RobotRaconteur.Sharp
0.22.4
dotnet add package RobotRaconteur.Sharp --version 0.22.4
NuGet\Install-Package RobotRaconteur.Sharp -Version 0.22.4
<PackageReference Include="RobotRaconteur.Sharp" Version="0.22.4" />
<PackageVersion Include="RobotRaconteur.Sharp" Version="0.22.4" />
<PackageReference Include="RobotRaconteur.Sharp" />
paket add RobotRaconteur.Sharp --version 0.22.4
#r "nuget: RobotRaconteur.Sharp, 0.22.4"
#:package RobotRaconteur.Sharp@0.22.4
#addin nuget:?package=RobotRaconteur.Sharp&version=0.22.4
#tool nuget:?package=RobotRaconteur.Sharp&version=0.22.4
RobotRaconteur.Sharp
RobotRaconteur.Sharp is a pure C# implementation of the Robot Raconteur framework for use with .NET Core
Github Repository: https://github.com/robotraconteur/RobotRaconteur.Sharp
Introduction
Robot Raconteur is a communication framework for robotics, automation, and the Internet of Things. RobotRaconteur.Sharp is an implementation of Robot Raconteur developed in pure C#. This is in contrast to RobotRaconteurNET, which is a wrapper for the native RobotRaconteurCore implementation that is developed in C++. RobotRaconteur.Sharp can be used with ASP.NET web servers using WebSockets (see the ASP.NET Core server example), allowing for Robot Raconteur to be easily integrated into cloud and information systems without requiring any modifications to clients.
RobotRaconteur.Sharp was formerly named RobotRaconteurWeb. The namespace is RobotRaconteurSharp.
RobotRaconteur.Sharp uses async/await for all blocking operations, making it easy to use with C# projects. Unlike RobotRaconteurNET, there are no blocking functions available.
Installation
For most platforms, the easiest way to install Robot Raconteur is using dotnet:
dotnet add package RobotRaconteur.Sharp
RobotRaconteur.Sharp is a pure C# netstandard2.1 library, making it very portable and easy to use with .NET Core.
Code Generation
RobotRaconteur.Sharp uses service definition files (*.robdef) to define the available services and data types. These files are used to generate C# code for RobotRaconteur.Sharp using the RobotRaconteur.Sharp.Gen tool. It can be installed using the following command:
dotnet tool install --global RobotRaconteur.Sharp.Gen
The RobotRaconteur.Sharp nuget package provides build integration to automatically generate the code when the project is built. The following 'ItemGroup' can be added to the project file to specify the service definition files:
<ItemGroup>
<RobotRaconteurGenCSharp Include="path/to/robdef/experimental.my_service.robdef" />
</ItemGroup>
The item types <RobotRaconteurIncludeCSharp> can be used to "include" a robdef without generating the code. This is useful
when a service definition file is included in another file. The <RobotRaconteurGenIncludePath> can be
used to specify a directory containing robdef files to include. Files in this path will be "auto-imported" if they
are included in another robdef file.
Documentation
See the RobotRaconteur.Sharp Documentation
See the RobotRaconteur.Sharp Examples
Example
This example demonstrates a simple client for the Reynard the Robot cartoon robot. See Reynard the Robot for more information and setup instructions.
In a terminal,run the following command to start the Reynard the Robot server:
python -m reynard_the_robot
On Linux, you may need to use python3 instead of python.
Open a browser to http://localhost:29201 to view the Reynard user interface.
The following is an example RobotRaconteur.Sharp C# client for Reynard the Robot:
using System;
using System.Threading;
using System.Threading.Tasks;
using RobotRaconteurSharp;
// Initialize the client node
using (var node_setup = new ClientNodeSetup(args: args))
{
// Connect to the Reynard service using a URL
var c = (experimental.reynard_the_robot.Reynard)await RobotRaconteurNode.s.ConnectService(
"rr+tcp://localhost:29200?service=reynard");
// Teleport the robot
await c.teleport(0.1, -0.2);
// Drive the robot with no timeout
await c.drive_robot(0.5, -0.2, -1, false);
// Wait for one second
await Task.Delay(1000);
// Stop the robot
await c.drive_robot(0, 0, -1, false);
// Set the arm position
await c.setf_arm_position(100.0 * (Math.PI / 180), -30 * (Math.PI / 180), -70 * (Math.PI / 180));
// Set the color to red
await c.set_color(new double[] { 1.0, 0.0, 0.0 });
// Say hello
await c.say("Hello, World From C#!");
}
Blazor WebAssembly
Raw sockets and most file system access are not available in the browser, so ClientNodeSetup, TcpTransport
and LocalTransport cannot be used in Blazor WebAssembly. Use BrowserWebSocketTransport instead. It connects to
services over WebSockets using rr+ws and rr+wss URLs. Register the generated service factories explicitly,
because Blazor trimming may remove types found by assembly scanning.
var node = RobotRaconteurNode.s;
node.RegisterServiceType(new experimental.reynard_the_robot.experimental__reynard_the_robotFactory(node));
node.RegisterTransport(new BrowserWebSocketTransport(node));
var c = (experimental.reynard_the_robot.Reynard)await node.ConnectService(
"rr+ws://localhost:29200?service=reynard");
The service must accept WebSocket connections. TcpTransport servers accept them by default, but they only
accept browser connections from a few known origins. Allow the origin your Blazor app is served from on the
server, for example tcp_transport.AddWebSocketAllowedOrigin("https://myapp.example.com").
test/RobotRaconteur.Sharp.BlazorTest in the repository runs the client service tests in Chromium, Firefox and
WebKit using Playwright.
License
Apache 2.0
Support
Please report bugs and issues on the GitHub issue tracker.
Ask questions on the Github discussions.
Acknowledgment
This work was supported in part by Subaward No. ARM-TEC-18-01-F-19 and ARM-TEC-19-01-F-24 from the Advanced Robotics for Manufacturing ("ARM") Institute under Agreement Number W911NF-17-3-0004 sponsored by the Office of the Secretary of Defense. ARM Project Management was provided by Christopher Adams. The views and conclusions contained in this document are those of the authors and should not be interpreted as representing the official policies, either expressed or implied, of either ARM or the Office of the Secretary of Defense of the U.S. Government. The U.S. Government is authorized to reproduce and distribute reprints for Government purposes, notwithstanding any copyright notation herein.
This work was supported in part by the New York State Empire State Development Division of Science, Technology and Innovation (NYSTAR) under contract C160142.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. 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. |
| .NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.1 is compatible. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- Mono.Options (>= 6.12.0.148)
- Mono.Posix.NETStandard (>= 1.0.0)
- System.IO.FileSystem.AccessControl (>= 5.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.