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

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

Open
siddux opened this issue Feb 6, 2025 · 0 comments

Comments

@siddux
Copy link

siddux commented Feb 6, 2025

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.

@siddux siddux changed the title Different behavior using registerSimpleAction() and loadSubstitutionRuleFromJSON() Different behavior using registerSimpleAction() and loadSubstitutionRuleFromJSON() Feb 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant