Reintegrate drone_models and drone_controllers into crazyflow#71
Merged
Conversation
7afd420 to
e53f1e5
Compare
drone_models into crazyflow & unify namingdrone_models and drone_controllers into crazyflow
ratheron
requested changes
Jun 18, 2026
ratheron
left a comment
Collaborator
There was a problem hiding this comment.
Thanks for working on this integration! This will make the entry to Crazyflow easier
Collaborator
Author
|
Latest changes are all in and ready for another review |
ratheron
approved these changes
Jun 19, 2026
ratheron
left a comment
Collaborator
There was a problem hiding this comment.
Looks like you found a clean solution for the parameterize after all. I like it!
Left some minor comments
ratheron
requested changes
Jun 19, 2026
ratheron
left a comment
Collaborator
There was a problem hiding this comment.
Looks like you found a clean solution for the parameterize after all. I like it!
Left some minor comments
345e1cb to
f22b001
Compare
c417fa0 to
9d1f4c2
Compare
9d1f4c2 to
67ec63c
Compare
ratheron
approved these changes
Jun 20, 2026
ratheron
left a comment
Collaborator
There was a problem hiding this comment.
The description of the models in the docs is wrong. Besides that, I can approve this PR now. Thanks for the work!
ratheron
approved these changes
Jun 20, 2026
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.
drone-modelsPrevious state
Drone definitions and dynamics lived in a separate
drone-modelspackage, pulled in as a PyPI dependency / git submodule (submodules/drone-models,import drone_models). The MJCF files, meshes and parameters were resolved viadrone_models.__file__, and the dynamics were imported intocrazyflow/sim/physics.py.Naming ambiguities
"Model" was overloaded three ways — the MuJoCo MJX model, the dynamics formulation, and the drone hardware. "models", "physics" and "dynamics" were often used interchangeably. These disambiguities have been fixed in the same step:
Physics/models/dynamicsDynamics/dynamicsdrone_model(param/attr)dronemodel(spec, file name)mjx_modelProposed naming scheme
cf2x_L250,cf21B_500, …).first_principles,so_rpy,so_rpy_rotor,so_rpy_rotor_drag), selected via theDynamicsenum.We avoid the use of
modelwhere possible because it is ambiguous.Package split
The vendored package is split by what the files are:
crazyflow/drones/— hardware descriptions: MJCF*.xml, meshes (assets/), and sharedparams.toml(mass, inertia, thrust/torque curves).available_dronesenumerates platforms.crazyflow/dynamics/— the dynamics themselves: one subpackage per fidelity level (each withdynamics.py+params.toml), pluscore.py(Dynamics,parametrize),symbols.py,transform.py, andutils/. Written backend-agnostic (Array API: NumPy/JAX/PyTorch) and CasADi-symbolic, so the dynamics stay usable standalone for estimation/control.available_dynamics/dynamics_featuresenumerate and introspect them.Other resulting changes
drone-modelsdependency and submodule and added package-data globs for the vendored XML/STL/TOML.crazyflow/sim/physics.py; dynamics selection now lives incrazyflow/dynamics.crazyflow/_typing.py(Array/ArrayLikeshim until array-api typing lands).physics→dynamics,drone_model→drone);docs/user-guide/physics-models.md→dynamics-models.md.Follow-up (separate PR)
to_xp(crazyflow/dynamics/utils/__init__.py) to the generalcrazyflow/utils.py. It's a generic Array-API helper, not dynamics-specific.crazyflow/dynamics/transform.py,crazyflow/dynamics/utils/rotation.py). Several are general-purpose and may belong in shared utils.drone-controllersPrevious state
Controllers lived in a separate
drone-controllerspackage, pulled in as a PyPI dependency and git submodule (submodules/drone-controllers,import drone_controllers).Package move
Vendored into
crazyflow/control/, mirroringcrazyflow/dynamics/:mellinger/subpackage (controller functions +params.toml),core.py(parametrize, param loaders),control.py(Controlenum),transform.py.Unification
Previously the controller functions, the sim data structs, and the controller-to-
SimDataadapters were split across packages. They now live together incrazyflow/control/mellinger/control.py, the same way each dynamics module co-locatesdynamics+Params+sim_dynamics.API changes
drone_modelparam renamed todrone(consistent with dynamics).load_paramssplit intoload_params(controller, drone)(raw, name-keyed loader) andload_fn_params(fn, drone)(per-function selection + signature filter).pos_err_i,r_int_error) instead of a genericctrl_errorstuple.control_<stage>and registered in the step pipeline under explicit role-based stage names (state_controller,attitude_controller,force_torque_controller,commit_attitude), so the pipeline is readable and the names are a stable insertion API.Other resulting changes
drone-controllersdependency and submodule.array-api-compatandarray-api-extraas direct dependencies (were transitive via the package).tests/unit/control/) and docs (docs/user-guide/control/).