如下所示:
import numpy as npfrom autolab_core import RigidTransform# 写上用四元数表示的orientation和xyz表示的positionorientation = {'y': -0.6971278819736084, 'x': -0.716556549511624, 'z': -0.010016582945017661, 'w': 0.02142651612120239}position = {'y': -0.26022684372145516, 'x': 0.6453529828252734, 'z': 1.179122068068349}rotation_quaternion = np.asarray([orientation['w'], orientation['x'], orientation['y'], orientation['z']])translation = np.asarray([position['x'], position['y'], position['z']])# 这里用的是UC Berkeley的autolab_core,比较方便吧,当然可以自己写一个fuction来计算,计算公式在https:///latest/de/pose_formats.html?highlight=format以上这篇python将四元数变换为旋转矩阵的实例就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。