Class SwerveDrive

java.lang.Object
edu.wpi.first.wpilibj2.command.SubsystemBase
com.marslib.swerve.SwerveDrive
All Implemented Interfaces:
SystemTestable, edu.wpi.first.util.sendable.Sendable, edu.wpi.first.wpilibj2.command.Subsystem

public class SwerveDrive extends edu.wpi.first.wpilibj2.command.SubsystemBase implements SystemTestable
The core MARSLib SwerveDrive subsystem responsible for managing holonomic kinematics, dynamic PathPlanner autonomous trajectories, and active power shedding.
  • Constructor Summary

    Constructors
    Constructor
    Description
    SwerveDrive(SwerveModule[] modules, GyroIO gyroIO, MARSPowerManager powerManager, SwerveConfig config)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addVisionMeasurement(edu.wpi.first.math.geometry.Pose2d visionRobotPoseMeters, double timestampSeconds, edu.wpi.first.math.Matrix<edu.wpi.first.math.numbers.N3,edu.wpi.first.math.numbers.N1> visionMeasurementStdDevs)
     
    edu.wpi.first.wpilibj2.command.Command
    alignToPoint(Supplier<edu.wpi.first.math.geometry.Pose2d> target)
     
    void
     
    edu.wpi.first.wpilibj2.command.Command
     
    edu.wpi.first.math.kinematics.ChassisSpeeds
     
     
    com.marslib.swerve.GyroIOInputsAutoLogged
     
    edu.wpi.first.math.geometry.Pose2d
     
    edu.wpi.first.math.geometry.Pose3d
     
    edu.wpi.first.math.geometry.Pose3d
     
    edu.wpi.first.wpilibj2.command.Command
    Generates an autonomous, state-machine style verification routine for this subsystem.
    void
     
    void
    resetPose(edu.wpi.first.math.geometry.Pose2d pose)
     
    void
    runVelocity(edu.wpi.first.math.kinematics.ChassisSpeeds speeds)
     
    void
    setModuleStates(edu.wpi.first.math.kinematics.SwerveModuleState... states)
     
    edu.wpi.first.wpilibj2.command.Command
    sysIdDynamic(edu.wpi.first.wpilibj2.command.sysid.SysIdRoutine.Direction direction)
     
    edu.wpi.first.wpilibj2.command.Command
    sysIdQuasistatic(edu.wpi.first.wpilibj2.command.sysid.SysIdRoutine.Direction direction)
     

    Methods inherited from class edu.wpi.first.wpilibj2.command.SubsystemBase

    addChild, getName, getSubsystem, initSendable, setName, setSubsystem

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface edu.wpi.first.wpilibj2.command.Subsystem

    defer, getCurrentCommand, getDefaultCommand, idle, register, removeDefaultCommand, run, runEnd, runOnce, setDefaultCommand, simulationPeriodic, startEnd, startRun
  • Constructor Details

  • Method Details

    • configurePathPlanner

      public void configurePathPlanner()
    • periodic

      public void periodic()
      Specified by:
      periodic in interface edu.wpi.first.wpilibj2.command.Subsystem
    • runVelocity

      public void runVelocity(edu.wpi.first.math.kinematics.ChassisSpeeds speeds)
    • setModuleStates

      public void setModuleStates(edu.wpi.first.math.kinematics.SwerveModuleState... states)
    • getPose

      public edu.wpi.first.math.geometry.Pose2d getPose()
    • getPose3d

      public edu.wpi.first.math.geometry.Pose3d getPose3d()
    • getSimPose3d

      public edu.wpi.first.math.geometry.Pose3d getSimPose3d()
    • resetPose

      public void resetPose(edu.wpi.first.math.geometry.Pose2d pose)
    • getChassisSpeeds

      public edu.wpi.first.math.kinematics.ChassisSpeeds getChassisSpeeds()
    • addVisionMeasurement

      public void addVisionMeasurement(edu.wpi.first.math.geometry.Pose2d visionRobotPoseMeters, double timestampSeconds, edu.wpi.first.math.Matrix<edu.wpi.first.math.numbers.N3,edu.wpi.first.math.numbers.N1> visionMeasurementStdDevs)
    • getGyroInputs

      public com.marslib.swerve.GyroIOInputsAutoLogged getGyroInputs()
    • sysIdQuasistatic

      public edu.wpi.first.wpilibj2.command.Command sysIdQuasistatic(edu.wpi.first.wpilibj2.command.sysid.SysIdRoutine.Direction direction)
    • sysIdDynamic

      public edu.wpi.first.wpilibj2.command.Command sysIdDynamic(edu.wpi.first.wpilibj2.command.sysid.SysIdRoutine.Direction direction)
    • alignToPoint

      public edu.wpi.first.wpilibj2.command.Command alignToPoint(Supplier<edu.wpi.first.math.geometry.Pose2d> target)
    • finalClimbLineupCommand

      public edu.wpi.first.wpilibj2.command.Command finalClimbLineupCommand()
    • getSystemCheckCommand

      public edu.wpi.first.wpilibj2.command.Command getSystemCheckCommand()
      Description copied from interface: SystemTestable
      Generates an autonomous, state-machine style verification routine for this subsystem.
      Specified by:
      getSystemCheckCommand in interface SystemTestable
      Returns:
      A command that runs through diagnostic checks and logs results.
    • getConfig

      public SwerveConfig getConfig()