0
$\begingroup$

Rosanswers logo

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>, 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 nodes
# add_dependencies(hello_rtt_ros_node hello_rtt_ros_generate_messages_cpp)

## Specify libraries to link a library or executable target against
target_link_libraries(kinematics
  ${catkin_LIBRARIES}
  ${orocos_kdl_LIBRARIES}
)

target_link_libraries(simarm
  ${catkin_LIBRARIES}
  ${orocos_kdl_LIBRARIES}
)

target_link_libraries(orocos-cartesian-gnulinux 
  ${catkin_LIBRARIES}
  ${orocos_kdl_LIBRARIES}
)

target_link_libraries(orocos-naxes-gnulinux 
  ${catkin_LIBRARIES}
  ${orocos_kdl_LIBRARIES}
)

target_link_libraries(kinematics 
  ${catkin_LIBRARIES}
  ${orocos_kdl_LIBRARIES}
)

target_link_libraries(jointlimiter 
  ${catkin_LIBRARIES}
  ${orocos_kdl_LIBRARIES}
)

target_link_libraries(wslimiter 
  ${catkin_LIBRARIES}
  ${orocos_kdl_LIBRARIES}
)

target_link_libraries(switch
  ${catkin_LIBRARIES}
  ${orocos_kdl_LIBRARIES}
  ${OROCOS-RTT_RTT-SCRIPTING_LIBRARY}
  
)

target_link_libraries(multipoint 
  ${catkin_LIBRARIES}
  ${orocos_kdl_LIBRARIES}
)

target_link_libraries(shapegens 
  ${catkin_LIBRARIES}
  ${orocos_kdl_LIBRARIES}
)

target_link_libraries(messagehandler 
  ${catkin_LIBRARIES}
  ${orocos_kdl_LIBRARIES}
)

target_link_libraries(twister 
  ${catkin_LIBRARIES}
  ${orocos_kdl_LIBRARIES}
)

target_link_libraries(twister_ros 
  ${catkin_LIBRARIES}
  ${orocos_kdl_LIBRARIES}
)

target_link_libraries(elmoarm2 
  ${catkin_LIBRARIES}
  ${orocos_kdl_LIBRARIES}
)

target_link_libraries(orocos-cartesiancontroller-gnulinux 
  ${catkin_LIBRARIES}
  ${orocos_kdl_LIBRARIES}
)

target_link_libraries(orocos-naxescontroller-gnulinux 
  ${catkin_LIBRARIES}
  ${orocos_kdl_LIBRARIES}
)

target_link_libraries(amcdrives 
  ${catkin_LIBRARIES}
  ${orocos_kdl_LIBRARIES}
)


#install(FILES 
#  example.launch 
#  example.ops 
#  DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})


### Orocos Package Exports and Install Targets ###

# Generate install targets for header files
orocos_install_headers(DIRECTORY include/${PROJECT_NAME})

# Export package information (replaces catkin_package() macro) 
orocos_generate_package(
  INCLUDE_DIRS include
  DEPENDS rtt_ros tf
)

I am using Indigo.


Originally posted by jdcarp on ROS Answers with karma: 18 on 2016-05-22

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Try add find_package(kdl_conversions).


Originally posted by Craig with karma: 78 on 2017-01-01

This answer was ACCEPTED on the original site

Post score: 1

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.