pub struct Ackermann { /* private fields */ }Expand description
Car-like (Ackermann) steering: one steered axle and a driven axle a wheelbase apart.
A car cannot turn in place; it follows an arc whose radius is set by the steering angle. The
kinematic bicycle model collapses each axle to a single central wheel, so the steering angle
delta, the wheelbase L, the forward speed v, and the yaw rate omega are related by
tan(delta) = L * omega / v, equivalently a turn radius R = L / tan(delta). This is the
standard model behind a rover, a tractor, or any rack-and-pinion vehicle.
§Examples
use pamoja_kit::Ackermann;
// A rover with a 2.5 m wheelbase, steering 30 degrees (about 0.5236 rad).
let car = Ackermann::new(2.5);
let radius = car.turn_radius(0.5236);
assert!((radius - 4.33).abs() < 0.01); // R = 2.5 / tan(30 deg)
// At 5 m/s that steering yields a yaw rate of about 1.155 rad/s.
let omega = car.yaw_rate(5.0, 0.5236);
assert!((omega - 1.1547).abs() < 1e-3);
// And asking for that yaw rate at that speed recovers the steering angle.
assert!((car.steering_angle(5.0, omega) - 0.5236).abs() < 1e-3);Implementations§
Source§impl Ackermann
impl Ackermann
Sourcepub fn steering_angle(&self, linear: f32, angular: f32) -> f32
pub fn steering_angle(&self, linear: f32, angular: f32) -> f32
Returns the steering angle for a desired forward speed and yaw rate.
§Arguments
linear- the forward speed.angular- the desired yaw rate, positive turning left.
§Returns
The steering angle in radians, atan(wheelbase * angular / linear). Returns zero when
the vehicle is stopped (linear is zero), since a stationary car cannot yaw by steering.
Sourcepub fn turn_radius(&self, steering: f32) -> f32
pub fn turn_radius(&self, steering: f32) -> f32
Returns the turn radius for a steering angle.
§Arguments
steering- the steering angle in radians.
§Returns
The radius wheelbase / tan(steering) in metres, or f32::INFINITY when the wheels
point straight ahead (steering is zero), since the path is then a straight line.