调用头文件
#include "tf/transform_datatypes.h"
tf::Quaternion orientation;//四元数
doule roll, pitch, yaw;
四元数转换为偏航角:
yaw=tf::getYaw(orientation);
欧拉角转换为四元数:
orientation=tf::createQuaternionMsgFromRollPitchYaw(roll,pitch,yaw);
偏航角转换为四元数:
orientation=tf::createQuaternionMsgFromYaw(yaw);