File tree Expand file tree Collapse file tree 3 files changed +8
-7
lines changed Expand file tree Collapse file tree 3 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -149,7 +149,7 @@ def collidable_point_dynamics(
149
149
# collidable point, and the corresponding material deformation rate.
150
150
# Note that the material deformation rate is always returned in the mixed frame
151
151
# C[W] = (W_p_C, [W]). This is convenient for integration purpose.
152
- W_f_Ci , CW_ṁ = jax .vmap (soft_contacts .compute_contact_forces )(
152
+ W_f_Ci , ( CW_ṁ ,) = jax .vmap (soft_contacts .compute_contact_forces )(
153
153
W_p_Ci , W_ṗ_Ci , data .state .contact .tangential_deformation
154
154
)
155
155
Original file line number Diff line number Diff line change @@ -158,7 +158,7 @@ def compute_contact_forces(
158
158
position : jtp .Vector ,
159
159
velocity : jtp .Vector ,
160
160
tangential_deformation : jtp .Vector ,
161
- ) -> tuple [jtp .Vector , jtp .Vector ]:
161
+ ) -> tuple [jtp .Vector , tuple [ jtp .Vector , None ] ]:
162
162
"""
163
163
Compute the contact forces and material deformation rate.
164
164
@@ -237,7 +237,7 @@ def with_no_friction():
237
237
# Compute lin-ang 6D forces (inertial representation)
238
238
W_f = W_Xf_CW @ CW_f
239
239
240
- return W_f , ṁ
240
+ return W_f , ( ṁ ,)
241
241
242
242
# =========================
243
243
# Compute tangential forces
@@ -255,7 +255,7 @@ def with_friction():
255
255
active_contact = pz < self .terrain .height (x = px , y = py )
256
256
257
257
def above_terrain ():
258
- return jnp .zeros (6 ), ṁ
258
+ return jnp .zeros (6 ), ( ṁ ,)
259
259
260
260
def below_terrain ():
261
261
# Decompose the velocity in normal and tangential components
@@ -311,9 +311,9 @@ def slipping_contact():
311
311
W_f = W_Xf_CW @ CW_f
312
312
313
313
# Return the 6D force in the world frame and the deformation derivative
314
- return W_f , ṁ
314
+ return W_f , ( ṁ ,)
315
315
316
- # (W_f, ṁ )
316
+ # (W_f, (ṁ,) )
317
317
return jax .lax .cond (
318
318
pred = active_contact ,
319
319
true_fun = lambda _ : below_terrain (),
Original file line number Diff line number Diff line change @@ -308,9 +308,10 @@ def close_over_inputs_and_parameters(
308
308
m : jtp .VectorLike ,
309
309
params : SoftContactsParams ,
310
310
) -> tuple [jtp .Vector , jtp .Vector ]:
311
- return SoftContacts (parameters = params ).compute_contact_forces (
311
+ W_f_Ci , ( CW_ṁ ,) = SoftContacts (parameters = params ).compute_contact_forces (
312
312
position = p , velocity = v , tangential_deformation = m
313
313
)
314
+ return W_f_Ci , CW_ṁ
314
315
315
316
# Check derivatives against finite differences.
316
317
check_grads (
You can’t perform that action at this time.
0 commit comments