jaxsim 0.5.1.dev46__tar.gz → 0.5.1.dev56__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 (133) hide show
  1. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/PKG-INFO +1 -1
  2. jaxsim-0.5.1.dev56/pixi.lock +3 -0
  3. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/_version.py +2 -2
  4. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/api/model.py +3 -1
  5. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/api/ode_data.py +3 -217
  6. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/api/references.py +41 -41
  7. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/rbda/contacts/visco_elastic.py +1 -1
  8. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim.egg-info/PKG-INFO +1 -1
  9. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/tests/test_api_model.py +1 -1
  10. jaxsim-0.5.1.dev46/pixi.lock +0 -3
  11. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/.devcontainer/Dockerfile +0 -0
  12. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/.devcontainer/devcontainer.json +0 -0
  13. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/.gitattributes +0 -0
  14. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/.github/CODEOWNERS +0 -0
  15. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/.github/dependabot.yml +0 -0
  16. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/.github/workflows/ci_cd.yml +0 -0
  17. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/.github/workflows/pixi.yml +0 -0
  18. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/.github/workflows/read_the_docs.yml +0 -0
  19. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/.gitignore +0 -0
  20. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/.pre-commit-config.yaml +0 -0
  21. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/.readthedocs.yaml +0 -0
  22. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/CONTRIBUTING.md +0 -0
  23. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/LICENSE +0 -0
  24. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/README.md +0 -0
  25. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/docs/Makefile +0 -0
  26. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/docs/conf.py +0 -0
  27. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/docs/examples.rst +0 -0
  28. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/docs/guide/install.rst +0 -0
  29. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/docs/index.rst +0 -0
  30. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/docs/make.bat +0 -0
  31. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/docs/modules/api.rst +0 -0
  32. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/docs/modules/integrators.rst +0 -0
  33. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/docs/modules/math.rst +0 -0
  34. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/docs/modules/mujoco.rst +0 -0
  35. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/docs/modules/parsers.rst +0 -0
  36. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/docs/modules/rbda.rst +0 -0
  37. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/docs/modules/typing.rst +0 -0
  38. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/docs/modules/utils.rst +0 -0
  39. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/environment.yml +0 -0
  40. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/examples/.gitattributes +0 -0
  41. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/examples/.gitignore +0 -0
  42. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/examples/README.md +0 -0
  43. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/examples/assets/build_cartpole_urdf.py +0 -0
  44. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/examples/assets/cartpole.urdf +0 -0
  45. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/examples/jaxsim_as_multibody_dynamics_library.ipynb +0 -0
  46. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/examples/jaxsim_as_physics_engine.ipynb +0 -0
  47. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/examples/jaxsim_for_robot_controllers.ipynb +0 -0
  48. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/pyproject.toml +0 -0
  49. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/setup.cfg +0 -0
  50. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/setup.py +0 -0
  51. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/__init__.py +0 -0
  52. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/api/__init__.py +0 -0
  53. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/api/com.py +0 -0
  54. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/api/common.py +0 -0
  55. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/api/contact.py +0 -0
  56. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/api/data.py +0 -0
  57. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/api/frame.py +0 -0
  58. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/api/joint.py +0 -0
  59. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/api/kin_dyn_parameters.py +0 -0
  60. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/api/link.py +0 -0
  61. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/api/ode.py +0 -0
  62. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/exceptions.py +0 -0
  63. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/integrators/__init__.py +0 -0
  64. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/integrators/common.py +0 -0
  65. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/integrators/fixed_step.py +0 -0
  66. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/integrators/variable_step.py +0 -0
  67. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/logging.py +0 -0
  68. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/math/__init__.py +0 -0
  69. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/math/adjoint.py +0 -0
  70. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/math/cross.py +0 -0
  71. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/math/inertia.py +0 -0
  72. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/math/joint_model.py +0 -0
  73. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/math/quaternion.py +0 -0
  74. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/math/rotation.py +0 -0
  75. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/math/skew.py +0 -0
  76. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/math/transform.py +0 -0
  77. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/mujoco/__init__.py +0 -0
  78. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/mujoco/__main__.py +0 -0
  79. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/mujoco/loaders.py +0 -0
  80. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/mujoco/model.py +0 -0
  81. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/mujoco/utils.py +0 -0
  82. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/mujoco/visualizer.py +0 -0
  83. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/parsers/__init__.py +0 -0
  84. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/parsers/descriptions/__init__.py +0 -0
  85. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/parsers/descriptions/collision.py +0 -0
  86. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/parsers/descriptions/joint.py +0 -0
  87. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/parsers/descriptions/link.py +0 -0
  88. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/parsers/descriptions/model.py +0 -0
  89. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/parsers/kinematic_graph.py +0 -0
  90. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/parsers/rod/__init__.py +0 -0
  91. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/parsers/rod/meshes.py +0 -0
  92. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/parsers/rod/parser.py +0 -0
  93. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/parsers/rod/utils.py +0 -0
  94. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/rbda/__init__.py +0 -0
  95. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/rbda/aba.py +0 -0
  96. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/rbda/collidable_points.py +0 -0
  97. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/rbda/contacts/__init__.py +0 -0
  98. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/rbda/contacts/common.py +0 -0
  99. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/rbda/contacts/relaxed_rigid.py +0 -0
  100. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/rbda/contacts/rigid.py +0 -0
  101. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/rbda/contacts/soft.py +0 -0
  102. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/rbda/crba.py +0 -0
  103. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/rbda/forward_kinematics.py +0 -0
  104. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/rbda/jacobian.py +0 -0
  105. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/rbda/rnea.py +0 -0
  106. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/rbda/utils.py +0 -0
  107. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/terrain/__init__.py +0 -0
  108. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/terrain/terrain.py +0 -0
  109. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/typing.py +0 -0
  110. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/utils/__init__.py +0 -0
  111. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/utils/jaxsim_dataclass.py +0 -0
  112. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/utils/tracing.py +0 -0
  113. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim/utils/wrappers.py +0 -0
  114. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim.egg-info/SOURCES.txt +0 -0
  115. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim.egg-info/dependency_links.txt +0 -0
  116. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim.egg-info/requires.txt +0 -0
  117. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/src/jaxsim.egg-info/top_level.txt +0 -0
  118. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/tests/__init__.py +0 -0
  119. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/tests/conftest.py +0 -0
  120. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/tests/test_api_com.py +0 -0
  121. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/tests/test_api_contact.py +0 -0
  122. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/tests/test_api_data.py +0 -0
  123. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/tests/test_api_frame.py +0 -0
  124. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/tests/test_api_joint.py +0 -0
  125. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/tests/test_api_link.py +0 -0
  126. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/tests/test_automatic_differentiation.py +0 -0
  127. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/tests/test_benchmark.py +0 -0
  128. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/tests/test_contact.py +0 -0
  129. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/tests/test_exceptions.py +0 -0
  130. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/tests/test_meshes.py +0 -0
  131. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/tests/test_pytree.py +0 -0
  132. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/tests/test_simulations.py +0 -0
  133. {jaxsim-0.5.1.dev46 → jaxsim-0.5.1.dev56}/tests/utils_idyntree.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: jaxsim
