Class Swerve

java.lang.Object
com.stuypulse.robot.util.PeriodicSubsystem
com.stuypulse.robot.subsystems.swerve.Swerve
All Implemented Interfaces:
org.wpilib.command3.Mechanism

public class Swerve extends PeriodicSubsystem
  • Field Details

  • Constructor Details

  • Method Details

    • periodic

      public void periodic()
      Description copied from class: PeriodicSubsystem
      This method is called periodically before Scheduler.run(), and should be overriden for processing inputs.
      Specified by:
      periodic in class PeriodicSubsystem
    • periodicAfterScheduler

      public void periodicAfterScheduler()
      Description copied from class: PeriodicSubsystem
      This method is called periodically after Scheduler.run(), and should be overriden for applying outputs.
      Overrides:
      periodicAfterScheduler in class PeriodicSubsystem
    • runVelocity

      public void runVelocity(org.wpilib.math.kinematics.ChassisVelocities speeds)
      Runs the drive at the desired velocity.
      Parameters:
      speeds - Speeds in meters/sec
    • runCharacterization

      public void runCharacterization(double output)
      Runs the drive in a straight line with the specified drive output.
    • stop

      public void stop()
      Stops the drive.
    • stopWithX

      public void stopWithX()
      Stops the drive and turns the modules to an X arrangement to resist movement. The modules will return to their normal orientations the next time a nonzero velocity is requested.
    • getModuleVelocities

      private org.wpilib.math.kinematics.SwerveModuleVelocity[] getModuleVelocities()
      Returns the module states (turn angles and drive velocities) for all of the modules.
    • getModulePositions

      private org.wpilib.math.kinematics.SwerveModulePosition[] getModulePositions()
      Returns the module positions (turn angles and drive positions) for all of the modules.
    • getChassisSpeeds

      private org.wpilib.math.kinematics.ChassisVelocities getChassisSpeeds()
      Returns the measured chassis speeds of the robot.
    • getWheelRadiusCharacterizationPositions

      Returns the position of each module in radians.
    • getFFCharacterizationVelocity

      Returns the average velocity of the modules in rotations/sec (Phoenix native units).
    • getPose

      public org.wpilib.math.geometry.Pose2d getPose()
      Returns the current odometry pose.
    • getRotation

      public org.wpilib.math.geometry.Rotation2d getRotation()
      Returns the current odometry rotation.
    • resetPose

      public void resetPose(org.wpilib.math.geometry.Pose2d pose)
      Resets the current odometry pose.
    • resetRotation

      public void resetRotation(org.wpilib.math.geometry.Rotation2d rotation)
    • getMaxLinearSpeedMetersPerSec

      Returns the maximum linear speed in meters per sec.
    • getMaxAngularSpeedRadPerSec

      public double getMaxAngularSpeedRadPerSec()
      Returns the maximum angular speed in radians per sec.
    • getModuleTranslations

      public static org.wpilib.math.geometry.Translation2d[] getModuleTranslations()
      Returns an array of module translations.