Skip to content

Commit

Permalink
Update to SDK 0.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
codaris committed Aug 16, 2020
1 parent cd31bf0 commit 7e66328
Show file tree
Hide file tree
Showing 23 changed files with 135 additions and 120 deletions.
2 changes: 1 addition & 1 deletion ReserveControl/ReserveControl.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Anki.Vector.SDK" Version="0.6.7" />
<PackageReference Include="Anki.Vector.SDK" Version="0.7.0" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion Tutorial_01_HelloWorld/Tutorial_01_HelloWorld.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Anki.Vector.SDK" Version="0.6.7" />
<PackageReference Include="Anki.Vector.SDK" Version="0.7.0" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion Tutorial_02_DriveSquare/Tutorial_02_DriveSquare.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Anki.Vector.SDK" Version="0.6.7" />
<PackageReference Include="Anki.Vector.SDK" Version="0.7.0" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion Tutorial_03_Motors/Tutorial_03_Motors.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Anki.Vector.SDK" Version="0.6.7" />
<PackageReference Include="Anki.Vector.SDK" Version="0.7.0" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion Tutorial_04_Animation/Tutorial_04_Animation.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Anki.Vector.SDK" Version="0.6.7" />
<PackageReference Include="Anki.Vector.SDK" Version="0.7.0" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Anki.Vector.SDK" Version="0.6.7" />
<PackageReference Include="Anki.Vector.SDK" Version="0.7.0" />
</ItemGroup>

</Project>
21 changes: 18 additions & 3 deletions Tutorial_06_FaceImage/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
using Anki.Vector;
using Anki.Vector.Types;
Expand All @@ -23,13 +24,12 @@ public static async Task Main()
{
// Get image
using var resourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Tutorial_06_FaceImage.cozmo_image.jpg");
using var image = Image.Load<Rgb24>(resourceStream);
using var image = SixLabors.ImageSharp.Image.Load<Rgb24>(resourceStream);

// Create a new connection to the first configured Vector
using var robot = await Robot.NewConnection();

// Data in Rgb24 format
var data = MemoryMarshal.AsBytes(image.GetPixelSpan()).ToArray();
var data = ConvertImageToByteArray(image);

Console.WriteLine("Requesting control of Vector...");
await robot.Control.RequestControl();
Expand All @@ -42,5 +42,20 @@ public static async Task Main()
await robot.Screen.DisplayImageRgb24(data, 5000);
await Task.Delay(5000);
}

/// <summary>
/// Converts the image data to a byte array
/// </summary>
/// <param name="image">The image.</param>
/// <returns></returns>
/// <exception cref="NotSupportedException">Cannot extract pixel data from image.</exception>
private static byte[] ConvertImageToByteArray(Image<Rgb24> image)
{
if (image.TryGetSinglePixelSpan(out var pixelSpan))
{
return MemoryMarshal.AsBytes(pixelSpan).ToArray();
}
throw new NotSupportedException("Cannot extract pixel data from image.");
}
}
}
4 changes: 2 additions & 2 deletions Tutorial_06_FaceImage/Tutorial_06_FaceImage.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Anki.Vector.SDK" Version="0.6.7" />
<PackageReference Include="SixLabors.ImageSharp" Version="1.0.0-beta0006" />
<PackageReference Include="Anki.Vector.SDK" Version="0.7.0" />
<PackageReference Include="SixLabors.ImageSharp" Version="1.0.0" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion Tutorial_07_DockWithCube/Tutorial_07_DockWithCube.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Anki.Vector.SDK" Version="0.6.7" />
<PackageReference Include="Anki.Vector.SDK" Version="0.7.0" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion Tutorial_08_DownloadPhoto/Tutorial_08_DownloadPhoto.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Anki.Vector.SDK" Version="0.6.7" />
<PackageReference Include="Anki.Vector.SDK" Version="0.7.0" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion Tutorial_09_EyeColor/Tutorial_09_EyeColor.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Anki.Vector.SDK" Version="0.6.7" />
<PackageReference Include="Anki.Vector.SDK" Version="0.7.0" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion Tutorial_10_PlayAudio/Tutorial_10_PlayAudio.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Anki.Vector.SDK" Version="0.6.7" />
<PackageReference Include="Anki.Vector.SDK" Version="0.7.0" />
<PackageReference Include="NAudio" Version="1.10.0" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Anki.Vector.SDK" Version="0.6.7" />
<PackageReference Include="Anki.Vector.SDK" Version="0.7.0" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Anki.Vector.SDK" Version="0.6.7" />
<PackageReference Include="Anki.Vector.SDK" Version="0.7.0" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion Tutorial_13_UserIntent/Tutorial_13_UserIntent.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Anki.Vector.SDK" Version="0.6.7" />
<PackageReference Include="Anki.Vector.SDK" Version="0.7.0" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion Tutorial_14_FaceEvent/Tutorial_14_FaceEvent.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Anki.Vector.SDK" Version="0.6.7" />
<PackageReference Include="Anki.Vector.SDK" Version="0.7.0" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion Tutorial_15_FaceFollower/Tutorial_15_FaceFollower.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Anki.Vector.SDK" Version="0.6.7" />
<PackageReference Include="Anki.Vector.SDK" Version="0.7.0" />
</ItemGroup>

</Project>
60 changes: 30 additions & 30 deletions Tutorial_16_FeatureStatus/Program.cs
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
// <copyright file="Program.cs" company="Wayne Venables">
// Copyright (c) 2019 Wayne Venables. All rights reserved.
// </copyright>

using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Anki.Vector;

namespace Tutorial_16_FeatureStatus
{
class Program
{
/// <summary>
/// Return information about the features that Vector's AI is using
/// </summary>
static async Task Main()
{
using var robot = await Robot.NewConnection();
// <copyright file="Program.cs" company="Wayne Venables">
// Copyright (c) 2019 Wayne Venables. All rights reserved.
// </copyright>

robot.Events.FeatureStatus += (sender, e) =>
{
Console.WriteLine($"FeatureStatus: intent {e.FeatureName}");
Console.WriteLine(e.Source);
};

Console.WriteLine("Vector is waiting for a voice command like 'Hey Vector! What time is it?' Press any key to exit...");
await Task.Run(() => Console.ReadKey(true));
}
}
}
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Anki.Vector;

namespace Tutorial_16_FeatureStatus
{
class Program
{
/// <summary>
/// Return information about the features that Vector's AI is using
/// </summary>
static async Task Main()
{
using var robot = await Robot.NewConnection();

robot.Events.FeatureStatus += (sender, e) =>
{
Console.WriteLine($"FeatureStatus: intent {e.FeatureName}");
Console.WriteLine(e.Source);
};

Console.WriteLine("Vector is waiting for a voice command like 'Hey Vector! What time is it?' Press any key to exit...");
await Task.Run(() => Console.ReadKey(true));
}
}
}
2 changes: 1 addition & 1 deletion Tutorial_16_FeatureStatus/Tutorial_16_FeatureStatus.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Anki.Vector.SDK" Version="0.6.7" />
<PackageReference Include="Anki.Vector.SDK" Version="0.7.0" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion Tutorial_17_AppIntent/Tutorial_17_AppIntent.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Anki.Vector.SDK" Version="0.6.7" />
<PackageReference Include="Anki.Vector.SDK" Version="0.7.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading

0 comments on commit 7e66328

Please sign in to comment.