Ask Your Question
0

Looping a sequence in py_trees

asked 2018-02-06 19:31:38 -0500

Pi Robot gravatar image

Hello,

I am trying out the most excellent py_trees_ros 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

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-03-23 11:32:32 -0500

Daniel Stonier gravatar image

updated 2019-03-23 11:34:07 -0500

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.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2018-02-06 19:31:38 -0500

Seen: 299 times

Last updated: Mar 23