3
- Version: 0.5.1.dev46
3
+ Version: 0.5.1.dev56
4
4
  Summary: A differentiable physics engine and multibody dynamics library for control and robot learning.
5
5
  Author-email: Diego Ferigo <dgferigo@gmail.com>, Filippo Luca Ferretti <filippoluca.ferretti@outlook.com>
6
6
  Maintainer-email: Filippo Luca Ferretti <filippo.ferretti@iit.it>, Alessandro Croci <alessandro.croci@iit.it>
@@ -0,0 +1,3 @@
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1516589d06af0d8a12e957d5fe907fee86117145d900c07f8fd99cbbb494b07f
3
+ size 617307
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '0.5.1.dev46'
16
- __version_tuple__ = version_tuple = (0, 5, 1, 'dev46')
15
+ __version__ = version = '0.5.1.dev56'
16
+ __version_tuple__ = version_tuple = (0, 5, 1, 'dev56')
@@ -2198,7 +2198,9 @@ def step(
2198
2198
  isinstance(model.contact_model, jaxsim.rbda.contacts.ViscoElasticContacts)
2199
2199
  & (
2200
2200
  ~jnp.allclose(dt, model.time_step)
2201
- | ~isinstance(integrator, jaxsim.integrators.fixed_step.ForwardEuler)
2201
+ | ~int(
2202
+ isinstance(integrator, jaxsim.integrators.fixed_step.ForwardEuler)
2203
+ )
2202
2204
  )
2203
2205
  ),
