Class FeedForwardProcessor
- java.lang.Object
-
- org.team1540.rooster.drive.pipeline.FeedForwardProcessor
-
- All Implemented Interfaces:
Function<TankDriveData,TankDriveData>
,Processor<TankDriveData,TankDriveData>
public class FeedForwardProcessor extends Object implements Processor<TankDriveData,TankDriveData>
Processor
to apply an Oblarg-style feed-forward. This processor allows for velocity, acceleration, and static friction (vIntercept) feed-forwards. For further details, seeapply()
. The output will mirror the input with the exception of a change in the feed-forward value.
-
-
Constructor Summary
Constructors Constructor Description FeedForwardProcessor(double velocityFeedFwd, double throtBump, double accelFeedFwd)
Creates aFeedForwardProcessor
with the provided \(k_v\) and \(v_{Intercept}\)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull TankDriveData
apply(@NotNull TankDriveData command)
Applies feed-forwards to the providedTankDriveData
.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.team1540.rooster.functional.Processor
followedBy, process
-
-
-
-
Constructor Detail
-
FeedForwardProcessor
public FeedForwardProcessor(double velocityFeedFwd, double throtBump, double accelFeedFwd)
Creates aFeedForwardProcessor
with the provided \(k_v\) and \(v_{Intercept}\)- Parameters:
velocityFeedFwd
- The velocity constant feed-forward \(k_v\), in output units per speed unit.throtBump
- The velocity intercept \(V_{intercept}\), in output units.accelFeedFwd
- The acceleration constant feed-forward \(k_a\), in output units per acceleration unit.
-
-
Method Detail
-
apply
@NotNull public @NotNull TankDriveData apply(@NotNull @NotNull TankDriveData command)
Applies feed-forwards to the providedTankDriveData
. The method for calculating the feed-forward is as follows:- The feed-forward starts at 0.
- The product of the velocity (if present) and the velocity feed-forward is added.
- The product of the acceleration (if present) and the acceleration feed-forward is added.
- If the velocity is present and nonzero, the throttle bump (with the sign of the velocity) is added.
- Specified by:
apply
in interfaceFunction<TankDriveData,TankDriveData>
- Parameters:
command
- The data to use.- Returns:
- A new
TankDriveData
as described above.
-
-