mjSpec tutorial backwards compatibility with the latest MuJoCo release.
PiperOrigin-RevId: 690747714 Change-Id: Ib8894a1dc2a68e30a110e773c77fbd2baee87efd
This commit is contained in:
committed by
Copybara-Service
parent
d01fb81b50
commit
f1d4b23e48
+18
-7
@@ -172,7 +172,7 @@
|
||||
"render(model)\n",
|
||||
"\n",
|
||||
"# Change the mjSpec, re-compile and re-render\n",
|
||||
"geoms = spec.worldbody.find_all('geom')\n",
|
||||
"geoms = spec.worldbody.find_all(mj.mjtObj.mjOBJ_GEOM)\n",
|
||||
"geoms[0].name = 'blue_box'\n",
|
||||
"geoms[0].rgba = [0, 0, 1, 1]\n",
|
||||
"geoms[1].name = 'yellow_sphere'\n",
|
||||
@@ -392,7 +392,11 @@
|
||||
"#@title Six Creatures on a floor.{vertical-output: true}\n",
|
||||
"\n",
|
||||
"arena = mj.MjSpec()\n",
|
||||
"arena.compiler.degree = False # Use radians.\n",
|
||||
"\n",
|
||||
"if hasattr(arena, 'compiler'):\n",
|
||||
" arena.compiler.degree = False # MuJoCo dev (next release).\n",
|
||||
"else:\n",
|
||||
" arena.degree = False # MuJoCo release\n",
|
||||
"\n",
|
||||
"# Make arena with textured floor.\n",
|
||||
"chequered = arena.add_texture(\n",
|
||||
@@ -452,7 +456,7 @@
|
||||
"video = []\n",
|
||||
"pos_x = []\n",
|
||||
"pos_y = []\n",
|
||||
"geoms = arena.worldbody.find_all(\"geom\")\n",
|
||||
"geoms = arena.worldbody.find_all(mj.mjtObj.mjOBJ_GEOM)\n",
|
||||
"torsos = [geom.id for geom in geoms if 'torso' in geom.name]\n",
|
||||
"actuators = [actuator.id for actuator in arena.actuators]\n",
|
||||
"\n",
|
||||
@@ -703,7 +707,11 @@
|
||||
"\n",
|
||||
"spec = mj.MjSpec.from_file(humanoid_file)\n",
|
||||
"franka = mj.MjSpec.from_file(franka_file)\n",
|
||||
"spec.compiler.degree = False # This has no effect on the humanoid as it does not contain angles\n",
|
||||
"\n",
|
||||
"if hasattr(spec, 'compiler'):\n",
|
||||
" spec.compiler.degree = False # MuJoCo dev (next release).\n",
|
||||
"else:\n",
|
||||
" spec.degree = False # MuJoCo release\n",
|
||||
"\n",
|
||||
"# Replace right arm with frame\n",
|
||||
"arm_right = spec.find_body('upper_arm_right')\n",
|
||||
@@ -805,15 +813,18 @@
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"accelerator": "GPU",
|
||||
"colab": {
|
||||
"collapsed_sections": [
|
||||
"sJFuNetilv4m"
|
||||
],
|
||||
"gpuClass": "premium",
|
||||
"private_outputs": true
|
||||
},
|
||||
"gpuClass": "premium",
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"name": "python"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
||||
Reference in New Issue
Block a user