Gu Yueju_ ROS command line tool

Keywords: ROS

rqt_graph

  rqt_graph creates a dynamic graph that displays the current system operation:

$ rqt_graph

rosnode

  the rosnode command can view node related information.
  rosnode list is used to list all nodes of the system:

$ rosnode list
/rosout
/teleop_turtle
/turtlesim

  rosnode info is used to view the specific information of a node:

$ rosnode info /turtlesim
------------------------------------------
Node [/turtlesim]
Publications:
 * /rosout [rosgraph_msgs/Log]
 * /turtle1/color_sensor [turtlesim/Color]
 * /turtle1/pose [turtlesim/Pose]

Subscriptions:
 * /turtle1/cmd_vel [geometry_msgs/Twist]

Services:
 * /clear
 * /kill
 * /reset
 * /spawn
 * /turtle1/set_pen
 * /turtle1/teleport_absolute
 * /turtle1/teleport_relative
 * /turtlesim/get_loggers
 * /turtlesim/set_logger_level

rostopic

  the rostopic tool allows you to get information about ROS topics.
  rostopic list is used to print the current topic list of the system:

$ rostopic list
/rosout
/rosout_agg
/turtle1/cmd_vel
/turtle1/color_sensor
/turtle1/pose

The   rostopic type command is used to view the message type of the published topic:

$ rostopic type /turtle1/cmd_vel
geometry_msgs/Twist

  rostopic pub is used to publish messages to topics:

$ rostopic pub /turtle1/cmd_vel geometry_msgs/Twist "linear:
  x: 0.0
  y: 0.0
  z: 0.0
angular:
  x: 0.0
  y: 0.0
  z: 0.0"
  • /turtle1/cmd_vel: topic name.
  • geometry_msgs/Twist: topic message category.
  • Linear:...: message content, where linear is linear velocity and angular velocity.

    the above command can only publish messages once. If you need to publish messages continuously, you need to use the - r option:

# 10 means 10 releases per second
$ rostopic pub -r 10 /turtle1/cmd_vel geometry_msgs/Twist "linear:
  x: 1.0
  y: 0.0
  z: 0.0
angular:
  x: 0.0
  y: 0.0
  z: 1.0"

rosmsg

  we can use the rosmsg command to view the details of the message:

$ rosmsg show geometry_msgs/Twist
geometry_msgs/Vector3 linear
  float64 x
  float64 y
  float64 z
geometry_msgs/Vector3 angular
  float64 x
  float64 y
  float64 z

rosservice

  service related functions can be performed using the rosservice command.
  rosservice list is used to list the active service information:

$ rosservice list
/clear
/kill
/reset
/rosout/get_loggers
/rosout/set_logger_level
/spawn
/teleop_turtle/get_loggers
/teleop_turtle/set_logger_level
/turtle1/set_pen
/turtle1/teleport_absolute
/turtle1/teleport_relative
/turtlesim/get_loggers
/turtlesim/set_logger_level

  rosservice call uses the entered parameters to request a service. The command format is rosservice call [service name] [parameters]:

$ rosservice call /clear # / clear is used to clear the tracks of the little turtle
# The following command is used to generate a new turtle
$ rosservice call /spawn "x: 0.0
y: 0.0
theta: 0.0
name: 'turtle2'"

  rosservice args [service name] is used to output the parameters required by the service. Let's take a look at / turnle1 / set_ Each parameter of the pen service:

$ rosservice args /turtle1/set_pen
r g b width off

The command is displayed in / turnle1 / set_ The parameters used in the pen service are r, g, b, width, and off.

rosbag

  rosbag is used to save and reproduce data.
   the command to save data is as follows. After executing the command, the file CMD will be generated in the current directory_ record.bag:

# "- a" means to save all data, "- O" means to output, cmd_record is the name of the output file
$ rosbag record -a -O cmd_record

  the commands for reproducing data are as follows:

$ rosbag play cmd_record.bag

rossrv

  rossrv is used to view information about a service.
  list the currently provided service s, and use the following command:

$ rossrv list

  to view the requests and responses required by a certain type of service, use the command rossrv show:

$ rossrv show std_srvs/Trigger
---
bool success
string message

---Request and response are separated, --- request above, --- response below.

rosparam

The   rosparam command can operate on the parameters on the ROS parameter server.
  rosparam list can list all parameters in the parameter server:

$ rosparam list
/background_b
/background_g
/background_r
/rosdistro
/rosversion

   rosparam get can obtain the value of the parameter:

$ rosparam get /background_r
255

   rosparam set is used to set the value of the parameter:

$ rosparam set /background_r 100
$ rosparam get /background_r
100

  rosparam dump is used to write parameters in the parameter server to a file. Generally, we save the parameters in yaml file:

$ rosparam dump param.yaml

param.yaml is as follows:

background_b: 255
background_g: 255
background_r: 100
rosdistro: 'melodic'
rosversion: '1.14.10'

   rosparam load is used to load parameters from the file to the parameter server:

$ rosparam load param.yaml

  rosparam delete is used to delete parameters:

$ rosparam delete /background_r

Posted by recklessgeneral on Thu, 23 Sep 2021 15:54:58 -0700