jaxsim 0.2.1.dev128__tar.gz → 0.2.1.dev155__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.
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/.github/workflows/ci_cd.yml +2 -3
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/.gitignore +5 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/PKG-INFO +5 -5
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/README.md +4 -4
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155/examples}/.gitattributes +0 -1
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim/__init__.py +39 -7
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim/_version.py +2 -2
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim/api/contact.py +4 -4
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim/api/kin_dyn_parameters.py +4 -1
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim/api/link.py +2 -2
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim/api/model.py +16 -23
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim/api/ode.py +15 -2
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim/math/joint_model.py +2 -2
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim/mujoco/loaders.py +4 -5
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim/mujoco/model.py +1 -1
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim/mujoco/visualizer.py +1 -1
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim/parsers/descriptions/collision.py +58 -23
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim/parsers/descriptions/joint.py +39 -17
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim/parsers/descriptions/link.py +9 -6
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim/parsers/descriptions/model.py +31 -11
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim/parsers/kinematic_graph.py +36 -11
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim/parsers/rod/parser.py +1 -1
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim/parsers/rod/utils.py +5 -7
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim/rbda/crba.py +2 -2
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim/rbda/forward_kinematics.py +1 -1
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim/typing.py +4 -1
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim.egg-info/PKG-INFO +5 -5
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/tests/test_api_com.py +1 -5
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/tests/test_api_model.py +78 -10
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/tests/test_automatic_differentiation.py +3 -3
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/tests/test_simulations.py +1 -1
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/tests/utils_idyntree.py +1 -1
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/.devcontainer/Dockerfile +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/.devcontainer/devcontainer.json +0 -0
- {jaxsim-0.2.1.dev128/examples → jaxsim-0.2.1.dev155}/.gitattributes +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/.github/CODEOWNERS +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/.github/workflows/read_the_docs.yml +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/.github/workflows/style.yml +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/.pre-commit-config.yaml +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/.readthedocs.yaml +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/CONTRIBUTING.md +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/LICENSE +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/docs/Makefile +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/docs/conf.py +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/docs/guide/install.rst +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/docs/index.rst +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/docs/make.bat +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/docs/modules/api.rst +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/docs/modules/index.rst +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/docs/modules/integrators.rst +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/docs/modules/math.rst +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/docs/modules/mujoco.rst +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/docs/modules/parsers.rst +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/docs/modules/rbda.rst +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/docs/modules/typing.rst +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/docs/modules/utils.rst +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/environment.yml +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/examples/.gitignore +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/examples/PD_controller.ipynb +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/examples/Parallel_computing.ipynb +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/examples/README.md +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/examples/assets/cartpole.urdf +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/pixi.lock +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/pyproject.toml +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/setup.cfg +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/setup.py +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim/api/__init__.py +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim/api/com.py +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim/api/common.py +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim/api/data.py +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim/api/frame.py +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim/api/joint.py +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim/api/ode_data.py +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim/api/references.py +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim/integrators/__init__.py +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim/integrators/common.py +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim/integrators/fixed_step.py +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim/integrators/variable_step.py +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim/logging.py +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim/math/__init__.py +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim/math/adjoint.py +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim/math/cross.py +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim/math/inertia.py +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim/math/quaternion.py +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim/math/rotation.py +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim/math/skew.py +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim/math/transform.py +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim/mujoco/__init__.py +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim/mujoco/__main__.py +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim/parsers/__init__.py +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim/parsers/descriptions/__init__.py +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim/parsers/rod/__init__.py +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim/rbda/__init__.py +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim/rbda/aba.py +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim/rbda/collidable_points.py +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim/rbda/jacobian.py +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim/rbda/rnea.py +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim/rbda/soft_contacts.py +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim/rbda/utils.py +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim/terrain/__init__.py +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim/terrain/terrain.py +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim/utils/__init__.py +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim/utils/jaxsim_dataclass.py +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim/utils/tracing.py +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim/utils/wrappers.py +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim.egg-info/SOURCES.txt +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim.egg-info/dependency_links.txt +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim.egg-info/not-zip-safe +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim.egg-info/requires.txt +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/src/jaxsim.egg-info/top_level.txt +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/tests/__init__.py +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/tests/conftest.py +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/tests/test_api_data.py +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/tests/test_api_frame.py +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/tests/test_api_joint.py +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/tests/test_api_link.py +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/tests/test_contact.py +0 -0
- {jaxsim-0.2.1.dev128 → jaxsim-0.2.1.dev155}/tests/test_pytree.py +0 -0
@@ -118,8 +118,7 @@ jobs:
|
|
118
118
|
- *src
|
119
119
|
- *tests
|
120
120
|
|
121
|
-
|
122
|
-
- name: Install Gazebo Sim
|
121
|
+
- name: Install 'gz sdf' system command
|
123
122
|
if: |
|
124
123
|
contains(matrix.os, 'ubuntu') &&
|
125
124
|
(github.event_name != 'pull_request' ||
|
@@ -130,7 +129,7 @@ jobs:
|
|
130
129
|
sudo wget https://packages.osrfoundation.org/gazebo.gpg -O /usr/share/keyrings/pkgs-osrf-archive-keyring.gpg
|
131
130
|
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/pkgs-osrf-archive-keyring.gpg] http://packages.osrfoundation.org/gazebo/ubuntu-stable $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/gazebo-stable.list > /dev/null
|
132
131
|
sudo apt-get update
|
133
|
-
sudo apt-get install gz-
|
132
|
+
sudo apt-get install --no-install-recommends libsdformat13 gz-tools2
|
134
133
|
|
135
134
|
- name: Run the Python tests
|
136
135
|
if: |
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: jaxsim
|
3
|
-
Version: 0.2.1.
|
3
|
+
Version: 0.2.1.dev155
|
4
4
|
Home-page: https://github.com/ami-iit/jaxsim
|
5
5
|
Author: Diego Ferigo
|
6
6
|
Author-email: diego.ferigo@iit.it
|
@@ -68,7 +68,7 @@ Requires-Dist: mujoco>=3.0.0; extra == "all"
|
|
68
68
|
|
69
69
|
JaxSim is a **differentiable physics engine** and **multibody dynamics library** designed for applications in control and robot learning, implemented with JAX.
|
70
70
|
|
71
|
-
Its design facilitates research and accelerates prototyping in the intersection of robotics and artificial intelligence.
|
71
|
+
Its design facilitates research and accelerates prototyping in the intersection of robotics and artificial intelligence.
|
72
72
|
|
73
73
|
## Features
|
74
74
|
|
@@ -91,7 +91,7 @@ Its design facilitates research and accelerates prototyping in the intersection
|
|
91
91
|
|
92
92
|
### JaxSim as a multibody dynamics library
|
93
93
|
|
94
|
-
- Provides rigid body dynamics algorithms (RBDAs) like RNEA, ABA, CRBA, and Jacobians.
|
94
|
+
- Provides rigid body dynamics algorithms (RBDAs) like RNEA, ABA, CRBA, and Jacobians.
|
95
95
|
- Provides all the quantities included in the Euler-Poincarè formulation of the equations of motion.
|
96
96
|
- Supports body-fixed, inertial-fixed, and mixed [velocity representations][notation].
|
97
97
|
- Exposes all the necessary quantities to develop controllers in centroidal coordinates.
|
@@ -198,10 +198,10 @@ The main differences between MJX/Brax and JaxSim are as follows:
|
|
198
198
|
|
199
199
|
- JaxSim supports out-of-the-box all SDF models with [Pose Frame Semantics][PFS].
|
200
200
|
- JaxSim only supports collisions between points rigidly attached to bodies and a compliant ground surface.
|
201
|
-
Our contact model requires careful tuning of its spring-damper parameters, but being an instantaneous
|
201
|
+
Our contact model requires careful tuning of its spring-damper parameters, but being an instantaneous
|
202
202
|
function of the state $(\mathbf{q}, \boldsymbol{\nu})$, it doesn't require running any optimization algorithm
|
203
203
|
when stepping the simulation forward.
|
204
|
-
- JaxSim mitigates the stiffness of the contact-aware system dynamics by providing variable-step integrators.
|
204
|
+
- JaxSim mitigates the stiffness of the contact-aware system dynamics by providing variable-step integrators.
|
205
205
|
|
206
206
|
[brax]: https://github.com/google/brax
|
207
207
|
[mjx]: https://mujoco.readthedocs.io/en/3.0.0/mjx.html
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
JaxSim is a **differentiable physics engine** and **multibody dynamics library** designed for applications in control and robot learning, implemented with JAX.
|
4
4
|
|
5
|
-
Its design facilitates research and accelerates prototyping in the intersection of robotics and artificial intelligence.
|
5
|
+
Its design facilitates research and accelerates prototyping in the intersection of robotics and artificial intelligence.
|
6
6
|
|
7
7
|
## Features
|
8
8
|
|
@@ -25,7 +25,7 @@ Its design facilitates research and accelerates prototyping in the intersection
|
|
25
25
|
|
26
26
|
### JaxSim as a multibody dynamics library
|
27
27
|
|
28
|
-
- Provides rigid body dynamics algorithms (RBDAs) like RNEA, ABA, CRBA, and Jacobians.
|
28
|
+
- Provides rigid body dynamics algorithms (RBDAs) like RNEA, ABA, CRBA, and Jacobians.
|
29
29
|
- Provides all the quantities included in the Euler-Poincarè formulation of the equations of motion.
|
30
30
|
- Supports body-fixed, inertial-fixed, and mixed [velocity representations][notation].
|
31
31
|
- Exposes all the necessary quantities to develop controllers in centroidal coordinates.
|
@@ -132,10 +132,10 @@ The main differences between MJX/Brax and JaxSim are as follows:
|
|
132
132
|
|
133
133
|
- JaxSim supports out-of-the-box all SDF models with [Pose Frame Semantics][PFS].
|
134
134
|
- JaxSim only supports collisions between points rigidly attached to bodies and a compliant ground surface.
|
135
|
-
Our contact model requires careful tuning of its spring-damper parameters, but being an instantaneous
|
135
|
+
Our contact model requires careful tuning of its spring-damper parameters, but being an instantaneous
|
136
136
|
function of the state $(\mathbf{q}, \boldsymbol{\nu})$, it doesn't require running any optimization algorithm
|
137
137
|
when stepping the simulation forward.
|
138
|
-
- JaxSim mitigates the stiffness of the contact-aware system dynamics by providing variable-step integrators.
|
138
|
+
- JaxSim mitigates the stiffness of the contact-aware system dynamics by providing variable-step integrators.
|
139
139
|
|
140
140
|
[brax]: https://github.com/google/brax
|
141
141
|
[mjx]: https://mujoco.readthedocs.io/en/3.0.0/mjx.html
|
@@ -8,8 +8,9 @@ def _jnp_options() -> None:
|
|
8
8
|
|
9
9
|
import jax
|
10
10
|
|
11
|
-
# Enable by default
|
12
|
-
if
|
11
|
+
# Enable by default 64bit precision in JAX.
|
12
|
+
if os.environ.get("JAX_ENABLE_X64", "1") != "0":
|
13
|
+
|
13
14
|
logging.info("Enabling JAX to use 64bit precision")
|
14
15
|
jax.config.update("jax_enable_x64", True)
|
15
16
|
|
@@ -27,6 +28,7 @@ def _np_options() -> None:
|
|
27
28
|
|
28
29
|
|
29
30
|
def _is_editable() -> bool:
|
31
|
+
|
30
32
|
import importlib.util
|
31
33
|
import pathlib
|
32
34
|
import site
|
@@ -45,11 +47,40 @@ def _is_editable() -> bool:
|
|
45
47
|
return jaxsim_package_dir not in site.getsitepackages()
|
46
48
|
|
47
49
|
|
48
|
-
|
49
|
-
|
50
|
-
logging
|
51
|
-
|
52
|
-
|
50
|
+
def _get_default_logging_level(env_var: str) -> logging.LoggingLevel:
|
51
|
+
"""
|
52
|
+
Get the default logging level.
|
53
|
+
|
54
|
+
Args:
|
55
|
+
env_var: The environment variable to check.
|
56
|
+
|
57
|
+
Returns:
|
58
|
+
The logging level to set.
|
59
|
+
"""
|
60
|
+
|
61
|
+
import os
|
62
|
+
|
63
|
+
# Define the default logging level depending on the installation mode.
|
64
|
+
default_logging_level = (
|
65
|
+
logging.LoggingLevel.DEBUG
|
66
|
+
if _is_editable() # noqa: F821
|
67
|
+
else logging.LoggingLevel.WARNING
|
68
|
+
)
|
69
|
+
|
70
|
+
# Allow to override the default logging level with an environment variable.
|
71
|
+
try:
|
72
|
+
return logging.LoggingLevel[
|
73
|
+
os.environ.get(env_var, default_logging_level.name).upper()
|
74
|
+
]
|
75
|
+
|
76
|
+
except KeyError as exc:
|
77
|
+
msg = f"Invalid logging level defined in {env_var}='{os.environ[env_var]}'"
|
78
|
+
raise RuntimeError(msg) from exc
|
79
|
+
|
80
|
+
|
81
|
+
# Configure the logger with the default logging level.
|
82
|
+
logging.configure(level=_get_default_logging_level(env_var="JAXSIM_LOGGING_LEVEL"))
|
83
|
+
|
53
84
|
|
54
85
|
# Configure JAX
|
55
86
|
_jnp_options()
|
@@ -59,6 +90,7 @@ _np_options()
|
|
59
90
|
|
60
91
|
del _jnp_options
|
61
92
|
del _np_options
|
93
|
+
del _get_default_logging_level
|
62
94
|
del _is_editable
|
63
95
|
|
64
96
|
from . import terrain # isort:skip
|
@@ -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.1.
|
16
|
-
__version_tuple__ = version_tuple = (0, 2, 1, '
|
15
|
+
__version__ = version = '0.2.1.dev155'
|
16
|
+
__version_tuple__ = version_tuple = (0, 2, 1, 'dev155')
|
@@ -365,20 +365,20 @@ def jacobian(
|
|
365
365
|
|
366
366
|
W_H_C = transforms(model=model, data=data)
|
367
367
|
|
368
|
-
def
|
368
|
+
def body_jacobian(W_H_C: jtp.Matrix, W_J_WC: jtp.Matrix) -> jtp.Matrix:
|
369
369
|
C_X_W = jaxsim.math.Adjoint.from_transform(
|
370
370
|
transform=W_H_C, inverse=True
|
371
371
|
)
|
372
372
|
C_J_WC = C_X_W @ W_J_WC
|
373
373
|
return C_J_WC
|
374
374
|
|
375
|
-
O_J_WC = jax.vmap(
|
375
|
+
O_J_WC = jax.vmap(body_jacobian)(W_H_C, W_J_WC)
|
376
376
|
|
377
377
|
case VelRepr.Mixed:
|
378
378
|
|
379
379
|
W_H_C = transforms(model=model, data=data)
|
380
380
|
|
381
|
-
def
|
381
|
+
def mixed_jacobian(W_H_C: jtp.Matrix, W_J_WC: jtp.Matrix) -> jtp.Matrix:
|
382
382
|
|
383
383
|
W_H_CW = W_H_C.at[0:3, 0:3].set(jnp.eye(3))
|
384
384
|
|
@@ -389,7 +389,7 @@ def jacobian(
|
|
389
389
|
CW_J_WC = CW_X_W @ W_J_WC
|
390
390
|
return CW_J_WC
|
391
391
|
|
392
|
-
O_J_WC = jax.vmap(
|
392
|
+
O_J_WC = jax.vmap(mixed_jacobian)(W_H_C, W_J_WC)
|
393
393
|
|
394
394
|
case _:
|
395
395
|
raise ValueError(output_vel_repr)
|
@@ -6,6 +6,7 @@ import jax.lax
|
|
6
6
|
import jax.numpy as jnp
|
7
7
|
import jax_dataclasses
|
8
8
|
import jaxlie
|
9
|
+
import numpy as np
|
9
10
|
from jax_dataclasses import Static
|
10
11
|
|
11
12
|
import jaxsim.typing as jtp
|
@@ -220,7 +221,9 @@ class KynDynParameters(JaxsimDataclass):
|
|
220
221
|
(
|
221
222
|
hash(self.number_of_links()),
|
222
223
|
hash(self.number_of_joints()),
|
223
|
-
hash(tuple(
|
224
|
+
hash(tuple(np.atleast_1d(self.parent_array).flatten().tolist())),
|
225
|
+
hash(self._parent_array),
|
226
|
+
hash(self._support_body_array_bool),
|
224
227
|
)
|
225
228
|
)
|
226
229
|
|
@@ -241,8 +241,8 @@ def jacobian(
|
|
241
241
|
)
|
242
242
|
|
243
243
|
# Compute the actual doubly-left free-floating jacobian of the link.
|
244
|
-
κ = model.kin_dyn_parameters.support_body_array_bool[link_index]
|
245
|
-
B_J_WL_B = jnp.hstack([jnp.ones(5), κ]) * B_J_full_WX_B
|
244
|
+
κb = model.kin_dyn_parameters.support_body_array_bool[link_index]
|
245
|
+
B_J_WL_B = jnp.hstack([jnp.ones(5), κb]) * B_J_full_WX_B
|
246
246
|
|
247
247
|
# Adjust the input representation such that `J_WL_I @ I_ν`.
|
248
248
|
match data.velocity_representation:
|
@@ -17,7 +17,7 @@ import jaxsim.api as js
|
|
17
17
|
import jaxsim.parsers.descriptions
|
18
18
|
import jaxsim.typing as jtp
|
19
19
|
from jaxsim.math import Cross
|
20
|
-
from jaxsim.utils import
|
20
|
+
from jaxsim.utils import JaxsimDataclass, Mutability
|
21
21
|
|
22
22
|
from .common import VelRepr
|
23
23
|
|
@@ -33,6 +33,7 @@ class JaxSimModel(JaxsimDataclass):
|
|
33
33
|
terrain: Static[jaxsim.terrain.Terrain] = dataclasses.field(
|
34
34
|
default=jaxsim.terrain.FlatTerrain(), repr=False, compare=False, hash=False
|
35
35
|
)
|
36
|
+
|
36
37
|
kin_dyn_parameters: js.kin_dyn_parameters.KynDynParameters | None = (
|
37
38
|
dataclasses.field(default=None, repr=False, compare=False, hash=False)
|
38
39
|
)
|
@@ -41,13 +42,9 @@ class JaxSimModel(JaxsimDataclass):
|
|
41
42
|
default=None, repr=False, compare=False, hash=False
|
42
43
|
)
|
43
44
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
@property
|
49
|
-
def description(self) -> jaxsim.parsers.descriptions.ModelDescription:
|
50
|
-
return self._description.get()
|
45
|
+
description: Static[jaxsim.parsers.descriptions.ModelDescription | None] = (
|
46
|
+
dataclasses.field(default=None, repr=False, compare=False, hash=False)
|
47
|
+
)
|
51
48
|
|
52
49
|
def __eq__(self, other: JaxSimModel) -> bool:
|
53
50
|
|
@@ -61,6 +58,7 @@ class JaxSimModel(JaxsimDataclass):
|
|
61
58
|
return hash(
|
62
59
|
(
|
63
60
|
hash(self.model_name),
|
61
|
+
hash(self.description),
|
64
62
|
hash(self.kin_dyn_parameters),
|
65
63
|
)
|
66
64
|
)
|
@@ -157,7 +155,7 @@ class JaxSimModel(JaxsimDataclass):
|
|
157
155
|
# Build the model
|
158
156
|
model = JaxSimModel(
|
159
157
|
model_name=model_name,
|
160
|
-
|
158
|
+
description=model_description,
|
161
159
|
kin_dyn_parameters=js.kin_dyn_parameters.KynDynParameters.build(
|
162
160
|
model_description=model_description
|
163
161
|
),
|
@@ -302,7 +300,7 @@ def reduce(
|
|
302
300
|
locked_joint_positions:
|
303
301
|
A dictionary containing the positions of the joints to be considered
|
304
302
|
in the reduction process. The removed joints in the reduced model
|
305
|
-
will have their position locked to their value
|
303
|
+
will have their position locked to their value of this dictionary.
|
306
304
|
If a joint is not part of the dictionary, its position is set to zero.
|
307
305
|
"""
|
308
306
|
|
@@ -315,10 +313,9 @@ def reduce(
|
|
315
313
|
new_joints = set(model.joint_names()) - set(locked_joint_positions)
|
316
314
|
raise ValueError(f"Passed joints not existing in the model: {new_joints}")
|
317
315
|
|
318
|
-
#
|
319
|
-
|
320
|
-
|
321
|
-
)
|
316
|
+
# Operate on a deep copy of the model description in order to prevent problems
|
317
|
+
# when mutable attributes are updated.
|
318
|
+
intermediate_description = copy.deepcopy(model.description)
|
322
319
|
|
323
320
|
# Update the initial position of the joints.
|
324
321
|
# This is necessary to compute the correct pose of the link pairs connected
|
@@ -686,8 +683,6 @@ def forward_dynamics_aba(
|
|
686
683
|
another representation C_v̇_WB expressed in a generic frame C.
|
687
684
|
"""
|
688
685
|
|
689
|
-
from jaxsim.math import Cross
|
690
|
-
|
691
686
|
# In Mixed representation, we need to include a cross product in ℝ⁶.
|
692
687
|
# In Inertial and Body representations, the cross product is always zero.
|
693
688
|
C_X_W = jaxlie.SE3.from_matrix(W_H_C).inverse().adjoint()
|
@@ -1483,12 +1478,7 @@ def link_bias_accelerations(
|
|
1483
1478
|
# ================================================
|
1484
1479
|
|
1485
1480
|
# Compute the base transform.
|
1486
|
-
W_H_B =
|
1487
|
-
rotation=jaxlie.SO3.from_quaternion_xyzw(
|
1488
|
-
xyzw=jaxsim.math.Quaternion.to_xyzw(wxyz=data.base_orientation())
|
1489
|
-
),
|
1490
|
-
translation=data.base_position(),
|
1491
|
-
).as_matrix()
|
1481
|
+
W_H_B = data.base_transform()
|
1492
1482
|
|
1493
1483
|
def other_representation_to_inertial(
|
1494
1484
|
C_v̇_WB: jtp.Vector, C_v_WB: jtp.Vector, W_H_C: jtp.Matrix, W_v_WC: jtp.Vector
|
@@ -1529,9 +1519,12 @@ def link_bias_accelerations(
|
|
1529
1519
|
W_H_C = W_H_BW
|
1530
1520
|
with data.switch_velocity_representation(VelRepr.Mixed):
|
1531
1521
|
W_ṗ_B = data.base_velocity()[0:3]
|
1532
|
-
|
1522
|
+
BW_v_W_BW = jnp.zeros(6).at[0:3].set(W_ṗ_B)
|
1523
|
+
W_X_BW = jaxsim.math.Adjoint.from_transform(transform=W_H_BW)
|
1524
|
+
W_v_WC = W_v_W_BW = W_X_BW @ BW_v_W_BW
|
1533
1525
|
with data.switch_velocity_representation(VelRepr.Mixed):
|
1534
1526
|
C_v_WB = BW_v_WB = data.base_velocity()
|
1527
|
+
|
1535
1528
|
case _:
|
1536
1529
|
raise ValueError(data.velocity_representation)
|
1537
1530
|
|
@@ -223,7 +223,9 @@ def system_velocity_dynamics(
|
|
223
223
|
|
224
224
|
@jax.jit
|
225
225
|
def system_position_dynamics(
|
226
|
-
model: js.model.JaxSimModel,
|
226
|
+
model: js.model.JaxSimModel,
|
227
|
+
data: js.data.JaxSimModelData,
|
228
|
+
baumgarte_quaternion_regularization: jtp.FloatLike = 1.0,
|
227
229
|
) -> tuple[jtp.Vector, jtp.Vector, jtp.Vector]:
|
228
230
|
"""
|
229
231
|
Compute the dynamics of the system position.
|
@@ -231,6 +233,8 @@ def system_position_dynamics(
|
|
231
233
|
Args:
|
232
234
|
model: The model to consider.
|
233
235
|
data: The data of the considered model.
|
236
|
+
baumgarte_quaternion_regularization:
|
237
|
+
The Baumgarte regularization coefficient for adjusting the quaternion norm.
|
234
238
|
|
235
239
|
Returns:
|
236
240
|
A tuple containing the derivative of the base position, the derivative of the
|
@@ -250,6 +254,7 @@ def system_position_dynamics(
|
|
250
254
|
quaternion=W_Q_B,
|
251
255
|
omega=W_ω_WB,
|
252
256
|
omega_in_body_fixed=False,
|
257
|
+
K=baumgarte_quaternion_regularization,
|
253
258
|
).squeeze()
|
254
259
|
|
255
260
|
return W_ṗ_B, W_Q̇_B, ṡ
|
@@ -262,6 +267,7 @@ def system_dynamics(
|
|
262
267
|
*,
|
263
268
|
joint_forces: jtp.Vector | None = None,
|
264
269
|
link_forces: jtp.Vector | None = None,
|
270
|
+
baumgarte_quaternion_regularization: jtp.FloatLike = 1.0,
|
265
271
|
) -> tuple[ODEState, dict[str, Any]]:
|
266
272
|
"""
|
267
273
|
Compute the dynamics of the system.
|
@@ -271,6 +277,9 @@ def system_dynamics(
|
|
271
277
|
data: The data of the considered model.
|
272
278
|
joint_forces: The joint forces to apply.
|
273
279
|
link_forces: The 6D forces to apply to the links.
|
280
|
+
baumgarte_quaternion_regularization:
|
281
|
+
The Baumgarte regularization coefficient used to adjust the norm of the
|
282
|
+
quaternion (only used in integrators not operating on the SO(3) manifold).
|
274
283
|
|
275
284
|
Returns:
|
276
285
|
A tuple with an `ODEState` object storing in each of its attributes the
|
@@ -287,7 +296,11 @@ def system_dynamics(
|
|
287
296
|
)
|
288
297
|
|
289
298
|
# Extract the velocities.
|
290
|
-
W_ṗ_B, W_Q̇_B, ṡ = system_position_dynamics(
|
299
|
+
W_ṗ_B, W_Q̇_B, ṡ = system_position_dynamics(
|
300
|
+
model=model,
|
301
|
+
data=data,
|
302
|
+
baumgarte_quaternion_regularization=baumgarte_quaternion_regularization,
|
303
|
+
)
|
291
304
|
|
292
305
|
# Create an ODEState object populated with the derivative of each leaf.
|
293
306
|
# Our integrators, operating on generic pytrees, will be able to handle it
|
@@ -34,8 +34,8 @@ class JointModel:
|
|
34
34
|
already in a vectorized form. In other words, it cannot be created using vmap.
|
35
35
|
"""
|
36
36
|
|
37
|
-
λ_H_pre:
|
38
|
-
suc_H_i:
|
37
|
+
λ_H_pre: jtp.Array
|
38
|
+
suc_H_i: jtp.Array
|
39
39
|
|
40
40
|
joint_dofs: Static[tuple[int, ...]]
|
41
41
|
joint_names: Static[tuple[str, ...]]
|
@@ -188,10 +188,9 @@ class RodModelToMjcf:
|
|
188
188
|
)
|
189
189
|
|
190
190
|
# If considered joints are passed, make sure that they are all part of the model.
|
191
|
-
if considered_joints -
|
192
|
-
extra_joints = set(considered_joints) -
|
193
|
-
|
194
|
-
)
|
191
|
+
if considered_joints - {j.name for j in rod_model.joints()}:
|
192
|
+
extra_joints = set(considered_joints) - {j.name for j in rod_model.joints()}
|
193
|
+
|
195
194
|
msg = f"Couldn't find the following joints in the model: '{extra_joints}'"
|
196
195
|
raise ValueError(msg)
|
197
196
|
|
@@ -352,7 +351,7 @@ class RodModelToMjcf:
|
|
352
351
|
# Set alpha=0 to the color of all collision elements
|
353
352
|
for geometry_element in mujoco_element.findall(".//geom[@rgba]"):
|
354
353
|
if geometry_element.attrib.get("name") in collision_names:
|
355
|
-
r, g, b,
|
354
|
+
r, g, b, _ = geometry_element.attrib["rgba"].split(" ")
|
356
355
|
geometry_element.set("rgba", f"{r} {g} {b} 0")
|
357
356
|
|
358
357
|
# -----------------------
|
@@ -73,7 +73,7 @@ class MujocoModelHelper:
|
|
73
73
|
new_hfield = generate_hfield(heightmap, (nrow, ncol))
|
74
74
|
model.hfield_data = new_hfield
|
75
75
|
|
76
|
-
return MujocoModelHelper(model=model, data=
|
76
|
+
return MujocoModelHelper(model=model, data=data)
|
77
77
|
|
78
78
|
def time(self) -> float:
|
79
79
|
"""Return the simulation time."""
|
@@ -1,11 +1,13 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
1
3
|
import abc
|
2
4
|
import dataclasses
|
3
|
-
from typing import List
|
4
5
|
|
5
6
|
import jax.numpy as jnp
|
6
7
|
import numpy as np
|
7
8
|
import numpy.typing as npt
|
8
9
|
|
10
|
+
import jaxsim.typing as jtp
|
9
11
|
from jaxsim import logging
|
10
12
|
|
11
13
|
from .link import LinkDescription
|
@@ -17,9 +19,9 @@ class CollidablePoint:
|
|
17
19
|
Represents a collidable point associated with a parent link.
|
18
20
|
|
19
21
|
Attributes:
|
20
|
-
parent_link
|
21
|
-
position
|
22
|
-
enabled
|
22
|
+
parent_link: The parent link to which the collidable point is attached.
|
23
|
+
position: The position of the collidable point relative to the parent link.
|
24
|
+
enabled: A flag indicating whether the collidable point is enabled for collision detection.
|
23
25
|
|
24
26
|
"""
|
25
27
|
|
@@ -29,7 +31,7 @@ class CollidablePoint:
|
|
29
31
|
|
30
32
|
def change_link(
|
31
33
|
self, new_link: LinkDescription, new_H_old: npt.NDArray
|
32
|
-
) ->
|
34
|
+
) -> CollidablePoint:
|
33
35
|
"""
|
34
36
|
Move the collidable point to a new parent link.
|
35
37
|
|
@@ -39,8 +41,8 @@ class CollidablePoint:
|
|
39
41
|
|
40
42
|
Returns:
|
41
43
|
CollidablePoint: A new collidable point associated with the new parent link.
|
42
|
-
|
43
44
|
"""
|
45
|
+
|
44
46
|
msg = f"Moving collidable point: {self.parent_link.name} -> {new_link.name}"
|
45
47
|
logging.debug(msg=msg)
|
46
48
|
|
@@ -50,15 +52,24 @@ class CollidablePoint:
|
|
50
52
|
enabled=self.enabled,
|
51
53
|
)
|
52
54
|
|
53
|
-
def
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
55
|
+
def __hash__(self) -> int:
|
56
|
+
|
57
|
+
return hash(
|
58
|
+
(
|
59
|
+
hash(self.parent_link),
|
60
|
+
hash(tuple(self.position.tolist())),
|
61
|
+
hash(self.enabled),
|
62
|
+
)
|
58
63
|
)
|
59
|
-
return retval
|
60
64
|
|
61
|
-
def
|
65
|
+
def __eq__(self, other: CollidablePoint) -> bool:
|
66
|
+
|
67
|
+
if not isinstance(other, CollidablePoint):
|
68
|
+
return False
|
69
|
+
|
70
|
+
return hash(self) == hash(other)
|
71
|
+
|
72
|
+
def __str__(self) -> str:
|
62
73
|
return (
|
63
74
|
f"{self.__class__.__name__}("
|
64
75
|
+ f"parent_link={self.parent_link.name}"
|
@@ -74,11 +85,11 @@ class CollisionShape(abc.ABC):
|
|
74
85
|
Abstract base class for representing collision shapes.
|
75
86
|
|
76
87
|
Attributes:
|
77
|
-
collidable_points
|
88
|
+
collidable_points: A list of collidable points associated with the collision shape.
|
78
89
|
|
79
90
|
"""
|
80
91
|
|
81
|
-
collidable_points:
|
92
|
+
collidable_points: tuple[CollidablePoint]
|
82
93
|
|
83
94
|
def __str__(self):
|
84
95
|
return (
|
@@ -95,14 +106,26 @@ class BoxCollision(CollisionShape):
|
|
95
106
|
Represents a box-shaped collision shape.
|
96
107
|
|
97
108
|
Attributes:
|
98
|
-
center
|
109
|
+
center: The center of the box in the local frame of the collision shape.
|
99
110
|
|
100
111
|
"""
|
101
112
|
|
102
|
-
center:
|
113
|
+
center: jtp.VectorLike
|
103
114
|
|
104
|
-
def
|
105
|
-
return (
|
115
|
+
def __hash__(self) -> int:
|
116
|
+
return hash(
|
117
|
+
(
|
118
|
+
hash(super()),
|
119
|
+
hash(tuple(self.center.tolist())),
|
120
|
+
)
|
121
|
+
)
|
122
|
+
|
123
|
+
def __eq__(self, other: BoxCollision) -> bool:
|
124
|
+
|
125
|
+
if not isinstance(other, BoxCollision):
|
126
|
+
return False
|
127
|
+
|
128
|
+
return hash(self) == hash(other)
|
106
129
|
|
107
130
|
|
108
131
|
@dataclasses.dataclass
|
@@ -111,11 +134,23 @@ class SphereCollision(CollisionShape):
|
|
111
134
|
Represents a spherical collision shape.
|
112
135
|
|
113
136
|
Attributes:
|
114
|
-
center
|
137
|
+
center: The center of the sphere in the local frame of the collision shape.
|
115
138
|
|
116
139
|
"""
|
117
140
|
|
118
|
-
center:
|
141
|
+
center: jtp.VectorLike
|
142
|
+
|
143
|
+
def __hash__(self) -> int:
|
144
|
+
return hash(
|
145
|
+
(
|
146
|
+
hash(super()),
|
147
|
+
hash(tuple(self.center.tolist())),
|
148
|
+
)
|
149
|
+
)
|
150
|
+
|
151
|
+
def __eq__(self, other: BoxCollision) -> bool:
|
152
|
+
|
153
|
+
if not isinstance(other, BoxCollision):
|
154
|
+
return False
|
119
155
|
|
120
|
-
|
121
|
-
return (self.center == other.center).all() and super().__eq__(other)
|
156
|
+
return hash(self) == hash(other)
|