瑞芯微Rockchip开发者社区
直播中

王静

7年用户 684经验值
私信 关注
[问答]

怎样去使用ROS中的launch启动文件呢

怎样去使用ROS中的launch启动文件呢?ROS中的launch启动文件该怎样去使用呢?

回帖(1)

杨秀兰

2022-2-14 14:11:05
Launch文件:通过XML文件实现多节点的配置和启动(可自动启动ROS Master)
Launch文件语法
< l a u n c h >
launch文件中的根元素采用< < >>标签定义
< n o d e >

pkg:节点所在的功能包名称
type:节点的可执行文件名称
name:节点运行时的名称
output, respawn, required, ns, args
参数设置
< p a r a m > / < r o s p a r a m >
设置ROS系统运行中的参数,存储在参数服务器中。

name:参数名
value:参数值
加载参数文件中的多个参数:

< a r g >
launch文件内部的局部变量,仅限于launch文件使用

name:参数名
value:参数值
调用:


< r e m a p >
重映射ROS计算图资源的命名。

from:原命名
to:映射之后的命名
< i n c l u d e >
包含其他launch文件,类似C语言中的头文件包含。

file:包含的其他launch文件路径
更多标签可参见:http://wiki.ros.org/roslaunch/XML
实验
创建功能包
cd ~/catkin_workspace/src
catkin_create_pkg learning_launch
cd learning_launch
mkdir launch
例子
simple.launch
nano ~/catkin_workspace/src/learning_launch/launch/simple.launch

   
   

编译并运行
cd ~/catkin_workspace
catkin_make
# 新建一个终端
source ~/catkin_workspace/devel/setup.bash
roslaunch learning_launch simple.launch


turtlesim_parameter_config.launch
nano ~/catkin_workspace/src/learning_launch/launch/turtlesim_parameter_config.launch


   




   

mkdir ~/catkin_workspace/src/learning_launch/config
nano ~/catkin_workspace/src/learning_launch/config/param.yaml
A: 123
B: "hello"
group:
  C: 456
  D: "hello"
编译并运行
cd ~/catkin_workspace
catkin_make
# 新建一个终端
source ~/catkin_workspace/devel/setup.bash
roslaunch learning_launch turtlesim_parameter_config.launch



start_tf_demo_c++.launch
nano ~/catkin_workspace/src/learning_launch/launch/start_tf_demo_c++.launch

   
   
   
   
   
   
  

编译并运行
cd ~/catkin_workspace
catkin_make
# 新建一个终端
source ~/catkin_workspace/devel/setup.bash
roslaunch learning_launch start_tf_demo_c++.launch


start_tf_demo_py.launch
nano ~/catkin_workspace/src/learning_launch/launch/start_tf_demo_py.launch





  


  

   

编译并运行
cd ~/catkin_workspace
catkin_make
# 新建一个终端
source ~/catkin_workspace/devel/setup.bash
roslaunch learning_launch start_tf_demo_py.launch


turtlesim_remap.launch
nano ~/catkin_workspace/src/learning_launch/launch/turtlesim_remap.launch


   



编译并运行
cd ~/catkin_workspace
catkin_make
# 新建一个终端
source ~/catkin_workspace/devel/setup.bash
roslaunch learning_launch turtlesim_remap.launch



# 新建一个终端
source ~/catkin_workspace/devel/setup.bash
rqt_graph

rostopic list


rostopic pub /cmd_vel geometry_msgs/Twist "linear:
  x: 1.0
  y: 0.0
  z: 0.0
angular:
  x: 0.0
  y: 0.0
  z: 0.0"


# 新建一个终端
source ~/catkin_workspace/devel/setup.bash
rqt_graph
举报

更多回帖

发帖
×
20
完善资料,
赚取积分