What the @#$% is ROS?
This was the question I asked myself some months ago when I heard of ‘ROS’ for the first time in my life. I immediately fell in love with it and started building my own robot, which I want to share here. I’m still a beginner concerning ROS, so you can learn it together with me.
ROS (Robot Operating System) is an open-source framework for programming robots. It’s a middleware that manages the communication and data-exchange between single applications. And it provides some handy tools to visualize and debug your system.
ROS is developed for Ubuntu. For each version of ROS, you need a specific version of Ubuntu. I recommend using ROS kinetic with Ubuntu 16.04 or ROS melodic with Ubuntu 18.04.
The software components of your robot are separated in nodes. Each node can be compiled and executed individually and usually, has one single purpose. In the case of my robot, there’s one node getting the Lidar data, one for the Camera and one for the motor controls. All nodes are managed by the master node ‘roscore’.
ROS Nodes communicate via topics and ROS messages. A topic is a bus, in which data can be exchanged. The datatype has to match a predefined message type. You can either use standard ones or define your own in a *.msg file. Nodes can publish or subscribe to certain topics. The previously mentioned Lidar node publishes a topic called ‘/scan’ of the message type ‘sensor_msgs/LaserScan’. Another node processing the Lidar data can subscribe to this topic and automatically receives all data.
ROS Demo
- To start ROS, you need to open a terminal and type ‘roscore’.
- Next, you can start the specific Lidar Node. You can define the nodes you want to launch in *.launch files. So we need to type ‘roslaunch ydlidar lidar_view.launch’ in a separate terminal.
The Lidar node is now running, and the Lidar scanner starts to spin. Is detections are published in the topic /scan. You can visualize the data using RViz.
And here’s a video of the Lidar Scanner in action.
I hope I could give you a brief overview of ROS and motivate you to start your own project. If you want to dive deeper I recommend these resources:
If you have any questions or article wishes, let me know in the responses!