Replies: 2 comments 1 reply
-
Probably introducing a So, what can you do? If you're merely interested in resetting a oneshot, you could do that by deleting the idiom's oneshot variable from the blackboard (see https://github.com/splintered-reality/py_trees/blob/devel/py_trees/idioms.py#L314 - that will cause the oneshot to be entered again). That could be done by your program in-between ticks, or even from another behaviour. Alternatively, if you're wishing to reset an arbitrary subtree in your behaviour tree, just prune the existing subtree and replace it in-between ticks (you can even do this from another behaviour if you wish). In more detail, write yourself a method which creates the subtree (~idiom). Then just call that repeatedly. i.e.
There's an example of this at https://py-trees-ros-tutorials.readthedocs.io/en/devel/tutorials.html#module-py_trees_ros_tutorials.eight_dynamic_application_loading. It has a space for an application subtree that gets created, added to the tree manager, then pruned when done. It can be the same application that gets re-inserted on the next cycle. Hope this helps. |
Beta Was this translation helpful? Give feedback.
-
I think this should be added to your FAQ. I had exactly the same questions after 20 mins w/ the library. I'll volunteer a PR, if you agree @stonier. |
Beta Was this translation helpful? Give feedback.
-
Hello Daniel,
First of all, many thanks for writing this great repository. I find this repository very useful and brilliantly written.
I was wondering if py_trees has an option to reset the behaviours (i.e. nodes). For example, in the case of decorators like OneShot, it would be nice if the node can be reset dynamically to the initial state, without having to kill and restart the process that is running the tree. This would be useful when py_trees is part of larger projects such as those that control robots or virtual agents.
Do you plan to add this feature to the library? For example, via a new method named 'reset'?
Looking forward to your reply.
Many thanks & best regards,
Teena
Beta Was this translation helpful? Give feedback.
All reactions