Class DriveTurnInputProcessor

java.lang.Object
com.stuypulse.robot.util.swerve.DriveTurnInputProcessor

public class DriveTurnInputProcessor extends Object

DriveTurnInputProcessor

Class for processing driver turn input for the drivetrain. It's intended to replace StuyLib's IStream and Filters and use pure WPILib and Java.

This will be used to be as close as the original StuyLib implementation as possible It will be used for

  • Applying deadbands
  • Applying power curves
  • Applying max angular velocity
  • Applying a low pass filter

To use within a command, create an instance of this class and call the update() method in the start of the Command.

To get the processed speed, call the get() method.

  • Field Details

    • controller

      private final org.wpilib.command3.button.CommandGamepad controller
    • deadband

      private final double deadband
    • power

      private final double power
    • maxAngularVelocity

      private final org.wpilib.units.measure.AngularVelocity maxAngularVelocity
      The max angular velocity in radians per second
    • lowPassFilter

      private final org.wpilib.math.filter.LinearFilter lowPassFilter
    • processedAngularVelocity

      private double processedAngularVelocity
      The processed angular velocity after the full processing and filtering.
  • Constructor Details

    • DriveTurnInputProcessor

      public DriveTurnInputProcessor(org.wpilib.command3.button.CommandGamepad controller, double deadband, double power, org.wpilib.units.measure.AngularVelocity maxAngularVelocity, double rc)

      Constructor for the DriveInputProcessor

      Creates a new DriveInputProcessor with the specified parameters processes the input periodically.

      Parameters:
      controller - The CommandXboxController to get driver input from
      deadband - The deadband to apply to the input (0-1)
      power - The power to apply to the input
      maxAngularVelocity - The maximum angular velocity to scale the input to (radians/s)
      rc - The time constant for the low pass filter (seconds)
  • Method Details