BehaviorTree/BehaviorTree.ROS2

Tips to implement "long running or infinite time actions"

Opened this issue · 0 comments

Hi
Thank you for providing such great library.
I am currently implemented to behaviors in ros2 and now i designed a behavior tree using back-chaining method. My problem is that some actions in my behavior tree should run for an infinite time until a certain condition changed. For example suppose I have a behavior tree like below :

image

All "Scripts" in above behavior tree are implemented as action servers and all "ScriptConditions" are implemented as SubTopics in ROS2.

The challenge I am currently facing is that as long as no one is visible for the robot, it should search for a person in the room. It means that it should run a long running or infinite action of searching until "Is Any Person Visible" condition is met and it will automatically "halt" the search action and start another infinite action of approaching that person until another condition of "Can High Five To Person" is met. After that it will "High Five and Shut Down".

I can easily implement the behaviors such that they never return success and keep running forever until they fail for some reason (for example missing the person in case of approaching that person action). The problem is that the behavior-tree send "Goal Timeout" after some time and change the action node state to failure resulting in running that action again and again.

One could argue that the action should return "success" whenever the condition is met but isn't the success condition of behavior or action already defined in behavior tree ? for example for the action "Search For A Person In The Room" to be successful, "Is Any Person Visible?" should return success.

I would be very thankful if anyone could help me with this.