Hi,
Been working with the Tinkerforge system as a prototyping platform for a commercial product. Very well designed and easy system to work with but the .Net bindings are tied to some legacy framework versions and quite 'ugly' with the requirement for 'out' variables etc.
I have just released a new set of bindings with three big updates.
Firstly there is full support for ValueTuple returns on all functions with full property naming. It allows calls like
var result = imu.GetAllData();
var accel = result.Acceleration;
var angles = result.EulerAngle;
rather than having to deal with multiple 'out' variables.
There is also a fully async version of every call implemented using the Async/Await pattern. The IPConnection class implements all socket send and receive calls asynchronously and there are async overrides of each available call. The combined effect is that the above example can be written as
var resultAsync = await imu.GetAllDataAsync();
var accel = resultAsync.Acceleration;
var angles = resultAsync.EulerAngle;
This code is properly async and not just wrapping synchronous calls in Task.Run().
The last addition is the use of Reactive.Linq and a full set of extension methods to allow the use of IObservable on every brick or bricklet callback. RX Extensions allow a composable and functional approach to streams of data.
Time shifting of sequences, buffering, throttling and all sorts of manipulations become very easy with a Linq based approach. The underlying callback event is converted to an IObservable and the disposal of event handlers is all handled automatically.
The example below subscribes to a stream of data coming from the imu but it's 'throttled' to only produce data every 500 milliseconds regardless of the incoming rate from the brick.
imu.WhenOrientation()
.Sample(TimeSpan.FromMilliseconds(500))
.Subscribe(async v =>
{
Console.WriteLine($"Heading: {v.Heading}");
await Log.WriteAsync($"Roll: {v.Roll}");
});
The nuget package is available at
https://www.nuget.org/packages/FiftyOneNorth.Tinkerforge/ (FiftyOneNorth.Tinkerforge)
The complete set of bricks and bricklets are covered and I will try and maintain compatibility with future releases. Keen to hear other's experiences and hope it's useful to someone
Thanks,
Steve Hayles
Fifty One North Ltd