Ask Your Question

[ROS2] What is the equivalent API in C++ for ros2 param set? [closed]

asked 2019-07-12 15:35:40 -0600

ahtsan gravatar image

updated 2019-07-12 15:39:34 -0600

I want to call it in code, instead of in terminal. What API should I call?

Also is it true that if I call the API, all nodes that implemented on_parameter_event will be notified? Given they will be notified by calling ros2 param set.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by ahtsan
close date 2019-07-16 14:53:44.867900

1 Answer

Sort by ยป oldest newest most voted

answered 2019-07-12 15:38:48 -0600

William gravatar image

This is the closest equivalent:

In that is can set one or more parameters on any node (remote or local) by name and will return when the setting of the parameter is complete (synchronous).

There is an Asynchronous version as well which returns a future:

Here's the examples:

Note that in this example it is getting and setting parameters on the local node, but you can also use the same class to get and set parameters on remote nodes given their name.

edit flag offensive delete link more


The API only accepts a node object as argument. How can we pass the name of the node instead of the node object?

ahtsan gravatar image ahtsan  ( 2019-07-12 15:43:42 -0600 )edit

Also if we call set_parameters(...), will all nodes that implemented on_parameter_event be notified?

ahtsan gravatar image ahtsan  ( 2019-07-12 15:44:34 -0600 )edit

Question Tools

1 follower


Asked: 2019-07-12 15:35:40 -0600

Seen: 77 times

Last updated: Jul 12 '19