Task |
ROS1 Command |
ROS2 Command |
Notes |
Node Introspection |
List all nodes |
rosnode list |
ros2 node list |
The functionality is similar, but in ROS2 all command line tools use the ros2 prefix |
Get node information |
rosnode info /node_name |
ros2 node info /node_name |
Shows publishers, subscribers, services, and actions associated with the node |
Ping a node |
rosnode ping /node_name |
ros2 node ping /node_name |
Test connectivity to a specific node |
Kill a node |
rosnode kill /node_name |
Not directly available |
In ROS2, you typically use Ctrl+C or task/process management |
Run a node |
rosrun package_name node_name |
ros2 run package_name node_name |
The core functionality is the same |
Topic Introspection |
List all topics |
rostopic list |
ros2 topic list |
Lists all active topics |
List topics with types |
rostopic list -v |
ros2 topic list -t |
In ROS2, the -t flag is used for showing types |
Show topic information |
rostopic info /topic_name |
ros2 topic info /topic_name |
Shows publishers and subscribers of a topic |
Echo (display) topic messages |
rostopic echo /topic_name |
ros2 topic echo /topic_name |
Displays message content in real-time |
Show message type |
rostopic type /topic_name |
ros2 topic type /topic_name |
Shows the message type used by a topic |
Publish to topic |
rostopic pub /topic_name msg_type "data" |
ros2 topic pub /topic_name msg_type "data" |
In ROS2, message types include the msg/ namespace (e.g., std_msgs/msg/String) |
Show topic publishing rate |
rostopic hz /topic_name |
ros2 topic hz /topic_name |
Shows how frequently messages are published |
Show topic bandwidth |
rostopic bw /topic_name |
ros2 topic bw /topic_name |
Shows bandwidth used by the topic |
Find topics by type |
rostopic find msg_type |
ros2 topic find msg_type |
Find all topics of a specific message type |
Service Introspection |
List all services |
rosservice list |
ros2 service list |
Lists all available services |
Show service type |
rosservice type /service_name |
ros2 service type /service_name |
Shows the service type |
Call a service |
rosservice call /service_name [args] |
ros2 service call /service_name srv_type [args] |
In ROS2, you must specify the service type explicitly |
Show service arguments |
rosservice args /service_name |
Use ros2 interface show srv_type |
In ROS2, you check the service interface definition instead |
Find services by type |
rosservice find srv_type |
ros2 service find srv_type |
Find all services of a specific type |
Monitor service calls |
Not directly available |
ros2 service echo /service_name |
ROS2 introduced service call monitoring |
Interface Introspection |
Show message definition |
rosmsg show msg_type |
ros2 interface show msg_type |
ROS2 unified msg, srv, and action introspection under "interface" |
Show service definition |
rossrv show srv_type |
ros2 interface show srv_type |
Same command for all interface types in ROS2 |
List message types |
rosmsg list |
ros2 interface list |
Use with --only-msgs flag in ROS2 to filter |
List service types |
rossrv list |
ros2 interface list |
Use with --only-srvs flag in ROS2 to filter |
Parameter Introspection |
List parameters |
rosparam list |
ros2 param list |
In ROS2, parameters are node-specific |
Get parameter value |
rosparam get parameter_name |
ros2 param get /node_name parameter_name |
ROS2 requires specifying the node name |
Set parameter value |
rosparam set parameter_name value |
ros2 param set /node_name parameter_name value |
Node name is required in ROS2 |
Load parameters from file |
rosparam load file.yaml |
ros2 param load /node_name file.yaml |
Node-specific in ROS2 |
Dump parameters to file |
rosparam dump file.yaml |
ros2 param dump /node_name file.yaml |
Node-specific in ROS2 |
Action Introspection (ROS2 Only) |
List actions |
Not available (used actionlib) |
ros2 action list |
Actions are a first-class citizen in ROS2 |
Show action info |
Not available |
ros2 action info /action_name |
Shows action servers and clients |
Send action goal |
Not available (required code) |
ros2 action send_goal /action_name action_type goal |
Command line interface for actions |
Launch |
Launch multiple nodes |
roslaunch package_name file.launch |
ros2 launch package_name file.launch.py |
ROS2 supports Python, XML, and YAML launch files |
留言
張貼留言