Crazyflow Conventions

VerifiedSafe

Non-obvious traps and conventions for working in the Crazyflow drone simulator, including adding models, testing, and using JAX.

Sby Skills Guide Bot
DevelopmentAdvanced
8/14/2026
Claude CodeCursorCodex
#jax#simulation#drone-dynamics#array-api#testing

Recommended for

Automated summary

Captures the non-obvious conventions and traps of the crazyflow drone simulator, covering the array API, JAX usage, dynamics model registration, and how tests are run with pixi.

Strengths

  • Spells out the array API rules: take the namespace from inputs with array_namespace, coerce parameters with to_xp, and never import numpy on a computation path
  • Gives a reliable procedure for adding a dynamics model or drone, including every registration site and the grep trap caused by build_control_fns
  • Flags concrete testing pitfalls: render tests deselected by addopts, the visualization test skipped silently when headless, and executable docstrings whose output is never compared
  • Details out-of-Sim usage subtleties: import order versus scipy, the three distinct load_params, the shared partial returned by parametrize, and batch/feature axis conventions

Limitations

  • Heavily tied to the crazyflow repository, so it is not a general guide to JAX or drone simulation
  • The document cuts off mid-sentence about symbolic_dynamics, leaving that section incomplete
  • Assumes familiarity with pixi, jax.jit/grad/vmap and the project's test setup
When to use it

Load it whenever a task touches the crazyflow codebase: adding a drone or dynamics model, reusing controllers outside Sim, or debugging tests and executable examples.

When not to use it

When learning JAX or the standard array API, when doing generic drone simulation, or when working in a simulator other than crazyflow.

Security analysis

Safe
Quality score92/100

The skill is a codebase-specific guide with no dangerous instructions, credential handling, network exfiltration, obfuscated payloads, or destructive commands. It suggests deleting a shared JAX cache to resolve confusing failures, which is mildly operational but not a meaningful security risk.

No concerns found

How this analysis is made

Examples

Add a new drone platform
Add a new quadrotor platform called 'x500' to crazyflow: register it in the available drones, add the matching section to every crazyflow/dynamics/*/params.toml, and make sure the ~40 parametrized registration tests pass.
Use dynamics outside Sim
Write a batched MPC-style loop that calls crazyflow's dynamics and Mellinger controller outside Sim, with array_namespace handling, zeros-initialized integral state under jit, and a ctrl_freq that matches my real 100 Hz loop.
Debug tests and doctests
My crazyflow tests pass in CI but a docstring example prints the wrong value — convert the output check to a pycon fence with >>> prompts and tell me why the markdown runner never caught it.

name: crazyflow description: Non-obvious traps and conventions in the crazyflow drone simulator. Use when working in the crazyflow codebase, adding a dynamics model or drone platform, reusing the dynamics or controllers outside Sim for estimation or MPC, or writing code under jax.jit, grad or vmap.

Crazyflow

Settings are in pyproject.toml, layout in the tree, API reference in docs/.

Conventions

  • Ruff settings live in pyproject.toml and must pass before committing.
  • Dynamics and controllers follow the array API standard. Take the namespace from the inputs with array_namespace(...), do all math through it, coerce bound parameters with to_xp, and never import numpy into a computation path.
  • crazyflow/control/mellinger/params.toml deliberately holds values that differ from the true physical constants in crazyflow/drones/params.toml, reproducing the real firmware. Do not unify them.

Testing

pixi run -e tests tests        # what CI runs
pixi run -e tests test-docs    # every example in docstrings and docs

Use pixi, not uv. pixi run <cmd> resolves task names only, so arbitrary commands need -e tests.

  • addopts = "-m 'not render'" deselects every render test, and tests/unit/test_visualizations.py is @skip_if_headless without the marker, so it is skipped silently without DISPLAY. Rendering regressions pass CI green. Run -m render locally with a display.
  • Docs and docstrings are executable. The markdown runner catches exceptions but never compares output, so a print with the result in a trailing comment proves nothing. Output that must be checked goes in a pycon fence with >>> prompts, which doctest picks up.
  • tests/integration/test_examples.py runs every script under examples/, so a new example is a new test.
  • tests/conftest.py forces JAX's persistent cache on at /tmp/jax_cache, shared across branches. Delete it when failures make no sense.
  • Request the device fixture rather than a GPU marker. It falls back to CPU silently, so gpu-tests asserts nothing about placement on a machine without CUDA.

Adding a dynamics model or drone

Grepping the name of an existing model or drone finds every registration site, except when matching against all models in the simulation's build_control_fns.

Define the function in dynamics.py and never in the package __init__.py, because load_params derives the model name from fn.__module__.split(".")[-2]. parametrize binds exactly the keyword-only parameters after the bare *, so anything before it is never bound. Every drone in available_drones needs a section in every crazyflow/dynamics/*/params.toml, even an empty one.

