tf2Quaternion qtn; qtnsetRPY00pose-theta; tfstransformrotationx = qtngetX; tfstransformrotationy = qtngetY; tfstransformrotationz = qtngetZ; tfstransformrotationw = qtngetW; 注释
// 创建一个四元数对象qtn
tf2::Quaternion qtn;
// 设置四元数的欧拉角表示,其中pose->theta是绕Z轴的旋转角度
qtn.setRPY(0,0,pose->theta);
// 将四元数转换为ROS中的Quaternion消息类型,并将其赋值给变量tfs的transform.rotation
tfs.transform.rotation.x = qtn.getX();
tfs.transform.rotation.y = qtn.getY();
tfs.transform.rotation.z = qtn.getZ();
tfs.transform.rotation.w = qtn.getW();
原文地址: https://www.cveoy.top/t/topic/bqcN 著作权归作者所有。请勿转载和采集!