mjlab 0.0.2__tar.gz

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 (196) hide show
  1. mjlab-0.0.2/LICENSE +202 -0
  2. mjlab-0.0.2/PKG-INFO +173 -0
  3. mjlab-0.0.2/README.md +131 -0
  4. mjlab-0.0.2/pyproject.toml +108 -0
  5. mjlab-0.0.2/src/mjlab/__init__.py +17 -0
  6. mjlab-0.0.2/src/mjlab/asset_zoo/README.md +6 -0
  7. mjlab-0.0.2/src/mjlab/asset_zoo/__init__.py +0 -0
  8. mjlab-0.0.2/src/mjlab/asset_zoo/img/g1.png +0 -0
  9. mjlab-0.0.2/src/mjlab/asset_zoo/img/go1.png +0 -0
  10. mjlab-0.0.2/src/mjlab/asset_zoo/render_robots.py +49 -0
  11. mjlab-0.0.2/src/mjlab/asset_zoo/robots/__init__.py +7 -0
  12. mjlab-0.0.2/src/mjlab/asset_zoo/robots/unitree_g1/__init__.py +1 -0
  13. mjlab-0.0.2/src/mjlab/asset_zoo/robots/unitree_g1/g1_constants.py +296 -0
  14. mjlab-0.0.2/src/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/head_link.STL +0 -0
  15. mjlab-0.0.2/src/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/left_ankle_pitch_link.STL +0 -0
  16. mjlab-0.0.2/src/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/left_ankle_roll_link.STL +0 -0
  17. mjlab-0.0.2/src/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/left_elbow_link.STL +0 -0
  18. mjlab-0.0.2/src/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/left_hand_index_0_link.STL +0 -0
  19. mjlab-0.0.2/src/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/left_hand_index_1_link.STL +0 -0
  20. mjlab-0.0.2/src/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/left_hand_middle_0_link.STL +0 -0
  21. mjlab-0.0.2/src/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/left_hand_middle_1_link.STL +0 -0
  22. mjlab-0.0.2/src/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/left_hand_palm_link.STL +0 -0
  23. mjlab-0.0.2/src/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/left_hand_thumb_0_link.STL +0 -0
  24. mjlab-0.0.2/src/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/left_hand_thumb_1_link.STL +0 -0
  25. mjlab-0.0.2/src/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/left_hand_thumb_2_link.STL +0 -0
  26. mjlab-0.0.2/src/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/left_hip_pitch_link.STL +0 -0
  27. mjlab-0.0.2/src/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/left_hip_roll_link.STL +0 -0
  28. mjlab-0.0.2/src/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/left_hip_yaw_link.STL +0 -0
  29. mjlab-0.0.2/src/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/left_knee_link.STL +0 -0
  30. mjlab-0.0.2/src/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/left_rubber_hand.STL +0 -0
  31. mjlab-0.0.2/src/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/left_shoulder_pitch_link.STL +0 -0
  32. mjlab-0.0.2/src/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/left_shoulder_roll_link.STL +0 -0
  33. mjlab-0.0.2/src/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/left_shoulder_yaw_link.STL +0 -0
  34. mjlab-0.0.2/src/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/left_wrist_pitch_link.STL +0 -0
  35. mjlab-0.0.2/src/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/left_wrist_roll_link.STL +0 -0
  36. mjlab-0.0.2/src/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/left_wrist_yaw_link.STL +0 -0
  37. mjlab-0.0.2/src/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/logo_link.STL +0 -0
  38. mjlab-0.0.2/src/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/pelvis.STL +0 -0
  39. mjlab-0.0.2/src/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/pelvis_contour_link.STL +0 -0
  40. mjlab-0.0.2/src/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/right_ankle_pitch_link.STL +0 -0
  41. mjlab-0.0.2/src/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/right_ankle_roll_link.STL +0 -0
  42. mjlab-0.0.2/src/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/right_elbow_link.STL +0 -0
  43. mjlab-0.0.2/src/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/right_hand_index_0_link.STL +0 -0
  44. mjlab-0.0.2/src/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/right_hand_index_1_link.STL +0 -0
  45. mjlab-0.0.2/src/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/right_hand_middle_0_link.STL +0 -0
  46. mjlab-0.0.2/src/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/right_hand_middle_1_link.STL +0 -0
  47. mjlab-0.0.2/src/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/right_hand_palm_link.STL +0 -0
  48. mjlab-0.0.2/src/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/right_hand_thumb_0_link.STL +0 -0
  49. mjlab-0.0.2/src/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/right_hand_thumb_1_link.STL +0 -0
  50. mjlab-0.0.2/src/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/right_hand_thumb_2_link.STL +0 -0
  51. mjlab-0.0.2/src/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/right_hip_pitch_link.STL +0 -0
  52. mjlab-0.0.2/src/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/right_hip_roll_link.STL +0 -0
  53. mjlab-0.0.2/src/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/right_hip_yaw_link.STL +0 -0
  54. mjlab-0.0.2/src/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/right_knee_link.STL +0 -0
  55. mjlab-0.0.2/src/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/right_rubber_hand.STL +0 -0
  56. mjlab-0.0.2/src/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/right_shoulder_pitch_link.STL +0 -0
  57. mjlab-0.0.2/src/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/right_shoulder_roll_link.STL +0 -0
  58. mjlab-0.0.2/src/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/right_shoulder_yaw_link.STL +0 -0
  59. mjlab-0.0.2/src/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/right_wrist_pitch_link.STL +0 -0
  60. mjlab-0.0.2/src/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/right_wrist_roll_link.STL +0 -0
  61. mjlab-0.0.2/src/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/right_wrist_yaw_link.STL +0 -0
  62. mjlab-0.0.2/src/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/torso_link_rev_1_0.STL +0 -0
  63. mjlab-0.0.2/src/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/waist_roll_link_rev_1_0.STL +0 -0
  64. mjlab-0.0.2/src/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/waist_yaw_link_rev_1_0.STL +0 -0
  65. mjlab-0.0.2/src/mjlab/asset_zoo/robots/unitree_g1/xmls/g1.xml +309 -0
  66. mjlab-0.0.2/src/mjlab/asset_zoo/robots/unitree_go1/__init__.py +1 -0
  67. mjlab-0.0.2/src/mjlab/asset_zoo/robots/unitree_go1/go1_constants.py +159 -0
  68. mjlab-0.0.2/src/mjlab/asset_zoo/robots/unitree_go1/xmls/assets/calf.stl +0 -0
  69. mjlab-0.0.2/src/mjlab/asset_zoo/robots/unitree_go1/xmls/assets/hip.stl +0 -0
  70. mjlab-0.0.2/src/mjlab/asset_zoo/robots/unitree_go1/xmls/assets/thigh.stl +0 -0
  71. mjlab-0.0.2/src/mjlab/asset_zoo/robots/unitree_go1/xmls/assets/thigh_mirror.stl +0 -0
  72. mjlab-0.0.2/src/mjlab/asset_zoo/robots/unitree_go1/xmls/assets/trunk.stl +0 -0
  73. mjlab-0.0.2/src/mjlab/asset_zoo/robots/unitree_go1/xmls/go1.xml +164 -0
  74. mjlab-0.0.2/src/mjlab/entity/__init__.py +15 -0
  75. mjlab-0.0.2/src/mjlab/entity/data.py +514 -0
  76. mjlab-0.0.2/src/mjlab/entity/entity.py +652 -0
  77. mjlab-0.0.2/src/mjlab/envs/__init__.py +12 -0
  78. mjlab-0.0.2/src/mjlab/envs/manager_based_env.py +198 -0
  79. mjlab-0.0.2/src/mjlab/envs/manager_based_rl_env.py +226 -0
  80. mjlab-0.0.2/src/mjlab/envs/mdp/__init__.py +5 -0
  81. mjlab-0.0.2/src/mjlab/envs/mdp/actions/__init__.py +10 -0
  82. mjlab-0.0.2/src/mjlab/envs/mdp/actions/actions_config.py +23 -0
  83. mjlab-0.0.2/src/mjlab/envs/mdp/actions/joint_actions.py +103 -0
  84. mjlab-0.0.2/src/mjlab/envs/mdp/events.py +415 -0
  85. mjlab-0.0.2/src/mjlab/envs/mdp/observations.py +92 -0
  86. mjlab-0.0.2/src/mjlab/envs/mdp/rewards.py +174 -0
  87. mjlab-0.0.2/src/mjlab/envs/mdp/terminations.py +49 -0
  88. mjlab-0.0.2/src/mjlab/envs/types.py +11 -0
  89. mjlab-0.0.2/src/mjlab/managers/__init__.py +18 -0
  90. mjlab-0.0.2/src/mjlab/managers/action_manager.py +150 -0
  91. mjlab-0.0.2/src/mjlab/managers/command_manager.py +193 -0
  92. mjlab-0.0.2/src/mjlab/managers/curriculum_manager.py +130 -0
  93. mjlab-0.0.2/src/mjlab/managers/event_manager.py +211 -0
  94. mjlab-0.0.2/src/mjlab/managers/manager_base.py +93 -0
  95. mjlab-0.0.2/src/mjlab/managers/manager_term_config.py +125 -0
  96. mjlab-0.0.2/src/mjlab/managers/observation_manager.py +216 -0
  97. mjlab-0.0.2/src/mjlab/managers/reward_manager.py +109 -0
  98. mjlab-0.0.2/src/mjlab/managers/scene_entity_config.py +177 -0
  99. mjlab-0.0.2/src/mjlab/managers/termination_manager.py +121 -0
  100. mjlab-0.0.2/src/mjlab/py.typed +0 -0
  101. mjlab-0.0.2/src/mjlab/rl/__init__.py +15 -0
  102. mjlab-0.0.2/src/mjlab/rl/config.py +110 -0
  103. mjlab-0.0.2/src/mjlab/rl/vecenv_wrapper.py +111 -0
  104. mjlab-0.0.2/src/mjlab/scene/__init__.py +3 -0
  105. mjlab-0.0.2/src/mjlab/scene/scene.py +147 -0
  106. mjlab-0.0.2/src/mjlab/scene/scene.xml +12 -0
  107. mjlab-0.0.2/src/mjlab/scripts/csv_to_npz.py +414 -0
  108. mjlab-0.0.2/src/mjlab/scripts/demo.py +39 -0
  109. mjlab-0.0.2/src/mjlab/scripts/gcs.py +103 -0
  110. mjlab-0.0.2/src/mjlab/scripts/list_envs.py +39 -0
  111. mjlab-0.0.2/src/mjlab/scripts/play.py +128 -0
  112. mjlab-0.0.2/src/mjlab/scripts/train.py +143 -0
  113. mjlab-0.0.2/src/mjlab/sim/__init__.py +11 -0
  114. mjlab-0.0.2/src/mjlab/sim/randomization.py +55 -0
  115. mjlab-0.0.2/src/mjlab/sim/sim.py +246 -0
  116. mjlab-0.0.2/src/mjlab/sim/sim_data.py +229 -0
  117. mjlab-0.0.2/src/mjlab/tasks/__init__.py +5 -0
  118. mjlab-0.0.2/src/mjlab/tasks/tracking/__init__.py +1 -0
  119. mjlab-0.0.2/src/mjlab/tasks/tracking/config/__init__.py +0 -0
  120. mjlab-0.0.2/src/mjlab/tasks/tracking/config/g1/__init__.py +21 -0
  121. mjlab-0.0.2/src/mjlab/tasks/tracking/config/g1/flat_env_cfg.py +70 -0
  122. mjlab-0.0.2/src/mjlab/tasks/tracking/config/g1/rl_cfg.py +41 -0
  123. mjlab-0.0.2/src/mjlab/tasks/tracking/mdp/__init__.py +6 -0
  124. mjlab-0.0.2/src/mjlab/tasks/tracking/mdp/commands.py +374 -0
  125. mjlab-0.0.2/src/mjlab/tasks/tracking/mdp/observations.py +69 -0
  126. mjlab-0.0.2/src/mjlab/tasks/tracking/mdp/rewards.py +137 -0
  127. mjlab-0.0.2/src/mjlab/tasks/tracking/mdp/terminations.py +83 -0
  128. mjlab-0.0.2/src/mjlab/tasks/tracking/rl/__init__.py +3 -0
  129. mjlab-0.0.2/src/mjlab/tasks/tracking/rl/exporter.py +123 -0
  130. mjlab-0.0.2/src/mjlab/tasks/tracking/rl/runner.py +56 -0
  131. mjlab-0.0.2/src/mjlab/tasks/tracking/tracking_env_cfg.py +300 -0
  132. mjlab-0.0.2/src/mjlab/tasks/velocity/__init__.py +1 -0
  133. mjlab-0.0.2/src/mjlab/tasks/velocity/config/__init__.py +0 -0
  134. mjlab-0.0.2/src/mjlab/tasks/velocity/config/g1/__init__.py +41 -0
  135. mjlab-0.0.2/src/mjlab/tasks/velocity/config/g1/flat_env_cfg.py +21 -0
  136. mjlab-0.0.2/src/mjlab/tasks/velocity/config/g1/rl_cfg.py +41 -0
  137. mjlab-0.0.2/src/mjlab/tasks/velocity/config/g1/rough_env_cfg.py +69 -0
  138. mjlab-0.0.2/src/mjlab/tasks/velocity/config/go1/__init__.py +41 -0
  139. mjlab-0.0.2/src/mjlab/tasks/velocity/config/go1/flat_env_cfg.py +21 -0
  140. mjlab-0.0.2/src/mjlab/tasks/velocity/config/go1/rl_cfg.py +41 -0
  141. mjlab-0.0.2/src/mjlab/tasks/velocity/config/go1/rough_env_cfg.py +68 -0
  142. mjlab-0.0.2/src/mjlab/tasks/velocity/mdp/__init__.py +5 -0
  143. mjlab-0.0.2/src/mjlab/tasks/velocity/mdp/curriculums.py +50 -0
  144. mjlab-0.0.2/src/mjlab/tasks/velocity/mdp/rewards.py +234 -0
  145. mjlab-0.0.2/src/mjlab/tasks/velocity/mdp/velocity_command.py +187 -0
  146. mjlab-0.0.2/src/mjlab/tasks/velocity/rl/__init__.py +11 -0
  147. mjlab-0.0.2/src/mjlab/tasks/velocity/rl/exporter.py +66 -0
  148. mjlab-0.0.2/src/mjlab/tasks/velocity/rl/runner.py +38 -0
  149. mjlab-0.0.2/src/mjlab/tasks/velocity/velocity_env_cfg.py +309 -0
  150. mjlab-0.0.2/src/mjlab/terrains/__init__.py +25 -0
  151. mjlab-0.0.2/src/mjlab/terrains/box_terrains.py +607 -0
  152. mjlab-0.0.2/src/mjlab/terrains/config.py +50 -0
  153. mjlab-0.0.2/src/mjlab/terrains/terrain_generator.py +265 -0
  154. mjlab-0.0.2/src/mjlab/terrains/terrain_importer.py +238 -0
  155. mjlab-0.0.2/src/mjlab/terrains/utils.py +108 -0
  156. mjlab-0.0.2/src/mjlab/third_party/README.md +18 -0
  157. mjlab-0.0.2/src/mjlab/third_party/__init__.py +0 -0
  158. mjlab-0.0.2/src/mjlab/third_party/isaaclab/LICENSE +30 -0
  159. mjlab-0.0.2/src/mjlab/third_party/isaaclab/README.vendor.md +8 -0
  160. mjlab-0.0.2/src/mjlab/third_party/isaaclab/__init__.py +0 -0
  161. mjlab-0.0.2/src/mjlab/third_party/isaaclab/isaaclab/__init__.py +0 -0
  162. mjlab-0.0.2/src/mjlab/third_party/isaaclab/isaaclab/terrains/__init__.py +0 -0
  163. mjlab-0.0.2/src/mjlab/third_party/isaaclab/isaaclab/terrains/trimesh/__init__.py +0 -0
  164. mjlab-0.0.2/src/mjlab/third_party/isaaclab/isaaclab/terrains/trimesh/utils.py +194 -0
  165. mjlab-0.0.2/src/mjlab/third_party/isaaclab/isaaclab/utils/__init__.py +0 -0
  166. mjlab-0.0.2/src/mjlab/third_party/isaaclab/isaaclab/utils/math.py +1925 -0
  167. mjlab-0.0.2/src/mjlab/third_party/isaaclab/isaaclab/utils/string.py +368 -0
  168. mjlab-0.0.2/src/mjlab/third_party/isaaclab/isaaclab_rl/__init__.py +0 -0
  169. mjlab-0.0.2/src/mjlab/third_party/isaaclab/isaaclab_rl/rsl_rl/__init__.py +0 -0
  170. mjlab-0.0.2/src/mjlab/third_party/isaaclab/isaaclab_rl/rsl_rl/exporter.py +214 -0
  171. mjlab-0.0.2/src/mjlab/third_party/isaaclab/isaaclab_tasks/__init__.py +0 -0
  172. mjlab-0.0.2/src/mjlab/third_party/isaaclab/isaaclab_tasks/utils/__init__.py +0 -0
  173. mjlab-0.0.2/src/mjlab/third_party/isaaclab/isaaclab_tasks/utils/importer.py +89 -0
  174. mjlab-0.0.2/src/mjlab/third_party/isaaclab/isaaclab_tasks/utils/parse_cfg.py +113 -0
  175. mjlab-0.0.2/src/mjlab/utils/__init__.py +0 -0
  176. mjlab-0.0.2/src/mjlab/utils/actuator.py +38 -0
  177. mjlab-0.0.2/src/mjlab/utils/color.py +223 -0
  178. mjlab-0.0.2/src/mjlab/utils/dataclasses.py +15 -0
  179. mjlab-0.0.2/src/mjlab/utils/mujoco.py +28 -0
  180. mjlab-0.0.2/src/mjlab/utils/noise/__init__.py +25 -0
  181. mjlab-0.0.2/src/mjlab/utils/noise/noise_cfg.py +136 -0
  182. mjlab-0.0.2/src/mjlab/utils/noise/noise_model.py +84 -0
  183. mjlab-0.0.2/src/mjlab/utils/os.py +108 -0
  184. mjlab-0.0.2/src/mjlab/utils/random.py +26 -0
  185. mjlab-0.0.2/src/mjlab/utils/spec.py +40 -0
  186. mjlab-0.0.2/src/mjlab/utils/spec_config.py +521 -0
  187. mjlab-0.0.2/src/mjlab/utils/string.py +36 -0
  188. mjlab-0.0.2/src/mjlab/utils/torch.py +11 -0
  189. mjlab-0.0.2/src/mjlab/viewer/__init__.py +16 -0
  190. mjlab-0.0.2/src/mjlab/viewer/base.py +318 -0
  191. mjlab-0.0.2/src/mjlab/viewer/keys.py +107 -0
  192. mjlab-0.0.2/src/mjlab/viewer/native.py +430 -0
  193. mjlab-0.0.2/src/mjlab/viewer/viewer_config.py +24 -0
  194. mjlab-0.0.2/src/mjlab/viewer/viser.py +487 -0
  195. mjlab-0.0.2/src/mjlab/viewer/viser_conversions.py +263 -0
  196. mjlab-0.0.2/src/mjlab/viewer/viser_reward_plotter.py +151 -0
mjlab-0.0.2/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
mjlab-0.0.2/PKG-INFO ADDED
@@ -0,0 +1,173 @@
1
+ Metadata-Version: 2.4
2
+ Name: mjlab
3
+ Version: 0.0.2
4
+ Summary: IsaacLab-style manager API, powered by MuJoCo-Warp, for RL and robotics research.
5
+ Keywords: mujoco,mujoco-warp,simulation,reinforcement-learning,robotics
6
+ Author: The MjLab Developers
7
+ License-Expression: Apache-2.0
8
+ License-File: LICENSE
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Intended Audience :: Science/Research
12
+ Classifier: License :: OSI Approved :: Apache Software License
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3 :: Only
18
+ Classifier: Typing :: Typed
19
+ Classifier: Environment :: GPU :: NVIDIA CUDA
20
+ Classifier: Topic :: Scientific/Engineering
21
+ Classifier: Natural Language :: English
22
+ Requires-Dist: gymnasium==1.2.0
23
+ Requires-Dist: prettytable
24
+ Requires-Dist: tqdm
25
+ Requires-Dist: tyro
26
+ Requires-Dist: torch
27
+ Requires-Dist: warp-lang
28
+ Requires-Dist: mujoco
29
+ Requires-Dist: trimesh
30
+ Requires-Dist: viser
31
+ Requires-Dist: wandb
32
+ Requires-Dist: moviepy
33
+ Requires-Dist: tensordict
34
+ Requires-Dist: rsl-rl-lib
35
+ Requires-Dist: tensorboard>=2.20.0
36
+ Requires-Dist: torch>=2.7.0 ; extra == 'cu12'
37
+ Requires-Python: >=3.10
38
+ Project-URL: Bug Reports, https://github.com/mujocolab/mjlab/issues
39
+ Project-URL: Source, https://github.com/mujocolab/mjlab
40
+ Provides-Extra: cu12
41
+ Description-Content-Type: text/markdown
42
+
43
+ # mjlab
44
+
45
+ <p align="left">
46
+ <img alt="tests" src="https://github.com/mujocolab/mjlab/actions/workflows/ci.yml/badge.svg" />
47
+ </p>
48
+
49
+ > **⚠️ EXPERIMENTAL PREVIEW**
50
+ >
51
+ > This project is in very early experimental stages. APIs, features, and documentation are subject to significant changes. Use at your own risk and expect frequent breaking changes.
52
+
53
+ [Isaac Lab](https://github.com/isaac-sim/IsaacLab) API with [MJWarp](https://github.com/google-deepmind/mujoco_warp) backend.
54
+
55
+ ```bash
56
+ uv run demo
57
+ ```
58
+
59
+ ## Development Guide
60
+
61
+ Clone `mjlab`:
62
+
63
+ ```bash
64
+ git clone git@github.com:mujocolab/mjlab.git && cd mjlab
65
+ ```
66
+
67
+ ### Using uv
68
+
69
+ Install [uv](https://docs.astral.sh/uv/):
70
+
71
+ ```bash
72
+ curl -LsSf https://astral.sh/uv/install.sh | sh
73
+ ```
74
+
75
+ Once installed, you can verify it works by running:
76
+
77
+ ```bash
78
+ uv run scripts/list_envs.py
79
+ ```
80
+
81
+ ## Reinforcement Learning
82
+
83
+ ### Velocity training
84
+
85
+ Train a Unitree G1 to follow velocity commands (headless, large batch):
86
+
87
+ ```bash
88
+ MUJOCO_GL=egl uv run train \
89
+ Mjlab-Velocity-Flat-Unitree-G1 \
90
+ --env.scene.num-envs 4096
91
+ ```
92
+
93
+ Play the trained policy:
94
+
95
+ ```bash
96
+ uv run play --task Mjlab-Velocity-Flat-Unitree-G1-Play
97
+ ```
98
+
99
+ ### Motion mimicking
100
+
101
+ Run a pre-trained motion-mimic policy on the G1:
102
+
103
+ ```bash
104
+ uv run play \
105
+ --task Mjlab-Tracking-Flat-Unitree-G1-Play \
106
+ --wandb-run-path gcbc_researchers/mjlab_alpha/rfdej55h
107
+ ```
108
+
109
+ Train the same motion-mimic policy (headless, large batch):
110
+
111
+ ```bash
112
+ MUJOCO_GL=egl uv run train \
113
+ Mjlab-Tracking-Flat-Unitree-G1 \
114
+ --registry-name gcbc_researchers/csv_to_npz/lafan_cartwheel \
115
+ --env.scene.num-envs 4096
116
+ ```
117
+
118
+ Add a new motion to the WandB registry from a CSV:
119
+
120
+ ```bash
121
+ MUJOCO_GL=egl uv run src/mjlab/scripts/csv_to_npz.py \
122
+ --input-file /path/to/motion.csv \
123
+ --output-name side_kick \
124
+ --input-fps 30 \
125
+ --output-fps 50 \
126
+ --render
127
+ ```
128
+
129
+ ## Running tests
130
+
131
+ ```bash
132
+ make test
133
+ ```
134
+
135
+ ## Code formatting and linting
136
+
137
+ You can install a pre-commit hook:
138
+
139
+ ```bash
140
+ uvx pre-commit install
141
+ ```
142
+
143
+ or manually format with:
144
+
145
+ ```
146
+ make format
147
+ ```
148
+
149
+ ## Troubleshooting
150
+
151
+ **CUDA Compatibility**: Not all CUDA versions are supported. Check [mujoco_warp#101](https://github.com/google-deepmind/mujoco_warp/issues/101) for your CUDA version compatibility.
152
+
153
+ ## License
154
+
155
+ This project, **mjlab**, is licensed under the [Apache License, Version 2.0](LICENSE).
156
+
157
+ ### Third-Party Code
158
+
159
+ The `third_party/` directory contains selected files from external projects.
160
+ Each such subdirectory includes its own original `LICENSE` file from the upstream source.
161
+ These files are used under the terms of their respective licenses.
162
+
163
+ Currently, `third_party/` contains:
164
+
165
+ - **isaaclab/** — Selected files from [NVIDIA Isaac Lab](https://github.com/isaac-sim/IsaacLab),
166
+ licensed under the [BSD-3-Clause](src/mjlab/third_party/isaaclab/LICENSE).
167
+
168
+ When distributing or modifying this project, you must comply with both:
169
+
170
+ 1. The **Apache-2.0 license** of mjlab (applies to all original code in this repository).
171
+ 2. The licenses of any code in `third_party/` (applies only to the files from those projects).
172
+
173
+ See the individual `LICENSE` files for the complete terms.
mjlab-0.0.2/README.md ADDED
@@ -0,0 +1,131 @@
1
+ # mjlab
2
+
3
+ <p align="left">
4
+ <img alt="tests" src="https://github.com/mujocolab/mjlab/actions/workflows/ci.yml/badge.svg" />
5
+ </p>
6
+
7
+ > **⚠️ EXPERIMENTAL PREVIEW**
8
+ >
9
+ > This project is in very early experimental stages. APIs, features, and documentation are subject to significant changes. Use at your own risk and expect frequent breaking changes.
10
+
11
+ [Isaac Lab](https://github.com/isaac-sim/IsaacLab) API with [MJWarp](https://github.com/google-deepmind/mujoco_warp) backend.
12
+
13
+ ```bash
14
+ uv run demo
15
+ ```
16
+
17
+ ## Development Guide
18
+
19
+ Clone `mjlab`:
20
+
21
+ ```bash
22
+ git clone git@github.com:mujocolab/mjlab.git && cd mjlab
23
+ ```
24
+
25
+ ### Using uv
26
+
27
+ Install [uv](https://docs.astral.sh/uv/):
28
+
29
+ ```bash
30
+ curl -LsSf https://astral.sh/uv/install.sh | sh
31
+ ```
32
+
33
+ Once installed, you can verify it works by running:
34
+
35
+ ```bash
36
+ uv run scripts/list_envs.py
37
+ ```
38
+
39
+ ## Reinforcement Learning
40
+
41
+ ### Velocity training
42
+
43
+ Train a Unitree G1 to follow velocity commands (headless, large batch):
44
+
45
+ ```bash
46
+ MUJOCO_GL=egl uv run train \
47
+ Mjlab-Velocity-Flat-Unitree-G1 \
48
+ --env.scene.num-envs 4096
49
+ ```
50
+
51
+ Play the trained policy:
52
+
53
+ ```bash
54
+ uv run play --task Mjlab-Velocity-Flat-Unitree-G1-Play
55
+ ```
56
+
57
+ ### Motion mimicking
58
+
59
+ Run a pre-trained motion-mimic policy on the G1:
60
+
61
+ ```bash
62
+ uv run play \
63
+ --task Mjlab-Tracking-Flat-Unitree-G1-Play \
64
+ --wandb-run-path gcbc_researchers/mjlab_alpha/rfdej55h
65
+ ```
66
+
67
+ Train the same motion-mimic policy (headless, large batch):
68
+
69
+ ```bash
70
+ MUJOCO_GL=egl uv run train \
71
+ Mjlab-Tracking-Flat-Unitree-G1 \
72
+ --registry-name gcbc_researchers/csv_to_npz/lafan_cartwheel \
73
+ --env.scene.num-envs 4096
74
+ ```
75
+
76
+ Add a new motion to the WandB registry from a CSV:
77
+
78
+ ```bash
79
+ MUJOCO_GL=egl uv run src/mjlab/scripts/csv_to_npz.py \
80
+ --input-file /path/to/motion.csv \
81
+ --output-name side_kick \
82
+ --input-fps 30 \
83
+ --output-fps 50 \
84
+ --render
85
+ ```
86
+
87
+ ## Running tests
88
+
89
+ ```bash
90
+ make test
91
+ ```
92
+
93
+ ## Code formatting and linting
94
+
95
+ You can install a pre-commit hook:
96
+
97
+ ```bash
98
+ uvx pre-commit install
99
+ ```
100
+
101
+ or manually format with:
102
+
103
+ ```
104
+ make format
105
+ ```
106
+
107
+ ## Troubleshooting
108
+
109
+ **CUDA Compatibility**: Not all CUDA versions are supported. Check [mujoco_warp#101](https://github.com/google-deepmind/mujoco_warp/issues/101) for your CUDA version compatibility.
110
+
111
+ ## License
112
+
113
+ This project, **mjlab**, is licensed under the [Apache License, Version 2.0](LICENSE).
114
+
115
+ ### Third-Party Code
116
+
117
+ The `third_party/` directory contains selected files from external projects.
118
+ Each such subdirectory includes its own original `LICENSE` file from the upstream source.
119
+ These files are used under the terms of their respective licenses.
120
+
121
+ Currently, `third_party/` contains:
122
+
123
+ - **isaaclab/** — Selected files from [NVIDIA Isaac Lab](https://github.com/isaac-sim/IsaacLab),
124
+ licensed under the [BSD-3-Clause](src/mjlab/third_party/isaaclab/LICENSE).
125
+
126
+ When distributing or modifying this project, you must comply with both:
127
+
128
+ 1. The **Apache-2.0 license** of mjlab (applies to all original code in this repository).
129
+ 2. The licenses of any code in `third_party/` (applies only to the files from those projects).
130
+
131
+ See the individual `LICENSE` files for the complete terms.
@@ -0,0 +1,108 @@
1
+ [build-system]
2
+ requires = ["uv_build>=0.8.19,<0.9.0"]
3
+ build-backend = "uv_build"
4
+
5
+ [project]
6
+ name = "mjlab"
7
+ version = "0.0.2"
8
+ license = "Apache-2.0"
9
+ license-files = ["LICENSE"]
10
+ readme = { file = "README.md", content-type = "text/markdown" }
11
+ authors = [
12
+ {name = "The MjLab Developers"},
13
+ ]
14
+ keywords = ["mujoco", "mujoco-warp", "simulation", "reinforcement-learning", "robotics"]
15
+ classifiers = [
16
+ "Development Status :: 4 - Beta",
17
+ "Intended Audience :: Developers",
18
+ "Intended Audience :: Science/Research",
19
+ "License :: OSI Approved :: Apache Software License",
20
+ "Programming Language :: Python :: 3",
21
+ "Programming Language :: Python :: 3.10",
22
+ "Programming Language :: Python :: 3.11",
23
+ "Programming Language :: Python :: 3.12",
24
+ "Programming Language :: Python :: 3 :: Only",
25
+ "Typing :: Typed",
26
+ "Environment :: GPU :: NVIDIA CUDA",
27
+ "Topic :: Scientific/Engineering",
28
+ "Natural Language :: English",
29
+ ]
30
+ description = "IsaacLab-style manager API, powered by MuJoCo-Warp, for RL and robotics research."
31
+ requires-python = ">=3.10"
32
+ dependencies = [
33
+ "gymnasium==1.2.0",
34
+ "prettytable",
35
+ "tqdm",
36
+ "tyro",
37
+ "torch",
38
+ "warp-lang",
39
+ # "mujoco-warp @ git+https://github.com/google-deepmind/mujoco_warp",
40
+ "mujoco",
41
+ "trimesh",
42
+ "viser",
43
+ "wandb",
44
+ "moviepy",
45
+ "tensordict",
46
+ "rsl-rl-lib",
47
+ "tensorboard>=2.20.0",
48
+ ]
49
+
50
+ [project.urls]
51
+ "Bug Reports" = "https://github.com/mujocolab/mjlab/issues"
52
+ "Source" = "https://github.com/mujocolab/mjlab"
53
+
54
+ [dependency-groups]
55
+ dev = [
56
+ "pre-commit",
57
+ "pyright>=1.1.386",
58
+ "pytest>=8.4.2",
59
+ "ruff>=0.13.1",
60
+ ]
61
+
62
+ [project.optional-dependencies]
63
+ cu12 = ["torch>=2.7.0"]
64
+
65
+ [project.scripts]
66
+ train = "mjlab.scripts.train:main"
67
+ play = "mjlab.scripts.play:main"
68
+ demo = "mjlab.scripts.demo:main"
69
+
70
+ [[tool.uv.index]]
71
+ url = "https://pypi.org/simple"
72
+
73
+ [[tool.uv.index]]
74
+ name = "nvidia"
75
+ url = "https://pypi.nvidia.com/"
76
+ explicit = true
77
+
78
+ [[tool.uv.index]]
79
+ name = "pytorch-cu128"
80
+ url = "https://download.pytorch.org/whl/cu128"
81
+ explicit = true
82
+
83
+ [[tool.uv.index]]
84
+ name = "mujoco"
85
+ url = "https://py.mujoco.org"
86
+ explicit = true
87
+
88
+ [tool.uv.sources]
89
+ mujoco-warp = { git = "https://github.com/google-deepmind/mujoco_warp" }
90
+ warp-lang = { index = "nvidia", marker = "sys_platform != 'darwin'" }
91
+ mujoco = { index = "mujoco" }
92
+ torch = [{ index = "pytorch-cu128", extra = "cu12" }]
93
+
94
+ [tool.ruff]
95
+ src = ["src"] # Helpful for recognizing first-party imports.
96
+ indent-width = 2
97
+ exclude = [
98
+ "src/mjlab/third_party",
99
+ "typings",
100
+ ]
101
+
102
+ [tool.ruff.lint]
103
+ select = ["E4", "E7", "E9", "F", "I", "B"]
104
+
105
+ [tool.pyright]
106
+ pythonVersion = "3.10"
107
+ ignore = ["./typings", "./src/mjlab/third_party"]
108
+ stubPath = "typings"
@@ -0,0 +1,17 @@
1
+ import os
2
+ from pathlib import Path
3
+
4
+ import warp as wp
5
+
6
+ MJLAB_SRC_PATH: Path = Path(__file__).parent
7
+
8
+
9
+ def configure_warp() -> None:
10
+ """Configure Warp globally for mjlab."""
11
+ wp.config.enable_backward = False
12
+
13
+ quiet = os.environ.get("MJLAB_WARP_VERBOSE", "").lower() not in ("1", "true", "yes")
14
+ wp.config.quiet = quiet
15
+
16
+
17
+ configure_warp()
@@ -0,0 +1,6 @@
1
+ # Asset Zoo
2
+
3
+ | Robot | Image |
4
+ |-------|-------|
5
+ | **Unitree G1** | <img src="img/g1.png" width="200" height="150" alt="Unitree G1 Humanoid"> |
6
+ | **Unitree Go1** | <img src="img/go1.png" width="200" height="150" alt="Unitree Go1 Quadruped"> |
File without changes
@@ -0,0 +1,49 @@
1
+ from dataclasses import replace
2
+ from pathlib import Path
3
+
4
+ import mujoco
5
+ from PIL import Image
6
+
7
+ from mjlab.entity import Entity, EntityCfg
8
+ from mjlab.utils.spec_config import TextureCfg
9
+
10
+ _HERE = Path(__file__).parent
11
+ _HEIGHT = 300
12
+ _WIDTH = 400
13
+
14
+
15
+ def render_robots(name: str, cfg: EntityCfg):
16
+ skybox_tex = TextureCfg(
17
+ name="skybox",
18
+ type="skybox",
19
+ builtin="gradient",
20
+ rgb1=(1, 1, 1),
21
+ rgb2=(1, 1, 1),
22
+ width=512,
23
+ height=3072,
24
+ )
25
+ robot = Entity(replace(cfg, textures=(skybox_tex,)))
26
+ model = robot.compile()
27
+ data = mujoco.MjData(model)
28
+ mujoco.mj_resetDataKeyframe(model, data, 0)
29
+ data.qpos[:3] = 0.0
30
+ mujoco.mj_forward(model, data)
31
+ cam = mujoco.MjvCamera()
32
+ mujoco.mjv_defaultCamera(cam)
33
+ cam.elevation = -10
34
+ cam.distance = 1.15 * model.stat.extent
35
+ cam.azimuth = -160
36
+ cam.lookat[2] -= 0.1
37
+ with mujoco.Renderer(model, height=_HEIGHT, width=_WIDTH) as renderer:
38
+ renderer.update_scene(data, cam)
39
+ img = renderer.render()
40
+ img = Image.fromarray(img)
41
+ img.save(_HERE / "img" / f"{name}.png")
42
+
43
+
44
+ if __name__ == "__main__":
45
+ from mjlab.asset_zoo.robots.unitree_g1.g1_constants import G1_ROBOT_CFG
46
+ from mjlab.asset_zoo.robots.unitree_go1.go1_constants import GO1_ROBOT_CFG
47
+
48
+ render_robots("g1", G1_ROBOT_CFG)
49
+ render_robots("go1", GO1_ROBOT_CFG)