Registration alone produces roughly 40 parametrized tests. These do not include derivatives tests.

Using dynamics and controllers outside Sim

Pure, batched, array-API functions with no dependency on Sim.

  • Import crazyflow before scipy. crazyflow/__init__.py sets SCIPY_ARRAY_API=1 and imports scipy immediately, and scipy cannot be reconfigured once loaded. Transitive imports through acados or sklearn trigger this too.
  • Three different load_params exist. The two in .core filter to the target signature and silently drop the rest, so hardware constants like thrust_max need crazyflow.drones.load_params.
  • parametrize returns a functools.partial whose keywords dict is shared by every reference to it. Call parametrize again for an independent copy.
  • Leading batch dimensions, trailing feature axis. quat is scalar-last xyzw, force is (..., 1) rather than a scalar, ang_vel is body frame.
  • ctrl_freq scales only the integral and derivative terms, so it must match your real loop rate. Under jit, initialize integral states to zeros rather than None, since the pytree structure change forces a recompile.
  • symbolic_dynamics monkey-patches module-global symbols while building, so it is not reentrant. Do not build two concurrently.

The functional API and jit

Sim rebinds sim.data as a Python side effect that JAX cannot trace, so anything inside jit, grad, vmap or scan must use crazyflow.sim.functional with Sim only as the builder. See functional-api.md.

  • After editing a pipeline, call build_step_fn() or build_reset_fn() again. The builders snapshot the stages, so a later edit is silently ignored and the stage never runs.
  • n_steps is static, so each distinct value compiles separately. Build once and reuse.
  • states.force and states.torque are inputs, not outputs, and nothing clears them, so writing them applies a persistent disturbance.
  • Mutating state does not invalidate core.mjx_synced, so contacts() can query stale geometry. Set the flag false yourself.
  • Gradients vanish at clip_floor_pos (jnp.where on floor contact) and at any saturation bound.

Splats

attach_splats performs no calibration. Both .ply files must already sit in the simulator's frames, the scene in the MuJoCo world frame at metric scale and the drone in its body frame. An uncalibrated splat looks correct alone but does not match the simulated geometry. See splats.md.

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/crazyflow-conventions-msshyweq/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/crazyflow-conventions-msshyweq' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/crazyflow-conventions-msshyweq/download' --output '.skill-downloads/crazyflow-conventions-msshyweq/SKILL.md.part' && mv '.skill-downloads/crazyflow-conventions-msshyweq/SKILL.md.part' '.skill-downloads/crazyflow-conventions-msshyweq/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/crazyflow-conventions-msshyweq/SKILL.md' && test -s '.skill-downloads/crazyflow-conventions-msshyweq/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/crazyflow' && cp -R '.skill-downloads/crazyflow-conventions-msshyweq' '.claude/skills/crazyflow'

Cursor
test -f '.skill-downloads/crazyflow-conventions-msshyweq/SKILL.md' && test -s '.skill-downloads/crazyflow-conventions-msshyweq/SKILL.md' && mkdir -p '.cursor/skills' && test ! -e '.cursor/skills/crazyflow' && cp -R '.skill-downloads/crazyflow-conventions-msshyweq' '.cursor/skills/crazyflow'

Codex
test -f '.skill-downloads/crazyflow-conventions-msshyweq/SKILL.md' && test -s '.skill-downloads/crazyflow-conventions-msshyweq/SKILL.md' && mkdir -p '.agents/skills' && test ! -e '.agents/skills/crazyflow' && cp -R '.skill-downloads/crazyflow-conventions-msshyweq' '.agents/skills/crazyflow'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/crazyflow-conventions-msshyweq'

openskills read 'crazyflow-conventions-msshyweq'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/crazyflow-conventions-msshyweq/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills