-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unified cleanup using scoped behaviors #103
Conversation
Tested in sim. The only issue I noticed is that when terminating the CLI action call during robot arm motion, the tree runs the post-behavior before terminating the movement, which can be particularly harmful if the post-behavior blocks (e.g., toggling a collision object off). Instead, we want to first terminate the robot movement, and then run the post behavior. I should write comprehensive test cases for this idiom, covering:
|
Run: `colcon test --packages-select ada_feeding; colcon test-result --all --verbose` The current implementation fails on preemption order, and because `on_failure` runs if `on_success` fails
Wrote comprehensive test cases, and modified
The tree has become a bit unwieldy (reproduced below), but the comprehensive test cases mean that we can be fairly certain it works as outlined above.
All the test cases in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment for OnPreempt
, stopping the review there for now.
…etween on_failure and on_success
…_preempt will no longer be called
…`scoped_behavior`
Note that even the new The tests that still need to be implemented for
|
Addressed all changes, added comprehensive unit tests for @egordon note that while our discussed approach worked for
The only danger of the above formulation is potential name clashes with the blackboard status. However, I nest the blackboard variable within the idiom name, so the only way names will clash is if the programmer uses multiple idioms with the same name and doesn't pass a custom |
Description
In service of #54 .
In our trees, there are numerous times when we want to flip a switch, move the robot, and then flip the switch. For example, turning face detection on/off, adding/removing a collision object in the world, allowing/disallowing collisions with certain objects, etc.
What is challenging is that we want to run the "cleanup" for flipping the switch in three different cases:
Achieving the above 2 is straightforward using Selectors. Achieving the third is more difficult, because when
tree.stop(INVALID)
is called, it is called on all the behaviors one-by-one, which in turn calls each behaviors'terminate
function. Therefore, achieving the proper cleanup behavior in the third case requires performing that cleanup in aterminate
function of a behavior.Building off of the discussion and contribution in
py_trees
#427, this PR implements ascoped_behavior
idiom that executes a pre-behavior, main-behavior, and post-behaviour, with a guarantee that the post-behavior will execute even if the behavior is preempted.Testing procedure
Run the necessary nodes as documented in the README. Verify the following:
ros2 action send_goal /MoveToRestingPosition ada_feeding_msgs/action/MoveTo "{}" --feedback
ros2 action send_goal /MoveToMouth ada_feeding_msgs/action/MoveTo "{}" --feedback
wheelchair_collision
object.ros2 action send_goal /MoveFromMouthToRestingPosition ada_feeding_msgs/action/MoveTo "{}" --feedback
wheelchair_collision
object.in_front_of_wheelchair_wall
from the collision scene.MoveToMouth
andMoveFromMouthToRestingPosition
several times iteratively to test all of the above.)ros2 action send_goal /MoveToRestingPosition ada_feeding_msgs/action/MoveTo "{}" --feedback
ros2 action send_goal /MoveToMouth ada_feeding_msgs/action/MoveTo "{}" --feedback
wheelchair_collision
object.ros2 action send_goal /MoveFromMouthToRestingPosition ada_feeding_msgs/action/MoveTo "{}" --feedback
wheelchair_collision
object.in_front_of_wheelchair_wall
from the collision scene.MoveToMouth
andMoveFromMouthToRestingPosition
several times iteratively to test all of the above.)colcon test --packages-select ada_feeding; colcon test-result --all --verbose
Before opening a pull request
python3 -m black .
ada_feeding
directory, run:pylint --recursive=y --rcfile=.pylintrc .
.Before Merging
Squash & Merge