jaxsim 0.2.dev188__py3-none-any.whl → 0.2.dev364__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.
Files changed (81) hide show
  1. jaxsim/__init__.py +3 -4
  2. jaxsim/_version.py +2 -2
  3. jaxsim/api/__init__.py +3 -1
  4. jaxsim/api/com.py +240 -0
  5. jaxsim/api/common.py +13 -2
  6. jaxsim/api/contact.py +120 -43
  7. jaxsim/api/data.py +112 -71
  8. jaxsim/api/joint.py +77 -36
  9. jaxsim/api/kin_dyn_parameters.py +777 -0
  10. jaxsim/api/link.py +150 -75
  11. jaxsim/api/model.py +542 -269
  12. jaxsim/api/ode.py +88 -72
  13. jaxsim/api/ode_data.py +694 -0
  14. jaxsim/api/references.py +12 -11
  15. jaxsim/integrators/__init__.py +2 -2
  16. jaxsim/integrators/common.py +110 -24
  17. jaxsim/integrators/fixed_step.py +11 -67
  18. jaxsim/integrators/variable_step.py +610 -0
  19. jaxsim/math/__init__.py +11 -0
  20. jaxsim/math/adjoint.py +24 -2
  21. jaxsim/math/joint_model.py +335 -0
  22. jaxsim/math/quaternion.py +44 -3
  23. jaxsim/math/rotation.py +4 -4
  24. jaxsim/math/transform.py +93 -0
  25. jaxsim/parsers/descriptions/collision.py +14 -0
  26. jaxsim/parsers/descriptions/link.py +13 -2
  27. jaxsim/parsers/kinematic_graph.py +5 -0
  28. jaxsim/parsers/rod/utils.py +7 -8
  29. jaxsim/rbda/__init__.py +7 -0
  30. jaxsim/rbda/aba.py +295 -0
  31. jaxsim/rbda/collidable_points.py +142 -0
  32. jaxsim/{physics/algos → rbda}/crba.py +43 -42
  33. jaxsim/rbda/forward_kinematics.py +113 -0
  34. jaxsim/rbda/jacobian.py +201 -0
  35. jaxsim/rbda/rnea.py +237 -0
  36. jaxsim/rbda/soft_contacts.py +296 -0
  37. jaxsim/rbda/utils.py +152 -0
  38. jaxsim/terrain/__init__.py +2 -0
  39. jaxsim/{physics/algos → terrain}/terrain.py +4 -6
  40. jaxsim/utils/__init__.py +1 -4
  41. jaxsim/utils/hashless.py +18 -0
  42. jaxsim/utils/jaxsim_dataclass.py +281 -30
  43. {jaxsim-0.2.dev188.dist-info → jaxsim-0.2.dev364.dist-info}/METADATA +4 -6
  44. jaxsim-0.2.dev364.dist-info/RECORD +64 -0
  45. {jaxsim-0.2.dev188.dist-info → jaxsim-0.2.dev364.dist-info}/WHEEL +1 -1
  46. jaxsim/high_level/__init__.py +0 -2
  47. jaxsim/high_level/common.py +0 -11
  48. jaxsim/high_level/joint.py +0 -148
  49. jaxsim/high_level/link.py +0 -259
  50. jaxsim/high_level/model.py +0 -1686
  51. jaxsim/math/conv.py +0 -114
  52. jaxsim/math/joint.py +0 -102
  53. jaxsim/math/plucker.py +0 -100
  54. jaxsim/physics/__init__.py +0 -12
  55. jaxsim/physics/algos/__init__.py +0 -0
  56. jaxsim/physics/algos/aba.py +0 -254
  57. jaxsim/physics/algos/aba_motors.py +0 -284
  58. jaxsim/physics/algos/forward_kinematics.py +0 -79
  59. jaxsim/physics/algos/jacobian.py +0 -98
  60. jaxsim/physics/algos/rnea.py +0 -180
  61. jaxsim/physics/algos/rnea_motors.py +0 -196
  62. jaxsim/physics/algos/soft_contacts.py +0 -523
  63. jaxsim/physics/algos/utils.py +0 -69
  64. jaxsim/physics/model/__init__.py +0 -0
  65. jaxsim/physics/model/ground_contact.py +0 -55
  66. jaxsim/physics/model/physics_model.py +0 -388
  67. jaxsim/physics/model/physics_model_state.py +0 -283
  68. jaxsim/simulation/__init__.py +0 -4
  69. jaxsim/simulation/integrators.py +0 -393
  70. jaxsim/simulation/ode.py +0 -290
  71. jaxsim/simulation/ode_data.py +0 -96
  72. jaxsim/simulation/ode_integration.py +0 -62
  73. jaxsim/simulation/simulator.py +0 -543
  74. jaxsim/simulation/simulator_callbacks.py +0 -79
  75. jaxsim/simulation/utils.py +0 -15
  76. jaxsim/sixd/__init__.py +0 -2
  77. jaxsim/utils/oop.py +0 -536
  78. jaxsim/utils/vmappable.py +0 -117
  79. jaxsim-0.2.dev188.dist-info/RECORD +0 -81
  80. {jaxsim-0.2.dev188.dist-info → jaxsim-0.2.dev364.dist-info}/LICENSE +0 -0
  81. {jaxsim-0.2.dev188.dist-info → jaxsim-0.2.dev364.dist-info}/top_level.txt +0 -0
