During ROSCon 2019 Alberto Soragna, Juan Oxoby, and Dhiraj Goel from iRobot presented their experience in using Robot Operating System 2 (ROS 2) on a low-cost embedded platform. By experimenting with different Data Distribution Service (DDS) implementations they reduced the CPU and memory usage of their application, which improved performance.
As iRobot is creating consumer robots with low-cost embedded platforms in them, they investigated the use of ROS 2 on their embedded hardware. ROS 2 works well on desktop computers and on microcontrollers, but it is more difficult to use ROS on small Linux computers. iRobot took a comparable platform to what they have on their robots, which for them is a Raspberry Pi 2 with 1 gigabyte of RAM, and a 900mhz quad-core ARM cortex A7 CPU. To see if ROS2 was a viable option for them they were willing to accept a consumption overhead for ROS of less than 20% CPU and 20MB RAM, an acceptable latency for messages, and zero lost messages
A core challenge that iRobot faced during development is that they have approximately 1000 robots connected to the same network during their prototyping phase. This can create a lot of communication overhead, which they analyzed with a self-written tool. They used this tool to create the data to analyze and see how many messages were on time, arrived late, or arrived too late.
During their talk, iRobot showed that all targets they set in terms of CPU and memory usage are currently exceeded. CPU usage overhead was 33%, and ram was 153 MB instead of the maximum of 20 MB. Most of the overhead came from the DDS communication layer. When replacing this layer with cyclone DDS, they got better results. Their example application now was below the maximum CPU and memory usage with only 13% CPU overhead and 15.82MB RAM used. Developers thus have to look at their DDS implementation and have to consider switching to a different DDS implementation to get a massive boost in performance.
A second way iRobot improved the statistics was by looking at the actual source of the overhead. The RAM usage was so high because DDS creates a process for each object in ROS that can communicate to another topic. By adding blacklisting they could restrict communication to only nodes which they knew had to discover each other. This decreased their RAM usage to 45% of the original amount.
The last thing they looked at is the ROS 2 intra-process manager. The intra-process manager in the current release of ROS 2, Dashing Diademata, sends meta-messages through the RMW layer. iRobot created a new intra-process manager which reduces the amount of communication overhead, which reduced latency and CPU usage. This option reduced CPU usage by 45%, but still has a big RAM memory overhead. The new intra-process manager was added to the master version of ROS 2 and will be in the upcoming release.
For more information, look at the tool used to create this performance analysis. Also look at the different quality of service policies ROS 2 offers, so that you can set your expected quality of service. This can help you as developer get the communication you want on your robotics application.