2204
2206
  msg=msg.format(module, name),
@@ -10,108 +10,14 @@ import jaxsim.api as js
10
10
  import jaxsim.typing as jtp
11
11
  from jaxsim.utils import JaxsimDataclass
12
12
 
13
- # =============================================================================
14
- # Define the input and state of the ODE system defining the integrated dynamics
15
- # =============================================================================
13
+ # ===================================================================
14
+ # Define the state of the ODE system defining the integrated dynamics
15
+ # ===================================================================
16
16
 
17
17
  # Note: the ODE system is the combination of the floating-base dynamics and the
18
18
  # soft-contacts dynamics.
19
19
 
20
20
 
21
- @jax_dataclasses.pytree_dataclass
22
- class ODEInput(JaxsimDataclass):
23
- """
24
- The input to the ODE system.
25
-
26
- Attributes:
27
- physics_model: The input to the physics model.
28
- """
29
-
30
- physics_model: PhysicsModelInput
31
-
32
- @staticmethod
33
- def build_from_jaxsim_model(
34
- model: js.model.JaxSimModel | None = None,
35
- link_forces: jtp.MatrixLike | None = None,
36
- joint_force_references: jtp.VectorLike | None = None,
37
- ) -> ODEInput:
38
- """
39
- Build an `ODEInput` from a `JaxSimModel`.
40
-
41
- Args:
42
- model: The `JaxSimModel` associated with the ODE input.
43
- link_forces: The matrix of external forces applied to the links.
44
- joint_force_references: The vector of joint force references.
45
-
46
- Returns:
47
- The `ODEInput` built from the `JaxSimModel`.
48
-
49
- Note:
50
- If any of the input components are not provided, they are built from the
51
- `JaxSimModel` and initialized to zero.
52
- """
53
-
54
- return ODEInput.build(
55
- physics_model_input=PhysicsModelInput.build_from_jaxsim_model(
56
- model=model,
57
- link_forces=link_forces,
58
- joint_force_references=joint_force_references,
59
- ),
60
- model=model,
61
- )
62
-
63
- @staticmethod
64
- def build(
65
- physics_model_input: PhysicsModelInput | None = None,
66
- model: js.model.JaxSimModel | None = None,
67
- ) -> ODEInput:
68
- """
69
- Build an `ODEInput` from a `PhysicsModelInput`.
70
-
71
- Args:
72
- physics_model_input: The `PhysicsModelInput` associated with the ODE input.
73
- model: The `JaxSimModel` associated with the ODE input.
74
-
75
- Returns:
76
- A `ODEInput` instance.
77
- """
78
-
79
- physics_model_input = (
80
- physics_model_input
81
- if physics_model_input is not None
82
- else PhysicsModelInput.zero(model=model)
83
- )
84
-
85
- return ODEInput(physics_model=physics_model_input)
86
-
87
- @staticmethod
88
- def zero(model: js.model.JaxSimModel) -> ODEInput:
89
- """
90
- Build a zero `ODEInput` from a `JaxSimModel`.
91
-
92
- Args:
93
- model: The `JaxSimModel` associated with the ODE input.
94
-
95
- Returns:
96
- A zero `ODEInput` instance.
97
- """
98
-
99
- return ODEInput.build(model=model)
100
-
101
- def valid(self, model: js.model.JaxSimModel) -> bool:
102
- """
103
- Check if the `ODEInput` is valid for a given `JaxSimModel`.
104
-
105
- Args:
106
- model: The `JaxSimModel` to validate the `ODEInput` against.
107
-
108
- Returns:
109
- `True` if the ODE input is valid for the given model, `False` otherwise.
110
- """
111
-
112
- return self.physics_model.valid(model=model)
113
-
114
-
115
21
  @jax_dataclasses.pytree_dataclass
