Skip to content

MischaRo/ros2_dotnet

 
 

Repository files navigation

ROS2 for .NET

Build status

Target Status
Universal Windows Platform (x86) Build status
Universal Windows Platform (x64) Build status
Universal Windows Platform (ARM) Build status
Windows Desktop Build status

Introduction

This is a collection of projects (bindings, code generator, examples and more) for writing ROS2 applications for .NET Core and .NET Standard.

Features

The current set of features include:

  • Generation of all builtin ROS types
  • Support for publishers and subscriptions
  • Cross-platform support (Linux, Windows, Windows IoT Core, UWP)

What's missing?

Lots of things!

  • Nested types
  • Component nodes
  • Clients and services
  • Tests
  • Documentation
  • More examples (e.g. IoT, VB, UWP, HoloLens, etc.)

Sounds great, how can I try this out?

First of all install the standard ROS2 dependencies for your operating system of choice https://github.com/ros2/ros2/wiki/Installation#building-from-source

Next make sure you've either installed .Net Core (preferred) https://www.microsoft.com/net/learn/get-started or Mono https://www.mono-project.com/

The following steps show how to build the examples on Windows and Linux:

Windows (Desktop)

md \dev\ros2_dotnet_ws\src
cd \dev\ros2_dotnet_ws
wget https://raw.githubusercontent.com/esteve/ros2_dotnet/master/ros2_dotnet.repos
vcs import \dev\ros2_dotnet_ws\src < ros2_dotnet.repos
src\ament\ament_tools\scripts\ament.py build

Linux

mkdir -p ~/ros2_dotnet_ws/src
cd ~/ros2_dotnet_ws
wget https://raw.githubusercontent.com/esteve/ros2_dotnet/master/ros2_dotnet.repos
vcs import ~/ros2_dotnet_ws/src < ros2_dotnet.repos
src/ament/ament_tools/scripts/ament.py build

Universal Windows Platform (ARM, Win32, Win64)

We'll build this in two steps, first ament (the build system) and then ROS2 itself. This is because ament will run on the host platform, whereas ros2-dotnet on the target.

ament

md \dev\ament\src
cd \dev\ament
curl -sk https://raw.githubusercontent.com/esteve/ros2_dotnet/%BUILD_SOURCEBRANCHNAME%/ament_dotnet_uwp.repos -o ament_dotnet_uwp.repos
vcs import src < ament_dotnet_uwp.repos
python src\ament\ament_tools\scripts\ament.py build --cmake-args -G "Visual Studio 15 2017 Win64" --
call install\local_setup.bat

UWP

Replace %TARGET_GENERATOR% with "Visual Studio 15 2017" for Win32, "Visual Studio 15 2017 Win64" for Win64 and "Visual Studio 15 2017 ARM" for ARM

md \dev\ros2\src
cd \dev\ros2
curl -sk https://raw.githubusercontent.com/esteve/ros2_dotnet/%BUILD_SOURCEBRANCHNAME%/ros2_dotnet_uwp.repos -o ros2_dotnet_uwp.repos
vcs import src < ros2_dotnet_uwp.repos
cd \dev\ament
call install\local_setup.bat
cd \dev\ros2
ament build --parallel --cmake-args -G "%TARGET_GENERATOR%" -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0.14393 -DTHIRDPARTY=ON -DINSTALL_EXAMPLES=OFF -DCMAKE_FIND_ROOT_PATH="\dev\ament\install;\dev\ros2\install" --

Now you can just run a bunch of examples.

Publisher and subscriber

Publisher:

Windows

call \dev\ros2_dotnet_ws\install\local_setup.bat

ros2 run rcldotnet_examples rcldotnet_talker

Linux

. ~/ros2_dotnet_ws/install/local_setup.sh

ros2 run rcldotnet_examples rcldotnet_talker

Subscriber:

Windows

call \dev\ros2_dotnet_ws\install\local_setup.bat

ros2 run rcldotnet_examples rcldotnet_listener

Linux

. ~/ros2_dotnet_ws/install/local_setup.sh

ros2 run rcldotnet_examples rcldotnet_listener

Enjoy!

About

.NET bindings for ROS2

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 40.7%
  • CMake 21.4%
  • C 13.8%
  • Python 11.1%
  • EmberScript 11.1%
  • Batchfile 1.9%