Get dynamic reconfigure caller name

asked 2015-07-13 03:00:38 -0500

apalomer gravatar image


I have some nodes which are reconfigurable using dynamic reconfigure. Some times some other node changes the parameters (and the behavior of the sensor which is dynamic reconfigurable) when it is not supposed to do so. Since the dynamic reconfigure calls are not saved in the rosbag I have no clue on who called the reconfiguration. Is there any way in the dynamic reconfigure callback that I can get the name of who called with the new parameters so I can print a ROS_INFO and get it in the logs? I know that a first solution would be to do the ROS_INFO where you call the dynamic reconfiguration, but some of this nodes are not programmed by me, so I need this in the dynamic reconfigure callback to be able to control it. For instance if instead of a dynamic reconfigure it is a normal service (the example is for the add two ints of the service tutorial)) I do:

bool SomeClass::service_handle(rospy_tutorials::AddTwoInts::Request &req, rospy_tutorials::AddTwoInts::Response &res) {
    std::string caller = (*req.__connection_header)["callerid"];
    ROS_INFO("%s: service_handle called from %s with req = (%d, %d)",
              _name.c_str(), caller.c_str(),
               static_cast<int>(req.a), static_cast<int>(req.b));
    // rest of code ....

Thank you!

edit retag flag offensive close merge delete