116
22
  class ODEState(JaxsimDataclass):
117
23
  """
@@ -493,123 +399,3 @@ class PhysicsModelState(JaxsimDataclass):
493
399
  return False
494
400
 
495
401
  return True
496
-
497
-
498
- @jax_dataclasses.pytree_dataclass
499
- class PhysicsModelInput(JaxsimDataclass):
500
- """
501
- Class storing the inputs of the physics model dynamics.
502
-
503
- Attributes:
504
- tau: The vector of joint forces.
505
- f_ext: The matrix of external forces applied to the links.
506
- """
507
-
508
- tau: jtp.Vector
509
- f_ext: jtp.Matrix
510
-
511
- @staticmethod
512
- def build_from_jaxsim_model(
513
- model: js.model.JaxSimModel | None = None,
514
- link_forces: jtp.MatrixLike | None = None,
515
- joint_force_references: jtp.VectorLike | None = None,
516
- ) -> PhysicsModelInput:
517
- """
518
- Build a `PhysicsModelInput` from a `JaxSimModel`.
519
-
520
- Args:
521
- model: The `JaxSimModel` associated with the input.
522
- link_forces: The matrix of external forces applied to the links.
523
- joint_force_references: The vector of joint force references.
524
-
525
- Returns:
526
- A `PhysicsModelInput` instance.
527
-
528
- Note:
529
- If any of the input components are not provided, they are built from the
530
- `JaxSimModel` and initialized to zero.
531
- """
532
-
533
- return PhysicsModelInput.build(
534
- joint_force_references=joint_force_references,
535
- link_forces=link_forces,
536
- number_of_dofs=model.dofs(),
537
- number_of_links=model.number_of_links(),
538
- )
539
-
540
- @staticmethod
541
- def build(
542
- link_forces: jtp.MatrixLike | None = None,
543
- joint_force_references: jtp.VectorLike | None = None,
544
- number_of_dofs: jtp.Int | None = None,
545
- number_of_links: jtp.Int | None = None,
546
- ) -> PhysicsModelInput:
547
- """
548
- Build a `PhysicsModelInput`.
549
-
550
- Args:
551
- link_forces: The matrix of external forces applied to the links.
552
- joint_force_references: The vector of joint force references.
553
- number_of_dofs: The number of degrees of freedom of the model.
554
- number_of_links: The number of links of the model.
555
-
556
- Returns:
557
- A `PhysicsModelInput` instance.
558
- """
559
-
560
- joint_force_references = jnp.atleast_1d(
561
- jnp.array(joint_force_references, dtype=float).squeeze()
562
- if joint_force_references is not None
563
- else jnp.zeros(number_of_dofs)
564
- ).astype(float)
565
-
566
- link_forces = jnp.atleast_2d(
567
- jnp.array(link_forces, dtype=float).squeeze()
568
- if link_forces is not None
569
- else jnp.zeros(shape=(number_of_links, 6))
570
- ).astype(float)
571
-
572
- return PhysicsModelInput(
573
- tau=joint_force_references,
574
- f_ext=link_forces,
575
- )
576
-
577
- @staticmethod
578
- def zero(model: js.model.JaxSimModel) -> PhysicsModelInput:
579
- """
580
- Build a `PhysicsModelInput` with all components initialized to zero.
581
-
582
- Args:
583
- model: The `JaxSimModel` associated with the input.
584
-
585
- Returns:
586
- A `PhysicsModelInput` instance.
587
- """
588
-
589
- return PhysicsModelInput.build_from_jaxsim_model(model=model)
590
-
591
- def valid(self, model: js.model.JaxSimModel) -> bool:
592
- """
593
- Check if the `PhysicsModelInput` is valid for a given `JaxSimModel`.
594
-
595
- Args:
596
- model: The `JaxSimModel` to validate the `PhysicsModelInput` against.
597
-
598
- Returns:
599
- `True` if the `PhysicsModelInput` is valid for the given model,
600
- `False` otherwise.
601
- """
602
-
603
- shape = self.tau.shape
604
- expected_shape = (model.dofs(),)
605
-
606
- if shape != expected_shape:
607
- return False
608
-
609
- shape = self.f_ext.shape
610
- expected_shape = (model.number_of_links(), 6)
611
-
612
- if shape != expected_shape:
613
- return False
614
-
615
- return True
@@ -12,7 +12,6 @@ from jaxsim import exceptions
12
12
  from jaxsim.utils.tracing import not_tracing
13
13
 
14
14
  from .common import VelRepr
15
- from .ode_data import ODEInput
16
15
 
17
16
  try:
18
17
  from typing import Self
@@ -24,9 +23,14 @@ except ImportError:
24
23
  class JaxSimModelReferences(js.common.ModelDataWithVelocityRepresentation):
25
24
  """
