Prerequisite: Introduction to Robot Operating System ROS2 - madibabaiasl/kinematics-robotic-arms-modern-approach GitHub Wiki

Learning Objectives

  • Explain ROS vs. ROS 2 (why ROS 2 exists, middleware/DDS, QoS, real-time, distributed design).
  • Describe the core ROS 2 concepts and data flow: nodes, topics, services, actions, parameters, and launch.
  • Get to know essential ROS 2 tooling: ros2 CLI introspection (list/echo/info), rviz, rqt, rosbag, and basic Gazebo simulation.
  • Interpret a simple URDF (links, joints, visuals/collisions, limits).

Learning Outcomes

By the end of this lesson, you will be able to:

  • Summarize in a few sentences what ROS 2 is and why it replaced ROS 1, including DDS’s role and real-time/QoS implications.
  • Explain a minimal ROS 2 graph and explain nodes/topics/services/actions.
  • Answer the six reflection questions after the ROS 2 architecture video with concrete examples from robotics.

Why This Matters

ROS 2 is the plumbing that turns Python code into coordinated robot behavior. Understanding nodes, topics, and QoS is how you will later push math into robot motion commands. This directly advances the course goals: integrating tools (ROS 2/Python), applying math and programming to control a real manipulator, and building professional, testable systems that scale from simulation to hardware.

Robot Operating System (ROS)

The Robot Operating System (ROS) is a freely available software framework used to control robots. It comprises a collection of software libraries and tools that facilitate the construction and sharing of code among various robotics applications. Additionally, ROS fosters a worldwide open-source community consisting of engineers, developers, and enthusiasts who collaborate to make robots better and make this field accessible to all. ROS is the backbone of a wide variety of systems like autonomous cars, and research & development systems to name a few. ROS is not an operating system in the conventional sense of process management and scheduling, but rather a structured communications layer that sits on top of the host operating system.

In this course, we will utilize Robot Operating System 2 (ROS2) Humble in conjunction with the ROS-Python API to operate our robot arm. ROS2 Humble serves as the Long-Term Support (LTS) distribution of ROS, ensuring support for a minimum of 5 years. Our primary goal in this class is not to become ROS developers, but rather to leverage it to our advantage for controlling and programming our robot arm. The ROS-Python API will enable us to code the robot arm without needing to grasp all the intricate details of ROS. Instead, we will write our code in Python3, and this API will handle the underlying complexities. This prerequisite's objective is to provide you with an understanding of what ROS2 is and how it functions, enabling you to easily utilize it for your robot arm control.

ros_ros-python_gazebo_our robot

In 2007, ROS originated with the intention of establishing a cooperative software framework dedicated to the advancement of robotics development. At that time, roboticists had to write all their operating code from scratch. Performing even a basic task, starting from writing the code, developing a framework controller, handling serial communication between the microcontroller and the main computer, and dealing with debugging, could consume several weeks. When dealing with more extensive projects involving lots of code, numerous sensors, and actuators, the complexity multiplies significantly. ROS was created to alleviate the complexity of this challenging situation by offering a multitude of pre-built tools and packages developed by other roboticists. These resources significantly reduce the amount of time required for software development, allowing you to get your robot operational more quickly and effortlessly. ROS also gives you the ability to scale your robotics systems. ROS2 fills in the gaps of ROS1 and is suitable not only for robotic arms but mobile robots, legged robots, drones, swarm robots, and autonomous cars. C++ & Python are officially supported and in this class, we will use Python3 to program our robot arm.

The communication architecture of the ROS2 framework differs significantly from ROS1, and you can have a good concise overview of the architecture in the video below:

https://youtu.be/LI4NexFDF4E

After watching this video, answer the following questions to gauge your understanding:

  1. What is ROS2, and why was it developed as a successor to ROS1?
  2. Explain the role of middleware in ROS2. How does DDS (Data Distribution Service) fit into the ROS2 architecture?
  3. Why is real-time communication a critical feature introduced in ROS2?
  4. Give an example of a real-world robotic system or scenario where ROS2’s distributed and scalable design would be especially beneficial. Why?
  5. What are nodes in ROS2, and how do they interact with topics, services, and actions within the framework?
  6. Considering the benefits and drawbacks highlighted, do you think ROS2 is ready for large-scale deployment in safety-critical robotics (e.g., autonomous vehicles, medical robots)? Justify your answer.

ROS2 Simulation and Visualization Tools

ROS provides software packages scheduled to support robotics simulation and data visualization.

Gazebo is a free robot simulator and can communicate data over ROS2. It has the ability to keep track of robot positions and replicate the state of a real robot. Additionally, it incorporates virtual sensors, enabling the simulation of authentic sensor data. This allows you to evaluate and test your code as if you were running it on an actual physical robotic system.

Rviz and RQT are for visualization purposes. Rviz is a comprehensive software suite for 3D data visualization that allows seamless interaction with data using ROS2. It is equipped with various data visualization capabilities, enabling users to effectively interact with their robot. RQT on the other hand is a plugin-based GUI that can be used with ROS2. It comes with variable graphical plugins such as a topic publisher, image viewer, parameter updater, and node graph visualizer. RQT focuses most on user interaction with ROS2, whereas Rviz focuses on visualizing 3D data.

gazebo-rviz-rqt

The robots can be modeled by creating a URDF (Unified Robot Description Format) model. URDF is an XML-based file format used to describe the geometry, kinematics, and visual properties of a robot. The URDF file includes information about robot joints, links, visual and collision geometry, joint limits, and more. Part of a URDF has a structure like this:

A URDF file

In summary, the Robot Operating System (ROS) stands as a versatile software framework for robot control that fosters collaboration and innovation within a global open-source community. Through ROS, we tap into a powerful toolset of libraries and utilities, simplifying code creation and sharing across a spectrum of robotics applications. ROS not only serves as the backbone for diverse systems but also provides a platform for efficient and modular development. As we start our journey with ROS 2 Humble and the ROS-Python API, our goal isn't to delve into intricate ROS development but rather to leverage these tools for effective robot arm control.

Video version: https://youtu.be/VLxf72OZ3JY

More Resources

Here you can learn more about our robot arm's ROS2 interface, the packages, etc:

⚠️ **GitHub.com Fallback** ⚠️