ROS practice manual (two) command-line tool

According to the author Ku ranking · ROS 21 Getting speak learning organize and refer to "ROS robotics development practices," a book.

[Note] This section may refer Ku ranking · Getting ROS say 21 Lecture 8

Experimental preparation: start small turtles emulator

  • Use $ roscorestart Ros Master
  • Open a new terminal, start small turtles simulator:$ rosrun turtlesim turtlesim_node
  • Open a new terminal, control node start small turtles: $ rosrun turtlesim turtle_teleop_key

Tools

  • $ rqt_graph: Calculation FIG visual interfaces
  • $ rosnode: Node tool
    • $ rosnode ping node_name: A test connection node
    • $ rosnode list: Lists all of the current node
    • $ rosnode info node_name: View of a node information
    • $ rosnode machine machine_name: List the nodes running on a particular machine or machines list
    • $ rosnode kill node_name: Kill a node
    • $ rosnode cleanup: Clear unreachable node registration information
    • $ rosnode help: View help information
  • $ rostopic: Topic Tools
    • $ rostopic bw topic_name: View of a topic bandwidth
    • $ rostopic delay topic_name: Delayed by a time stamp is displayed in the title topic
    • $ rostopic echo topic_name: Displays the contents of a topic
    • $ rostopic find topic_type: Find a type of topic
    • $ rostopic hz topic_name: View a topic of frequency
    • $ rostopic info topic_name: Displays information about a topic of
    • $ rostopic list: Lists all the current topic
    • $ rostopic pub topic_name: Publish content to a particular topic
      • After entering the name of the topic, double-click the TAB key to complement the default configuration, a data structure of the topic and the specific data
      • For example, input $ rostopic pub /turtle1/cmd_veldouble-click the TAB key, completion information linear velocity and angular velocity angular Twist linear data structure, respectively, and m units of radians respectively.
      • -r rate_numberTopic issuance frequency setting, e.g., input $ rostopic pub -r 10 /turtle1/cmd_veldouble-click the TAB key completion information indicating 10 times the release per topic.
    • $ rostopic type topic_name : The type of viewing a topic (msg)
  • $ rosmsg: Message Tool
    • $ rosmsg show message_name: View the data structure of a message
    • $ rosmsg info message_name: Same as above, showan alias.
    • $ rosmsg list: Lists all of the current message
    • $ rosmsg md5 package_name: _ Unknown _
    • $ rosmsg package package_name: List all messages in a package
    • $ rosmsg packages message_name: List all packets containing the message
  • $ rosservice: Service Tools
    • $ rosservice args: View a service parameter structure
    • $ rosservice call sevice_name: Request a Service
      • After entering the service name, double-click the TAB key completion default structure
      • For example, a request to generate a new service hatchlings, input $ rosservice call /spawndouble-click the TAB key, completion information of the hatchlings are new x, y coordinates, theta angle towards, name name.
    • $ rosservice find service_type: Find a service by service type
    • $ rosservice info sevice_name: View the details of a service
    • $ rosservice list: Lists all current service request
    • $ rosservice type sevice_name: View of a service type
    • $ rosservice uri sevice_name: View a service where the host and port rosrpc
  • $ rosbag: Topics recording tool
    • $ rosbag check: A bag is determined whether the executable file in the current system, movable
    • $ rosbag compress: One or more compressed files bag
    • $ rosbag decompress: Unpack a bag or more files
    • $ rosbag decrypt: Decrypt a file or multiple bag
    • $ rosbag encrypt: Encrypt one or more files bag
    • $ rosbag filterContent filtering bag in:
    • $ rosbag fix: Repair bag make it executable files in the current system
    • $ rosbag help: View help information
    • $ rosbag info: The contents of one or more files bag Overview
    • $ rosbag play: Time synchronized manner one or more content playback package file
    • $ rosbag record: A bag with the contents of the file records of the specified topic
    • $ rosbag reindex: Re-index file one or more bag
    • Common commands
      • Topics record:$ rosbag record -a -O record_file_name
      • Recurring topic:$ rosbag play record_file_name.bag

