jaxsim 0.2.dev400__py3-none-any.whl → 0.2.dev425__py3-none-any.whl

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.
jaxsim/_version.py CHANGED
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '0.2.dev400'
16
- __version_tuple__ = version_tuple = (0, 2, 'dev400')
15
+ __version__ = version = '0.2.dev425'
16
+ __version_tuple__ = version_tuple = (0, 2, 'dev425')
jaxsim/api/model.py CHANGED
@@ -986,8 +986,8 @@ def free_floating_gravity_forces(
986
986
  def free_floating_bias_forces(
987
987
  model: JaxSimModel, data: js.data.JaxSimModelData
988
988
  ) -> jtp.Vector:
989
- """
990
- Compute the free-floating bias forces :math:`h(\\mathbf{q}, \boldsymbol{\nu})`
989
+ r"""
990
+ Compute the free-floating bias forces :math:`h(\mathbf{q}, \boldsymbol{\nu})`
991
991
  of the model.
992
992
 
993
993
  Args:
jaxsim/mujoco/loaders.py CHANGED
@@ -13,7 +13,17 @@ def load_rod_model(
13
13
  is_urdf: bool | None = None,
14
14
  model_name: str | None = None,
15
15
  ) -> rod.Model:
16
- """"""
16
+ """
17
+ Loads a ROD model from a URDF/SDF file or a ROD model.
18
+
19
+ Args:
20
+ model_description: The URDF/SDF file or ROD model to load.
21
+ is_urdf: Whether the model description is a URDF file.
22
+ model_name: The name of the model to load from the resource.
23
+
24
+ Returns:
25
+ rod.Model: The loaded ROD model.
26
+ """
17
27
 
18
28
  # Parse the SDF resource.
19
29
  sdf_element = rod.Sdf.load(sdf=model_description, is_urdf=is_urdf)
@@ -50,7 +60,15 @@ class RodModelToMjcf:
50
60
  def assets_from_rod_model(
51
61
  rod_model: rod.Model,
52
62
  ) -> dict[str, bytes]:
53
- """"""
63
+ """
64
+ Generates a dictionary of assets from a ROD model.
65
+
66
+ Args:
67
+ rod_model: The ROD model to extract the assets from.
68
+
69
+ Returns:
70
+ dict: A dictionary of assets.
71
+ """
54
72
 
55
73
  import resolve_robotics_uri_py
56
74
 
@@ -85,7 +103,17 @@ class RodModelToMjcf:
85
103
  base_link_name: str,
86
104
  floating_joint_name: str = "world_to_base",
87
105
  ) -> str:
88
- """"""
106
+ """
107
+ Adds a floating joint to a URDF string.
108
+
109
+ Args:
110
+ urdf_string: The URDF string to modify.
111
+ base_link_name: The name of the base link to attach the floating joint.
112
+ floating_joint_name: The name of the floating joint to add.
113
+
114
+ Returns:
115
+ str: The modified URDF string.
116
+ """
89
117
 
90
118
  with tempfile.NamedTemporaryFile(mode="w+", suffix=".urdf") as urdf_file:
91
119
 
@@ -132,7 +160,16 @@ class RodModelToMjcf:
132
160
  plane_normal: tuple[float, float, float] = (0, 0, 1),
133
161
  heightmap: bool | None = None,
134
162
  ) -> tuple[str, dict[str, Any]]:
135
- """"""
163
+ """
164
+ Converts a ROD model to a Mujoco MJCF string.
165
+
166
+ Args:
167
+ rod_model: The ROD model to convert.
168
+ considered_joints: The list of joint names to consider in the conversion.
169
+
170
+ Returns:
171
+ tuple: A tuple containing the MJCF string and the assets dictionary.
172
+ """
136
173
 
137
174
  # -------------------------------------
138
175
  # Convert the model description to URDF
@@ -468,7 +505,17 @@ class UrdfToMjcf:
468
505
  plane_normal: tuple[float, float, float] = (0, 0, 1),
469
506
  heightmap: bool | None = None,
470
507
  ) -> tuple[str, dict[str, Any]]:
471
- """"""
508
+ """
509
+ Converts a URDF file to a Mujoco MJCF string.
510
+
511
+ Args:
512
+ urdf: The URDF file to convert.
513
+ considered_joints: The list of joint names to consider in the conversion.
514
+ model_name: The name of the model to convert.
515
+
516
+ Returns:
517
+ tuple: A tuple containing the MJCF string and the assets dictionary.
518
+ """
472
519
 
473
520
  # Get the ROD model.
474
521
  rod_model = load_rod_model(
@@ -495,7 +542,17 @@ class SdfToMjcf:
495
542
  plane_normal: tuple[float, float, float] = (0, 0, 1),
496
543
  heightmap: bool | None = None,
497
544
  ) -> tuple[str, dict[str, Any]]:
498
- """"""
545
+ """
546
+ Converts a SDF file to a Mujoco MJCF string.
547
+
548
+ Args:
549
+ sdf: The SDF file to convert.
550
+ considered_joints: The list of joint names to consider in the conversion.
551
+ model_name: The name of the model to convert.
552
+
553
+ Returns:
554
+ tuple: A tuple containing the MJCF string and the assets dictionary.
555
+ """
499
556
 
500
557
  # Get the ROD model.
