/ros-sharp

ROS# is a set of open source software libraries and tools in C# for communicating with ROS from .NET applications, in particular Unity3D

Primary LanguageC#Apache License 2.0Apache-2.0

ROS#

ROS# is a set of open source software libraries and tools in C# for communicating with ROS from .NET applications, in particular Unity.

Find some examples what you can do with ROS# here.

Notes On This Fork

This fork has implemented changes to the repo to enable building to UWP devices, like the Microsoft HoloLens. Like the main ROS# branch, use 2018.2 or later.

Installation

To use ROS# with the HoloLens, simply clone this fork and stay on the master branch. Then open the Unity project and import the Microsoft Mixed Reality Toolkit. The toolkit provides a version of Newtonsoft.Json that works on the HoloLens, as well as other tools/features you will want during HoloLens development. Follow the Mixed Reality Toolkit configuration instructions, and you will be good to go.

Architecture

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.

Creating RosBridgeClientUWP.dll

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, build the solution.

Preparing the Unity Project

In the ROS# Unity project, I first installed the Mixed Reality Toolkit and followed their configuration instructions. Next, in RosSharp/Plugins, I deselected all platforms from Newtonsoft.Json, and excluded WSAPlayer from all others. Next, I copied over the RosBridgeClientUWP.dll into RosSharp/Plugins, and selected WSAPlayer as the only platform. Finally, I modified RosConnector.cs, using preprocessor directives to make Unity use the WebSocketUWP protocol if WINDOWS_UWP is defined.

Making Changes

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.

Compatibile With Mixed Reality Toolkit

This branch is compatible with Microsoft's Mixed Reality Toolkit. See the Preparing Unity Project Section.

Recent Changes

This commit comes with major changes in how ROS# deals with URDF import/export

The biggest changes are:

  • Urdf Libary: The UrdfImporter project was renamed to Urdf. It now supports the ability to both read from and write to URDF files.
  • Create, Modify, and Export URDF models in Unity: ROS# now supports creating and exporting URDF models directly in Unity. It is also possible to modify and re-export an existing URDF model.
  • Transfer URDF files from Unity to ROS: Previously it was only possible to transfer/import URDF files from ROS to Unity. Now ROS# can send a URDF and all its meshes from Unity to a package in ROS.

Please see the Wiki, especially section 3.2, for an explanation of how to use the new framework.

Contents

Releases

In addition to the source code, Releases contain:

The latest release is also being published in the Unity Asset Store.

Please get the development version with latest changes and fixes directly from the tip of this master branch.

Licensing

ROS# is open source under the Apache 2.0 license and is free for commercial use.

External Dependencies

RosBridgeClient requires:

Platform Support

  • ROS# is developed for Windows and has successfully been used on Linux and iOS by community members.

  • The RosSharp solution requires .NET Framework 4.6 and Visual Studio 2017 to compile.

  • The Unity Project Unity3D requires Unity 2018.x. 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.

Further Info


© Siemens AG, 2017-2018

Author: Dr. Martin Bischoff (martin.bischoff@siemens.com)