jaxsim 0.5.1.dev164__py3-none-any.whl → 0.5.1.dev166__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.dev164'
16
- __version_tuple__ = version_tuple = (0, 5, 1, 'dev164')
15
+ __version__ = version = '0.5.1.dev166'
16
+ __version_tuple__ = version_tuple = (0, 5, 1, 'dev166')
jaxsim/mujoco/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
- from .loaders import RodModelToMjcf, SdfToMjcf, UrdfToMjcf
1
+ from .loaders import ModelToMjcf, RodModelToMjcf, SdfToMjcf, UrdfToMjcf
2
2
  from .model import MujocoModelHelper
3
3
  from .utils import mujoco_data_from_jaxsim
4
4
  from .visualizer import MujocoVideoRecorder, MujocoVisualizer
jaxsim/mujoco/loaders.py CHANGED
@@ -9,6 +9,8 @@ import numpy as np
9
9
  import rod.urdf.exporter
10
10
  from lxml import etree as ET
11
11
 
12
+ from jaxsim import logging
13
+
12
14
  from .utils import MujocoCamera
13
15
 
14
16
  MujocoCameraType = (
@@ -61,6 +63,59 @@ def load_rod_model(
61
63
  return models[model_name]
62
64
 
63
65
 
66
+ class ModelToMjcf:
67
+ """
68
+ Class to convert a URDF/SDF file or a ROD model to a Mujoco MJCF string.
69
+ """
70
+
71
+ @staticmethod
72
+ def convert(
73
+ model: str | pathlib.Path | rod.Model,
74
+ considered_joints: list[str] | None = None,
75
+ plane_normal: tuple[float, float, float] = (0, 0, 1),
76
+ heightmap: bool | None = None,
77
+ heightmap_samples_xy: tuple[int, int] = (101, 101),
78
+ cameras: MujocoCameraType = (),
79
+ ) -> tuple[str, dict[str, Any]]:
80
+ """
81
+ Convert a model to a Mujoco MJCF string.
82
+
83
+ Args:
84
+ model: The URDF/SDF file or ROD model to convert.
85
+ considered_joints: The list of joint names to consider in the conversion.
86
+ plane_normal: The normal vector of the plane.
87
+ heightmap: Whether to generate a heightmap.
88
+ heightmap_samples_xy: The number of points in the heightmap grid.
89
+ cameras: The custom cameras to add to the scene.
90
+
91
+ Returns:
92
+ A tuple containing the MJCF string and the dictionary of assets.
93
+ """
94
+
95
+ match model:
96
+ case rod.Model():
97
+ rod_model = model
98
+ case str() | pathlib.Path():
99
+ # Convert the JaxSim model to a ROD model.
100
+ rod_model = load_rod_model(
101
+ model_description=model,
102
+ is_urdf=None,
103
+ model_name=None,
104
+ )
105
+ case _:
106
+ raise TypeError(f"Unsupported type for 'model': {type(model)}")
107
+
108
+ # Convert the ROD model to MJCF.
109
+ return RodModelToMjcf.convert(
110
+ rod_model=rod_model,
111
+ considered_joints=considered_joints,
112
+ plane_normal=plane_normal,
113
+ heightmap=heightmap,
114
+ heightmap_samples_xy=heightmap_samples_xy,
115
+ cameras=cameras,
116
+ )
117
+
118
+
64
119
  class RodModelToMjcf:
65
120
  """
66
121
  Class to convert a ROD model to a Mujoco MJCF string.
@@ -552,6 +607,8 @@ class UrdfToMjcf:
552
607
  tuple: A tuple containing the MJCF string and the assets dictionary.
553
608
  """
554
609
 
610
+ logging.warning("This method is deprecated. Use 'ModelToMjcf.convert' instead.")
611
+
555
612
  # Get the ROD model.
556
613
  rod_model = load_rod_model(
557
614
  model_description=urdf,
@@ -598,6 +655,8 @@ class SdfToMjcf:
598
655
  tuple: A tuple containing the MJCF string and the assets dictionary.
599
656
  """
600
657
 
658
+ logging.warning("This method is deprecated. Use 'ModelToMjcf.convert' instead.")
659
+
601
660
  # Get the ROD model.
602
661
  rod_model = load_rod_model(
603
662
  model_description=sdf,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: jaxsim
3
- Version: 0.5.1.dev164
3
+ Version: 0.5.1.dev166
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=_8rbKOf3bwx-2ChEbspZxs_rZY0RqUcmWAftnEw1bfM,3401
2
- jaxsim/_version.py,sha256=HBJFyRR4TSVLpDUSzqSMToGIY0oGpnNcNj-DP-ll5I0,428
2
+ jaxsim/_version.py,sha256=kGOL2jvMIPzXvzoNfMwZDyAgJVTdfsfiFG-sWppA4F0,428
3
3
  jaxsim/exceptions.py,sha256=qjfTjE9lXvD3-JCPQcxxiX2XSS8QegawzQ6ZuC2tc0Y,2638
4
4
  jaxsim/logging.py,sha256=STI-D_upXZYX-ZezLrlJJ0UlD5YspST0vZ_DcIwkzO4,1553
5
5
  jaxsim/typing.py,sha256=7msl8t5Jt09RNYfKdPJtpjLfWurldcycDappb045Eso,761
@@ -30,9 +30,9 @@ jaxsim/math/rotation.py,sha256=bl9WCbYyLKg6RyRkMaEBBTmARBs8pB-FGR0JVbfbaNE,2187
30
30
  jaxsim/math/skew.py,sha256=P82yeQs9Fzb7Ri_MAikcb54_06cE_syi9yPssSg4ydw,1426
31
31
  jaxsim/math/transform.py,sha256=We0ChLajSckxGINiJsP1a5Ur3yjg3JuweQ3kK4Woix4,3332
32
32
  jaxsim/math/utils.py,sha256=2id1F6QOvkHkIF3Nuxuj_tz_kI0IYlrlgVQrETmXFfI,1058
33
- jaxsim/mujoco/__init__.py,sha256=fZyRWre49pIhOrYdf6yJk_hOax8qWGe8OCmoq-dMVq8,201
33
+ jaxsim/mujoco/__init__.py,sha256=1kAWzYOS7nP29S5FGyWPqiAnPf4yPSoaPW-WBGBjVV0,214
34
34
  jaxsim/mujoco/__main__.py,sha256=GBmB7J-zj75ZnFyuAAmpSOpbxi_HhHhWJeot3ljGDJY,5291
35
- jaxsim/mujoco/loaders.py,sha256=lHU-Oc2hyYca2eXIWmkhQAcX7vAvxAVTmBFsEqg3fL4,21066
35
+ jaxsim/mujoco/loaders.py,sha256=Jjb5Us9ERmLjejM4S1FcqrF12ZVkjBMZXelu9n6HGA4,23138
36
36
  jaxsim/mujoco/model.py,sha256=tZWn2gpZSpQtwS5v7O5rGdjYNcEU6rnfAS6_ZKnZagE,16478
37
37
  jaxsim/mujoco/utils.py,sha256=6vYXNXmyI7lf2cp49cq9srClrPsbHmBGgdcPP1kux8M,8396
38
38
  jaxsim/mujoco/visualizer.py,sha256=wb9Nzrlf-IAkRa4RgSNWswb3DxjnLKnOFTPfklUMpmU,7212
@@ -67,8 +67,8 @@ jaxsim/utils/__init__.py,sha256=Y5zyoRevl3EMVQadhZ4EtSwTEkDt2vcnFoRhPJjKTZ0,215
67
67
  jaxsim/utils/jaxsim_dataclass.py,sha256=Fxa555u14VUsVlKU1rBQFurrVzBp7BNsIaVoNko0lrI,11261
68
68
  jaxsim/utils/tracing.py,sha256=Btwxdfhb7fJLk3r5PlQkGYj60Y2KbFT1gANGIA697FU,530
69
69
  jaxsim/utils/wrappers.py,sha256=3IMwydqFgmSPqeuUQ3PRmdhDc1IoT6XC23jPC_LjWXs,4175
70
- jaxsim-0.5.1.dev164.dist-info/LICENSE,sha256=eaYdFmdeMbiIoIiPzEK0MjP1S9wtFXjXNR5er49uLR0,1546
71
- jaxsim-0.5.1.dev164.dist-info/METADATA,sha256=ER36MgF_wHAofj6s6aJDAO8ZU7LQSe8tU_WvpzqVMsw,20201
72
- jaxsim-0.5.1.dev164.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
73
- jaxsim-0.5.1.dev164.dist-info/top_level.txt,sha256=LxGMA8FLtXjQ6oI7N5gd_R_oSUHxpXxUEOfT1xS_ni0,7
74
- jaxsim-0.5.1.dev164.dist-info/RECORD,,
70
+ jaxsim-0.5.1.dev166.dist-info/LICENSE,sha256=eaYdFmdeMbiIoIiPzEK0MjP1S9wtFXjXNR5er49uLR0,1546
71
+ jaxsim-0.5.1.dev166.dist-info/METADATA,sha256=4SzQHAizMPLLi6V3C01bD_C_COGWM-Ha0b8AYUlKcvY,20201
72
+ jaxsim-0.5.1.dev166.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
73
+ jaxsim-0.5.1.dev166.dist-info/top_level.txt,sha256=LxGMA8FLtXjQ6oI7N5gd_R_oSUHxpXxUEOfT1xS_ni0,7
74
+ jaxsim-0.5.1.dev166.dist-info/RECORD,,