Class Swerve
java.lang.Object
com.stuypulse.robot.util.PeriodicSubsystem
com.stuypulse.robot.subsystems.swerve.Swerve
- All Implemented Interfaces:
org.wpilib.command3.Mechanism
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final doubleprivate final org.wpilib.util.Alertprivate final com.stuypulse.robot.subsystems.swerve.GyroIOInputsAutoLoggedprivate final GyroIOprivate org.wpilib.math.kinematics.SwerveDriveKinematicsprivate org.wpilib.math.kinematics.SwerveModulePosition[]private final Module[](package private) static final double(package private) static final Lockprivate org.wpilib.math.estimator.SwerveDrivePoseEstimatorprivate org.wpilib.math.geometry.Rotation2d -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate org.wpilib.math.kinematics.ChassisVelocitiesReturns the measured chassis speeds of the robot.doubleReturns the average velocity of the modules in rotations/sec (Phoenix native units).doubleReturns the maximum angular speed in radians per sec.doubleReturns the maximum linear speed in meters per sec.private org.wpilib.math.kinematics.SwerveModulePosition[]Returns the module positions (turn angles and drive positions) for all of the modules.static org.wpilib.math.geometry.Translation2d[]Returns an array of module translations.private org.wpilib.math.kinematics.SwerveModuleVelocity[]Returns the module states (turn angles and drive velocities) for all of the modules.org.wpilib.math.geometry.Pose2dgetPose()Returns the current odometry pose.org.wpilib.math.geometry.Rotation2dReturns the current odometry rotation.double[]Returns the position of each module in radians.voidperiodic()This method is called periodically beforeScheduler.run(), and should be overriden for processing inputs.voidThis method is called periodically afterScheduler.run(), and should be overriden for applying outputs.voidresetPose(org.wpilib.math.geometry.Pose2d pose) Resets the current odometry pose.voidresetRotation(org.wpilib.math.geometry.Rotation2d rotation) voidrunCharacterization(double output) Runs the drive in a straight line with the specified drive output.voidrunVelocity(org.wpilib.math.kinematics.ChassisVelocities speeds) Runs the drive at the desired velocity.voidstop()Stops the drive.voidStops the drive and turns the modules to an X arrangement to resist movement.Methods inherited from class PeriodicSubsystem
getName, runAllPeriodicAfterScheduler, toStringMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.wpilib.command3.Mechanism
controllableDuringDisabled, getDefaultCommand, getRegisteredScheduler, getRunningCommands, idle, idleFor, run, runRepeatedly, setDefaultCommand
-
Field Details
-
ODOMETRY_FREQUENCY
-
DRIVE_BASE_RADIUS
-
odometryLock
-
gyroIO
-
gyroInputs
-
modules
-
gyroDisconnectedAlert
-
kinematics
-
rawGyroRotation
-
lastModulePositions
-
poseEstimator
-
visionConsumer
-
-
Constructor Details
-
Swerve
-
-
Method Details
-
periodic
Description copied from class:PeriodicSubsystemThis method is called periodically beforeScheduler.run(), and should be overriden for processing inputs.- Specified by:
periodicin classPeriodicSubsystem
-
periodicAfterScheduler
Description copied from class:PeriodicSubsystemThis method is called periodically afterScheduler.run(), and should be overriden for applying outputs.- Overrides:
periodicAfterSchedulerin classPeriodicSubsystem
-
runVelocity
Runs the drive at the desired velocity.- Parameters:
speeds- Speeds in meters/sec
-
runCharacterization
Runs the drive in a straight line with the specified drive output. -
stop
Stops the drive. -
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
Returns the module states (turn angles and drive velocities) for all of the modules. -
getModulePositions
Returns the module positions (turn angles and drive positions) for all of the modules. -
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
Returns the current odometry pose. -
getRotation
Returns the current odometry rotation. -
resetPose
Resets the current odometry pose. -
resetRotation
-
getMaxLinearSpeedMetersPerSec
Returns the maximum linear speed in meters per sec. -
getMaxAngularSpeedRadPerSec
Returns the maximum angular speed in radians per sec. -
getModuleTranslations
Returns an array of module translations.
-