pose current_pose; //得到的Pose
tf::StampedTransform tf_
tf_.setOrigin( tf::Vector3(current_pose.x, current_pose.y, current_pose.z) ); //设置平移
//欧拉角 -->>四元数
tf::Quaternion q;
q.setRPY(current_pose.roll, current_pose.pitch, current_pose.yaw);
tf_.setRotation(q); //TF 的transform 必须从四元数获取旋转信息
//四元数 -->> 欧拉角
tf::Quaternion quat;
tf::quaternionMsgToTF(odom.pose.pose.orientation, quat);
double roll, pitch, yaw; //定义存储r\p\y的容器
tf::Matrix3x3(quat).getRPY(roll, pitch, yaw);//进行转换
tf的四元素和欧拉角之间转换
最新推荐文章于 2023-05-20 23:57:38 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)