solve dependencies problem

This commit is contained in:
2025-09-05 15:49:00 +08:00
parent 12a6b47969
commit 21fbd5a323
114 changed files with 11337 additions and 19 deletions

View File

@@ -0,0 +1,30 @@
""" Tools for data processing.
Author: chenxi-wang
"""
import numpy as np
from scipy.spatial.transform import Rotation as R
def pose_difference(pose1, pose2):
# 提取位置
position1 = pose1[:3, 3]
position2 = pose2[:3, 3]
# 计算位置的欧式距离
position_distance = np.linalg.norm(position1 - position2)
# 提取旋转矩阵
rotation1 = pose1[:3, :3]
rotation2 = pose2[:3, :3]
# 计算旋转矩阵的角度差
r1 = R.from_matrix(rotation1)
r2 = R.from_matrix(rotation2)
# 计算旋转差
relative_rotation = r1.inv() * r2
angle_difference = relative_rotation.magnitude()
return position_distance, np.degrees(angle_difference)