Skip to main content

SkidSteer

Struct SkidSteer 

Source
pub struct SkidSteer { /* private fields */ }
Expand description

Skid-steer (tracked or four-wheel) drive: turning by spinning each side at a different speed.

A skid-steer robot steers like a differential one, but its wheels or tracks must slip sideways to turn, so the geometric track under-predicts the turn. The standard correction is an effective track wider than the real one by a slip factor (at least one), found by calibration: commanding a yaw rate needs a larger left-right speed difference than the bare geometry suggests. With slip of one this reduces to plain differential drive.

§Examples

use pamoja_kit::SkidSteer;

// Wheels 0.5 m apart that slip enough to need a 1.2x wider effective track.
let drive = SkidSteer::new(0.5, 1.2);
// Spin in place at 2 rad/s: each side runs at omega * effective_track / 2.
let (left, right) = drive.wheel_speeds(0.0, 2.0);
assert!((left + 0.6).abs() < 1e-6 && (right - 0.6).abs() < 1e-6);
// Reading the wheels back recovers the body motion.
let (linear, angular) = drive.body_motion(left, right);
assert!(linear.abs() < 1e-6 && (angular - 2.0).abs() < 1e-6);

Implementations§

Source§

impl SkidSteer

Source

pub fn new(track: f32, slip: f32) -> Self

Creates a model for wheels track apart with a given slip factor.

§Arguments
  • track - the distance between the left and right wheels or tracks; its magnitude is used.
  • slip - how much wider the effective track is than the geometric one; its magnitude is used, and a value of zero is treated as one (no slip).
§Returns

The kinematics model.

Source

pub fn wheel_speeds(&self, linear: f32, angular: f32) -> (f32, f32)

Returns the (left, right) wheel speeds for a desired body motion.

§Arguments
  • linear - the forward speed.
  • angular - the yaw rate, positive turning left.
§Returns

(left, right), where the split uses the effective (slip-corrected) track.

Source

pub fn body_motion(&self, left: f32, right: f32) -> (f32, f32)

Returns the body (linear, angular) motion for measured wheel speeds.

§Arguments
  • left - the left wheel speed.
  • right - the right wheel speed.
§Returns

(linear, angular), where angular divides by the effective track and is zero when that track is zero.

Trait Implementations§

Source§

impl Clone for SkidSteer

Source§

fn clone(&self) -> SkidSteer

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for SkidSteer

Source§

impl Debug for SkidSteer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.