pub struct DiffDrive { /* private fields */ }Expand description
Converts between a robot’s motion and its two wheel speeds (differential drive).
A differential-drive robot steers by spinning its left and right wheels at different
speeds. This converts both ways: wheel_speeds turns a desired
forward speed and turn rate into the wheel speeds to command (inverse kinematics), and
body_motion turns measured wheel speeds back into the robot’s
forward speed and turn rate (forward kinematics). The one parameter is the track: the
distance between the wheels.
§Examples
use pamoja_kit::DiffDrive;
let drive = DiffDrive::new(0.5); // wheels 0.5 apart
// Drive straight: both wheels turn at the forward speed.
assert_eq!(drive.wheel_speeds(1.0, 0.0), (1.0, 1.0));
// Spin in place: the wheels turn opposite, each at turn rate times half the track.
assert_eq!(drive.wheel_speeds(0.0, 2.0), (-0.5, 0.5));Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DiffDrive
impl RefUnwindSafe for DiffDrive
impl Send for DiffDrive
impl Sync for DiffDrive
impl Unpin for DiffDrive
impl UnsafeUnpin for DiffDrive
impl UnwindSafe for DiffDrive
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