Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
flferretti committed Jun 26, 2024
1 parent 2b03b65 commit 836e49f
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions examples/PD_controller.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,13 @@
" !apt -qq update\n",
" !apt install -qq --no-install-recommends libsdformat13 gz-tools2\n",
"\n",
" # Optional dependency for visualization\n",
"# Install dependencies for visualization on Colab and ReadTheDocs\n",
"if IS_COLAB or IS_RTD:\n",
" !sudo apt update\n",
" !apt install xvfb ffmpeg python-opengl\n",
" !{sys.executable} -m pip install pyvirtualdisplay\n",
" !apt install xvfb\n",
" clear_output()\n",
"\n",
"if IS_COLAB or IS_RTD:\n",
" # Start Xvfb and set \"DISPLAY\" environment variable\n",
" import pyvirtualdisplay\n",
"\n",
Expand Down Expand Up @@ -156,18 +157,11 @@
"source": [
"# @title Set up MuJoCo renderer\n",
"\n",
"from jaxsim.mujoco import MujocoModelHelper, MujocoVideoRecorder\n",
"from jaxsim.mujoco.loaders import UrdfToMjcf\n",
"\n",
"import os\n",
"import subprocess\n",
"\n",
"\n",
"if IS_COLAB:\n",
" if subprocess.run(\"ffmpeg -version\", shell=True).returncode:\n",
" !command -v ffmpeg >/dev/null || (apt update && apt install -y ffmpeg)\n",
" clear_output()\n",
"\n",
" if subprocess.run(\"nvidia-smi\").returncode:\n",
" raise RuntimeError(\n",
" \"Cannot communicate with GPU. \"\n",
Expand All @@ -194,6 +188,9 @@
"\n",
"%env MUJOCO_GL=egl\n",
"\n",
"from jaxsim.mujoco import MujocoModelHelper, MujocoVideoRecorder\n",
"from jaxsim.mujoco.loaders import UrdfToMjcf\n",
"\n",
"camera = {\n",
" \"name\": \"cartpole_camera\",\n",
" \"mode\": \"fixed\",\n",
Expand Down

0 comments on commit 836e49f

Please sign in to comment.