How packtpublishing/ros-2-from-scratch works
This repository is a chapter-by-chapter set of ROS 2 learning examples, not one integrated robot application. A representative runtime workflow is to start a node, exchange topic or service/action messages with other nodes, and observe results; the later chapters add a turtle controller and launch examples. The README also describes robot-description, TF, RViz, and Gazebo topics, but the supplied tree does not expose enough implementation to map those workflows in detail. The graph uses sampled controller code and tree-supported example paths; wiring to unsampled implementations is omitted.
Main entry points: turtle_controller.py Turtle controller · turtle_controller.cpp C++ turtle controller · count_until_client.py Count action client · number_counter.py Number counter
Components 22
ROS examples
- Python node
ch4/my_py_pkg/my_py_pkg/my_first_node.py - C++ node
ch4/my_cpp_pkg/src/my_first_node.cpp - Number publisher
ch7/my_py_pkg/my_py_pkg/number_publisher.py - Number counter
ch7/my_py_pkg/my_py_pkg/number_counter.py - Reset client
ch7/my_py_pkg/my_py_pkg/reset_counter_client.py - Count action client
ch7/my_py_pkg/my_py_pkg/count_until_client.py - Count action server
ch7/my_py_pkg/my_py_pkg/count_until_server.py - C++ action client
ch7/my_cpp_pkg/src/count_until_client.cpp - C++ action server
ch7/my_cpp_pkg/src/count_until_server.cpp - Number app launch
ch9/my_robot_bringup/launch/number_app.launch.py
Turtle control
- Turtle controller
ch9/turtle_controller/turtle_controller/turtle_controller.py - C++ turtle controller
ch9/turtle_controller_cpp/src/turtle_controller.cpp - Turtle launch
ch9/my_robot_bringup/launch/turtlesim_control.launch.py
ROS interfaces
- Activation service
ch9/my_robot_interfaces/CMakeLists.txt - Count action interface
ch7/my_robot_interfaces/CMakeLists.txt - Number/reset interfaces
ch7/my_robot_interfaces/CMakeLists.txt
Robot description
- Robot description launch
ch13/my_robot_description/launch/display.launch.py - Robot model / TF
ch13/my_robot_description
Other components
- ROS user
- ROS 2 runtime
- Turtlesim
- Controller operator
Connections 34
- ROS user → Python node: runs node
- ROS user → C++ node: runs node
- ROS user → Number app launch: starts example
- Number app launch → Number publisher: launches
- Number app launch → Number counter: launches
- Number publisher → ROS 2 runtime: publishes numbers
- ROS 2 runtime → Number counter: delivers numbers
- Reset client → Number counter: requests reset
- ROS user → Count action client: runs client
- Count action client → Count action server: sends goals
- Count action client → ROS 2 runtime: uses action transport
- C++ action client → C++ action server: sends goals
- C++ action client → ROS 2 runtime: uses action transport
- ROS user → Turtle launch: starts example
- Turtle launch → Turtle controller: launches
- Turtle controller → Turtlesim: reads pose
- Turtle controller → Turtlesim: publishes motion
- Turtle controller → Turtlesim: requests pen change
- Controller operator → Turtle controller: activates service
- C++ turtle controller → Turtlesim: reads pose
- C++ turtle controller → Turtlesim: publishes motion
- C++ turtle controller → Turtlesim: requests pen change
- Controller operator → C++ turtle controller: activates service
- Turtle controller → Activation service: implements service
- C++ turtle controller → Activation service: implements service
- Count action client → Count action interface: uses type
- Count action server → Count action interface: uses type
- C++ action client → Count action interface: uses type
- C++ action server → Count action interface: uses type
- Number publisher → Number/reset interfaces: uses type
- Number counter → Number/reset interfaces: uses type
- Reset client → Number/reset interfaces: uses type
- ROS user → Robot description launch: starts display
- Robot description launch → Robot model / TF: loads description