Skip to content

Commit

Permalink
minor fix in examples
Browse files Browse the repository at this point in the history
  • Loading branch information
simeon-ned committed Sep 3, 2024
1 parent a8e0c03 commit e414181
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions examples/03_pinocchio.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,6 @@ def casadi_sequential_evaluation(q_vals):

# Verify results
print("\nVerifying performance test results:")
casadi_results = np.array(casadi_sequential_evaluation(q_vals[:50]))[:,:,0]
jax_results = np.array(jax_fn_vectorized(jax_q_vals[:50]))[0,:,:,0]
print("First 50 results match:", np.allclose(casadi_results, jax_results, atol=1e-6))
casadi_results = np.array(casadi_sequential_evaluation(q_vals[:100]))[:,:,0]
jax_results = np.array(jax_fn_vectorized(jax_q_vals[:100]))[0,:,:,0]
print("First 100 results match:", np.allclose(casadi_results, jax_results, atol=1e-6))
10 changes: 5 additions & 5 deletions examples/04_mjx.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ def mjx_fk(joint_pos):

# Verify results
print("\nVerifying performance test results:")
casadi_results = np.array(casadi_sequential_evaluation(q_vals[:10]))[:,:,0]
jax_results = np.array(jax_fn_vectorized(jax_q_vals[:10]))[0,:,:,0]
mjx_results = np.array(mjx_fn_vectorized(mjx_q_vals[:10]))
print("First 10 JAX and Casadi results match:", np.allclose(casadi_results, jax_results, atol=1e-6))
print("First 10 MJX and Casadi results match:", np.allclose(casadi_results, mjx_results, atol=1e-6))
casadi_results = np.array(casadi_sequential_evaluation(q_vals[:100]))[:,:,0]
jax_results = np.array(jax_fn_vectorized(jax_q_vals[:100]))[0,:,:,0]
mjx_results = np.array(mjx_fn_vectorized(mjx_q_vals[:100]))
print("First 100 JAX and Casadi results match:", np.allclose(casadi_results, jax_results, atol=1e-6))
print("First 100 MJX and Casadi results match:", np.allclose(casadi_results, mjx_results, atol=1e-6))

0 comments on commit e414181

Please sign in to comment.