Parameter events on foxy?
I just switched to ROS2 foxy and now my parameter events don't work anymore.
I couldn't find any documentation on what could have changed.
Basically I have a parameter blackboard node or param server and some nodes which have a param client with added remote node name of the param server, so they can listen to the param servers changes.
So on the "clients" I call this:
parameterEventSub_ = on_parameter_event(
[this](const rcl_interfaces::msg::ParameterEvent::SharedPtr event) -> void
{
RCLCPP_INFO(logger, "parameterEventSub_: new params: %d", event->new_parameters.size() );
onParameterEvent(event);
});
But since foxy, this doesn't work anymore.
I can see that the parameters are set exactly the same as before (eloquent), only the events are missing.
On the parameter server itself I got callbacks by using add_on_set_parameters_callback
but that is a method of the node and not of the parameter client.
Does someone know how this should be done now?
Update 3.10.2020
The param event handling is working without namespaces.
But my nodes run in a namespace and then I get no events.
Parameter events on the client are working for me. To test with a remote node, I modified this line in the demo so that it sets parameters and listens for events on the parameter blackboard:
If you're able to share a more complete version of code that reproduces your issue, then it might be easier to help identify the issue.
Well, I just found out, that when adding a namespace it won't work. I suppose you don't have namespaced nodes..
Hmm, I've tried giving different namespaces to both the parameter client and parameter server nodes and it still works as I would expect. Note, you have to update the constructor call for the parameter client to include the namespace of the server node. See my answer below.
Again, if you are able to provide a SSCCE, then it would be easier to identify the issue.
Ah, on second glance I think I was able to reproduce the issue. Can you take a look at the referenced PR in my answer and let me know if it fixes it?