Skip to content

Update drone-controllers to 0.2.0#58

Merged
ratheron merged 1 commit intomainfrom
feat.controllers
May 11, 2026
Merged

Update drone-controllers to 0.2.0#58
ratheron merged 1 commit intomainfrom
feat.controllers

Conversation

@amacati
Copy link
Copy Markdown
Collaborator

@amacati amacati commented May 10, 2026

No description provided.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the project to use drone-controllers==0.2.0 and adapts Crazyflow’s Mellinger control integration, simulation pipeline calls, and tests to the updated controller APIs/parameter-loading approach.

Changes:

  • Bump drone-controllers dependency to 0.2.0 and refresh the Pixi lockfile accordingly.
  • Update Mellinger controller wiring to load controller params via drone_controllers.core.load_params and pass params as dictionaries.
  • Adjust simulation/controller call sites and tests to match the updated controller function signatures, and add a fused-model smoke test.

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/unit/test_sim.py Adds dict handling in commit-check helper and introduces a fused model smoke test.
tests/integration/test_interfaces.py Updates state2attitude invocation to the new signature in the attitude interface test.
pyproject.toml Bumps drone-controllers to 0.2.0.
pixi.lock Lockfile refresh reflecting updated dependency graph (incl. drone-controllers 0.2.0).
crazyflow/utils.py Removes named_tuple2device helper now superseded by controller param loading.
crazyflow/sim/sim.py Updates controller step functions to pass updated inputs and unpack dict params.
crazyflow/envs/drone_env.py Updates attitude action space bounds to use load_params(...) and dict keys.
crazyflow/control/mellinger.py Switches controller param storage/loading to load_params(...) with dict-based params.
Comments suppressed due to low confidence (1)

tests/integration/test_interfaces.py:54

  • These integration tests create Sim(...) instances but never call sim.close(). This can leave MuJoCo/JAX resources alive across tests and cause interference/flakiness. Consider adding sim.close() in a finally block (or using a fixture) to ensure cleanup even if assertions fail.
def test_attitude_interface(physics: Physics):
    sim = Sim(physics=physics, control=Control.attitude)
    target_pos = np.array([0.0, 0.0, 1.0])
    jit_state2attitude = jax.jit(parametrize(state2attitude, drone_model="cf2x_L250"))

    i_error = np.zeros((1, 1, 3))
    cmd = np.zeros((1, 1, 13))
    cmd[0, 0, 2] = 1.0  # Set z position target to 1.0

    for _ in range(int(2 * sim.control_freq)):  # Run simulation for 2 seconds
        pos, vel, quat = sim.data.states.pos, sim.data.states.vel, sim.data.states.quat
        rpyt, i_error = jit_state2attitude(pos, quat, vel, cmd, (i_error,), ctrl_freq=100)
        sim.attitude_control(rpyt)
        sim.step(sim.freq // sim.control_freq)

    # Check if drone maintained hover position
    dpos = sim.data.states.pos[0, 0] - target_pos
    distance = np.linalg.norm(dpos)
    assert distance < 0.05, f"Failed to maintain hover with {physics} ({dpos})"

Comment thread crazyflow/control/mellinger.py
Comment thread tests/unit/test_sim.py
@amacati amacati force-pushed the feat.controllers branch from d7cb962 to b9126d8 Compare May 10, 2026 14:42
@ratheron ratheron merged commit db8e13d into main May 11, 2026
8 checks passed
@ratheron ratheron deleted the feat.controllers branch May 11, 2026 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants