jaxsim 0.5.1.dev164__py3-none-any.whl → 0.5.1.dev169__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.dev169'
16
+ __version_tuple__ = version_tuple = (0, 5, 1, 'dev169')
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,
jaxsim/mujoco/utils.py CHANGED
@@ -147,7 +147,7 @@ class MujocoCamera:
147
147
  camera_name: str,
148
148
  lookat: Sequence[float | int] | npt.NDArray = (0, 0, 0),
149
149
  distance: float | int | npt.NDArray = 3,
150
- azimut: float | int | npt.NDArray = 90,
150
+ azimuth: float | int | npt.NDArray = 90,
151
151
  elevation: float | int | npt.NDArray = -45,
152
152
  fovy: float | int | npt.NDArray = 45,
153
153
  degrees: bool = True,
@@ -170,7 +170,7 @@ class MujocoCamera:
170
170
  distance:
171
171
  The distance from the target point (displacement between the origins
172
172
  of `T` and `C`).
173
- azimut:
173
+ azimuth:
174
174
  The rotation around z of the camera. With an angle of 0, the camera
175
175
  would loot at the target point towards the positive x-axis of `T`.
176
176
  elevation:
@@ -193,8 +193,8 @@ class MujocoCamera:
193
193
  seq="ZX", angles=[-90, 90], degrees=True
194
194
  ).as_matrix()
195
195
 
196
- # Process the azimut.
197
- R_az = Rotation.from_euler(seq="Y", angles=azimut, degrees=degrees).as_matrix()
196
+ # Process the azimuth.
197
+ R_az = Rotation.from_euler(seq="Y", angles=azimuth, degrees=degrees).as_matrix()
198
198
  W_H_C[0:3, 0:3] = W_H_C[0:3, 0:3] @ R_az
199
199
 
200
200
  # Process elevation.
@@ -178,7 +178,7 @@ class MujocoVisualizer:
178
178
  close_on_exit: bool = True,
179
179
  lookat: Sequence[float | int] | npt.NDArray | None = None,
180
180
  distance: float | int | npt.NDArray | None = None,
181
- azimut: float | int | npt.NDArray | None = None,
181
+ azimuth: float | int | npt.NDArray | None = None,
182
182
  elevation: float | int | npt.NDArray | None = None,
183
183
  ) -> contextlib.AbstractContextManager[mujoco.viewer.Handle]:
184
184
  """
@@ -195,7 +195,7 @@ class MujocoVisualizer:
195
195
  viewer=handle,
196
196
  lookat=lookat,
197
197
  distance=distance,
198
- azimut=azimut,
198
+ azimuth=azimuth,
199
199
  elevation=elevation,
200
200
  )
201
201
 
@@ -210,7 +210,7 @@ class MujocoVisualizer:
210
210
  *,
211
211
  lookat: Sequence[float | int] | npt.NDArray | None,
212
212
  distance: float | int | npt.NDArray | None = None,
213
- azimut: float | int | npt.NDArray | None = None,
213
+ azimuth: float | int | npt.NDArray | None = None,
214
214
  elevation: float | int | npt.NDArray | None = None,
215
215
  ) -> mj.viewer.Handle:
216
216
  """
@@ -236,8 +236,8 @@ class MujocoVisualizer:
236
236
  if distance is not None:
237
237
  viewer.cam.distance = float(distance)
238
238
 
239
- if azimut is not None:
240
- viewer.cam.azimuth = float(azimut) % 360
239
+ if azimuth is not None:
240
+ viewer.cam.azimuth = float(azimuth) % 360
241
241
 
242
242
  if elevation is not None:
243
243
  viewer.cam.elevation = float(elevation)
@@ -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.dev169
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=qXEGQ7GIBzsGmuLyQgxO4_ta2lYS2xZ9e0PU-m3eua8,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,12 +30,12 @@ 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
- jaxsim/mujoco/utils.py,sha256=6vYXNXmyI7lf2cp49cq9srClrPsbHmBGgdcPP1kux8M,8396
38
- jaxsim/mujoco/visualizer.py,sha256=wb9Nzrlf-IAkRa4RgSNWswb3DxjnLKnOFTPfklUMpmU,7212
37
+ jaxsim/mujoco/utils.py,sha256=ZFEGvmz0xfbN-EKLOXVkcumqBKs5ywc49XGEnFOwBmU,8400
38
+ jaxsim/mujoco/visualizer.py,sha256=zkdu5qxZK0BGYotAHxoYQ5ZVTWSmwVZPQ3vTWGOik9E,7218
39
39
  jaxsim/parsers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
40
40
  jaxsim/parsers/kinematic_graph.py,sha256=N6cn8Bh4uH92ygkoYFvazbi1Gq7svTojDiZVkhbxsRI,35897
41
41
  jaxsim/parsers/descriptions/__init__.py,sha256=N_hp8cGI5FyEFiuNx9a-CAGCr0F0QpYEpdMHvwB7_1g,261
@@ -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.dev169.dist-info/LICENSE,sha256=eaYdFmdeMbiIoIiPzEK0MjP1S9wtFXjXNR5er49uLR0,1546
71
+ jaxsim-0.5.1.dev169.dist-info/METADATA,sha256=zvEWq3xREecEqZZrV8HtRFRWe0szMcbICDDZS-PndnU,20201
72
+ jaxsim-0.5.1.dev169.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
73
+ jaxsim-0.5.1.dev169.dist-info/top_level.txt,sha256=LxGMA8FLtXjQ6oI7N5gd_R_oSUHxpXxUEOfT1xS_ni0,7
74
+ jaxsim-0.5.1.dev169.dist-info/RECORD,,