From bea65bc1a7ac331ae52a2219fe02e58fe3406a30 Mon Sep 17 00:00:00 2001 From: Filippo Luca Ferretti Date: Tue, 21 May 2024 12:09:20 +0200 Subject: [PATCH] Set `DISPLAY` environment variable for Colab --- examples/PD_controller.ipynb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/examples/PD_controller.ipynb b/examples/PD_controller.ipynb index 4754a79f4..5da316c89 100644 --- a/examples/PD_controller.ipynb +++ b/examples/PD_controller.ipynb @@ -27,12 +27,22 @@ "\n", "# Install JAX and Gazebo SDF\n", "if IS_COLAB:\n", - " !{sys.executable} -m pip install -qU jaxsim\n", + " !{sys.executable} -m pip install -qU jaxsim[viz]\n", " !apt install -qq lsb-release wget gnupg\n", " !wget https://packages.osrfoundation.org/gazebo.gpg -O /usr/share/keyrings/pkgs-osrf-archive-keyring.gpg\n", " !echo \"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/pkgs-osrf-archive-keyring.gpg] http://packages.osrfoundation.org/gazebo/ubuntu-stable $(lsb_release -cs) main\" | sudo tee /etc/apt/sources.list.d/gazebo-stable.list > /dev/null\n", " !apt -qq update\n", " !apt install -qq --no-install-recommends libsdformat13 gz-tools2\n", + "\n", + " # Optional dependency for visualization\n", + " !{sys.executable} -m pip install pyvirtualdisplay\n", + " !apt install xvfb\n", + "\n", + " # Start Xvfb and set \"DISPLAY\" environment variable\n", + " import pyvirtualdisplay\n", + " d = pyvirtualdisplay.Display()\n", + " d.start()\n", + "\n", " clear_output()\n", "\n", "import jax\n",