ROS topic subscription

Written by @christos_chrysikos

I would like to ask you about the best practice to input information from the ROS domain to the BT domain.

I am currently working with ROS1 noetic, and these are the two approaches I am thinking:

  • Use the “main.cpp”, where I am initializing ros and registering the BT, to subscribe to all the required topics and use the subscriber callbacks to transfer the information in the blackboard. Then each BT node uses blackboard for checking conditions, halting processes, etc.
  • Each BT node that requires data from the ROS domain subscribes itself to the specfic topic/topics and doesn’t involve the blackboard at all. Then use the blackboard only for sharing non ROS related information between the BT nodes.

From my understanding, the second approach is the one used in Navigation2 with BT.CPP, and I think this is a more cleaner and modular solution.

I would like to hear the opinions of the whole community, and of course if there are available code examples in ROS1 would be more than welcome.

This is good timing, because i am specifically think about the best way to implement this.

I think both solutions are valid, but, for the second one, we need to be careful about not creating multiple ubscribers, but only a single subscriber

Under Development!.

1 Like

Thanks for the reply @Davide, looking forward for the updates :slight_smile: .

Looking forward to an update on this. I was also wondering about this problem.