当前位置:网站首页>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
边栏推荐
- SwiftUI 的动画机制
- Installing MySQL on Linux
- Added the ability of class @published for @cloudstorage
- RPC (remote procedure call protocol) telecommunication framework
- 基于 MinIO 对象存储保障 Rancher 数据
- Ability to add class @published for custom attribute wrapper types
- Swiftui layout - size (top)
- Hand in hand from 0 to a "Nuggets special attention" Google plug-in, 5000 words detailed vue3 responsive principle, the advantages, disadvantages and choices of several cache read-write schemes, flyin
- 为自定义属性包装类型添加类 @Published 的能力
- 如何在 Core Data 中进行批量操作
猜你喜欢

八、picker用法 下拉框选择效果
Robot mathematics foundation 3D space position representation space position

Floating point data type in C language (did you learn to waste it)
![[线程安全问题] 多线程到底可能会带来哪些风险?](/img/79/112ab7e586b0bceb296dfddb2728be.png)
[线程安全问题] 多线程到底可能会带来哪些风险?

2022 safety officer-a certificate operation certificate examination question bank simulated examination platform operation

Tdengine helps Siemens' lightweight digital solutions

@Solution to DS ('slave') multi data source compatible transaction problem

Focus on differentiated product design, intelligent technology efficiency improvement and literacy education around new citizen Finance

Installing redis in Linux

9、 Uni popup usage popup effect at the bottom of the drop-down box
随机推荐
SwiftUI 布局 —— 尺寸( 下 )
Product Manager
(function(global,factory){
How many ways can multithread run in sequence?
Redis-配置文件讲解
ssh服务
【LeetCode】 贴纸拼词(动态规划)
How long can we "eat" the dividends of domestic databases?
八、picker用法 下拉框选择效果
Installing MySQL on Linux
9、 Uni popup usage popup effect at the bottom of the drop-down box
Qtableview in QT sets three methods of paging display [easy to understand]
Redis configuration file explanation
Reptile: from introduction to imprisonment (I) -- Concept
Swiftui 4.0's new navigation system
Iterator iterator interface
看了就会的 Rainbond 入门教程
C# 获取当前路径7种方法
Excel VBA 免密查看VBE加密代码
The method of implementing simple student achievement management system with C language