jaxsim/utils/vmappable.py DELETED
@@ -1,117 +0,0 @@
1
- import dataclasses
2
- from typing import Type
3
-
4
- import jax
5
- import jax.numpy as jnp
6
- import jax_dataclasses
7
-
8
- from . import JaxsimDataclass, Mutability
9
-
10
- try:
11
- from typing import Self
12
- except ImportError:
13
- from typing_extensions import Self
14
-
15
-
16
- @jax_dataclasses.pytree_dataclass
17
- class Vmappable(JaxsimDataclass):
18
- """Abstract class with utilities for vmappable pytrees."""
19
-
20
- batch_size: jax_dataclasses.Static[int] = dataclasses.field(
21
- default=int(0), repr=False, compare=False, hash=False, kw_only=True
22
- )
23
-
24
- @property
25
- def vectorized(self) -> bool:
26
- """Marks this pytree as vectorized."""
27
-
28
- return self.batch_size > 0
29
-
30
- @classmethod
31
- def build_from_list(cls: Type[Self], list_of_obj: list[Self]) -> Self:
32
- """
33
- Build a vectorized pytree from a list of pytree of the same type.
34
-
35
- Args:
36
- list_of_obj: The list of pytrees to vectorize.
37
-
38
- Returns:
39
- The vectorized pytree having as leaves the stacked leaves of the input list.
40
- """
41
-
42
- if set(type(el) for el in list_of_obj) != {cls}:
43
- msg = "The input list must contain only objects of type '{}'"
44
- raise ValueError(msg.format(cls.__name__))
45
-
46
- # Create a pytree by stacking all the leafs of the input list
47
- data_vec: Vmappable = jax.tree_map(
48
- lambda *leafs: jnp.array(leafs), *list_of_obj
49
- )
50
-
51
- # Store the batch dimension
52
- with data_vec.mutable_context(mutability=Mutability.MUTABLE_NO_VALIDATION):
53
- data_vec.batch_size = len(list_of_obj)
54
-
55
- # Detect the most common mutability in the input list
56
- mutabilities = [e._mutability() for e in list_of_obj]
57
- mutability = max(set(mutabilities), key=mutabilities.count)
58
-
59
- # Update the mutability of the vectorized pytree
60
- data_vec._set_mutability(mutability)
61
-
62
- return data_vec
63
-
64
- def vectorize(self: Self, batch_size: int) -> Self:
65
- """
66
- Return a vectorized version of this pytree.
67
-
68
- Args:
69
- batch_size: The batch size.
70
-
71
- Returns:
72
- A vectorized version of this pytree obtained by stacking the leaves of the
73
- original pytree along a new batch dimension (the first one).
74
- """
75
-
76
- if self.vectorized:
77
- raise RuntimeError("Cannot vectorize an already vectorized object")
78
-
79
- if batch_size == 0:
80
- return self.copy()
81
-
82
- # TODO validate if mutability is maintained
83
-
84
- return self.__class__.build_from_list(list_of_obj=[self] * batch_size)
85
-
86
- def extract_element(self: Self, index: int) -> Self:
87
- """
88
- Extract the i-th element from a vectorized pytree.
89
-
90
- Args:
91
- index: The index of the element to extract.
92
-
93
- Returns:
94
- A non vectorized pytree obtained by extracting the i-th element from the
95
- vectorized pytree.
96
- """
97
-
98
- if index < 0:
99
- raise ValueError("The index of the desired element cannot be negative")
100
-
101
- if index == 0 and self.batch_size == 0:
102
- return self.copy()
103
-
104
- if not self.vectorized:
105
- raise RuntimeError("Cannot extract elements from a non-vectorized object")
106
-
107
- if index >= self.batch_size:
108
- raise ValueError("The index must be smaller than the batch size")
109
-
110
- # Get the i-th pytree by extracting the i-th element from the vectorized pytree
111
- data = jax.tree_map(lambda leaf: leaf[index], self)
112
-
113
- # Update the batch size of the extracted scalar pytree
114
- with data.mutable_context(mutability=Mutability.MUTABLE):
115
- data.batch_size = 0
116
-
117
- return data
@@ -1,81 +0,0 @@
1
- jaxsim/__init__.py,sha256=acqCVEg71ekNOwazlwA06dXeaPJh3Sr_e5JB8pcI5lo,1862
2
- jaxsim/_version.py,sha256=25Ei2WVWsVwEC3k_WuiVBPfYOrVetMFq0zkbn_gOAyY,423
3
- jaxsim/logging.py,sha256=c4zhwBKf9eAYAHVp62kTEllqdsZgh0K-kPKVy8L3elU,1584
4
- jaxsim/typing.py,sha256=MeuOCQtLAr-sPkvB_sU8FtwGNRirz1auCwIgRC-QZl8,646
5
- jaxsim/api/__init__.py,sha256=UehgJtcV9BYlX6vec-f_IgnMcq-F9BU_STsR0RDjEjA,53
6
- jaxsim/api/common.py,sha256=I8YgQwsfLcuWXtyp_2IVIyAnWMsfcf4ICmgkMfaGyRs,6475
7
- jaxsim/api/contact.py,sha256=9LX9FNXSXjMonJgg6svyrFcRfhptfBMywbswBUebHeE,5945
8
- jaxsim/api/data.py,sha256=mKgyYEJ6JpuHcXe_ddzw13Y553SV_92AzH3mT4FaxBo,25588
9
- jaxsim/api/joint.py,sha256=J65MgjMzp2O980wIEf2TxG_VCgczUsexGgd4YJ6rxiE,3615
10
- jaxsim/api/link.py,sha256=Fpbtr2JF9fAouOX-lGAmajF2ZEz6q8ttDYsCiqpLxEk,6939
11
- jaxsim/api/model.py,sha256=sxFJADqHXXm8nCvwYiorOgl9nzGhA_QvI1dOSOv9its,35206
12
- jaxsim/api/ode.py,sha256=cbWrXe7s5O3UCpWpI77Lg8Pujr_SiaQfLc7ELBqnJQM,9492
13
- jaxsim/api/references.py,sha256=hiVrDfXF0jOYrtLpb2_-nmunz0p2maIDFx_NZYPOCks,15419
14
- jaxsim/high_level/__init__.py,sha256=aWYBCsYmEO76Qt4GEi91Hye_ifGFLvc_bpy9OQplz2o,69
15
- jaxsim/high_level/common.py,sha256=6nyRlFsNOLEy5JvLH70VPWeHGSL_ZKNxX3Q62ccqSuY,196
16
- jaxsim/high_level/joint.py,sha256=0WF0QWkZzP0SXw0QYpn3PAwdZq0_uXFr2_f1OATiOBA,4089
17
- jaxsim/high_level/link.py,sha256=4kcBMh-3w9c-fkTYm3_sXfdwd3NwUm7jKf5BjwEge94,8010
18
- jaxsim/high_level/model.py,sha256=q29hSs0gH_UQrUyVzuCyF9YRB79WEWyHcVvV_1B9LrA,57054
19
- jaxsim/integrators/__init__.py,sha256=x4kYr7k-nC0X7HH2bTXzGOl_3B9TBN9blw5BBxQtyQ0,72
20
- jaxsim/integrators/common.py,sha256=kL4EqUjWZUNPtDrCcrStx-ZTxEYDS-W2WPQ0g-QqHqs,17567
21
- jaxsim/integrators/fixed_step.py,sha256=_gChRm0RHjDtst-aWjyQKUys6TyYhZqdWap7vLf5LaE,4291
22
- jaxsim/math/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
23
- jaxsim/math/adjoint.py,sha256=ImkOkWHQKMukBprLTsOPpSuqb1NNPA3_t447zRVo79s,3779
24
- jaxsim/math/conv.py,sha256=jbr9MU_vGtTpLTQpbqwAT4huF51skCfORFUBmKSdlaI,3138
25
- jaxsim/math/cross.py,sha256=U7yEx_l75mSy5g6O-jsjBztApvxC3WaV4MpkS5tThu4,1330
26
- jaxsim/math/inertia.py,sha256=UAB7ym4gXFanejcs_ovZMpteHCc6poWYmt-mLmd5hhk,1640
27
- jaxsim/math/joint.py,sha256=vNgxPfn6rkHHrIt_2vYwS832mDMYmza_7cnle2Jh8sA,3012
28
- jaxsim/math/plucker.py,sha256=44NvKVbcZoG8ivFN1BeXxDpuSFdEre1Q6ZXvhnmIiPY,2282
29
- jaxsim/math/quaternion.py,sha256=ToyRnAWU0JvKSSSX2vaJeSw2lMa5BGU72DjtonOUw0k,3685
30
- jaxsim/math/rotation.py,sha256=MHOnrpS5Sf4rszhOpZ8w7qXFkEl7UMltYimqqsuYuuU,2187
31
- jaxsim/math/skew.py,sha256=oOGSSR8PUGROl6IJFlrmu6K3gPH-u16hUPfKIkcVv9o,1177
32
- jaxsim/mujoco/__init__.py,sha256=Zo5GAlN1DYKvX8s1hu1j6HntKIbBMLB9Puv9ouaNAZ8,158
33
- jaxsim/mujoco/__main__.py,sha256=GBmB7J-zj75ZnFyuAAmpSOpbxi_HhHhWJeot3ljGDJY,5291
34
- jaxsim/mujoco/loaders.py,sha256=8sXc_tsDFWBYl8nesgFarYd3hA-PESLMrXsnR3Siz1Y,16400
35
- jaxsim/mujoco/model.py,sha256=0kG2GERxjVFqWZ1K3352rgUNfchB4kRtIrsvv4pS4oc,10766
36
- jaxsim/mujoco/visualizer.py,sha256=-qg26t5tleTva6zzQmc5SdnlC8XZ1ZAwZ_lDjdwHJ0A,4400
37
- jaxsim/parsers/__init__.py,sha256=sonYi-bBWAoB04kp1mxT4uIORxjb7SdZ0ukGPmVx98Y,44
38
- jaxsim/parsers/kinematic_graph.py,sha256=5wQnbzu8JE0bbnLRxK4ZsD_gQ9kbBpYbhUSzCMiNWko,23610
39
- jaxsim/parsers/descriptions/__init__.py,sha256=EbTfnrK3oCxA3pNv--YUwllJ6uICENvFgAdRbYtS9ts,238
40
- jaxsim/parsers/descriptions/collision.py,sha256=p8v24UyWNQFd3n5t3Z25IamfTqw19V9VlF5oyxeQXtU,2935
41
- jaxsim/parsers/descriptions/joint.py,sha256=hpH0ANvIhbEQk-NGRmWIvPv3lXW385TBIMWNgz5rzM4,4106
42
- jaxsim/parsers/descriptions/link.py,sha256=SONPaSwtNhIX93RIVng8Fb_Y7I5h3sk-5rsqd5U7Fmw,2493
43
- jaxsim/parsers/descriptions/model.py,sha256=wenuDrjoBf6prkzm9WyYT0nFWc0l6WBpKNjLoRUDPxo,8937
44
- jaxsim/parsers/rod/__init__.py,sha256=G2vqlLajBLUc4gyzXwsEI2Wsi4TMOIF9bLDFeT6KrGU,92
45
- jaxsim/parsers/rod/parser.py,sha256=mFi1baSJte6EMmWLpVjVuCpicfAAF48aFUzoKzYzPpo,12555
46
- jaxsim/parsers/rod/utils.py,sha256=C3RfLSnHHR7rgZhnM15QjM_tpJFHKf1Jf2mOsdep3LM,6492
47
- jaxsim/physics/__init__.py,sha256=TKH7IqQi39eobWT03b820ky6tWVWFFWcO8YPayNpnZc,216
48
- jaxsim/physics/algos/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
49
- jaxsim/physics/algos/aba.py,sha256=nv7ezClJT6ygx-pui3oZzUrOc-eMlvRYUzDNwCLOUwE,7547
50
- jaxsim/physics/algos/aba_motors.py,sha256=gGdFrFvImTwYs2V2lONHh85DObppee1MkDUoUGGoc24,8362
51
- jaxsim/physics/algos/crba.py,sha256=5OcPNaeGMZ3IcemhX4cdXvUUtysJv1SB92QkZTVtizc,4478
52
- jaxsim/physics/algos/forward_kinematics.py,sha256=myiqBGk5Nv-OIJpkNFVOby2FdHEJM3teEOQrL77dExQ,2513
53
- jaxsim/physics/algos/jacobian.py,sha256=HQk7UBYwWr2_qIYZBil_t9nqoL-TQB8hi-JHdPcSA0g,3166
54
- jaxsim/physics/algos/rnea.py,sha256=bIv6TTwdCZVj_s9Fd5i_ZTMib4W2_sn8gxCbMRrzRcg,5322
55
- jaxsim/physics/algos/rnea_motors.py,sha256=gaiEAOfpw9kZBVImfNKKwpgIgM8eygVu--wszh3npJc,5684
56
- jaxsim/physics/algos/soft_contacts.py,sha256=mPNs5a3JAZ5dRTWbNMhZNV57UyYxQTqjRQXGA5pk3II,18424
57
- jaxsim/physics/algos/terrain.py,sha256=Gw9-1AjU4c4Yd2xzo0i-fgWwYlroj03TjScJsz_2m9o,2228
58
- jaxsim/physics/algos/utils.py,sha256=0OiELbXtv5Jink3l-vMK_OGHgGkZ_wTAAclcd7vDKoc,2230
59
- jaxsim/physics/model/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
60
- jaxsim/physics/model/ground_contact.py,sha256=mva-yDzYHREmgUu8jGJmIAsf66_SF6ZISmN-XQQ9Ktw,1924
61
- jaxsim/physics/model/physics_model.py,sha256=izK5EaKFwNZVqD2hG69yZ5XOW5MmOFyP8_KojaWxBMk,14529
62
- jaxsim/physics/model/physics_model_state.py,sha256=Av42rJWgicqxDmZZu1T_clpnmeaX_daASYhA7cxHYxQ,9256
63
- jaxsim/simulation/__init__.py,sha256=WOWkzq7rMGa4xWvjNqTYtD0Nl4yLQtULGW1xU7hD9m0,182
64
- jaxsim/simulation/integrators.py,sha256=WIlL7xi4UocSlWg4Qms8-6puqRYnK5A4r7TJUNPg5g0,13022
65
- jaxsim/simulation/ode.py,sha256=ntq_iQPIw3SHj64CZWD2mHAKmt05ZgRpw2UwyTxHDOQ,10380
66
- jaxsim/simulation/ode_data.py,sha256=5nPynNSC5tRnhAVwOCkdv6FrDn148bC7zZaqVCKgowM,2952
67
- jaxsim/simulation/ode_integration.py,sha256=VDprQYoHEE_iI7ia1Mm3RyYl-LRvHU8dJEvRoGA4TFA,1947
68
- jaxsim/simulation/simulator.py,sha256=qCI5QG0WKkBC5GNqauSvI7rSlGD7CLttTzCgLED7iJM,18123
69
- jaxsim/simulation/simulator_callbacks.py,sha256=QWdY7dilmjrxeieWCB6RQ-cWpwLuUOK8fYWXpnnBcyU,2217
70
- jaxsim/simulation/utils.py,sha256=YdNA1mYGBAE7xVA-Dw7_OoBEuh0J8RS2X0RPQZf4c5E,329
71
- jaxsim/sixd/__init__.py,sha256=3tbynXQjvJ6X1IRcDH5eQBgBL0ilTSerDkS8SEF7a8A,62
72
- jaxsim/utils/__init__.py,sha256=UQsjrWMrhSQUfUXIIQhzd0kEioLHR3U0OhB-sIQqOd4,291
73
- jaxsim/utils/jaxsim_dataclass.py,sha256=FbjfEoCoYC_F-M3wUggXiEhQ7MMS-V_ciYQca-uSiMQ,3272
74
- jaxsim/utils/oop.py,sha256=LQhBXkSOD0zgYNJLO7Bl0FPRg-LvtvPzxyQa1WFP0rM,22616
75
- jaxsim/utils/tracing.py,sha256=KDMoyVPlu2NJvFkhtZwq5AkqMMgajt3munvJom-vEjQ,650
76
- jaxsim/utils/vmappable.py,sha256=NqGL9nGFRI5OorCfnjXsjR_yXigzDxL0lW1YhQ_nMTY,3655
77
- jaxsim-0.2.dev188.dist-info/LICENSE,sha256=EsU2z6_sWW4Zduzq3goVWjZoCZVKQsM4H_y0o7oRA7Q,1547
78
- jaxsim-0.2.dev188.dist-info/METADATA,sha256=flkZoYKaLN8C6F_IlOOyfucfXnzwHxBN8Kgi9NXNJww,7734
79
- jaxsim-0.2.dev188.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
80
- jaxsim-0.2.dev188.dist-info/top_level.txt,sha256=LxGMA8FLtXjQ6oI7N5gd_R_oSUHxpXxUEOfT1xS_ni0,7
81
- jaxsim-0.2.dev188.dist-info/RECORD,,