当前位置:网站首页>Ros2 learning notes (V) learn ros2 parameters from turnlesim
Ros2 learning notes (V) learn ros2 parameters from turnlesim
2022-04-22 12:29:00 【Xicheng Xiaokai】
from turtlesim Study ROS2 Parameters
Preface
Study ROS2 Way , Not through learning ROS1 Instead of , because ROS2 Of “ kernel ” differ ROS1, We must seriously start from scratch and learn again .
Ubuntu edition :20.04
ROS edition :Foxy
Review of study notes
- ROS2 Learning notes ( One ) Get document
- ubuntu20.04 install ROS2 and ROS1 coexistence
- ROS2 Learning notes ( Two ) from turtlesim Study ROS2 node
- ROS2 Learning notes ( 3、 ... and ) from turtlesim Study ROS2 The theme
- ROS2 Learning notes ( Four ) from turtlesim Study ROS2 service
1.ROS2 param
Whether it's ROS1 still ROS2, Parameters are very important knowledge points , It is mainly the configuration of node functions , stay ROS2 Each node in the has its own parameters .
2. Start the little turtle simulator first
$ ros2 run turtlesim turtlesim_node
$ ros2 run turtlesim turtle_teleop_key
3.ros2 param list
This command can be used to view all parameters of the current node , Enter the following command in the new terminal :
$ ros2 param list
----
/teleop_turtle:
qos_overrides./parameter_events.publisher.depth
qos_overrides./parameter_events.publisher.durability
qos_overrides./parameter_events.publisher.history
qos_overrides./parameter_events.publisher.reliability
scale_angular
scale_linear
use_sim_time
/turtlesim:
background_b
background_g
background_r
qos_overrides./parameter_events.publisher.depth
qos_overrides./parameter_events.publisher.durability
qos_overrides./parameter_events.publisher.history
qos_overrides./parameter_events.publisher.reliability
use_sim_time
Because we opened two nodes , So you can see the nodes /teleop_turtle and /turtlesim, This is followed by all parameters of each node .
Every node has use_sim_time Parameters .
4.ros2 param get
This command can get the type and current value of the parameter , Command format :
$ ros2 param get <node_name> <parameter_name>
We get background_g Parameter to get the green value in the background color .
$ ros2 param get /turtlesim background_g
----
Integer value is: 86
You can see that the type returned is an integer , The value is 86.
Of course , obtain background_r and background_b It's all the same .
5.ros2 param set
The change command can change the running parameters , The command format is as follows :
$ ros2 param set <node_name> <parameter_name> <value>
At this time , We can try to change the background color of the little turtle simulator red Value :
$ ros2 param set /turtlesim background_r 150
----
Set parameter successful
Return to see successful Description parameter setting succeeded , The effect is as follows :

set The command does not permanently change parameter values , Can only be saved in the current process .
6.ros2 param dump
This command can save the parameters and reload the saved parameters after starting the node next time , The command format is as follows :
$ ros2 param dump <node_name>
Try to save the settings above /turtlesim Background color parameters , The command is as follows :
$ ros2 param dump /turtlesim
----
Saving to: ./turtlesim.yaml
The configuration file will be saved to the current running directory , Double click to open view , The contents of the document are as follows :
/turtlesim:
ros__parameters:
background_b: 255
background_g: 86
background_r: 150
use_sim_time: false
7. Load parameter file
You can use the following command format to load the parameter file into the currently running node :
$ ros2 param load <node_name> <parameter_file>
take ./turtlesim.yaml Add to /turtlesim Go to the node , Use the following command :
$ ros2 param load /turtlesim ./turtlesim.yaml
----
Set parameter background_b successful
Set parameter background_g successful
Set parameter background_r successful
Set parameter use_sim_time successful
After successful startup , The background as like as two peas and the same color as manually modified on the simulator are then available. .
summary
This is it. ROS2 Parameters in , We can use the command line get or set Parameter values , You can also use files to save and load parameters .
Reference:
https://docs.ros.org/en/foxy/Tutorials/Parameters/Understanding-ROS2-Parameters.html
Conclusion
This paper is also based on the author's learning and use experience , Strong subjectivity , If there is anything wrong or unclear , Welcome to leave a message in the comments area ~
In order to further discuss the problem with the readers , Set up a wechat group , It's convenient to answer your questions , You can also discuss problems together .
Add group links
版权声明
本文为[Xicheng Xiaokai]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204221223330401.html
边栏推荐
- The difference between let and VaR
- 【并发编程050】内存屏障的种类以及说明?
- Whether l3-010 is complete binary search tree (30 points)
- LeetCode 695、岛屿的最大面积
- Pytorch processes RNN input variable length sequence padding
- Ner brief overview
- 【深入理解TcaplusDB技术】扫描数据接口说明——[List表]
- 【并发编程051】volatile 内存语义的实现原理
- matlab 自动选择不标准桥梁跨径代码(源代码完全版)
- About the case of server URL
猜你喜欢
![[logical fallacies in life] controlling violence with violence and suppressing rationality](/img/5a/2d69a7ae6e2ac108cd2bd937f3fcdf.jpg)
[logical fallacies in life] controlling violence with violence and suppressing rationality

C语言%7.2d、%-7d、%7.2f、%0.2f的含义
![[concurrent programming 054] multithreading status and transition process?](/img/b0/7f6bb898fb58477c73023135bd49db.png)
[concurrent programming 054] multithreading status and transition process?

MySQL 5.0安装教程图解详细教程
![[concurrent programming 052] talk about double check lock and its advantages?](/img/45/0d35b6b358f6605c46300f749dcd3d.png)
[concurrent programming 052] talk about double check lock and its advantages?

Share a recent tag

【生活中的逻辑谬误】以暴制暴和压制理性

栈的概念和操作

LeetCode 206、反转链表

Meaning of C language% 7.2d, --7d,% 7.2f,% 0.2f
随机推荐
Best buy website EDI test process
The higher the refresh rate, the better?
MySQL 5.0 installation tutorial illustration detailed tutorial
使用PHPstudy开启MySQL服务,并创建一个数据库
nt10. 0 system (server2016 / 2019) runtimebroker abnormally shut down, associated event ID 142 / 143 / 226 / 227 / 228, etc
Knowledge points that need to be recorded in the work
let和var的区别面试题答案
JS基础9
Low frequency (LF) RFID intelligent terminal
JS基础11
How to compare the hardware configuration when buying mobile phones of different brands?
matlab 自动选择不标准桥梁跨径代码(源代码完全版)
Remember a study of Intranet penetration into the shooting range
H5<canvas>标签+原生JS 自制一个简易画图工具
刷了一千道选择题,我总结了这些C语言易错点【第二弹】
Case 4-1.4: path in the reactor (simulation establishment and simulation path of small top reactor)
STM32 中的0UL或1UL是什么意思?
腾讯云域名绑定
.NET宝藏API之:OutputFormatter,格式化输出对象
【并发编程051】volatile 内存语义的实现原理