pub struct FeedForward { /* private fields */ }Expand description
Feedforward controller for linear motion.
Computes motor voltage based on desired velocity and acceleration using:
voltage = ks * sign(v) + kv * v + ka * a§Gains
ks: Static friction compensation. The minimum voltage needed to start moving from rest. Applied in the direction of motion.kv: Velocity feedforward. Voltage required per unit velocity to maintain constant speed against friction and back-EMF.ka: Acceleration feedforward. Voltage required per unit acceleration to overcome inertia.
§Example
let ff = FeedForward::new()
.set_gains(0.1, 0.5, 0.01);
let voltage = ff.calculate(target_velocity, target_acceleration);Implementations§
Source§impl FeedForward
impl FeedForward
Sourcepub const fn new() -> FeedForward
pub const fn new() -> FeedForward
Creates a new feedforward controller with zero gains.
Use set_gains or individual setters to configure.
Sourcepub fn calculate(&self, velocity: f64, acceleration: f64) -> f64
pub fn calculate(&self, velocity: f64, acceleration: f64) -> f64
Calculates the feedforward voltage for the given velocity and acceleration.
§Arguments
velocity- Desired velocity (units depend on your system)acceleration- Desired acceleration (units depend on your system)
§Returns
The feedforward voltage output.
§Formula
voltage = ks * sign(velocity) + kv * velocity + ka * accelerationAuto Trait Implementations§
impl Freeze for FeedForward
impl RefUnwindSafe for FeedForward
impl Send for FeedForward
impl Sync for FeedForward
impl Unpin for FeedForward
impl UnsafeUnpin for FeedForward
impl UnwindSafe for FeedForward
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
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.