ROS2 Launch文件
在ROS1中launch文件是一种格式以.launch结尾的xml文档;而在ROS2中推荐使用Python方式编写launch文件,此时的launch文件是一种格式以.launch.py结尾的Python脚本。
LaunchDescription
对于一个基础的启动节点的launch文件,需要引用以下库,然后创建一个名为做generate_launch_description的函数:
from launch import LaunchDescription
from launch_ros.actions import Node
def generate_launch_description():
创建LaunchDescription的对象ld(名字任意)
# Create the launch description and populate
ld = LaunchDescription()
# Declare the launch options
ld.add_action(declare_urdf_model_path_cmd)
package
获取package路径
# Set the path to this package.
pkg_share = FindPackageShare(package='roarm').find(