Skip to content

armlabstanford/ros-sharp

 
 

Repository files navigation

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 2019.x 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. I use the 2017 version of MRTK, not vNext.

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, I built 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 latest development version directly from the tip of this master branch.

Unity Robotics Hub

In 11/2020 Unity launched Unity Robotics Hub and included a major part of ROS#.

We are in close contact with the developers and decided to run both initiatives in parallel.

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 a variety of other platforms community members.

  • The RosSharp Visual Studio solution requires .NET Framework 4.6.1 and Visual Studio 2017 or higher.

  • The Unity Project Unity3D has been developed with Unity Version 2019.4.18f (LTS) and should be compatible also with older versions. 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.

Further Info


© Siemens AG, 2017-2021

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

About

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

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 97.1%
  • CMake 1.9%
  • Other 1.0%