Sign up for the Design News Daily newsletter.
ROS 101: An Intro to the Robot Operating System
Here's everything you need to know about the open-source Robot Operating System (ROS) and how you can get started creating your first project!
Dr. Don Wilcher
July 1, 2019
6 Min Read
First released in 2007 by two Stanford PhD students who observed their colleague’s lack of entry into the robotics field, the Robot Operating System (ROS) was developed to be a distributed and modular open-source platform for robotics software development. Makers, engineers, researchers, and educators can use as little or much of the modular library functions for their robotics designs and projects. The distributive abilities of sharing modular software component packages is the major appeal of ROS within the robotics community. And there are currently over 3,000 software component packages contributed by the Open Robotics community, creating thriving ecosystem for ROS.
Although ROS is not operating system in the vein of Windows 10 or Linux, the software development platform provides a system of nodes that allows interprocesses to occur within the target’s intelligent platform. These interprocesses allow the sharing of functional messages to occur within a robotic architecture. The architecture of a ROS system consists of five components: a ROS Master, nodes, publishers, subscribers, and topics.
Here is a brief primer on ROS system components:
A typical ROS Model: System components.
The ROS Master is responsible for managing names and registration services to the nodes within a ROS system. Publishers and subscribers are monitored by the ROS Master to ensure associated topics, as well as services, are provided within the robotic system. The ROS Master also enables location and communication between nodes within the robotics system. Finally, the ROS Master commonly initiates the node communication function using the roscore command. The roscore command is used to load the ROS Master with the essential software components to allow communication between nodes.
An executable file within the ROS system to allow communication among another node.
A message that is transmitted by a node or topic within a ROS system is known as a publisher.
A message that is received by a node or topic within a ROS system is known as a subscriber.
The publishing and subscribing of a message of a specific name type is known as a topic.
Each of these software components allows a robotic system to move, sense, monitor, and process a variety of signal and imaging data.
Hello World ROS Project
To get started in exploring ROS, we need two essential parts: Ubuntu Linux distro (version 18.04 LTS), and a host computer. The host computer can be a desktop PC, laptop computer, or a Raspberry Pi 3 or Model 3 B+. The Hello World project will illustrate how these two essential parts create a simple desktop robotic system.
In this example a Raspberry Pi 3 was used as the host computer. To use Ubuntu Linux on a Raspberry Pi 3 (RPi 3), the Mate version 18.04 LTS is the recommended distro to install on the single board computer.
Ubuntu Mate supports the Raspberry Pi single board computers.
Once the Linux distribution is installed on the RPi 3, the ROS distro library is required. There are several ROS distro libraries known as (ros_lib) packages to select from at the ROS.org website. Each revision level has new library packages, services, and software bug corrections to improve the user experience with the ROS. For this project build example, ROS Melodic was installed on the RPi 3. Before proceeding with the ros_lib installation, a workspace directory is required. Creating a workspace directory requires opening a Linux terminal. The directions to create a workspace directory can be found at the ROS.org website. The Linux commands required to install Melodic onto the RPI3 are below (you can copy/past them into a Linux terminal screen to save time):
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654sudo apt updatesudo apt install ros-melodic-desktop-fullsudo rosdep initrosdep updateecho "source /opt/ros/melodic/setup.bash" >> ~/.bashrcsource ~/.bashrcsudo apt install python-rosinstall python-rosinstall-generator python-wstool build-essential
Linux installation commands for ROS Melodic desktop. Image source: introrobotics.com
This installation build includes the commonly used robot programming and simulator packages of turtlesim and Gazebo.
The turtlesim simulator allows Python robot algorithms to be developed and tested using a 2D turtle.
The turtlesim simulator allows testing of robot code using C++ and Python programming languages.
Gazebo provides a 3D simulation environment where motion planning, object detection and sensing algorithms can be validated using 3D-based robotic systems and mobile platforms.
The Gazebo simulator is 3D robotics simulation package for testing motion planning and kinematic algorithms.
The final stage of the ROS project is the execution of the software code on a RPi 3 and an Arduino Uno.
The Arduino Uno will be functioning as a publisher whereby the chatter topic will be advertised through the ROS system. The topic message to be published is the infamous hello world text. To run the publisher code, the ros_lib hello world sketch will be installed on an Arduino Uno. The RPi3 and the Arduino Uno will share the topic by using USB serial communications. Therefore, the Arduino Uno and the RPi3 are attached to each other using an USB cable as shown:
Serial communication between the RPi3 and an Arduino Uno.
Running the entire project requires the use of multiple terminal screens initiating specific ros_lib commands. The first Linux command to allow the ROS Master to monitor and manage communication with the Arduino Uno node is “roscore.” The roscore command allows the hello world publisher code to be sent from the RPi 3 to the Arduino Uno. The chatter topic encapsulates and sends the publish hello world message to a Linux terminal screen.
The roscore command (service) being executed on a RPi3 using a Linux terminal.
The second Linux terminal screen will display the chatter topic of hello world.
The Arduino Uno (client) publishes the chatter’s topic hello world to a second linux terminal screen.
The initial ros_lib hello world Arduino Uno sketch (code) can be modified to publish new messages. Although the transmission message rate is set for one second, the publishing time can be change appropriately within the hello world code.
There are also other examples provided within the ros_lib package that can be explored on the Arduino Uno. Some examples include: blinking an LED; monitoring an electrical pushbutton; and operating a servo motor. Additional, information on ROS, ros_lib, the system model, and using the Arduino Uno can be found on the ROS.org website.
[All images courtesy Don Wilcher]
Don Wilcher is a passionate teacher of electronics technology and an electrical engineer with 26 years of industrial experience. He’s worked on industrial robotics systems, automotive electronic modules/systems, and embedded wireless controls for small consumer appliances. He’s also a book author, writing DIY project books on electronics and robotics technologies.
This summer (August 27-29), Drive World Conference & Expo launches in Silicon Valley with North America's largest embedded systems event, Embedded Systems Conference (ESC). The inaugural three-day showcase brings together the brightest minds across the automotive electronics and embedded systems industries who are looking to shape the technology of tomorrow.
About the Author(s)
Dr. Don Wilcher, an Electrical Engineer, is an Associate Certified Electronics Technician (CETa), a Technical Education Researcher, Instructor, Maker, Emerging Technology Lecturer, Electronics Project writer, and Book Author. His Learn Electronics with Arduino book, published by Apress, has been cited 80 times in academic journals and referenced on patents.
He is the Director of Manufacturing and Technology at Jefferson State Community College. His research interest is Embedded Controls, Robotics Education, Machine Learning, and Artificial Intelligence applications and their impact on Personalized Learning, Competency-Based Models curriculum, and instructional development in Mechatronics, Automation, IoT, Electronics, Robotics, and Industrial Maintenance Technologies. He is also the Founder and owner of MaDon Research LLC, an instructional technology consulting, technical training, and electronics project writing company serving Electronics Marketing Media, Technical and Engineering Education companies.
You May Also Like
Video: How to Use Ford's NACS Adapter for Tesla SuperchargersMar 1, 2024
Breakthrough PPG Matte Clear Film Wraps New MustangsMar 1, 2024|3 Min Read
Taxicabs May Not Be So Bad After AllMar 1, 2024|5 Min Read
Top 20 Companies for Electrical EngineersMar 1, 2024|20 Slides