pub trait StateSource {
// Required method
fn state(&mut self, dt: Duration) -> VehicleState;
}Expand description
Where the flight loop’s vehicle state comes from.
The name describes the role, not how the state is obtained. Implementors include:
- Simulator backends that report the simulator’s true state (e.g.
RealFlightVehicle); - Test doubles that report a fixed state (
testing::NullVehicle); - Estimators that fuse sensor readings into an estimate (IMU, baro, mag, GNSS).
Every implementor reports in the VehicleState frame contract.
Required Methods§
Sourcefn state(&mut self, dt: Duration) -> VehicleState
fn state(&mut self, dt: Duration) -> VehicleState
Returns the current vehicle state.
Takes &mut self because sources typically advance internal state on each call
(a filter’s predict/update, a simulator exchange’s bookkeeping).
§Parameters
dt: Time elapsed since the previous call. The first call, made once before the control loop starts, passesDuration::ZERO; implementations may use it to initialize (seeRealFlightVehicle).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".