当前位置:网站首页>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
边栏推荐
- Application and definition of interface
- Basic use of Charles
- What to pay attention to when writing the first code
- Leetcode punch in diary day 01
- Codeforces Round #784 (Div. 4)题解 (第一次AK cf (XD
- Raspberry pie 3B logs into the wired end of Ruijie campus network through mentohust, creates WiFi (open hotspot) for other devices, and realizes self startup at the same time
- 2022 group programming ladder simulation l2-1 blind box packaging line (25 points)
- C set
- The query type of MySQL is very inefficient.
- "Visual programming" test paper
猜你喜欢
Test questions (2)
Supersocket is Use in net5 - startup
"Visual programming" test paper
2022 group programming ladder game simulation L2-4 Zhezhi game (25 points)
Supersocket is Used in net5 - command
QT dynamic translation of Chinese and English languages
On the principle of concurrent programming and the art of notify / Park
Section 2 map and structure in Chapter 6
Notes sur l'apprentissage profond (Ⅱ) - - Principe et mise en oeuvre de la fonction d'activation
Design and implementation of redis (6): how redis achieves high availability
随机推荐
MySQL zip installation tutorial
Design and implementation of redis (1): understand data structures and objects
2022 团体程序设计天梯赛 模拟赛 L1-7 矩阵列平移 (20 分)
Vs Studio modifie le langage C scanf et d'autres erreurs
STM32 advanced timer com event
Query stored procedures in PostgreSQL
Three column layout (fixed width on both sides in the middle and fixed width on both sides in the middle)
Leetcode 617 merge binary tree
Activity supports multi window display
Download and configuration of idea
Instructions for fastmock
Detailed explanation on the use of annotation tool via (VGg image annotator) in mask RCNN
PWA I'm here
51 single chip microcomputer: D / a digital to analog conversion experiment
7-2 Tushare
Codeforces round 784 (Div. 4) (AK CF (XD) for the first time)
Create virtual machine
Alphafpld upgrade alphafold multimer
Picture synthesis video
Vscode delete uninstall residue