A structured guide to understanding ROS 2 (Humble) fundamentals — including nodes, topics, publishers/subscribers, remapping, and Docker setup — organized in the recommended order of learning.
sudo apt update && sudo apt upgrade
sudo apt install ros-humble-desktopsource /opt/ros/humble/setup.bash
# Make permanent
echo "source /opt/ros/humble/setup.bash" >> ~/.bashrcros2 --version
ros2 run demo_nodes_cpp talkerA Node is an independent process that performs computation in a ROS 2 graph. Nodes communicate through topics, services, and actions.
Publisher Node ---> Topic ---> Subscriber Node
Each node can:
- Publish data (e.g., from a sensor)
- Subscribe to data (e.g., to control a motor)
- Provide or call services
- Perform tasks in coordination with others
🔗 Related diagrams:
ros2 topic list # show all active topics
ros2 topic info /topic_name # show details (type, QoS, publishers, subscribers)ros2 topic echo /topic_name # view published messagesros2 topic pub /topic_name <msg_type> '{data}'
ros2 topic pub -r 1 /topic_name <msg_type> '{data}' # publish at 1 Hzros2 topic hz /topic_name # check publishing frequency
ros2 topic bw /topic_name # check bandwidth usage
ros2 topic find <type> # find topics of a specific message typeros2 topic hz /turtle1/pose
ros2 topic bw /turtle1/poseRemapping lets you change default node or topic names at runtime without editing source code.
Example — renaming a node:
ros2 run turtlesim turtlesim_node --ros-args --remap __node:=my_turtleNow, running ros2 node list shows:
/my_turtle
/turtlesim
/teleop_turtle
Remapping is useful when running multiple instances of the same node or avoiding naming conflicts.
ros2 node list— list all running nodesros2 node info <node>— get details about a noderqt_graph— visualize node-topic connectionsros2 topic echo /topic_name— observe message dataros2 topic hz /topic_name— verify publishing rate
These tools are key for debugging publisher/subscriber connectivity.
docker ps -a # list containers
docker start <name> # start container
docker stop <name> # stop container
docker compose down # remove containers
docker run -it osrf/ros:humble-desktop # interactive rundocker run -it --rm --net=host \
--env="DISPLAY" \
--volume="$HOME/.Xauthority:/root/.Xauthority:rw" \
osrf/ros:humble-desktopAdd --gpus all for GPU support if available.
Stop all running nodes:
Ctrl + C # in each terminalStop Docker containers:
docker compose down
docker stop <container_name>- ROS 2 Docs: https://docs.ros.org/en/humble/
- NVIDIA Container Toolkit: https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/

