当前位置:网站首页>ROS parameter server
ROS parameter server
2022-06-11 01:36:00 【Mbot】
First create a function package in the workspace
catkin_create_pkg test_param std_msgs roscpp rospy
Create a... Under the feature pack param Folder 
stay param Create one under the folder param.yaml file
The contents are as follows :
string: dsad3421
num1: 564.65
num2: 87896
sub_param_set:
string: cvvx
num: 423
sub_sub_param_set:
string: gfdg
num: 767
Then load the parameters :
First run
roscore
And then param Run under folder directory
rosparam load param.yaml
rosparam list
give the result as follows :
It can be used rosparam get and rosparam set To get and set parameter values 
The function of the package is src Create under directory test_param.cpp
Fill in the following :
#include <string>
#include <ros/ros.h>
int main(int argc, char **argv)
{
int aaa;
// ROS Node initialization
ros::init(argc, argv, "parameter_config");
// Create node handle
ros::NodeHandle node;
ros::param::get("/sub_param/num", aaa);
ROS_INFO("aaa=%d\n", aaa);
return 0;
}
The function of the package is CMakeLists.txt Add :
add_executable(test_param src/test_param.cpp)
target_link_libraries(test_param ${catkin_LIBRARIES})
then catkin_make Run... After compilation
rosrun test_param test_param
give the result as follows , When running this node , Must use rosparam load After loading the parameter file ,ROS Inner talent get To the value of the parameter , I used it here before rosparam set Set parameters /sub_param/num The value of is 456, So here get The value of is 456, without set, Then this value is the value in the parameter file 
边栏推荐
- 2.1、ROS+PX4仿真---定点飞行控制
- ROS参数服务器
- Classic questions: 01 backpack, complete backpack, multiple backpack, two-dimensional cost Backpack
- 北京密云区高新技术企业培育支持标准,补贴10万
- 如何下载网页照片
- 中国专利奖奖金多少,补贴100万
- How to write this with data and proc without SQL
- Multi interest recall model practice | acquisition technology
- SAS聚类分析(系统聚类cluster,动态聚类fastclus,变量聚类varclus)
- SQL question brushing and sorting in leetcode of partial deduction
猜你喜欢

Project_ Visual analysis of epidemic data based on Web Crawler

Using MySQL database in nodejs

Yanrong looks at how to realize the optimal storage solution of data Lake in a hybrid cloud environment

云呐|省级行政单位固定资产管理系统

Yunna provincial administrative unit fixed assets management system

Merge sort and cardinality sort

Inventory management and strategy mode

Brief description of custom annotations

中间件_Redis_05_Redis的持久化

SAS factor analysis (proc factor process, factor rotation and regression method for factor score function)
随机推荐
数字ic设计自学ing
Merge sort and cardinality sort
腾讯云数据库TDSQL-大咖论道 | 基础软件的过去、现在、未来
Beijing Dongcheng District high tech enterprise cultivation support standard, with a subsidy of 100000 yuan
Current limiting and download interface request number control
Inventory management and strategy mode
Introduction and creation of Huffman tree
Store binary tree in sequence [store tree in array]
SSH Remote Login configuration sshd_ Config file details
Tencent Cloud Database tdsql - Dajia comments | The Past, Present and Future of basic software
Basic introduction of graph and depth first traversal and breadth first traversal
About mobx
Introduction to China patent award policy support, with a subsidy of 1million yuan
使用 CompletableFuture
Role of handlermethodargumentresolver + use case
nodejs中使用mySql数据库
[mavros] mavros startup Guide
Shenzhen Nanshan District specialized, special and new enterprise application conditions, with a subsidy of 100000-500000 yuan
函数的节流和防抖
Introduction to the application process of China Patent Award, with a subsidy of 1million yuan