pub struct Runner<'a, C = MonotonicCurveLut256>{ /* private fields */ }Expand description
Executes a Program against an ERM or LRA motor configuration.
The caller supplies a free-running wrapping u32 millisecond clock to
Runner::poll and applies the returned DriveCommand. Polling may then
pause until Frame::next_transition_ms; fixed-rate polling is unnecessary.
Implementations§
Source§impl<'a, C> Runner<'a, C>
impl<'a, C> Runner<'a, C>
Sourcepub fn start_and_poll(&mut self, now_ms: u32) -> Frame
pub fn start_and_poll(&mut self, now_ms: u32) -> Frame
Start playback at now_ms and return the first frame.
Sourcepub fn poll_or_start(&mut self, now_ms: u32) -> Frame
pub fn poll_or_start(&mut self, now_ms: u32) -> Frame
Poll current output; if not running, start playback at now_ms first.
Sourcepub const fn is_running(&self) -> bool
pub const fn is_running(&self) -> bool
Whether the program is currently running.
Sourcepub const fn motor(&self) -> MotorConfig
pub const fn motor(&self) -> MotorConfig
Motor configuration assigned to this runner.
Sourcepub fn poll(&mut self, now_ms: u32) -> Frame
pub fn poll(&mut self, now_ms: u32) -> Frame
Evaluate output for the wrapping millisecond clock value now_ms.
The returned frame’s deadline is the earliest time the command may
change. Callers should wait with wrapping arithmetic and poll again at
that deadline. If the deadline equals now_ms, poll again immediately to
drain the control-flow transition. Completion is edge-triggered; see
Frame::finished.