Skip to content

SubTreePlus in v3.8.4: Port initially created with type [std::string] and, later type [...] was used somewhere else #623

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
m-morelli opened this issue Aug 1, 2023 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@m-morelli
Copy link

Ciao @facontidavide,

I've recently upgraded BehaviorTree.CPP from v3.8.3 to v3.8.4. Now when my BT executor executes a SubTreePlus like

<SubTreePlus name="Patrol" ID="Patrol" tl1="KITCHEN" tl2="LIVING"/>

I get this error:

[ERROR] [1690826385.151509220] []: Original error: The creation of the tree failed because the port [tl1] was initially created with type [std::string] and, later type [std_msgs::msg::String_<std::allocator<void> >] was used somewhere else.

It was used to work in v3.8.3. Possibly related to #489, which you already fixed for BehaviorTree.CPP v4?


Here's a simple test that reproduces the issue, based on the MoveBase node in BehaviorTree.CPP for your convenience:

#include "behaviortree_cpp_v3/loggers/bt_cout_logger.h"
#include "behaviortree_cpp_v3/bt_factory.h"

#include "movebase_node.h"

// clang-format off

static const char* xml_text = R"(
<root main_tree_to_execute="Test">
  <BehaviorTree ID="Test">
    <ReactiveSequence name="MainSequence">
      <SubTreePlus name="Visit2" ID="Visit2" tl1="1;2;3" tl2="4;5;6"/>
    </ReactiveSequence>
  </BehaviorTree>
  <BehaviorTree ID="Visit2">
    <Sequence name="Visit2MainSequence">
      <Action name="MoveBase" ID="MoveBase" goal="{tl1}"/>
      <Action name="MoveBase" ID="MoveBase" goal="{tl2}"/>
    </Sequence>
  </BehaviorTree>
</root>
 )";

// clang-format on

using namespace BT;

int main()
{
  BehaviorTreeFactory factory;
  factory.registerNodeType<MoveBaseAction>("MoveBase");
  auto tree = factory.createTreeFromText(xml_text);
  tree.tickRootWhileRunning();
  return 0;
}

Execution on my system gives:

$ ./test_subtreeplus 
tl2 (std::string) -> full
tl1 (std::string) -> full
terminate called after throwing an instance of 'BT::RuntimeError'
  what():  The creation of the tree failed because the port [tl1] was initially created with type [std::string] and, later type [Pose2D] was used somewhere else.
Aborted (core dumped)
@siferati
Copy link

siferati commented Aug 4, 2023

Having the same issue after updating from 3.8.3 to 3.8.4 today

@facontidavide
Copy link
Collaborator

fixed

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