Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Arithmetic operations on Post Conditions (Success | Failure) | Not working #539

Closed
@ephson24

Description

@ephson24

Hi Davide,

I find trying to set arithmetic operations using _onSuccess and _onFailure does not work.
However using _onpost works as expected.

E.g XML (not working)

<Sequence>
              <TestCanDo state="false"
                         _onFailure="loop_count  += 1"/>
              <SendWarning deviceStatus="{isLowBattery}"
                           deviceType="BATT"/>
</Sequence>

But this works:

<Sequence>
              <TestCanDo state="false"
                         _onpost="loop_count  += 1"/>
              <SendWarning deviceStatus="{isLowBattery}"
                           deviceType="BATT"/>
</Sequence>

C++ code

BT::NodeStatus testCanDo(BT::TreeNode &self)
{
  bool state;
  if(auto res = self.getInput<bool>("state"))
    state = res.value();
  else
    throw std::runtime_error(res.error());
  return (state)? BT::NodeStatus::SUCCESS : BT::NodeStatus::FAILURE;
}

Could this be a bug of sorts?

PS: TestCanDo is a simple condition node

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions