Closed daydayupcg137 closed 3 years ago
Assuming that your callback function is called pixhawk_pose_callback
, the code would be this:
void pixhawk_pose_callback(geometry_msgs::PoseStamped pose) {
tf::Quaternion q(pose.pose.orientation.x,
pose.pose.orientation.y,
pose.pose.orientation.z,
pose.pose.orientation.w);
double roll, pitch, yaw;
tf::Matrix3x3(q).getRPY(roll, pitch, yaw);
}
You would also need to define tf
as dependency and include this at the top:
#include <tf/transform_datatypes.h>