jaxsim 0.1.dev401__tar.gz → 0.2.0__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 (169) hide show
  1. jaxsim-0.2.0/.devcontainer/Dockerfile +26 -0
  2. jaxsim-0.2.0/.devcontainer/devcontainer.json +34 -0
  3. jaxsim-0.2.0/.github/CODEOWNERS +2 -0
  4. {jaxsim-0.1.dev401 → jaxsim-0.2.0}/.github/workflows/ci_cd.yml +42 -4
  5. jaxsim-0.2.0/.github/workflows/read_the_docs.yml +18 -0
  6. {jaxsim-0.1.dev401 → jaxsim-0.2.0}/.github/workflows/style.yml +23 -10
  7. {jaxsim-0.1.dev401 → jaxsim-0.2.0}/.gitignore +3 -0
  8. jaxsim-0.2.0/.pre-commit-config.yaml +26 -0
  9. {jaxsim-0.1.dev401 → jaxsim-0.2.0}/.readthedocs.yaml +4 -4
  10. jaxsim-0.2.0/CONTRIBUTING.md +74 -0
  11. {jaxsim-0.1.dev401 → jaxsim-0.2.0}/LICENSE +1 -1
  12. jaxsim-0.2.0/PKG-INFO +237 -0
  13. jaxsim-0.2.0/README.md +171 -0
  14. {jaxsim-0.1.dev401 → jaxsim-0.2.0}/docs/conf.py +17 -6
  15. {jaxsim-0.1.dev401 → jaxsim-0.2.0}/docs/guide/install.rst +9 -2
  16. {jaxsim-0.1.dev401 → jaxsim-0.2.0}/docs/index.rst +64 -48
  17. jaxsim-0.2.0/docs/modules/api.rst +68 -0
  18. jaxsim-0.2.0/docs/modules/index.rst +19 -0
  19. jaxsim-0.2.0/docs/modules/integrators.rst +23 -0
  20. jaxsim-0.2.0/docs/modules/math.rst +28 -0
  21. jaxsim-0.2.0/docs/modules/mujoco.rst +27 -0
  22. {jaxsim-0.1.dev401 → jaxsim-0.2.0}/docs/modules/parsers.rst +1 -4
  23. jaxsim-0.2.0/docs/modules/rbda.rst +59 -0
  24. jaxsim-0.2.0/docs/modules/typing.rst +17 -0
  25. {jaxsim-0.1.dev401 → jaxsim-0.2.0}/docs/modules/utils.rst +1 -4
  26. jaxsim-0.2.0/environment.yml +58 -0
  27. {jaxsim-0.1.dev401 → jaxsim-0.2.0}/examples/.gitattributes +0 -1
  28. {jaxsim-0.1.dev401 → jaxsim-0.2.0}/examples/.gitignore +0 -1
  29. {jaxsim-0.1.dev401 → jaxsim-0.2.0}/examples/PD_controller.ipynb +130 -121
  30. {jaxsim-0.1.dev401 → jaxsim-0.2.0}/examples/Parallel_computing.ipynb +74 -63
  31. {jaxsim-0.1.dev401 → jaxsim-0.2.0}/examples/README.md +3 -3
  32. jaxsim-0.2.0/examples/assets/cartpole.urdf +83 -0
  33. jaxsim-0.2.0/pyproject.toml +69 -0
  34. {jaxsim-0.1.dev401 → jaxsim-0.2.0}/setup.cfg +13 -6
  35. {jaxsim-0.1.dev401 → jaxsim-0.2.0}/src/jaxsim/__init__.py +5 -6
  36. {jaxsim-0.1.dev401 → jaxsim-0.2.0}/src/jaxsim/_version.py +2 -2
  37. jaxsim-0.2.0/src/jaxsim/api/__init__.py +3 -0
  38. jaxsim-0.2.0/src/jaxsim/api/com.py +240 -0
  39. jaxsim-0.2.0/src/jaxsim/api/common.py +216 -0
  40. jaxsim-0.2.0/src/jaxsim/api/contact.py +271 -0
  41. jaxsim-0.2.0/src/jaxsim/api/data.py +821 -0
  42. jaxsim-0.2.0/src/jaxsim/api/joint.py +189 -0
  43. jaxsim-0.2.0/src/jaxsim/api/kin_dyn_parameters.py +777 -0
  44. jaxsim-0.2.0/src/jaxsim/api/link.py +361 -0
  45. jaxsim-0.2.0/src/jaxsim/api/model.py +1633 -0
  46. jaxsim-0.2.0/src/jaxsim/api/ode.py +295 -0
  47. jaxsim-0.2.0/src/jaxsim/api/ode_data.py +694 -0
  48. jaxsim-0.2.0/src/jaxsim/api/references.py +421 -0
  49. jaxsim-0.2.0/src/jaxsim/integrators/__init__.py +2 -0
  50. jaxsim-0.2.0/src/jaxsim/integrators/common.py +594 -0
  51. jaxsim-0.2.0/src/jaxsim/integrators/fixed_step.py +102 -0
  52. jaxsim-0.2.0/src/jaxsim/integrators/variable_step.py +610 -0
  53. jaxsim-0.2.0/src/jaxsim/math/__init__.py +11 -0
  54. {jaxsim-0.1.dev401 → jaxsim-0.2.0}/src/jaxsim/math/adjoint.py +24 -2
  55. jaxsim-0.2.0/src/jaxsim/math/joint_model.py +335 -0
  56. {jaxsim-0.1.dev401 → jaxsim-0.2.0}/src/jaxsim/math/quaternion.py +44 -3
  57. {jaxsim-0.1.dev401 → jaxsim-0.2.0}/src/jaxsim/math/rotation.py +4 -4
  58. jaxsim-0.2.0/src/jaxsim/math/transform.py +92 -0
  59. jaxsim-0.2.0/src/jaxsim/mujoco/__init__.py +3 -0
  60. jaxsim-0.2.0/src/jaxsim/mujoco/__main__.py +192 -0
  61. jaxsim-0.2.0/src/jaxsim/mujoco/loaders.py +615 -0
  62. jaxsim-0.2.0/src/jaxsim/mujoco/model.py +414 -0
  63. jaxsim-0.2.0/src/jaxsim/mujoco/visualizer.py +176 -0
  64. {jaxsim-0.1.dev401 → jaxsim-0.2.0}/src/jaxsim/parsers/descriptions/collision.py +14 -0
  65. {jaxsim-0.1.dev401 → jaxsim-0.2.0}/src/jaxsim/parsers/descriptions/link.py +13 -2
  66. {jaxsim-0.1.dev401 → jaxsim-0.2.0}/src/jaxsim/parsers/kinematic_graph.py +8 -3
  67. {jaxsim-0.1.dev401 → jaxsim-0.2.0}/src/jaxsim/parsers/rod/parser.py +54 -38
  68. {jaxsim-0.1.dev401 → jaxsim-0.2.0}/src/jaxsim/parsers/rod/utils.py +7 -8
  69. jaxsim-0.2.0/src/jaxsim/rbda/__init__.py +7 -0
  70. jaxsim-0.2.0/src/jaxsim/rbda/aba.py +295 -0
  71. jaxsim-0.2.0/src/jaxsim/rbda/collidable_points.py +142 -0
  72. {jaxsim-0.1.dev401/src/jaxsim/physics/algos → jaxsim-0.2.0/src/jaxsim/rbda}/crba.py +43 -42
  73. jaxsim-0.2.0/src/jaxsim/rbda/forward_kinematics.py +113 -0
  74. jaxsim-0.2.0/src/jaxsim/rbda/jacobian.py +201 -0
  75. jaxsim-0.2.0/src/jaxsim/rbda/rnea.py +237 -0
  76. jaxsim-0.2.0/src/jaxsim/rbda/soft_contacts.py +296 -0
  77. jaxsim-0.2.0/src/jaxsim/rbda/utils.py +152 -0
  78. jaxsim-0.2.0/src/jaxsim/terrain/__init__.py +2 -0
  79. {jaxsim-0.1.dev401/src/jaxsim/physics/algos → jaxsim-0.2.0/src/jaxsim/terrain}/terrain.py +4 -6
  80. jaxsim-0.2.0/src/jaxsim/typing.py +39 -0
  81. {jaxsim-0.1.dev401 → jaxsim-0.2.0}/src/jaxsim/utils/__init__.py +1 -4
  82. jaxsim-0.2.0/src/jaxsim/utils/hashless.py +18 -0
  83. jaxsim-0.2.0/src/jaxsim/utils/jaxsim_dataclass.py +359 -0
  84. jaxsim-0.2.0/src/jaxsim.egg-info/PKG-INFO +237 -0
  85. jaxsim-0.2.0/src/jaxsim.egg-info/SOURCES.txt +114 -0
  86. {jaxsim-0.1.dev401 → jaxsim-0.2.0}/src/jaxsim.egg-info/requires.txt +17 -6
  87. jaxsim-0.2.0/tests/conftest.py +361 -0
  88. jaxsim-0.2.0/tests/test_api_com.py +63 -0
  89. jaxsim-0.2.0/tests/test_api_data.py +145 -0
  90. jaxsim-0.2.0/tests/test_api_joint.py +34 -0
  91. jaxsim-0.2.0/tests/test_api_link.py +191 -0
  92. jaxsim-0.2.0/tests/test_api_model.py +326 -0
  93. jaxsim-0.2.0/tests/test_automatic_differentiation.py +430 -0
  94. jaxsim-0.2.0/tests/test_pytree.py +59 -0
  95. jaxsim-0.2.0/tests/test_simulations.py +92 -0
  96. {jaxsim-0.1.dev401 → jaxsim-0.2.0}/tests/utils_idyntree.py +186 -15
  97. jaxsim-0.1.dev401/PKG-INFO +0 -167
  98. jaxsim-0.1.dev401/README.md +0 -110
  99. jaxsim-0.1.dev401/docs/jaxsim_conda_env.yml +0 -21
  100. jaxsim-0.1.dev401/docs/modules/high_level.rst +0 -17
  101. jaxsim-0.1.dev401/docs/modules/math.rst +0 -41
  102. jaxsim-0.1.dev401/docs/modules/physics.rst +0 -56
  103. jaxsim-0.1.dev401/docs/modules/simulation.rst +0 -15
  104. jaxsim-0.1.dev401/docs/modules/typing.rst +0 -34
  105. jaxsim-0.1.dev401/examples/assets/cartpole.urdf +0 -83
  106. jaxsim-0.1.dev401/pyproject.toml +0 -25
  107. jaxsim-0.1.dev401/src/jaxsim/high_level/__init__.py +0 -2
  108. jaxsim-0.1.dev401/src/jaxsim/high_level/common.py +0 -11
  109. jaxsim-0.1.dev401/src/jaxsim/high_level/joint.py +0 -148
  110. jaxsim-0.1.dev401/src/jaxsim/high_level/link.py +0 -259
  111. jaxsim-0.1.dev401/src/jaxsim/high_level/model.py +0 -1695
  112. jaxsim-0.1.dev401/src/jaxsim/math/conv.py +0 -114
  113. jaxsim-0.1.dev401/src/jaxsim/math/joint.py +0 -101
  114. jaxsim-0.1.dev401/src/jaxsim/math/plucker.py +0 -100
  115. jaxsim-0.1.dev401/src/jaxsim/physics/__init__.py +0 -12
  116. jaxsim-0.1.dev401/src/jaxsim/physics/algos/__init__.py +0 -0
  117. jaxsim-0.1.dev401/src/jaxsim/physics/algos/aba.py +0 -256
  118. jaxsim-0.1.dev401/src/jaxsim/physics/algos/aba_motors.py +0 -284
  119. jaxsim-0.1.dev401/src/jaxsim/physics/algos/forward_kinematics.py +0 -79
  120. jaxsim-0.1.dev401/src/jaxsim/physics/algos/jacobian.py +0 -98
  121. jaxsim-0.1.dev401/src/jaxsim/physics/algos/rnea.py +0 -180
  122. jaxsim-0.1.dev401/src/jaxsim/physics/algos/rnea_motors.py +0 -196
  123. jaxsim-0.1.dev401/src/jaxsim/physics/algos/soft_contacts.py +0 -454
  124. jaxsim-0.1.dev401/src/jaxsim/physics/algos/utils.py +0 -69
  125. jaxsim-0.1.dev401/src/jaxsim/physics/model/__init__.py +0 -0
  126. jaxsim-0.1.dev401/src/jaxsim/physics/model/ground_contact.py +0 -55
  127. jaxsim-0.1.dev401/src/jaxsim/physics/model/physics_model.py +0 -358
  128. jaxsim-0.1.dev401/src/jaxsim/physics/model/physics_model_state.py +0 -174
  129. jaxsim-0.1.dev401/src/jaxsim/simulation/__init__.py +0 -4
  130. jaxsim-0.1.dev401/src/jaxsim/simulation/integrators.py +0 -452
  131. jaxsim-0.1.dev401/src/jaxsim/simulation/ode.py +0 -290
  132. jaxsim-0.1.dev401/src/jaxsim/simulation/ode_data.py +0 -53
  133. jaxsim-0.1.dev401/src/jaxsim/simulation/ode_integration.py +0 -125
  134. jaxsim-0.1.dev401/src/jaxsim/simulation/simulator.py +0 -544
  135. jaxsim-0.1.dev401/src/jaxsim/simulation/simulator_callbacks.py +0 -53
  136. jaxsim-0.1.dev401/src/jaxsim/simulation/utils.py +0 -15
  137. jaxsim-0.1.dev401/src/jaxsim/sixd/__init__.py +0 -2
  138. jaxsim-0.1.dev401/src/jaxsim/typing.py +0 -39
  139. jaxsim-0.1.dev401/src/jaxsim/utils/jaxsim_dataclass.py +0 -109
  140. jaxsim-0.1.dev401/src/jaxsim/utils/oop.py +0 -532
  141. jaxsim-0.1.dev401/src/jaxsim/utils/vmappable.py +0 -117
  142. jaxsim-0.1.dev401/src/jaxsim.egg-info/PKG-INFO +0 -167
  143. jaxsim-0.1.dev401/src/jaxsim.egg-info/SOURCES.txt +0 -103
  144. jaxsim-0.1.dev401/tests/__init__.py +0 -0
  145. jaxsim-0.1.dev401/tests/test_ad_physics.py +0 -190
  146. jaxsim-0.1.dev401/tests/test_eom.py +0 -130
  147. jaxsim-0.1.dev401/tests/test_forward_dynamics.py +0 -71
  148. jaxsim-0.1.dev401/tests/test_jax_oop.py +0 -422
  149. jaxsim-0.1.dev401/tests/utils_models.py +0 -56
  150. jaxsim-0.1.dev401/tests/utils_rng.py +0 -96
  151. {jaxsim-0.1.dev401 → jaxsim-0.2.0}/docs/Makefile +0 -0
  152. {jaxsim-0.1.dev401 → jaxsim-0.2.0}/docs/make.bat +0 -0
  153. {jaxsim-0.1.dev401 → jaxsim-0.2.0}/examples/pixi.lock +0 -0
  154. {jaxsim-0.1.dev401 → jaxsim-0.2.0}/examples/pixi.toml +0 -0
  155. {jaxsim-0.1.dev401 → jaxsim-0.2.0}/setup.py +0 -0
  156. {jaxsim-0.1.dev401 → jaxsim-0.2.0}/src/jaxsim/logging.py +0 -0
  157. {jaxsim-0.1.dev401 → jaxsim-0.2.0}/src/jaxsim/math/cross.py +0 -0
  158. {jaxsim-0.1.dev401 → jaxsim-0.2.0}/src/jaxsim/math/inertia.py +0 -0
  159. {jaxsim-0.1.dev401 → jaxsim-0.2.0}/src/jaxsim/math/skew.py +0 -0
  160. {jaxsim-0.1.dev401 → jaxsim-0.2.0}/src/jaxsim/parsers/__init__.py +0 -0
  161. {jaxsim-0.1.dev401 → jaxsim-0.2.0}/src/jaxsim/parsers/descriptions/__init__.py +0 -0
  162. {jaxsim-0.1.dev401 → jaxsim-0.2.0}/src/jaxsim/parsers/descriptions/joint.py +0 -0
  163. {jaxsim-0.1.dev401 → jaxsim-0.2.0}/src/jaxsim/parsers/descriptions/model.py +0 -0
  164. {jaxsim-0.1.dev401 → jaxsim-0.2.0}/src/jaxsim/parsers/rod/__init__.py +0 -0
  165. {jaxsim-0.1.dev401 → jaxsim-0.2.0}/src/jaxsim/utils/tracing.py +0 -0
  166. {jaxsim-0.1.dev401 → jaxsim-0.2.0}/src/jaxsim.egg-info/dependency_links.txt +0 -0
  167. {jaxsim-0.1.dev401 → jaxsim-0.2.0}/src/jaxsim.egg-info/not-zip-safe +0 -0
  168. {jaxsim-0.1.dev401 → jaxsim-0.2.0}/src/jaxsim.egg-info/top_level.txt +0 -0
  169. {jaxsim-0.1.dev401/src/jaxsim/math → jaxsim-0.2.0/tests}/__init__.py +0 -0
@@ -0,0 +1,26 @@
1
+ FROM mcr.microsoft.com/devcontainers/base:ubuntu
2
+ COPY environment.yml /opt/environment.yml
3
+
4
+ # Enable by default the conda environment for all users.
5
+ # The prefix is the one used by the micromamba feature.
6
+ ENV CONDA_PREFIX_JAXSIM=/opt/conda/envs/jaxsim
7
+ RUN echo 'function activate_conda() {' >> /etc/bash.bashrc &&\
8
+ echo ' eval "$(micromamba shell hook -s bash)"' >> /etc/bash.bashrc &&\
9
+ echo ' micromamba activate ${CONDA_PREFIX_JAXSIM-$CONDA_PREFIX}' >> /etc/bash.bashrc &&\
10
+ echo '}' >> /etc/bash.bashrc &&\
11
+ echo '[[ -x $(which micromamba) && -d ${CONDA_PREFIX_JAXSIM-$CONDA_PREFIX} ]] && activate_conda' >> /etc/bash.bashrc &&\
12
+ echo '[[ -x $(which micromamba) && ! -x $(which mamba) ]] && alias mamba="$(which micromamba)"' >> /etc/bash.bashrc &&\
13
+ echo '[[ -x $(which micromamba) && ! -x $(which conda) ]] && alias conda="$(which micromamba)"' >> /etc/bash.bashrc
14
+
15
+ # Provide libGL.so.1 from the host OS
16
+ RUN sudo apt-get update &&\
17
+ sudo apt-get install -y --no-install-recommends libgl1 &&\
18
+ rm -rf /var/lib/apt/lists/*
19
+
20
+ # The Python extension in VSCode is not able to detect the interpreter installed with micromamba.
21
+ # As documented as follows, we provide a suggestion through an environment variable.
22
+ # https://code.visualstudio.com/docs/python/environments#_where-the-extension-looks-for-environments
23
+ ENV WORKON_HOME=$CONDA_PREFIX_JAXSIM
24
+
25
+ # Specify the workdir of the container
26
+ WORKDIR /workspace/jaxsim
@@ -0,0 +1,34 @@
1
+ // For format details, see https://aka.ms/devcontainer.json. For config options, see the
2
+ // README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu
3
+ {
4
+ "name": "Ubuntu",
5
+ // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
6
+ "build": {
7
+ "context": "..",
8
+ "dockerfile": "Dockerfile",
9
+ },
10
+
11
+ // Features to add to the dev container. More info: https://containers.dev/features.
12
+ "features": {
13
+ "ghcr.io/mamba-org/devcontainer-features/micromamba:1": {
14
+ "envFile": "/opt/environment.yml",
15
+ },
16
+ },
17
+
18
+ // Use 'forwardPorts' to make a list of ports inside the container available locally.
19
+ // "forwardPorts": [],
20
+
21
+ // Use 'postCreateCommand' to run commands after the container is created.
22
+ // "postCreateCommand": "uname -a",
23
+
24
+ // Configure tool-specific properties.
25
+ // "customizations": {},
26
+
27
+ // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
28
+ // "remoteUser": "root"
29
+
30
+ // VSCode extensions
31
+ "extensions": [
32
+ "ms-python.python",
33
+ ],
34
+ }
@@ -0,0 +1,2 @@
1
+ * @diegoferigo @flferretti
2
+ *.ipynb @flferretti
@@ -1,11 +1,17 @@
1
1
  name: Python CI/CD
2
2
 
3
3
  on:
4
+ workflow_dispatch:
4
5
  push:
5
6
  pull_request:
6
7
  release:
7
8
  types:
8
9
  - published
10
+ schedule:
11
+ # * is a special character in YAML so you have to quote this string
12
+ # Execute a "nightly" build at 2 AM UTC
13
+ - cron: '0 2 * * *'
14
+
9
15
 
10
16
  jobs:
11
17
 
@@ -83,6 +89,10 @@ jobs:
83
89
  shell: bash
84
90
  run: pip install "$(find dist/ -type f -name '*.whl')"
85
91
 
92
+ - name: Document installed pip packages
93
+ shell: bash
94
+ run: pip list --verbose
95
+
86
96
  - name: Import the package
87
97
  run: python -c "import jaxsim"
88
98
 
@@ -90,14 +100,42 @@ jobs:
90
100
  with:
91
101
  fetch-depth: 0
92
102
 
93
- - name: Install Gazebo Classic
94
- if: contains(matrix.os, 'ubuntu')
103
+ - uses: dorny/paths-filter@v3
104
+ id: changes
105
+ with:
106
+ filters: |
107
+ conf: &conf
108
+ - 'pyproject.toml'
109
+ - 'setup.cfg'
110
+ - 'setup.py'
111
+ src: &src
112
+ - 'src/**'
113
+ tests: &tests
114
+ - 'tests/**'
115
+ all:
116
+ - *conf
117
+ - *src
118
+ - *tests
119
+
120
+ # https://gazebosim.org/docs/harmonic/install_ubuntu
121
+ - name: Install Gazebo Sim
122
+ if: |
123
+ contains(matrix.os, 'ubuntu') &&
124
+ (github.event_name != 'pull_request' ||
125
+ steps.changes.outputs.all == 'true')
95
126
  run: |
96
127
  sudo apt-get update
97
- sudo apt-get install gazebo
128
+ sudo apt-get install lsb-release wget gnupg
129
+ sudo wget https://packages.osrfoundation.org/gazebo.gpg -O /usr/share/keyrings/pkgs-osrf-archive-keyring.gpg
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
131
+ sudo apt-get update
132
+ sudo apt-get install gz-harmonic
98
133
 
99
134
  - name: Run the Python tests
100
- if: contains(matrix.os, 'ubuntu')
135
+ if: |
136
+ contains(matrix.os, 'ubuntu') &&
137
+ (github.event_name != 'pull_request' ||
138
+ steps.changes.outputs.all == 'true')
101
139
  run: pytest
102
140
  env:
103
141
  JAX_PLATFORM_NAME: cpu
@@ -0,0 +1,18 @@
1
+ name: Read the Docs PR
2
+ on:
3
+ pull_request_target:
4
+ types:
5
+ - opened
6
+
7
+ permissions:
8
+ pull-requests: write
9
+
10
+ jobs:
11
+
12
+ documentation-links:
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: readthedocs/actions/preview@v1
16
+ with:
17
+ project-slug: "jaxsim"
18
+ project-language: ""
@@ -10,39 +10,40 @@ on:
10
10
  jobs:
11
11
 
12
12
  black:
13
-
14
13
  name: black
15
14
  runs-on: ubuntu-latest
16
15
 
17
16
  steps:
18
17
 
19
18
  - name: "🔀 Checkout repository"
20
- uses: actions/checkout@v2
19
+ uses: actions/checkout@v4
21
20
 
22
21
  - name: '🐍 Initialize Python'
23
- uses: actions/setup-python@v2
22
+ uses: actions/setup-python@v5
24
23
  with:
25
- python-version: "3.8"
24
+ python-version: "3.*"
26
25
 
26
+ # Note: the black version needs to be in sync with what
27
+ # specified in setup.cfg.
27
28
  - name: "📝 Black Code Formatter"
28
29
  uses: psf/black@stable
29
30
  with:
30
- options: --check --diff --color
31
+ options: "--check --diff --color"
32
+ version: "~= 24.0"
31
33
 
32
34
  isort:
33
-
34
35
  name: isort
35
36
  runs-on: ubuntu-latest
36
37
 
37
38
  steps:
38
39
 
39
40
  - name: "🔀 Checkout repository"
40
- uses: actions/checkout@v2
41
+ uses: actions/checkout@v4
41
42
 
42
43
  - name: '🐍 Initialize Python'
43
- uses: actions/setup-python@v2
44
+ uses: actions/setup-python@v5
44
45
  with:
45
- python-version: "3.8"
46
+ python-version: "3.*"
46
47
 
47
48
  # Workaround for https://github.com/isort/isort-action/issues/70
48
49
  - run: pip install colorama
@@ -50,4 +51,16 @@ jobs:
50
51
  - name: "📝 isort"
51
52
  uses: isort/isort-action@master
52
53
  with:
53
- configuration: --check --diff --color
54
+ configuration: "--check --diff --color"
55
+
56
+ ruff:
57
+ name: ruff
58
+ runs-on: ubuntu-latest
59
+
60
+ steps:
61
+
62
+ - name: "🔀 Checkout repository"
63
+ uses: actions/checkout@v4
64
+
65
+ - name: "📝 Ruff"
66
+ uses: chartboost/ruff-action@v1
@@ -136,3 +136,6 @@ dmypy.json
136
136
 
137
137
  # setuptools_scm dynamic version
138
138
  src/jaxsim/_version.py
139
+
140
+ # ruff
141
+ .ruff_cache/
@@ -0,0 +1,26 @@
1
+ repos:
2
+ - repo: https://github.com/pre-commit/pre-commit-hooks
3
+ rev: v4.5.0
4
+ hooks:
5
+ - id: check-ast
6
+ - id: check-merge-conflict
7
+ - id: check-yaml
8
+ - id: end-of-file-fixer
9
+ - id: trailing-whitespace
10
+
11
+ - repo: https://github.com/psf/black-pre-commit-mirror
12
+ rev: 24.2.0
13
+ hooks:
14
+ - id: black
15
+ language_version: python3.11
16
+
17
+ - repo: https://github.com/pycqa/isort
18
+ rev: 5.13.2
19
+ hooks:
20
+ - id: isort
21
+ name: isort (python)
22
+
23
+ - repo: https://github.com/astral-sh/ruff-pre-commit
24
+ rev: v0.3.2
25
+ hooks:
26
+ - id: ruff
@@ -4,16 +4,16 @@ build:
4
4
  os: ubuntu-22.04
5
5
  tools:
6
6
  python: "mambaforge-22.9"
7
-
7
+
8
8
  conda:
9
- environment: docs/jaxsim_conda_env.yml
9
+ environment: environment.yml
10
10
 
11
11
  python:
12
12
  install:
13
13
  - method: pip
14
14
  path: .
15
-
15
+
16
16
  sphinx:
17
17
  configuration: docs/conf.py
18
18
 
19
- formats: all
19
+ formats: all
@@ -0,0 +1,74 @@
1
+ # Contributing to JAXsim :rocket:
2
+
3
+ Hello Contributor,
4
+
5
+ We're thrilled that you're considering contributing to JAXsim!
6
+ Here's a brief guide to help you seamlessly become a part of our project.
7
+
8
+ ## Development Environment :hammer_and_wrench:
9
+
10
+ Make sure your development environment is set up.
11
+ Follow the installation instructions in the [README](./README.md) to get JAXsim and its dependencies up and running.
12
+
13
+ To ensure consistency and maintain code quality, we recommend using the pre-commit hook with the following configuration.
14
+ This will help catch issues before they become a part of the project.
15
+
16
+ ### Setting Up Pre-commit Hook :fishing_pole_and_fish:
17
+
18
+ `pre-commit` is a tool that manages pre-commit hooks for your project.
19
+ It will run checks on your code before you commit it, ensuring that it meets the project's standards.
20
+ You should have it already installed if you followed the installation instructions in the [README](./README.md).
21
+
22
+ Run the following command to install the hooks:
23
+
24
+ ```bash
25
+ pre-commit install
26
+ ```
27
+
28
+ ### Using Pre-commit Hook :vertical_traffic_light:
29
+
30
+ Before making any commits, the pre-commit hook will automatically run.
31
+ If it finds any issues, it will prevent the commit and provide instructions on how to fix them.
32
+
33
+ To get your commit through without fixing the issues, use the `--no-verify` flag:
34
+
35
+ ```bash
36
+ git commit -m "Your commit message" --no-verify
37
+ ```
38
+
39
+ To manually run the pre-commit hook at any time, use:
40
+
41
+ ```bash
42
+ pre-commit run --all-files
43
+ ```
44
+
45
+ ## Making Changes :construction:
46
+
47
+ Before submitting a pull request, create an issue to discuss your changes if major changes are involved.
48
+ This helps us understand your needs and provide feedback.
49
+ Clearly describe your pull request, referencing any related issues.
50
+ Follow the [PEP 8](https://peps.python.org/pep-0008/) style guide and include relevant tests.
51
+
52
+ ## Testing :test_tube:
53
+
54
+ Your code will be tested with the CI/CD pipeline before merging.
55
+ Feel free to add new ones or update the existing tests in the [workflows](./github/workflows) folder to cover your changes.
56
+
57
+ ## Documentation :book:
58
+
59
+ Update the documentation in the [docs](./docs) folder and the [README](./README.md) to reflect your changes, if necessary.
60
+ There is no need to build the documentation locally; it will be automatically built and deployed with your pull request, where a preview link will be provided.
61
+
62
+ ## Code Review :eyes:
63
+
64
+ Expect feedback during the code review process.
65
+ Address comments and make necessary changes.
66
+ This collaboration ensures quality.
67
+ Please keep the commit history clean, or squash commits if necessary.
68
+
69
+ ## License :scroll:
70
+
71
+ JAXsim is under the [BSD 3-Clause License](./LICENSE).
72
+ By contributing, you agree to the same license.
73
+
74
+ Thank you for contributing to JAXsim! Your efforts are appreciated.
@@ -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
jaxsim-0.2.0/PKG-INFO ADDED
@@ -0,0 +1,237 @@
1
+ Metadata-Version: 2.1
2
+ Name: jaxsim
3
+ Version: 0.2.0
4
+ Summary: A differentiable physics engine and multibody dynamics library for control and robot learning.
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: Documentation, https://jaxsim.readthedocs.io
11
+ Project-URL: Source, https://github.com/ami-iit/jaxsim
12
+ Project-URL: Tracker, https://github.com/ami-iit/jaxsim/issues
13
+ Keywords: physics,physics engine,jax,rigid body dynamics,featherstone,reinforcement learning,robot,robotics,sdf,urdf
14
+ Platform: any
15
+ Classifier: Development Status :: 4 - Beta
16
+ Classifier: Framework :: Robot Framework
17
+ Classifier: Intended Audience :: Developers
18
+ Classifier: Intended Audience :: Science/Research
19
+ Classifier: License :: OSI Approved :: BSD License
20
+ Classifier: Operating System :: POSIX :: Linux
21
+ Classifier: Operating System :: MacOS
22
+ Classifier: Operating System :: Microsoft
23
+ Classifier: Programming Language :: Python :: 3.11
24
+ Classifier: Programming Language :: Python :: 3.12
25
+ Classifier: Programming Language :: Python :: 3 :: Only
26
+ Classifier: Programming Language :: Python :: Implementation :: CPython
27
+ Classifier: Topic :: Games/Entertainment :: Simulation
28
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
29
+ Classifier: Topic :: Scientific/Engineering :: Physics
30
+ Classifier: Topic :: Software Development
31
+ Requires-Python: >=3.11
32
+ Description-Content-Type: text/markdown
33
+ License-File: LICENSE
34
+ Requires-Dist: coloredlogs
35
+ Requires-Dist: jax>=0.4.13
36
+ Requires-Dist: jaxlib>=0.4.13
37
+ Requires-Dist: jaxlie>=1.3.0
38
+ Requires-Dist: jax_dataclasses>=1.4.0
39
+ Requires-Dist: pptree
40
+ Requires-Dist: rod>=0.2.0
41
+ Requires-Dist: typing_extensions; python_version < "3.12"
42
+ Provides-Extra: style
43
+ Requires-Dist: black[jupyter]~=24.0; extra == "style"
44
+ Requires-Dist: isort; extra == "style"
45
+ Requires-Dist: pre-commit; extra == "style"
46
+ Provides-Extra: testing
47
+ Requires-Dist: idyntree; extra == "testing"
48
+ Requires-Dist: pytest>=6.0; extra == "testing"
49
+ Requires-Dist: pytest-icdiff; extra == "testing"
50
+ Requires-Dist: robot-descriptions; extra == "testing"
51
+ Provides-Extra: viz
52
+ Requires-Dist: lxml; extra == "viz"
53
+ Requires-Dist: mediapy; extra == "viz"
54
+ Requires-Dist: mujoco>=3.0.0; extra == "viz"
55
+ Provides-Extra: all
56
+ Requires-Dist: black[jupyter]~=24.0; extra == "all"
57
+ Requires-Dist: isort; extra == "all"
58
+ Requires-Dist: pre-commit; extra == "all"
59
+ Requires-Dist: idyntree; extra == "all"
60
+ Requires-Dist: pytest>=6.0; extra == "all"
61
+ Requires-Dist: pytest-icdiff; extra == "all"
62
+ Requires-Dist: robot-descriptions; extra == "all"
63
+ Requires-Dist: lxml; extra == "all"
64
+ Requires-Dist: mediapy; extra == "all"
65
+ Requires-Dist: mujoco>=3.0.0; extra == "all"
66
+
67
+ # JaxSim
68
+
69
+ JaxSim is a **differentiable physics engine** and **multibody dynamics library** designed for applications in control and robot learning, implemented with JAX.
70
+
71
+ Its design facilitates research and accelerates prototyping in the intersection of robotics and artificial intelligence.
72
+
73
+ ## Features
74
+
75
+ - Physics engine in reduced coordinates supporting fixed-base and floating-base robots.
76
+ - Multibody dynamics library providing all the necessary components for developing model-based control algorithms.
77
+ - Completely developed in Python with [`google/jax`][jax] following a functional programming paradigm.
78
+ - Transparent support for running on CPUs, GPUs, and TPUs.
79
+ - Full support for JIT compilation for increased performance.
80
+ - Full support for automatic vectorization for massive parallelization of open-loop and closed-loop architectures.
81
+ - Support for SDF models and, upon conversion with [sdformat][sdformat], URDF models.
82
+ - Visualization based on the [passive viewer][passive_viewer_mujoco] of Mujoco.
83
+
84
+ ### JaxSim as a simulator
85
+
86
+ - Wide range of fixed-step explicit Runge-Kutta integrators.
87
+ - Support for variable-step integrators implemented as embedded Runge-Kutta schemes.
88
+ - Improved stability by optionally integrating the base orientation on the $\text{SO}(3)$ manifold.
89
+ - Soft contacts model supporting full friction cone and sticking-slipping transition.
90
+ - Collision detection between points rigidly attached to bodies and uneven ground surfaces.
91
+
92
+ ### JaxSim as a multibody dynamics library
93
+
94
+ - Provides rigid body dynamics algorithms (RBDAs) like RNEA, ABA, CRBA, and Jacobians.
95
+ - Provides all the quantities included in the Euler-Poincarè formulation of the equations of motion.
96
+ - Supports body-fixed, inertial-fixed, and mixed [velocity representations][notation].
97
+ - Exposes all the necessary quantities to develop controllers in centroidal coordinates.
98
+
99
+ ### JaxSim for robot learning
100
+
101
+ - Being developed with JAX, all the RBDAs support automatic differentiation both in forward and reverse modes.
102
+ - Support for automatically differentiating against kinematics and dynamics parameters.
103
+ - All fixed-step integrators are forward and reverse differentiable.
104
+ - All variable-step integrators are forward differentiable.
105
+ - Ideal for sampling synthetic data for reinforcement learning (RL).
106
+ - Ideal for designing physics-informed neural networks (PINNs) with loss functions requiring model-based quantities.
107
+ - Ideal for combining model-based control with learning-based components.
108
+
109
+ [jax]: https://github.com/google/jax/
110
+ [sdformat]: https://github.com/gazebosim/sdformat
111
+ [notation]: https://research.tue.nl/en/publications/multibody-dynamics-notation-version-2
112
+ [passive_viewer_mujoco]: https://mujoco.readthedocs.io/en/stable/python.html#passive-viewer
113
+
114
+ > [!WARNING]
115
+ > This project is still experimental, APIs could change between releases without notice.
116
+
117
+ > [!NOTE]
118
+ > JaxSim currently focuses on locomotion applications.
119
+ > Only contacts between bodies and smooth ground surfaces are supported.
120
+
121
+ ## Documentation
122
+
123
+ The JaxSim API documentation is available at [jaxsim.readthedocs.io][readthedocs].
124
+
125
+ [readthedocs]: https://jaxsim.readthedocs.io/
126
+
127
+ ## Installation
128
+
129
+ <details>
130
+ <summary>With conda</summary>
131
+
132
+ You can install the project using [`conda`][conda] as follows:
133
+
134
+ ```bash
135
+ conda install jaxsim -c conda-forge
136
+ ```
137
+
138
+ You can enforce GPU support, if needed, by also specifying `"jaxlib = * = *cuda*"`.
139
+
140
+ </details>
141
+
142
+ <details>
143
+ <summary>With pip</summary>
144
+
145
+ You can install the project using [`pypa/pip`][pip], preferably in a [virtual environment][venv], as follows:
146
+
147
+ ```bash
148
+ pip install jaxsim
149
+ ```
150
+
151
+ Check [`setup.cfg`](setup.cfg) for the complete list of optional dependencies.
152
+ You can obtain a full installation using `jaxsim[all]`.
153
+
154
+ If you need GPU support, follow the official [installation instructions][jax_gpu] of JAX.
155
+
156
+ </details>
157
+
158
+ <details>
159
+ <summary>Contributors installation</summary>
160
+
161
+ If you want to contribute to the project, we recommend creating the following `jaxsim` conda environment first:
162
+
163
+ ```bash
164
+ conda env create -f environment.yml
165
+ ```
166
+
167
+ Then, activate the environment and install the project in editable mode:
168
+
169
+ ```bash
170
+ conda activate jaxsim
171
+ pip install --no-deps -e .
172
+ ```
173
+
174
+ </details>
175
+
176
+ [conda]: https://anaconda.org/
177
+ [pip]: https://github.com/pypa/pip/
178
+ [venv]: https://docs.python.org/3/tutorial/venv.html
179
+ [jax_gpu]: https://github.com/google/jax/#installation
180
+
181
+ ## Credits
182
+
183
+ The RBDAs are based on the theory of the [Rigid Body Dynamics Algorithms][RBDA]
184
+ book by Roy Featherstone.
185
+ The algorithms and some simulation features were inspired by its accompanying [code][spatial_v2].
186
+
187
+ [RBDA]: https://link.springer.com/book/10.1007/978-1-4899-7560-7
188
+ [spatial_v2]: http://royfeatherstone.org/spatial/index.html#spatial-software
189
+
190
+ The development of JaxSim started in late 2021, inspired by early versions of [`google/brax`][brax].
191
+ At that time, Brax was implemented in maximal coordinates, and we wanted a physics engine in reduced coordinates.
192
+ We are grateful to the Brax team for their work and showing the potential of [JAX][jax] in this field.
193
+
194
+ Brax v2 was later implemented reduced coordinates, following an approach comparable to JaxSim.
195
+ The development then shifted to [MJX][mjx], which today provides a JAX-based implementation of the Mujoco APIs.
196
+
197
+ The main differences between MJX/Brax and JaxSim are as follows:
198
+
199
+ - JaxSim supports out-of-the-box all SDF models with [Pose Frame Semantics][PFS].
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
202
+ function of the state $(\mathbf{q}, \boldsymbol{\nu})$, it doesn't require running any optimization algorithm
203
+ when stepping the simulation forward.
204
+ - JaxSim mitigates the stiffness of the contact-aware system dynamics by providing variable-step integrators.
205
+
206
+ [brax]: https://github.com/google/brax
207
+ [mjx]: https://mujoco.readthedocs.io/en/3.0.0/mjx.html
208
+ [PFS]: http://sdformat.org/tutorials?tut=pose_frame_semantics
209
+
210
+ ## Contributing
211
+
212
+ We welcome contributions from the community.
213
+ Please read the [contributing guide](./CONTRIBUTING.md) to get started.
214
+
215
+ ## Citing
216
+
217
+ ```bibtex
218
+ @software{ferigo_jaxsim_2022,
219
+ author = {Diego Ferigo and Filippo Luca Ferretti and Silvio Traversaro and Daniele Pucci},
220
+ title = {{JaxSim}: A Differentiable Physics Engine and Multibody Dynamics Library for Control and Robot Learning},
221
+ url = {http://github.com/ami-iit/jaxsim},
222
+ year = {2022},
223
+ }
224
+ ```
225
+
226
+ ## People
227
+
228
+ | Author | Maintainers |
229
+ |:------:|:-----------:|
230
+ | [<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] |
231
+
232
+ [df]: https://github.com/diegoferigo
233
+ [ff]: https://github.com/flferretti
234
+
235
+ ## License
236
+
237
+ [BSD3](https://choosealicense.com/licenses/bsd-3-clause/)