You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Crazyflow is a high-performance simulation framework for Crazyflie drones that leverages JAX for efficient parallelization and automatic differentiation. The architecture is designed around a flexible pipeline that can be configured at initialization time, enabling users to swap out physics backends, control methods, and integration schemes.
25
+
26
+
### Core Components
27
+
28
+
#### Simulation Pipeline
29
+
The simulation is built as a pipeline of functions that are composed at initialization time based on the configuration. This approach avoids runtime branching and allows JAX to optimize the entire pipeline as a single computation. Users can insert their own pure functions into the pipeline to modify the simulation behavior while maintaining compatibility with JAX's optimizations.
30
+
31
+
#### Physics Backends
32
+
Multiple physics models are supported:
33
+
- analytical: A first-principles model based on physical equations
34
+
- sys_id: A system-identified model trained on real drone data
35
+
- mujoco: MuJoCo physics engine for more complex interactions
36
+
37
+
#### Control Modes
38
+
Different control interfaces are available:
39
+
- state: High-level control of position, velocity, and yaw
40
+
- attitude: Mid-level control of collective thrust and orientation
41
+
- thrust: Low-level control of individual motor thrusts
42
+
43
+
#### Integration Methods
44
+
For analytical and system-identified physics:
45
+
- euler: Simple first-order integration
46
+
- rk4: Fourth-order Runge-Kutta integration for higher accuracy
- Worlds: Independent simulation environments that can run in parallel
51
+
- Drones: Multiple drones within each world
52
+
- Devices: Computations can be executed on CPU or GPU
53
+
This parallelization is achieved through JAX's vectorization capabilities, allowing thousands of simulations to run simultaneously with minimal overhead.
54
+
55
+
### Domain Randomization
56
+
The framework supports domain randomization through the crazyflow/randomize module, allowing parameters like mass to be varied across simulations to improve sim-to-real transfer.
57
+
58
+
### Functional Design
59
+
The simulation follows a functional programming paradigm: All state is contained in immutable data structures. Updates create new states rather than modifying existing ones. All functions are pure, enabling JAX's transformations (JIT, grad, vmap) and thus automatic differentiation through the entire simulation, making it suitable for gradient-based optimization and reinforcement learning.
60
+
61
+
## Examples
62
+
The repository includes several example scripts demonstrating different capabilities:
-`"RuntimeError: MUJOCO_PATH environment variable is not set"` upon installing this package. This error can be resolved by using `venv` instead of `conda`. Somtimes the `mujoco` install can [fail with `conda`](https://github.com/google-deepmind/mujoco/issues/1004).
76
+
- If using `zsh` don't forget to escape brackets when installing additional dependencies: `pip install .\[gpu\]`.
77
+
1
78
### Using the project with VSCode devcontainers
2
79
3
80
**Running on CPU**: by default the containers run on CPU. You don't need to take any action.
@@ -6,11 +83,11 @@
6
83
7
84
8
85
**Linux**
9
-
0. Make sure to be in a X11 session ([link](https://askubuntu.com/questions/1410256/how-do-i-use-the-x-window-manager-instead-of-wayland-on-ubuntu-22-04)), otherwise rendering of the drone will fail.
10
-
1. Install [Docker](https://docs.docker.com/engine/install/) (, and make sure Docker Daemon is running)
11
-
2. Install [VSCode](https://code.visualstudio.com/), with [devcontainer extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers), and [remote dev pack](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-docker).
12
-
3. Clone this project's code. Rename `/.devcontainer/devcontainer.linux.json` to `/.devcontainer/devcontainer.json`.
13
-
4. Open this project in VSCode. VSCode should automatically detect the devcontainer and prompt you to `Reopen in container`. If not, see [here](https://code.visualstudio.com/docs/devcontainers/containers#_quick-start-open-an-existing-folder-in-a-container) 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.
86
+
1. Make sure to be in a X11 session ([link](https://askubuntu.com/questions/1410256/how-do-i-use-the-x-window-manager-instead-of-wayland-on-ubuntu-22-04)), otherwise rendering of the drone will fail.
87
+
2. Install [Docker](https://docs.docker.com/engine/install/) (, and make sure Docker Daemon is running)
88
+
3. Install [VSCode](https://code.visualstudio.com/), with [devcontainer extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers), and [remote dev pack](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-docker).
89
+
4. Clone this project's code. Rename `/.devcontainer/devcontainer.linux.json` to `/.devcontainer/devcontainer.json`.
90
+
5. Open this project in VSCode. VSCode should automatically detect the devcontainer and prompt you to `Reopen in container`. If not, see [here](https://code.visualstudio.com/docs/devcontainers/containers#_quick-start-open-an-existing-folder-in-a-container) 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.
14
91
15
92
**Windows** (requires Windows 10 or later)
16
93
@@ -34,29 +111,3 @@ ____________
34
111
Known Issues:
35
112
- 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
36
113
37
-
# crazyflow
38
-
Fast, parallelizable simulations of Crazyflies with JAX and MuJoCo.
39
-
40
-
[![Python Version]][Python Version URL][![Ruff Check]][Ruff Check URL][![Documentation Status]][Documentation Status URL][![Tests]][Tests URL]
-`"RuntimeError: MUJOCO_PATH environment variable is not set"` upon installing this package. This error can be resolved by using `venv` instead of `conda`. Somtimes the `mujoco` install can [fail with `conda`](https://github.com/google-deepmind/mujoco/issues/1004).
62
-
- If using `zsh` don't forget to escape brackets when installing additional dependencies: `pip install .\[gpu\]`.
0 commit comments