当前位置:网站首页>16、 Launch file label of ROS (II)
16、 Launch file label of ROS (II)
2022-07-28 14:53:00 【Rock magnon】
List of articles
1、launch Document labels
1.param
- It is mainly used to set parameters on the parameter server , It can be loaded through external files
- attribute :
- name=“ Namespace / Parameter name ”
- Parameter name , Can contain namespaces
- value=“xxx”( Optional )
- Define parameter values , If omitted here , You must specify an external file as the parameter source
- type=“str/int/double/bool/yaml”( Optional )
- If the parameter type is not specified , The system will try to determine the parameter type , The following rules :
- contain . Numbers : Think of it as floating point
- It doesn't contain . The number of : Think it's an integer
- Others are strings
- If the parameter type is not specified , The system will try to determine the parameter type , The following rules :
- name=“ Namespace / Parameter name ”
- Code implementation : There are two formats
<launch deprecated = " Disclaimer "> <!-- Disclaimer , Warnings will be given during operation --> <!-- Format 1:launch Next ,node Outside --> <param name="param_A" type="int" value="100" /> <node pkg="turtlesim" type="turtlesim_node" name="myturtle" output="screen" > <remap from="/turtle1/cmd_vel" to="/cmd_vel" /> <!-- Format 2:node Inside , The user-defined node name will be added before the parameter --> <param name="param_B" type="double" value="1.2" /> </node> <node pkg="turtlesim" type="turtle_teleop_key" name="mykey" output="screen" /> </launch> - Running results :
/myturtle/param_B /param_A
2.rosparam
- effect : from yaml Import... Into the file , export , Delete parameters
- attribute :
- command=“load/dump/delete”( The default is load)
- file=“$(find xxxx)/xxxx/xxxx…”
- File load export path
- param=“ Parameter name ”( Optional ), Used to determine the parameters under that node
- ns=“ Namespace ”( Optional )
- Implementation steps :
- Write parameter file yaml
R: 200 G: 300 B: 400- load: Import parameters
- Code implementation :( Two formats )
<launch deprecated = " Disclaimer "> <!-- Disclaimer , Warnings will be given during operation --> <!-- Load parameters --> <!-- Format 1: stay node External loading --> <rosparam command="load" file="$(find launch_test_01)/launch/params.yaml" /> <node pkg="turtlesim" type="turtlesim_node" name="myturtle" output="screen" > <!-- Format 2: stay node Internal loading , There will be one more node name defined by yourself --> <rosparam command="load" file="$(find launch_test_01)/launch/params.yaml" /> </node> <node pkg="turtlesim" type="turtle_teleop_key" name="mykey" output="screen" /> </launch> - Running results :
PARAMETERS * /B: 400 * /G: 300 * /R: 200 * /myturtle/B: 400 * /myturtle/G: 300 * /myturtle/R: 200
- dump: Export parameters
- Code implementation :
turtle_start.launch( The node and the export command are in the same file )
params.launch( The node and the export command are not in the same file )<launch deprecated = " Disclaimer "> <!-- Disclaimer , Warnings will be given during operation --> <!-- Load parameters --> <!-- Format 1: stay node External loading --> <rosparam command="load" file="$(find launch_test_01)/launch/params.yaml" /> <!-- Format 1: stay node Export , All parameters will be exported , But sometimes some parameters will be exported , You'd better write one by yourself launch file , Export parameters --> <!-- Specifies the namespace , Only the parameters in the renamed space will be exported --> <rosparam command="dump" file="$(find launch_test_01)/launch/params_out1.yaml" ns="myturtle" /> <rosparam command="dump" file="$(find launch_test_01)/launch/params_out2.yaml" /> <node pkg="turtlesim" type="turtlesim_node" name="myturtle" output="screen" > <!-- Format 2: stay node Internal loading , There will be one more node name defined by yourself --> <rosparam command="load" file="$(find launch_test_01)/launch/params.yaml" /> <!-- Format 2: stay node Internal export , Only the parameters under the current node will be exported --> <rosparam command="dump" file="$(find launch_test_01)/launch/params_out3.yaml" /> </node> <node pkg="turtlesim" type="turtle_teleop_key" name="mykey" output="screen" /> </launch> ```xml <launch deprecated = " Disclaimer "> <!-- Disclaimer , Warnings will be given during operation --> <!-- Load parameters --> <!-- Format 1: stay node External loading --> <rosparam command="load" file="$(find launch_test_01)/launch/params.yaml" /> <!-- Format 1: stay node Export , All parameters will be exported , But sometimes some parameters will be exported , You'd better write one by yourself launch file , Export parameters --> <!-- Specifies the namespace , Only the parameters in the renamed space will be exported --> <rosparam command="dump" file="$(find launch_test_01)/launch/params_out1.yaml" ns="myturtle" /> <rosparam command="dump" file="$(find launch_test_01)/launch/params_out2.yaml" /> <node pkg="turtlesim" type="turtlesim_node" name="myturtle" output="screen" > <!-- Format 2: stay node Internal loading , There will be one more node name defined by yourself --> <rosparam command="load" file="$(find launch_test_01)/launch/params.yaml" /> <!-- Format 2: stay node Internal export , Only the parameters under the current node will be exported --> <rosparam command="dump" file="$(find launch_test_01)/launch/params_out3.yaml" /> </node> <node pkg="turtlesim" type="turtle_teleop_key" name="mykey" output="screen" /> </launch><launch> <!-- Write a single launch file , Prevent incomplete parameter Export --> <rosparam command="dump" file="$(find launch_test_01)/launch/params_out4.yaml" /> </launch> - Running results :
params_out1.yaml
params_out2.yamlB: 400 G: 300 R: 200 background_b: 255 background_g: 86 background_r: 69 param_B: 1.2
params_out3.yamlB: 400 G: 300 R: 200 myturtle: B: 400 G: 300 R: 200 background_b: 255 background_g: 86 background_r: 69 param_B: 1.2 param_A: 100 rosdistro: 'noetic ' roslaunch: uris: host_d102_w65kj1_kk1__33231: http://d102-W65KJ1-KK1:33231/ host_d102_w65kj1_kk1__33309: http://d102-W65KJ1-KK1:33309/ host_d102_w65kj1_kk1__33799: http://d102-W65KJ1-KK1:33799/ host_d102_w65kj1_kk1__43485: http://d102-W65KJ1-KK1:43485/ host_d102_w65kj1_kk1__44799: http://d102-W65KJ1-KK1:44799/ host_d102_w65kj1_kk1__45711: http://d102-W65KJ1-KK1:45711/ host_d102_w65kj1_kk1__46191: http://d102-W65KJ1-KK1:46191/ rosversion: '1.15.14 ' run_id: 0f399634-f437-11ec-a9f9-9bef9f37954f
params_out4.yamlB: 400 G: 300 R: 200 background_b: 255 background_g: 86 background_r: 69 param_B: 1.2B: 400 G: 300 R: 200 myturtle: B: 400 G: 300 R: 200 background_b: 255 background_g: 86 background_r: 69 param_B: 1.2 param_A: 100 rosdistro: 'noetic ' roslaunch: uris: host_d102_w65kj1_kk1__33231: http://d102-W65KJ1-KK1:33231/ host_d102_w65kj1_kk1__33309: http://d102-W65KJ1-KK1:33309/ host_d102_w65kj1_kk1__33799: http://d102-W65KJ1-KK1:33799/ host_d102_w65kj1_kk1__40997: http://d102-W65KJ1-KK1:40997/ host_d102_w65kj1_kk1__43485: http://d102-W65KJ1-KK1:43485/ host_d102_w65kj1_kk1__44799: http://d102-W65KJ1-KK1:44799/ host_d102_w65kj1_kk1__45711: http://d102-W65KJ1-KK1:45711/ host_d102_w65kj1_kk1__46191: http://d102-W65KJ1-KK1:46191/ rosversion: '1.15.14 ' run_id: 0f399634-f437-11ec-a9f9-9bef9f37954f
- delete: Delete parameters
- Code implementation :
<launch> <rosparam command="delete" param="/B" /> </launch>
- Code implementation :
3.group
- effect : Grouping nodes , Make the node have ns attribute , So you can start the same node , Use namespaces to distinguish
- attribute :
- ns=“ The name space ”( Optional )
- clear_params=“true/false”( Optional : Use with caution )
- Code implementation :
<launch> <group ns="first" clear_params="true"> <node pkg="turtlesim" type="turtlesim_node" name="myturtle" output="screen" /> <node pkg="turtlesim" type="turtle_teleop_key" name="mykey" output="screen" /> </group> <group ns="second" clear_params="true"> <node pkg="turtlesim" type="turtlesim_node" name="myturtle" output="screen" /> <node pkg="turtlesim" type="turtle_teleop_key" name="mykey" output="screen" /> </group> </launch> - Running results :
rosnode list /first/mykey /first/myturtle /myturtle /rosout /second/mykey /second/myturtle
4.arg
- effect : For dynamic parameter transfer , Parameter reuse
- attribute :
- name=“ Parameter name ”
- default=“ The default value is ”( Optional )
- value=“ The number ”( Optional ,default and value Can't exist at the same time )
- doc=“ Parameter description ”
- Code implementation :
<launch> <!-- Be careful ,default and value Can't exist at the same time --> <rosparam command="delete" param="/B" /> <arg name="car_weight" default="2.3" doc="this is a test" /> <arg name="car_length" value="2.3" doc="this is a test" /> <param name="weight" value="$(arg car_weight)" /> <param name="length" value="$(arg car_length)" /> </launch> - Running results :
rosparam list /length /weight - Command assignment :
roslaunch launch_test_01 arg.launch car_weight:=0.8
边栏推荐
- Read the introduction tutorial of rainbow
- 为自定义属性包装类型添加类 @Published 的能力
- 数字化转型安全问题频发,山石网科助力数字政府建设
- 复制excel行到指定行
- ScottPlot入门教程:获取和显示鼠标处的数值
- 多商户商城系统功能拆解17讲-平台端订单列表
- How to perform batch operations in core data
- Iterator iterator interface
- How long can we "eat" the dividends of domestic databases?
- Some problems encountered in the development of Excel VBA, solutions, and continuous updates
猜你喜欢

Hcip day 12

Floating point data type in C language (did you learn to waste it)

Redis-持久化

VTK annotation class widget vtkborderwidget

MITK create module

2022 melting welding and thermal cutting examination questions and online simulation examination

Simple data analysis using Weka and excel

ScottPlot入门教程:获取和显示鼠标处的数值

Redis-配置文件讲解

MQTT入门级简单介绍与使用
随机推荐
Qt中QTableView设置分页显示的三种方法[通俗易懂]
How to make the characters in the photos laugh? HMS core video editing service one click smile function makes people smile more naturally
linux安装mysql
面试官:ThreadLocal使用场景有哪些?内存泄露问题如何避免?
Hcip day 10
Installing MySQL on Linux
How to reduce the resolution of only 3D camera but not UI camera
为什么jq的匿名函数 外部可以访问到里面的方法
工厂模式和构造函数模式
On July 29, apachecon | apachepulsar's exploration and practice in vivo will be broadcast soon
js的实例化方式
468 product planning and promotion plan (150 copies)
Introduction to MITK
Why can the anonymous functions of JQ access the methods inside
Many "double first-class" universities have launched the research guarantee and prediction name!
Multi merchant mall system function disassembly lecture 17 - platform side order list
Excel VBA 开发过程中遇到的一些问题,解决方案,持续更新
35道MySQL面试必问题图解,这样也太好理解了吧
Simple data analysis using Weka and excel
Analysis of thrift serialization protocol