当前位置:网站首页>ROS series (IV): ROS communication mechanism series (6): parameter server operation
ROS series (IV): ROS communication mechanism series (6): parameter server operation
2022-04-23 03:37:00 【Yi Lanjun】
Requirements describe : modify turtlesim Tortoise displays the background color of the node form , It is known that the background color is displayed in the form of parameter server rgb The way to set up .
Result demonstration :
Implementation process :
- adopt ros Command to get parameters .
- Code to implement the service parameter setting node .
- start-up roscore、turtlesim_node And parameter setting node , View the run results .
1 Parameter name acquisition
Get parameter list :
rosparam list
In response to the results :
/turtlesim/background_b
/turtlesim/background_g
/turtlesim/background_r
2 Parameters change (C++)
/* Pay attention to the use of namespaces . */
#include "ros/ros.h"
int main(int argc, char *argv[])
{
ros::init(argc,argv,"haha");
ros::NodeHandle nh("turtlesim");
//ros::NodeHandle nh;
// ros::param::set("/turtlesim/background_r",0);
// ros::param::set("/turtlesim/background_g",0);
// ros::param::set("/turtlesim/background_b",0);
nh.setParam("background_r",0);
nh.setParam("background_g",0);
nh.setParam("background_b",0);
return 0;
}
3 function
- First , start-up roscore;
- Then start the background color setting node ;
- Finally, start the tortoise display node ;
- The final execution result is similar to the demonstration result .
PS: Note the node startup sequence , If you start the tortoise display node first , After the node is started, the background color is set , Then the color setting will not take effect .
4 Modify parameters in other ways
The way 1: Modify the background color of the little turtle node ( Terminal code implementation )
rosparam set /turtlesim/background_b Custom values
rosparam set /turtlesim/background_g Custom values
rosparam set /turtlesim/background_r Custom values
The way 2: When starting the node , Set parameters directly
rosrun turtlesim turtlesim_node _background_r:=100 _background_g=0 _background_b=0
版权声明
本文为[Yi Lanjun]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220602231633.html
边栏推荐
- Code forces round # 784 (DIV. 4) solution (First AK CF (XD)
- 集合之List接口
- Supersocket is Use in net5 - concept
- Identificateur, mot - clé, type de données
- Redis(17) -- Redis缓存相关问题解决
- MySQL zip installation tutorial
- L3-011 direct attack Huanglong (30 points)
- When migrating tslib_ setup: No such file or directory、ts_ open: No such file or director
- 2022 group programming ladder simulation match 1-8 are prime numbers (20 points)
- 标识符、关键字、数据类型
猜你喜欢
Codeforces Round #784 (Div. 4)题解 (第一次AK cf (XD
深度學習筆記(二)——激活函數原理與實現
Learn about I / O flow and file operations
Database - MySQL -- Navicat import SQL error 1067 - invalid default value for 'paydate‘
On the principle of concurrent programming and the art of notify / Park
Code forces round # 784 (DIV. 4) solution (First AK CF (XD)
Un aperçu des flux d'E / s et des opérations de fichiers de classe de fichiers
C set
The art of concurrent programming (2): synchronized usage scenarios
Paddlepaddle model to onnx
随机推荐
Abstract classes, interfaces and common keywords
Three column layout (fixed width on both sides in the middle and fixed width on both sides in the middle)
Key point detection of human hand based on mediapipe
Unity games and related interview questions
The fourth operation
Variable definition and use
MySQL zip installation tutorial
Use of rotary selector wheelpicker
Alphafpld upgrade alphafold multimer
【微服务】(十)—— 统一网关Gateway
Detailed explanation on the use of annotation tool via (VGg image annotator) in mask RCNN
Variables, constants, operators
Supersocket is Used in net5 - command
Seekbar custom style details
Activity supports multi window display
Database - MySQL -- Navicat import SQL error 1067 - invalid default value for 'paydate‘
Redis(17) -- Redis缓存相关问题解决
If statement format flow
Redis (17) -- redis cache related problem solving
浅学一下I/O流和File类文件操作