当前位置:网站首页>Introduction to common ROS commands

Introduction to common ROS commands

2022-06-13 01:38:00 lainegates

Reference resources ROS Official website tutorial

Command Completion

ROS The system is more complex , To simplify command input ,ROS Some of the tools provided by tab Complement function .
for example ,

$ roscd roscpp_tut<<< Press TAB key >>>

You'll get

$ roscd roscpp_tutorials/

Package compilation catkin***

Create a package catkin_create_pkg

Create a package , And specify dependencies

catkin_create_pkg <package_name> [depend1] [depend2] [depend3]

Build package catkin_make

catkin_make The tool should be called at the bottom cmake, It passes through CMakeLists.txt To set the compilation information .

command explain
catkin_make [make_targets] [-DCMAKE_VARIABLES=…] Command style , Bottom call cmake
catkin_make install Be similar to cmake install
catkin_make --source [my_source_dir] Place the compiled contents of the code in the specified directory in the current directory

Non runtime tools

Package management tools rospack = ros + pack(age)

rospack yes rosbash Part of the command set ,rospack Allows you to get information about the package , Detailed view .

command explain
rospack find [package_name] Find the path where the package is located
rospack depends1 [package_name] View package level dependencies ( Directly dependent packages ), With view [package_name]/package.xml Of <build_depend> Label equivalence .
rospack depends [package_name] View all dependent packages ( Recursively view all dependent packages )

Catalog roscd = ros + cd

roscd yes rosbash Part of the command set , It allows you to switch directories directly (cd) To a package or package set .

roscd You can only switch to those paths that are already included in ROS_PACKAGE_PATH Packages in environment variables .
ROS_PACKAGE_PATH The value of is determined by (:) Separate
see ROS_PACKAGE_PATH The path contained in :

$ echo $ROS_PACKAGE_PATH
command explain
roscd [locationname[/subdir]]roscd roscpp/cmake , Enter the package cmake subdirectories
roscd log Enter the package log Catalog

Catalog rosls = ros + ls

rosls yes rosbash Part of the command set , It allows you to execute directly by the package name ls command ( Instead of entering an absolute path ).

$ rosls roscpp_tutorials

Packet message protocol (rosmsg) Tools

This tool is used to view the *.msg Generated message object information

command explain
rosmsg show Output message definition
rosmsg list List all supported messages
rosmsg md5 Output News md5 value
rosmsg package Enumerate all messages supported by the package
rosmsg packages List messages supported by multiple packages

Package service agreement (rossrv) Tools

This tool is used to view the *.srv Generated message object information

command explain
rossrv show [srv-name] Definition of the output service agreement
rossrv info [srv-name] Equivalent to rossrv show
rossrv list List all supported service agreements
rossrv md5 Of the output service agreement md5 value
rossrv package List all service agreements supported by the package ( Name only )
rossrv packages List the service agreements supported by multiple packages ( Name only )

Runtime tools

Master node roscore

Start master node

roscore

node rosnode (ros+node)

command explain
rosnode list View the running node
rosnode info [package name] View node status , Nodes such as rosnode info /rosout
rosnode cleanup Empty nodes
rosnode ping [node_name] Check the operation node

Start node rosrun (ros+run)

rosrun Run the nodes in the software package directly according to the package name , You don't need to know the path of the package .

$ rosrun [package_name] [node_name]

for example , Run the little turtle

rosrun turtlesim turtlesim_node  #  function  turtlesim  Bag  turtlesim_node   node 

Topic command rostopic (ros+topic)

rostopic Command tools are used to get ROS Information about the topic .

rostopic bw Output bandwidth
rostopic delay Input delay
rostopic echo [topic] Information output to the screen
rostopic find [topic] Find by type topic
rostopic hz [topic] Output information frequency (Hz)
rostopic info [topic] Output activity topic Information about
rostopic list List activities topic
rostopic pub [topic] [msg_type] [args] towards [topic] Release (publish) [msg_type] Information of type information , Parameter is [args.] , See the following example
rostopic type [topic] Output topic The message type of , As coordinates (x,y,z)
rostopic -h see rostopic All operations supported
rostopic -h see rostopic Specific instructions for operation

towards topic Examples of publishing messages ( edition ROS Groovy )

$ rostopic pub -1 /turtle1/command_velocity turtlesim/Velocity  -- 2.0  1.8
  • -1, The news is only released once , Such as the input -r 1, with 1Hz frequency publish Repeat message
  • /turtle1/command_velocity,topic Name
  • turtlesim/Velocity, Message type
  • --, Separator , The following are parameters of the current data type ( namely 2.0 1.8

The service command

Service is ROS Another way the system transmits information , And topic The difference is that :

  • Service is like making phone calls , Yes, there is.
  • topic Like watching TV , At one end , Close at one end .

Server command rosservice

The service command explain
rosservice list Output information about active services
rosservice call [service] [args] Call the service with the given parameters
rosservice type [service] Type of output service
rosservice find Find services by service type
rosservice uri Output service ROSRPC uri

Server parameters rosparam

rosparam For storage and operation ROS Parameters , Use YAML Grammar of markup language :

  • 1 Integer.
  • 1.0 It's floating point
  • one Is string
  • true It's Boolean
  • [1, 2, 3] Is a list of integers
  • {a: b, c: d} It's a dictionary .
Support operation explain
rosparam set [param_name] Set parameters
rosparam get [param_name] To obtain parameters , If write / You will get all the contents of the parameter
rosparam load [file_name] [namespace] Load parameters from file
rosparam dump [file_name] [namespace] Dump parameters to a file
rosparam delete Delete parameters
rosparam list List parameter names
原网站

版权声明
本文为[lainegates]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202280551219933.html