pub struct Esc { /* private fields */ }Expand description
Maps a normalized throttle to an electronic speed controller’s RC pulse width.
An ESC reads the same RC pulse a servo does, with the pulse width setting motor output.
Esc::bidirectional uses the common reversible scheme: 1000 microseconds full reverse, 1500
neutral, 2000 full forward, so a throttle in [-1, 1] maps linearly across it.
§Examples
use pamoja_kit::Esc;
let esc = Esc::bidirectional();
assert_eq!(esc.pulse(0.0), 1500); // neutral
assert_eq!(esc.pulse(1.0), 2000); // full forward
assert_eq!(esc.pulse(-1.0), 1000); // full reverse
assert_eq!(esc.pulse(0.5), 1750);Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Esc
impl RefUnwindSafe for Esc
impl Send for Esc
impl Sync for Esc
impl Unpin for Esc
impl UnsafeUnpin for Esc
impl UnwindSafe for Esc
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