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

New action node for BT linked to ROS2 service

asked 2021-12-13 10:32:46 -0500

TomSon gravatar image

updated 2021-12-13 10:32:55 -0500

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 nav2_behavior_tree/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 "service_client" that can async_send a request.

Is there a way to sync this ?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2021-12-13 14:31:28 -0500

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.

edit flag offensive delete link more

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.

TomSon gravatar image TomSon  ( 2021-12-16 11:43:28 -0500 )edit

Check rclcpp APIs

stevemacenski gravatar image stevemacenski  ( 2021-12-16 12:30:59 -0500 )edit

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.

TomSon gravatar image TomSon  ( 2021-12-17 02:34:21 -0500 )edit

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

TomSon gravatar image TomSon  ( 2021-12-21 08:27:13 -0500 )edit

Question Tools

3 followers

Stats

Asked: 2021-12-13 10:32:46 -0500

Seen: 194 times

Last updated: Dec 13 '21