dynamic reconfigure server with multiple callbacks [closed]

asked 2014-11-04 07:25:31 -0500

alextoind gravatar image

updated 2014-11-06 04:51:33 -0500

I'll try to be as clear as possible. I've got two classes A and B and in each of these there is a configCallback which I'd like to be executed as a callback of a dynamic reconfigure server. Both methods use the same parameters and are identical at the moment (I don't know in the future).

class A {   
  ... 
  void configCallback(pkg_name::fileConfig &config, uint32_t level); 
}

class B {   
  ... 
  void configCallback(pkg_name::fileConfig &config, uint32_t level); 
}

In main I create one object per class and I setup both as listener for two distinct topics.

A *a;
B *b;
...
a->createSubscriber("topic_a", 1000);
b->createSubscriber("topic_b", 1000);

I'd like to set a dynamic reconfigure server who calls both the configCallback methods (I'd like to change them simultaneously).

I thought that multiple dynamic servers would work (for example as it is in this post), but the problem is that using separate subordinate namespaces creates two sets of parameters which I don't actually need. I want that one change affects both classes. For clarity, parameters are 2 strings which specify a log file name.

In few words, I'd like that conflict correctly warned by ROS (Tried to advertise a service that is already advertised in this node [/node_name/set_parameters]) should affect my node.

This is what I've done (but namespace conflict happen and changing one parameter through rqt_reconfigure tool affect only one of the classes):

...
dynamic_reconfigure::Server<pkg_name::fileConfig> a_server;
dynamic_reconfigure::Server<pkg_name::fileConfig>::CallbackType f1;
f1 = boost::bind(&A::configCallback, a, _1, _2);
a_server.setCallback(f1);

dynamic_reconfigure::Server<pkg_name::fileConfig> b_server;
dynamic_reconfigure::Server<pkg_name::fileConfig>::CallbackType f2;
f2 = boost::bind(&B::configCallback, b, _1, _2);
b_server.setCallback(f2);
...

How could I solve this problem?

EDIT: I think that there would be no solution. I've rearranged the code to do something similar.

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by alextoind
close date 2015-06-27 05:44:44.146413