Skip to content

Commit

Permalink
Make Cross.vx_star compatible with batches
Browse files Browse the repository at this point in the history
  • Loading branch information
flferretti committed Nov 22, 2024
1 parent 1393a82 commit ff5752a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions src/jaxsim/math/cross.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ def vx(velocity_sixd: jtp.Vector) -> jtp.Matrix:
Raises:
ValueError: If the input vector does not have a size of 6.
"""
velocity_sixd = velocity_sixd.reshape(-1, 6)

v, ω = jnp.split(velocity_sixd, 2, axis=-1)
v, ω = jnp.split(velocity_sixd.reshape(-1, 6), 2, axis=-1)

v_cross = jnp.concatenate(
[
Expand Down Expand Up @@ -50,5 +49,5 @@ def vx_star(velocity_sixd: jtp.Vector) -> jtp.Matrix:
Raises:
ValueError: If the input vector does not have a size of 6.
"""
v_cross_star = -Cross.vx(velocity_sixd).T
v_cross_star = -Cross.vx(velocity_sixd).swapaxes(-1, -2)
return v_cross_star
2 changes: 1 addition & 1 deletion src/jaxsim/rbda/rnea.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def rnea(
# Force applied to the base link that produce the base acceleration w/o gravity.
f_0 = (
M[0] @ a[0]
+ Cross.vx_star(v[0]) @ M[0] @ v[0]
+ Cross.vx_star(v[0].squeeze()) @ M[0] @ v[0]
- W_X_B.T @ jnp.vstack(W_f[0])
)
f = f.at[0].set(f_0)
Expand Down

0 comments on commit ff5752a

Please sign in to comment.