py_trees.demos.context_switching module
A py_trees demo.
- class py_trees.demos.context_switching.ContextSwitch(name: str = 'ContextSwitch')
Bases:
Behaviour
An example of a context switching class.
This class sets (in
initialise()
) and restores a context (interminate()
). Use in parallel with a sequence/subtree that does the work while in this context.Attention
Simply setting a pair of behaviours (set and reset context) on either end of a sequence will not suffice for context switching. In the case that one of the work behaviours in the sequence fails, the final reset context switch will never trigger.
- initialise() None
Backup and set a new context.
- py_trees.demos.context_switching.command_line_argument_parser() ArgumentParser
Process command line arguments.
- Returns:
the argument parser
- py_trees.demos.context_switching.create_root() Behaviour
Create the root behaviour and it’s subtree.
- Returns:
the root behaviour
- py_trees.demos.context_switching.description() str
Print description and usage information about the program.
- Returns:
the program description string
- py_trees.demos.context_switching.epilog() str | None
Print a noodly epilog for –help.
- Returns:
the noodly message
- py_trees.demos.context_switching.main() None
Entry point for the demo script.