setParam.cpp
Go to the documentation of this file.
1 #include <ros/ros.h>
2 #include <ros/param.h>
3 #include <ros/console.h>
4 
5 #include <ros/xmlrpc_manager.h>
6 #include <std_msgs/String.h>
7 
8 int main(int argc, char **argv)
9 {
10  XmlRpc::XmlRpcValue params, result, payload;
11 
12  ros::init(argc, argv, "test_node");
13 
14  ros::NodeHandle nh("~");
15 
16  ros::param::set("~test_set_param", "");
17 
18  ROS_INFO("Created new parameter through XmlRpc API call.");
19 
20  params[0] = ros::this_node::getName();
21  params[1] = ros::XMLRPCManager::instance()->getServerURI();
22  params[2] = ros::names::resolve(std::string("~test_param"));
23 
24  if (ros::master::execute("getParam", params, result, payload, false)) {
25  ROS_INFO("Subscribed to parameter.");
26  }
27  else {
28  ROS_ERROR("Failed to subscribe to the parameter.");
29  }
30 
31  while (nh.ok()) {
32  ros::spinOnce();
33 
34  }
35  return 0;
36 }
int main(int argc, char **argv)
Definition: setParam.cpp:8


vapor_master
Author(s): RosHub Inc.
autogenerated on Mon Feb 28 2022 23:59:43