ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Parameter events on foxy?

asked 2020-07-28 09:09:41 -0500

madmax gravatar image

updated 2020-08-03 06:37:26 -0500

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.

edit retag flag offensive close merge delete

Comments

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:

auto parameters_client = std::make_shared<rclcpp::SyncParametersClient>(node, "/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.

jacobperron gravatar image jacobperron  ( 2020-07-29 12:03:11 -0500 )edit

Well, I just found out, that when adding a namespace it won't work. I suppose you don't have namespaced nodes..

madmax gravatar image madmax  ( 2020-08-03 06:36:07 -0500 )edit

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.

jacobperron gravatar image jacobperron  ( 2020-08-03 13:57:29 -0500 )edit

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?

jacobperron gravatar image jacobperron  ( 2020-08-03 14:08:39 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2020-08-03 13:55:48 -0500

jacobperron gravatar image

updated 2020-08-03 14:07:38 -0500

If the parameter server node has a namespace, then the client must include the namespace when it is created. For example, I have my parameter server node running with the full name /foo/parameter_blackboard, then the code to create the parameter client should look like this:

auto parameters_client = std::make_shared<rclcpp::SyncParametersClient>(node, "/foo/parameter_blackboard");

Edit

I think I was able to reproduce the issue. It occurs when the local node (parameter client) has a namespace, that is also different from the remote node. I've opened a PR to address this issue in rclcpp. If you are able to try that patch and confirm if it fixes the issue that would be great.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2020-07-28 09:09:41 -0500

Seen: 847 times

Last updated: Aug 03 '20