@@ -201,7 +201,9 @@ def solve_ik_via_jacobian(
201
201
self , position : Union [List [float ], np .ndarray ],
202
202
euler : Union [List [float ], np .ndarray ] = None ,
203
203
quaternion : Union [List [float ], np .ndarray ] = None ,
204
- relative_to : Object = None ) -> List [float ]:
204
+ relative_to : Object = None ,
205
+ locked_joints : List [int ] = None ,
206
+ ) -> List [float ]:
205
207
"""Solves an IK group and returns the calculated joint values.
206
208
207
209
This IK method performs a linearisation around the current robot
@@ -226,8 +228,15 @@ def solve_ik_via_jacobian(
226
228
elif quaternion is not None :
227
229
self ._ik_target .set_quaternion (quaternion , relative_to )
228
230
231
+ joints = self .joints
232
+ if locked_joints is not None and len (locked_joints ) > 0 :
233
+ joints = []
234
+ for idx , j in enumerate (self .joints ):
235
+ if idx not in locked_joints :
236
+ joints .append (j )
237
+
229
238
ik_result , joint_values = sim .simCheckIkGroup (
230
- self ._ik_group , [j .get_handle () for j in self . joints ])
239
+ self ._ik_group , [j .get_handle () for j in joints ])
231
240
if ik_result == sim .sim_ikresult_fail :
232
241
raise IKError ('IK failed. Perhaps the distance was between the tip '
233
242
' and target was too large.' )
0 commit comments