The robot operating system ROS is the most widely used robotic middleware platform. It’s being used in the robotics community for more than 10 years, both in the hobbyist area as in industry. ROS can be used on a wide array of microcontrollers and computers, from Arduino to Raspberry Pi to your Linux Workstation, and it offers hardware support for motor controllers, visual sensors, depth cameras and laser scanners.
In my project to build a robot, I worked with both ROS1 and ROS2. So far, I finished 2 out of 5 phases. The first phase was research: Understanding the hardware and software of robotic, researching microcontroller and sensor, testing libraries and middleware. In the second phase, I built an Arduino based prototype, an IR controlled 4-wheel vehicle that I termed RADU. Now, Phase 3 has two distinct parts: Simulate the robot with ROS, then build a ROS-enabled robot. And this is the dilemma: The simulation with ROS2 — hard earned with long trial&error periods — could not be extended to the concrete robot because my hardware is not supported. For a long time, I considered this, and finally decided to continue with ROS1 from hereon.
This article summarizes my experiences, and explains the rationale for the final choice.
This article originally appeared at my blog admantium.com.
Recapitulating my Robot Project
When starting the project at the beginning of 2021, my first experience with ROS was confined to pure simulation. With an Ubuntu base Linux running as a VM on my laptop, I installed ROS noetic with RViz and made a simple URDF model of a four wheeled robot.
Then, I bought a robot chassis, several Arduino Uno, and 5V compliant sensors. Working through the tutorials, understanding how Arduino works and how sensor data is measured and processed, was an invigorating time. I had many “eureka” moments in which after some difficulties the sensor would suddenly work. This phase finished with a first concrete prototype, a moving 4-wheel chassis controlled by an IR.
Preparing the full utilization of ROS in my project, I installed ROS2 on a dedicated Linux Workstation. Then I began to port my simple RViz ROS1 model to ROS2, and extend the model to be compliant with Gazebo. On the fun side was learning the physics behind robots, and getting deep knowledge of ROS concepts. On the downside, I spend long periods of trial and error to develop a Gazebo compatible model. But finally, I could launch the simulation, start a teleop node, and move the robot in a simulation streaming point cloud sensor data.
From simulation to robot was the next phase. In the meantime, the Raspberry Pico entered the stage. Initially I just tested how to add sensors and read them with C and MicroPython. But reading several tutorials and watching videos around Raspberry Pi based projects with robot control software in Python convinced me of the feasibility. Writing the motor control software from Scratch in MicroPython became my goal. I rebuild my Robot completely with MicroPython, and added also a ROS Twist Message to motor control commands wrapper. The robot moved! But when adding my Realsense D435 camera, I could not get point cloud data streamed with ROS2, after several hours of trying. Out of curiosity, I switched to ROS1 — and here it worked out of the box!
This revelation gave rise to the observations summarized in the next paragraph.
ROS1 vs ROS2
ROS2 is the ROS of the future. According to information from community websites and YouTube videos, ROS2 is geared towards industrial use. Robot communication uses a standard middleware layer called XRCE-DDS. ROS2 also inhibits feature of system self-healing and reliability, such as no ROS master node is required to run.
When looking into concrete robot projects, ROS2 robots from the community pale against ROS1 robots. Most projects developed in the last 3 years still work with ROS1. I did not consider this fact, merely felt astonished because ROS2 was already released since 2017.
After working with ROS2 for simulating a robot and for getting ROS2 to run with my robot sensors, particularly the RealsenseD435 camera, several obstacles occurred to me. This is a personal recollection.
First, when searching for how to connect a certain sensor, ROS2 related information, concrete articles, documentation, or YouTube videos, is hard to find or non-existent.
Second, documentation about special topics such as Gazebo controllers and Gazebo plugins is incomplete. If you want to build a Gazebo simulation, there are explorative and comprehensive manuals for ROS1, but for ROS2, you need to fetch information pieces from different websites, assemble them, and use a lot of trial and error before it works. Getting my robots simulation to work with all sensors and topic in Gazebo/RVIZ 2 was a long journey.
Third, when assembling a robot by using an SBC and connect it to microcontrollers, you will be surprised to find out that there is no universal library for connecting them via serial, as explained in this blog post. You either need to use very specific microcontrollers, and compile a custom RTOS Linux distribution to them, making it hard to reuse your e.g. Arduino libraries. Or you need special board with networking features.
Fourth, checking hardware support for ROS2 shows that fewer options are available and the other robot enthusiasts have problems to get ROS2 running. I had the very same experience when trying to get the Intel Real SenseD435 work with ROS2. Although I used the latest firmware, compiled the librealsense from scratch, compiled the ros-realsense package, it did just not work and even a thread on the very responsive and helpful community issue board did not find an answer. When I switched to ROS1, the same sensor just works without any problems.
Generalizing these observations leads me to the sad conclusion that using ROS2 means to find fewer documentation, have fewer support for sensors, and harder integration of SBCs and microcontroller.
Switching to ROS1
The experience in getting the gazebo Simulation to work in ROS2 was mostly trial and error. Getting the Realsense2 camera to work in ROS2 was not successful. Thereby, reading from other about similar errors and problems with ROS2, was another impact. And finally, when researching about the next aspects of using ROS on my robot, like SLAM, autonomous movements, gripper — did reveal time and time again complete tutorials and books in ROS1, I made the decision: My project will be continued with ROS1.