-
Notifications
You must be signed in to change notification settings - Fork 15
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
Implement new behavior, RepeatSequence #24
Conversation
Hey, sorry for late reply. Will have a look on your PR sometime in the next couple of days. Been quite busy lately |
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.
Great work, and thank you for adding an additional useful behavior. Before I can approve the code I need you to:
- fix any comments I've added
- Include unit tests of new behavior. See
/bonsai/tests/
folder to make sure the behavior works as intended. Test common cases and edge cases e.g input vector is empty - Update the
How to use a Behavior tree?
section found inbonsai/README.md
in the root to include the new behavior - Update the
bonsai/examples/README.md
to cinlude your new example with a readme on what the examples show/does, how to run it, and if it requires any installations/dependecies (e.g from apt-get registry)
FYA, I'm writing from a different github user atm as I don't have access to my main user from this computer.
bonsai/src/state.rs
Outdated
@@ -51,6 +51,8 @@ pub enum State<A> { | |||
SequenceState(Vec<Behavior<A>>, usize, Box<State<A>>), | |||
/// Keeps track of a `While` behavior. | |||
WhileState(Box<State<A>>, Vec<Behavior<A>>, usize, Box<State<A>>), | |||
/// Keeps track of a `While` behavior. |
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.
typo, RepeatSequence
I added the required changes but I could not verify that It seems that the other behaviors (or at least |
} | ||
|
||
#[test] | ||
fn test_repeat_sequence_timed() { |
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.
I think this makes sense.
wrt to dt
, when one action terminates, it can consume some of dt
and the remaining is passed onto the next action.
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.
pre-commit is failing, so you need to make the fixes as suggested by the failing checks. https://github.com/Sollimann/bonsai/actions/runs/6944779061 to install pre-commit for this project, see: https://pre-commit.com/ Its basically:
Also, I have invited you to be collaborator on the project. That should give you some more privileges for the project. |
Other than that, I think it looks good now. Will approve when all the checks pass. Great work! :) |
Also, can you bump version to |
Thanks! I also had to do some cosmetic changes to the boids example to get through the pre-commit. Looks good now? |
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.
lgtm!
I´ll make a new release once you have merged it to main :) |
Implements new behavior
RepeatSequence
which acts like aSequence
but repeats forever as long as a conditional behavior succeeds (or fails) that precedes the sequence. The condition is only checked before the sequence runs and not during the sequence, unlike inWhile
behavior.I am testing this on my own application soon to see if anything should be changed but here's the initial idea draft anyway.
Related issue: #23