jaxsim 0.5.1.dev139__py3-none-any.whl → 0.5.1.dev147__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.5.1.dev139'
16
- __version_tuple__ = version_tuple = (0, 5, 1, 'dev139')
15
+ __version__ = version = '0.5.1.dev147'
16
+ __version_tuple__ = version_tuple = (0, 5, 1, 'dev147')
jaxsim/api/model.py CHANGED
@@ -2295,9 +2295,6 @@ def step(
2295
2295
  # Hence, here we need to reset the velocity after each impact to guarantee that
2296
2296
  # the linear velocity of the active collidable points is zero.
2297
2297
  case jaxsim.rbda.contacts.RigidContacts():
2298
- assert isinstance(
2299
- data_tf.contacts_params, jaxsim.rbda.contacts.RigidContactsParams
2300
- )
2301
2298
 
2302
2299
  # Raise runtime error for not supported case in which Rigid contacts and
2303
2300
  # Baumgarte stabilization are enabled and used with ForwardEuler integrator.
@@ -2331,12 +2328,13 @@ def step(
2331
2328
  indices_of_enabled_collidable_points
2332
2329
  ]
2333
2330
  M = js.model.free_floating_mass_matrix(model, data_tf)
2331
+ BW_ν_pre_impact = data_tf.generalized_velocity()
2334
2332
 
2335
2333
  # Compute the impact velocity.
2336
2334
  # It may be discontinuous in case new contacts are made.
2337
- BW_nu_post_impact = (
2335
+ BW_ν_post_impact = (
2338
2336
  jaxsim.rbda.contacts.RigidContacts.compute_impact_velocity(
2339
- data=data_tf,
2337
+ generalized_velocity=BW_ν_pre_impact,
2340
2338
  inactive_collidable_points=(δ <= 0),
2341
2339
  M=M,
2342
2340
  J_WC=J_WC,
@@ -2344,8 +2342,8 @@ def step(
2344
2342
  )
2345
2343
 
2346
2344
  # Reset the generalized velocity.
2347
- data_tf = data_tf.reset_base_velocity(BW_nu_post_impact[0:6])
2348
- data_tf = data_tf.reset_joint_velocities(BW_nu_post_impact[6:])
2345
+ data_tf = data_tf.reset_base_velocity(BW_ν_post_impact[0:6])
2346
+ data_tf = data_tf.reset_joint_velocities(BW_ν_post_impact[6:])
2349
2347
 
2350
2348
  # Restore the input velocity representation.
2351
2349
  data_tf = data_tf.replace(
@@ -173,7 +173,7 @@ class RigidContacts(ContactModel):
173
173
  inactive_collidable_points: jtp.ArrayLike,
174
174
  M: jtp.MatrixLike,
175
175
  J_WC: jtp.MatrixLike,
176
- data: js.data.JaxSimModelData,
176
+ generalized_velocity: jtp.VectorLike,
177
177
  ) -> jtp.Vector:
178
178
  """
179
179
  Return the new velocity of the system after a potential impact.
@@ -182,55 +182,37 @@ class RigidContacts(ContactModel):
182
182
  inactive_collidable_points: The activation state of the collidable points.
183
183
  M: The mass matrix of the system (in mixed representation).
184
184
  J_WC: The Jacobian matrix of the collidable points (in mixed representation).
185
- data: The `JaxSimModelData` instance.
186
- """
185
+ generalized_velocity: The generalized velocity of the system.
187
186
 
188
- def impact_velocity(
189
- inactive_collidable_points: jtp.ArrayLike,
190
- nu_pre: jtp.ArrayLike,
191
- M: jtp.MatrixLike,
192
- J_WC: jtp.MatrixLike,
193
- data: js.data.JaxSimModelData,
194
- ):
195
- # Compute system velocity after impact maintaining zero linear velocity of active points
196
- with data.switch_velocity_representation(VelRepr.Mixed):
197
- sl = jnp.s_[:, 0:3, :]
198
- Jl_WC = J_WC[sl]
199
- # Zero out the jacobian rows of inactive points
200
- Jl_WC = jnp.vstack(
201
- jnp.where(
202
- inactive_collidable_points[:, jnp.newaxis, jnp.newaxis],
203
- jnp.zeros_like(Jl_WC),
204
- Jl_WC,
205
- )
206
- )
187
+ Note:
188
+ The mass matrix `M`, the Jacobian `J_WC`, and the generalized velocity `generalized_velocity`
189
+ must be expressed in the same velocity representation.
190
+ """
207
191
 
208
- A = jnp.vstack(
209
- [
210
- jnp.hstack([M, -Jl_WC.T]),
211
- jnp.hstack(
212
- [Jl_WC, jnp.zeros((Jl_WC.shape[0], Jl_WC.shape[0]))]
213
- ),
214
- ]
215
- )
216
- b = jnp.hstack([M @ nu_pre, jnp.zeros(Jl_WC.shape[0])])
217
- x = jnp.linalg.lstsq(A, b)[0]
218
- nu_post = x[0 : M.shape[0]]
192
+ # Compute system velocity after impact maintaining zero linear velocity of active points.
193
+ sl = jnp.s_[:, 0:3, :]
194
+ Jl_WC = J_WC[sl]
195
+
196
+ # Zero out the jacobian rows of inactive points.
197
+ Jl_WC = jnp.vstack(
198
+ jnp.where(
199
+ inactive_collidable_points[:, jnp.newaxis, jnp.newaxis],
200
+ jnp.zeros_like(Jl_WC),
201
+ Jl_WC,
202
+ )
203
+ )
219
204
 
220
- return nu_post
205
+ A = jnp.vstack(
206
+ [
207
+ jnp.hstack([M, -Jl_WC.T]),
208
+ jnp.hstack([Jl_WC, jnp.zeros((Jl_WC.shape[0], Jl_WC.shape[0]))]),
209
+ ]
210
+ )
211
+ b = jnp.hstack([M @ generalized_velocity, jnp.zeros(Jl_WC.shape[0])])
221
212
 
222
- with data.switch_velocity_representation(VelRepr.Mixed):
223
- BW_ν_pre_impact = data.generalized_velocity()
224
-
225
- BW_ν_post_impact = impact_velocity(
226
- data=data,
227
- inactive_collidable_points=inactive_collidable_points,
228
- nu_pre=BW_ν_pre_impact,
229
- M=M,
230
- J_WC=J_WC,
231
- )
213
+ BW_ν_post_impact = jnp.linalg.lstsq(A, b)[0]
232
214
 
233
- return BW_ν_post_impact
215
+ return BW_ν_post_impact[0 : M.shape[0]]
234
216
 
235
217
  @jax.jit
236
218
  def compute_contact_forces(
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: jaxsim
3
- Version: 0.5.1.dev139
3
+ Version: 0.5.1.dev147
4
4
  Summary: A differentiable physics engine and multibody dynamics library for control and robot learning.
5
5
  Author-email: Diego Ferigo <dgferigo@gmail.com>, Filippo Luca Ferretti <filippoluca.ferretti@outlook.com>
6
6
  Maintainer-email: Filippo Luca Ferretti <filippo.ferretti@iit.it>, Alessandro Croci <alessandro.croci@iit.it>
@@ -1,5 +1,5 @@
1
1
  jaxsim/__init__.py,sha256=_8rbKOf3bwx-2ChEbspZxs_rZY0RqUcmWAftnEw1bfM,3401
2
- jaxsim/_version.py,sha256=rbdPpRdcjuL-NT02qiXuq49AdlY8evQGQKEirA3w01c,428
2
+ jaxsim/_version.py,sha256=FRAq9Ja5ETQImIOQUFNBXpAELhsbGMZ09hbzc0KN4cE,428
3
3
  jaxsim/exceptions.py,sha256=qjfTjE9lXvD3-JCPQcxxiX2XSS8QegawzQ6ZuC2tc0Y,2638
4
4
  jaxsim/logging.py,sha256=STI-D_upXZYX-ZezLrlJJ0UlD5YspST0vZ_DcIwkzO4,1553
5
5
  jaxsim/typing.py,sha256=7msl8t5Jt09RNYfKdPJtpjLfWurldcycDappb045Eso,761
@@ -12,7 +12,7 @@ jaxsim/api/frame.py,sha256=d6pa6vywGDqfaJU76F_-yjLJs6R3mrjZ6B-KXPu6f3Q,14595
12
12
  jaxsim/api/joint.py,sha256=AnqlNWmBOay-gsoo0y4AbfFQ2OCJm-8T1E0IMhZeLoY,7457
13
13
  jaxsim/api/kin_dyn_parameters.py,sha256=BaOp7ICxWosDIdWVjh8-cdlX8mXM9IM8wzy2fHz8Ufc,30444
14
14
  jaxsim/api/link.py,sha256=nHjffhNdi_xGkteMsqdb_hC9mdV9rNw7k3pl89Uhw_8,12798
15
- jaxsim/api/model.py,sha256=xcPKrpm66wR6lmWIaYHiRp8xMwhNbWG6vTLtwO0Hu_E,80198
15
+ jaxsim/api/model.py,sha256=LSdPk1NrBHEP4avKh3K0ANIXkPHVF1AyzZj8TfDiQ00,80162
16
16
  jaxsim/api/ode.py,sha256=XFi3gGRU2s-hqOpZEAuk7o4cxEa871V1LmGcvT5wf10,16056
17
17
  jaxsim/api/ode_data.py,sha256=ggF1AVaLW5QuXrfpNsFs-voVcW6gZkxK2Xe9GiDmou0,13755
18
18
  jaxsim/api/references.py,sha256=YkdZhRv8NoBC94qvpwn1w9_alVuxrfiZV5w5NHQIt-g,20737
@@ -58,7 +58,7 @@ jaxsim/rbda/utils.py,sha256=GLt7XIl1ROkx0_fnBCKUHYdB9_IBF3Yi4OnkHSX3gxA,5365
58
58
  jaxsim/rbda/contacts/__init__.py,sha256=L5MM-2pv76YPGzxExdz2EErgGBATuAjYnNHlq5QOySs,503
59
59
  jaxsim/rbda/contacts/common.py,sha256=7ZveKD4ddhUaW_-7mU315zyFdCBgzo60TRK74SOdFpY,10574
60
60
  jaxsim/rbda/contacts/relaxed_rigid.py,sha256=kwk1PoGtqE9e4n1ySNCIOoyZBSUkBj3BSKlgXFPZR6k,20563
61
- jaxsim/rbda/contacts/rigid.py,sha256=5fZooYtqy3Db0ef5x1PRX-eEYinp9nCcv4pMSIw1tLM,16161
61
+ jaxsim/rbda/contacts/rigid.py,sha256=ISaUwE5vk4TlcDTYWd9q3SXT215_YrG5QgFf-SRBY6A,15469
62
62
  jaxsim/rbda/contacts/soft.py,sha256=XDzHVNrw0gbX8e-3uHVEOAK2OQiwlrnCur5HXsnPitc,16960
63
63
  jaxsim/rbda/contacts/visco_elastic.py,sha256=3CVnZpTZPjyaVO2O5-CiFeNvK3c8Gcw304EVXCcpUvA,39935
64
64
  jaxsim/terrain/__init__.py,sha256=f7lVX-iNpH_wkkjef9Qpjh19TTAUOQw76EiLYJDVizc,78
@@ -67,8 +67,8 @@ jaxsim/utils/__init__.py,sha256=Y5zyoRevl3EMVQadhZ4EtSwTEkDt2vcnFoRhPJjKTZ0,215
67
67
  jaxsim/utils/jaxsim_dataclass.py,sha256=Fxa555u14VUsVlKU1rBQFurrVzBp7BNsIaVoNko0lrI,11261
68
68
  jaxsim/utils/tracing.py,sha256=Btwxdfhb7fJLk3r5PlQkGYj60Y2KbFT1gANGIA697FU,530
69
69
  jaxsim/utils/wrappers.py,sha256=3IMwydqFgmSPqeuUQ3PRmdhDc1IoT6XC23jPC_LjWXs,4175
70
- jaxsim-0.5.1.dev139.dist-info/LICENSE,sha256=eaYdFmdeMbiIoIiPzEK0MjP1S9wtFXjXNR5er49uLR0,1546
71
- jaxsim-0.5.1.dev139.dist-info/METADATA,sha256=lHheObCCOEXZ3SOwOVDjwn2GNHOLStob0PomYBUvmfU,19484
72
- jaxsim-0.5.1.dev139.dist-info/WHEEL,sha256=A3WOREP4zgxI0fKrHUG8DC8013e3dK3n7a6HDbcEIwE,91
73
- jaxsim-0.5.1.dev139.dist-info/top_level.txt,sha256=LxGMA8FLtXjQ6oI7N5gd_R_oSUHxpXxUEOfT1xS_ni0,7
74
- jaxsim-0.5.1.dev139.dist-info/RECORD,,
70
+ jaxsim-0.5.1.dev147.dist-info/LICENSE,sha256=eaYdFmdeMbiIoIiPzEK0MjP1S9wtFXjXNR5er49uLR0,1546
71
+ jaxsim-0.5.1.dev147.dist-info/METADATA,sha256=LYzQ___gRWAJsixXYn9lRcbioNzj4-d62a8oDIvp-tg,19484
72
+ jaxsim-0.5.1.dev147.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
73
+ jaxsim-0.5.1.dev147.dist-info/top_level.txt,sha256=LxGMA8FLtXjQ6oI7N5gd_R_oSUHxpXxUEOfT1xS_ni0,7
74
+ jaxsim-0.5.1.dev147.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.7.0)
2
+ Generator: setuptools (75.8.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5