Ask Your Question
1

Pluginception: Build Factory

asked 2013-12-13 11:21:14 -0500

David Lu gravatar image

updated 2013-12-15 06:49:54 -0500

I get the following error message in pluginlib.

[FATAL] [1386974148.099388732, 94910.942000000]: Failed to create the dwa_local_planner/DWAPlannerROS planner, are you sure it is properly registered and that the containing library is built? Exception: MultiLibraryClassLoader: Could not create object of class type dwa_local_planner::OscillationCostFunction as no factory exists for it. Make sure that the library exists and was explicitly loaded through MultiLibraryClassLoader::loadLibrary()

The relevant code is here: GitHub: dwa_local_planner (groovy_plugin_planner branch)

If you have a package that creates a DWAPlanner directly (without pluginlib), then the PluginLoader inside of DWAPlanner works fine, as in this test

However, if you dynamically load DWAPlanner as move_base does, then the above error message occurs when you try to load the plugins within DWAPlanner as in this test

edit retag flag offensive close merge delete

Comments

Hey David, I can try to help you debug this. What do you mean when you say "in isolation"? First thing to check is after sourcing your environment, check LD_LIBRARY_PATH to see if it's pointing to the right place and has the right ordering. Then make sure the library with the respective class (dwa_local_planner::OscillationCostFunction) actually exists.

mirzashah gravatar image mirzashah  ( 2013-12-13 12:40:31 -0500 )edit

Other things to check -- make sure the plugin name is correct in your plugin xml file and corresponds with what you're attempting to load.

mirzashah gravatar image mirzashah  ( 2013-12-13 12:42:02 -0500 )edit

I have clarified what I meant by in isolation. The library is built, contains the respective class and is on the LD_LIBRARY_PATH.

David Lu gravatar image David Lu  ( 2013-12-15 05:57:49 -0500 )edit

I understand now what you mean. Everything looks good it terms of your package.xml, CMakeLists.txt and plugin XML. However, your error message is interesting nwo that I read it a second time -- you try to create a DWAPlannerROS but its trying to lookup the factory for OscillationCostFunction. Does that mean the DWAPlannerROS plugin has a classloader inside of it that tries to load that cost function boject?

mirzashah gravatar image mirzashah  ( 2013-12-16 14:35:44 -0500 )edit

Ah ok, so DWAPlannerROS is creating a DWAPlanner inside of it which itself has a plugin classloader for creating the OscillationCostFunction which is a TrajectoryCostFunciion...

mirzashah gravatar image mirzashah  ( 2013-12-16 14:43:09 -0500 )edit

Wait where's the plugin XML file for OscillationCostFunction...that's probably what's wrong

mirzashah gravatar image mirzashah  ( 2013-12-16 14:45:46 -0500 )edit

Its default_critics.xml, as listed in the package.xml

David Lu gravatar image David Lu  ( 2013-12-17 08:43:25 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2013-12-21 19:21:47 -0500

mardo gravatar image

updated 2013-12-21 21:59:27 -0500

Hey David,

I happened to be working on the same thing as you with regards to adding cost functions as plugins to the DWAPlanner and came across this exact same problem.

I believe the issue is that you cannot link against the same library that contains the plugin that you are trying to load.

I can get your example to run with the following changes to your CMakeLists.txt:

add_library(cost_functions src/map_grid_cost_function.cpp src/goal_dist_cost_function.cpp src/path_dist_cost_function.cpp src/offset_grid_cost_function.cpp src/goal_align_cost_function.cpp src/path_align_cost_function.cpp src/obstacle_cost_function.cpp src/oscillation_cost_function.cpp src/prefer_forward_cost_function.cpp )

add_library(dwa_local_planner src/dwa_planner.cpp src/dwa_planner_ros.cpp src/simple_scored_sampling_planner.cpp) target_link_libraries(dwa_local_planner base_local_planner) add_dependencies(dwa_local_planner dwa_local_planner_gencfg) add_dependencies(dwa_local_planner nav_msgs_gencpp) add_executable(plugin_quiz src/plugin_quiz.cpp) target_link_libraries(plugin_quiz ${catkin_LIBRARIES} dwa_local_planner)

add_executable(plugin_quiz2 src/plugin_quiz2.cpp) target_link_libraries(plugin_quiz2 ${catkin_LIBRARIES} dwa_local_planner)

However, I now get the following error after running:


Warning: class_loader::ClassLoader: SEVERE WARNING!!! Attempting to unload library while objects created by this loader exist in the heap! You should delete your objects before attempting to unload the library or destroying the ClassLoader. The library will NOT be unloaded.
         at line 94 in /tmp/buildd/ros-hydro-class-loader-0.2.3-0precise-20131010-0141/src/class_loader.cpp
Segmentation fault (core dumped)

The segfault appears to be occurring with the deletion of the WorldModel in the destructor of ObstacleCostFunction - changing world_model_ to a boost::shared_ptr appears to fix this, though I'm not sure what the root cause is. I'm not sure about the cause of the class_loader warning either, but calling tc_.reset() at the end of your plugin_quiz2.cpp appears to fix it.

With these changes, I intermittently get the following error when the program finishes:


plugin_quiz2: pthread_mutex_lock.c:62: __pthread_mutex_lock: Assertion `mutex->__data.__owner == 0' failed.
Aborted (core dumped)

Let me know if that helps. Looking forward to seeing this addition to the planner!

edit flag offensive delete link more

Comments

This worked. Thanks so much.

David Lu gravatar image David Lu  ( 2013-12-26 12:49:47 -0500 )edit

@David Lu, @mardo: what was actually the solution? (as the github repository doesn't exist anymore, I can't see what was the problem and the change)

gavran gravatar image gavran  ( 2017-03-24 11:22:54 -0500 )edit

I believe it was separating them into different libraries.

David Lu gravatar image David Lu  ( 2017-03-24 15:02:45 -0500 )edit

Hi, I have the same warning, about the class_loader. What does tc_ in the code corresponds to ?

Shanika gravatar image Shanika  ( 2020-06-25 02:48:27 -0500 )edit

I believe it was the boost pointer. Probably best to just open a new question at this point.

David Lu gravatar image David Lu  ( 2020-06-25 17:59:08 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

3 followers

Stats

Asked: 2013-12-13 11:21:14 -0500

Seen: 4,805 times

Last updated: Dec 21 '13