jaxsim 0.5.1.dev2__py3-none-any.whl → 0.5.1.dev12__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.dev2'
16
- __version_tuple__ = version_tuple = (0, 5, 1, 'dev2')
15
+ __version__ = version = '0.5.1.dev12'
16
+ __version_tuple__ = version_tuple = (0, 5, 1, 'dev12')
jaxsim/api/frame.py CHANGED
@@ -58,7 +58,7 @@ def name_to_idx(model: js.model.JaxSimModel, *, frame_name: str) -> jtp.Int:
58
58
  The index of the frame.
59
59
  """
60
60
 
61
- if frame_name not in model.kin_dyn_parameters.frame_parameters.name:
61
+ if frame_name not in model.frame_names():
62
62
  raise ValueError(f"Frame '{frame_name}' not found in the model.")
63
63
 
64
64
  return (
@@ -180,6 +180,56 @@ def transform(
180
180
  return W_H_L @ L_H_F
181
181
 
182
182
 
183
+ @functools.partial(jax.jit, static_argnames=["output_vel_repr"])
184
+ def velocity(
185
+ model: js.model.JaxSimModel,
186
+ data: js.data.JaxSimModelData,
187
+ *,
188
+ frame_index: jtp.IntLike,
189
+ output_vel_repr: VelRepr | None = None,
190
+ ) -> jtp.Vector:
191
+ """
192
+ Compute the 6D velocity of the frame.
193
+
194
+ Args:
195
+ model: The model to consider.
196
+ data: The data of the considered model.
197
+ frame_index: The index of the frame.
198
+ output_vel_repr:
199
+ The output velocity representation of the frame velocity.
200
+
201
+ Returns:
202
+ The 6D velocity of the frame in the specified velocity representation.
203
+ """
204
+ n_l = model.number_of_links()
205
+ n_f = model.number_of_frames()
206
+
207
+ exceptions.raise_value_error_if(
208
+ condition=jnp.array([frame_index < n_l, frame_index >= n_l + n_f]).any(),
209
+ msg="Invalid frame index '{idx}'",
210
+ idx=frame_index,
211
+ )
212
+
213
+ output_vel_repr = (
214
+ output_vel_repr if output_vel_repr is not None else data.velocity_representation
215
+ )
216
+
217
+ # Get the frame jacobian having I as input representation (taken from data)
218
+ # and O as output representation, specified by the user (or taken from data).
219
+ O_J_WF_I = jacobian(
220
+ model=model,
221
+ data=data,
222
+ frame_index=frame_index,
223
+ output_vel_repr=output_vel_repr,
224
+ )
225
+
226
+ # Get the generalized velocity in the input velocity representation.
227
+ I_ν = data.generalized_velocity()
228
+
229
+ # Compute the frame velocity in the output velocity representation.
230
+ return O_J_WF_I @ I_ν
231
+
232
+
183
233
  @functools.partial(jax.jit, static_argnames=["output_vel_repr"])
184
234
  def jacobian(
185
235
  model: js.model.JaxSimModel,
@@ -207,7 +257,7 @@ def jacobian(
207
257
  """
208
258
 
209
259
  n_l = model.number_of_links()
210
- n_f = len(model.frame_names())
260
+ n_f = model.number_of_frames()
211
261
 
