pub struct AxisProcessor<F>{
pub pid: PidController,
pub filter: F,
}Expand description
A generic controller for a single physical axis.
The AxisProcessor is generic over any Filter that accepts InertialInput
and produces Radians. This allows the same control logic to be used with
Complementary filters, Kalman filters, or simple low-pass filters.
Fields§
§pid: PidControllerThe PID algorithm responsible for generating the corrective signal.
filter: FThe sensor fusion filter responsible for estimating the current orientation.
Implementations§
Source§impl<F> AxisProcessor<F>
impl<F> AxisProcessor<F>
Sourcepub fn new(filter: F, pid: PidController) -> Self
pub fn new(filter: F, pid: PidController) -> Self
Creates a new AxisProcessor with the provided estimation and control components.
Sourcepub fn process(
&mut self,
input: InertialInput,
target_angle: Radians,
dt: f32,
) -> f32
pub fn process( &mut self, input: InertialInput, target_angle: Radians, dt: f32, ) -> f32
Executes one iteration of the control loop for this axis.
This method performs two primary steps:
- State Estimation: Updates the internal filter with new IMU data.
- Control Generation: Computes the PID output based on the error
between the
target_angleand the estimatedcurrent_angle.
§Parameters
input- Raw rate and reference data from sensors.target_angle- The desired orientation for this axis.dt- Time delta since the last update in seconds.
§Returns
A normalized control signal (f32), typically in the range [-1.0, 1.0].
Auto Trait Implementations§
impl<F> Freeze for AxisProcessor<F>where
F: Freeze,
impl<F> RefUnwindSafe for AxisProcessor<F>where
F: RefUnwindSafe,
impl<F> Send for AxisProcessor<F>where
F: Send,
impl<F> Sync for AxisProcessor<F>where
F: Sync,
impl<F> Unpin for AxisProcessor<F>where
F: Unpin,
impl<F> UnsafeUnpin for AxisProcessor<F>where
F: UnsafeUnpin,
impl<F> UnwindSafe for AxisProcessor<F>where
F: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more