Practical exercises

  • Start ROS Simulator
    • $ roscore: Start Ros Master
    • $ rosrun turtlesim turtlesim_node : Start small turtles emulator
  • Control instruction
    • turtle1 Draw "O"
      • $ rostopic pub -1 /turtle1/cmd_vel geometry_msgs/Twist '[2.0, 0.0, 0.0]' '[0.0, 0.0, 1.5708]': 90 ° arc to the left
      • $ rostopic pub -1 /turtle1/cmd_vel geometry_msgs/Twist '[2.5, 0.0, 0.0]' '[0.0, 0.0, 0.0]': Front Line 2.5
      • $ rostopic pub -1 /turtle1/cmd_vel geometry_msgs/Twist '[4.0, 0.0, 0.0]' '[0.0, 0.0, 3.1416]': 180 ° arc to the left
      • $ rostopic pub -1 /turtle1/cmd_vel geometry_msgs/Twist '[2.5, 0.0, 0.0]' '[0.0, 0.0, 0.0]': Front Line 2.5
      • $ rostopic pub -1 /turtle1/cmd_vel geometry_msgs/Twist '[2.0, 0.0, 0.0]' '[0.0, 0.0, 1.5708]': 90 ° arc to the left
    • turtle2 Draw "R"
      • $ rosservice call /spawn 1.0 5.5 1.5708 "turtle2": Create a new tortoise turtle2, coordinates (1.0, 5.5), head towards the north
      • $ rostopic pub -1 /turtle2/cmd_vel geometry_msgs/Twist '[5.0, 0.0, 0.0]' '[0.0, 0.0, 0.0]': Front Line 5.0
      • $ rostopic pub -1 /turtle2/cmd_vel geometry_msgs/Twist '[0.0, 0.0, 0.0]' '[0.0, 0.0, -1.5708]': 90 ° right turn situ
      • $ rostopic pub -1 /turtle2/cmd_vel geometry_msgs/Twist '[1.0, 0.0, 0.0]' '[0.0, 0.0, 0.0]': Front Line 1.0
      • $ rostopic pub -1 /turtle2/cmd_vel geometry_msgs/Twist '[4.0, 0.0, 0.0]' '[0.0, 0.0, -3.1416]': 180 ° arc to the right
      • $ rostopic pub -1 /turtle2/cmd_vel geometry_msgs/Twist '[1.0, 0.0, 0.0]' '[0.0, 0.0, 0.0]': Front Line 1.0
      • $ rostopic pub -1 /turtle2/cmd_vel geometry_msgs/Twist '[0.0, 0.0, 0.0]' '[0.0, 0.0, 2.3562]': 135 ° turn left in situ
      • $ rostopic pub -1 /turtle2/cmd_vel geometry_msgs/Twist '[3.5355, 0.0, 0.0]' '[0.0, 0.0, 0.0]': 3.5355 ahead
    • turtle3 Draw "S"
      • $ rosservice call /spawn 8.0 5.5 0.0 "turtle3": Create a new tortoise turtle3, coordinates (10.0, 5.5), head towards the east
      • $ rostopic pub -1 /turtle3/cmd_vel geometry_msgs/Twist '[1.0, 0.0, 0.0]' '[0.0, 0.0, 0.0]': Front Line 1.0
      • $ rostopic pub -1 /turtle3/cmd_vel geometry_msgs/Twist '[4.0, 0.0, 0.0]' '[0.0, 0.0, 3.1416]': 180 ° arc to the left
      • $ rostopic pub -1 /turtle3/cmd_vel geometry_msgs/Twist '[4.0, 0.0, 0.0]' '[0.0, 0.0, -3.1416]': 180 ° arc to the right
      • $ rostopic pub -1 /turtle3/cmd_vel geometry_msgs/Twist '[1.0, 0.0, 0.0]' '[0.0, 0.0, 0.0]': Front Line 1.0
        Here Insert Picture Description
Released three original articles · won praise 1 · views 1621

Guess you like

Origin blog.csdn.net/mashaocong/article/details/104073440