Class DifferentialDriveFeedforward

java.lang.Object
edu.wpi.first.math.controller.DifferentialDriveFeedforward

public class DifferentialDriveFeedforward
extends Object
A helper class which computes the feedforward outputs for a differential drive drivetrain.
  • Constructor Summary

    Constructors 
    Constructor Description
    DifferentialDriveFeedforward​(double kVLinear, double kALinear, double kVAngular, double kAAngular)
    Creates a new DifferentialDriveFeedforward with the specified parameters.
    DifferentialDriveFeedforward​(double kVLinear, double kALinear, double kVAngular, double kAAngular, double trackwidth)
    Creates a new DifferentialDriveFeedforward with the specified parameters.
  • Method Summary

    Modifier and Type Method Description
    DifferentialDriveWheelVoltages calculate​(double currentLeftVelocity, double nextLeftVelocity, double currentRightVelocity, double nextRightVelocity, double dtSeconds)
    Calculates the differential drive feedforward inputs given velocity setpoints.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DifferentialDriveFeedforward

      public DifferentialDriveFeedforward​(double kVLinear, double kALinear, double kVAngular, double kAAngular, double trackwidth)
      Creates a new DifferentialDriveFeedforward with the specified parameters.
      Parameters:
      kVLinear - The linear velocity gain in volts per (meters per second).
      kALinear - The linear acceleration gain in volts per (meters per second squared).
      kVAngular - The angular velocity gain in volts per (radians per second).
      kAAngular - The angular acceleration gain in volts per (radians per second squared).
      trackwidth - The distance between the differential drive's left and right wheels, in meters.
    • DifferentialDriveFeedforward

      public DifferentialDriveFeedforward​(double kVLinear, double kALinear, double kVAngular, double kAAngular)
      Creates a new DifferentialDriveFeedforward with the specified parameters.
      Parameters:
      kVLinear - The linear velocity gain in volts per (meters per second).
      kALinear - The linear acceleration gain in volts per (meters per second squared).
      kVAngular - The angular velocity gain in volts per (meters per second).
      kAAngular - The angular acceleration gain in volts per (meters per second squared).
  • Method Details

    • calculate

      public DifferentialDriveWheelVoltages calculate​(double currentLeftVelocity, double nextLeftVelocity, double currentRightVelocity, double nextRightVelocity, double dtSeconds)
      Calculates the differential drive feedforward inputs given velocity setpoints.
      Parameters:
      currentLeftVelocity - The current left velocity of the differential drive in meters/second.
      nextLeftVelocity - The next left velocity of the differential drive in meters/second.
      currentRightVelocity - The current right velocity of the differential drive in meters/second.
      nextRightVelocity - The next right velocity of the differential drive in meters/second.
      dtSeconds - Discretization timestep.
      Returns:
      A DifferentialDriveWheelVoltages object containing the computed feedforward voltages.