jaxsim 0.8.3.dev35__tar.gz → 0.8.3.dev38__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/PKG-INFO +1 -1
  2. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/_version.py +2 -2
  3. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/api/data.py +2 -0
  4. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/api/integrators.py +1 -2
  5. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/api/model.py +30 -6
  6. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/rbda/aba.py +4 -4
  7. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/rbda/crba.py +5 -1
  8. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/rbda/forward_kinematics.py +5 -12
  9. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/rbda/mass_inverse.py +4 -27
  10. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/rbda/rnea.py +5 -4
  11. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/tests/test_api_model_hw_parametrization.py +7 -1
  12. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/tests/test_automatic_differentiation.py +16 -4
  13. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/.devcontainer/Dockerfile +0 -0
  14. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/.devcontainer/devcontainer.json +0 -0
  15. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/.gitattributes +0 -0
  16. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/.github/CODEOWNERS +0 -0
  17. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/.github/dependabot.yml +0 -0
  18. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/.github/release.yml +0 -0
  19. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/.github/workflows/ci_cd.yml +0 -0
  20. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/.github/workflows/gpu_benchmark.yml +0 -0
  21. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/.github/workflows/pixi.yml +0 -0
  22. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/.github/workflows/read_the_docs.yml +0 -0
  23. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/.gitignore +0 -0
  24. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/.pre-commit-config.yaml +0 -0
  25. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/.readthedocs.yaml +0 -0
  26. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/CITATION.cff +0 -0
  27. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/CONTRIBUTING.md +0 -0
  28. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/LICENSE +0 -0
  29. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/README.md +0 -0
  30. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/docs/Makefile +0 -0
  31. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/docs/conf.py +0 -0
  32. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/docs/examples.rst +0 -0
  33. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/docs/guide/configuration.rst +0 -0
  34. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/docs/guide/install.rst +0 -0
  35. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/docs/index.rst +0 -0
  36. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/docs/make.bat +0 -0
  37. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/docs/modules/api.rst +0 -0
  38. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/docs/modules/math.rst +0 -0
  39. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/docs/modules/mujoco.rst +0 -0
  40. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/docs/modules/parsers.rst +0 -0
  41. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/docs/modules/rbda.rst +0 -0
  42. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/docs/modules/typing.rst +0 -0
  43. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/docs/modules/utils.rst +0 -0
  44. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/environment.yml +0 -0
  45. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/examples/.gitattributes +0 -0
  46. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/examples/.gitignore +0 -0
  47. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/examples/README.md +0 -0
  48. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/examples/assets/build_cartpole_urdf.py +0 -0
  49. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/examples/assets/cartpole.urdf +0 -0
  50. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/examples/jaxsim_as_multibody_dynamics_library.ipynb +0 -0
  51. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/examples/jaxsim_as_physics_engine.ipynb +0 -0
  52. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/examples/jaxsim_as_physics_engine_advanced.ipynb +0 -0
  53. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/examples/jaxsim_for_robot_controllers.ipynb +0 -0
  54. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/pixi.lock +0 -0
  55. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/pyproject.toml +0 -0
  56. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/__init__.py +0 -0
  57. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/api/__init__.py +0 -0
  58. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/api/actuation_model.py +0 -0
  59. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/api/com.py +0 -0
  60. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/api/common.py +0 -0
  61. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/api/contact.py +0 -0
  62. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/api/frame.py +0 -0
  63. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/api/joint.py +0 -0
  64. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/api/kin_dyn_parameters.py +0 -0
  65. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/api/link.py +0 -0
  66. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/api/ode.py +0 -0
  67. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/api/references.py +0 -0
  68. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/exceptions.py +0 -0
  69. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/logging.py +0 -0
  70. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/math/__init__.py +0 -0
  71. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/math/adjoint.py +0 -0
  72. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/math/cross.py +0 -0
  73. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/math/inertia.py +0 -0
  74. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/math/joint_model.py +0 -0
  75. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/math/quaternion.py +0 -0
  76. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/math/rotation.py +0 -0
  77. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/math/skew.py +0 -0
  78. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/math/transform.py +0 -0
  79. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/math/utils.py +0 -0
  80. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/mujoco/__init__.py +0 -0
  81. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/mujoco/__main__.py +0 -0
  82. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/mujoco/loaders.py +0 -0
  83. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/mujoco/model.py +0 -0
  84. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/mujoco/utils.py +0 -0
  85. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/mujoco/visualizer.py +0 -0
  86. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/parsers/__init__.py +0 -0
  87. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/parsers/descriptions/__init__.py +0 -0
  88. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/parsers/descriptions/collision.py +0 -0
  89. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/parsers/descriptions/joint.py +0 -0
  90. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/parsers/descriptions/link.py +0 -0
  91. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/parsers/descriptions/model.py +0 -0
  92. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/parsers/kinematic_graph.py +0 -0
  93. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/parsers/rod/__init__.py +0 -0
  94. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/parsers/rod/meshes.py +0 -0
  95. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/parsers/rod/parser.py +0 -0
  96. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/parsers/rod/utils.py +0 -0
  97. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/rbda/__init__.py +0 -0
  98. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/rbda/actuation/__init__.py +0 -0
  99. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/rbda/actuation/common.py +0 -0
  100. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/rbda/collidable_points.py +0 -0
  101. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/rbda/contacts/__init__.py +0 -0
  102. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/rbda/contacts/common.py +0 -0
  103. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/rbda/contacts/relaxed_rigid.py +0 -0
  104. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/rbda/contacts/rigid.py +0 -0
  105. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/rbda/contacts/soft.py +0 -0
  106. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/rbda/jacobian.py +0 -0
  107. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/rbda/kinematic_constraints.py +0 -0
  108. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/rbda/utils.py +0 -0
  109. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/terrain/__init__.py +0 -0
  110. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/terrain/terrain.py +0 -0
  111. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/typing.py +0 -0
  112. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/utils/__init__.py +0 -0
  113. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/utils/jaxsim_dataclass.py +0 -0
  114. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/utils/tracing.py +0 -0
  115. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/src/jaxsim/utils/wrappers.py +0 -0
  116. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/tests/__init__.py +0 -0
  117. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/tests/assets/4_bar_opened.urdf +0 -0
  118. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/tests/assets/double_pendulum.sdf +0 -0
  119. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/tests/conftest.py +0 -0
  120. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/tests/test_actuation.py +0 -0
  121. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/tests/test_api_com.py +0 -0
  122. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/tests/test_api_contact.py +0 -0
  123. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/tests/test_api_data.py +0 -0
  124. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/tests/test_api_frame.py +0 -0
  125. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/tests/test_api_joint.py +0 -0
  126. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/tests/test_api_link.py +0 -0
  127. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/tests/test_api_model.py +0 -0
  128. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/tests/test_benchmark.py +0 -0
  129. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/tests/test_exceptions.py +0 -0
  130. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/tests/test_meshes.py +0 -0
  131. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/tests/test_pytree.py +0 -0
  132. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/tests/test_simulations.py +0 -0
  133. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/tests/test_visualizer.py +0 -0
  134. {jaxsim-0.8.3.dev35 → jaxsim-0.8.3.dev38}/tests/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: jaxsim
