ROS study notes and common commands

Brief description

In order to record some commonly used commands, refer to http://wiki.ros.org/ROS/Tutorials

catkin_make

Use catkin_make to create a catkin workspace

$ mkdir -p ~/catkin_ws/src
$ cd ~/catkin_ws/
$ catkin_make
$ source devel/setup.bash

The setup.bash file can be replaced with the file corresponding to the bash used by myself, I use .zsh myself

rospack find [package_name]

roscd [locationname[/subdir]]

rosls [locationname[/subdir]]

roscp [package_name] [file_to_copy_path] [copy_path]

catkin_create_pkg

Create catkin Package in the src directory of catkin workspace

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

There will be a pakage.xmlfile in the package that records some information about the package (author, etc.) and dependencies.
Generally, there are three dependencies:

  • <buildtool_depend>
  • <build_depend>
  • <exec_depend>

There is also a CMakeList.txtfile in the created package

After creating the package, you need to go back to the root directory of the catkin workspace and execute the catkin_make command.
Refer to http://wiki.ros.org/ROS/Tutorials/BuildingPackages

roscore

It must be executed before using ROS roscore, and there can only be one roscore

rosnode

$ rosnode -h

rosnode

$ rosnode info /rosout

rosnode info / rosout

rosrun

$ rosrun [package_name] [node_name]
$ rosrun turtlesim turtlesim_node __name:=my_turtle	# 使用`__name:=`可以改node名字
 $ rosrun rqt_graph rqt_graph		# 显示节点和节点之间的话题
 $ rqt_graph

rqt_graph

Or enter rqt on the command line, and select Plugins> Introspection> Node Graph in the menu bar :

$ rosrun rqt_plot rqt_plot

rqt_plot

$ rosrun rqt_console rqt_console	# 输出log日志控制台,display output from nodes

rqt_console

$ rosrun rqt_logger_level rqt_logger_level	# fatal级别最高,debug级别最低

Insert picture description here

rostopic

$ rostopic -h

rostopic -h

rostopic list -v		#显示详细信息

rostopic list-v

rosmsg show

$ rosmsg -h

rosmsg -h

$ rostopic type [topic_name] | rosmsg show
$ rostopic pub [topic] [msg_type] [args]

The args parameter is in accordance with YAML requirements

rosservice

$ rosservice -h

rosservice -h

rossrv

$ rosservice type [service_name] | rossrv show

snarled

$ rosparam -h

they hissed -h

roslaunch

$ roslaunch [package] [filename.launch]

reference

  1. http://wiki.ros.org/ROS/Tutorials/UsingRqtconsoleRoslaunch
  2. https://blog.csdn.net/qq_33444963/article/details/77893881

rosed

$ rosed [package_name] [filename]	# 直接编辑包里的文件,不用进入路径里,默认使用vim

rosbag

$ rosbag record # -O parameter can specify the .bag name,
$ rosbag info <your bagfile>
$ rosbag play <your bagfile> # -s parameter starts playing at a certain duration after the beginning, -r changes the rate

The data recorded by rosbag may not be exactly the same as the original

Guess you like

Origin blog.csdn.net/lqysgdb/article/details/113553223