Robotics StackExchange | Archived questions

ROS2 parameter sync and async

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::spinuntilfuture_complete(node, parameters).

I referred this link https://answers.ros.org/question/306094/access-parameters-set-from-another-node/

Thanks.

Asked by poonam1120 on 2019-01-09 02:38:59 UTC

Comments

Answers

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.

Asked by William on 2019-06-11 18:33:09 UTC

Comments