Skip to content

Commit

Permalink
Refactor: Add forward_kinematics method.
Browse files Browse the repository at this point in the history
  • Loading branch information
mmurooka committed Dec 19, 2024
1 parent b139232 commit afcdc3f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions robo_manip_baselines/common/MotionManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def __init__(self, env):
self.joint_pos = self.env.unwrapped.init_qpos[
self.env.unwrapped.ik_arm_joint_ids
].copy()
pin.forwardKinematics(self.pin_model, self.pin_data, self.joint_pos)
self.forward_kinematics()
self._original_target_se3 = self.pin_data.oMi[
self.env.unwrapped.ik_eef_joint_id
].copy()
Expand All @@ -50,6 +50,9 @@ def reset(self):
self.env.unwrapped.gripper_action_idx
]

def forward_kinematics(self):
pin.forwardKinematics(self.pin_model, self.pin_data, self.joint_pos)

def inverse_kinematics(self):
"""Solve inverse kinematics."""
# https://gepettoweb.laas.fr/doc/stack-of-tasks/pinocchio/master/doxygen-html/md_doc_b-examples_d-inverse-kinematics.html
Expand All @@ -71,7 +74,7 @@ def inverse_kinematics(self):
)
)
self.joint_pos = pin.integrate(self.pin_model, self.joint_pos, delta_joint_pos)
pin.forwardKinematics(self.pin_model, self.pin_data, self.joint_pos)
self.forward_kinematics()

def set_relative_target_se3(self, delta_pos=None, delta_rpy=None):
"""Set the target pose of the end-effector relatively."""
Expand Down

0 comments on commit afcdc3f

Please sign in to comment.