yml写法:
yaml
launch:
- node:
pkg: "pub_app"
exec: "publisher"
name: "pub_app"
namespace: "desertrescue"
- node:
pkg: "sub_app"
exec: "minimal_subscriber"
name: "minimal_subscriber"
namespace: "desertrescue"
直接ros2 launch /pathto/yml
xml写法:
xml
<launch>
<node pkg="pub_app" exec="publisher" name="pub_app" output="screen">
</node>
</launch>
还可以直接指定参数文件:
xml
<launch>
<node pkg="my_package" exec="my_node" name="my_node_name" output="screen">
<param from="path/to/params.yaml"/>
</node>
</launch>
或:
xml
<launch>
<node pkg="my_package" exec="my_node" name="my_node" output="screen">
<param from="$(find my_package)/config/params.yaml"/>
</node>
</launch>
但xml写法需要将xml文件通过cmake或人工拷贝到ros2 install对应的节点路径的share目录下,否则会报错
拷贝之后直接ros2 launch pkg xxx.xml即可,tab会弹出可选xml