pub struct PiServo { /* private fields */ }Expand description
PI (Proportional-Integral) servo for clock discipline.
Processes offset samples and produces clock adjustment actions. The servo
transitions through ServoState::Init -> ServoState::FrequencyLock ->
ServoState::PhaseLock as it gathers enough samples to converge.
Implementations§
Source§impl PiServo
impl PiServo
Sourcepub fn new(config: ServoConfig) -> Self
pub fn new(config: ServoConfig) -> Self
Create a new PI servo with the given configuration.
Sourcepub fn with_defaults() -> Self
pub fn with_defaults() -> Self
Create a new PI servo with default configuration.
Sourcepub fn state(&self) -> ServoState
pub fn state(&self) -> ServoState
Current servo state.
Sourcepub fn sample_count(&self) -> u32
pub fn sample_count(&self) -> u32
Number of samples processed so far.
Sourcepub fn sample(&mut self, offset_ns: f64, poll_interval_secs: f64) -> ServoAction
pub fn sample(&mut self, offset_ns: f64, poll_interval_secs: f64) -> ServoAction
Process a new offset measurement and return the action to take.
§Arguments
offset_ns: measured clock offset in nanoseconds (positive means local clock is ahead).poll_interval_secs: current polling interval in seconds (tau). This controls the PI gain scaling.
Auto Trait Implementations§
impl Freeze for PiServo
impl RefUnwindSafe for PiServo
impl Send for PiServo
impl Sync for PiServo
impl Unpin for PiServo
impl UnsafeUnpin for PiServo
impl UnwindSafe for PiServo
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