roslaunch用于方便我们一下子启动多个节点
1.常用语法(这里只列举我个人常用的一部分)
更全的roslaunch语法看官网
roslaunch <package-name> <launch-filename> [args]
roslaunch <launch-file-paths...> [args]
[args] 是非必须部分,用来传递参数
2.launch文件结构
<launch> 任何launch文件必须要有的部分,表明这是个launch文件
<node> 表明你要运行的节点
<param> Set a parameter on the Parameter Server
<remap> Declare a name remapping.
<machine> Declare a machine to use for launching.
<rosparam>Set ROS parameters for the launch using a rosparam file.
<include> Include other roslaunch files.
<env> Specify an environment variable for launched nodes.
<test> Launch a test node (see rostest).
<arg> Declare an argument.
<group> Group enclosed elements sharing a namespace or remap.
2.1 < node >
<node name="listener1" pkg="rospy_tutorials" type="listener.py" args="--test" respawn="true" />
用包rospy_tutorials里的可执行文件listener.py来运行节点,并给他取名叫为listener1,用到的命令行是–test,且这个节点会自动复活
2.2 < param >
把parameter放进参数服务器里,相当于设置静态变量供各个节点使用
< param name="publish_frequency" type="double" value="10.0" />