@@ -23,7 +23,6 @@ def __init__(
23
23
urdf_path : str ,
24
24
target_frame_name : str = "gripperframe" ,
25
25
joint_names : list [str ] = None ,
26
- orientation_weight : float = 0.01 ,
27
26
):
28
27
"""
29
28
Initialize placo-based kinematics solver.
@@ -32,7 +31,6 @@ def __init__(
32
31
urdf_path: Path to the robot URDF file
33
32
target_frame_name: Name of the end-effector frame in the URDF
34
33
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
36
34
"""
37
35
try :
38
36
import placo
@@ -54,9 +52,6 @@ def __init__(
54
52
# Initialize frame task for IK
55
53
self .tip_frame = self .solver .add_frame_task (self .target_frame_name , np .eye (4 ))
56
54
57
- # Set orientation weight
58
- self .orientation_weight = orientation_weight
59
-
60
55
def forward_kinematics (self , robot_pos_deg ):
61
56
"""
62
57
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):
81
76
# Get the transformation matrix
82
77
return self .robot .get_T_world_frame (self .target_frame_name )
83
78
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 ):
85
80
"""
86
81
Compute inverse kinematics using placo solver.
87
82
88
83
Args:
89
84
current_joint_pos: Current joint positions in degrees (used as initial guess)
90
85
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
91
88
92
89
Returns:
93
90
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):
104
101
self .tip_frame .T_world_frame = desired_ee_pose
105
102
106
103
# 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 )
108
105
109
106
# Solve IK
110
107
self .solver .solve (True )
0 commit comments