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

ROS2 parameter sync and async

asked 2019-01-09 01:38:59 -0600

poonam1120 gravatar image

updated 2019-01-10 08:20:37 -0600

lucasw gravatar image

Hi Everyone,

I am tryin demo examples of ROS2 paramter,(sync and async both) but not with single node, creating two nodes, one for set param and other for get param.

But I am confused with the difference between sync and async. Should we pass remote node name(set param node name) with async type or not? If I don't pass the remote node name, I don't get the parameters. What is the correct way and what is the exact diff between sync and sync param client? It is not very clear from the demo examples.

With sync, on get param node,

auto parameters_client = std::make_shared<rclcpp::SyncParametersClient>(node, "set param node name");

With Async, on get param node,

auto parameters_client = std::make_shared<rclcpp::AsyncParametersClient>(node, "set param node name");

Here, I am doing one extra thing, rclcpp::spin_until_future_complete(node, parameters).

I referred this link https://answers.ros.org/question/3060...

Thanks.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-06-11 18:33:09 -0600

William gravatar image

The AsyncParameterClient has asynchronous functions on it, and the SyncParameterClient has synchronous functions on it, i.e. the functions on the SyncParameterClient block until complete and the async ones return a future or take a callback to be called when completed.

edit flag offensive delete link more

Question Tools

3 followers

Stats

Asked: 2019-01-09 01:38:59 -0600

Seen: 1,252 times

Last updated: Jun 11 '19