3
- Version: 0.8.3.dev35
3
+ Version: 0.8.3.dev38
4
4
  Summary: A differentiable physics engine and multibody dynamics library for control and robot learning.
5
5
  Project-URL: Changelog, https://github.com/gbionics/jaxsim/releases
6
6
  Project-URL: Documentation, https://jaxsim.readthedocs.io
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
18
18
  commit_id: str | None
19
19
  __commit_id__: str | None
20
20
 
21
- __version__ = version = '0.8.3.dev35'
22
- __version_tuple__ = version_tuple = (0, 8, 3, 'dev35')
21
+ __version__ = version = '0.8.3.dev38'
22
+ __version_tuple__ = version_tuple = (0, 8, 3, 'dev38')
23
23
 
24
24
  __commit_id__ = commit_id = None
@@ -168,6 +168,7 @@ class JaxSimModelData(common.ModelDataWithVelocityRepresentation):
168
168
  base_linear_velocity_inertial=W_v_WB[0:3],
169
169
  base_angular_velocity_inertial=W_v_WB[3:6],
170
170
  joint_velocities=joint_velocities,
171
+ joint_transforms=joint_transforms,
171
172
  )
172
173
  )
173
174
 
@@ -489,6 +490,7 @@ class JaxSimModelData(common.ModelDataWithVelocityRepresentation):
489
490
  base_angular_velocity_inertial=jnp.atleast_2d(
490
491
  base_angular_velocity_inertial
491
492
  ),
