Skip to content

Flight Controller: sim / bevy bindings#863

Merged
gbin merged 11 commits into
masterfrom
gbin/fc_bevy
Feb 26, 2026
Merged

Flight Controller: sim / bevy bindings#863
gbin merged 11 commits into
masterfrom
gbin/fc_bevy

Conversation

@gbin

@gbin gbin commented Feb 26, 2026

Copy link
Copy Markdown
Collaborator

Summary

enables sim for the flight controller.
(empty world right now, just all the tasks compile in std mode + loop etc...)

Related issues

  • Closes #

Changes

Testing

  • just fmt
  • just lint
  • just test
  • optional full just std-ci (if std/runtime paths are impacted)
  • optional full just nostd-ci (if embedded/no_std paths are impacted)
  • Other (please specify):

pro-tip: just with no parameters in the root defaults to just fmt, just lint, and just test.

Checklist

  • I have updated docs or examples where needed
  • I have added or updated tests where needed
  • I have considered platform impact (Linux/macOS/Windows/embedded)
  • I have considered config/logging changes (if applicable)
  • This change is not a breaking change (or I documented it below)

Breaking changes (if any)

Additional context

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a host-side (std) simulation entrypoint for the flight controller, including Bevy integration and “sim-safe” task/bridge bindings so the example can run without embedded hardware resources.

Changes:

  • Introduces a Bevy-based quad-sim binary and sim_support implementations for sensors, battery ADC, LED state, and placeholder bridges.
  • Updates flight-controller tasks/config to compile and run in sim mode (including sim/firmware backend selection and run_in_sim config usage).
  • Extends the runtime/config/derive pipeline with BridgeConfig.run_in_sim and a CuSimBridge<Tx,Rx> placeholder to avoid compiling/instantiating real bridges in simulation.

Reviewed changes

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

Show a summary per file
File Description
examples/cu_flight_controller/src/tasks/mod.rs Selects firmware vs sim sensor source types via cfgs.
examples/cu_flight_controller/src/tasks/battery.rs Adds firmware/sim battery ADC backend abstraction and sim voltage support.
examples/cu_flight_controller/src/tasks/activity_led.rs Adds firmware/sim LED backend abstraction and sim LED state hook.
examples/cu_flight_controller/src/sim_support.rs Adds sim implementations for sensors, battery ADC, LED, and bridge shims.
examples/cu_flight_controller/src/sim.rs New Bevy app wiring Copper sim runtime into an update loop + smoke test.
examples/cu_flight_controller/src/logreader.rs Aligns crate aliasing for reflect/type-path expectations.
examples/cu_flight_controller/justfile Adds just sim helper target.
examples/cu_flight_controller/copperconfig.ron Enables tasks in sim and disables real bridges via run_in_sim: false.
examples/cu_flight_controller/Cargo.toml Enables quad-sim bin, sim deps/features, and sets default-run.
core/cu29_runtime/tests/sim_bridge_config.ron Adds run_in_sim: false coverage in runtime tests.
core/cu29_runtime/tests/sim_bridge.rs Ensures real bridge is not instantiated when run_in_sim: false.
core/cu29_runtime/src/simulation.rs Adds CuSimBridge placeholder + empty channel set types.
core/cu29_runtime/src/config.rs Adds BridgeConfig.run_in_sim with default-true semantics.
core/cu29_derive/src/lib.rs Generates placeholder bridge types/channel sets when run_in_sim: false; adds ignore_resources.
components/payloads/cu_sensor_payloads/src/imu.rs Adds Reflect to magnetometer-related payloads.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +5 to +11
struct BatteryAdcCalibration {
vref_mv: u32,
vbat_scale: u32,
vbat_res_div_val: u32,
vbat_res_div_mult: u32,
}

Copilot AI Feb 26, 2026

Copy link

Choose a reason for hiding this comment

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

BatteryAdcSource derives Reflect and contains calib: BatteryAdcCalibration, but BatteryAdcCalibration itself does not implement/derive Reflect. This will break builds that enable the cu29/reflect feature (where Reflect is backed by bevy_reflect and requires field types to be reflectable). Consider deriving Reflect for BatteryAdcCalibration (or marking calib with #[reflect(ignore)] if it should not be part of reflection).

Copilot uses AI. Check for mistakes.
Comment thread examples/cu_flight_controller/src/sim.rs
@gbin gbin merged commit 45a2373 into master Feb 26, 2026
23 checks passed
@gbin gbin deleted the gbin/fc_bevy branch February 26, 2026 23:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants