Skip to content

Pre-Condition : _skipIf NOT working with ReactiveSequence #525

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

Closed
ephson24 opened this issue Mar 14, 2023 · 6 comments
Closed

Pre-Condition : _skipIf NOT working with ReactiveSequence #525

ephson24 opened this issue Mar 14, 2023 · 6 comments

Comments

@ephson24
Copy link

Hi Davide,

I have this simple behavior to check battery level(condition always returning TRUE) and only send warning only if the "isLowBattery" variable is set. Thus, the SendWarning node should not run if it is false.
<root BTCPP_format="4" > <BehaviorTree ID="PowerManagerT"> <ReactiveSequence> <Script code=" LOW_BATT:=20 "/> <CheckLevel deviceType="BATT" percentage="{LOW_BATT}" isLowBattery="{isLowBattery}"/> <SendWarning deviceType="BATT" deviceStatus="{isLowBattery}" _skipIf="!isLowBattery"/> </ReactiveSequence> </BehaviorTree> </root>

But when running the tree, SendWarning keeps getting called regardless. However, if I change the control node to use a Sequence, it works as expected.

PS: I am using the same cpp code refrenced in this issue
With the added code fixes when using getInput.

@facontidavide
Copy link
Collaborator

Please look at this. it seems to work correctly to me:

https://github.com/BehaviorTree/BehaviorTree.CPP/blob/master/tests/script_parser_test.cpp#L280-L288

Also, there was an error in your code that I corrected:

 ((100 < percent)? true : false))

This will return false.
I changed it to:

 ( percent < 25 )

@facontidavide
Copy link
Collaborator

Closing this. If you think that my unit test does not reproduce correctly your issue, please suggest a modification to the unit test and send a PR.

@facontidavide
Copy link
Collaborator

I was able to reproduce the issue with much simpler code. Thanks a lot for your help!!!

c71b2aa

@facontidavide
Copy link
Collaborator

facontidavide commented Mar 14, 2023

I think that I can reproduce it

I will keep you posted

@facontidavide
Copy link
Collaborator

better unit test added. Have a look

@ephson24
Copy link
Author

better unit test added. Have a look

Will do. Thanks

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

No branches or pull requests

2 participants