jaxsim 0.2.1.dev47__py3-none-any.whl → 0.2.1.dev54__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 +2 -2
- jaxsim/mujoco/loaders.py +3 -3
- jaxsim/parsers/kinematic_graph.py +2 -1
- jaxsim/parsers/rod/parser.py +70 -4
- {jaxsim-0.2.1.dev47.dist-info → jaxsim-0.2.1.dev54.dist-info}/METADATA +2 -2
- {jaxsim-0.2.1.dev47.dist-info → jaxsim-0.2.1.dev54.dist-info}/RECORD +9 -9
- {jaxsim-0.2.1.dev47.dist-info → jaxsim-0.2.1.dev54.dist-info}/LICENSE +0 -0
- {jaxsim-0.2.1.dev47.dist-info → jaxsim-0.2.1.dev54.dist-info}/WHEEL +0 -0
- {jaxsim-0.2.1.dev47.dist-info → jaxsim-0.2.1.dev54.dist-info}/top_level.txt +0 -0
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.2.1.
|
16
|
-
__version_tuple__ = version_tuple = (0, 2, 1, '
|
15
|
+
__version__ = version = '0.2.1.dev54'
|
16
|
+
__version_tuple__ = version_tuple = (0, 2, 1, 'dev54')
|
jaxsim/mujoco/loaders.py
CHANGED
@@ -203,10 +203,10 @@ class RodModelToMjcf:
|
|
203
203
|
joints_dict[joint_name].type = "fixed"
|
204
204
|
|
205
205
|
# Convert the ROD model to URDF.
|
206
|
-
urdf_string = rod.urdf.exporter.UrdfExporter
|
206
|
+
urdf_string = rod.urdf.exporter.UrdfExporter(
|
207
|
+
gazebo_preserve_fixed_joints=False, pretty=True
|
208
|
+
).to_urdf_string(
|
207
209
|
sdf=rod.Sdf(model=rod_model, version="1.7"),
|
208
|
-
gazebo_preserve_fixed_joints=False,
|
209
|
-
pretty=True,
|
210
210
|
)
|
211
211
|
|
212
212
|
# -------------------------------------
|
@@ -121,7 +121,8 @@ class KinematicGraph(Sequence[descriptions.LinkDescription]):
|
|
121
121
|
# Also here, we assume the model is fixed-base, therefore the first frame will
|
122
122
|
# have last_link_idx + 1. These frames are not part of the physics model.
|
123
123
|
for index, frame in enumerate(self.frames):
|
124
|
-
frame.
|
124
|
+
with frame.mutable_context(mutability=Mutability.MUTABLE_NO_VALIDATION):
|
125
|
+
frame.index = int(index + len(self.link_names()))
|
125
126
|
|
126
127
|
# Number joints so that their index matches their child link index
|
127
128
|
links_dict = {l.name: l for l in iter(self)}
|
jaxsim/parsers/rod/parser.py
CHANGED
@@ -6,6 +6,7 @@ import jax.numpy as jnp
|
|
6
6
|
import numpy as np
|
7
7
|
import rod
|
8
8
|
|
9
|
+
import jaxsim.utils
|
9
10
|
from jaxsim import logging
|
10
11
|
from jaxsim.math.quaternion import Quaternion
|
11
12
|
from jaxsim.parsers import descriptions, kinematic_graph
|
@@ -25,6 +26,7 @@ class SDFData(NamedTuple):
|
|
25
26
|
|
26
27
|
link_descriptions: List[descriptions.LinkDescription]
|
27
28
|
joint_descriptions: List[descriptions.JointDescription]
|
29
|
+
frame_descriptions: List[descriptions.LinkDescription]
|
28
30
|
collision_shapes: List[descriptions.CollisionShape]
|
29
31
|
|
30
32
|
sdf_model: rod.Model | None = None
|
@@ -70,6 +72,8 @@ def extract_model_data(
|
|
70
72
|
|
71
73
|
# Jaxsim supports only models compatible with URDF, i.e. those having all links
|
72
74
|
# directly attached to their parent joint without additional roto-translations.
|
75
|
+
# Furthermore, the following switch also post-processes frames such that their
|
76
|
+
# pose is expressed wrt the parent link they are rigidly attached to.
|
73
77
|
sdf_model.switch_frame_convention(frame_convention=rod.FrameConvention.Urdf)
|
74
78
|
|
75
79
|
# Log type of base link
|
@@ -113,6 +117,23 @@ def extract_model_data(
|
|
113
117
|
# Create a dictionary to find easily links
|
114
118
|
links_dict: Dict[str, descriptions.LinkDescription] = {l.name: l for l in links}
|
115
119
|
|
120
|
+
# ============
|
121
|
+
# Parse frames
|
122
|
+
# ============
|
123
|
+
|
124
|
+
# Parse the frames (unconnected)
|
125
|
+
frames = [
|
126
|
+
descriptions.LinkDescription(
|
127
|
+
name=f.name,
|
128
|
+
mass=jnp.array(0.0, dtype=float),
|
129
|
+
inertia=jnp.zeros(shape=(3, 3)),
|
130
|
+
parent=links_dict[f.attached_to],
|
131
|
+
pose=f.pose.transform() if f.pose is not None else jnp.eye(4),
|
132
|
+
)
|
133
|
+
for f in sdf_model.frames()
|
134
|
+
if f.attached_to in links_dict
|
135
|
+
]
|
136
|
+
|
116
137
|
# =========================
|
117
138
|
# Process fixed-base models
|
118
139
|
# =========================
|
@@ -309,6 +330,7 @@ def extract_model_data(
|
|
309
330
|
model_name=sdf_model.name,
|
310
331
|
link_descriptions=links,
|
311
332
|
joint_descriptions=joints,
|
333
|
+
frame_descriptions=frames,
|
312
334
|
collision_shapes=collisions,
|
313
335
|
fixed_base=sdf_model.is_fixed_base(),
|
314
336
|
base_link_name=sdf_model.get_canonical_link(),
|
@@ -338,10 +360,14 @@ def build_model_description(
|
|
338
360
|
model_description=model_description, model_name=None, is_urdf=is_urdf
|
339
361
|
)
|
340
362
|
|
341
|
-
# Build the model
|
363
|
+
# Build the intermediate representation used for building a JaxSim model.
|
364
|
+
# This process, beyond other operations, removes the fixed joints.
|
342
365
|
# Note: if the model is fixed-base, the fixed joint between world and the first
|
343
366
|
# link is removed and the pose of the first link is updated.
|
344
|
-
|
367
|
+
#
|
368
|
+
# The whole process is:
|
369
|
+
# URDF/SDF ⟶ rod.Model ⟶ ModelDescription ⟶ JaxSimModel.
|
370
|
+
graph = descriptions.ModelDescription.build_model_from(
|
345
371
|
name=sdf_data.model_name,
|
346
372
|
links=sdf_data.link_descriptions,
|
347
373
|
joints=sdf_data.joint_descriptions,
|
@@ -356,7 +382,47 @@ def build_model_description(
|
|
356
382
|
],
|
357
383
|
)
|
358
384
|
|
385
|
+
# Depending on how the model is reduced due to the removal of fixed joints,
|
386
|
+
# there might be frames that are no longer attached to existing links.
|
387
|
+
# We need to change the link to which they are attached to, and update their pose.
|
388
|
+
frames_with_no_parent_link = (
|
389
|
+
f for f in sdf_data.frame_descriptions if f.parent.name not in graph
|
390
|
+
)
|
391
|
+
|
392
|
+
# Build the object to compute forward kinematics.
|
393
|
+
fk = kinematic_graph.KinematicGraphTransforms(graph=graph)
|
394
|
+
|
395
|
+
for frame in frames_with_no_parent_link:
|
396
|
+
# Get the original data of the frame.
|
397
|
+
original_pose = frame.pose
|
398
|
+
original_parent_link = frame.parent.name
|
399
|
+
|
400
|
+
# The parent link, that has been removed, became a frame.
|
401
|
+
assert original_parent_link in graph.frames_dict, (frame, original_parent_link)
|
402
|
+
|
403
|
+
# Get the new parent of the frame corresponding to the removed parent link.
|
404
|
+
new_parent_link = graph.frames_dict[original_parent_link].parent.name
|
405
|
+
logging.debug(f"Frame '{frame.name}' is now attached to '{new_parent_link}'")
|
406
|
+
|
407
|
+
# Get the transform from the new parent link to the original parent link.
|
408
|
+
# The original pose is expressed wrt the original parent link.
|
409
|
+
F_H_P = fk.relative_transform(
|
410
|
+
relative_to=new_parent_link, name=original_parent_link
|
411
|
+
)
|
412
|
+
|
413
|
+
# Update the frame with the updated data.
|
414
|
+
with frame.mutable_context(
|
415
|
+
mutability=jaxsim.utils.Mutability.MUTABLE_NO_VALIDATION
|
416
|
+
):
|
417
|
+
frame.parent = graph.links_dict[new_parent_link]
|
418
|
+
frame.pose = np.array(F_H_P @ original_pose)
|
419
|
+
|
420
|
+
# Include the SDF frames originally stored in the SDF.
|
421
|
+
graph = dataclasses.replace(
|
422
|
+
graph, frames=sdf_data.frame_descriptions + graph.frames
|
423
|
+
)
|
424
|
+
|
359
425
|
# Store the parsed SDF tree as extra info
|
360
|
-
|
426
|
+
graph = dataclasses.replace(graph, extra_info={"sdf_model": sdf_data.sdf_model})
|
361
427
|
|
362
|
-
return
|
428
|
+
return graph
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: jaxsim
|
3
|
-
Version: 0.2.1.
|
3
|
+
Version: 0.2.1.dev54
|
4
4
|
Home-page: https://github.com/ami-iit/jaxsim
|
5
5
|
Author: Diego Ferigo
|
6
6
|
Author-email: diego.ferigo@iit.it
|
@@ -37,7 +37,7 @@ Requires-Dist: jaxlib >=0.4.13
|
|
37
37
|
Requires-Dist: jaxlie >=1.3.0
|
38
38
|
Requires-Dist: jax-dataclasses >=1.4.0
|
39
39
|
Requires-Dist: pptree
|
40
|
-
Requires-Dist: rod >=0.
|
40
|
+
Requires-Dist: rod >=0.3.0
|
41
41
|
Requires-Dist: typing-extensions ; python_version < "3.12"
|
42
42
|
Provides-Extra: all
|
43
43
|
Requires-Dist: black[jupyter] ~=24.0 ; extra == 'all'
|
@@ -1,5 +1,5 @@
|
|
1
1
|
jaxsim/__init__.py,sha256=OcrfoYS1DGcmAGqu2AqlCTiUVxcpi-IsVwcr_16x74Q,1789
|
2
|
-
jaxsim/_version.py,sha256=
|
2
|
+
jaxsim/_version.py,sha256=24mK1zDo1LYXJlnfAXK4DuEE3unwK-LVtB-E07NZnBs,426
|
3
3
|
jaxsim/logging.py,sha256=c4zhwBKf9eAYAHVp62kTEllqdsZgh0K-kPKVy8L3elU,1584
|
4
4
|
jaxsim/typing.py,sha256=MeuOCQtLAr-sPkvB_sU8FtwGNRirz1auCwIgRC-QZl8,646
|
5
5
|
jaxsim/api/__init__.py,sha256=fNTCPUeDfOAizRd4RsW3Epv0sLTu0KJGoFRSEsi75VM,162
|
@@ -29,18 +29,18 @@ jaxsim/math/skew.py,sha256=oOGSSR8PUGROl6IJFlrmu6K3gPH-u16hUPfKIkcVv9o,1177
|
|
29
29
|
jaxsim/math/transform.py,sha256=boeuN8df4Yd9NvS64g-xUYoNqG91YafYLam4iITFJVg,2917
|
30
30
|
jaxsim/mujoco/__init__.py,sha256=Zo5GAlN1DYKvX8s1hu1j6HntKIbBMLB9Puv9ouaNAZ8,158
|
31
31
|
jaxsim/mujoco/__main__.py,sha256=GBmB7J-zj75ZnFyuAAmpSOpbxi_HhHhWJeot3ljGDJY,5291
|
32
|
-
jaxsim/mujoco/loaders.py,sha256
|
32
|
+
jaxsim/mujoco/loaders.py,sha256=Tq3b2tq_BulGm9GCM00NQMzcD7B0yKvoyiP94aFbjx4,21023
|
33
33
|
jaxsim/mujoco/model.py,sha256=5-4KTbEbU19zjrSuvUVdLo3noWxTvlCNsFIs3rQTNDY,13506
|
34
34
|
jaxsim/mujoco/visualizer.py,sha256=YlteqcCbeB1B6saAHKBz1IJad3N5Rp163reZrzKLAys,5065
|
35
35
|
jaxsim/parsers/__init__.py,sha256=sonYi-bBWAoB04kp1mxT4uIORxjb7SdZ0ukGPmVx98Y,44
|
36
|
-
jaxsim/parsers/kinematic_graph.py,sha256=
|
36
|
+
jaxsim/parsers/kinematic_graph.py,sha256=rAqh1XBJU0qDkDoA_BSdt-PwBBTFO8SXVpr81Xumbp4,29074
|
37
37
|
jaxsim/parsers/descriptions/__init__.py,sha256=PbIlunVfb59pB5jSX97YVpMAANRZPRkJ0X-hS14rzv4,221
|
38
38
|
jaxsim/parsers/descriptions/collision.py,sha256=HUWwuRgI9KznY29FFw1_zU3bGigDEezrcPOJSxSJGNU,3382
|
39
39
|
jaxsim/parsers/descriptions/joint.py,sha256=r7teUWJyw62WS7qNCB_9FGQD1hvGHBepk-2LCSlmcSc,3052
|
40
40
|
jaxsim/parsers/descriptions/link.py,sha256=hqLLitrAXnouia6ULk1BPOIEfRxrXwHmoPsi306IZW8,2859
|
41
41
|
jaxsim/parsers/descriptions/model.py,sha256=hapbpO1VpC7f5ELkGH1ZtM2I3dpmYLz8Em5cb3DdiaA,9264
|
42
42
|
jaxsim/parsers/rod/__init__.py,sha256=G2vqlLajBLUc4gyzXwsEI2Wsi4TMOIF9bLDFeT6KrGU,92
|
43
|
-
jaxsim/parsers/rod/parser.py,sha256=
|
43
|
+
jaxsim/parsers/rod/parser.py,sha256=DmYYHAovzn1WnY_8qb6Sihr8QX--RMj32QF1RXPdScM,15278
|
44
44
|
jaxsim/parsers/rod/utils.py,sha256=9oO4YsQRaR2v700IkNOXRnPpn5i4N8HFfgjPkMLK2mc,5732
|
45
45
|
jaxsim/rbda/__init__.py,sha256=HLwxeU-IxaRpFGUCSQv-LDv20JHTt3Xj7ELiRbRieS8,319
|
46
46
|
jaxsim/rbda/aba.py,sha256=0OoCzHhf1v-qqr1y5PIrD7_mPwAlid0fjXxUrIa5E_s,9118
|
@@ -57,8 +57,8 @@ jaxsim/utils/__init__.py,sha256=tnQq1_CavdfeKaLYt3pmO7Jk4MU2RwwQU_qICkjyoTY,197
|
|
57
57
|
jaxsim/utils/hashless.py,sha256=bFIwKeo9KiWwsY8QM55duEGGQOyyJ4jQyPcuqTLEp5k,297
|
58
58
|
jaxsim/utils/jaxsim_dataclass.py,sha256=h26timZ_XrBL_Q_oymv-DkQd-EcUiHn8QexAaZXBY9c,11396
|
59
59
|
jaxsim/utils/tracing.py,sha256=KDMoyVPlu2NJvFkhtZwq5AkqMMgajt3munvJom-vEjQ,650
|
60
|
-
jaxsim-0.2.1.
|
61
|
-
jaxsim-0.2.1.
|
62
|
-
jaxsim-0.2.1.
|
63
|
-
jaxsim-0.2.1.
|
64
|
-
jaxsim-0.2.1.
|
60
|
+
jaxsim-0.2.1.dev54.dist-info/LICENSE,sha256=eaYdFmdeMbiIoIiPzEK0MjP1S9wtFXjXNR5er49uLR0,1546
|
61
|
+
jaxsim-0.2.1.dev54.dist-info/METADATA,sha256=mWt_RdR_9w3PkebK_45c5dLOiDJpSXB7sI2ucykU7mU,9744
|
62
|
+
jaxsim-0.2.1.dev54.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
63
|
+
jaxsim-0.2.1.dev54.dist-info/top_level.txt,sha256=LxGMA8FLtXjQ6oI7N5gd_R_oSUHxpXxUEOfT1xS_ni0,7
|
64
|
+
jaxsim-0.2.1.dev54.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|