@@ -11,6 +11,7 @@ def factory(
11
11
num_segments : int ,
12
12
* args ,
13
13
segment_actuation_selector : Optional [Array ] = None ,
14
+ simplified_actuation_mapping : bool = False ,
14
15
** kwargs
15
16
):
16
17
"""
@@ -19,6 +20,7 @@ def factory(
19
20
num_segments: number of segments
20
21
segment_actuation_selector: actuation selector for the segments as boolean array of shape (num_segments,)
21
22
True entries signify that the segment is actuated, False entries signify that the segment is passive
23
+ simplified_actuation_mapping: flag to use a simplified actuation mapping (i.e., a constant actuation matrix)
22
24
Returns:
23
25
"""
24
26
if segment_actuation_selector is None :
@@ -102,22 +104,29 @@ def compute_actuation_matrix_for_segment(
102
104
2 / 3 * jnp .sinc (0.5 * varphi_cham ) * (r_cham_out ** 3 - r_cham_in ** 3 ) / (r_cham_out ** 2 - r_cham_in ** 2 )
103
105
)
104
106
105
- # compute the actuation matrix that collects the contributions of the pneumatic chambers in the given segment
106
- # first we consider the contribution of the distal end
107
- A_sm_de = J_de .T @ jnp .array ([
108
- [- 2 * A_cham * jnp .sin (th_de ), - 2 * A_cham * jnp .sin (th_de )],
109
- [2 * A_cham * jnp .cos (th_de ), 2 * A_cham * jnp .cos (th_de )],
110
- [A_cham * r_cop , - A_cham * r_cop ]
111
- ])
112
- # then, we consider the contribution of the proximal end
113
- A_sm_pe = J_pe .T @ jnp .array ([
114
- [2 * A_cham * jnp .sin (th_pe ), 2 * A_cham * jnp .sin (th_pe )],
115
- [- 2 * A_cham * jnp .cos (th_pe ), - 2 * A_cham * jnp .cos (th_pe )],
116
- [- A_cham * r_cop , A_cham * r_cop ]
117
- ])
118
-
119
- # sum the contributions of the distal and proximal ends
120
- A_sm = A_sm_de + A_sm_pe
107
+ if simplified_actuation_mapping :
108
+ A_sm = B_xi .T @ jnp .array ([
109
+ [A_cham * r_cop , - A_cham * r_cop ],
110
+ [0.0 , 0.0 ],
111
+ [2 * A_cham , 2 * A_cham ],
112
+ ])
113
+ else :
114
+ # compute the actuation matrix that collects the contributions of the pneumatic chambers in the given segment
115
+ # first we consider the contribution of the distal end
116
+ A_sm_de = J_de .T @ jnp .array ([
117
+ [- 2 * A_cham * jnp .sin (th_de ), - 2 * A_cham * jnp .sin (th_de )],
118
+ [2 * A_cham * jnp .cos (th_de ), 2 * A_cham * jnp .cos (th_de )],
119
+ [A_cham * r_cop , - A_cham * r_cop ]
120
+ ])
121
+ # then, we consider the contribution of the proximal end
122
+ A_sm_pe = J_pe .T @ jnp .array ([
123
+ [2 * A_cham * jnp .sin (th_pe ), 2 * A_cham * jnp .sin (th_pe )],
124
+ [- 2 * A_cham * jnp .cos (th_pe ), - 2 * A_cham * jnp .cos (th_pe )],
125
+ [- A_cham * r_cop , A_cham * r_cop ]
126
+ ])
127
+
128
+ # sum the contributions of the distal and proximal ends
129
+ A_sm = A_sm_de + A_sm_pe
121
130
122
131
return A_sm
123
132
@@ -173,18 +182,18 @@ def stiffness_fn(
173
182
B_xi: Strain basis matrix
174
183
formulate_in_strain_space: whether to formulate the elastic matrix in the strain space
175
184
Returns:
176
- K : elastic matrix of shape (n_q, n_q) if formulate_in_strain_space is False or (n_xi, n_xi) otherwise
185
+ S : elastic matrix of shape (n_q, n_q) if formulate_in_strain_space is False or (n_xi, n_xi) otherwise
177
186
"""
178
187
# stiffness matrix of shape (num_segments, 3, 3)
179
- S = vmap (
188
+ S_sms = vmap (
180
189
_compute_stiffness_matrix_for_segment
181
190
)(
182
191
params ["l" ], params ["r" ], params ["r_cham_in" ], params ["r_cham_out" ], params ["varphi_cham" ], params ["E" ]
183
192
)
184
- # we define the elastic matrix of shape (n_xi, n_xi) as K(xi) = K @ xi where K is equal to
185
- K = blk_diag (S )
193
+ # we define the elastic matrix of shape (n_xi, n_xi) as K(xi) = S @ xi where K is equal to
194
+ S = blk_diag (S_sms )
186
195
187
196
if not formulate_in_strain_space :
188
- K = B_xi .T @ K @ B_xi
197
+ S = B_xi .T @ S @ B_xi
189
198
190
- return K
199
+ return S
0 commit comments