undefined reference to KDL::Rotation::Quaternion
I am using orocos toolchain 2.9, ros kinetic, ubunt u16.
CMakeFiles/localisation-component.dir/src/localisation-component.cpp.o: In function `Localisation::updateHook()':
localisation-component.cpp:(.text._ZN12Localisation10updateHookEv[_ZN12Localisation10updateHookEv]+0xd3): undefined reference to `KDL::Rotation::Quaternion(double, double, double, double)'
localisation-component.cpp:(.text._ZN12Localisation10updateHookEv[_ZN12Localisation10updateHookEv]+0xe6): undefined reference to `KDL::epsilon'
localisation-component.cpp:(.text._ZN12Localisation10updateHookEv[_ZN12Localisation10updateHookEv]+0x10b): undefined reference to `KDL::Rotation::GetRotAngle(KDL::Vector&, double) const'
collect2: error: ld returned 1 exit status
youbot-controller/CMakeFiles/localisation-component.dir/build.make:133: recipe for target '/home/robot/youbot_catkin_ws/devel/lib/orocos/gnulinux/youbot-controller/liblocalisation-component-gnulinux.so' failed
make[2]: *** [/home/robot/youbot_catkin_ws/devel/lib/orocos/gnulinux/youbot-controller/liblocalisation-component-gnulinux.so] Error 1
CMakeFiles/Makefile2:1273: recipe for target 'youbot-controller/CMakeFiles/localisation-component.dir/all' failed
make[1]: *** [youbot-controller/CMakeFiles/localisation-component.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j4 -l4" failed
My CmakeLists.txt file is:
cmake_minimum_required(VERSION 2.8.3)
project(youbot-controller)
### ROS Dependencies ###
# Find the RTT-ROS package (this transitively includes the Orocos CMake macros)
find_package(catkin REQUIRED COMPONENTS
rtt_ros
rtt_tf
# ADDITIONAL ROS PACKAGES
)
find_package(orocos_kdl)
find_package(kdl_parser)
include_directories(${catkin_INCLUDE_DIRS})
### Orocos Dependencies ###
# Note that orocos_use_package() does not need to be called for any dependency
# listed in the package.xml file
include_directories(${USE_OROCOS_INCLUDE_DIRS})
### Orocos Targets ###
orocos_component(localisation-component src/localisation-component.cpp)
target_link_libraries(localisation-component ${catkin_LIBRARIES} ${USE_OROCOS_LIBRARIES})
# orocos_library(my_library src/my_library.cpp)
# target_link_libraries(my_library ${catkin_LIBRARIES} ${USE_OROCOS_LIBRARIES})
# orocos_service(my_service src/my_service.cpp)
# target_link_libraries(my_service ${catkin_LIBRARIES} ${USE_OROCOS_LIBRARIES})
# orocos_plugin(my_plugin src/my_plugin.cpp)
# target_link_libraries(my_plugin ${catkin_LIBRARIES} ${USE_OROCOS_LIBRARIES})
# orocos_typekit(my_typekit src/my_typekit.cpp)
# target_link_libraries(my_typekit ${catkin_LIBRARIES} ${USE_OROCOS_LIBRARIES})
### 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
)
the src file is:
#ifndef OROCOS_LOCALISATION_COMPONENT_HPP
#define OROCOS_LOCALISATION_COMPONENT_HPP
#include <rtt/RTT.hpp>
#include <iostream>
#include <geometry_msgs/Pose2D.h>
#include <geometry_msgs/TransformStamped.h>
#include <kdl/frames.hpp>
class Localisation
: public RTT::TaskContext
{
geometry_msgs::TransformStamped tfs;
RTT::OutputPort<geometry_msgs::Pose2D> outpose;
public:
Localisation(std::string const& name)
: TaskContext(name, PreOperational)
{
addPort("pose", outpose).doc("Contains latest Youbot Pose.");
}
bool configureHook() {
/** Check in here that we can call rtt_tf */
return false;
}
void updateHook() {
try {
/* tfs = ...call rtt_tf and query the transform /odom to /base_footprint ... ; */
} catch (...) {
return;
}
geometry_msgs::Pose2D pose;
pose.x = tfs.transform.translation.x;
pose.y = tfs.transform.translation.y;
geometry_msgs::Quaternion qu = tfs.transform.rotation;
KDL::Rotation rot = KDL::Rotation::Quaternion(qu.x, qu.y, qu.z, qu.w);
KDL::Vector v;
pose.theta = rot.GetRotAngle(v);
outpose.write(pose);
}
};
#endif
So where do you link against
kdl_parser
libraries? Justfind_package(..)
ing that package is not enough.i tried like that also but still the same error. something problem with api version mismatch?
you tried what? As always: show what you did.
i've edited above question in CmakeLists.txt file. by adding find_package(orocos_kdl) find_package(kdl_parser) and target_link_libraries(localisation-component ${catkin_LIBRARIES} ${USE_OROCOS_LIBRARIES})
I'm not too familiar with what
${USE_OROCOS_LIBRARIES}
does exactly, but unless it automatically pulls in the libraries ofkdl_parser
andorocos_kdl
, I would expect to still see linker errors.Note also that this doesn't seem like a ROS question. At best one to ask of the OROCOS devs.