can't call member without object?
i'm using ros kinetic.
In file included from /home/robot/youbot_catkin_ws/src/youbot-controller/src/localisation-component.cpp:1:0:
/home/robot/youbot_catkin_ws/src/youbot-controller/src/localisation-component.hpp: In member function ‘virtual void Localisation::updateHook()’:
/home/robot/youbot_catkin_ws/src/youbot-controller/src/localisation-component.hpp:37:80: error: cannot call member function ‘void KDL::Rotation::GetQuaternion(double&, double&, double&, double&) const’ without object
KDL::Rotation rot = KDL::Rotation::GetQuaternion(qu.x, qu.y, qu.z, qu.w);
^
youbot-controller/CMakeFiles/localisation-component.dir/build.make:62: recipe for target 'youbot-controller/CMakeFiles
/localisation-component.dir/src/localisation-component.cpp.o' failed
make[2]: *** [youbot-controller/CMakeFiles/localisation-component.dir/src/localisation-component.cpp.o] Error 1
CMakeFiles/Makefile2:407: 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
here is d source file:
#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::GetQuaternion(qu.x, qu.y, qu.z, qu.w);
//KDL::Vector v;
//pose.theta = rot.GetRotAngle(v);
//outpose.write(pose);
}
};
#endif