[ros-users] ROS C#

Zsolt Szabo szabo.zsolt at nik.uni-obuda.hu
Sun Jul 20 20:17:15 UTC 2014


Dear ROS Community,

First of all, let me say hello. I am Zsolt Szabo from Obuda University  
(Budapest, Hungary). Our department has recently bought a Turtlebot2 robot  
(and another department from the uni has a Nao, if I am correct) - both is  
running ROS.

However, students in our faculty mainly learn C# (with a little (very  
little) java). Of course, you can say that they should use rosjava, or  
learn a proper programming language instead. However, it is not for us to  
question their choice. The fact is that most of the students know only C#  
and I plan to make it possible for them to work with ROS using C#, somehow.

I checked the official roscs, but it is very old and uses heavily some cpp  
middleware. Also, the code is funny on some places. So instead I started  
messing around, and managed to create a lightweight (~2K) cpp middleware  
that allowes sending fixed-size text messages between c# ROS nodes.  
However, sending complex (struct) messages, this poses a problem.

Without a middleware, I do not think that it is possible, as the mono  
documentation says <quote>This makes it nearly impossible to directly  
invoke functions that are not C ABI compatible, such as C++ library  
functions that are not extern "C".</quote>

Another solution I tried is re-implementing the big ROS api itself, but to  
be honest I did not put too much effort into this one. I checked the  
Master API ( http://wiki.ros.org/ROS/Master_API ), I managed to execute  
the getSystemState via XMLRPC, but I got stuck at the registerSubscriber  
call, because the ROS documentation says "the subscriber will also receive  
notifications of new publishers via the publisherUpdate API" , and I found  
absolutely ZERO documentation about the publisherUpdate API ...

So to access ROS from c#, I think we have the following three  
possibilities; these pose three nice questions:

1) try to use and modify the old roscs ==> QUESTION: any  
details/documentation about the current roscs implementation? Does anyone  
have any clue about the code structure and about the reason behind the  
quarks in the .cs code (e.g. MessageField.cs freaks me out A LOT)

2) implement a new roscs with this lightweight cpp middleware using  
converters or something similar to support more complex messages. ==>  
QUESTION: do you think this is doable? Right now, to pass non-text  
messages, I managed to give the absolute pointer of the data from the cpp  
middleware to the c# code. But I do not think that a cpp code and a c#  
code sharing the same pointer is a wise idea...

3) implement a new roscs without a cpp middleware (just like rosjava),  
with XMLRPC + TCPROS support. ==> QUESTION: do you think this is doable /  
worthwhile? QUESTION: can anyone point me to the proper protocol  
specifications? the ones I found at the ROS wiki seem kinda stripped down  
and short.

Sorry for the long mail, and thank you all for your help and suggestions.

Yours,
Zsolt Szabo


More information about the ros-users mailing list