Skip to content

Different behavior using registerSimpleAction() and loadSubstitutionRuleFromJSON() #930

Open
@siddux

Description

@siddux

Describe the bug
I've a BT running inside a ROS node. More precisely I tick the tree on the execute() function of an action server. Everything worked fine but I wanted to add some testing using the mock nodes as described on the tutorial. Once running with the substitutions, the tree gets stuck right after the async delay finishes (immediately when enters on the subsituted node if the delay is 0). I've been playing around it so I found that just running it using a multithreaded executor solves the issue (even though every now and then it still gets stuck if I send goals quick enough).

This wouldn't be a problem by itself but later one I've realized that if I change my rules json file to something like this:

{
  "TestNodeConfigs": {
    
  },

  "SubstitutionRules": {
    "script_2": "MyTest"
  }
}

And on my code, I define the node like this:

factory.registerSimpleAction("DummyAction", [](BT::TreeNode& self){
    std::cout << "DummyAction substituting: "<< self.name() << std::endl;
    return BT::NodeStatus::SUCCESS;
  });

It runs perfectly on a single threaded executor. I've been analyzing the 2 methods from the factory that are used and I see the way of register the node is different but I don't have enough knowledge about the library to spot why this happens.

So my question is if that's really a bug or a design decision. In any case it would be nice to either find a way to fix it or to tell the user the limitation of each type of subsitution.

How to Reproduce*

I'll update this later once I've a cleaner example that can be easily run.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions