Class FeedForwardToVelocityProcessor
- java.lang.Object
-
- org.team1540.rooster.drive.pipeline.FeedForwardToVelocityProcessor
-
- All Implemented Interfaces:
Function<TankDriveData,TankDriveData>
,Processor<TankDriveData,TankDriveData>
public class FeedForwardToVelocityProcessor extends Object implements Processor<TankDriveData,TankDriveData>
Processor
that converts a feed-forward/throttle into a velocity setpoint. This processor multiplies each feed-forward by the maximum velocity of the robot. This is useful when running closed-loop teleop drive code (as joystick inputs usually provide feed-forwards).
-
-
Constructor Summary
Constructors Constructor Description FeedForwardToVelocityProcessor(double maxVelocity)
Creates a newFeedForwardToVelocityProcessor
that clears feed-forwards in the returned data.FeedForwardToVelocityProcessor(double maxVelocity, boolean clearFeedForwards)
Creates a newFeedForwardToVelocityProcessor
.FeedForwardToVelocityProcessor(DoubleSupplier maxVelSupplier, boolean clearFeedForwards)
Creates a newFeedForwardToVelocityProcessor
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TankDriveData
apply(TankDriveData data)
-
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
-
FeedForwardToVelocityProcessor
public FeedForwardToVelocityProcessor(double maxVelocity)
Creates a newFeedForwardToVelocityProcessor
that clears feed-forwards in the returned data.- Parameters:
maxVelocity
- The maximum velocity of the robot.
-
FeedForwardToVelocityProcessor
public FeedForwardToVelocityProcessor(double maxVelocity, boolean clearFeedForwards)
Creates a newFeedForwardToVelocityProcessor
.- Parameters:
maxVelocity
- The maximum velocity of the robot.clearFeedForwards
- Whether to set the feed-forwards in theTankDriveData
to emptyOptionalDoubles
. Iftrue
, the value will be cleared; iffalse
, it will be passed through as-is.
-
FeedForwardToVelocityProcessor
public FeedForwardToVelocityProcessor(DoubleSupplier maxVelSupplier, boolean clearFeedForwards)
Creates a newFeedForwardToVelocityProcessor
.- Parameters:
maxVelSupplier
- A supplier that supplies the maximum velocity of the robot.clearFeedForwards
- Whether to set the feed-forwards in theTankDriveData
to emptyOptionalDoubles
. Iftrue
, the value will be cleared; iffalse
, it will be passed through as-is.
-
-
Method Detail
-
apply
public TankDriveData apply(TankDriveData data)
- Specified by:
apply
in interfaceFunction<TankDriveData,TankDriveData>
-
-