博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

Embeding KDL within Gazebo plugin

Posted on 2020-05-08 22:09  惊鸿BoltLi  阅读(150)  评论(0编辑  收藏  举报
Embeding KDL within Gazebo plugin
原网页:https://community.gazebosim.org/t/embeding-kdl-within-gazebo-plugin/248 Help

chris-mt
Nov '18
For controlling a 6-d.f. robotic arm I need to make the inverse kinematics maths within a plugin. I installed KDL and Eigen2 and 3 but at runtime (I used an example source code taken from KDL org) I get an error message like, symbol not found -random letters-chain-random letters-. Questions: what kinematics library, most compatible with Gazebo’s plugins, should I use? How to install/link the kinematics library with Gazebo’s plugins?

created
Nov '18
last reply
7d
2
replies
164
views
3
users

nate
Nov '18
Sounds like you have a linking error. You should be able to use KDL with Gazebo. Chances are you just need to include the correct libraries in your CMake or Makefile.

1 YEAR LATER

AlessandroMelone

Hi @chris-mt (sorry for the late, i will answer for who could met the same problem), if u mean a message in the bash like this:
gzserver: symbol lookup error: /home/alessandro/ros_ws/devel/lib/libplugin_control_iiwa.so: undefined symbol: _ZN3KDL4TreeC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE

To be clear, I want to implement a gazebo plugin using ros, the file .cpp in ros use the KDL libraries.

How I fixed it
I fixed it with modifying the CMakeList that compile the plugin the command, in particular adding {catkin_LIBRARIES} to the istruction target_link_libraries. So I changed: target_link_libraries(plugin_ros_gazebo {GAZEBO_LIBRARIES} ${Boost_LIBRARIES})

to:

target_link_libraries(plugin_ros_gazebo ${GAZEBO_LIBRARIES} ${Boost_LIBRARIES} ${catkin_LIBRARIES})

Where plugin_ros_gazebo is the name of the executable .cpp that defines the plugin.

I think that is caused by the dependencies of KDL to Eigen, and Eigen is in catkin_LIBRARIES (but is just a hypothesis).

To be more accurate I past all my CMakeList.txt:

cmake_minimum_required(VERSION 2.8.3)
project(gazebo_plugin_iiwa)

include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
if(COMPILER_SUPPORTS_CXX11)
    set(CMAKE_CXX_FLAGS "-std=c++11")
elseif(COMPILER_SUPPORTS_CXX0X)
    set(CMAKE_CXX_FLAGS "-std=c++0x")
else()
    message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
endif()

find_package(catkin REQUIRED COMPONENTS 
  roscpp 
  gazebo_ros 
  

  geometry_msgs
  kdl_parser
  sensor_msgs
)