Fast, parallelizable simulations of Crazyflies with JAX and MuJoCo.
Running on CPU: by default the containers run on CPU. You don't need to take any action.
Running on GPU: The devcontsainers can easily run using your computer's NVIDIA GPU on Linux and Windows. This makes sense if you want to accelerate simulation by running thousands of simulation in parallel. In order to work you need to install the CUDA Toolkit, NVIDIA Container runtime for your computer. Finally, enable GPU access to the devcontainers by setting the commented out "--gpus=all"
and "--runtime=nvidia"
flags in devcontainer.json
.
- Install Docker (, and make sure Docker Daemon is running)
- Install VSCode, with devcontainer extension, and remote dev pack.
- Clone this project's code. Rename
/.devcontainer/devcontainer.linux.json
to/.devcontainer/devcontainer.json
. - Open this project in VSCode. VSCode should automatically detect the devcontainer and prompt you to
Reopen in container
. If not, see here to open manually. Note: Opening the container for the first time might take a while (up to 15 min), as the container is pulled from the web and build.
For windows, we require WSL2 to run the devcontainer. (So its actually Linux with extra steps.) Full instructions can be found in the official docs. Here are the important steps:
- Install Docker, and WSL2, and Ubuntu 22.04 LTS (, and make sure Docker Daemon is running)
- Docker will recognize that you have WSL installed and prompt you via Windows Notifications to enable WSL integration -> confirm this with
Enable WSL integration
. If not, openDocker Desktop
, navigate to the settings, and manually enable WSL integration. (There are TWO setting options for this. Make sure to enable BOTH!) - Install VSCode, with the WSL extension, devcontainer extension, and remote dev pack.
- Clone the source code for the exercises in the WSL2 file system to
/home
(~
), or wherever you like. (Performance when working on the WSL file system is much better compared to Windows file system). You can access the WSL filesystem either by starting a WSL/Ubuntu console, or via the Windows File Explorer at\\wsl.localhost\Ubuntu\home
(replaceUbuntu
with your distro, if necessary). - Rename
/.devcontainer/devcontainer.windows.json
to/.devcontainer/devcontainer.json
. - Open this project in VSCode. The easiest way to do so is by starting a WSL/Ubuntu shell, navigating via
cd
to the source code, then typecode .
to open VSCode. VSCode should automatically detect the devcontainer and prompt you toReopen in container
. If not, see here to open manually. Note: Opening the container for the first time might take a while (up to 15 min), as the container is pulled from the web and build.
Unfortunately, we did not get the devcontainer to work with MacOS yet, even after following those steps. We expect that the issue is related to Mujoco rendering from inside the Docker container and display forwarding with X11. There is also an unresolved Issue on GitHub. If you manage to make it work, please let us know.
Until then, MacOS users are required to install this project using an python environment manager such as conda or mamba. If you use conda, these are the required commands: conda create --name crazyflow -c conda-forge python=3.11
, conda activate crazyflow
, conda install pip
, pip install -e .
.
Known Issues:
- if building docker container fails at
RUN apt-get update
, make sure your host systems time is set correct: https://askubuntu.com/questions/1511514/docker-build-fails-at-run-apt-update-error-failed-to-solve-process-bin-sh
"RuntimeError: MUJOCO_PATH environment variable is not set"
upon installing this package. This error can be resolved by usingvenv
instead ofconda
. Somtimes themujoco
install can fail withconda
.- If using
zsh
don't forget to escape brackets when installing additional dependencies:pip install .\[gpu\]
.