ROS# is a set of open source software libraries and tools in C# for communicating with ROS from .NET applications, in particular Unity.
Here are some showcases illustrating what can be done with ROS#. Community provided a variety of other application examples for ROS# here. Please don't hesitate to post yours!
This fork has some changes to allow ROS# to be used in UWP projects, such as the Microsoft HoloLens. Like the main ROS# branch, use 2019.x or later.
Step 1: Clone this project
Step 2, Option 1: Open the Demo Project and copy its content. It is setup in a way, that it is buildable for UWP applications.
Step 2, Option 2: Follow these instructions:
- Create a new Unity Project or use an existing one
- Copy the RosSharp folder into the Assets Folder of your project
- Configure the RosSharpClientUWP.dll to be used for the WSA platform and disable it for all other platforms
- Configure the RosSharpClient.dll to be excluded for the WSA platform.
- Configure the NewtonSoft.dll to be excluded from ALL platforms
- Copy the NewtonSoft AOT version into your project (e.g. Assets/Plugins)
It is important to keep the NewtonSoft.dll in the RosSharp/Plugins folder, to "trick" unity during development time that a compatible version of NewtonSoft is present. This version is not AOT compilable and will not work in UWP applications using the IL2CPP backend. When building the "Game" Unity ignores this "faulty" version of NewtonSoft and uses the AOT-Version of NewtonSoft instead, which will work.
With this setup your project should work in Editor Mode and in UWP-Mode.
How does this work under the hood? In brief, I wrote a UWP-compatible WebSocket interface for ROS#, created a UWP-compatible version of RosBridgeClient.dll, called RosBridgeClientUWP.dll, added that to the Unity Project, specified proper platforms for all .dlls, and edited RosConnector.cs to automatically use to the UWP WebSocket interface.
ROS# contains a solution in the Libraries folder, which contains a project called RosBridgeClient. In the Protocols folder, I created a UWP compatible WebSocket interface. Next, I wrapped all WebSocket protocol files in preprocessor directives so only the UWP compatible interface would be compiled in a UWP-build. Finally, I created a second project in the solution called RosBridgeClientUWP. I made it a Windows Universal class library project, and copied all of the RosBridgeClient code over as links. Copying as links means that editing the code in one location changes it in both. Finally, I built the solution.
If you want to make changes to the RosBridgeClient, like adding new messages, for instance, simply edit the code in the RosBridgeClient project (following the instructions from the main ROS# wiki), build the solution, and copy over the new RosBridgeClient.dll and RosBridgeClientUWP.dll.
This branch is compatible with Microsoft's Mixed Reality Toolkit. See the Preparing Unity Project Section.
Please see the Wiki, especially Section 3.2, for an explanation of how to use the new framework.
- Libraries: .NET solution for RosBridgeClient, Urdf and MessageGeneration
- ROS: ROS packages used by ROS#.
- Unity3D: Unity project containing
- Unity-specific extensions to RosBridgeClient and Urdf and MessageGeneration
- example scenes and reference code (see Wiki)
In addition to the source code, Releases contain:
- a Unity Asset Package containing the Unity3D project assets:
- to be imported in other Unity projects using ROS#.
- binaries of RosBridgeClient and Urdf
- to be used in other .NET projects using these libraries.
The latest release is also being published in the Unity Asset Store.
Please get the latest development version directly from the tip of this master branch.
ROS# is open source under the Apache 2.0 license and is free for commercial use.
RosBridgeClient requires:
- Newtonsoft.Json (MIT License)
- Newtonsoft.Json.Bson (MIT License)
- websocket-sharp (MIT License), required only when using WebSocketSharpProtocol
-
ROS# is developed for Windows and has successfully been used on a variety of other platforms community members.
-
The RosSharp Visual Studio solution requires .NET Framework 4.6 and Visual Studio 2017 or higher.
-
The Unity Project Unity3D requires Unity Version 2018.3 or higher. In Versions below 2019.3, make sure to set the scripting runtime version to
.NET 4.x Equivalent
(see Wiki page). -
Please find a UWP version of ROS# here.
-
Please find a .NET Standard 2.0 version of UrdfImporter here.
© Siemens AG, 2017-2020
Author: Dr. Martin Bischoff ([email protected])