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

SetBlackboard crashing when used with a typed remapped port #653

Closed
afrixs opened this issue Sep 6, 2023 · 5 comments
Closed

SetBlackboard crashing when used with a typed remapped port #653

afrixs opened this issue Sep 6, 2023 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@afrixs
Copy link

afrixs commented Sep 6, 2023

Version: 3.8.5

Custom node (the important part is that <bool> is used inside providedPorts()):

#include "behaviortree_cpp_v3/behavior_tree.h"

namespace bt_test
{
class Assert : public BT::SyncActionNode
{
  public:
    Assert(const std::string& name, const BT::NodeConfiguration& config)
      : BT::SyncActionNode(name, config) {}

    static BT::PortsList providedPorts() {
        return {BT::InputPort<bool>("condition")};
    }

  private:
    virtual BT::NodeStatus tick() override {
        if (getInput<bool>("condition").value())
            return BT::NodeStatus::SUCCESS;
        else
            return BT::NodeStatus::FAILURE;
    }
};
} // end namespace

BT:

<?xml version='1.0'?>
<root main_tree_to_execute = "MainTree" xmlns:xacro="http://www.ros.org/wiki/xacro">
  <BehaviorTree ID="MainTree">
    <Sequence>
      <SubTreePlus ID="Init" test="{test}" />
      <Assert condition="{test}" />
    </Sequence>
  </BehaviorTree>

  <BehaviorTree ID="Init">
    <SetBlackboard output_key="test" value="true"/>
  </BehaviorTree>
</root>

Expected behavior:
SUCCESS

Actual behavior:

terminate called after throwing an instance of 'BT::LogicError'
  what():  Blackboard: once declared, the type of a port shall not change. Previously declared type [bool] != new type [std::string]

Notes:

  • Same happens with <SubTree ID="Init" test="test" />
  • The crash doesn't occur when <SetBlackboard output_key="test" value="true"/> is used directly in the MainTree
@facontidavide
Copy link
Collaborator

facontidavide commented Sep 6, 2023

thanks for reporting. Version 4.x on master was also affected. I fixed it there, but I will backport the fix to 3.8

@facontidavide facontidavide self-assigned this Sep 6, 2023
@facontidavide facontidavide added the bug Something isn't working label Sep 6, 2023
@facontidavide
Copy link
Collaborator

Fixed on branch v3.8 too

@facontidavide
Copy link
Collaborator

thanks for providing a way to test it 😃

@bektaskemal
Copy link

Hi, will there be a 3.8 release for this?

@facontidavide
Copy link
Collaborator

@bektaskemal when you ask about a release, which ROS distro are you talking about? I think it was released

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants