https://blog.csdn.net/qq_45779334/article/details/115520925
#!/usr/bin/python
#coding=utf-8
from math import pi
from tf.transformations import quaternion_from_euler
from geometry_msgs.msg import Pose
# 创建位姿实例
pos = Pose()
# 角度转弧度
DE2RA = pi / 180
# RPY的单位是角度值
roll = 0
pitch = 0.0
yaw = 1
# RPY转四元素
q = quaternion_from_euler(roll * DE2RA, pitch * DE2RA, yaw * DE2RA)
print q