Skip to the content.

ROS 2 Course Repository – 2026

Official repository of the ROS 2 course taught at Tecnológico de Monterrey, Campus Guadalajara, in 2026. This course is designed for students in the Robotics and Intelligent Systems Engineering program and aims to provide a solid foundation in the use and development of ROS 2 Humble applications.

Instructions to launch the ROS 2 Packages

1. Running ROS 2 Examples

Examples to Try

Talker-Listener

After installing ros-humble-desktop (and optionally Terminator), try the following:

You should observe that the talker publishes messages and the listener confirms their reception.

Turtlesim: Publish and Move a Turtle

Another example is provided by the turtlesim package:

Use the arrow keys to move the turtle. This example demonstrates publishing velocity commands to control the simulated turtle.

Evidence: Example screenshot showing terminal outputs from both the Talker-Listener example and the Turtlesim node example in action. Figure: Example screenshot showing terminal outputs from both the Talker-Listener example and the Turtlesim node example in action.

2. Running ROS 2 Nodes: Publishers and Subscribers

Executing ROS 2 Publishers and Subscribers

Running the Python Publisher and Subscriber

After implementing and saving your Python nodes and updating package.xml and setup.py files, build your package and run the nodes. In two separate terminal sessions (or using the Terminator emulator), execute the following commands from the root of your workspace:

You should observe that the py_publisher node sends a personalized message (e.g., displaying your name), and the py_subscriber node awaits the reception of the messages.

Running the C++ Publisher and Subscriber

After implementing and saving your C++ nodes and updating package.xml and CMakeLists.txt files, build your package and run the nodes. In two additional terminal sessions (or another two sessions in Terminator), execute the following commands from the root of your workspace:

You should observe that the py_publisher node publishes your personalized message (e.g., displaying your name), and the cpp_subscriber node confirms its reception. Likewise, the cpp_publisher node publishes your other personalized message, and the py_subscriber node confirms its reception.

Visualizing the ROS Graph with rqt_graph

To ensure that your publisher and subscriber nodes are correctly connected, use the rqt_graph tool. In Terminal 5, execute the following command (no need to enter your workspace directory):

ros2 run rqt_graph rqt_graph

or simply:

rqt_graph

This visualization should show the topics connecting your publisher and subscriber nodes.

Evidence: Example screenshot showing terminal outputs of the publisher and subscriber nodes, in C++ and Python, in action. Figure: Example screenshot showing terminal outputs of the publisher and subscriber nodes, in C++ and Python, in action.

3. Running ROS 2 Nodes: Services and Clients

Executing ROS 2 Services and Clients

Running the Python Service and Client

After implementing and saving your Python nodes and updating the package.xml and setup.py files, build your package and run the nodes. In three separate terminal sessions (or using the Terminator emulator), execute the following commands from the root of your workspace:

You should observe that the py_server node processes service requests from both the py_client node and the command-line client in Terminal 3.

Running the C++ Service and Client

After implementing and saving your C++ nodes and updating the package.xml and CMakeLists.txt files, build your package and run the nodes. In three additional terminal sessions (or three new sessions in Terminator), execute the following commands from the root of your workspace:

You should observe that the cpp_server node processes service requests from both the cpp_client node and the command-line client in Terminal 6.

Requesting a Service Using rqt_service_caller

Use the rqt_service_caller tool to send service requests to both the Python and C++ servers. In Terminal 7, run:

ros2 run rqt_service_caller rqt_service_caller

Then, request a service call for:

You should observe that the py_server and cpp_server nodes successfully process the service requests sent via rqt_service_caller.

Evidence: Example screenshot showing terminal outputs from the servers and clients in action. Figure: Example screenshot showing terminal outputs from the servers and clients in action.

4. ROS 2 Custom .msg and .srv Files

Executing ROS 2 Publishers, Subscribers, Services, and Clients

After editing and saving your custom .msg and .srv files, and updating your C++ and Python nodes along with CMakeLists.txt, setup.py, and package.xml, build the packages:

colcon build --packages-select s4_custom_interface
colcon build --packages-select s4_cpp_apps
colcon build --packages-select s4_py_apps

Then, in eight separate terminal sessions (or using the Terminator emulator), source your ROS 2 workspace in each terminal and run the nodes as follows:

You should observe the following:

  1. The py_publisher node publishes the custom HardwareStatus and Sphere messages.
  2. The py_subscriber node receives the HardwareStatus message from the cpp_publisher and the Sphere message from the py_publisher.
  3. The py_server node processes the service request from the py_client node.
  4. The cpp_publisher node publishes the custom HardwareStatus and Sphere messages.
  5. The cpp_subscriber node receives the HardwareStatus message from the py_publisher and the Sphere message from the cpp_publisher.
  6. The cpp_server node processes the service request from the cpp_client node.

Visualizing the ROS Graph with rqt_graph

To verify that all nodes are correctly connected, use the rqt_graph tool.

In Terminal 9, run:

ros2 run rqt_graph rqt_graph

or simply:

rqt_graph

This will display a graph of all publishers, subscribers, and services, confirming proper communication and node topology.

Evidence 1: Example screenshot showing terminal outputs of the publishers, subscribers, services, and clients, in C++ and Python, in action. Figure: Example screenshot showing terminal outputs of the publishers, subscribers, services, and clients, in C++ and Python, in action.

Evidence 2: Example screenshot showing the ROS 2 graph of the publisher, subscriber, and service nodes. Figure: Example screenshot showing the ROS 2 graph of the publisher, subscriber, and service nodes.