From 7af9bcbf00be9efa4f972bad8ca29e648716b1b3 Mon Sep 17 00:00:00 2001 From: Yuval Tassa Date: Wed, 12 Feb 2025 01:01:21 -0800 Subject: [PATCH] mjSpec tutorial: Move humanoid and Menagerie imports to the cells that require them. PiperOrigin-RevId: 725945693 Change-Id: I3f0d4c867626ef61605815bb708a55c8e29d79e2 --- python/mjspec.ipynb | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/python/mjspec.ipynb b/python/mjspec.ipynb index e5392ed2..e818800a 100644 --- a/python/mjspec.ipynb +++ b/python/mjspec.ipynb @@ -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",