ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
I was looking for a way to accomplish this without the useful but cumbersome dynamic_reconfigure package as I think we have enough things to deal with, just considering ROS messages/actions/services, launch files (that support YAML syntax in XML...) and catkin specific CMakeLists file without adding another layer of complexity which is often unneeded.
So here is my working but flawed example (I followed Asormeville's hints):
#include <ros/ros.h>
#include <ros/xmlrpc_manager.h>
#include <std_msgs/String.h>
void callback(XmlRpc::XmlRpcValue& params, XmlRpc::XmlRpcValue& result)
{
ROS_ERROR("Updated parameters!");
}
int main(int argc, char **argv)
{
XmlRpc::XmlRpcValue params, result, payload;
ros::init(argc, argv, "test_node");
ros::NodeHandle nh;
ros::XMLRPCManager::instance()->unbind("paramUpdate");
ros::XMLRPCManager::instance()->bind("paramUpdate", callback);
params[0] = ros::this_node::getName();
params[1] = ros::names::resolve(std::string("~test_param"));
params[2] = static_cast<XmlRpc::XmlRpcValue>(true);
ros::master::execute("setParam", params, result, payload, true);
ROS_INFO("Created new parameter through XmlRpc API call.");
params[0] = ros::this_node::getName();
params[1] = ros::XMLRPCManager::instance()->getServerURI();
params[2] = ros::names::resolve(std::string("~test_param"));
if (ros::master::execute("subscribeParam", params, result, payload, false)) {
ROS_INFO("Subscribed to parameter.");
}
else {
ROS_ERROR("Failed to subscribe to the parameter.");
}
while (ros::ok()) {
ros::spinOnce();
}
return 0;
}
The next steps would be to have a specific callback per parameter. But I don't know if that would be possible and it would begin to look like Publishers/Subscribers mechanisms.
2 | No.2 Revision |
I was looking for a way to accomplish this without the useful but cumbersome dynamic_reconfigure package as I think we have enough things to deal with, just considering ROS messages/actions/services, launch files (that support YAML syntax in XML...) and catkin specific CMakeLists file without adding another layer of complexity which is often unneeded.
So here is my working but flawed example (I followed Asormeville's hints):
#include <ros/ros.h>
#include <ros/xmlrpc_manager.h>
#include <std_msgs/String.h>
void callback(XmlRpc::XmlRpcValue& params, XmlRpc::XmlRpcValue& result)
{
ROS_ERROR("Updated parameters!");
}
int main(int argc, char **argv)
{
XmlRpc::XmlRpcValue params, result, payload;
ros::init(argc, argv, "test_node");
ros::NodeHandle nh;
ros::XMLRPCManager::instance()->unbind("paramUpdate");
ros::XMLRPCManager::instance()->bind("paramUpdate", callback);
//---
params[0] = ros::this_node::getName();
params[1] = ros::names::resolve(std::string("~test_param"));
params[2] = static_cast<XmlRpc::XmlRpcValue>(true);
ros::master::execute("setParam", params, result, payload, true);
//---
// This part can be replaced by: ros::param::set("~test_param", true);
ROS_INFO("Created new parameter through XmlRpc API call.");
params[0] = ros::this_node::getName();
params[1] = ros::XMLRPCManager::instance()->getServerURI();
params[2] = ros::names::resolve(std::string("~test_param"));
if (ros::master::execute("subscribeParam", params, result, payload, false)) {
ROS_INFO("Subscribed to parameter.");
}
else {
ROS_ERROR("Failed to subscribe to the parameter.");
}
while (ros::ok()) {
ros::spinOnce();
}
return 0;
}
The next steps would be to have a specific callback per parameter. But I don't know if that would be possible and it would begin to look like Publishers/Subscribers mechanisms.
3 | No.3 Revision |
I was looking for a way to accomplish this without the useful but cumbersome dynamic_reconfigure package as I think we have enough things to deal with, just considering ROS messages/actions/services, launch files (that support YAML syntax in XML...) and catkin specific CMakeLists file without adding another layer of complexity which is often unneeded.
So here is my working but flawed *flawed example (I followed Asormeville's hints):
#include <ros/ros.h>
#include <ros/xmlrpc_manager.h>
#include <std_msgs/String.h>
void callback(XmlRpc::XmlRpcValue& params, XmlRpc::XmlRpcValue& result)
{
ROS_ERROR("Updated parameters!");
}
int main(int argc, char **argv)
{
XmlRpc::XmlRpcValue params, result, payload;
ros::init(argc, argv, "test_node");
ros::NodeHandle nh;
ros::XMLRPCManager::instance()->unbind("paramUpdate");
ros::XMLRPCManager::instance()->bind("paramUpdate", callback);
//---
params[0] = ros::this_node::getName();
params[1] = ros::names::resolve(std::string("~test_param"));
params[2] = static_cast<XmlRpc::XmlRpcValue>(true);
ros::master::execute("setParam", params, result, payload, true);
//---
// This part can be replaced by: ros::param::set("~test_param", true);
ROS_INFO("Created new parameter through XmlRpc API call.");
params[0] = ros::this_node::getName();
params[1] = ros::XMLRPCManager::instance()->getServerURI();
params[2] = ros::names::resolve(std::string("~test_param"));
if (ros::master::execute("subscribeParam", params, result, payload, false)) {
ROS_INFO("Subscribed to parameter.");
}
else {
ROS_ERROR("Failed to subscribe to the parameter.");
}
while (ros::ok()) {
ros::spinOnce();
}
return 0;
}
The next steps would be to have a specific callback per parameter. But I don't know if that would be possible and it would begin to look like Publishers/Subscribers mechanisms.
No ROS nodes launched after having bind to the new callback can use the *ros::param::getCached() function.
4 | No.4 Revision |
I was looking for a way to accomplish this without the useful but cumbersome dynamic_reconfigure package as I think we have enough things to deal with, just considering ROS messages/actions/services, launch files (that support YAML syntax in XML...) and catkin specific CMakeLists file without adding another layer of complexity which is often unneeded.
So here is my working but *flawed example (I followed Asormeville's hints):
#include <ros/ros.h>
#include <ros/xmlrpc_manager.h>
#include <std_msgs/String.h>
void callback(XmlRpc::XmlRpcValue& params, XmlRpc::XmlRpcValue& result)
{
ROS_ERROR("Updated parameters!");
}
int main(int argc, char **argv)
{
XmlRpc::XmlRpcValue params, result, payload;
ros::init(argc, argv, "test_node");
ros::NodeHandle nh;
ros::XMLRPCManager::instance()->unbind("paramUpdate");
ros::XMLRPCManager::instance()->bind("paramUpdate", callback);
//---
params[0] = ros::this_node::getName();
params[1] = ros::names::resolve(std::string("~test_param"));
params[2] = static_cast<XmlRpc::XmlRpcValue>(true);
ros::master::execute("setParam", params, result, payload, true);
//---
// This part can be replaced by: ros::param::set("~test_param", true);
ROS_INFO("Created new parameter through XmlRpc API call.");
params[0] = ros::this_node::getName();
params[1] = ros::XMLRPCManager::instance()->getServerURI();
params[2] = ros::names::resolve(std::string("~test_param"));
if (ros::master::execute("subscribeParam", params, result, payload, false)) {
ROS_INFO("Subscribed to parameter.");
}
else {
ROS_ERROR("Failed to subscribe to the parameter.");
}
while (ros::ok()) {
ros::spinOnce();
}
return 0;
}
The next steps would be to have a specific callback per parameter. But I don't know if that would be possible and it would begin to look like Publishers/Subscribers mechanisms.
No ROS nodes launched after having bind to the new callback can use the *ros::param::getCached() function.
5 | No.5 Revision |
I was looking for a way to accomplish this without the useful but cumbersome dynamic_reconfigure package as I think we have enough things to deal with, just considering ROS messages/actions/services, launch files (that support YAML syntax in XML...) and catkin specific CMakeLists file without adding another layer of complexity which is often unneeded.
So here is my working but *flawed example (I followed Asormeville's hints):
#include <ros/ros.h>
#include <ros/xmlrpc_manager.h>
#include <std_msgs/String.h>
void callback(XmlRpc::XmlRpcValue& params, XmlRpc::XmlRpcValue& result)
{
ROS_ERROR("Updated parameters!");
}
int main(int argc, char **argv)
{
XmlRpc::XmlRpcValue params, result, payload;
ros::init(argc, argv, "test_node");
ros::NodeHandle nh;
ros::XMLRPCManager::instance()->unbind("paramUpdate");
ros::XMLRPCManager::instance()->bind("paramUpdate", callback);
//---
params[0] = ros::this_node::getName();
params[1] = ros::names::resolve(std::string("~test_param"));
params[2] = static_cast<XmlRpc::XmlRpcValue>(true);
ros::master::execute("setParam", params, result, payload, true);
//---
// This part can be replaced by: ros::param::set("~test_param", true);
ROS_INFO("Created new parameter through XmlRpc API call.");
params[0] = ros::this_node::getName();
params[1] = ros::XMLRPCManager::instance()->getServerURI();
params[2] = ros::names::resolve(std::string("~test_param"));
if (ros::master::execute("subscribeParam", params, result, payload, false)) {
ROS_INFO("Subscribed to parameter.");
}
else {
ROS_ERROR("Failed to subscribe to the parameter.");
}
while (ros::ok()) {
ros::spinOnce();
}
return 0;
}
The next steps would be to have a specific callback per parameter. But I don't know if that would be possible and it would begin to look like Publishers/Subscribers mechanisms.
No ROS nodes launched after having bind to the new callback can use the *ros::param::getCached() function.
6 | No.6 Revision |
I was looking for a way to accomplish this without the useful but cumbersome dynamic_reconfigure package as I think we have enough things to deal with, just considering ROS messages/actions/services, launch files (that support YAML syntax in XML...) and catkin specific CMakeLists file without adding another layer of complexity which is often unneeded.
So here is my working but *flawed example (I followed Asormeville's hints):
#include <ros/ros.h>
#include <ros/xmlrpc_manager.h>
#include <std_msgs/String.h>
void callback(XmlRpc::XmlRpcValue& params, XmlRpc::XmlRpcValue& result)
{
ROS_ERROR("Updated parameters!");
}
int main(int argc, char **argv)
{
XmlRpc::XmlRpcValue params, result, payload;
ros::init(argc, argv, "test_node");
ros::NodeHandle nh;
ros::XMLRPCManager::instance()->unbind("paramUpdate");
ros::XMLRPCManager::instance()->bind("paramUpdate", callback);
//---
params[0] = ros::this_node::getName();
params[1] = ros::names::resolve(std::string("~test_param"));
params[2] = static_cast<XmlRpc::XmlRpcValue>(true);
ros::master::execute("setParam", params, result, payload, true);
//---
// This part can be replaced by: ros::param::set("~test_param", true);
ROS_INFO("Created new parameter through XmlRpc API call.");
params[0] = ros::this_node::getName();
params[1] = ros::XMLRPCManager::instance()->getServerURI();
params[2] = ros::names::resolve(std::string("~test_param"));
if (ros::master::execute("subscribeParam", params, result, payload, false)) {
ROS_INFO("Subscribed to parameter.");
}
else {
ROS_ERROR("Failed to subscribe to the parameter.");
}
while (ros::ok()) {
ros::spinOnce();
}
return 0;
}
The next steps would be to have a specific callback per parameter. But I don't know if that would be possible and it would begin to look like Publishers/Subscribers mechanisms.
No The ROS nodes launched after having bind to the new node redefining this callback can won't be able to use the *ros::param::getCached() function.function anymore.
7 | No.7 Revision |
I was looking for a way to accomplish this without the useful but cumbersome dynamic_reconfigure package as I think we have enough things to deal with, just considering ROS messages/actions/services, launch files (that support YAML syntax in XML...) and catkin specific CMakeLists file without adding another layer of complexity which is often unneeded.
So here is my working but *flawed example (I followed Asormeville's hints):
#include <ros/ros.h>
#include <ros/xmlrpc_manager.h>
#include <std_msgs/String.h>
void callback(XmlRpc::XmlRpcValue& params, XmlRpc::XmlRpcValue& result)
{
ROS_ERROR("Updated parameters!");
}
int main(int argc, char **argv)
{
XmlRpc::XmlRpcValue params, result, payload;
ros::init(argc, argv, "test_node");
ros::NodeHandle nh;
ros::XMLRPCManager::instance()->unbind("paramUpdate");
ros::XMLRPCManager::instance()->bind("paramUpdate", callback);
//---
params[0] = ros::this_node::getName();
params[1] = ros::names::resolve(std::string("~test_param"));
params[2] = static_cast<XmlRpc::XmlRpcValue>(true);
ros::master::execute("setParam", params, result, payload, true);
//---
// This part can be replaced by: ros::param::set("~test_param", true);
ROS_INFO("Created new parameter through XmlRpc API call.");
params[0] = ros::this_node::getName();
params[1] = ros::XMLRPCManager::instance()->getServerURI();
params[2] = ros::names::resolve(std::string("~test_param"));
if (ros::master::execute("subscribeParam", params, result, payload, false)) {
ROS_INFO("Subscribed to parameter.");
}
else {
ROS_ERROR("Failed to subscribe to the parameter.");
}
while (ros::ok()) {
ros::spinOnce();
}
return 0;
}
The next steps would be to have a specific callback per parameter. But I don't know if that would be possible and it would begin to look like Publishers/Subscribers mechanisms.
The ROS node redefining this callback won't be able to use the *ros::param::getCached()ros::param::getCached() function anymore.
8 | No.8 Revision |
I was looking for a way to accomplish this without the useful but cumbersome dynamic_reconfigure package as I think we have enough things to deal with, just considering ROS messages/actions/services, launch files (that support YAML syntax in XML...) and catkin specific CMakeLists file without adding another layer of complexity which is often unneeded.
So here is my working but *flawed example (I followed Asormeville's hints):
#include <ros/ros.h>
#include <ros/xmlrpc_manager.h>
#include <std_msgs/String.h>
void callback(XmlRpc::XmlRpcValue& params, XmlRpc::XmlRpcValue& result)
{
ROS_ERROR("Updated parameters!");
}
int main(int argc, char **argv)
{
XmlRpc::XmlRpcValue params, result, payload;
ros::init(argc, argv, "test_node");
ros::NodeHandle nh;
ros::XMLRPCManager::instance()->unbind("paramUpdate");
ros::XMLRPCManager::instance()->bind("paramUpdate", callback);
//---
params[0] = ros::this_node::getName();
params[1] = ros::names::resolve(std::string("~test_param"));
params[2] = static_cast<XmlRpc::XmlRpcValue>(true);
ros::master::execute("setParam", params, result, payload, true);
//---
// This part can be replaced by: ros::param::set("~test_param", true);
ROS_INFO("Created new parameter through XmlRpc API call.");
params[0] = ros::this_node::getName();
params[1] = ros::XMLRPCManager::instance()->getServerURI();
params[2] = ros::names::resolve(std::string("~test_param"));
if (ros::master::execute("subscribeParam", params, result, payload, false)) {
ROS_INFO("Subscribed to parameter.");
}
else {
ROS_ERROR("Failed to subscribe to the parameter.");
}
while (ros::ok()) {
ros::spinOnce();
}
return 0;
}
The next steps would be to have a specific callback per parameter. But I don't know if that would be possible and it would begin to look like Publishers/Subscribers mechanisms.
* The ROS node redefining this callback won't be able to use the ros::param::getCached() function anymore.
9 | No.9 Revision |
I was looking for a way to accomplish this without the useful but cumbersome dynamic_reconfigure package as I think we have enough things to deal with, just considering ROS messages/actions/services, launch files (that support YAML syntax in XML...) and catkin specific CMakeLists file without adding another layer of complexity which is often unneeded.
So here is my working but *flawed example (I followed Asormeville's hints):
#include <ros/ros.h>
#include <ros/xmlrpc_manager.h>
#include <std_msgs/String.h>
void callback(XmlRpc::XmlRpcValue& params, XmlRpc::XmlRpcValue& result)
{
ROS_ERROR("Updated parameters!");
}
int main(int argc, char **argv)
{
XmlRpc::XmlRpcValue params, result, payload;
ros::init(argc, argv, "test_node");
ros::NodeHandle nh;
ros::XMLRPCManager::instance()->unbind("paramUpdate");
ros::XMLRPCManager::instance()->bind("paramUpdate", callback);
//---
params[0] = ros::this_node::getName();
params[1] = ros::names::resolve(std::string("~test_param"));
params[2] = static_cast<XmlRpc::XmlRpcValue>(true);
ros::master::execute("setParam", params, result, payload, true);
//---
// This part can be replaced by: ros::param::set("~test_param", true);
ROS_INFO("Created new parameter through XmlRpc API call.");
params[0] = ros::this_node::getName();
params[1] = ros::XMLRPCManager::instance()->getServerURI();
params[2] = ros::names::resolve(std::string("~test_param"));
if (ros::master::execute("subscribeParam", params, result, payload, false)) {
ROS_INFO("Subscribed to parameter.");
}
else {
ROS_ERROR("Failed to subscribe to the parameter.");
}
while (ros::ok()) {
ros::spinOnce();
}
return 0;
}
The next steps would be to have a specific callback per parameter. But I don't know if that would be possible and it would begin to look like Publishers/Subscribers mechanisms.
* The ROS node redefining this callback won't be able to use the ros::param::getCached() function anymore.