# 将translation和rotation转换为手眼矩阵
# 经验证,此程序可用
import numpy as np
from scipy.spatial.transform import Rotation
# Translation vector
translation = np.array([0.02111988839859031, -0.06686781041966289, 0.03838598336018828])
# Rotation quaternion
rotation_quaternion = np.array([-0.00176506715140691, 0.0016587793444772236, 0.38548107576385465, 0.922712562601145])
# Convert quaternion to rotation matrix
rotation = Rotation.from_quat(rotation_quaternion)
rotation_matrix = rotation.as_matrix()
# Construct hand-eye matrix
hand_eye_matrix = np.eye(4)
hand_eye_matrix[:3, :3] = rotation_matrix
hand_eye_matrix[:3, 3] = translation
print("Hand-Eye Matrix:")
print(hand_eye_matrix)
四元数转换为旋转平移矩阵
最新推荐文章于 2024-03-29 15:45:04 发布
本文介绍了如何使用Python的NumPy和SciPy库中的Rotation类,将三维平移(translation)和旋转(通过quaternion表示)转换为手眼矩阵(Hand-EyeMatrix),并展示了具体的代码实现过程。
摘要由CSDN通过智能技术生成