Class 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.SubsystemBase
    Add 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
      void arcadeDrive​(double forwardInput, double rotInput)
      Control the robot by passing in a forward value and a rotation value
      double getAverageEncoderDistance()  
      double getAverageEncoderDistanceInFeet()  
      edu.wpi.first.math.geometry.Rotation2d getHeading()  
      edu.wpi.first.math.geometry.Pose2d getPose()  
      double getTurnRate()  
      edu.wpi.first.math.kinematics.DifferentialDriveWheelSpeeds getWheelSpeeds()  
      void periodic()  
      void resetEncoders()  
      void resetOdometry​(edu.wpi.first.math.geometry.Pose2d pose)  
      void setMaxOutput​(double maxOutput)  
      void stopMotors()  
      void tankDriveVolts​(double leftVolts, double rightVolts)
      Tank drive control with voltage
      void zeroHeading()  
      • 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 edu.wpi.first.wpilibj2.command.Subsystem

        getCurrentCommand, getDefaultCommand, register, setDefaultCommand, simulationPeriodic
    • Constructor Detail

      • DriveTrainSubsystem

        public DriveTrainSubsystem​(com.revrobotics.CANSparkMax rearLeft,
                                   com.revrobotics.CANSparkMax frontLeft,
                                   com.revrobotics.CANSparkMax rearRight,
                                   com.revrobotics.CANSparkMax frontRight)
        Constructor, initialize motor controllers and groups.
    • Method Detail

      • tankDriveVolts

        public void tankDriveVolts​(double leftVolts,
                                   double rightVolts)
        Tank drive control with voltage
        Parameters:
        leftVolts - Voltage for rear left motors
        rightVolts - 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()