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

Can't find symbol [BT_RegisterNodesFromPlugin] #300

Open
kevinlyu1 opened this issue Aug 3, 2021 · 2 comments
Open

Can't find symbol [BT_RegisterNodesFromPlugin] #300

kevinlyu1 opened this issue Aug 3, 2021 · 2 comments

Comments

@kevinlyu1
Copy link

@kevinlyu1 kevinlyu1 commented Aug 3, 2021

Hi Davide,

I have been trying to build a collision detection node but seem to be running into issues. I am getting the error below:
[bt_navigator-13] ERROR loading library [libsdr_behaviors__check_collision_condition.so]: can't find symbol [BT_RegisterNodesFromPlugin]

I have been trying to model my code after the code in the nav2_recoveries project because they already have a isCollisionFree function that should do this. I am just trying to pull this out so collision detection can be used as a condition node instead of being hidden within the nav2_recovery behaviors.

I have the macro to register the node in the .cpp file:
#include "pluginlib/class_list_macros.hpp"
PLUGINLIB_EXPORT_CLASS(sdr_behaviors::CheckCollisionCondition, nav2_core::Recovery)

sdr_behaviors is the name space and CheckCollisionCondition is the class name. The .so is being created in the install folder, but for some reason I keep getting the error above. I believe this is similar to the issue #102 but that did not seem to fix my issue.

Please let me know if there is any information I can provide to help get this working!

@samiamlabs
Copy link

@samiamlabs samiamlabs commented Nov 10, 2021

Hi @kevinlyu1,
I have a similar problem, did you find a solution?

I'm trying to figure out how to register custom ros2 action interfaces as BehaviorTree.CPP actions. I based the code on the nav2_behavior_tree package.

#include "behaviortree_cpp_v3/bt_factory.h"
BT_REGISTER_NODES(factory)
{
  BT::NodeBuilder builder = [](const std::string & name, const BT::NodeConfiguration & config) {
    return std::make_unique<relox_behavior_tree::SleepAction>(name, "sleep", config);
  };

  factory.registerBuilder<relox_behavior_tree::SleepAction>("Sleep", builder);
}

It compiles without complaining but I get this error when starting the tree:
ERROR loading library [librelox_sleep_action_bt_node.so]: can't find symbol [BT_RegisterNodesFromPlugin]

@samiamlabs
Copy link

@samiamlabs samiamlabs commented Nov 10, 2021

Turns out I was missing target_compile_definitions(${bt_plugin} PRIVATE BT_PLUGIN_EXPORT) in my CMakeLists.txt
Not exactly sure what that does, but it seems to have fixed the problem.

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

2 participants