#include <ros/ros.h>
#include <std_srvs/Empty.h>
#include <string>
int main(int argc, char **argv) {
int red, green, blue;
ros::init(argc, argv, "parameter_config");
ros::NodeHandle node;
ros::param::get("/background_r", red);
ros::param::get("/background_g", green);
ros::param::get("/background_b", blue);
ROS_INFO("Get Backgroud Color[%d, %d, %d]", red, green, blue);
ros::param::set("/background_r", 255);
ros::param::set("/background_g", 255);
ros::param::set("/background_b", 255);
ros::param::get("/background_r", red);
ros::param::get("/background_g", green);
ros::param::get("/background_b", blue);
ROS_INFO("Re-get Backgroud Color[%d, %d, %d]", red, green, blue);
sleep(1);
return 0;
}
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/e9f38fce892567b983ee063fcd31a8fc.png)
<launch>
<node pkg="test_parameter" type="test_parameter" name="test_parameter" output="screen" >
<rosparam file="$(find test_parameter)/params/params.yaml" command="load" />
<rosparam file="$(find test_parameter)/params/params.yaml" command="load" ns="test123" />
</node>
</launch>
background_b: 255
background_g: 86
background_r: 69
rosdistro: 'melodic'
roslaunch:
uris: {host_hcx_vpc__43763: 'http://hcx-vpc:43763/'}
rosversion: '1.14.3'
run_id: 077058de-a38b-11e9-818b-000c29d22e4d
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/874e8cf244947c9dc083fbe5ee799679.png)