jaxsim 0.2.dev428__py3-none-any.whl → 0.2.dev435__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 +45 -0
- {jaxsim-0.2.dev428.dist-info → jaxsim-0.2.dev435.dist-info}/METADATA +1 -1
- {jaxsim-0.2.dev428.dist-info → jaxsim-0.2.dev435.dist-info}/RECORD +7 -7
- {jaxsim-0.2.dev428.dist-info → jaxsim-0.2.dev435.dist-info}/LICENSE +0 -0
- {jaxsim-0.2.dev428.dist-info → jaxsim-0.2.dev435.dist-info}/WHEEL +0 -0
- {jaxsim-0.2.dev428.dist-info → jaxsim-0.2.dev435.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.
|
16
|
-
__version_tuple__ = version_tuple = (0, 2, '
|
15
|
+
__version__ = version = '0.2.dev435'
|
16
|
+
__version_tuple__ = version_tuple = (0, 2, 'dev435')
|
jaxsim/mujoco/loaders.py
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
import dataclasses
|
1
2
|
import pathlib
|
2
3
|
import tempfile
|
3
4
|
import warnings
|
@@ -159,6 +160,7 @@ class RodModelToMjcf:
|
|
159
160
|
considered_joints: list[str] | None = None,
|
160
161
|
plane_normal: tuple[float, float, float] = (0, 0, 1),
|
161
162
|
heightmap: bool | None = None,
|
163
|
+
cameras: list[dict[str, str]] | dict[str, str] = None,
|
162
164
|
) -> tuple[str, dict[str, Any]]:
|
163
165
|
"""
|
164
166
|
Converts a ROD model to a Mujoco MJCF string.
|
@@ -166,6 +168,9 @@ class RodModelToMjcf:
|
|
166
168
|
Args:
|
167
169
|
rod_model: The ROD model to convert.
|
168
170
|
considered_joints: The list of joint names to consider in the conversion.
|
171
|
+
plane_normal: The normal vector of the plane.
|
172
|
+
heightmap: Whether to generate a heightmap.
|
173
|
+
cameras: The list of cameras to add to the scene.
|
169
174
|
|
170
175
|
Returns:
|
171
176
|
tuple: A tuple containing the MJCF string and the assets dictionary.
|
@@ -470,6 +475,14 @@ class RodModelToMjcf:
|
|
470
475
|
fovy="60",
|
471
476
|
)
|
472
477
|
|
478
|
+
# Add user-defined camera
|
479
|
+
cameras = cameras if cameras is not None else {}
|
480
|
+
for camera in cameras if isinstance(cameras, list) else [cameras]:
|
481
|
+
mj_camera = MujocoCamera.build(**camera)
|
482
|
+
_ = ET.SubElement(
|
483
|
+
worldbody_element, "camera", dataclasses.asdict(mj_camera)
|
484
|
+
)
|
485
|
+
|
473
486
|
# ------------------------------------------------
|
474
487
|
# Add a light following the CoM of the first link
|
475
488
|
# ------------------------------------------------
|
@@ -504,6 +517,7 @@ class UrdfToMjcf:
|
|
504
517
|
model_name: str | None = None,
|
505
518
|
plane_normal: tuple[float, float, float] = (0, 0, 1),
|
506
519
|
heightmap: bool | None = None,
|
520
|
+
cameras: list[dict[str, str]] | dict[str, str] = None,
|
507
521
|
) -> tuple[str, dict[str, Any]]:
|
508
522
|
"""
|
509
523
|
Converts a URDF file to a Mujoco MJCF string.
|
@@ -512,6 +526,9 @@ class UrdfToMjcf:
|
|
512
526
|
urdf: The URDF file to convert.
|
513
527
|
considered_joints: The list of joint names to consider in the conversion.
|
514
528
|
model_name: The name of the model to convert.
|
529
|
+
plane_normal: The normal vector of the plane.
|
530
|
+
heightmap: Whether to generate a heightmap.
|
531
|
+
cameras: The list of cameras to add to the scene.
|
515
532
|
|
516
533
|
Returns:
|
517
534
|
tuple: A tuple containing the MJCF string and the assets dictionary.
|
@@ -530,6 +547,7 @@ class UrdfToMjcf:
|
|
530
547
|
considered_joints=considered_joints,
|
531
548
|
plane_normal=plane_normal,
|
532
549
|
heightmap=heightmap,
|
550
|
+
cameras=cameras,
|
533
551
|
)
|
534
552
|
|
535
553
|
|
@@ -541,6 +559,7 @@ class SdfToMjcf:
|
|
541
559
|
model_name: str | None = None,
|
542
560
|
plane_normal: tuple[float, float, float] = (0, 0, 1),
|
543
561
|
heightmap: bool | None = None,
|
562
|
+
cameras: list[dict[str, str]] | dict[str, str] = None,
|
544
563
|
) -> tuple[str, dict[str, Any]]:
|
545
564
|
"""
|
546
565
|
Converts a SDF file to a Mujoco MJCF string.
|
@@ -549,6 +568,9 @@ class SdfToMjcf:
|
|
549
568
|
sdf: The SDF file to convert.
|
550
569
|
considered_joints: The list of joint names to consider in the conversion.
|
551
570
|
model_name: The name of the model to convert.
|
571
|
+
plane_normal: The normal vector of the plane.
|
572
|
+
heightmap: Whether to generate a heightmap.
|
573
|
+
cameras: The list of cameras to add to the scene.
|
552
574
|
|
553
575
|
Returns:
|
554
576
|
tuple: A tuple containing the MJCF string and the assets dictionary.
|
@@ -567,4 +589,27 @@ class SdfToMjcf:
|
|
567
589
|
considered_joints=considered_joints,
|
568
590
|
plane_normal=plane_normal,
|
569
591
|
heightmap=heightmap,
|
592
|
+
cameras=cameras,
|
570
593
|
)
|
594
|
+
|
595
|
+
|
596
|
+
@dataclasses.dataclass
|
597
|
+
class MujocoCamera:
|
598
|
+
name: str
|
599
|
+
mode: str
|
600
|
+
pos: str
|
601
|
+
xyaxes: str
|
602
|
+
fovy: str
|
603
|
+
|
604
|
+
@classmethod
|
605
|
+
def build(cls, **kwargs):
|
606
|
+
if not all(isinstance(value, str) for value in kwargs.values()):
|
607
|
+
raise ValueError("Values must be strings")
|
608
|
+
|
609
|
+
if len(kwargs["pos"].split()) != 3:
|
610
|
+
raise ValueError("pos must have three values separated by space")
|
611
|
+
|
612
|
+
if len(kwargs["xyaxes"].split()) != 6:
|
613
|
+
raise ValueError("xyaxes must have six values separated by space")
|
614
|
+
|
615
|
+
return cls(**kwargs)
|
@@ -1,5 +1,5 @@
|
|
1
1
|
jaxsim/__init__.py,sha256=OcrfoYS1DGcmAGqu2AqlCTiUVxcpi-IsVwcr_16x74Q,1789
|
2
|
-
jaxsim/_version.py,sha256=
|
2
|
+
jaxsim/_version.py,sha256=rUboBlbZMDawXjrlvgG4MouhFWI6cvGpLnbn2W6ms1I,423
|
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,7 +29,7 @@ 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=8_2jB6DjGyFGPQS6mTs_1JH37Wd6mSiWP8rlNTuB6Uo,21029
|
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
|
@@ -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=T8nZolb563mYJD7YvTmYW-z-hpkEiaK3cDbYHqwtqRc,11347
|
59
59
|
jaxsim/utils/tracing.py,sha256=KDMoyVPlu2NJvFkhtZwq5AkqMMgajt3munvJom-vEjQ,650
|
60
|
-
jaxsim-0.2.
|
61
|
-
jaxsim-0.2.
|
62
|
-
jaxsim-0.2.
|
63
|
-
jaxsim-0.2.
|
64
|
-
jaxsim-0.2.
|
60
|
+
jaxsim-0.2.dev435.dist-info/LICENSE,sha256=eaYdFmdeMbiIoIiPzEK0MjP1S9wtFXjXNR5er49uLR0,1546
|
61
|
+
jaxsim-0.2.dev435.dist-info/METADATA,sha256=tUs4Lvi29uqo36Pc8MGDr5lKmvaSBB2aiWjnVOvDrEA,9778
|
62
|
+
jaxsim-0.2.dev435.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
63
|
+
jaxsim-0.2.dev435.dist-info/top_level.txt,sha256=LxGMA8FLtXjQ6oI7N5gd_R_oSUHxpXxUEOfT1xS_ni0,7
|
64
|
+
jaxsim-0.2.dev435.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|