Drivetrain.Java Description - TrinityTrihawks/2018 GitHub Wiki
Drivetain.java
Drivetrain.java creates an enum called "wheelIdnex" that creates an index for each wheel backrightwheel, frontrightwheel, backleftwheel, and frontleftwheel. An integer is also made called "wheel" set to the integer "value". getValue() is made to return the value of "wheel". "numberWheels" is made and set to a number corresponding to RobotMap. Each of the variables that were made in the enum wheelIndex are set as a TalonSRX with a number corresponding to a value in RobotMap.
This next part takes in the inputs from OI and actually drives the robot in Drive. Right away the rotation value is multiplied by -0.5, and determins if the magnitude is <= .08 and >= -.08, if so set both theta and the magnitude to 0. xPower and yPower is made and set to a value around the magnitude and theta. The powers are then given a power value based on xPower and yPower.
The voltages from each each of the wheels, outputted voltage onto the SmartDashboard. The voltages for the wheels are also printed out in the command prompt. The Stop function is introduced. The voltages for each wheel are set to a voltage double. Similarily to two output doubles the wheels motor output percent and to the other the current output. initDefaultCommand() is made and sets the Default command at new teleopDrive(). resetDistance() is made to reset the distance (ticks) on each wheel is made, resetting each wheel to (0,0). getDistance is also made, this to return the distance the wheels have traveled.