Skip to content

Commit

Permalink
Fix headless rendering when executing notebooks with MyST
Browse files Browse the repository at this point in the history
  • Loading branch information
flferretti committed Jul 2, 2024
1 parent 9190ea9 commit 82219d1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
10 changes: 6 additions & 4 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,10 @@
# -- Options for sphinx-gallery ----------------------------------------------

sphinx_gallery_conf = {
"examples_dirs": "_collections/examples",
"gallery_dirs": ("_collections/generated_examples/"),
"examples_dirs": "../examples",
"gallery_dirs": "../generated_examples/",
"doc_module": "jaxsim",
"backreferences_dir": os.path.join("modules", "generated"),
"abort_on_example_error": True,
}

# -- Options for myst -------------------------------------------------------
Expand All @@ -113,7 +113,9 @@
]
nb_execution_mode = "force"
nb_execution_allow_errors = False
nb_render_image_options = {}
nb_render_image_options = {
"scale": "60",
}

source_suffix = [".rst", ".md", ".ipynb"]

Expand Down
9 changes: 5 additions & 4 deletions examples/PD_controller.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"import sys\n",
"\n",
"IS_COLAB = \"google.colab\" in sys.modules\n",
"IS_RTD = os.environ.get(\"READTHEDOCS\") is not None\n",
"\n",
"# Install JAX and Gazebo SDF\n",
"if IS_COLAB:\n",
Expand Down Expand Up @@ -159,6 +158,7 @@
"import os\n",
"import subprocess\n",
"\n",
"os.environ[\"MUJOCO_GL\"] = \"osmesa\"\n",
"\n",
"if IS_COLAB:\n",
" if subprocess.run(\"nvidia-smi\").returncode:\n",
Expand All @@ -185,7 +185,8 @@
" \"\"\"\n",
" )\n",
"\n",
"os.environ[\"MUJOCO_GL\"] = \"egl\" if not IS_RTD else \"osmesa\"\n",
" os.environ[\"MUJOCO_GL\"] = \"egl\"\n",
"\n",
"\n",
"from jaxsim.mujoco import MujocoModelHelper, MujocoVideoRecorder\n",
"from jaxsim.mujoco.loaders import UrdfToMjcf\n",
Expand All @@ -209,8 +210,8 @@
" model=mj_model_helper.model,\n",
" data=mj_model_helper.data,\n",
" fps=int(1 / 0.010),\n",
" width=320 * 4,\n",
" height=240 * 4,\n",
" width=320 * 2,\n",
" height=240 * 2,\n",
")"
]
},
Expand Down

0 comments on commit 82219d1

Please sign in to comment.