Skip to content

SetBlackboard crashing when used with a typed remapped port #653

@afrixs

Description

@afrixs

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

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