Ask Your Question
0

tf::poseKDLToMSG throwing errors

asked 2016-05-22 20:46:44 -0500

jdcarp gravatar image

I am trying to convert a KDL::Frame to a geometry_msgs::Pose so I can stream the original KDL::Frame data to ros topics using rtt_ros_integration. I can stream orocos ports to ros topics correctly when the ports have type <vector<double>>, however I need to stream ports that are of type <kdl::frame>.

First, I

#include <geometry_msgs/Pose.h>
#include <tf/tf.h>
#include <tf_conversions/tf_kdl.h>
#include <kdl_conversions/kdl_msg.h>     
#include <tf/transform_datatypes.h>
#include <tf/transform_listener.h>

Then, when I call tf::poseKDLToMSG in messagehandler.cpp I get the following error

undefined reference to `tf::poseKDLToMsg(KDL::Frame const&, geometry_msgs::Pose_<std::allocator<void> >&)'

At first I believed this to be a linker error, however I added tf to both my build and run dependencies in package.xml, and I added it to find_package() in my CMakeLists.txt and there is still the same error.

Here is the entirety of my CMakeLists.txt

cmake_minimum_required(VERSION 2.8.3)

project(dmu_base)

find_package(catkin REQUIRED COMPONENTS 
  roscpp
  tf
  rospy  
  libpcan
  sensor_msgs
  geometry_msgs
  std_msgs
  rtt_ros
  rtt_roscomm
  rtt_std_msgs
  rtt_std_srvs
  rtt_sensor_msgs
  rtt_geometry_msgs
  )

find_package( Eigen3 REQUIRED)
find_package(  orocos_kdl REQUIRED )
find_package(  OROCOS-RTT REQUIRED rtt-scripting )


###################################
## catkin specific configuration ##
###################################
## The catkin_package macro generates cmake config files for your package
## Declare things to be passed to dependent projects
## INCLUDE_DIRS: uncomment this if you package contains header files
## LIBRARIES: libraries you create in this project that dependent projects also need
## CATKIN_DEPENDS: catkin_packages dependent projects also need
## DEPENDS: system dependencies of this project that dependent projects also need

catkin_package(
#  INCLUDE_DIRS include
#  LIBRARIES hello_rtt_ros
#  CATKIN_DEPENDS ocl orocos_kdl rtt_ros rtt_sensor_msgs tf
#  DEPENDS system_lib
#CATKIN_DEPENDS rtt rtt_ros rtt_roscomm std_msgs sensor_msgs geometry_msgs rtt_sensor_msgs rtt_geometry_msgs eigen libpcan tf
#DEPENDS system_lib
)

###########
## Build ##
###########

## Specify additional locations of header files
## Your package locations should be listed before other locations
# include_directories(include)

include_directories(
  ${catkin_INCLUDE_DIRS}
  ${EIGEN3_INCLUDE_DIR}
  include
  include/dmu_base
)

include_directories(  ${USE_OROCOS_INCLUDE_DIRS}  )

## Declare a cpp library
# add_library(hello_rtt_ros
#   src/${PROJECT_NAME}/rtt_talker.cpp
# )

## Declare a cpp executable
#add_executable(rtt_talker src/rtt_talker.cpp)

#
# definitions
#
add_definitions(${EIGEN3_DEFINITIONS})

# for orocos components
add_definitions(-DRTT_COMPONENT)
add_definitions(-DOCL_DLL_EXPORT)
add_definitions(-DOCL_COMPONENT_ONLY)

add_definitions(-std=c++11)

# OROCOS COMPONENTS
# Declare an Orocos RTT component

# kinematics
orocos_component(kinematics src/kinematics.cpp)
#ADD_LIBRARY(kinematics SHARED src/kinematics.cpp)
#SET_TARGET_PROPERTIES(kinematics PROPERTIES COMPILE_FLAGS "-O2 -Wall -fPIC -DOROCOS_TARGET=gnulinux -DOCL_DLL_EXPORT -DOCL_COMPONENT_ONLY")

# simarm
orocos_component(simarm src/simarm.cpp)

orocos_component(simarm_naxes src/simarm_naxes.cpp)

orocos_component(jointlimiter src/jointlimiter.cpp)

orocos_component(messagehandler src/messagehandler.cpp)

orocos_component(logger src/logger.cpp)

orocos_component(wslimiter src/wslimiter.cpp)

orocos_component(switch src/switch.cpp)

orocos_component(elmoarm2 src/elmoarm2.cpp)

orocos_component(multipoint src/multipoint.cpp)

orocos_component(shapegens src/shapegens.cpp)

orocos_component(twister src/twister.cpp src/connection.cpp src/server.cpp)

orocos_component(twister_ros src/twister_ros.cpp )

orocos_component(udpinterface src/ethernet2.cpp src/connection.cpp src/server.cpp)

orocos_component(jointstream src/jointstream.cpp src/connection.cpp src/server.cpp)

orocos_component(orocos-cartesian-gnulinux src/CartesianGeneratorPos.cpp)

orocos_component(orocos-naxes-gnulinux src/nAxesGeneratorPos.cpp)

orocos_component(orocos-cartesiancontroller-gnulinux src/CartesianControllerPosVel.cpp)

orocos_component(orocos-naxescontroller-gnulinux src/nAxesControllerPosVel.cpp)

orocos_component(amcdrives src/amcdrives.cpp)







## Add cmake target dependencies of the executable/library
## as an example, message headers may need to be generated before ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2017-01-01 09:42:35 -0500

Craig gravatar image

Try add find_package(kdl_conversions).

edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-05-22 20:46:44 -0500

Seen: 173 times

Last updated: Jan 01 '17