ROS-Launch file basic operations

Launch file: realize the configuration and startup of multiple nodes through xml files (the ROS Master can be started automatically).

1. Basic grammar:

1. <launch>: The root element in the launch file is defined by the <launch> tag.

2. <node>: start the node. Syntax: <node pkg="package-name" type="executable-name" name="node-name" />

        (1) pkg: The name of the function package where the node is located.

        (2) type: The executable file name of the node.

        (3) name: The name of the node when it is running. Name it yourself, which will override the name of the executable at runtime.

        (4) Other parameters: output, respawn, required, ns, args, etc.

3. Parameter setting:

        (1) Set the parameters in the operation of the ROS system and store them in the parameter server.

        Such as: <param name="output_frame" value="odom" />, where name represents the parameter name, and value represents the parameter value.

        To load multiple parameters in a parameter file, use: <rosparam file="params.yaml" command="load" ns="params"/> where file indicates the path of the parameter file, and command indicates the operation performed on the parameter file. ns means to place the loaded parameters under this namespace.

        (2) The local variables inside the launch file are only used by the launch file.

        Such as: <arg name="arg-name" default="arg-value" />, where name represents the parameter name, and value represents the parameter value. Local variable call: <param name="foo" value="$(arg arg-name)" /> or <node name="node" pkg="package" type="type" args="$(arg arg -name)" />

        (3) Remap the naming of ROS computing graph resources.

        For example: <remap from="/turtlebot/cmd_vel" to="/cmd_vel" />, where from is the original name, and to is the name after remapping.

        (4) Include other launch files, similar to header files included in C/C++ language

        Such as: <include file="$(dirname)/other.launch" />, where file indicates the path containing other launch files.

Use roslaunch <function package name> <launch file name> to start the launch file. Example of a launch file:

Guess you like

Origin blog.csdn.net/xiao_qs/article/details/130637877