(self, behavior, criteria, name, timeout=60, terminate_on_failure=False)
| 223 | """ |
| 224 | |
| 225 | def __init__(self, behavior, criteria, name, timeout=60, terminate_on_failure=False): |
| 226 | self.behavior = behavior |
| 227 | self.test_criteria = criteria |
| 228 | self.timeout = timeout |
| 229 | self.name = name |
| 230 | |
| 231 | if self.test_criteria is not None and not isinstance(self.test_criteria, py_trees.composites.Parallel): |
| 232 | # list of nodes |
| 233 | for criterion in self.test_criteria: |
| 234 | criterion.terminate_on_failure = terminate_on_failure |
| 235 | |
| 236 | # Create py_tree for test criteria |
| 237 | self.criteria_tree = py_trees.composites.Parallel( |
| 238 | name="Test Criteria", |
| 239 | policy=py_trees.common.ParallelPolicy.SUCCESS_ON_ONE |
| 240 | ) |
| 241 | self.criteria_tree.add_children(self.test_criteria) |
| 242 | self.criteria_tree.setup(timeout=1) |
| 243 | else: |
| 244 | self.criteria_tree = criteria |
| 245 | |
| 246 | # Create node for timeout |
| 247 | self.timeout_node = TimeOut(self.timeout, name="TimeOut") |
| 248 | |
| 249 | # Create overall py_tree |
| 250 | self.scenario_tree = py_trees.composites.Parallel(name, policy=py_trees.common.ParallelPolicy.SUCCESS_ON_ONE) |
| 251 | if behavior is not None: |
| 252 | self.scenario_tree.add_child(self.behavior) |
| 253 | self.scenario_tree.add_child(self.timeout_node) |
| 254 | self.scenario_tree.add_child(WeatherBehavior()) |
| 255 | self.scenario_tree.add_child(UpdateAllActorControls()) |
| 256 | |
| 257 | if criteria is not None: |
| 258 | self.scenario_tree.add_child(self.criteria_tree) |
| 259 | self.scenario_tree.setup(timeout=1) |
| 260 | |
| 261 | def _extract_nodes_from_tree(self, tree): # pylint: disable=no-self-use |
| 262 | """ |
nothing calls this directly
no test coverage detected