symbol lookup error when running a custom gazebo_ros plugin
Update :
Still investigating on this problem. I think the problem may be a dependency problem. I searched a GazeboRos class with a readCommonParameter function and I found it in the gazeborosutils files. So I have downloaded the .cpp and .h file and build the gazeborosutils lib but nothing changed.
There is my package.xml file :
<?xml version="1.0"?>
<package>
<name>gazebo_pkg_src</name>
<version>0.0.0</version>
<description>The gazebo_pkg_src package</description>
<!-- One maintainer tag required, multiple allowed, one person per tag -->
<!-- Example: -->
<!-- <maintainer email="jane.doe@example.com">Jane Doe</maintainer> -->
<maintainer email="todo@todo">todo</maintainer>
<!-- One license tag required, multiple allowed, one license per tag -->
<!-- Commonly used license strings: -->
<!-- BSD, MIT, Boost Software License, GPLv2, GPLv3, LGPLv2.1, LGPLv3 -->
<license>TODO</license>
<!-- Url tags are optional, but mutiple are allowed, one per tag -->
<!-- Optional attribute type can be: website, bugtracker, or repository -->
<!-- Example: -->
<!-- <url type="website">http://wiki.ros.org/gazebo_pkg_src</url> -->
<!-- Author tags are optional, mutiple are allowed, one per tag -->
<!-- Authors do not have to be maintianers, but could be -->
<!-- Example: -->
<!-- <author email="jane.doe@example.com">Jane Doe</author> -->
<!-- The *_depend tags are used to specify dependencies -->
<!-- Dependencies can be catkin packages or system dependencies -->
<!-- Examples: -->
<!-- Use build_depend for packages you need at compile time: -->
<!-- <build_depend>message_generation</build_depend> -->
<!-- Use buildtool_depend for build tool packages: -->
<!-- <buildtool_depend>catkin</buildtool_depend> -->
<!-- Use run_depend for packages you need at runtime: -->
<!-- <run_depend>message_runtime</run_depend> -->
<!-- Use test_depend for packages you need only for testing: -->
<!-- <test_depend>gtest</test_depend> -->
<buildtool_depend>catkin</buildtool_depend>
<build_depend>gazebo</build_depend>
<build_depend>gazebo_msgs</build_depend>
<build_depend>roscpp</build_depend>
<build_depend>rospy</build_depend>
<build_depend>rosconsole</build_depend>
<build_depend>geometry_msgs</build_depend>
<build_depend>nav_msgs</build_depend>
<build_depend>tf</build_depend>
<build_depend>tf2_ros</build_depend>
<build_depend>sensor_msgs</build_depend>
<build_depend>std_msgs</build_depend>
<run_depend>gazebo</run_depend>
<run_depend>gazebo_ros</run_depend>
<run_depend>gazebo_msgs</run_depend>
<run_depend>roscpp</run_depend>
<run_depend>rospy</run_depend>
<run_depend>rosconsole</run_depend>
<run_depend>geometry_msgs</run_depend>
<run_depend>nav_msgs</run_depend>
<run_depend>tf</run_depend>
<run_depend>tf2_ros</run_depend>
<run_depend>sensor_msgs</run_depend>
<run_depend>std_msgs</run_depend>
<!-- The export tag contains other, unspecified, tags -->
<export>
<!-- Other tools can request additional information be placed here -->
<gazebo_ros plugin_path="${prefix}/lib" gazebo_media_path="${prefix}"/>
</export>
</package>
There is my CMakeList.txt file :
cmake_minimum_required(VERSION 2.8.3)
project(gazebo_pkg_src)
set(CMAKE_CXX_FLAGS "-std=c++0x ${CMAKE_CXX_FLAGS} -g -Wall")
## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS
gazebo_msgs
roscpp
rospy
geometry_msgs
nav_msgs
tf
tf2_ros
sensor_msgs
rosconsole
std_msgs
)
find_package(gazebo REQUIRED)
find_package(Boost REQUIRED COMPONENTS thread)
link_directories(${GAZEBO_LIBRARY_DIRS})
include_directories(include ${Boost_INCLUDE_DIR} ${catkin_INCLUDE_DIRS} ${GAZEBO_INCLUDE_DIRS})
catkin_package(
INCLUDE_DIRS
include
LIBRARIES
secondRobot_drive_plugin
firstRobot_drive_plugin
gazebo_ros_utils
CATKIN_DEPENDS
gazebo_msgs
roscpp
rospy
rosconsole
geometry_msgs
nav_msgs
tf
tf2_ros
sensor_msgs
std_msgs
DEPENDS
SDF
gazebo
)
add_library(gazebo_ros_utils src/gazebo_ros_utils.cpp)
target_link_libraries(gazebo_ros_utils ${GAZEBO_LIBRARIES} ${catkin_LIBRARIES} ${Boost_LIBRARIES})
add_library(secondRobot_drive_plugin src/secondRobot_drive_plugin.cpp)
target_link_libraries(secondRobot_drive_plugin ${catkin_LIBRARIES} ${GAZEBO_LIBRARIES})
add_library(firstRobot_drive_plugin src/firstRobot_drive_plugin.cpp)
target_link_libraries(firstRobot_drive_plugin ${catkin_LIBRARIES} ${GAZEBO_LIBRARIES})
install(TARGETS
secondRobot_drive_plugin
firstRobot_drive_plugin
gazebo_ros_utils
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
)
Original :
Hello everybody,
I am trying to modify the gazeborosdiff_drive plugin because I have a custom message type to command my robot. So I take the source files and I just modified the name of the class (for the moment). When running, I got this error :
gzserver: symbol lookup error: /home/robosoft/workspace/rosws/devel/lib/libmyRobotdrive_plugin.so: undefined symbol: _ZN6gazebo9GazeboRos19readCommonParameterEv Service call failed: transport error completing service call: unable to receive data from sender, check sender's logs for details
My plugin and my robot are not in the same package.
Thanks in advance
Asked by F.Brosseau on 2016-01-12 10:35:16 UTC
Answers
My bad. I forgot gazebo_ros_utils in a line of my CMakeList
target_link_libraries(firstRobot_drive_plugin gazebo_ros_utils ${catkin_LIBRARIES} ${GAZEBO_LIBRARIES})
Everything works fine now.
Asked by F.Brosseau on 2016-01-13 08:11:25 UTC
Comments