Ask Your Question
1

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

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

ahtsan gravatar image

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

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
1

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

William gravatar image

This is the closest equivalent:

http://docs.ros2.org/dashing/api/rclc...

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:

http://docs.ros2.org/dashing/api/rclc...

Here's the examples:

https://github.com/ros2/demos/blob/f7...

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

Comments

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 imageahtsan ( 2019-07-12 15:43:42 -0500 )edit

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

ahtsan gravatar imageahtsan ( 2019-07-12 15:44:34 -0500 )edit

Question Tools

1 follower

Stats

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

Seen: 22 times

Last updated: Jul 12