jaxsim 0.4.3.dev94__py3-none-any.whl → 0.4.3.dev97__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.4.3.dev94'
16
- __version_tuple__ = version_tuple = (0, 4, 3, 'dev94')
15
+ __version__ = version = '0.4.3.dev97'
16
+ __version_tuple__ = version_tuple = (0, 4, 3, 'dev97')
jaxsim/api/contact.py CHANGED
@@ -93,7 +93,10 @@ def collidable_point_velocities(
93
93
 
94
94
  @jax.jit
95
95
  def collidable_point_forces(
96
- model: js.model.JaxSimModel, data: js.data.JaxSimModelData
96
+ model: js.model.JaxSimModel,
97
+ data: js.data.JaxSimModelData,
98
+ link_forces: jtp.MatrixLike | None = None,
99
+ joint_force_references: jtp.VectorLike | None = None,
97
100
  ) -> jtp.Matrix:
98
101
  """
99
102
  Compute the 6D forces applied to each collidable point.
@@ -101,13 +104,23 @@ def collidable_point_forces(
101
104
  Args:
102
105
  model: The model to consider.
103
106
  data: The data of the considered model.
107
+ link_forces:
108
+ The 6D external forces to apply to the links expressed in the same
109
+ representation of data.
110
+ joint_force_references:
111
+ The joint force references to apply to the joints.
104
112
 
105
113
  Returns:
106
114
  The 6D forces applied to each collidable point expressed in the frame
107
115
  corresponding to the active representation.
108
116
  """
109
117
 
110
- f_Ci, _ = collidable_point_dynamics(model=model, data=data)
118
+ f_Ci, _ = collidable_point_dynamics(
119
+ model=model,
120
+ data=data,
121
+ link_forces=link_forces,
122
+ joint_force_references=joint_force_references,
123
+ )
111
124
 
112
125
  return f_Ci
113
126
 
jaxsim/api/model.py CHANGED
@@ -1731,7 +1731,10 @@ def link_bias_accelerations(
1731
1731
 
1732
1732
  @jax.jit
1733
1733
  def link_contact_forces(
1734
- model: js.model.JaxSimModel, data: js.data.JaxSimModelData
1734
+ model: js.model.JaxSimModel,
1735
+ data: js.data.JaxSimModelData,
1736
+ link_forces: jtp.MatrixLike | None = None,
1737
+ joint_force_references: jtp.VectorLike | None = None,
1735
1738
  ) -> jtp.Matrix:
1736
1739
  """
1737
1740
  Compute the 6D contact forces of all links of the model.
@@ -1739,6 +1742,11 @@ def link_contact_forces(
1739
1742
  Args:
1740
1743
  model: The model to consider.
1741
1744
  data: The data of the considered model.
1745
+ link_forces:
1746
+ The 6D external forces to apply to the links expressed in the same
1747
+ representation of data.
1748
+ joint_force_references:
1749
+ The joint force references to apply to the joints.
1742
1750
 
1743
1751
  Returns:
1744
1752
  A `(nL, 6)` array containing the stacked 6D contact forces of the links,
@@ -1749,10 +1757,44 @@ def link_contact_forces(
1749
1757
  # `jaxsim.api.ode.system_velocity_dynamics`. We cannot merge them since
1750
1758
  # there we need to get also aux_data.
1751
1759
 
1760
+ # Build link forces if not provided.
1761
+ # These forces are expressed in the frame corresponding to the velocity
1762
+ # representation of data.
1763
+ O_f_L = (
1764
+ jnp.atleast_2d(link_forces.squeeze())
1765
+ if link_forces is not None
1766
+ else jnp.zeros((model.number_of_links(), 6))
1767
+ ).astype(float)
1768
+
1769
+ # Build joint force references if not provided.
1770
+ joint_force_references = (
1771
+ jnp.atleast_1d(joint_force_references)
1772
+ if joint_force_references is not None
1773
+ else jnp.zeros(model.dofs())
1774
+ )
1775
+
1776
+ # We expect that the 6D forces included in the `link_forces` argument are expressed
1777
+ # in the frame corresponding to the velocity representation of `data`.
1778
+ input_references = js.references.JaxSimModelReferences.build(
1779
+ model=model,
1780
+ data=data,
1781
+ velocity_representation=data.velocity_representation,
1782
+ link_forces=O_f_L,
1783
+ joint_force_references=joint_force_references,
1784
+ )
1785
+
1752
1786
  # Compute the 6D forces applied to each collidable point expressed in the
1753
1787
  # inertial frame.
1754
- with data.switch_velocity_representation(VelRepr.Inertial):
1755
- W_f_C = js.contact.collidable_point_forces(model=model, data=data)
1788
+ with (
1789
+ data.switch_velocity_representation(VelRepr.Inertial),
1790
+ input_references.switch_velocity_representation(VelRepr.Inertial),
1791
+ ):
1792
+ W_f_C = js.contact.collidable_point_forces(
1793
+ model=model,
1794
+ data=data,
1795
+ link_forces=input_references.link_forces(),
1796
+ joint_force_references=input_references.joint_force_references(),
1797
+ )
1756
1798
 
1757
1799
  # Construct the vector defining the parent link index of each collidable point.
1758
1800
  # We use this vector to sum the 6D forces of all collidable points rigidly
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: jaxsim
3
- Version: 0.4.3.dev94
3
+ Version: 0.4.3.dev97
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>
6
6
  Maintainer-email: Diego Ferigo <dgferigo@gmail.com>, Filippo Luca Ferretti <filippo.ferretti@iit.it>
@@ -1,18 +1,18 @@
1
1
  jaxsim/__init__.py,sha256=bSbpggIz5aG6QuGZLa0V2EfHjAOeucMxi-vIYxzLmN8,2788
2
- jaxsim/_version.py,sha256=f0-5Va8ZSzGXVRJ_ApiuY6zOurBuqFLN7dmOX5CxUAA,426
2
+ jaxsim/_version.py,sha256=riqB2Q7Zs4o0SGcY3Iy0aOEgFrNB6sdtU1rQ9czad4I,426
3
3
  jaxsim/exceptions.py,sha256=8_h8iqL8DgNR754dR8SZiQ7361GR5V1sUk3ZuZCHw1Q,2069
4
4
  jaxsim/logging.py,sha256=STI-D_upXZYX-ZezLrlJJ0UlD5YspST0vZ_DcIwkzO4,1553
5
5
  jaxsim/typing.py,sha256=2HXy9hgazPXjofi1vLQ09ZubPtgVmg80U9NKmZ6NYiI,761
6
6
  jaxsim/api/__init__.py,sha256=8eV22t2S3UwNyCg8karPetG1dmX1VDBXkyv28_FwNQA,210
7
7
  jaxsim/api/com.py,sha256=m-p3EJDhpnMTlXKplfbZE_aH9NqX_VyLlAE3vUhc6l4,13642
8
8
  jaxsim/api/common.py,sha256=SNgxq42r6eF_-aPszvOjUYkGwXOzz4hKmhDwEUkscFQ,6650
9
- jaxsim/api/contact.py,sha256=YwiG44giPxFgIaZq24rYxBx6McNgXXFwwiG9tA8801I,22528
9
+ jaxsim/api/contact.py,sha256=lTCCYEh0t1XPz-hFapHzyU6c1LcCq6QcZgZnv3grXYE,22980
10
10
  jaxsim/api/data.py,sha256=QldUHniJqKrdNtAcXuRaS9UyeslJ0Rjvb17UA0Ca5Tw,29008
11
11
  jaxsim/api/frame.py,sha256=KS8A5wRfjxhe9NgcVo2QA516iP5zky7UVnWxG7nTa7c,12911
12
12
  jaxsim/api/joint.py,sha256=lksT1Doxz2jknHyhb4ls20z6f6dofpZSzBJtVacZXAE,7129
13
13
  jaxsim/api/kin_dyn_parameters.py,sha256=ElahFk_RCcLvjTidH2qDOsY-m1gN1hXitCv4SvfgGYY,29260
14
14
  jaxsim/api/link.py,sha256=LAA6ZMQXkWomXeptURBtc7z3_xDZ2BBnBMhVrohh0bE,18621
15
- jaxsim/api/model.py,sha256=WL31JA2jK5L79TJ05ZouIYGe02rQvFItVDqizkzC1UE,66100
15
+ jaxsim/api/model.py,sha256=CAxGDjSSP5coKQXM53pejnF1UmSo851UwZ3fz7JN8RE,67658
16
16
  jaxsim/api/ode.py,sha256=gYSbtHWGCDP-IkUzQlH3t0fBKnK8qmxwhIvsbLG9lwU,13616
17
17
  jaxsim/api/ode_data.py,sha256=7RSoBhfCJdP6P9InQbDwdBVpClPMMuetewI-6AWm-_0,20276
18
18
  jaxsim/api/references.py,sha256=XOVKuQXRmjPoP-T5JWGSbqIGX5DzOkeGafqRpj0ZQEM,20771
@@ -63,8 +63,8 @@ jaxsim/utils/__init__.py,sha256=Y5zyoRevl3EMVQadhZ4EtSwTEkDt2vcnFoRhPJjKTZ0,215
63
63
  jaxsim/utils/jaxsim_dataclass.py,sha256=TGmTQV2Lq7Q-2nLoAEaeNtkPa_qj0IKkdBm4COj46Os,11312
64
64
  jaxsim/utils/tracing.py,sha256=KDMoyVPlu2NJvFkhtZwq5AkqMMgajt3munvJom-vEjQ,650
65
65
  jaxsim/utils/wrappers.py,sha256=Fh82ZcaFi5fUnByyFLnmumaobsu1hJIvFdopUVzJ1ps,4052
66
- jaxsim-0.4.3.dev94.dist-info/LICENSE,sha256=eaYdFmdeMbiIoIiPzEK0MjP1S9wtFXjXNR5er49uLR0,1546
67
- jaxsim-0.4.3.dev94.dist-info/METADATA,sha256=wEoRAFF3f-3u2hBbHzyOPBQ_mgcwFGcBaPmC-wYuAhE,17276
68
- jaxsim-0.4.3.dev94.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
69
- jaxsim-0.4.3.dev94.dist-info/top_level.txt,sha256=LxGMA8FLtXjQ6oI7N5gd_R_oSUHxpXxUEOfT1xS_ni0,7
70
- jaxsim-0.4.3.dev94.dist-info/RECORD,,
66
+ jaxsim-0.4.3.dev97.dist-info/LICENSE,sha256=eaYdFmdeMbiIoIiPzEK0MjP1S9wtFXjXNR5er49uLR0,1546
67
+ jaxsim-0.4.3.dev97.dist-info/METADATA,sha256=53FEV8OdSD0cdz2Hm1dtfd_aPsJPrKoNkA4mycVTOco,17276
68
+ jaxsim-0.4.3.dev97.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
69
+ jaxsim-0.4.3.dev97.dist-info/top_level.txt,sha256=LxGMA8FLtXjQ6oI7N5gd_R_oSUHxpXxUEOfT1xS_ni0,7
70
+ jaxsim-0.4.3.dev97.dist-info/RECORD,,