The actual meaning, definition and search method, and specific location of node name, package, and type in ROS launch

15940003:

The specific location of pkg and type in the ros launch file_View the address of the launch file_Blue Feather Flying Bird's Blog-CSDN Blog

I checked a lot on the Internet about the pkg and type in the lauch file. They all say that it is a package and an executable file. It is not clear which folder this file is in. I have practiced it and recorded it.
This is not about how to write the launch file, nor is it about starting multiple nodes, only one node is written, in order to explain where pkg and type are.

Here is the full flow for an example:

    cd ~/git (other folders are also available)
    git clone https://github.com/ethz-asl/ros_best_practices.git
    ln -s ~/git/ros_best_practices/ ~/catkin_ws/src/ (create symbolic link, multiple It is more convenient for projects)
    cd ~/catkin_ws
    catkin build ros_package_template (ros_package_template is in the ros_best_practices folder)
    source devel/setup.bash (update work space)
    you can see that there is already a ros_package_template.launch
    can be started directly with the roslaunch ros_package_template ros_package_template.launch command

If you want to write a launch file and start it through the launch file, you can use the following template

<launch>
  <node pkg="" type="" name=""  output="screen">
  </node>
</launch>

The question now is which pkg and type should write

You can see the newly built ros_package_template folder in the ~/catkin_ws/devel/lib folder, enter the ros_package_template folder and find an executable file ros_package_template, so pkg is the name of the folder ros_package_template, and type is the
executable file The name ros_package_template (although they are the same), the name can be taken by itself, still take ros_package_template

The content of this launch file is as follows, named test.launch, assuming it is placed under ~/git

<launch>
  <node pkg="ros_package_template" type="ros_package_template" name="ros_package_template" output="screen">
  </node>
</launch>

Use roslaunch ~/git/test.launch to start it


Set the yaml file in the launch file

1. Set directly, use the xml file format, and the yaml file format will report an error

 https://blog.csdn.net/ljx0365/article/details/115058744

2. Directly set the path of the yaml file

<launch>

<node name="vins_node" pkg="vins" type="vins_node" output="screen" args="/xx/xx/x/.yaml"/>

</launch>

详见:roslaunch command line args - ROS Answers: Open Source Q&A Forum

<launch>
   <node pkg="my_package" type="my_node" name="node_instance" args="-arg1 -arg2" />
</launch>

Guess you like

Origin blog.csdn.net/weixin_45834800/article/details/131891771