Class DualPIDTankDriveTrain
- java.lang.Object
-
- edu.wpi.first.wpilibj2.command.SubsystemBase
-
- io.github.frc5024.lib5k.bases.drivetrain.AbstractDriveTrain
-
- io.github.frc5024.lib5k.bases.drivetrain.implementations.TankDriveTrain
-
- io.github.frc5024.lib5k.bases.drivetrain.implementations.DualPIDTankDriveTrain
-
- All Implemented Interfaces:
Sendable
,Subsystem
,IDifferentialDrivebase
,SafeSystem
,java.lang.AutoCloseable
public abstract class DualPIDTankDriveTrain extends TankDriveTrain
DualPIDTankDriveTrain is a TankDriveTrain implementation that uses two PID controllers to control autonomous robot movement
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class io.github.frc5024.lib5k.bases.drivetrain.AbstractDriveTrain
AbstractDriveTrain.State
-
-
Field Summary
-
Fields inherited from class io.github.frc5024.lib5k.bases.drivetrain.implementations.TankDriveTrain
maxSpeedPercent
-
Fields inherited from class io.github.frc5024.lib5k.bases.drivetrain.AbstractDriveTrain
logger, stateMachine
-
-
Constructor Summary
Constructors Constructor Description DualPIDTankDriveTrain(Controller rotationController)
Create a new DualPIDTankDriveTrainDualPIDTankDriveTrain(Controller rotationController, double Kr)
Create a new DualPIDTankDriveTrain
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
handleAutonomousRotation(StateMetadata<AbstractDriveTrain.State> meta, Rotation2d goalHeading, Rotation2d epsilon)
State handler for autonomous rotation controlprotected void
handleDrivingToPose(StateMetadata<AbstractDriveTrain.State> meta, Translation2d goalPose, Translation2d epsilon)
State handler for driving to a new pose autonomouslyvoid
reset()
Reset everything-
Methods inherited from class io.github.frc5024.lib5k.bases.drivetrain.implementations.TankDriveTrain
calculateThrottleCorrectionFactor, enableConstantCurvature, getFrontSide, getPose, getVelocity, handleDriverInputs, handleOpenLoopControl, handleVoltage, periodic, resetEncoders, resetPose, setEncodersInverted, setFrontSide, setMaxSpeedPercent, setMotorsInverted, setOpenLoop, setOpenLoop, stop
-
Methods inherited from class io.github.frc5024.lib5k.bases.drivetrain.AbstractDriveTrain
close, createPathingCommand, createTurnCommand, enableBrakes, getCurrentHeading, getCurrentState, getSpeed, handleGearShift, isAtGoal, runIteration, setGoalHeading, setGoalPose, setGoalPose, setRampRate
-
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 io.github.frc5024.lib5k.hardware.common.drivebase.IDifferentialDrivebase
getLeftMeters, getRightMeters, getWidthMeters
-
Methods inherited from interface edu.wpi.first.wpilibj2.command.Subsystem
getCurrentCommand, getDefaultCommand, register, setDefaultCommand, simulationPeriodic
-
-
-
-
Constructor Detail
-
DualPIDTankDriveTrain
public DualPIDTankDriveTrain(Controller rotationController)
Create a new DualPIDTankDriveTrain- Parameters:
rotationController
- Controller for rotation control
-
DualPIDTankDriveTrain
public DualPIDTankDriveTrain(Controller rotationController, double Kr)
Create a new DualPIDTankDriveTrain- Parameters:
rotationController
- Controller for rotation controlKr
- Rotational P gain for path following
-
-
Method Detail
-
handleAutonomousRotation
protected void handleAutonomousRotation(StateMetadata<AbstractDriveTrain.State> meta, Rotation2d goalHeading, Rotation2d epsilon)
Description copied from class:AbstractDriveTrain
State handler for autonomous rotation control- Specified by:
handleAutonomousRotation
in classAbstractDriveTrain
- Parameters:
meta
- State metadatagoalHeading
- Goal headingepsilon
- Rotation epsilon
-
handleDrivingToPose
protected void handleDrivingToPose(StateMetadata<AbstractDriveTrain.State> meta, Translation2d goalPose, Translation2d epsilon)
Description copied from class:AbstractDriveTrain
State handler for driving to a new pose autonomously- Specified by:
handleDrivingToPose
in classAbstractDriveTrain
- Parameters:
meta
- State metadatagoalPose
- Goal poseepsilon
- Epsilon around the goal pose in meters
-
reset
public void reset()
Description copied from interface:SafeSystem
Reset everything- Specified by:
reset
in interfaceSafeSystem
- Overrides:
reset
in classTankDriveTrain
-
-