Gazebo | Ignition | Community
Ask Your Question
0

How to resolve undefined symbol referenced from my plugin for ray sensor?

asked 2018-03-26 14:34:41 -0600

bybee.taylor gravatar image

I've created a Gazebo Plugin that inherits from the RayPlugin type.

class CustomPlugin : public RayPlugin

It compiles just fine (using Gazebo 9), but when I launch Gazebo I get the following error.

[Err] [Plugin.hh:180] Failed to load plugin {path_to_plugin}/libcustom_plugin.so: {path_to_plugin}/libcustom_plugin.so: undefined symbol:
_ZTIN6gazebo9RayPluginE

I am referencing it in my model file like this:

   <plugin name="custom_plugin" filename="libcustom_plugin.so">
      <!--Parameters-->
   </plugin>

In my CMakeLists.txt, I am linking like this:

add_library(custom_plugin SHARED plugins/custom_plugin.cpp)
target_link_libraries(custom_plugin ${GAZEBO_LIBRARIES} ${IGNITION-MSGS_LIBRARIES})

I've done two things to ensure that the GAZEBO_PLUGIN_PATH is set correctly. First, I've used the tag in package.xml.

  <export>
    <!-- Other tools can request additional information be placed here -->
    <gazebo_ros plugin_path="${prefix}/lib" gazebo_media_path="${prefix}" gazebo_model_path="${prefix}/models"/>
  </export>

Secondly, I've manually set the variable to reference both the native Gazebo plugins and the lib folder.

export GAZEBO_PLUGIN_PATH=/usr/lib/x86_64-linux-gnu/gazebo-9/plugins:{path_to_ros_package}/devel/lib

I've verified that /usr/lib/x86_64-linux-gnu/gazebo-9/plugins contains libRayPlugin.so. Neither of these two works.

I am at a loss. Any thoughts?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2018-03-26 15:10:15 -0600

bybee.taylor gravatar image

Just for reference, I got it working by including the following in the CMakeLists.txt.

link_directories(${GAZEBO_LIBRARY_DIRS})

and

add_library(custom_plugin SHARED plugins/custom_plugin.cpp)
target_link_libraries(custom_plugin RayPlugin ${GAZEBO_LIBRARIES} ${IGNITION-MSGS_LIBRARIES})
edit flag offensive delete link more

Comments

That worked for me also

adel gravatar imageadel ( 2020-08-19 04:18:42 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2018-03-26 14:34:41 -0600

Seen: 1,168 times

Last updated: Mar 26 '18