Repository navigation
Conversation
Collaborator
|
As we discussed before, the videos should not be included in this PR. We can add the CI job to generate them on the fly in a follow-up |
Collaborator
Author
|
Done |
amacati
reviewed
Oct 18, 2026
| ```{ .python notest } | ||
| --8<-- "examples/environments/figure8.py" | ||
| ``` | ||
| The runnable examples are grouped by topic, following the folders in `examples/`. Start with [hover](control.md#hover) if you're new, or jump to the group that matches your use case. Run an example from the repository root with `python examples/<group>/<script>.py`. |
Collaborator
There was a problem hiding this comment.
Suggested change
| The runnable examples are grouped by topic, following the folders in `examples/`. Start with [hover](control.md#hover) if you're new, or jump to the group that matches your use case. Run an example from the repository root with `python examples/<group>/<script>.py`. | |
| The runnable examples are grouped by topic, following the folders in `examples/`. Start with [hover](control.md#hover) if you're new, or jump to the group that matches your use case. Run an example from the repository root with `pixi run python examples/<group>/<script>.py`. |
|
|
||
| The body rate controller keeps the attitude terms of the Mellinger controller, which level the | ||
| drone at its current yaw and counteract the commanded rates. The example sets their `kR` and `ki_m` | ||
| gains to zero to track the body rates. |
Collaborator
There was a problem hiding this comment.
Suggested change
| gains to zero to track the body rates. | |
| gains to zero to freely track the body rates. |
| commands = np.stack([trajectory(t) for t in times]) | ||
| reference = commands[:, 0, 0, 0:3] | ||
| trajectory = [np.asarray(sim.data.states.pos[0, 0])] | ||
| positions = [np.asarray(sim.data.states.pos[0, 0])] |
Collaborator
There was a problem hiding this comment.
Can we fix unnecessary asarray uses while we are reworking the docs?
Comment on lines
+3
to
+4
| The goal position is set through the reset options, and the `JaxToNumpy` wrapper converts between | ||
| NumPy actions and JAX observations. |
Collaborator
There was a problem hiding this comment.
Suggested change
| The goal position is set through the reset options, and the `JaxToNumpy` wrapper converts between | |
| NumPy actions and JAX observations. | |
| The `JaxToNumpy` wrapper converts between NumPy actions and JAX observations. |
|
|
||
| Because the simulator is built entirely from JAX operations, `jax.grad` can differentiate through | ||
| it. Starting the drone in the air keeps it away from the floor, so the floor-clipping stage never | ||
| fires and gradients flow freely through the entire trajectory. |
Collaborator
There was a problem hiding this comment.
Suggested change
| fires and gradients flow freely through the entire trajectory. | |
| applies and gradients flow freely through the entire trajectory. |
Comment on lines
+4
to
+5
| Two drones circle the hall center while facing each other. Requires splax | ||
| (`pip install "crazyflow[splats]"`) and a CUDA GPU. |
Collaborator
There was a problem hiding this comment.
Suggested change
| Two drones circle the hall center while facing each other. Requires splax | |
| (`pip install "crazyflow[splats]"`) and a CUDA GPU. | |
| Requires splax (`pip install "crazyflow[splats]"`) and a CUDA GPU. |
| @@ -1,17 +1,22 @@ | |||
| """Animate the splat depth camera of a drone flying an elliptical lap through the flight hall. | |||
| """Example where a drone flies a lap through a hall and renders gaussian splat depth images. | |||
Collaborator
There was a problem hiding this comment.
Suggested change
| """Example where a drone flies a lap through a hall and renders gaussian splat depth images. | |
| """Fly a lap through a hall and renders gaussian splat depth images. |
Comment on lines
+3
to
+5
| `build_render_splat_rgbd_fn` compiles an RGB-D renderer that is a pure function of `sim.data`. The | ||
| depth is measured along the optical axis and clipped to `max_range`. Requires splax | ||
| (`pip install "crazyflow[splats]"`) and a CUDA GPU. |
Collaborator
There was a problem hiding this comment.
Suggested change
| `build_render_splat_rgbd_fn` compiles an RGB-D renderer that is a pure function of `sim.data`. The | |
| depth is measured along the optical axis and clipped to `max_range`. Requires splax | |
| (`pip install "crazyflow[splats]"`) and a CUDA GPU. | |
| `build_render_splat_rgbd_fn` compiles an RGB-D renderer that is a pure function of `sim.data`. | |
| Requires splax (`pip install "crazyflow[splats]"`) and a CUDA GPU. |
Comment on lines
+4
to
+6
| baseline pose, and its photometric error is differentiated over small z and yaw offsets. The | ||
| resulting gradients match the gradient of the squared pose error in sign and shape. Requires splax | ||
| (`pip install "crazyflow[splats]"`) and a CUDA GPU. |
Collaborator
There was a problem hiding this comment.
Suggested change
| baseline pose, and its photometric error is differentiated over small z and yaw offsets. The | |
| resulting gradients match the gradient of the squared pose error in sign and shape. Requires splax | |
| (`pip install "crazyflow[splats]"`) and a CUDA GPU. | |
| baseline pose, and its photometric error is differentiated over small z and yaw offsets. | |
| Requires splax (`pip install "crazyflow[splats]"`) and a CUDA GPU. |
Comment on lines
+63
to
+70
| def test_examples_in_docs(): | ||
| """Every example script has a section in the example docs, and every section has a script.""" | ||
| directive = re.compile(r'^--8<-- example "examples/(.+)"$', re.MULTILINE) | ||
| pages = DOCS_EXAMPLES_DIR.glob("*.md") | ||
| documented = {path for page in pages for path in directive.findall(page.read_text())} | ||
| scripts = {path.relative_to(EXAMPLES_DIR).as_posix() for path in EXAMPLES_DIR.rglob("*.py")} | ||
| assert not scripts - documented, f"Missing from docs/examples: {sorted(scripts - documented)}" | ||
| assert not documented - scripts, f"Stale in docs/examples: {sorted(documented - scripts)}" |
Collaborator
There was a problem hiding this comment.
Why is this here? We are already testing the examples outside the docs, aren't we?
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With this PR, the docs contain all examples (tested with new test). To make it less crowded (#131), the docs are strucuted as the example folders. Also, instead of having the information per example twice, we only have the docstring, which is also written into the docs during building (new script for that). Since the code of some examples is long, the code is now collapsible.
Additionally, I added some quality of life fixes, such as a --plot flag with no plotting when running regularly (would crash in the base env) and unifying the naming inside the examples (all now use
trajectory()for the reference and similar changes).This PR turned out longer than intended. Most of it is just shifting things around though. If I should split this into multiple PRs, lmk.