Ubuntu’s happy learning 3 – ros’s launch usage

Hits: 0

[Ubuntu] ‘s happy learning 3 – ros’s launch usage

study foreword

For the alliance!

what is launch

roslaunch is a directive in ros.
launch is used to launch nodes in batches in ros.

How to use launch

1. Simple use

<launch>
    <node pkg="package" type="pub_test" 
            />
    <node pkg="package" type="sub_test" 
            />
</launch>

Where pkg is the package name, type is the file name, and name is the node name.

2. Common labels

1. launch tag

Everything in the launch file is included in <launch> </launch>between.

<launch>
    ……
</launch>

2, node label

The node label can be said to be the most common label in the launch file. Each node label includes the name attribute name of the node in the ROS graph, the package name pkg where the node is located, and the type of the node.

  1. , used to specify the node name node_name.
  2. pkg=”PACKAGE_NAME”, the name of the package where the node is located.
  3. type=”FILE_NAME”, if the name of the executable file is written in Python, fill in xxx.py, if it is cpp, write the name of the executable file generated by compilation.
  4. output=”screen”: The terminal output is dumped on the current console, not in the log file, if output=”log” is output in the log file.
  5. respawn=“true” After roslaunch starts all the nodes that should be started, it will monitor each node to ensure their normal running status. For any node, when it terminates, roslaunch will restart the node
  6. required=”true” If the node dies, kill the entire roslaunch.
  7. args = “arg1 arg2 arg3” means input parameters

<node pkg="learning_tf" type="turtle_tf_broadcaster" args="/turtle1"  />

3. include tag

Can be used to import another launch file
file=”$(find learning_launch)/launch/simple.launch” is used to specify the file we want to include.

<include file="$(find learning_launch)/launch/simple.launch" />

4. Remap label

The remap tag is used for opic remapping, and the remap tag contains an original-name and a new-name.
If your current node subscribes to the topic “/remap_test”, but another node publishes the topic “/demo/remap_test”

<remap from="remap_test" to="demo/remap_test"/>

This will directly remap /remap_test to /demo/remap_test.
If the remap tag is written at the same level as the node element, and at the top level within the launch element. Then this remapping will apply to all nodes in the launch file.

5. param tag

The role of the param tag is equivalent to the rosparam set on the command line

<param />

6. rosparam day

The rosparam tag allows importing a large number of parameters at once from a YAML file.
It is used like this:

<rosparam file="$(find learning_launch)/config/param.yaml" command="load"/>

Leave a Reply

Your email address will not be published.