Skip to content

Commit 40fa74e

Browse files
committed
Merge dev branch
* Switch to drone models for physics * Switch to drone controllers for onboard controllers * Improve tests * Rename physics modes * Remove symbolic models in favor of drone-models * Add visualization helpers * Add support for purely functional sims * Remove assets * Add rudimentary docs support * Remove scipy build tools
2 parents 4007847 + 55a7266 commit 40fa74e

76 files changed

Lines changed: 5643 additions & 32803 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/CODEOWNERS

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@
1111
.github/CODEOWNERS @amacati
1212

1313
# Build related files
14-
pyproject.toml @amacati
15-
crazyflow @amacati
14+
pyproject.toml @amacati @Rather1337
15+
crazyflow @amacati @Rather1337

.github/workflows/docs.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Deploy Documentation
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
13+
14+
concurrency:
15+
group: "pages"
16+
cancel-in-progress: false
17+
18+
jobs:
19+
build:
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
26+
- name: Install submodules
27+
run: |
28+
git submodule update --init --recursive
29+
30+
- name: Setup pixi
31+
uses: prefix-dev/setup-pixi@v0.9.3
32+
with:
33+
pixi-version: v0.61.0
34+
cache: true
35+
environments: docs
36+
activate-environment: false
37+
locked: true
38+
39+
- name: Build documentation
40+
run: pixi run -e docs mkdocs build
41+
42+
- name: Setup Pages
43+
uses: actions/configure-pages@v3
44+
45+
- name: Upload artifact
46+
uses: actions/upload-pages-artifact@v4
47+
with:
48+
path: ./site
49+
50+
deploy:
51+
environment:
52+
name: github-pages
53+
url: ${{ steps.deployment.outputs.page_url }}
54+
runs-on: ubuntu-latest
55+
needs: build
56+
if: github.ref == 'refs/heads/main'
57+
58+
steps:
59+
- name: Deploy to GitHub Pages
60+
id: deployment
61+
uses: actions/deploy-pages@v4

.github/workflows/ruff.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
name: Ruff
22
on: [ push, pull_request ]
33
jobs:
4-
ruff:
4+
ruff-check:
55
runs-on: ubuntu-latest
66
steps:
77
- uses: actions/checkout@v4
8-
- uses: astral-sh/ruff-action@v1
8+
- uses: astral-sh/ruff-action@v1
9+
10+
ruff-format:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: astral-sh/ruff-action@v1
15+
with:
16+
args: "format --check --diff"

.github/workflows/testing.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,24 @@ name: Testing
22
on: [push, pull_request]
33

44
jobs:
5-
test:
5+
tests:
66
runs-on: ubuntu-latest
77
steps:
88
- uses: actions/checkout@v4
99

10+
- name: Install submodules
11+
run: |
12+
git submodule update --init --recursive
13+
1014
- name: Setup Pixi (installs pixi + caches envs) # https://github.com/marketplace/actions/setup-pixi
11-
uses: prefix-dev/setup-pixi@v0.9.0 # pin the action version
15+
uses: prefix-dev/setup-pixi@v0.9.3 # pin the action version
1216
with:
13-
pixi-version: v0.49.0 # pin the pixi binary version (optional)
17+
pixi-version: v0.61.0 # pin the pixi binary version (optional)
1418
cache: true # enable caching of installed envs
1519
# only write new caches on main pushes (TODO: Enable)
1620
# cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
17-
# ensure the 'test' environment(s) are installed
18-
environments: test
21+
# ensure the 'tests' environment(s) are installed
22+
environments: tests
1923
# don't activate env (we'll call pixi run -e test explicitly)
2024
activate-environment: false
2125
# prefer using existing lockfile if present (faster, deterministic)
@@ -24,4 +28,4 @@ jobs:
2428
- name: Verify pixi and run tests
2529
run: |
2630
pixi --version
27-
pixi run -e test pytest
31+
pixi run -e tests tests

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,9 @@ benchmark/data
2020
# pixi environments
2121
.pixi
2222
*.egg-info
23+
24+
# MkDocs build output
25+
site/
26+
# Temporary files
27+
.DS_Store
28+
Thumbs.db

.gitmodules

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[submodule "submodules/drone-models"]
2+
path = submodules/drone-models
3+
url = https://github.com/utiasDSL/drone-models.git
4+
branch = main
5+
[submodule "submodules/drone-controllers"]
6+
path = submodules/drone-controllers
7+
url = https://github.com/utiasDSL/drone-controllers.git
8+
branch = main

