mjSpec tutorial: Move humanoid and Menagerie imports to the cells that require them.

PiperOrigin-RevId: 725945693
Change-Id: I3f0d4c867626ef61605815bb708a55c8e29d79e2
This commit is contained in:
Yuval Tassa
2025-02-12 01:01:21 -08:00
committed by Copybara-Service
parent d830691f53
commit 7af9bcbf00
+10 -9
View File
@@ -112,15 +112,6 @@
"from IPython.display import clear_output, HTML, display\n",
"clear_output()\n",
"\n",
"# Get MuJoCo's humanoid model and a Franka arm from the MuJoCo Menagerie.\n",
"print('Getting MuJoCo humanoid XML description from GitHub:')\n",
"!git clone https://github.com/google-deepmind/mujoco\n",
"humanoid_file = 'mujoco/model/humanoid/humanoid.xml'\n",
"humanoid100_file = 'mujoco/model/humanoid/humanoid100.xml'\n",
"print('Getting MuJoCo Menagerie Franka XML description from GitHub:')\n",
"!git clone https://github.com/google-deepmind/mujoco_menagerie\n",
"franka_file = 'mujoco_menagerie/franka_fr3/fr3.xml'\n",
"\n",
"\n",
"is_dark = output.eval_js('document.documentElement.matches(\"[theme=dark]\")')\n",
"print_style = 'monokai' if is_dark else 'lovelace'\n",
@@ -806,6 +797,12 @@
"source": [
"#@title Traversing the spec.{vertical-output: true}\n",
"\n",
"# Get MuJoCo's humanoid model.\n",
"print('Getting MuJoCo humanoid XML description from GitHub:')\n",
"!git clone https://github.com/google-deepmind/mujoco\n",
"humanoid_file = 'mujoco/model/humanoid/humanoid.xml'\n",
"humanoid100_file = 'mujoco/model/humanoid/humanoid100.xml'\n",
"\n",
"spec = mj.MjSpec.from_file(humanoid_file)\n",
"\n",
"# Function that recursively prints all body names\n",
@@ -969,6 +966,10 @@
"source": [
"#@title Humanoid with Franka arm.{vertical-output: true}\n",
"\n",
"# Get Franka arm from the MuJoCo Menagerie.\n",
"!git clone https://github.com/google-deepmind/mujoco_menagerie\n",
"franka_file = 'mujoco_menagerie/franka_fr3/fr3.xml'\n",
"\n",
"spec = mj.MjSpec.from_file(humanoid_file)\n",
"franka = mj.MjSpec.from_file(franka_file)\n",
"\n",