Darp.Fairino
0.7.0
dotnet add package Darp.Fairino --version 0.7.0
NuGet\Install-Package Darp.Fairino -Version 0.7.0
<PackageReference Include="Darp.Fairino" Version="0.7.0" />
<PackageVersion Include="Darp.Fairino" Version="0.7.0" />
<PackageReference Include="Darp.Fairino" />
paket add Darp.Fairino --version 0.7.0
#r "nuget: Darp.Fairino, 0.7.0"
#:package Darp.Fairino@0.7.0
#addin nuget:?package=Darp.Fairino&version=0.7.0
#tool nuget:?package=Darp.Fairino&version=0.7.0
Darp.Fairino
Darp.Fairino is a modern async .NET SDK for Fairino robot controllers.
It provides typed command helpers, realtime-state feedback, dependency injection registration, and a Result<..., FairinoError> failure model for controller and transport errors.
The SDK is developed and tested against Fairino robot software v3.9.5, which is also the minimum supported version.
Install
dotnet add package Darp.Fairino
The package currently targets net10.0.
Quick Start
using Darp.Fairino;
using Darp.Fairino.DependencyInjection;
using Darp.Results;
using Microsoft.Extensions.DependencyInjection;
var services = new ServiceCollection();
services.AddFairinoRobot();
await using ServiceProvider provider = services.BuildServiceProvider();
await using FairinoRobot robot = provider.GetRequiredService<FairinoRobot>();
// The realtime states are fixed for the life of the connection; pass null for a command-only connection.
var realtimeStates = new FairinoRobotStateConfiguration(
[FairinoRobotStates.JointCurPos, FairinoRobotStates.MotionDone],
TimeSpan.FromMilliseconds(8));
Result<Success, FairinoError> connectResult = await robot.ConnectAsync("192.168.58.2", realtimeStates);
if (connectResult.TryGetError(out FairinoError? connectError))
{
Console.WriteLine($"Connection failed: {connectError.Message}");
return;
}
Result<SoftwareVersion, FairinoError> versionResult = await robot.GetSoftwareVersionAsync();
if (versionResult.TryGetValue(out SoftwareVersion version, out FairinoError? versionError))
{
Console.WriteLine($"Robot model: {version.RobotModel}");
Console.WriteLine($"Web version: {version.WebVersion}");
Console.WriteLine($"Controller version: {version.ControllerVersion}");
}
else
{
Console.WriteLine($"Version query failed: {versionError.Message}");
}
await robot.DisconnectAsync();
Only connect to a reachable controller on a trusted local network.
Geometry and units
Motion and kinematics methods use JointPos and Aardvark transforms:
| Value | Input | Result | Units |
|---|---|---|---|
| Six joint angles | JointPos |
JointPos |
Radians |
| TCP, flange or offset pose | Euclidean3d |
Euclidean3d |
Metres, quaternion rotation |
The SDK follows Fairino's controller coordinate definitions.
It converts to the controller's millimetres and degrees when sending commands
and converts responses back. GetActualJointPosAsync replaces
GetActualJointPosDegreeAsync. Optional pose offsets accept null for identity.
using Aardvark.Base;
var result = await robot.GetActualTcpPoseAsync();
if (result.TryGetValue(out Euclidean3d pose, out var error))
Console.WriteLine($"TCP in metres: {pose.Trans}");
External-axis coordinates, force/torque records, scalar motion options and raw telemetry arrays retain their documented controller units.
Local kinematics
The package embeds a URDF for each supported robot model, for use with
Darp.Kinematics. GetDhCompensationAsync reads the calibration of the
connected robot, which converts to the DH offset table that Darp.Kinematics expects:
using Darp.Kinematics;
DhCompensation compensation = (await robot.GetDhCompensationAsync()).Unwrap();
IKinematics kinematics = SerialKinematics.ParseEmbeddedUrdf(
typeof(FairinoRobot).Assembly,
"Darp.Fairino.Models.fr5_v6.urdf",
"base_link",
"flange",
compensation
);
| Robot | Resource | Links |
|---|---|---|
| FR5 V6 | Darp.Fairino.Models.fr5_v6.urdf |
base_link to flange |
The local model calculates the pose of the flange. The controller calculates the pose of the active TCP,
so multiply with GetTcpOffsetAsync to compare the two.
Configuration
FairinoRobotOptions holds the command timeout and the controller ports. Transport internals such as the reconnect policy are managed by the SDK.
services.AddFairinoRobot(options =>
{
options.CommandTimeout = TimeSpan.FromSeconds(30);
options.StatePort = 20005;
});
API Shape
The Fairino C# SDK manual can be used as a reference for available controller operations. In Darp.Fairino, methods are async and use an Async suffix.
Failure Model
SDK operations return operational failures as Result<..., FairinoError>. This includes robot error codes, network failures, protocol errors, timeouts, and not-connected states.
Caller cancellation throws OperationCanceledException, and invalid arguments throw the usual .NET argument exceptions.
Connection State
FairinoRobot.ConnectionState describes the realtime-state connection, which is the only persistent connection to the controller. A lost connection is recovered automatically until DisconnectAsync is called, and the realtime states passed to ConnectAsync are re-applied before the state returns to Connected. Changing the realtime states means disconnecting and connecting again.
using IDisposable subscription = robot
.WhenConnectionStateChanged()
.Subscribe(state => Console.WriteLine($"Robot connection: {state}"));
While the connection is being recovered, state reads fail with FairinoErrorMessages.NotConnected, and a state read that was already waiting fails with FairinoErrorMessages.ConnectionLost.
XML-RPC commands and UDP commands do not use this connection. They are neither rejected nor cancelled during a recovery, and a UDP command such as ServoJAsync still reports success. The SDK cannot tell a network interruption from a controller restart, so re-check the robot after a recovery and restart a servo session if one was active.
Build
dotnet restore Darp.Fairino.slnx
dotnet build Darp.Fairino.slnx --no-restore
dotnet pack src/Darp.Fairino/Darp.Fairino.csproj --no-build
License
This project is licensed under the Apache License 2.0. See LICENSE.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Aardvark.Base (>= 5.3.27)
- Darp.Results (>= 1.9.0)
- Dunet (>= 1.16.2)
- Microsoft.Extensions.DependencyInjection (>= 10.0.10)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.10)
- Microsoft.Extensions.Http (>= 10.0.8)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.8)
- Serilog (>= 4.4.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.