@@ -404,6 +404,7 @@ def operational_space_dynamical_matrices_fn(
404
404
s : Array ,
405
405
B : Array ,
406
406
C : Array ,
407
+ operational_space_selector = jnp .array ([True , True , True ]),
407
408
eps : float = 1e4 * global_eps ,
408
409
) -> Tuple [Array , Array , Array , Array , Array ]:
409
410
"""
@@ -417,6 +418,8 @@ def operational_space_dynamical_matrices_fn(
417
418
s: point coordinate along the robot in the interval [0, L].
418
419
B: inertia matrix in the generalized coordinates of shape (n_q, n_q)
419
420
C: coriolis matrix derived with Christoffer symbols in the generalized coordinates of shape (n_q, n_q)
421
+ operational_space_selector: boolean array of shape (3,) to select the operational space variables.
422
+ For examples, jnp.array([True, True, False]) selects only the positional components of the operational space.
420
423
eps: small number to avoid singularities (e.g., division by zero)
421
424
Returns:
422
425
Lambda: inertia matrix in the operational space of shape (3, 3)
@@ -447,9 +450,9 @@ def operational_space_dynamical_matrices_fn(
447
450
J_d = lax .switch (
448
451
segment_idx , J_d_lambda_sms , * params_for_lambdify , * xi_epsed , * xi_d , s_segment
449
452
).squeeze ()
450
- # apply the strain basis to the J and J_d
451
- J = J @ B_xi
452
- J_d = J_d @ B_xi
453
+ # apply the operational_space_selector and strain basis to the J and J_d
454
+ J = J [ operational_space_selector , :] @ B_xi
455
+ J_d = J_d [ operational_space_selector , :] @ B_xi
453
456
454
457
# inverse of the inertia matrix in the configuration space
455
458
B_inv = jnp .linalg .inv (B )
0 commit comments