212
262
  exceptions.raise_value_error_if(
213
263
  condition=jnp.array([frame_index < n_l, frame_index >= n_l + n_f]).any(),
@@ -268,6 +268,16 @@ class KynDynParameters(JaxsimDataclass):
268
268
 
269
269
  return len(self.joint_model.joint_names) - 1
270
270
 
271
+ def number_of_frames(self) -> int:
272
+ """
273
+ Return the number of frames of the model.
274
+
275
+ Returns:
276
+ The number of frames of the model.
277
+ """
278
+
279
+ return len(self.frame_parameters.name)
280
+
271
281
  def support_body_array(self, link_index: jtp.IntLike) -> jtp.Vector:
272
282
  r"""
273
283
  Return the support parent array :math:`\kappa(i)` of a link.
jaxsim/api/model.py CHANGED
@@ -327,6 +327,17 @@ class JaxSimModel(JaxsimDataclass):
327
327
 
328
328
  return self.kin_dyn_parameters.number_of_joints()
329
329
 
330
+ def number_of_frames(self) -> int:
331
+ """
332
+ Return the number of frames in the model.
333
+
334
+ Returns:
335
+ The number of frames in the model.
336
+
337
+ """
338
+
339
+ return self.kin_dyn_parameters.number_of_frames()
340
+
330
341
  # =================
331
342
  # Base link methods
332
343
  # =================
@@ -376,7 +376,7 @@ class RelaxedRigidContacts(common.ContactModel):
376
376
 
377
377
  # Compute the Delassus matrix and the free mixed linear acceleration of
378
378
  # the collidable points.
379
- G = Jl_WC @ jnp.linalg.lstsq(M, Jl_WC.T)[0]
379
+ G = Jl_WC @ jnp.linalg.pinv(M) @ Jl_WC.T
380
380
  CW_al_free_WC = Jl_WC @ BW_ν̇_free + J̇_WC @ BW_ν
381
381
 
382
382
  # Calculate quantities for the linear optimization problem.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: jaxsim
3
- Version: 0.5.1.dev2
3
+ Version: 0.5.1.dev12
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=opgtbhhd1kDsHI4H1vOd3loMPDRi884yQ3tohfFGfNc,3382
2
- jaxsim/_version.py,sha256=WrOoBsTPNibawODvIHWHaR6dpBCKQg4It8zAMDJwKsg,424
2
+ jaxsim/_version.py,sha256=2_bzGZzjfnjGwYxBgYuEQv-xkgzgn4lj1OXQDabjdJ4,426
3
3
  jaxsim/exceptions.py,sha256=vSoScaRD4nvh6jltgK9Ry5pKnE0O5hb4_yI_pk_fvR8,2175
4
4
  jaxsim/logging.py,sha256=STI-D_upXZYX-ZezLrlJJ0UlD5YspST0vZ_DcIwkzO4,1553
5
5
  jaxsim/typing.py,sha256=2HXy9hgazPXjofi1vLQ09ZubPtgVmg80U9NKmZ6NYiI,761
@@ -8,11 +8,11 @@ jaxsim/api/com.py,sha256=m-p3EJDhpnMTlXKplfbZE_aH9NqX_VyLlAE3vUhc6l4,13642
8
8
  jaxsim/api/common.py,sha256=SNgxq42r6eF_-aPszvOjUYkGwXOzz4hKmhDwEUkscFQ,6650
9
9
  jaxsim/api/contact.py,sha256=cPE7FIUycGzmmNW4Zh9w7qsWd4cQYowo_Tg3mL2evL0,25657
10
10
  jaxsim/api/data.py,sha256=ThRpoBlbdwf1N3xs8SWrY5d8RbfdYRwFcmkdIPgtee4,29004
11
- jaxsim/api/frame.py,sha256=yPSgNygHkvWlln4wShNt7vZm_fFobVEm7phsklNNyH8,12922
11
+ jaxsim/api/frame.py,sha256=MT6Qpg5uJDnhik899QNpHskZMijgjMSOw-2v-t-kul4,14434
12
12
  jaxsim/api/joint.py,sha256=8rCIxRMeAidsaBbw7kkGp6z3-UmBPtqmYmV_arHDQJ8,7365
13
- jaxsim/api/kin_dyn_parameters.py,sha256=Y9wnMshz83Zm4UEPOAOTINdtfkBZ86w853c8Yi2qaVs,29670
13
+ jaxsim/api/kin_dyn_parameters.py,sha256=wnto0nzzEJ_M8tH2PUdldEyxQwQdsStYUoQFu696uuw,29897
14
14
  jaxsim/api/link.py,sha256=nHjffhNdi_xGkteMsqdb_hC9mdV9rNw7k3pl89Uhw_8,12798
15
- jaxsim/api/model.py,sha256=HVoZ8AtFe5XOq8GlPbtpbMy-gzo4o1gM5gPchH0tHGw,79562
15
+ jaxsim/api/model.py,sha256=pNO-m7ZbHFvuGftu-ngvj05z8Fo0WOT69dU71fl_hA8,79801
16
16
  jaxsim/api/ode.py,sha256=_t18avoCJngQk6eMFTGpaeahbpchQP20qJnUOCPkz8s,15360
17
17
  jaxsim/api/ode_data.py,sha256=1SD-x-lYk_YSEnVpxTLd69uOKC0mFUj44ZqpSmEDOxw,20190
18
18
  jaxsim/api/references.py,sha256=eIOk3MAOc9LJSKfI8M4WA8gGD-meo50vRfhXdea4sNI,20539
@@ -56,7 +56,7 @@ jaxsim/rbda/rnea.py,sha256=CLfqs9XFVaD-hvkLABshDAfdw5bm_AMV3UVAQ_IvURQ,7542
56
56
  jaxsim/rbda/utils.py,sha256=GLt7XIl1ROkx0_fnBCKUHYdB9_IBF3Yi4OnkHSX3gxA,5365
57
57
  jaxsim/rbda/contacts/__init__.py,sha256=L5MM-2pv76YPGzxExdz2EErgGBATuAjYnNHlq5QOySs,503
58
58
  jaxsim/rbda/contacts/common.py,sha256=mjOS1MJkf9zRfcAKBwmYtO5Vrcrv-kLFM57FfFB8LgM,11244
59
- jaxsim/rbda/contacts/relaxed_rigid.py,sha256=u7WliwuKff2RjS85eIEtJXbDLilZMqlz-j46-Pv7QAw,21681
59
+ jaxsim/rbda/contacts/relaxed_rigid.py,sha256=I3Fz5WTJgIp9XBxBUKhJNwSlbx6VP8cZguzXu_Ch1W0,21678
60
60
  jaxsim/rbda/contacts/rigid.py,sha256=MSzkU6SFbW6CryNlyyxQ7K0-U-8k6VROGKv_DQrwqiw,17156
61
61
  jaxsim/rbda/contacts/soft.py,sha256=t6bqBfGAtV1AWoevY82LAcXy2XW8w_uu7bNywcyxF0s,17001
62
62
  jaxsim/rbda/contacts/visco_elastic.py,sha256=vQkfMuqQ3Qu8nbDTPY4jWBZjV3U7qtoRK1Aya3O3oFA,41424
@@ -66,8 +66,8 @@ jaxsim/utils/__init__.py,sha256=Y5zyoRevl3EMVQadhZ4EtSwTEkDt2vcnFoRhPJjKTZ0,215
66
66
  jaxsim/utils/jaxsim_dataclass.py,sha256=TGmTQV2Lq7Q-2nLoAEaeNtkPa_qj0IKkdBm4COj46Os,11312
67
67
  jaxsim/utils/tracing.py,sha256=eEY28MZW0Lm_jJNt1NkFqZz0ek01tvhR46OXZYCo7tc,532
68
68
  jaxsim/utils/wrappers.py,sha256=ZY7olSORzZRvSzkdeNLj8yjwUIAt9L0Douwl7wItjpk,4008
69
- jaxsim-0.5.1.dev2.dist-info/LICENSE,sha256=eaYdFmdeMbiIoIiPzEK0MjP1S9wtFXjXNR5er49uLR0,1546
70
- jaxsim-0.5.1.dev2.dist-info/METADATA,sha256=ssJ0fSQiK3p0xTNfDDPSlmWRwyI2B-vmVY4ySGLijVk,17534
71
- jaxsim-0.5.1.dev2.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
72
- jaxsim-0.5.1.dev2.dist-info/top_level.txt,sha256=LxGMA8FLtXjQ6oI7N5gd_R_oSUHxpXxUEOfT1xS_ni0,7
73
- jaxsim-0.5.1.dev2.dist-info/RECORD,,
69
+ jaxsim-0.5.1.dev12.dist-info/LICENSE,sha256=eaYdFmdeMbiIoIiPzEK0MjP1S9wtFXjXNR5er49uLR0,1546
70
+ jaxsim-0.5.1.dev12.dist-info/METADATA,sha256=9QS_0QH1kZvb1ObTztto40bXnMMJ0l92_-ftdq45dZw,17535
71
+ jaxsim-0.5.1.dev12.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
72
+ jaxsim-0.5.1.dev12.dist-info/top_level.txt,sha256=LxGMA8FLtXjQ6oI7N5gd_R_oSUHxpXxUEOfT1xS_ni0,7
73
+ jaxsim-0.5.1.dev12.dist-info/RECORD,,