README.md

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,44 @@ Fast, parallelizable simulations of Crazyflies with JAX.
66

77
[![Python Version]][Python Version URL] [![Ruff Check]][Ruff Check URL] [![Documentation Status]][Documentation Status URL] [![Tests]][Tests URL]
88

9-
[Python Version]: https://img.shields.io/badge/python-3.10+-blue.svg
9+
[Python Version]: https://img.shields.io/badge/python-3.11+-blue.svg
1010
[Python Version URL]: https://www.python.org
1111

1212
[Ruff Check]: https://github.com/utiasDSL/crazyflow/actions/workflows/ruff.yml/badge.svg?style=flat-square
1313
[Ruff Check URL]: https://github.com/utiasDSL/crazyflow/actions/workflows/ruff.yml
1414

15-
[Documentation Status]: https://readthedocs.org/projects/crazyflow/badge/?version=latest
16-
[Documentation Status URL]: https://crazyflow.readthedocs.io/en/latest/?badge=latest
15+
[Documentation Status]: https://github.com/utiasDSL/crazyflow/actions/workflows/docs.yml/badge.svg
16+
[Documentation Status URL]: https://utiasdsl.github.io/crazyflow
1717

1818
[Tests]: https://github.com/utiasDSL/crazyflow/actions/workflows/testing.yml/badge.svg
1919
[Tests URL]: https://github.com/utiasDSL/crazyflow/actions/workflows/testing.yml
2020

21+
## Quick Start
22+
For a more detailed guide, check out our [documentation TODO](TODO).
23+
24+
### Normal installation
25+
The regular way to use Crazyflow is to install it from PyPI with your favourite package manager, e.g., with pip:
26+
``` bash
27+
pip install crazyflow
28+
```
29+
30+
### Developer installation
31+
If you plan to develop with and around Crazyflow, you can use the existing [pixi](https://pixi.sh/) environment.
32+
``` bash
33+
git clone --recurse-submodules git@github.com:utiasDSL/crazyflow.git
34+
cd crazyflow
35+
pixi shell
36+
```
37+
38+
This will install Crazyflow, drone-models, and drone-controllers in editable mode for easy development.
39+
40+
In case you want to use another package manager or install the simulator with it's subpackages into another project, simply install all packages manually in your environment:
41+
``` bash
42+
pip install -e . # Installing Crazyflow
43+
pip install -e ./submodules/drone-models
44+
pip install -e ./submodules/drone-controllers
45+
```
46+
2147

2248
## Architecture
2349

@@ -30,8 +56,10 @@ The simulation is built as a pipeline of functions that are composed at initiali
3056

3157
#### Physics Backends
3258
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
59+
- first_principles: A first-principles model based on physical equations
60+
- so_rpy: A system-identified model trained on real drone data
61+
- so_rpy_rotor: An enhanced system-identified model that includes thrust dynamics
62+
- so_rpy_rotor_drag: A system-identified model that includes thrust dynamics and drag effects
3563

3664
#### Control Modes
3765
Different control interfaces are available:

benchmark/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ def main(device: str = "cpu", n_worlds_exp: int = 6):
151151
sim_config = config_dict.ConfigDict()
152152
sim_config.n_worlds = 1
153153
sim_config.n_drones = 1
154-
sim_config.physics = "analytical"
154+
sim_config.physics = "first_principles"
155155
sim_config.control = "attitude"
156156
sim_config.attitude_freq = 500
157157
sim_config.device = device

benchmark/op_count.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
def main():
66
"""Main entry point for profiling."""
7-
sim = Sim(n_worlds=1, n_drones=1, physics="analytical", control="attitude")
7+
sim = Sim(n_worlds=1, n_drones=1, physics="first_principles", control="attitude")
88

99
compiled_reset = sim._reset.lower(sim.data, sim.default_data, None).compile()
1010
compiled_step = sim._step.lower(sim.data, 1).compile()

benchmark/performance.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def main():
7777
sim_config = config_dict.ConfigDict()
7878
sim_config.n_worlds = 1
7979
sim_config.n_drones = 1
80-
sim_config.physics = "analytical"
80+
sim_config.physics = "first_principles"
8181
sim_config.control = "attitude"
8282
sim_config.device = device
8383

0 commit comments

Comments
 (0)