BehaviorTree/BehaviorTree.ROS2

ERROR loading library [libdummy_sleep_action_bt_node.so]: can't find symbol [BT_RegisterNodesFromPlugin]

Closed this issue · 1 comments

Hi all,

I'm facing an issue using my own created ROS2 Action BT Plugin.

I'm basically using the same header and cpp file as the sample sleep_action in the btcpp_ros2_samples package. I register the Action Server using the macro CreateRosNodePlugin(ros_behavior_tree::DummySleepAction, "DummySleepAction"); from behaviortree_ros2/plugins.hpp in the cpp file of the plugin.

Opposing to BehaviorTree/BehaviorTree.CPP#300 , I'm also adding the compile definitions BT_EXPORT_PLUGIN in my CMakeLists.txt:

add_library(dummy_sleep_action_bt_node SHARED plugins/action/DummySleepAction.cpp)
list(APPEND plugin_libs dummy_sleep_action_bt_node)

foreach(bt_plugin ${plugin_libs})
  ament_target_dependencies(${bt_plugin} ${dependencies})
  target_compile_definitions(${bt_plugin} PRIVATE BT_PLUGIN_EXPORT)
endforeach()

The plugin is being loaded using the BT::SharedLibrary loader with factory_.registerFromPlugin(loader.getOSName(p)); (p being "dummy_sleep_action_bt_node").

Does anyone have an idea what the issue might be? Also please let me know if I can provide any more information.

Best regards,
Tom

EDIT: In the meantime I found out, that naively "mixing" the provided functions by this package and functionalities that were part of the navigation2 behavior tree package could be the cause of the problem as I'm not registering the action plugins as described in the "sleep_client" sample of this package. Will update, but still happy for some feedback.

The problem was resolved by using the RegisterRosNode(factory_, loader.getOSName(p), params); function from plugins.hpp instead of factory_.registerFromPlugin(loader.getOSName(p)); as it is done in the behavior tree engine of the nav2_behavior_tree package. Leaving this issue here to be closed in case someone faces the same issue.