Command-Line Inspection Tools¶
Concept¶
ROS 2's CLI tools give you visibility into any running system without writing code. They are the primary debugging tools for robotics engineers.
ros2 run turtlesim turtlesim_nodeNode Commands¶
# List all running nodes
ros2 node list
# Detailed info about a specific node
ros2 node info /turtlesimOutput of ros2 node info includes: publishers, subscribers, services, and actions.
Topic Commands¶
# List all active topics
ros2 topic list
# Show who publishes and who subscribes
ros2 topic info /turtle1/cmd_vel
# Print live message data
ros2 topic echo /turtle1/pose
# Check how fast messages arrive (Hz)
ros2 topic hz /turtle1/pose
# Check bandwidth usage
ros2 topic bw /turtle1/poseService Commands¶
# List all available services
ros2 service list
# Check the type of a service
ros2 service type /reset
# Call the reset service (clears the canvas)
ros2 service call /reset std_srvs/srv/Empty "{}"
# Spawn a second turtle at position x=5, y=5
ros2 service call /spawn turtlesim/srv/Spawn "{x: 5.0, y: 5.0, theta: 0.0, name: 'turtle2'}"Interface / Message Inspection¶
# Show fields of a message type
ros2 interface show geometry_msgs/msg/Twist
# List all available message types
ros2 interface listParameter Commands¶
# List parameters of a node
ros2 param list /turtlesim
# Get a parameter value
ros2 param get /turtlesim background_r
# Set a parameter (change background red channel)
ros2 param set /turtlesim background_r 200Command Cheat Sheet¶
| Command | Purpose |
|---|---|
ros2 node list | All running nodes |
ros2 node info /name | Node details |
ros2 topic list | All topics |
ros2 topic echo /topic | Live data stream |
ros2 topic hz /topic | Publish frequency |
ros2 topic info /topic | Publishers & subscribers |
ros2 service list | All services |
ros2 service call /svc type "{}" | Call a service |
ros2 param list /node | Node parameters |
ros2 interface show type | Message fields |