学习topic话题感觉套用CAN总线的知识非常高效,Publisher就是在一条CAN总线写入一个信息,Subscriber就是在CAN总线监听一个信息。发送端(总线写入)可以有多个,接收端(总线监听)也可以有多个。
常用的topic命令:
ros2 topic list
ros2 topic echo <topic_name>: ros2 topic echo /turtle1/cmd_vel
ros2 interface show <msg_type>: ros2 interface show geometry_msgs/msg/Twist
ros2 topic pub <topic_name> <msg_type> ‘<args>’ : ros2 topic pub /turtle1/cmd_vel geometry_msgs/msg/Twist “{linear: {x: 2.0, y: 0.0, z: 0.0}, angular: {x: 0.0, y: 0.0, z: 1.8}}”
ros2 topic hz: ros2 topic hz /turtle1/pose
ros2 topic bw: ros2 topic bw /turtle1/pose
ros2 topic find <topic_type>: ros2 topic find geometry_msgs/msg/Twist
/turtle1/cmd_vel
相对来说概念很容易理解的,几个常见的命令感觉可以用力记一下,不然每次调试想到要用还要查命令查语法。