void IMUCallback(sensor_msgs::Imu msg){
if(msg.orientation_covariance[0]<0)//若协方差矩阵第一个值为-1,表示数据不存在
return;
//用TF工具将四元数转化为欧拉角
tf::Quaternion quaternion(
msg.orientation.x,
msg.orientation.y,
msg.orientation.z,
msg.orientation.w,
);
double roll,pitch,yaw;
tf::Matrix3x3(quaternion).getRPY(roll,pitch,yaw);
/*弧度转为角度
roll=roll*180/M_PI;
*/
}
标签:获取,msg,IMU,TF,工具,ros From: https://www.cnblogs.com/Liubox/p/18061535