Skip to content
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

Refactoring WhileDoElseNode to allow 2 or 3 children #625

Merged
merged 1 commit into from
Aug 8, 2023

Conversation

Aglargil
Copy link
Contributor

@Aglargil Aglargil commented Aug 2, 2023

Description:

This PR addresses the constraint in the WhileDoElse node that mandates the presence of three child nodes. The aim is to improve flexibility and align its behavior with that of the IfThenElse node which allows either two or three child nodes.

Testing:

Tests have been conducted to verify the behavior with both two and three child nodes.

Looking forward to your feedback, thank you!

@Aglargil
Copy link
Contributor Author

Aglargil commented Aug 2, 2023

#602

@facontidavide
Copy link
Collaborator

Side note.

With this change, It seems to me that WhileDoElse becomes EXACTLY equal to ReactiveSequence with two children.

I am not sure if this may create some confusion. What do you think?

@Aglargil
Copy link
Contributor Author

Aglargil commented Aug 8, 2023

Thank you for your reply!

I see that WhileDoElse is described as

It is a REACTIVE node of IfThenElseNode

And IfThenElse behaves like Sequence when there are only 2 nodes, so it is very design intuitive to make WhileDoElse behave consistently with ReactiveSequence when there are only two nodes is very intuitive to design, and such duality looks very elegant.

On the flip side, WhileDoElse and IfThenElse provide better extensibility. For tasks that require a precondition and then execute, we'll likely add the tasks that Else requires to execute later.

@facontidavide facontidavide merged commit 74c7dd7 into BehaviorTree:master Aug 8, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants