Package frc.robot.systems
Class Drivetrain
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionedu.wpi.first.math.kinematics.ChassisSpeedsGet the drivetrain chassis speeds.Get the current state of the Drivetrain subsystem.edu.wpi.first.math.kinematics.SwerveModulePosition[]Get the drivetrain swerve positions.edu.wpi.first.math.kinematics.SwerveModuleState[]Get the drivetrain swerve states.edu.wpi.first.math.kinematics.SwerveModuleState[]Get the drivetrain swerve targets.edu.wpi.first.math.geometry.Pose2dgetPose()Get the drivetrain pose.protected Drivetrain.DrivetrainStateGet the next state for the FSM based on inputs.voidreset()Reset the current FSM state.voidAligns the bot to target the hub for shooting.voidtargetPassZone(edu.wpi.first.math.geometry.Pose2d targetPose) Aligns the bot to target the passing target.voidUpdate the FSM state periodically based on inputs.Methods inherited from class frc.robot.systems.FSMSystem
setCurrentState, watchForStatesCommand
-
Constructor Details
-
Drivetrain
public Drivetrain()Constructs the drivetrain subsystem.
-
-
Method Details
-
reset
public void reset()Description copied from class:FSMSystemReset the current FSM state.- Specified by:
resetin classFSMSystem<Drivetrain.DrivetrainState>
-
update
Description copied from class:FSMSystemUpdate the FSM state periodically based on inputs.- Specified by:
updatein classFSMSystem<Drivetrain.DrivetrainState>- Parameters:
input- the input object
-
getPose
public edu.wpi.first.math.geometry.Pose2d getPose()Get the drivetrain pose.- Returns:
- the pose
-
getChassisSpeeds
public edu.wpi.first.math.kinematics.ChassisSpeeds getChassisSpeeds()Get the drivetrain chassis speeds.- Returns:
- the chassis speeds
-
getModuleStates
public edu.wpi.first.math.kinematics.SwerveModuleState[] getModuleStates()Get the drivetrain swerve states.- Returns:
- the swerve module states
-
getModuleTargets
public edu.wpi.first.math.kinematics.SwerveModuleState[] getModuleTargets()Get the drivetrain swerve targets.- Returns:
- the swerve module targets
-
getModulePositions
public edu.wpi.first.math.kinematics.SwerveModulePosition[] getModulePositions()Get the drivetrain swerve positions.- Returns:
- the swerve module positions
-
nextState
Description copied from class:FSMSystemGet the next state for the FSM based on inputs.- Specified by:
nextStatein classFSMSystem<Drivetrain.DrivetrainState>- Parameters:
input- the input object- Returns:
- the next state
-
getCurrentState
Get the current state of the Drivetrain subsystem.- Overrides:
getCurrentStatein classFSMSystem<Drivetrain.DrivetrainState>- Returns:
- current state of the drivetrain
-
targetHub
public void targetHub()Aligns the bot to target the hub for shooting. -
targetPassZone
public void targetPassZone(edu.wpi.first.math.geometry.Pose2d targetPose) Aligns the bot to target the passing target.- Parameters:
targetPose- the target passing pose
-