26
25
  Class containing the references for a `JaxSimModel` object.
26
+
27
+ Attributes:
28
+ _link_forces: The link 6D forces in inertial-fixed representation.
29
+ _joint_force_references: The joint force references.
27
30
  """
28
31
 
29
- input: ODEInput
32
+ _link_forces: jtp.Matrix
33
+ _joint_force_references: jtp.Vector
30
34
 
31
35
  @staticmethod
32
36
  def zero(
@@ -94,17 +98,21 @@ class JaxSimModelReferences(js.common.ModelDataWithVelocityRepresentation):
94
98
  velocity_representation = (
95
99
  velocity_representation
96
100
  if velocity_representation is not None
97
- else (
98
- data.velocity_representation if data is not None else VelRepr.Inertial
99
- )
101
+ else getattr(data, "velocity_representation", VelRepr.Inertial)
100
102
  )
101
103
 
102
104
  # Create a zero references object.
103
105
  references = JaxSimModelReferences(
104
- input=ODEInput.zero(model=model),
106
+ _link_forces=f_L,
107
+ _joint_force_references=joint_force_references,
105
108
  velocity_representation=velocity_representation,
106
109
  )
107
110
 
111
+ # If the velocity representation is inertial-fixed, we can return
112
+ # the references directly, as we store the link forces in this frame.
113
+ if velocity_representation is VelRepr.Inertial:
114
+ return references
115
+
108
116
  # Store the joint force references.
109
117
  references = references.set_joint_force_references(
110
118
  forces=joint_force_references,
@@ -135,12 +143,22 @@ class JaxSimModelReferences(js.common.ModelDataWithVelocityRepresentation):
135
143
  `False` otherwise.
136
144
  """
137
145
 
138
- valid = True
146
+ if model is None:
147
+ return True
148
+
149
+ shape = self._joint_force_references.shape
150
+ expected_shape = (model.dofs(),)
151
+
152
+ if shape != expected_shape:
153
+ return False
139
154
 
140
- if model is not None:
141
- valid = valid and self.input.valid(model=model)
155
+ shape = self._link_forces.shape
156
+ expected_shape = (model.number_of_links(), 6)
142
157
 
143
- return valid
158
+ if shape != expected_shape:
159
+ return False
160
+
161
+ return True
144
162
 
145
163
  # ==================
146
164
  # Extract quantities
@@ -178,7 +196,7 @@ class JaxSimModelReferences(js.common.ModelDataWithVelocityRepresentation):
178
196
  e.g. to the contact model and other kinematic constraints.
