Spaces:
Running
Running
File size: 767 Bytes
65da30d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
from reachy_mini.kinematics import AnalyticalKinematics
import numpy as np
def test_analytical_kinematics():
ak = AnalyticalKinematics()
pose = np.eye(4)
sol = ak.ik(pose)
assert sol is not None, "IK solution should be found"
fk_pose = ak.fk(sol, no_iterations=10)
assert np.allclose(fk_pose, pose, atol=1e-2), "FK should match the original pose"
def test_analytical_kinematics_with_yaw():
ak = AnalyticalKinematics()
pose = np.eye(4)
body_yaw = np.pi / 4 # 45 degrees
sol = ak.ik(pose, body_yaw=body_yaw)
assert sol is not None, "IK solution should be found with body yaw"
fk_pose = ak.fk(sol, no_iterations=10)
assert np.allclose(fk_pose, pose, atol=1e-2), "FK should match the original pose with body yaw" |