利用numpy和scipy,我们可以很容易根据欧拉角求出旋转矩阵,这里的旋转轴我们你理解成四元数里面的旋转轴
import numpy as np
import scipy.linalg as linalg
import math
#参数分别是旋转轴和旋转弧度值
def rotate_mat(self, axis, radian):
rot_matrix = linalg.expm(np.cross(np.eye(3), axis / linalg.norm(axis) * radian))
axis_x, axis_y, axis_z = [1,0,0],
1