Skip to content

Commit b23f823

Browse files
Removed orientation weight from configuration and added it as an argument in inverse kinematics
Co-authored-by: CarolinePascal <[email protected]>
1 parent cda1062 commit b23f823

File tree

3 files changed

+4
-11
lines changed

3 files changed

+4
-11
lines changed

lerobot/common/model/kinematics.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ def __init__(
2323
urdf_path: str,
2424
target_frame_name: str = "gripperframe",
2525
joint_names: list[str] = None,
26-
orientation_weight: float = 0.01,
2726
):
2827
"""
2928
Initialize placo-based kinematics solver.
@@ -32,7 +31,6 @@ def __init__(
3231
urdf_path: Path to the robot URDF file
3332
target_frame_name: Name of the end-effector frame in the URDF
3433
joint_names: List of joint names to use for the kinematics solver
35-
orientation_weight: Weight for orientation constraint in IK, set to 0.0 to only constrain position
3634
"""
3735
try:
3836
import placo
@@ -54,9 +52,6 @@ def __init__(
5452
# Initialize frame task for IK
5553
self.tip_frame = self.solver.add_frame_task(self.target_frame_name, np.eye(4))
5654

57-
# Set orientation weight
58-
self.orientation_weight = orientation_weight
59-
6055
def forward_kinematics(self, robot_pos_deg):
6156
"""
6257
Compute forward kinematics for given joint configuration given the target frame name in the constructor.
@@ -81,13 +76,15 @@ def forward_kinematics(self, robot_pos_deg):
8176
# Get the transformation matrix
8277
return self.robot.get_T_world_frame(self.target_frame_name)
8378

84-
def inverse_kinematics(self, current_joint_pos, desired_ee_pose):
79+
def inverse_kinematics(self, current_joint_pos, desired_ee_pose, position_weight=1.0, orientation_weight=0.01):
8580
"""
8681
Compute inverse kinematics using placo solver.
8782
8883
Args:
8984
current_joint_pos: Current joint positions in degrees (used as initial guess)
9085
desired_ee_pose: Target end-effector pose as a 4x4 transformation matrix
86+
position_weight: Weight for position constraint in IK
87+
orientation_weight: Weight for orientation constraint in IK, set to 0.0 to only constrain position
9188
9289
Returns:
9390
Joint positions in degrees that achieve the desired end-effector pose
@@ -104,7 +101,7 @@ def inverse_kinematics(self, current_joint_pos, desired_ee_pose):
104101
self.tip_frame.T_world_frame = desired_ee_pose
105102

106103
# Configure the task based on position_only flag
107-
self.tip_frame.configure(self.target_frame_name, "soft", 1.0, self.orientation_weight)
104+
self.tip_frame.configure(self.target_frame_name, "soft", position_weight, orientation_weight)
108105

109106
# Solve IK
110107
self.solver.solve(True)

lerobot/common/robots/so100_follower/config_so100_follower.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,6 @@ class SO100FollowerEndEffectorConfig(SO100FollowerConfig):
5050
# End-effector frame name in the URDF
5151
target_frame_name: str = "gripperframe"
5252

53-
# Weight for orientation constraint in IK
54-
orientation_weight: float = 0.01
55-
5653
# Default bounds for the end-effector position (in meters)
5754
end_effector_bounds: dict[str, list[float]] = field(
5855
default_factory=lambda: {

lerobot/common/robots/so100_follower/so100_follower_end_effector.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ def __init__(self, config: SO100FollowerEndEffectorConfig):
7272
self.kinematics = RobotKinematics(
7373
urdf_path=self.config.urdf_path,
7474
target_frame_name=self.config.target_frame_name,
75-
orientation_weight=self.config.orientation_weight,
7675
)
7776

7877
# Store the bounds for end-effector position

0 commit comments

Comments
 (0)