Package com.marslib.swerve
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
ConstructorsConstructorDescriptionSwerveDrive(SwerveModule[] modules, GyroIO gyroIO, MARSPowerManager powerManager, SwerveConfig config) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddVisionMeasurement(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.CommandalignToPoint(Supplier<edu.wpi.first.math.geometry.Pose2d> target) voidedu.wpi.first.wpilibj2.command.Commandedu.wpi.first.math.kinematics.ChassisSpeedscom.marslib.swerve.GyroIOInputsAutoLoggededu.wpi.first.math.geometry.Pose2dgetPose()edu.wpi.first.math.geometry.Pose3dedu.wpi.first.math.geometry.Pose3dedu.wpi.first.wpilibj2.command.CommandGenerates an autonomous, state-machine style verification routine for this subsystem.voidperiodic()voidresetPose(edu.wpi.first.math.geometry.Pose2d pose) voidrunVelocity(edu.wpi.first.math.kinematics.ChassisSpeeds speeds) voidsetModuleStates(edu.wpi.first.math.kinematics.SwerveModuleState... states) edu.wpi.first.wpilibj2.command.CommandsysIdDynamic(edu.wpi.first.wpilibj2.command.sysid.SysIdRoutine.Direction direction) edu.wpi.first.wpilibj2.command.CommandsysIdQuasistatic(edu.wpi.first.wpilibj2.command.sysid.SysIdRoutine.Direction direction) Methods inherited from class edu.wpi.first.wpilibj2.command.SubsystemBase
addChild, getName, getSubsystem, initSendable, setName, setSubsystemMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface edu.wpi.first.wpilibj2.command.Subsystem
defer, getCurrentCommand, getDefaultCommand, idle, register, removeDefaultCommand, run, runEnd, runOnce, setDefaultCommand, simulationPeriodic, startEnd, startRun
-
Constructor Details
-
SwerveDrive
public SwerveDrive(SwerveModule[] modules, GyroIO gyroIO, MARSPowerManager powerManager, SwerveConfig config)
-
-
Method Details
-
configurePathPlanner
public void configurePathPlanner() -
periodic
public void periodic()- Specified by:
periodicin interfaceedu.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:SystemTestableGenerates an autonomous, state-machine style verification routine for this subsystem.- Specified by:
getSystemCheckCommandin interfaceSystemTestable- Returns:
- A command that runs through diagnostic checks and logs results.
-
getConfig
-