Skip to content

Commit 8d4a7b0

Browse files
committed
Continue working on compute_actuation_matrix_for_segment
1 parent 4d42ffd commit 8d4a7b0

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

src/jsrm/systems/pneumatic_planar_pcs.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,21 +72,35 @@ def actuation_mapping_fn(
7272
J_sms = vmap(jacobian_fn, in_axes=(None, None, 0))(params, q, sms)
7373

7474
def compute_actuation_matrix_for_segment(
75-
chi_sm: Array, J_sm: Array, xi: Array
75+
r_cham_in: Array, r_cham_out: Array, varphi_cham: Array,
76+
chi_pe: Array, chi_de: Array,
77+
J_pe: Array, J_de: Array, xi: Array
7678
) -> Array:
7779
"""
7880
Compute the actuation matrix for a single segment.
7981
Args:
80-
chi_sm: tip position of the segment
81-
J_sm: Jacobian of the segment
82+
r_cham_in: inner radius of each segment chamber
83+
r_cham_out: outer radius of each segment chamber
84+
varphi_cham: sector angle of each segment chamber
85+
chi_pe: pose of the proximal end (i.e., the base) of the segment as array of shape (3,)
86+
chi_de: pose of the distal end (i.e., the tip) of the segment as array of shape (3,)
87+
J_pe: Jacobian of the proximal end of the segment as array of shape (3, n_q)
88+
J_de: Jacobian of the distal end of the segment as array of shape (3, n_q)
8289
xi: strains of the segment
8390
Returns:
8491
A_sm: actuation matrix of shape (n_xi, 2)
8592
"""
93+
# rotation matrix from the robot base to the segment base
94+
R_pe = jnp.array([[jnp.cos(chi_pe[2]), -jnp.sin(chi_pe[2])], [jnp.sin(chi_pe[2]), jnp.cos(chi_pe[2])]])
95+
# rotation matrix from the robot base to the segment tip
96+
R_de = jnp.array([[jnp.cos(chi_de[2]), -jnp.sin(chi_de[2])], [jnp.sin(chi_de[2]), jnp.cos(chi_de[2])]])
97+
98+
8699
# compute the actuation matrix for a single segment
87100
A_sm = jnp.zeros((n_xi, 2))
88101
return A_sm
89102

103+
A_sms = vmap(compute_actuation_matrix_for_segment)(chi_sms, J_sms, xi)
90104

91105
A = jnp.zeros((n_xi, 2 * num_segments))
92106

0 commit comments

Comments
 (0)