501
558
  rod_model = load_rod_model(
jaxsim/mujoco/model.py CHANGED
@@ -1,3 +1,5 @@
1
+ from __future__ import annotations
2
+
1
3
  import functools
2
4
  import pathlib
3
5
  from typing import Any, Callable
@@ -18,7 +20,13 @@ class MujocoModelHelper:
18
20
  """
19
21
 
20
22
  def __init__(self, model: mj.MjModel, data: mj.MjData | None = None) -> None:
21
- """"""
23
+ """
24
+ Initialize the MujocoModelHelper object.
25
+
26
+ Args:
27
+ model: A Mujoco model object.
28
+ data: A Mujoco data object. If None, a new one will be created.
29
+ """
22
30
 
23
31
  self.model = model
24
32
  self.data = data if data is not None else mj.MjData(self.model)
@@ -34,8 +42,19 @@ class MujocoModelHelper:
34
42
  mjcf_description: str | pathlib.Path,
35
43
  assets: dict[str, Any] = None,
36
44
  heightmap: HeightmapCallable | None = None,
37
- ) -> "MujocoModelHelper":
38
- """"""
45
+ ) -> MujocoModelHelper:
46
+ """
47
+ Build a Mujoco model from an XML description and an optional assets dictionary.
48
+
49
+ Args:
50
+ mjcf_description: A string containing the XML description of the Mujoco model
51
+ or a path to a file containing the XML description.
52
+ assets: An optional dictionary containing the assets of the model.
53
+ heightmap: A function in two variables that returns the height of a terrain
54
+ in the specified coordinate point.
55
+ Returns:
56
+ A MujocoModelHelper object.
57
+ """
39
58
 
40
59
  # Read the XML description if it's a path to file
41
60
  mjcf_description = (
@@ -175,17 +194,17 @@ class MujocoModelHelper:
175
194
  # ==================
176
195
 
177
196
  def number_of_joints(self) -> int:
178
- """"""
197
+ """Returns the number of joints in the model."""
179
198
 
180
199
  return self.model.njnt
181
200
 
182
201
  def number_of_dofs(self) -> int:
183
- """"""
202
+ """Returns the number of DoFs in the model."""
184
203
 
185
204
  return self.model.nq
186
205
 
187
206
  def joint_names(self) -> list[str]:
188
- """"""
207
+ """Returns the names of the joints in the model."""
189
208
 
190
209
  return [
191
210
  mj.mj_id2name(self.model, mj.mjtObj.mjOBJ_JOINT, idx)
@@ -193,7 +212,7 @@ class MujocoModelHelper:
193
212
  ]
194
213
 
195
214
  def joint_dofs(self, joint_name: str) -> int:
196
- """"""
215
+ """Returns the number of DoFs of a joint."""
197
216
 
198
217
  if joint_name not in self.joint_names():
199
218
  raise ValueError(f"Joint '{joint_name}' not found")
@@ -201,7 +220,7 @@ class MujocoModelHelper:
201
220
  return self.data.joint(joint_name).qpos.size
202
221
 
203
222
  def joint_position(self, joint_name: str) -> npt.NDArray:
204
- """"""
223
+ """Returns the position of a joint."""
205
224
 
206
225
  if joint_name not in self.joint_names():
207
226
  raise ValueError(f"Joint '{joint_name}' not found")
@@ -209,7 +228,7 @@ class MujocoModelHelper:
209
228
  return self.data.joint(joint_name).qpos
210
229
 
211
230
  def joint_positions(self, joint_names: list[str] | None = None) -> npt.NDArray:
212
- """"""
231
+ """Returns the positions of the joints."""
213
232
 
214
233
  joint_names = joint_names if joint_names is not None else self.joint_names()
215
234
 
@@ -220,7 +239,7 @@ class MujocoModelHelper:
220
239
  def set_joint_position(
221
240
  self, joint_name: str, position: npt.NDArray | float
222
241
  ) -> None:
223
- """"""
242
+ """Sets the position of a joint."""
224
243
 
225
244
  position = np.atleast_1d(np.array(position).squeeze())
226
245
 
@@ -239,7 +258,7 @@ class MujocoModelHelper:
239
258
  def set_joint_positions(
240
259
  self, joint_names: list[str], positions: npt.NDArray | list[npt.NDArray]
241
260
  ) -> None:
242
- """"""
261
+ """Set the positions of multiple joints."""
243
262
 
244
263
  mask = self.mask_qpos(joint_names=tuple(joint_names))
245
264
  self.data.qpos[mask] = positions
@@ -249,12 +268,12 @@ class MujocoModelHelper:
249
268
  # ==================
250
269
 
251
270
  def number_of_bodies(self) -> int:
252
- """"""
271
+ """Returns the number of bodies in the model."""
253
272
 
254
273
  return self.model.nbody
255
274
 
256
275
  def body_names(self) -> list[str]:
257
- """"""
276
+ """Returns the names of the bodies in the model."""
258
277
 
259
278
  return [
260
279
  mj.mj_id2name(self.model, mj.mjtObj.mjOBJ_BODY, idx)
@@ -262,7 +281,7 @@ class MujocoModelHelper:
262
281
  ]
263
282
 
264
283
  def body_position(self, body_name: str) -> npt.NDArray:
265
- """"""
284
+ """Returns the position of a body."""
266
285
 
267
286
  if body_name not in self.body_names():
268
287
  raise ValueError(f"Body '{body_name}' not found")
@@ -270,7 +289,7 @@ class MujocoModelHelper:
270
289
  return self.data.body(body_name).xpos
271
290
 
272
291
  def body_orientation(self, body_name: str, dcm: bool = False) -> npt.NDArray:
273
- """"""
292
+ """Returns the orientation of a body."""
274
293
 
275
294
  if body_name not in self.body_names():
276
295
  raise ValueError(f"Body '{body_name}' not found")
@@ -284,12 +303,12 @@ class MujocoModelHelper:
284
303
  # ======================
285
304
 
286
305
  def number_of_geometries(self) -> int:
287
- """"""
306
+ """Returns the number of geometries in the model."""
288
307
 
289
308
  return self.model.ngeom
290
309
 
291
310
  def geometry_names(self) -> list[str]:
292
- """"""
311
+ """Returns the names of the geometries in the model."""
293
312
 
294
313
  return [
295
314
  mj.mj_id2name(self.model, mj.mjtObj.mjOBJ_GEOM, idx)
@@ -297,7 +316,7 @@ class MujocoModelHelper:
297
316
  ]
298
317
 
299
318
  def geometry_position(self, geometry_name: str) -> npt.NDArray:
300
- """"""
319
+ """Returns the position of a geometry."""
301
320
 
302
321
  if geometry_name not in self.geometry_names():
303
322
  raise ValueError(f"Geometry '{geometry_name}' not found")
@@ -307,7 +326,7 @@ class MujocoModelHelper:
307
326
  def geometry_orientation(
308
327
  self, geometry_name: str, dcm: bool = False
309
328
  ) -> npt.NDArray:
310
- """"""
329
+ """Returns the orientation of a geometry."""
311
330
 
312
331
  if geometry_name not in self.geometry_names():
313
332
  raise ValueError(f"Geometry '{geometry_name}' not found")
@@ -20,7 +20,17 @@ class MujocoVideoRecorder:
20
20
  height: int | None = None,
21
21
  **kwargs,
22
22
  ) -> None:
23
- """"""
23
+ """
24
+ Initialize the Mujoco video recorder.
25
+
26
+ Args:
27
+ model: The Mujoco model.
28
+ data: The Mujoco data.
29
+ fps: The frames per second.
30
+ width: The width of the video.
31
+ height: The height of the video.
32
+ **kwargs: Additional arguments for the renderer.
33
+ """
24
34
 
25
35
  width = width if width is not None else model.vis.global_.offwidth
26
36
  height = height if height is not None else model.vis.global_.offheight
@@ -45,7 +55,7 @@ class MujocoVideoRecorder:
45
55
  def reset(
46
56
  self, model: mj.MjModel | None = None, data: mj.MjData | None = None
47
57
  ) -> None:
48
- """"""
58
+ """Reset the model and data."""
49
59
 
50
60
  self.frames = []
51
61
 
@@ -53,7 +63,7 @@ class MujocoVideoRecorder:
53
63
  self.model = model if model is not None else self.model
54
64
 
55
65
  def render_frame(self, camera_name: str | None = None) -> npt.NDArray:
56
- """"""
66
+ """Renders a frame."""
57
67
  camera_name = camera_name or "track"
58
68
 
59
69
  mujoco.mj_forward(self.model, self.data)
@@ -62,14 +72,14 @@ class MujocoVideoRecorder:
62
72
  return self.renderer.render()
63
73
 
64
74
  def record_frame(self, camera_name: str | None = None) -> None:
65
- """"""
75
+ """Stores a frame in the buffer."""
66
76
  camera_name = camera_name or "track"
67
77
 
68
78
  frame = self.render_frame(camera_name=camera_name)
69
79
  self.frames.append(frame)
70
80
 
71
81
  def write_video(self, path: pathlib.Path, exist_ok: bool = False) -> None:
72
- """"""
82
+ """Writes the video to a file."""
73
83
 
74
84
  if path.is_dir():
75
85
  raise IsADirectoryError(f"The path '{path}' is a directory.")
@@ -110,7 +120,13 @@ class MujocoVisualizer:
110
120
  def __init__(
111
121
  self, model: mj.MjModel | None = None, data: mj.MjData | None = None
112
122
  ) -> None:
113
- """"""
123
+ """
124
+ Initialize the Mujoco visualizer.
125
+
126
+ Args:
127
+ model: The Mujoco model.
128
+ data: The Mujoco data.
129
+ """
114
130
 
115
131
  self.data = data
116
132
  self.model = model
@@ -121,7 +137,7 @@ class MujocoVisualizer:
121
137
  model: mj.MjModel | None = None,
122
138
  data: mj.MjData | None = None,
123
139
  ) -> None:
124
- """"""
140
+ """Updates the viewer with the current model and data."""
125
141
 
126
142
  data = data if data is not None else self.data
127
143
  model = model if model is not None else self.model
@@ -132,7 +148,7 @@ class MujocoVisualizer:
132
148
  def open_viewer(
133
149
  self, model: mj.MjModel | None = None, data: mj.MjData | None = None
134
150
  ) -> mj.viewer.Handle:
135
- """"""
151
+ """Opens a viewer."""
136
152
 
137
153
  data = data if data is not None else self.data
138
154
  model = model if model is not None else self.model
@@ -150,7 +166,7 @@ class MujocoVisualizer:
150
166
  data: mj.MjData | None = None,
151
167
  close_on_exit: bool = True,
152
168
  ) -> ContextManager[mujoco.viewer.Handle]:
153
- """"""
169
+ """Context manager to open a viewer."""
154
170
 
155
171
  handle = self.open_viewer(model=model, data=data)
156
172
 
@@ -1,6 +1,6 @@
1
1
  BSD 3-Clause License
2
2
 
3
- Copyright (c) 2022, Artificial and Mechanical Intelligence
3
+ Copyright (c) 2022, Artificial and Mechanical Intelligence
4
4
  All rights reserved.
5
5
 
6
6
  Redistribution and use in source and binary forms, with or without
@@ -0,0 +1,236 @@
1
+ Metadata-Version: 2.1
2
+ Name: jaxsim
3
+ Version: 0.2.dev425
4
+ Summary: A physics engine in reduced coordinates implemented with JAX.
5
+ Home-page: https://github.com/ami-iit/jaxsim
6
+ Author: Diego Ferigo
7
+ Author-email: diego.ferigo@iit.it
8
+ License: BSD
9
+ Project-URL: Changelog, https://github.com/ami-iit/jaxsim/releases
10
+ Project-URL: Source, https://github.com/ami-iit/jaxsim
11
+ Project-URL: Tracker, https://github.com/ami-iit/jaxsim/issues
12
+ Keywords: physics,physics engine,jax,rigid body dynamics,featherstone,reinforcement learning,robot,robotics,sdf,urdf
13
+ Platform: any
14
+ Classifier: Development Status :: 4 - Beta
15
+ Classifier: Framework :: Robot Framework
16
+ Classifier: Intended Audience :: Developers
17
+ Classifier: Intended Audience :: Science/Research
18
+ Classifier: License :: OSI Approved :: BSD License
19
+ Classifier: Operating System :: POSIX :: Linux
20
+ Classifier: Operating System :: MacOS
21
+ Classifier: Operating System :: Microsoft
22
+ Classifier: Programming Language :: Python :: 3.11
23
+ Classifier: Programming Language :: Python :: 3.12
24
+ Classifier: Programming Language :: Python :: 3 :: Only
25
+ Classifier: Programming Language :: Python :: Implementation :: CPython
26
+ Classifier: Topic :: Games/Entertainment :: Simulation
27
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
28
+ Classifier: Topic :: Scientific/Engineering :: Physics
29
+ Classifier: Topic :: Software Development
30
+ Requires-Python: >=3.11
31
+ Description-Content-Type: text/markdown
32
+ License-File: LICENSE
33
+ Requires-Dist: coloredlogs
34
+ Requires-Dist: jax >=0.4.13
35
+ Requires-Dist: jaxlib >=0.4.13
36
+ Requires-Dist: jaxlie >=1.3.0
37
+ Requires-Dist: jax-dataclasses >=1.4.0
38
+ Requires-Dist: pptree
39
+ Requires-Dist: rod >=0.2.0
40
+ Requires-Dist: typing-extensions ; python_version < "3.12"
41
+ Provides-Extra: all
42
+ Requires-Dist: black[jupyter] ~=24.0 ; extra == 'all'
43
+ Requires-Dist: isort ; extra == 'all'
44
+ Requires-Dist: pre-commit ; extra == 'all'
45
+ Requires-Dist: idyntree ; extra == 'all'
46
+ Requires-Dist: pytest >=6.0 ; extra == 'all'
47
+ Requires-Dist: pytest-icdiff ; extra == 'all'
48
+ Requires-Dist: robot-descriptions ; extra == 'all'
49
+ Requires-Dist: lxml ; extra == 'all'
50
+ Requires-Dist: mediapy ; extra == 'all'
51
+ Requires-Dist: mujoco >=3.0.0 ; extra == 'all'
52
+ Provides-Extra: style
53
+ Requires-Dist: black[jupyter] ~=24.0 ; extra == 'style'
54
+ Requires-Dist: isort ; extra == 'style'
55
+ Requires-Dist: pre-commit ; extra == 'style'
56
+ Provides-Extra: testing
57
+ Requires-Dist: idyntree ; extra == 'testing'
58
+ Requires-Dist: pytest >=6.0 ; extra == 'testing'
59
+ Requires-Dist: pytest-icdiff ; extra == 'testing'
60
+ Requires-Dist: robot-descriptions ; extra == 'testing'
61
+ Provides-Extra: viz
62
+ Requires-Dist: lxml ; extra == 'viz'
63
+ Requires-Dist: mediapy ; extra == 'viz'
64
+ Requires-Dist: mujoco >=3.0.0 ; extra == 'viz'
65
+
66
+ # JaxSim
67
+
68
+ JaxSim is a **differentiable physics engine** and **multibody dynamics library** designed for applications in control and robot learning, implemented with JAX.
69
+
70
+ Its design facilitates research and accelerates prototyping in the intersection of robotics and artificial intelligence.
71
+
72
+ ## Features
73
+
74
+ - Physics engine in reduced coordinates supporting fixed-base and floating-base robots.
75
+ - Multibody dynamics library providing all the necessary components for developing model-based control algorithms.
76
+ - Completely developed in Python with [`google/jax`][jax] following a functional programming paradigm.
77
+ - Transparent support for running on CPUs, GPUs, and TPUs.
78
+ - Full support for JIT compilation for increased performance.
79
+ - Full support for automatic vectorization for massive parallelization of open-loop and closed-loop architectures.
80
+ - Support for SDF models and, upon conversion with [sdformat][sdformat], URDF models.
81
+ - Visualization based on the [passive viewer][passive_viewer_mujoco] of Mujoco.
82
+
83
+ ### JaxSim as a simulator
84
+
85
+ - Wide range of fixed-step explicit Runge-Kutta integrators.
86
+ - Support for variable-step integrators implemented as embedded Runge-Kutta schemes.
87
+ - Improved stability by optionally integrating the base orientation on the $\text{SO}(3)$ manifold.
88
+ - Soft contacts model supporting full friction cone and sticking-slipping transition.
89
+ - Collision detection between points rigidly attached to bodies and uneven ground surfaces.
90
+
91
+ ### JaxSim as a multibody dynamics library
92
+
93
+ - Provides rigid body dynamics algorithms (RBDAs) like RNEA, ABA, CRBA, and Jacobians.
94
+ - Provides all the quantities included in the Euler-Poincarè formulation of the equations of motion.
95
+ - Supports body-fixed, inertial-fixed, and mixed [velocity representations][notation].
96
+ - Exposes all the necessary quantities to develop controllers in centroidal coordinates.
97
+
98
+ ### JaxSim for robot learning
99
+
100
+ - Being developed with JAX, all the RBDAs support automatic differentiation both in forward and reverse modes.
101
+ - Support for automatically differentiating against kinematics and dynamics parameters.
102
+ - All fixed-step integrators are forward and reverse differentiable.
103
+ - All variable-step integrators are forward differentiable.
104
+ - Ideal for sampling synthetic data for reinforcement learning (RL).
105
+ - Ideal for designing physics-informed neural networks (PINNs) with loss functions requiring model-based quantities.
106
+ - Ideal for combining model-based control with learning-based components.
107
+
108
+ [jax]: https://github.com/google/jax/
109
+ [sdformat]: https://github.com/gazebosim/sdformat
110
+ [notation]: https://research.tue.nl/en/publications/multibody-dynamics-notation-version-2
111
+ [passive_viewer_mujoco]: https://mujoco.readthedocs.io/en/stable/python.html#passive-viewer
112
+
113
+ > [!WARNING]
114
+ > This project is still experimental, APIs could change between releases without notice.
115
+
116
+ > [!NOTE]
117
+ > JaxSim currently focuses on locomotion applications.
118
+ > Only contacts between bodies and smooth ground surfaces are supported.
119
+
120
+ ## Documentation
121
+
122
+ The JaxSim API documentation is available at [jaxsim.readthedocs.io][readthedocs].
123
+
124
+ [readthedocs]: https://jaxsim.readthedocs.io/
125
+
126
+ ## Installation
127
+
128
+ <details>
129
+ <summary>With conda</summary>
130
+
131
+ You can install the project using [`conda`][conda] as follows:
132
+
133
+ ```bash
134
+ conda install jaxsim -c conda-forge
135
+ ```
136
+
137
+ You can enforce GPU support, if needed, by also specifying `"jaxlib = * = *cuda*"`.
138
+
139
+ </details>
140
+
141
+ <details>
142
+ <summary>With pip</summary>
143
+
144
+ You can install the project using [`pypa/pip`][pip], preferably in a [virtual environment][venv], as follows:
145
+
146
+ ```bash
147
+ pip install jaxsim
148
+ ```
149
+
150
+ Check [`setup.cfg`](setup.cfg) for the complete list of optional dependencies.
151
+ You can obtain a full installation using `jaxsim[all]`.
152
+
153
+ If you need GPU support, follow the official [installation instructions][jax_gpu] of JAX.
154
+
155
+ </details>
156
+
157
+ <details>
158
+ <summary>Contributors installation</summary>
159
+
160
+ If you want to contribute to the project, we recommend creating the following `jaxsim` conda environment first:
161
+
162
+ ```bash
163
+ conda env create -f environment.yml
164
+ ```
165
+
166
+ Then, activate the environment and install the project in editable mode:
167
+
168
+ ```bash
169
+ conda activate jaxsim
170
+ pip install --no-deps -e .
171
+ ```
172
+
173
+ </details>
174
+
175
+ [conda]: https://anaconda.org/
176
+ [pip]: https://github.com/pypa/pip/
177
+ [venv]: https://docs.python.org/3/tutorial/venv.html
178
+ [jax_gpu]: https://github.com/google/jax/#installation
179
+
180
+ ## Credits
181
+
182
+ The RBDAs are based on the theory of the [Rigid Body Dynamics Algorithms][RBDA]
183
+ book by Roy Featherstone.
184
+ The algorithms and some simulation features were inspired by its accompanying [code][spatial_v2].
185
+
186
+ [RBDA]: https://link.springer.com/book/10.1007/978-1-4899-7560-7
187
+ [spatial_v2]: http://royfeatherstone.org/spatial/index.html#spatial-software
188
+
189
+ The development of JaxSim started in late 2021, inspired by early versions of [`google/brax`][brax].
190
+ At that time, Brax was implemented in maximal coordinates, and we wanted a physics engine in reduced coordinates.
191
+ We are grateful to the Brax team for their work and showing the potential of [JAX][jax] in this field.
192
+
193
+ Brax v2 was later implemented reduced coordinates, following an approach comparable to JaxSim.
194
+ The development then shifted to [MJX][mjx], which today provides a JAX-based implementation of the Mujoco APIs.
195
+
196
+ The main differences between MJX/Brax and JaxSim are as follows:
197
+
198
+ - JaxSim supports out-of-the-box all SDF models with [Pose Frame Semantics][PFS].
199
+ - JaxSim only supports collisions between points rigidly attached to bodies and a compliant ground surface.
200
+ Our contact model requires careful tuning of its spring-damper parameters, but being an instantaneous
201
+ function of the state $(\mathbf{q}, \boldsymbol{\nu})$, it doesn't require running any optimization algorithm
202
+ when stepping the simulation forward.
203
+ - JaxSim mitigates the stiffness of the contact-aware system dynamics by providing variable-step integrators.
204
+
205
+ [brax]: https://github.com/google/brax
206
+ [mjx]: https://mujoco.readthedocs.io/en/3.0.0/mjx.html
207
+ [PFS]: http://sdformat.org/tutorials?tut=pose_frame_semantics
208
+
209
+ ## Contributing
210
+
211
+ We welcome contributions from the community.
212
+ Please read the [contributing guide](./CONTRIBUTING.md) to get started.
213
+
214
+ ## Citing
215
+
216
+ ```bibtex
217
+ @software{ferigo_jaxsim_2022,
218
+ author = {Diego Ferigo and Filippo Luca Ferretti and Silvio Traversaro and Daniele Pucci},
219
+ title = {{JaxSim}: A Differentiable Physics Engine and Multibody Dynamics Library for Control and Robot Learning},
220
+ url = {http://github.com/ami-iit/jaxsim},
221
+ year = {2022},
222
+ }
223
+ ```
224
+
225
+ ## People
226
+
227
+ | Author | Maintainers |
228
+ |:------:|:-----------:|
229
+ | [<img src="https://avatars.githubusercontent.com/u/469199?v=4" width="40">][df] | [<img src="https://avatars.githubusercontent.com/u/102977828?v=4" width="40">][ff] [<img src="https://avatars.githubusercontent.com/u/469199?v=4" width="40">][df] |
230
+
231
+ [df]: https://github.com/diegoferigo
232
+ [ff]: https://github.com/flferretti
233
+
234
+ ## License
235
+
236
+ [BSD3](https://choosealicense.com/licenses/bsd-3-clause/)
@@ -1,5 +1,5 @@
1
1
  jaxsim/__init__.py,sha256=OcrfoYS1DGcmAGqu2AqlCTiUVxcpi-IsVwcr_16x74Q,1789
2
- jaxsim/_version.py,sha256=BO3EMbgAuYlaQwu5AW79yzemzs_VfsatTtNvmyxhhT4,423
2
+ jaxsim/_version.py,sha256=l20fd5wo4rdowiTMBXyxEkIgZd2mVxKUE6GuILEU3rA,423
3
3
  jaxsim/logging.py,sha256=c4zhwBKf9eAYAHVp62kTEllqdsZgh0K-kPKVy8L3elU,1584
4
4
  jaxsim/typing.py,sha256=MeuOCQtLAr-sPkvB_sU8FtwGNRirz1auCwIgRC-QZl8,646
5
5
  jaxsim/api/__init__.py,sha256=fNTCPUeDfOAizRd4RsW3Epv0sLTu0KJGoFRSEsi75VM,162
@@ -10,7 +10,7 @@ jaxsim/api/data.py,sha256=cPFy6TTm0rNpDk1O0ZxOpvBwWVPu6V14XLRMeC7x81Q,26786
10
10
  jaxsim/api/joint.py,sha256=q31Kp3Cqv-yTcxijjzbj_QADFnGQyjb2al9fYZtzedo,4763
11
11
  jaxsim/api/kin_dyn_parameters.py,sha256=G4mtSi8fElYe0yttLgsxSOPf7vcK-yqTu06Aa5SSrYg,26012
12
12
  jaxsim/api/link.py,sha256=rypTwkMf9HJ5UuAtHRJh0LqqdJWcLKTtTjWcjduEsF0,9842
13
- jaxsim/api/model.py,sha256=u7CZTNc0UY0ZVpUEW-RsZi2UysyzbK06zvSPsdOlPYQ,52269
13
+ jaxsim/api/model.py,sha256=UwjZctpQR_3F8_Cm-NmFQb14Wtw_vscs3Yg-ULpQyrs,52269
14
14
  jaxsim/api/ode.py,sha256=6l-6i2YHagsQvR8Ac-_fmO6P0hBVT6NkHhwXnrdITEg,9785
15
15
  jaxsim/api/ode_data.py,sha256=dwRFVPJ30XMmdUbPXEu7YxsQ97jZP4L4fd5ZzhrO5Ys,22184
16
16
  jaxsim/api/references.py,sha256=Lvskf17r619KKxwCJP7hAAty2kaXgDXJX1uKqoDIDgo,15483
@@ -29,9 +29,9 @@ jaxsim/math/skew.py,sha256=oOGSSR8PUGROl6IJFlrmu6K3gPH-u16hUPfKIkcVv9o,1177
29
29
  jaxsim/math/transform.py,sha256=boeuN8df4Yd9NvS64g-xUYoNqG91YafYLam4iITFJVg,2917
30
30
  jaxsim/mujoco/__init__.py,sha256=Zo5GAlN1DYKvX8s1hu1j6HntKIbBMLB9Puv9ouaNAZ8,158
31
31
  jaxsim/mujoco/__main__.py,sha256=GBmB7J-zj75ZnFyuAAmpSOpbxi_HhHhWJeot3ljGDJY,5291
32
- jaxsim/mujoco/loaders.py,sha256=PG6TrmurdF99B_HJW39daNXMYlwGy3JMofb4oTRwPLc,17406
33
- jaxsim/mujoco/model.py,sha256=ErL4X4QWPCJJJjCAMHsFsksYTgIpmV_M8xWPZc-gQcA,12117
34
- jaxsim/mujoco/visualizer.py,sha256=-qg26t5tleTva6zzQmc5SdnlC8XZ1ZAwZ_lDjdwHJ0A,4400
32
+ jaxsim/mujoco/loaders.py,sha256=FwEZHdRZoxOqXPauQUojP5mjknMaTb386V2BSiAoz5Q,19323
33
+ jaxsim/mujoco/model.py,sha256=5-4KTbEbU19zjrSuvUVdLo3noWxTvlCNsFIs3rQTNDY,13506
34
+ jaxsim/mujoco/visualizer.py,sha256=YlteqcCbeB1B6saAHKBz1IJad3N5Rp163reZrzKLAys,5065
35
35
  jaxsim/parsers/__init__.py,sha256=sonYi-bBWAoB04kp1mxT4uIORxjb7SdZ0ukGPmVx98Y,44
36
36
  jaxsim/parsers/kinematic_graph.py,sha256=_ZJr-u1m64qPCeY6BHTI56dSOWhOGfbg2HN49XbTXhA,23784
37
37
  jaxsim/parsers/descriptions/__init__.py,sha256=EbTfnrK3oCxA3pNv--YUwllJ6uICENvFgAdRbYtS9ts,238
@@ -57,8 +57,8 @@ jaxsim/utils/__init__.py,sha256=tnQq1_CavdfeKaLYt3pmO7Jk4MU2RwwQU_qICkjyoTY,197
57
57
  jaxsim/utils/hashless.py,sha256=bFIwKeo9KiWwsY8QM55duEGGQOyyJ4jQyPcuqTLEp5k,297
58
58
  jaxsim/utils/jaxsim_dataclass.py,sha256=T8nZolb563mYJD7YvTmYW-z-hpkEiaK3cDbYHqwtqRc,11347
59
59
  jaxsim/utils/tracing.py,sha256=KDMoyVPlu2NJvFkhtZwq5AkqMMgajt3munvJom-vEjQ,650
60
- jaxsim-0.2.dev400.dist-info/LICENSE,sha256=EsU2z6_sWW4Zduzq3goVWjZoCZVKQsM4H_y0o7oRA7Q,1547
61
- jaxsim-0.2.dev400.dist-info/METADATA,sha256=EL191CZ6s6EL91lE_vJkEYOmgo-3E7GQV8ovR9ZFwVM,7644
62
- jaxsim-0.2.dev400.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
63
- jaxsim-0.2.dev400.dist-info/top_level.txt,sha256=LxGMA8FLtXjQ6oI7N5gd_R_oSUHxpXxUEOfT1xS_ni0,7
64
- jaxsim-0.2.dev400.dist-info/RECORD,,
60
+ jaxsim-0.2.dev425.dist-info/LICENSE,sha256=eaYdFmdeMbiIoIiPzEK0MjP1S9wtFXjXNR5er49uLR0,1546
61
+ jaxsim-0.2.dev425.dist-info/METADATA,sha256=Dznse8CFPZj8N_pQ37sVie_jUB745H7sho_cmGvlNcA,9687
62
+ jaxsim-0.2.dev425.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
63
+ jaxsim-0.2.dev425.dist-info/top_level.txt,sha256=LxGMA8FLtXjQ6oI7N5gd_R_oSUHxpXxUEOfT1xS_ni0,7
64
+ jaxsim-0.2.dev425.dist-info/RECORD,,
@@ -1,182 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: jaxsim
3
- Version: 0.2.dev400
4
- Summary: A physics engine in reduced coordinates implemented with JAX.
5
- Home-page: https://github.com/ami-iit/jaxsim
6
- Author: Diego Ferigo
7
- Author-email: diego.ferigo@iit.it
8
- License: BSD
9
- Project-URL: Changelog, https://github.com/ami-iit/jaxsim/releases
10
- Project-URL: Source, https://github.com/ami-iit/jaxsim
11
- Project-URL: Tracker, https://github.com/ami-iit/jaxsim/issues
12
- Keywords: physics,physics engine,jax,rigid body dynamics,featherstone,reinforcement learning,robot,robotics,sdf,urdf
13
- Platform: any
14
- Classifier: Development Status :: 4 - Beta
15
- Classifier: Framework :: Robot Framework
16
- Classifier: Intended Audience :: Developers
17
- Classifier: Intended Audience :: Science/Research
18
- Classifier: License :: OSI Approved :: BSD License
19
- Classifier: Operating System :: POSIX :: Linux
20
- Classifier: Operating System :: MacOS
21
- Classifier: Operating System :: Microsoft
22
- Classifier: Programming Language :: Python :: 3.11
23
- Classifier: Programming Language :: Python :: 3.12
24
- Classifier: Programming Language :: Python :: 3 :: Only
25
- Classifier: Programming Language :: Python :: Implementation :: CPython
26
- Classifier: Topic :: Games/Entertainment :: Simulation
27
- Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
28
- Classifier: Topic :: Scientific/Engineering :: Physics
29
- Classifier: Topic :: Software Development
30
- Requires-Python: >=3.11
31
- Description-Content-Type: text/markdown
32
- License-File: LICENSE
33
- Requires-Dist: coloredlogs
34
- Requires-Dist: jax >=0.4.13
35
- Requires-Dist: jaxlib >=0.4.13
36
- Requires-Dist: jaxlie >=1.3.0
37
- Requires-Dist: jax-dataclasses >=1.4.0
38
- Requires-Dist: pptree
39
- Requires-Dist: rod >=0.2.0
40
- Requires-Dist: typing-extensions ; python_version < "3.12"
41
- Provides-Extra: all
42
- Requires-Dist: black[jupyter] ~=24.0 ; extra == 'all'
43
- Requires-Dist: isort ; extra == 'all'
44
- Requires-Dist: pre-commit ; extra == 'all'
45
- Requires-Dist: idyntree ; extra == 'all'
46
- Requires-Dist: pytest >=6.0 ; extra == 'all'
47
- Requires-Dist: pytest-icdiff ; extra == 'all'
48
- Requires-Dist: robot-descriptions ; extra == 'all'
49
- Requires-Dist: lxml ; extra == 'all'
50
- Requires-Dist: mediapy ; extra == 'all'
51
- Requires-Dist: mujoco >=3.0.0 ; extra == 'all'
52
- Provides-Extra: style
53
- Requires-Dist: black[jupyter] ~=24.0 ; extra == 'style'
54
- Requires-Dist: isort ; extra == 'style'
55
- Requires-Dist: pre-commit ; extra == 'style'
56
- Provides-Extra: testing
57
- Requires-Dist: idyntree ; extra == 'testing'
58
- Requires-Dist: pytest >=6.0 ; extra == 'testing'
59
- Requires-Dist: pytest-icdiff ; extra == 'testing'
60
- Requires-Dist: robot-descriptions ; extra == 'testing'
61
- Provides-Extra: viz
62
- Requires-Dist: lxml ; extra == 'viz'
63
- Requires-Dist: mediapy ; extra == 'viz'
64
- Requires-Dist: mujoco >=3.0.0 ; extra == 'viz'
65
-
66
- # JAXsim
67
-
68
- **A scalable physics engine and multibody dynamics library implemented with JAX. With JIT batteries 🔋**
69
-
70
- > [!WARNING]
71
- > This project is still experimental, APIs could change without notice.
72
-
73
- > [!NOTE]
74
- > This simulator currently focuses on locomotion applications. Only contacts with ground are supported.
75
-
76
- ## Features
77
-
78
- - Physics engine in reduced coordinates implemented with [JAX][jax] in Python.
79
- - JIT compilation of Python code for increased performance.
80
- - Transparent support to execute logic on CPUs, GPUs, and TPUs.
81
- - Parallel multi-body simulations on hardware accelerators for significantly increased throughput.
82
- - Support for SDF models (and, upon conversion, URDF models).
83
- - Collision detection between bodies and uneven ground surface.
84
- - Soft contacts model supporting full friction cone and sticking / slipping transition.
85
- - Complete support for inertial properties of rigid bodies.
86
- - Revolute, prismatic, and fixed joints support.
87
- - Integrators: forward Euler, semi-implicit Euler, Runge-Kutta 4.
88
- - High-level classes for object-oriented programming.
89
- - High-level classes to compute multi-body dynamics quantities from the simulation state.
90
- - High-level classes wrapping the low-level functional RBDAs with support of [multiple velocities representations][notation].
91
- - Default validation of JAX pytrees to prevent JIT re-compilations.
92
- - Preliminary support for automatic differentiation of RBDAs.
93
-
94
- [jax]: https://github.com/google/jax/
95
- [notation]: https://research.tue.nl/en/publications/multibody-dynamics-notation-version-2
96
-
97
- ## Documentation
98
-
99
- The JAXsim API documentation is available at [jaxsim.readthedocs.io](https://jaxsim.readthedocs.io/).
100
-
101
- ## Installation
102
-
103
- You can install the project using [`conda`][conda]:
104
-
105
- ```bash
106
- conda install jaxsim -c conda-forge
107
- ```
108
-
109
- Alternatively, you can use [`pypa/pip`][pip], preferably in a [virtual environment][venv]:
110
-
111
- ```bash
112
- pip install jaxsim
113
- ```
114
-
115
- Check [`setup.cfg`](setup.cfg) for the complete list of optional dependencies.
116
- Install all of them with `jaxsim[all]`.
117
-
118
- **Note:** For GPU support, follow the official [installation instructions][jax_gpu] of JAX.
119
-
120
- [conda]: https://anaconda.org/
121
- [pip]: https://github.com/pypa/pip/
122
- [venv]: https://docs.python.org/3/tutorial/venv.html
123
- [jax_gpu]: https://github.com/google/jax/#installation
124
-
125
- ## Quickstart
126
-
127
- Explore and learn how to use the library through practical demonstrations available in the [examples](./examples) folder.
128
-
129
- ## Credits
130
-
131
- The physics module of JAXsim is based on the theory of the [Rigid Body Dynamics Algorithms][RBDA]
132
- book by Roy Featherstone.
133
- We structured part of our logic following its accompanying [code][spatial_v2].
134
- The physics engine is developed entirely in Python using [JAX][jax].
135
-
136
- [RBDA]: https://link.springer.com/book/10.1007/978-1-4899-7560-7
137
- [spatial_v2]: http://royfeatherstone.org/spatial/index.html#spatial-software
138
-
139
- The inspiration for developing JAXsim originally stemmed from early versions of [`google/brax`][brax].
140
- Here below we summarize the differences between the projects:
141
-
142
- - JAXsim simulates multibody dynamics in reduced coordinates, while brax v1 uses maximal coordinates.
143
- - The new v2 APIs of brax (and the new [MJX][mjx]) were then implemented in reduced coordinates, following an approach comparable to JAXsim, with major differences in contact handling.
144
- - The rigid-body algorithms used in JAXsim allow to efficiently compute quantities based on the Euler-Poincarè
145
- formulation of the equations of motion, necessary for model-based robotics research.
146
- - JAXsim supports SDF (and, indirectly, URDF) models, assuming the model is described with the
147
- recent [Pose Frame Semantics][PFS].
148
- - Contrarily to brax, JAXsim only supports collision detection between bodies and a compliant ground surface.
149
- - The RBDAs of JAXsim support automatic differentiation, but this functionality has not been thoroughly tested.
150
-
151
- [brax]: https://github.com/google/brax
152
- [mjx]: https://mujoco.readthedocs.io/en/3.0.0/mjx.html
153
- [PFS]: http://sdformat.org/tutorials?tut=pose_frame_semantics
154
-
155
- ## Contributing
156
-
157
- We welcome contributions from the community.
158
- Please read the [contributing guide](./CONTRIBUTING.md) to get started.
159
-
160
- ## Citing
161
-
162
- ```bibtex
163
- @software{ferigo_jaxsim_2022,
164
- author = {Diego Ferigo and Silvio Traversaro and Daniele Pucci},
165
- title = {{JAXsim}: A Physics Engine in Reduced Coordinates and Multibody Dynamics Library for Control and Robot Learning},
166
- url = {http://github.com/ami-iit/jaxsim},
167
- year = {2022},
168
- }
169
- ```
170
-
171
- ## People
172
-
173
- | Author | Maintainers |
174
- |:------:|:-----------:|
175
- | [<img src="https://avatars.githubusercontent.com/u/469199?v=4" width="40">][df] | [<img src="https://avatars.githubusercontent.com/u/102977828?v=4" width="40">][ff] [<img src="https://avatars.githubusercontent.com/u/469199?v=4" width="40">][df] |
176
-
177
- [df]: https://github.com/diegoferigo
178
- [ff]: https://github.com/flferretti
179
-
180
- ## License
181
-
182
- [BSD3](https://choosealicense.com/licenses/bsd-3-clause/)