Package frc.robot.subsystems
Class DriveTrainSubsystem
- java.lang.Object
-
- edu.wpi.first.wpilibj2.command.SubsystemBase
-
- frc.robot.subsystems.DriveTrainSubsystem
-
- All Implemented Interfaces:
edu.wpi.first.util.sendable.Sendable,edu.wpi.first.wpilibj2.command.Subsystem
public class DriveTrainSubsystem extends edu.wpi.first.wpilibj2.command.SubsystemBaseAdd your docs here.
-
-
Constructor Summary
Constructors Constructor Description DriveTrainSubsystem(com.revrobotics.CANSparkMax rearLeft, com.revrobotics.CANSparkMax frontLeft, com.revrobotics.CANSparkMax rearRight, com.revrobotics.CANSparkMax frontRight)Constructor, initialize motor controllers and groups.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidarcadeDrive(double forwardInput, double rotInput)Control the robot by passing in a forward value and a rotation valuedoublegetAverageEncoderDistance()doublegetAverageEncoderDistanceInFeet()edu.wpi.first.math.geometry.Rotation2dgetHeading()edu.wpi.first.math.geometry.Pose2dgetPose()doublegetTurnRate()edu.wpi.first.math.kinematics.DifferentialDriveWheelSpeedsgetWheelSpeeds()voidperiodic()voidresetEncoders()voidresetOdometry(edu.wpi.first.math.geometry.Pose2d pose)voidsetMaxOutput(double maxOutput)voidstopMotors()voidtankDriveVolts(double leftVolts, double rightVolts)Tank drive control with voltagevoidzeroHeading()-
Methods inherited from class edu.wpi.first.wpilibj2.command.SubsystemBase
addChild, getName, getSubsystem, initSendable, setName, setSubsystem
-
-
-
-
Method Detail
-
tankDriveVolts
public void tankDriveVolts(double leftVolts, double rightVolts)Tank drive control with voltage- Parameters:
leftVolts- Voltage for rear left motorsrightVolts- Voltage for rear right motors
-
arcadeDrive
public void arcadeDrive(double forwardInput, double rotInput)Control the robot by passing in a forward value and a rotation value- Parameters:
forwardInput- Input for the desired forward speed. Positive input will move the robot forward.rotInput- Input for the desired rotation. Positive input will rotate the robot clockwise.
-
stopMotors
public void stopMotors()
-
getHeading
public edu.wpi.first.math.geometry.Rotation2d getHeading()
-
periodic
public void periodic()
-
getPose
public edu.wpi.first.math.geometry.Pose2d getPose()
-
getWheelSpeeds
public edu.wpi.first.math.kinematics.DifferentialDriveWheelSpeeds getWheelSpeeds()
-
resetOdometry
public void resetOdometry(edu.wpi.first.math.geometry.Pose2d pose)
-
resetEncoders
public void resetEncoders()
-
getAverageEncoderDistance
public double getAverageEncoderDistance()
-
getAverageEncoderDistanceInFeet
public double getAverageEncoderDistanceInFeet()
-
setMaxOutput
public void setMaxOutput(double maxOutput)
-
zeroHeading
public void zeroHeading()
-
getTurnRate
public double getTurnRate()
-
-