Gazebo | Ignition | Community
Ask Your Question
0

Resolving symbol lookup errors in Gazebo 1.5 and 1.8

asked 2013-06-11 01:27:45 -0600

PMilani gravatar image

updated 2013-06-11 01:59:01 -0600

Hi all,

I am trying to convert my ROS Fuerte Gazebo simulations over to the stand alone Gazebo setup. My simulatoins consist of SDF files with a plugin to publish data to ROS.

I have been following the 1.5 tutorial, effectively creating a standalone package for compiling my plugin code. This has worked okay in that when the plugin is disabled (ie with an incorrect GAZEBOPLUGINPATH the model is displayed, but does nothing.

With the GAZEBOPLUGINPATH correctly set my simulation exits with:

Msg Waiting for master
Msg Connected to gazebo master @ http://127.0.0.1:11345
Msg Publicized address: 192.168.1.5
gazebo: symbol lookup error: /home/petermilani/local/lib/gazebo_plugins/libros_model_plugin.so: undefined symbol: _ZN8hydmotorC1Ev

Error [ConnectionManager.cc:123] Connection Manager is not running

Now having a look at this similar error, however the solutions do not seem relevant to my plugin or have already been included. My plugin simply models the actuator dynamics of the manipulator, and works in Gazebo 1.0.

I think that it is an issue with the complilation. At the moment my CMakeLists.txt is as per the 1.5 tutorial. And looking through the build directory it is compiling against Gazebo 1.8.

In my fuerte ros package, my CMakeLists has an entry:

rosbuild_add_library(${PROJECT_NAME} src/hydcylinder.cpp)

and the object hydmotor is defined in hydcylinder.cpp

could the lack of this in my new gazebo package be the reason why a symbol _ZN8hydmotorC1Ev is not found? If so what is the equivalent call for a non-ros CMakeLists.Txt to compile and include it?

UPDATE 1: Just comparing CMakeLists.txt in the rosbuild environment: In ROSBuild:

rosbuild_add_library(${PROJECT_NAME} src/hydcylinder.cpp) . ...
rosbuild_add_library(HMMv2 src/HMMv2motors.cpp)

in the current standalone environment:

add_library(ros_model_plugin SHARED src/HMMv2motors.cc)

when I add to the standalone environment: addlibrary(rosmodel_plugin SHARED src/hydcylinder.cpp)

I get an error about:

add_library cannot create target "ros_model_plugin" because another target
  with the same name already exists.

which sort of makes sense and as the hydcylinder.h is included in HMMv2motors.cc I can't see why a separate library was necessary.

cheers

Peter

edit retag flag offensive close merge delete

Comments

Have you tried `$ sudo ldconfig`?

Boris gravatar imageBoris ( 2013-06-11 01:30:52 -0600 )edit

just ran it on verbose setting, didn't see anything unusual, and didn't change the result. I just added an update regarding CMakeLists.txt

PMilani gravatar imagePMilani ( 2013-06-11 01:53:03 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2013-06-11 03:24:07 -0600

PMilani gravatar image

updated 2013-06-11 03:25:29 -0600

This is essentially a linking issue. With my library referencing hydcylinder.h, I had to ensure that make compiled hydcylinder.cpp and that my ros_plugin library was linked to that. To do this I had had to change CMakeLists.txt as follows:

FROM:

add_library(ros_model_plugin SHARED src/HMMv2motors.cc)


set_target_properties(ros_model_plugin PROPERTIES COMPILE_FLAGS "${roscpp_CFLAGS_OTHER}")
set_target_properties(ros_model_plugin PROPERTIES LINK_FLAGS "${roscpp_LDFLAGS_OTHER}")
target_link_libraries(ros_model_plugin ${roscpp_LIBRARIES})

install (TARGETS ros_model_plugin DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/gazebo_plugins/)

TO:

add_library(ros_model_plugin SHARED src/HMMv2motors.cc)
add_library(hydcylinder SHARED src/hydcylinder.cpp)

set_target_properties(ros_model_plugin PROPERTIES COMPILE_FLAGS "${roscpp_CFLAGS_OTHER}")
set_target_properties(ros_model_plugin PROPERTIES LINK_FLAGS "${roscpp_LDFLAGS_OTHER}")
target_link_libraries(ros_model_plugin ${roscpp_LIBRARIES} hydcylinder )

install (TARGETS ros_model_plugin DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/gazebo_plugins/)
install (TARGETS hydcylinder DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/gazebo_plugins/)

The last install line may not be required. As I had problems between finding the plugin (which would only happen when I was launching gazebo from the gazeborosplugin/build directory) to finding my mesh files (which would only occur when I was in my home directory. To resolve this I added gazeborosplugin/build to my GAZEBOPLUGINPATH and launched gazebo from my home directory.

if it would work within ROS that would be best. Cant wait for the 1.9 to be released.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-06-11 01:27:45 -0600

Seen: 1,481 times

Last updated: Jun 11 '13