493
+ joint_transforms=joint_transforms,
492
494
  )
493
495
 
494
496
  # Adjust the output shapes.
@@ -70,7 +70,6 @@ def semi_implicit_euler_integration(
70
70
  contact_state_derivative,
71
71
  )
72
72
 
73
- # TODO: Avoid double replace, e.g. by computing cached value here
74
73
  data = dataclasses.replace(
75
74
  data,
76
75
  _base_quaternion=W_Q_B,
@@ -82,7 +81,7 @@ def semi_implicit_euler_integration(
82
81
  contact_state=integrated_contact_state,
83
82
  )
84
83
 
85
- # Update the cached computations.
84
+ # Recompute kinematic caches for the new state.
86
85
  data = data.replace(model=model)
87
86
 
88
87
  return data
@@ -1345,6 +1345,7 @@ def forward_dynamics_aba(
1345
1345
  base_linear_velocity=W_v_WB[0:3],
1346
1346
  base_angular_velocity=W_v_WB[3:6],
1347
1347
  joint_velocities=ṡ,
1348
+ joint_transforms=data._joint_transforms,
1348
1349
  joint_forces=τ,
1349
1350
  link_forces=W_f_L,
1350
1351
  standard_gravity=model.gravity,
@@ -1522,6 +1523,7 @@ def forward_kinematics(model: JaxSimModel, data: js.data.JaxSimModelData) -> jtp
1522
1523
  joint_velocities=data.joint_velocities,
1523
1524
  base_linear_velocity_inertial=data._base_linear_velocity,
1524
1525
  base_angular_velocity_inertial=data._base_angular_velocity,
1526
+ joint_transforms=data._joint_transforms,
1525
1527
  )
1526
1528
 
1527
1529
  return W_H_LL
@@ -1611,9 +1613,7 @@ def free_floating_mass_matrix_inverse(
1611
1613
  """
1612
1614
  M_inv_body = jaxsim.rbda.mass_inverse(
1613
1615
  model=model,
1614
- base_position=data.base_position,
1615
- base_quaternion=data.base_orientation,
1616
- joint_positions=data.joint_positions,
1616
+ joint_transforms=data._joint_transforms,
1617
1617
  )
1618
1618
 
1619
1619
  match data.velocity_representation:
@@ -1878,6 +1878,7 @@ def inverse_dynamics(
1878
1878
  base_linear_acceleration=W_v̇_WB[0:3],
1879
1879
  base_angular_acceleration=W_v̇_WB[3:6],
1880
1880
  joint_accelerations=s̈,
1881
+ joint_transforms=data._joint_transforms,
1881
1882
  link_forces=W_f_L,
1882
1883
  standard_gravity=model.gravity,
1883
1884
  )
@@ -2273,9 +2274,8 @@ def link_bias_accelerations(
2273
2274
  # Compute the parent-to-child adjoints and the motion subspaces of the joints.
2274
2275
  # These transforms define the relative kinematics of the entire model, including
2275
2276
  # the base transform for both floating-base and fixed-base models.
2276
- i_X_λi = model.kin_dyn_parameters.joint_transforms(
2277
- joint_positions=data.joint_positions, base_transform=W_H_B
2278
- )
2277
+ # Ensure cached transforms stay on device when indexed with traced `i`.
2278
+ i_X_λi = jnp.asarray(data._joint_transforms)
2279
2279
 
2280
2280
  # Extract the joint motion subspaces.
2281
2281
  S = model.kin_dyn_parameters.motion_subspaces
@@ -2390,6 +2390,30 @@ def link_bias_accelerations(
2390
2390
  return O_v̇_WL
2391
2391
 
2392
2392
 
2393
+ @jax.jit
2394
+ def joint_transforms(
2395
+ model: JaxSimModel, joint_positions: jtp.VectorLike, base_transform: jtp.MatrixLike
2396
+ ) -> jtp.Array:
2397
+ r"""
2398
+ Return the transforms of the joints.
2399
+
2400
+ Args:
2401
+ model: The model to consider.
2402
+ joint_positions: The joint positions.
2403
+ base_transform: The homogeneous matrix defining the base pose.
2404
+
2405
+ Returns:
2406
+ The stacked transforms
2407
+ :math:`{}^{i} \mathbf{H}_{\lambda(i)}(s)`
2408
+ of each joint.
2409
+ """
2410
+
2411
+ return model.kin_dyn_parameters.joint_transforms(
2412
+ joint_positions=joint_positions,
2413
+ base_transform=base_transform,
2414
+ )
2415
+
2416
+
2393
2417
  # ======
2394
2418
  # Energy
2395
2419
  # ======
@@ -18,6 +18,7 @@ def aba(
18
18
  base_linear_velocity: jtp.VectorLike,
19
19
  base_angular_velocity: jtp.VectorLike,
20
20
  joint_velocities: jtp.VectorLike,
21
+ joint_transforms: jtp.MatrixLike,
21
22
  joint_forces: jtp.VectorLike | None = None,
22
23
  link_forces: jtp.MatrixLike | None = None,
23
24
  standard_gravity: jtp.FloatLike = STANDARD_GRAVITY,
@@ -35,6 +36,7 @@ def aba(
35
36
  base_angular_velocity:
36
37
  The angular velocity of the base link in inertial-fixed representation.
37
38
  joint_velocities: The velocities of the joints.
39
+ joint_transforms: The parent-to-child transforms of the joints.
38
40
  joint_forces: The forces applied to the joints.
39
41
  link_forces:
40
42
  The forces applied to the links expressed in the world frame.
@@ -85,12 +87,10 @@ def aba(
85
87
  W_X_B = W_H_B.adjoint()
86
88
  B_X_W = W_H_B.inverse().adjoint()
87
89
 
88
- # Compute the parent-to-child adjoints of the joints.
90
+ # Extract the parent-to-child adjoints of the joints.
89
91
  # These transforms define the relative kinematics of the entire model, including
90
92
  # the base transform for both floating-base and fixed-base models.
91
- i_X_λi = model.kin_dyn_parameters.joint_transforms(
92
- joint_positions=s, base_transform=W_H_B.as_matrix()
93
- )
93
+ i_X_λi = jnp.asarray(joint_transforms)
94
94
 
95
95
  # Extract the joint motion subspaces.
96
96
  S = model.kin_dyn_parameters.motion_subspaces
@@ -7,7 +7,11 @@ import jaxsim.typing as jtp
7
7
  from . import utils
8
8
 
9
9
 
10
- def crba(model: js.model.JaxSimModel, *, joint_positions: jtp.Vector) -> jtp.Matrix:
10
+ def crba(
11
+ model: js.model.JaxSimModel,
12
+ *,
13
+ joint_positions: jtp.Vector,
14
+ ) -> jtp.Matrix:
11
15
  """
12
16
  Compute the free-floating mass matrix using the Composite Rigid-Body Algorithm (CRBA).
13
17
 
@@ -1,6 +1,5 @@
1
1
  import jax
2
2
  import jax.numpy as jnp
3
- import jaxlie
4
3
 
5
4
  import jaxsim.api as js
6
5
  import jaxsim.typing as jtp
@@ -18,6 +17,7 @@ def forward_kinematics_model(
18
17
  base_linear_velocity_inertial: jtp.VectorLike,
19
18
  base_angular_velocity_inertial: jtp.VectorLike,
20
19
  joint_velocities: jtp.VectorLike,
20
+ joint_transforms: jtp.MatrixLike,
21
21
  ) -> jtp.Array:
22
22
  """
23
23
  Compute the forward kinematics.
@@ -30,12 +30,13 @@ def forward_kinematics_model(
30
30
  base_linear_velocity_inertial: The linear velocity of the base link in inertial-fixed representation.
31
31
  base_angular_velocity_inertial: The angular velocity of the base link in inertial-fixed representation.
32
32
  joint_velocities: The velocities of the joints.
33
+ joint_transforms: The parent-to-child transforms of the joints.
33
34
 
34
35
  Returns:
35
36
  A 3D array containing the SE(3) transforms of all links belonging to the model.
36
37
  """
37
38
 
38
- W_p_B, W_Q_B, s, W_v_WB, ṡ, _, _, _, _, _ = utils.process_inputs(
39
+ _, _, _, W_v_WB, ṡ, _, _, _, _, _ = utils.process_inputs(
39
40
  model=model,
40
41
  base_position=base_position,
41
42
  base_quaternion=base_quaternion,
@@ -49,18 +50,10 @@ def forward_kinematics_model(
49
50
  # Note: λ(0) must not be used, it's initialized to -1.
50
51
  λ = model.kin_dyn_parameters.parent_array
51
52
 
52
- # Compute the base transform.
53
- W_H_B = jaxlie.SE3.from_rotation_and_translation(
54
- rotation=jaxlie.SO3(wxyz=W_Q_B),
55
- translation=W_p_B,
56
- )
57
-
58
- # Compute the parent-to-child adjoints of the joints.
53
+ # Extract the parent-to-child adjoints of the joints.
59
54
  # These transforms define the relative kinematics of the entire model, including
60
55
  # the base transform for both floating-base and fixed-base models.
61
- i_X_λi = model.kin_dyn_parameters.joint_transforms(
62
- joint_positions=s, base_transform=W_H_B.as_matrix()
63
- )
56
+ i_X_λi = jnp.asarray(joint_transforms)
64
57
 
65
58
  # Allocate the buffer of transforms world -> link and initialize the base pose.
66
59
  W_X_i = jnp.zeros(shape=(model.number_of_links(), 6, 6))
@@ -1,19 +1,14 @@
1
1
  import jax
2
2
  import jax.numpy as jnp
3
- import jaxlie
4
3
 
5
4
  import jaxsim.api as js
6
5
  import jaxsim.typing as jtp
7
6
 
8
- from . import utils
9
-
10
7
 
11
8
  def mass_inverse(
12
9
  model: js.model.JaxSimModel,
13
10
  *,
14
- base_position: jtp.VectorLike,
15
- base_quaternion: jtp.VectorLike,
16
- joint_positions: jtp.VectorLike,
11
+ joint_transforms: jtp.MatrixLike,
17
12
  ) -> jtp.Matrix:
18
13
  """
19
14
  Compute the inverse of the mass matrix using an ABA-like algorithm.
@@ -21,21 +16,12 @@ def mass_inverse(
21
16
 
22
17
  Args:
23
18
  model: The model to consider.
24
- base_position: The position of the base link.
25
- base_quaternion: The orientation of the base link (w, x, y, z).
26
- joint_positions: The positions of the joints.
19
+ joint_transforms: The parent-to-child transforms of the joints.
27
20
 
28
21
  Returns:
29
22
  The inverse of the mass matrix.
30
23
  """
31
24
 
32
- W_p_B, W_Q_B, s, _, _, _, _, _, _, _ = utils.process_inputs(
33
- model=model,
34
- base_position=base_position,
35
- base_quaternion=base_quaternion,
36
- joint_positions=joint_positions,
37
- )
38
-
39
25
  # Get the 6D spatial inertia matrices of all links.
40
26
  I_A = js.model.link_spatial_inertia_matrices(model=model)
41
27
 
@@ -44,19 +30,10 @@ def mass_inverse(
44
30
  # λ[i] = parent link index for link i.
45
31
  λ = model.kin_dyn_parameters.parent_array
46
32
 
47
- # Compute the base transform.
48
- W_H_B = jaxlie.SE3.from_rotation_and_translation(
49
- rotation=jaxlie.SO3(wxyz=W_Q_B),
50
- translation=W_p_B,
51
- )
52
-
53
- # Compute the parent-to-child adjoints of the joints.
33
+ # Extract the parent-to-child adjoints of the joints.
54
34
  # These transforms define the relative kinematics of the entire model, including
55
35
  # the base transform for both floating-base and fixed-base models.
56
- i_X_λi = model.kin_dyn_parameters.joint_transforms(
57
- joint_positions=s,
58
- base_transform=W_H_B.as_matrix(),
59
- )
36
+ i_X_λi = jnp.asarray(joint_transforms)
60
37
 
61
38
  # Extract the joint motion subspaces.
62
39
  S = model.kin_dyn_parameters.motion_subspaces
@@ -21,6 +21,7 @@ def rnea(
21
21
  base_linear_acceleration: jtp.Vector | None = None,
22
22
  base_angular_acceleration: jtp.Vector | None = None,
23
23
  joint_accelerations: jtp.Vector | None = None,
24
+ joint_transforms: jtp.MatrixLike,
24
25
  link_forces: jtp.Matrix | None = None,
25
26
  standard_gravity: jtp.FloatLike = STANDARD_GRAVITY,
26
27
  ) -> tuple[jtp.Vector, jtp.Vector]:
@@ -42,6 +43,7 @@ def rnea(
42
43
  base_angular_acceleration:
43
44
  The angular acceleration of the base link in inertial-fixed representation.
44
45
  joint_accelerations: The accelerations of the joints.
46
+ joint_transforms: The parent-to-child transforms of the joints.
45
47
  link_forces:
46
48
  The forces applied to the links expressed in the world frame.
47
49
  standard_gravity: The standard gravity constant.
@@ -88,12 +90,11 @@ def rnea(
88
90
  W_X_B = W_H_B.adjoint()
89
91
  B_X_W = W_H_B.inverse().adjoint()
90
92
 
91
- # Compute the parent-to-child adjoints of the joints.
93
+ # Extract the parent-to-child adjoints of the joints.
92
94
  # These transforms define the relative kinematics of the entire model, including
93
95
  # the base transform for both floating-base and fixed-base models.
94
- i_X_λi = model.kin_dyn_parameters.joint_transforms(
95
- joint_positions=s, base_transform=W_H_B.as_matrix()
96
- )
96
+ # Ensure cached transforms are JAX arrays so they work with traced indices.
97
+ i_X_λi = jnp.asarray(joint_transforms)
97
98
 
98
99
  # Extract the joint motion subspaces.
99
100
  S = model.kin_dyn_parameters.motion_subspaces
@@ -360,8 +360,14 @@ def test_hw_parameters_optimization(jaxsim_model_garpez: js.model.JaxSimModel):
360
360
  model=model, scaling_factors=scaling_factors
361
361
  )
362
362
 
363
+ # Sync the data's cached kinematics (joint transforms, link transforms, …)
364
+ # with the updated model geometry before running any dynamics.
365
+ updated_data = data.replace(model=updated_model)
366
+
363
367
  # Compute forward kinematics for the link.
364
- W_H_L = js.model.forward_kinematics(model=updated_model, data=data)[link_idx]
368
+ W_H_L = js.model.forward_kinematics(model=updated_model, data=updated_data)[
369
+ link_idx
370
+ ]
365
371
 
366
372
  # Extract the height (z-axis position) of the link.
367
373
  link4_height = W_H_L[2, 3] # Assuming z-axis is the third row.
@@ -6,6 +6,7 @@ import numpy as np
6
6
  from jax.test_util import check_grads
7
7
 
8
8
  import jaxsim.api as js
9
+ import jaxsim.math
9
10
  import jaxsim.rbda
10
11
  import jaxsim.typing as jtp
11
12
  from jaxsim import VelRepr
@@ -83,6 +84,7 @@ def test_ad_aba(
83
84
  s = data.joint_positions
84
85
  W_v_WB = data.base_velocity
85
86
  ṡ = data.joint_velocities
87
+ i_X_λi = data._joint_transforms
86
88
 
87
89
  # Inputs.
88
90
  W_f_L = references.link_forces(model=model)
@@ -93,7 +95,7 @@ def test_ad_aba(
93
95
  # ====
94
96
 
95
97
  # Get a closure exposing only the parameters to be differentiated.
96
- aba = lambda W_p_B, W_Q_B, s, W_v_WB, ṡ, τ, W_f_L, g: jaxsim.rbda.aba(
98
+ aba = lambda W_p_B, W_Q_B, s, W_v_WB, ṡ, i_X_λi, τ, W_f_L, g: jaxsim.rbda.aba(
97
99
  model=model,
98
100
  base_position=W_p_B,
99
101
  base_quaternion=W_Q_B / jnp.linalg.norm(W_Q_B),
@@ -102,6 +104,7 @@ def test_ad_aba(
102
104
  base_angular_velocity=W_v_WB[3:6],
103
105
  joint_velocities=ṡ,
104
106
  joint_forces=τ,
107
+ joint_transforms=i_X_λi,
105
108
  link_forces=W_f_L,
106
109
  standard_gravity=g,
107
110
  )
@@ -109,7 +112,7 @@ def test_ad_aba(
109
112
  # Check derivatives against finite differences.
110
113
  check_grads(
111
114
  f=aba,
112
- args=(W_p_B, W_Q_B, s, W_v_WB, ṡ, τ, W_f_L, g),
115
+ args=(W_p_B, W_Q_B, s, W_v_WB, ṡ, i_X_λi, τ, W_f_L, g),
113
116
  order=AD_ORDER,
114
117
  modes=["rev", "fwd"],
115
118
  eps=ε,
@@ -137,6 +140,7 @@ def test_ad_rnea(
137
140
  s = data.joint_positions
138
141
  W_v_WB = data.base_velocity
139
142
  ṡ = data.joint_velocities
143
+ i_X_λi = data._joint_transforms
140
144
 
141
145
  # Inputs.
142
146
  W_f_L = references.link_forces(model=model)
@@ -150,7 +154,7 @@ def test_ad_rnea(
150
154
  s̈ = jax.random.uniform(subkey2, shape=(model.dofs(),), minval=-1)
151
155
 
152
156
  # Get a closure exposing only the parameters to be differentiated.
153
- rnea = lambda W_p_B, W_Q_B, s, W_v_WB, ṡ, W_v̇_WB, s̈, W_f_L, g: jaxsim.rbda.rnea(
157
+ rnea = lambda W_p_B, W_Q_B, s, W_v_WB, ṡ, W_v̇_WB, s̈, i_X_λi, W_f_L, g: jaxsim.rbda.rnea(
154
158
  model=model,
155
159
  base_position=W_p_B,
156
160
  base_quaternion=W_Q_B / jnp.linalg.norm(W_Q_B),
@@ -161,6 +165,7 @@ def test_ad_rnea(
161
165
  base_linear_acceleration=W_v̇_WB[0:3],
162
166
  base_angular_acceleration=W_v̇_WB[3:6],
163
167
  joint_accelerations=s̈,
168
+ joint_transforms=i_X_λi,
164
169
  link_forces=W_f_L,
165
170
  standard_gravity=g,
166
171
  )
@@ -168,7 +173,7 @@ def test_ad_rnea(
168
173
  # Check derivatives against finite differences.
169
174
  check_grads(
170
175
  f=rnea,
171
- args=(W_p_B, W_Q_B, s, W_v_WB, ṡ, W_v̇_WB, s̈, W_f_L, g),
176
+ args=(W_p_B, W_Q_B, s, W_v_WB, ṡ, W_v̇_WB, s̈, i_X_λi, W_f_L, g),
172
177
  order=AD_ORDER,
173
178
  modes=["rev", "fwd"],
174
179
  eps=ε,
@@ -240,6 +245,13 @@ def test_ad_fk(
240
245
  base_linear_velocity_inertial=W_v_lin,
241
246
  base_angular_velocity_inertial=W_v_ang,
242
247
  joint_velocities=ṡ,
248
+ joint_transforms=model.kin_dyn_parameters.joint_transforms(
249
+ joint_positions=s,
250
+ base_transform=jaxsim.math.Transform.from_quaternion_and_translation(
251
+ translation=W_p_B,
252
+ quaternion=W_Q_B / jnp.linalg.norm(W_Q_B),
253
+ ),
254
+ ),
243
255
  )
244
256
 
245
257
  # Check derivatives against finite differences.
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes