[Discourse.ros.org] [Next Generation ROS] ROS2 on microcontrollers with RIOT

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

[Discourse.ros.org] [Next Generation ROS] ROS2 on microcontrollers with RIOT

Dirk Thomas via ros-users



Hello !

I am studying the possibility of porting ros2 to RIOT.

To begin wiith, I have seen a (very old) fork of RIOT on the ros2 organisation.
Is there someone who works (or worked) on that ?

Cheers !






---
[Visit Topic](https://discourse.ros.org/t/ros2-on-microcontrollers-with-riot/1293/1) or reply to this email to respond.


If you do not want to receive messages from ros-users please use the unsubscribe link below. If you use the one above, you will stop all of ros-users from receiving updates.
______________________________________________________________________________
ros-users mailing list
[hidden email]
http://lists.ros.org/mailman/listinfo/ros-users
Unsubscribe: <http://lists.ros.org/mailman//options/ros-users>
Reply | Threaded
Open this post in threaded view
|

[Discourse.ros.org] [Next Generation ROS] ROS2 on microcontrollers with RIOT

Dirk Thomas via ros-users



Hi @astralien3000,

The fork you referred to is available [here](https://github.com/ros2/ros2_embedded_riot).

RIOT was indeed considered as one of the candidates to build up a prototype of a ROS 2 microcontroller-oriented framework however the prototype was finally built on top of NuttX instead. The resulting prototype is available [here](https://github.com/ros2/ros2_embedded_nuttx).






---
[Visit Topic](https://discourse.ros.org/t/ros2-on-microcontrollers-with-riot/1293/2) or reply to this email to respond.


If you do not want to receive messages from ros-users please use the unsubscribe link below. If you use the one above, you will stop all of ros-users from receiving updates.
______________________________________________________________________________
ros-users mailing list
[hidden email]
http://lists.ros.org/mailman/listinfo/ros-users
Unsubscribe: <http://lists.ros.org/mailman//options/ros-users>
Reply | Threaded
Open this post in threaded view
|

[Discourse.ros.org] [Next Generation ROS] ROS2 on microcontrollers with RIOT

Dirk Thomas via ros-users
In reply to this post by Dirk Thomas via ros-users



Hi @vmayoral,

Thanks for your answer.
After reviewing the [NuttX-based repository](https://github.com/ros2/ros2_embedded_nuttx), I have found that you were implementing a [very light rcl interface](https://github.com/ros2/ros2_embedded_nuttx/blob/master/rcl/rcl.h) compared to the ["normal" one](https://github.com/ros2/rcl/tree/master/rcl/include/rcl). The interfaces are even not compatible.
Is that a choice ? Or is it an early proof of concept interface that will tend to look like the "normal" interface ? Or am I completely wrong and this is not the code you are using ?






--
[Visit Topic](https://discourse.ros.org/t/ros2-on-microcontrollers-with-riot/1293/3) or reply to this email to respond.


If you do not want to receive messages from ros-users please use the unsubscribe link below. If you use the one above, you will stop all of ros-users from receiving updates.
______________________________________________________________________________
ros-users mailing list
[hidden email]
http://lists.ros.org/mailman/listinfo/ros-users
Unsubscribe: <http://lists.ros.org/mailman//options/ros-users>
Reply | Threaded
Open this post in threaded view
|

[Discourse.ros.org] [Next Generation ROS] ROS2 on microcontrollers with RIOT

Dirk Thomas via ros-users
In reply to this post by Dirk Thomas via ros-users



hi @astralien3000,

[quote="astralien3000, post:3, topic:1293"]
Or is it an early proof of concept interface that will tend to look like the "normal" interface
[/quote]

that was the case. At the time of writing, ROS 2 rcl was still being written and only a minimal set of interfaces were implemented.

The code is not actively maintained anymore but it should provide a good starting point for anyone with relevant interest in the topic of ROS 2 running in microcontrollers.






---
[Visit Topic](https://discourse.ros.org/t/ros2-on-microcontrollers-with-riot/1293/4) or reply to this email to respond.


If you do not want to receive messages from ros-users please use the unsubscribe link below. If you use the one above, you will stop all of ros-users from receiving updates.
______________________________________________________________________________
ros-users mailing list
[hidden email]
http://lists.ros.org/mailman/listinfo/ros-users
Unsubscribe: <http://lists.ros.org/mailman//options/ros-users>
Reply | Threaded
Open this post in threaded view
|

[Discourse.ros.org] [Next Generation ROS] ROS2 on microcontrollers with RIOT

Dirk Thomas via ros-users
In reply to this post by Dirk Thomas via ros-users


Hello !

I'm here to give you some news about my project of porting ROS2 to RIOT.
[I have a working proof-of-concept !](https://github.com/astralien3000/riot-ros2)

While porting the ROS2 code to RIOT, I implemented 2 new RMW which are not based on DDS :
 - using NDN
 - using MQTT-SN

To make it work on microcontrollers (they don't support the C++ standard used in rclcpp), I also implemented a part of rclc.

As a result, I was able to [make it work on a real robot](https://youtu.be/YvPssYSgLYY).

The hardware running the ROS2 nodes are two [ARM Cortex-M0+ boards](https://github.com/RIOT-OS/RIOT/wiki/Board%3A-SAMR21-xpro), with wireless communication. The microcontroller, ATSAMR21G18A, is quite small, with only 32Kb RAM and 256Kb Flash, compared to the 192Kb RAM and 1Mb Flash STM32F407IG used for the previous NuttX-based example.





---
[Visit Topic](https://discourse.ros.org/t/ros2-on-microcontrollers-with-riot/1293/5) or reply to this email to respond.


If you do not want to receive messages from ros-users please use the unsubscribe link below. If you use the one above, you will stop all of ros-users from receiving updates.
______________________________________________________________________________
ros-users mailing list
[hidden email]
http://lists.ros.org/mailman/listinfo/ros-users
Unsubscribe: <http://lists.ros.org/mailman//options/ros-users>
Reply | Threaded
Open this post in threaded view
|

[Discourse.ros.org] [Next Generation ROS] ROS2 on microcontrollers with RIOT

Dirk Thomas via ros-users
In reply to this post by Dirk Thomas via ros-users


That's really cool!

Did you have any trouble with code size? I recently looked the code sizes on a desktop machine and they were not huge, but still big for the micro you're using. There were some low hanging things we could optionally turn off to help with that. E.g. since all of our error strings are set through a macro we could compile them out. They actually account for a non-trivial portion of the code size at this point.

Did you have any trouble with rcl? I guess that there are some features creeping in that won't work on a micro (use of env variables and/or filesystem checks). This is mostly due to the security features which can be turned off at compile time, but I'm curious what else you might have needed to change to make it work.

Also, I don't see mention of `rcutils` anywhere, so I'm guess you're using an older release of ROS 2 rather than beta 2 or master?





---
[Visit Topic](https://discourse.ros.org/t/ros2-on-microcontrollers-with-riot/1293/6) or reply to this email to respond.


If you do not want to receive messages from ros-users please use the unsubscribe link below. If you use the one above, you will stop all of ros-users from receiving updates.
______________________________________________________________________________
ros-users mailing list
[hidden email]
http://lists.ros.org/mailman/listinfo/ros-users
Unsubscribe: <http://lists.ros.org/mailman//options/ros-users>
Reply | Threaded
Open this post in threaded view
|

[Discourse.ros.org] [Next Generation ROS] ROS2 on microcontrollers with RIOT

Dirk Thomas via ros-users
In reply to this post by Dirk Thomas via ros-users


Thanks ! ^^

[quote]
Did you have any trouble with code size?
[/quote]

Not so much. But of course this proof of concept is far from having all the features. Here are the current sizes :

 - For the NDN version :
RAM : ~12Kb
Flash : ~60Kb

 - For the MQTT-SN version :
RAM : ~18Kb
Flash : ~62Kb

For the whole OS, ROS2, and user application.
The RAM is not counting the heap used, but it takes in account the stack of the different threads.

[quote]
Also, I dont see mention of rcutils anywhere, so Im guess youre using an older release of ROS 2 rather than beta 2 or master?
[/quote]

I'm based on beta1, mainly because I could not use the ROS2 build system (microcontrollers + RIOT having it's own build system, hard time), and I needed some generated files (from rosidl) that were not compatible with the master branch at this time (February). It was more secure to base my work on a stable branch.

[quote]
Did you have any trouble with rcl?
[/quote]

Not so much. I just had to change the time.c implementation to use RIOT, and some warnings made my build system unhappy (mostly old-style function definition), but the rest was ok.

The most hard part I (still) have is with the rosidl/typesupport things, which prevent me to support any type but Strings.





---
[Visit Topic](https://discourse.ros.org/t/ros2-on-microcontrollers-with-riot/1293/7) or reply to this email to respond.


If you do not want to receive messages from ros-users please use the unsubscribe link below. If you use the one above, you will stop all of ros-users from receiving updates.
______________________________________________________________________________
ros-users mailing list
[hidden email]
http://lists.ros.org/mailman/listinfo/ros-users
Unsubscribe: <http://lists.ros.org/mailman//options/ros-users>
Reply | Threaded
Open this post in threaded view
|

[Discourse.ros.org] [Next Generation ROS] ROS2 on microcontrollers with RIOT

Dirk Thomas via ros-users
In reply to this post by Dirk Thomas via ros-users


Very interesting, thanks for sharing!

For the RAM and flash does that include a comms stack? (you mention wireless communications - is that serial?) We are looking at using Ethernet so we would need a TCP/IP stack. I noticed in the RIOT documentation it seems to be at least marginally supported, is there anything missing?

Which did you prefer using between the NDN and MQTT-SN protocols, ie: which would you use in the future?

Merci





---
[Visit Topic](https://discourse.ros.org/t/ros2-on-microcontrollers-with-riot/1293/8) or reply to this email to respond.


If you do not want to receive messages from ros-users please use the unsubscribe link below. If you use the one above, you will stop all of ros-users from receiving updates.
______________________________________________________________________________
ros-users mailing list
[hidden email]
http://lists.ros.org/mailman/listinfo/ros-users
Unsubscribe: <http://lists.ros.org/mailman//options/ros-users>
Reply | Threaded
Open this post in threaded view
|

[Discourse.ros.org] [Next Generation ROS] ROS2 on microcontrollers with RIOT

Dirk Thomas via ros-users
In reply to this post by Dirk Thomas via ros-users


Yes, that include the comms stacks.
The wireless communication is [IEEE 802.15.4](https://en.wikipedia.org/wiki/IEEE_802.15.4). In the user application point of view, RIOT provides a net interface similar to the interfaces you can find with Linux. RIOT have a fully working UDP/IPv6 stack (I use it in my project). I think TCP is also working, but I never used it, same for IPv4. About Ethernet, it depends on how you would use it.

Before choosing between NDN and MQTT, let me quickly list the pros and cons

 - NDN
:heavy_check_mark: replace the full TCP/UDP/IP stack
:heavy_check_mark: is topic-oriented by design
:white_check_mark: is decentralized by design
:white_check_mark: can be used on top of TCP/UDP/IP as well as directly on the MAC Layer (ethernet, 802.15.4, ...)
:x: is still an active research topic and not standardized
:x: currently don't provide the ROS2 communication patterns (Pub/Sub, Services)
(but I implemented a beginning of Pub/Sub)

 - MQTT-SN
:heavy_check_mark: is based on UDP/IP
:heavy_check_mark: is topic-oriented by design
:white_check_mark: provide a Pub/Sub communication that fits well ROS.
:white_check_mark: is quite standardized
:x: is centralized by design (needs a broker)
:x: don't provide the ROS' Services communication pattern

For me, as a PhD student, NDN seems more interesting than MQTT, but harder to integrate in ROS2. But the thing is that I need to compare any of my implementation to something. Since I was not able to use DDS on my hardware, I just tried these 2 solutions, which may not be the only two I will try.





---
[Visit Topic](https://discourse.ros.org/t/ros2-on-microcontrollers-with-riot/1293/9) or reply to this email to respond.


If you do not want to receive messages from ros-users please use the unsubscribe link below. If you use the one above, you will stop all of ros-users from receiving updates.
______________________________________________________________________________
ros-users mailing list
[hidden email]
http://lists.ros.org/mailman/listinfo/ros-users
Unsubscribe: <http://lists.ros.org/mailman//options/ros-users>
Reply | Threaded
Open this post in threaded view
|

[Discourse.ros.org] [Next Generation ROS] ROS2 on microcontrollers with RIOT

Dirk Thomas via ros-users
In reply to this post by Dirk Thomas via ros-users


Hello !

Here are some news about the project :

I finally was able to integrate my modules with the "normal" ROS2 build system (now you can use "ament build"). The thing is that I needed to modify the build steps of some standards packages ([rcl](https://github.com/astralien3000/riot-ros2/blob/master/rcl/CMakeLists.txt), [std_msgs](https://github.com/astralien3000/riot-ros2/blob/master/std_msgs/CMakeLists.txt), [builtin_interfaces](https://github.com/astralien3000/riot-ros2/blob/master/builtin_interfaces/CMakeLists.txt), [rosidl_generator_c](https://github.com/astralien3000/riot-ros2/blob/master/rosidl_generator_c/CMakeLists.txt)) to make it work with RIOT's build system. To make it short, instead of compiling the sources with ament/cmake, I just generate Makefiles used by RIOT to compile the final application. Any feedback on how I managed that would be appreciated ^^.

I also began to experiment with rosidl to generate some serialization code, and currently the project can handle messages composed of strings, (u)int32 and (u)int64 fields. Serialization is made with cbor.

Cheers !





---
[Visit Topic](https://discourse.ros.org/t/ros2-on-microcontrollers-with-riot/1293/10) or reply to this email to respond.


If you do not want to receive messages from ros-users please use the unsubscribe link below. If you use the one above, you will stop all of ros-users from receiving updates.
______________________________________________________________________________
ros-users mailing list
[hidden email]
http://lists.ros.org/mailman/listinfo/ros-users
Unsubscribe: <http://lists.ros.org/mailman//options/ros-users>