Class TalonSRXBrushedTankDrive
- java.lang.Object
-
- edu.wpi.first.wpilibj2.command.SubsystemBase
-
- com.alumiboti5590.eop.subsystems.drivetrain.tank.TankDrive
-
- com.alumiboti5590.eop.subsystems.drivetrain.tank.TalonSRXBrushedTankDrive
-
- All Implemented Interfaces:
edu.wpi.first.util.sendable.Sendable
,edu.wpi.first.wpilibj2.command.Subsystem
public class TalonSRXBrushedTankDrive extends TankDrive
A TankDrive implementation using Talon SRX motor controllers to control brushed motors. Do not use this under any circumstances with brushless motors; this is designed for CIM, 775, Redline and other brushed motors only.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.alumiboti5590.eop.subsystems.drivetrain.tank.TankDrive
TankDrive.TeleopDriveType
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_CURRENT_LIMIT
Limit the motors to the following AMPS to prevent brownouts, trips, or too much power being drawn when it really isn't needed.static double
DEFAULT_RAMP_RATE
The default ramp rate, meaning the motors will take this long (in seconds) to accelerate to full speed to prevent damage to the motor or subsystems.-
Fields inherited from class com.alumiboti5590.eop.subsystems.drivetrain.tank.TankDrive
DEFAULT_TELEOP_DRIVE_TYPE
-
-
Constructor Summary
Constructors Constructor Description TalonSRXBrushedTankDrive(CANMotorConfig leftLeaderConfig, CANMotorConfig rightLeaderConfig, CANMotorConfig leftFollowerConfig, CANMotorConfig rightFollowerConfig, edu.wpi.first.wpilibj.Encoder leftEncoder, edu.wpi.first.wpilibj.Encoder rightEncoder)
Creates a new drivetrain from the provided motor and optionally provided encoders
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
resetOdometry()
Reset the encoders and gyroscope readings.void
setAccelerationRampRate(double maxAccRate)
Sets the ramp rate for open loop control modes.void
setCurrentLimit(int currentInAmps)
Sets the current limit in Amps.void
setSidePIDGains(PIDGains gains)
Set the PID controller gains for both sides of the tank drive.-
Methods inherited from class com.alumiboti5590.eop.subsystems.drivetrain.tank.TankDrive
configureDifferentialDrive, curvatureDrive, getTeleopDriveTypeSendableChooser, setCurvatureQuickTurnSupplier, setCurvatureSpeedSupplier, setCurvatureSteeringSupplier, setInvertCurvatureSteering, setSquareTeleopInputs, setTankDriveLeftSpeedSupplier, setTankDriveRightSpeedSupplier, setTeleopDriveType, stop, tankDrive, teleopOpenDrive
-
Methods inherited from class edu.wpi.first.wpilibj2.command.SubsystemBase
addChild, getName, getSubsystem, initSendable, setName, setSubsystem
-
-
-
-
Field Detail
-
DEFAULT_RAMP_RATE
public static final double DEFAULT_RAMP_RATE
The default ramp rate, meaning the motors will take this long (in seconds) to accelerate to full speed to prevent damage to the motor or subsystems. In drivetrains, this also helps to prevent flip-overs from sudden acceleration.- See Also:
- Constant Field Values
-
DEFAULT_CURRENT_LIMIT
public static final int DEFAULT_CURRENT_LIMIT
Limit the motors to the following AMPS to prevent brownouts, trips, or too much power being drawn when it really isn't needed. This is a nice safety feature.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
TalonSRXBrushedTankDrive
public TalonSRXBrushedTankDrive(CANMotorConfig leftLeaderConfig, CANMotorConfig rightLeaderConfig, CANMotorConfig leftFollowerConfig, CANMotorConfig rightFollowerConfig, edu.wpi.first.wpilibj.Encoder leftEncoder, edu.wpi.first.wpilibj.Encoder rightEncoder)
Creates a new drivetrain from the provided motor and optionally provided encoders- Parameters:
leftLeaderConfig
- configuration for the left leader motor controllerrightLeaderConfig
- configuration for the right leader motor controllerleftFollowerConfig
- configuration for the left follower motor controllerrightFollowerConfig
- configuration for the right follower motor controllerleftEncoder
- the encoder to be associated with the left side; must be in-phase where forward is positiverightEncoder
- the encoder to be associated with the right side; must be in-phase where forward is positive
-
-
Method Detail
-
setAccelerationRampRate
public void setAccelerationRampRate(double maxAccRate)
Description copied from class:TankDrive
Sets the ramp rate for open loop control modes.This is the maximum rate at which the motor controller's output is allowed to change.
- Specified by:
setAccelerationRampRate
in classTankDrive
- Parameters:
maxAccRate
- Time in seconds to go from 0 to full throttle.
-
setCurrentLimit
public void setCurrentLimit(int currentInAmps)
Description copied from class:TankDrive
Sets the current limit in Amps.The motor controller will reduce the controller voltage output to avoid surpassing this limit. This limit is enabled by default and used for brushless only. This limit is highly recommended when brushless motors, but it also helps to avoid brownouts in any situation.
- Specified by:
setCurrentLimit
in classTankDrive
- Parameters:
currentInAmps
- The current limit in Amps.
-
setSidePIDGains
public void setSidePIDGains(PIDGains gains)
Description copied from class:TankDrive
Set the PID controller gains for both sides of the tank drive. Note that the actual effect will be determined by the motors used (Neos + Spark Max's have a lot more control because of their built-in encoder) but it tries to be fairly equal enough for a drivetrain to work.- Specified by:
setSidePIDGains
in classTankDrive
- Parameters:
gains
- desired PID gains
-
resetOdometry
public void resetOdometry()
Description copied from class:TankDrive
Reset the encoders and gyroscope readings.- Specified by:
resetOdometry
in classTankDrive
-
-