Package edu.wpi.first.math.controller
Class DifferentialDriveAccelerationLimiter
java.lang.Object
edu.wpi.first.math.controller.DifferentialDriveAccelerationLimiter
public class DifferentialDriveAccelerationLimiter extends Object
Filters the provided voltages to limit a differential drive's linear and angular acceleration.
The differential drive model can be created via the functions in LinearSystemId
.
-
Constructor Summary
Constructors Constructor Description DifferentialDriveAccelerationLimiter(LinearSystem<N2,N2,N2> system, double trackwidth, double maxLinearAccel, double maxAngularAccel)
Constructs a DifferentialDriveAccelerationLimiter.DifferentialDriveAccelerationLimiter(LinearSystem<N2,N2,N2> system, double trackwidth, double minLinearAccel, double maxLinearAccel, double maxAngularAccel)
Constructs a DifferentialDriveAccelerationLimiter. -
Method Summary
Modifier and Type Method Description DifferentialDriveWheelVoltages
calculate(double leftVelocity, double rightVelocity, double leftVoltage, double rightVoltage)
Returns the next voltage pair subject to acceleration constraints.
-
Constructor Details
-
DifferentialDriveAccelerationLimiter
public DifferentialDriveAccelerationLimiter(LinearSystem<N2,N2,N2> system, double trackwidth, double maxLinearAccel, double maxAngularAccel)Constructs a DifferentialDriveAccelerationLimiter.- Parameters:
system
- The differential drive dynamics.trackwidth
- The distance between the differential drive's left and right wheels in meters.maxLinearAccel
- The maximum linear acceleration in meters per second squared.maxAngularAccel
- The maximum angular acceleration in radians per second squared.
-
DifferentialDriveAccelerationLimiter
public DifferentialDriveAccelerationLimiter(LinearSystem<N2,N2,N2> system, double trackwidth, double minLinearAccel, double maxLinearAccel, double maxAngularAccel)Constructs a DifferentialDriveAccelerationLimiter.- Parameters:
system
- The differential drive dynamics.trackwidth
- The distance between the differential drive's left and right wheels in meters.minLinearAccel
- The minimum (most negative) linear acceleration in meters per second squared.maxLinearAccel
- The maximum (most positive) linear acceleration in meters per second squared.maxAngularAccel
- The maximum angular acceleration in radians per second squared.- Throws:
IllegalArgumentException
- if minimum linear acceleration is greater than maximum linear acceleration
-
-
Method Details
-
calculate
public DifferentialDriveWheelVoltages calculate(double leftVelocity, double rightVelocity, double leftVoltage, double rightVoltage)Returns the next voltage pair subject to acceleration constraints.- Parameters:
leftVelocity
- The left wheel velocity in meters per second.rightVelocity
- The right wheel velocity in meters per second.leftVoltage
- The unconstrained left motor voltage.rightVoltage
- The unconstrained right motor voltage.- Returns:
- The constrained wheel voltages.
-