1:欧拉角转为四元数:
p=tf.transformations.quaternion_from_euler(roll,pitch,yaw)
输入roll,pitch,yaw的绕x,y,z轴转动,及欧拉角(单位弧度)
输出为:p四元数,[x,y,z,w]列表形式
四元数转欧拉角
(r, p, y) =tf.transformations.euler_from_quaternion([msg.orientation.x, msg.orientation.y, msg.orientation.z, msg.orientation.w])
2.四元数转旋转矩阵:
matrix = tf.transformations.quaternion_matrix(q)
输入为:四元数q=[x,y,z,w]
输出为:3*3的旋转矩阵
3.旋转矩阵转四元数:
q2=tf.transformations.quaternion_from_matrix(matrix)
输入为:3*3的旋转矩阵
输出为:四元数q2=[x,y,z,w]
4.欧拉角转旋转矩阵:
matrix2 = tf.transformations.euler_matrix(roll,pitch,yaw)
输入为:roll,pitch,yaw的绕x,y,z轴转动度数
输出为:3*3的旋转矩阵
5.旋转矩阵转欧拉角:
(roll2,pitch2,yaw2) = tf.transformations.euler_from_matrix(matrix2)
输入为:3*3的旋转矩阵
输出为:roll,pitch,yaw的绕x,y,z轴转动度数
6.求两个姿态(四元数)的旋转:
q2=q0*q1,q2 = tf.transformations.quaternion_multiply(q0, q1)
输入为:q0变换前的四元数和q1变换的四元数
输出为:变换后的四元数
7.矩阵求逆:
T1=np.linalg.inv(T)
输入:矩阵T
输出:逆解
8.np.linalg.norm是 NumPy 库中的函数,用于计算向量或矩阵的范数。它可以用来计算向量的长度(Euclidean 范数)或矩阵的 Frobenius 范数。
输入:矩阵或向量
输出:范数