Looping a sequence in py_trees
Hello,
I am trying out the most excellent pytreesros package and I was wondering if there is any kind of "loop" or "repeat" decorator that would allow me to loop over a sequence. For example, suppose the sequence represents a series of move_base goals that a robot needs to visit as part of a continual patrol. How can I start the navigation sequence over again once the last waypoint is reached?
Thanks!
patrick
Asked by Pi Robot on 2018-02-06 20:31:38 UTC
Answers
Late reply, but for reference, this ostensibly shouldn't require anything special.
If the entire tree is such that it immediately returns to the self-same sequence once it's ticked success, then you're done. It will just restart. A very simple tree in which the sequence is the lowest priority behaviour under a root behaviour that is a selector would do this. If not, you may be able to influence the tree to ensure it returns you to the same point.
A more complex case might look something like:
[ ] - Sequence 1
--> Lead-in Worker 1
--> Lead-in Worker 2
[ ] Sequence
--> Waypoint 1
--> Waypoint 2
--> Waypoint 3
which would inevitably drop back into the lead-ins once the sequence was done. If you wanted the waypoint sequence to repeat ad-nauseum, then a SuccessIsRunning decorator would suffice. If you'd like to repeat a finite number of times, then, yes, a Repeat
decorator would be useful. py_trees does not have one at the moment, but it should be simple to write (especially under the v1 style decorators) and would be a welcome addition to the library.
Asked by Daniel Stonier on 2019-03-23 11:32:32 UTC
Comments