ROS学习笔记(八)——ROSTOPIC

时间:2023-03-08 16:20:06

NEW 1

$ roscore

NEW 2

$ rosrun turtlesim turtlesim_node

NEW 3

$ rosrun turtlesim turtle_teleop_key

NEW 4

$ sudo apt-get install ros-indigo-rqt  #安装rqt,这个貌似是一个节点管理器

$ sudo sudo apt-get install ros-indigo-rqt-common-plugins

$ rosrun rqt_graph rqt_graph  #节点工作示意图,一个工具

ROS学习笔记(八)——ROSTOPIC

/teleop_turtle 控制节点

/turtlesim 显示节点

/turtle1/cmd_vel 话题

NEW 5

$ rostopic list -v  #显示所有在系统中活动的话题

$ rostopic  type /turtle1/cmd_vel  #话题的类型是由发布在它上面的消息类型决定的,rostopic可以查看消息类型

  geometry_msgs/Twist

$ rosmsg show geometry_msgs/Twist  #We can look at the details(或者说格式) of the message using rosmsg

  geometry_msgs/Vector3 linear

  float64 x

  float64 y

  float64 z

  geometry_msgs/Vector3 angular

  float64 x

  float64 y

  float64 z

$ rostopic  echo /turtle1/cmd_vel  #rostopic echo shows the data(或者说内容) published on a topic.

  linear:

  x: 2.0

  y: 0.0

  z: 0.0

  angular:

  x: 0.0

  y: 0.0

  z: 0.0

$ rostopic pub -1 /turtle1/cmd_vel geometry_msgs/Twist -- '[2.0, 0.0, 0.0]' '[0.0, 0.0, 1.8]'  #发送一个Massage 到一个话题中,感觉像偷用,或者说中途截断

                        # -1 This option (dash-one) causes rostopic to only publish one message then exit

                        # -r 1 循环发送Massage

$ rostopic hz /turtle1/pose  #循环现实乌龟的位置信息,pose怎么来的?

NEW 6

$ rosrun rqt_plot rqt_plot  #有一个工具,PLOT