Skip to content

Latest commit

 

History

History
86 lines (60 loc) · 6.49 KB

README.md

File metadata and controls

86 lines (60 loc) · 6.49 KB

ROS#

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!

UWP / HoloLens

Notes On This Fork

This fork has some changes to allow ROS# to be used in UWP projects, such as the Microsoft HoloLens (1 & 2 - tested and deployed successfully). Like the main ROS# branch, use 2019.x or later.

How to get started

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 and should work right out of the box.

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 RosBridgeClientUWP.dll to be used for the WSA platform and disable it for all other platforms
  • Configure the RosBridgeClient.dll to be excluded for the WSA platform.
  • Copy the NewtonSoft AOT version into your project (e.g. Assets/Plugins) You don't have to configure any targetplatforms as with the RosBridgeclient(UWP) dlls, since they should be configured correctly. The original source of this is here

It is important that the link.xml file is somewhere within the /Assets/ folder of the Unity Project. The reasons for that are described here. Basically, Unity's IL2CPP compiler strips away unused code. Since RosSharp works with classes that are never really used but only serialized to be sent via WebSockets, many of these "unused" fields and properties are removed, resulting in (almost) empty json-strings. The link.xml file tells Unity's IL2CPP compiler to not strip any code from the specified assemblies.

With this setup your project should work in Editor Mode and in UWP-Mode.

The simple Demo-App subscribes to the /clock topic and displays the values received. This was successfully deployed to HoloLens 2 deployed RosSharp UWP to HoloLens2

How it works

There are four main changes to the original Ros-Sharp repository

  1. AOT compilability The original RosSharp uses reflection and the normal NewtonSoft Json library, which are not AOT compilable and fail to work after Unity's IL2CPP compiler process the files. There were some changes made to the library to not use reflection, and also a AOT compilable version of NewtonSoft Json is included in the Demo-Project
  2. Websockets Prev. another than the default version for Websockets was needed, but the newer version of WebSocketSharp works fine for UWP projecst
  3. UWP DLL The DLL was created by creating a UWP class library project, and then linking all folders from the original library. The including part is done in the project file. Obj, Bin and Properties folders were of course excluded.
  4. Compiler constants / defines Some parts of the library and Unity Scripts needed some platform specific code, which was done with the "WINDOWS_UWP" compiler constant.

Compatibile With Mixed Reality Toolkit

This branch is compatible with Microsoft's Mixed Reality Toolkit. Tested with v. 2.4 and 2.3

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

Contents

Licensing

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

External Dependencies

RosBridgeClient and UWP requires:

Further Info


© Siemens AG, 2017-2020

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