I need convert quaternion to euler
I have this code but not catkin make.
#include "ros/ros.h"
#include "std_msgs/String.h"
#include "tf/transform_datatypes.h"
void chatterCallback(const nav_msgs::Odometry::ConstPtr& msg)
{
tf::Quaternion q= msg-> pose.pose.orientation();
}
int main(int argc, char **argv)
{
tf::Matrix3x3 m(q);
double roll, pitch, yaw;
m.getRPY(roll, pitch, yaw);
std::cout << "Roll: " << roll << ", Pitch: " << pitch << ", Yaw: " << yaw << std::endl;
ros::init(argc, argv, "quaternionToEuler");
ros::NodeHandle n;
ros::Subscriber sub = n.subscribe("odometry/filtered", 1000, chatterCallback);
ros::spin();
return 0;
}
add a comment