179
197
  """
180
198
 
181
- W_f_L = self.input.physics_model.f_ext
199
+ W_f_L = self._link_forces
182
200
 
183
201
  # Return all link forces in inertial-fixed representation using the implicit
184
202
  # serialization.
@@ -190,7 +208,7 @@ class JaxSimModelReferences(js.common.ModelDataWithVelocityRepresentation):
190
208
  if link_names is not None:
191
209
  raise ValueError("Link names cannot be provided without a model")
192
210
 
193
- return self.input.physics_model.f_ext
211
+ return W_f_L
194
212
 
195
213
  # If we have the model, we can extract the link names, if not provided.
196
214
  link_idxs = (
@@ -207,7 +225,7 @@ class JaxSimModelReferences(js.common.ModelDataWithVelocityRepresentation):
207
225
  msg = "Missing model data to use a representation different from {}"
208
226
  raise ValueError(msg.format(VelRepr.Inertial.name))
209
227
 
210
- if not_tracing(self.input.physics_model.f_ext) and not data.valid(model=model):
228
+ if not_tracing(self._link_forces) and not data.valid(model=model):
211
229
  raise ValueError("The provided data is not valid for the model")
212
230
 
213
231
  # Helper function to convert a single 6D force to the active representation
@@ -264,9 +282,9 @@ class JaxSimModelReferences(js.common.ModelDataWithVelocityRepresentation):
264
282
  if joint_names is not None:
265
283
  raise ValueError("Joint names cannot be provided without a model")
266
284
 
267
- return self.input.physics_model.tau
285
+ return self._joint_force_references
268
286
 
269
- if not_tracing(self.input.physics_model.tau) and not self.valid(model=model):
287
+ if not_tracing(self._joint_force_references) and not self.valid(model=model):
270
288
  msg = "The actuation object is not compatible with the provided model"
271
289
  raise ValueError(msg)
272
290
 
@@ -277,7 +295,7 @@ class JaxSimModelReferences(js.common.ModelDataWithVelocityRepresentation):
277
295
  )
278
296
 
279
297
  return jnp.atleast_1d(
280
- self.input.physics_model.tau[joint_idxs].squeeze()
298
+ self._joint_force_references[joint_idxs].squeeze()
281
299
  ).astype(float)
282
300
 
283
301
  # ================
@@ -310,11 +328,7 @@ class JaxSimModelReferences(js.common.ModelDataWithVelocityRepresentation):
310
328
  def replace(forces: jtp.Vector) -> JaxSimModelReferences:
311
329
  return self.replace(
312
330
  validate=True,
313
- input=self.input.replace(
314
- physics_model=self.input.physics_model.replace(
315
- tau=jnp.atleast_1d(forces.squeeze()).astype(float)
316
- )
317
- ),
331
+ _joint_force_references=jnp.atleast_1d(forces.squeeze()).astype(float),
318
332
  )
319
333
 
320
334
  if model is None:
@@ -330,7 +344,7 @@ class JaxSimModelReferences(js.common.ModelDataWithVelocityRepresentation):
330
344
  else jnp.arange(model.number_of_joints())
331
345
  )
332
346
 
333
- return replace(forces=self.input.physics_model.tau.at[joint_idxs].set(forces))
347
+ return replace(forces=self._joint_force_references.at[joint_idxs].set(forces))
334
348
 
335
349
  @functools.partial(jax.jit, static_argnames=["link_names", "additive"])
336
350
  def apply_link_forces(
@@ -370,11 +384,7 @@ class JaxSimModelReferences(js.common.ModelDataWithVelocityRepresentation):
370
384
  def replace(forces: jtp.MatrixLike) -> JaxSimModelReferences:
371
385
  return self.replace(
372
386
  validate=True,
373
- input=self.input.replace(
374
- physics_model=self.input.physics_model.replace(
375
- f_ext=jnp.atleast_2d(forces.squeeze()).astype(float)
376
- )
377
- ),
387
+ _link_forces=jnp.atleast_2d(forces.squeeze()).astype(float),
378
388
  )
379
389
 
380
390
  # In this case, we allow only to set the inertial 6D forces to all links
@@ -389,11 +399,7 @@ class JaxSimModelReferences(js.common.ModelDataWithVelocityRepresentation):
389
399
 
390
400
  W_f_L = f_L
391
401
 
392
- W_f0_L = (
393
- jnp.zeros_like(W_f_L)
394
- if not additive
395
- else self.input.physics_model.f_ext
396
- )
402
+ W_f0_L = jnp.zeros_like(W_f_L) if not additive else self._link_forces
397
403
 
398
404
  return replace(forces=W_f0_L + W_f_L)
399
405
 
@@ -410,18 +416,14 @@ class JaxSimModelReferences(js.common.ModelDataWithVelocityRepresentation):
410
416
 
411
417
  # Compute the bias depending on whether we either set or add the link forces.
412
418
  W_f0_L = (
413
- jnp.zeros_like(f_L)
414
- if not additive
415
- else self.input.physics_model.f_ext[link_idxs, :]
419
+ jnp.zeros_like(f_L) if not additive else self._link_forces[link_idxs, :]
416
420
  )
417
421
 
418
422
  # If inertial-fixed representation, we can directly store the link forces.
419
423
  if self.velocity_representation is VelRepr.Inertial:
420
424
  W_f_L = f_L
421
425
  return replace(
422
- forces=self.input.physics_model.f_ext.at[link_idxs, :].set(
423
- W_f0_L + W_f_L
424
- )
426
+ forces=self._link_forces.at[link_idxs, :].set(W_f0_L + W_f_L)
425
427
  )
426
428
 
427
429
  if data is None:
@@ -450,9 +452,7 @@ class JaxSimModelReferences(js.common.ModelDataWithVelocityRepresentation):
450
452
  W_H_L = js.model.forward_kinematics(model=model, data=data)
451
453
  W_f_L = convert_using_link_frame(f_L=f_L, W_H_L=W_H_L[link_idxs, :, :])
452
454
 
453
- return replace(
454
- forces=self.input.physics_model.f_ext.at[link_idxs, :].set(W_f0_L + W_f_L)
455
- )
455
+ return replace(forces=self._link_forces.at[link_idxs, :].set(W_f0_L + W_f_L))
456
456
 
457
457
  def apply_frame_forces(
458
458
  self,
@@ -851,7 +851,7 @@ class ViscoElasticContacts(common.ContactModel):
851
851
  W_f̅_L = (
852
852
  jnp.array(average_link_contact_forces_inertial)
853
853
  if average_link_contact_forces_inertial is not None
854
- else jnp.zeros_like(references.input.physics_model.f_ext)
854
+ else jnp.zeros_like(references._link_forces)
855
855
  ).astype(float)
856
856
 
857
857
  LW_f̿_L = (
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: jaxsim
3
- Version: 0.5.1.dev46
3
+ Version: 0.5.1.dev56
4
4
  Summary: A differentiable physics engine and multibody dynamics library for control and robot learning.
5
5
  Author-email: Diego Ferigo <dgferigo@gmail.com>, Filippo Luca Ferretti <filippoluca.ferretti@outlook.com>
6
6
  Maintainer-email: Filippo Luca Ferretti <filippo.ferretti@iit.it>, Alessandro Croci <alessandro.croci@iit.it>
@@ -364,7 +364,7 @@ def test_model_jacobian(
364
364
  ):
365
365
 
366
366
  f = references.link_forces(model=model, data=data)
367
- assert f == pytest.approx(references.input.physics_model.f_ext)
367
+ assert f == pytest.approx(references._link_forces)
368
368
 
369
369
  J = js.model.generalized_free_floating_jacobian(model=model, data=data)
370
370
  JTf_inertial = jnp.einsum("l6g,l6->g", J, f)
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:3ea898405d33dc9a7712d621c4539c523d766a7ef1c8e9e2e28942212b2aea97
3
- size 610957
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes