Class DriveTurnInputProcessor

java.lang.Object
com.stuypulse.robot.util.swerve.swerveinput.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 Command.execute() method of the command.

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

  • Field Details

    • controller

      private final edu.wpi.first.wpilibj2.command.button.CommandXboxController controller
    • deadband

      private final double deadband
    • power

      private final double power
    • maxAngularVelocity

      private final double maxAngularVelocity
      The max angular velocity in radians per second
    • lowPassFilter

      private final edu.wpi.first.math.filter.LinearFilter lowPassFilter
    • processedAngularVelocity

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

    • DriveTurnInputProcessor

      public DriveTurnInputProcessor(edu.wpi.first.wpilibj2.command.button.CommandXboxController controller, double deadband, double power, double 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