Skip to content

Commit 3067a41

Browse files
committed
Implement operational_space_selector into operational_space_dynamical_matrices_fn for planar pcs
1 parent 5a0a5f1 commit 3067a41

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/jsrm/systems/planar_pcs.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,7 @@ def operational_space_dynamical_matrices_fn(
404404
s: Array,
405405
B: Array,
406406
C: Array,
407+
operational_space_selector = jnp.array([True, True, True]),
407408
eps: float = 1e4 * global_eps,
408409
) -> Tuple[Array, Array, Array, Array, Array]:
409410
"""
@@ -417,6 +418,8 @@ def operational_space_dynamical_matrices_fn(
417418
s: point coordinate along the robot in the interval [0, L].
418419
B: inertia matrix in the generalized coordinates of shape (n_q, n_q)
419420
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.
420423
eps: small number to avoid singularities (e.g., division by zero)
421424
Returns:
422425
Lambda: inertia matrix in the operational space of shape (3, 3)
@@ -447,9 +450,9 @@ def operational_space_dynamical_matrices_fn(
447450
J_d = lax.switch(
448451
segment_idx, J_d_lambda_sms, *params_for_lambdify, *xi_epsed, *xi_d, s_segment
449452
).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
453456

454457
# inverse of the inertia matrix in the configuration space
455458
B_inv = jnp.linalg.inv(B)

0 commit comments

Comments
 (0)