Robotics StackExchange | Archived questions

New action node for BT linked to ROS2 service

Hello everyone,

I would like to try to connect an action node to a simple service in ROS2.

I create a simple python package with a service node.

I also create a new action in the nav2behaviortree/plugins.

I want the action to trigger the service, wait for the answer and continue the behavior. I notice that the action node got a member "serviceclient" that can asyncsend a request.

Is there a way to sync this ?

Asked by TomSon on 2021-12-13 11:32:46 UTC

Comments

Answers

See clear costmap BT node for example of using a ROS service client with BT nodes, it should be self explanatory with the doxygen functions. See below with a list of key files to be familiar with

Basically BtServiceNode will handle all of the ROS 2 comms boilerplate with a given templated service type and service name (e.g. string of service topic). In the virtual functions, you just need to populate your service request and/or get response values to process or add to the blackboard.

Asked by stevemacenski on 2021-12-13 15:31:28 UTC

Comments

Thanks for the answer, I check indeed those links before asking my question here. What I would like to know is if there is a sync send method instead of async_send.

Asked by TomSon on 2021-12-16 12:43:28 UTC

Check rclcpp APIs

Asked by stevemacenski on 2021-12-16 13:30:59 UTC

Will do but since the BTActionNode is a mix between BT action node and ROS action I kind of lost myself in the code, and there is not a lot of documentation about the service behavior.

Asked by TomSon on 2021-12-17 03:34:21 UTC

I'm back on the subject, is there a documentation for the BT service node ? I try to call the service without success. You talk about virtual functions, which one ? on_tick ? Thanks

Asked by TomSon on 2021-12-21 09:27:13 UTC