Permalink
Browse files

Merge pull request #7 from gatorbotics1700/tests

Cleaned up drive train code.
  • Loading branch information...
kirmani committed Dec 7, 2018
2 parents 5e9b9eb + f50980b commit 020c2a7a6c0017a2032c44e838f32471c7ae3215
@@ -17,13 +17,13 @@
*/
public class RobotMap {
//left side of the drivetrain
public static TalonSRX leftFirstDrive = new TalonSRX(1);
public static TalonSRX leftFirstDrive = new TalonSRX(3);
public static TalonSRX leftSecondDrive = new TalonSRX(2);
public static TalonSRX leftThirdDrive = new TalonSRX(3);
public static TalonSRX leftThirdDrive = new TalonSRX(4);

//right side of the drivetrain
public static TalonSRX rightFirstDrive = new TalonSRX(4);
public static TalonSRX rightSecondDrive = new TalonSRX(5);
public static TalonSRX rightFirstDrive = new TalonSRX(5);
public static TalonSRX rightSecondDrive = new TalonSRX(7);
public static TalonSRX rightThirdDrive = new TalonSRX(6);

//NAVX
@@ -17,6 +17,7 @@
private static double wheelCircumference = 4 * Math.PI; //in inches
private static double numTicks = 4096; //double-check this value!!
public static final double inchesPerTick = wheelCircumference / numTicks;
public static final double ticksPerInch = 1/inchesPerTick;

// MOTORS AND SENSORS : UPDATE BASED ON WHAT'S ON THE PRACTICE DRIVETRAIN
TalonSRX L1 = RobotMap.leftFirstDrive;
@@ -30,13 +31,13 @@ public DriveSubsystem() {
}

//Intakes the speeds of joysticks and updates motor speeds
public void driveTank(double leftPercentOutput, double rightPercentOutput) {
L1.set(ControlMode.PercentOutput, -leftPercentOutput);
L2.set(ControlMode.PercentOutput, -leftPercentOutput);
L3.set(ControlMode.PercentOutput, -leftPercentOutput);
R1.set(ControlMode.PercentOutput, rightPercentOutput);
R2.set(ControlMode.PercentOutput, rightPercentOutput);
R3.set(ControlMode.PercentOutput, rightPercentOutput);
public void driveTank(double leftSpeed, double rightSpeed) {
L1.set(ControlMode.Velocity, -leftSpeed*ticksPerInch);
L2.set(ControlMode.Velocity, -leftSpeed*ticksPerInch);
L3.set(ControlMode.Velocity, -leftSpeed*ticksPerInch);
R1.set(ControlMode.Velocity, rightSpeed*ticksPerInch);
R2.set(ControlMode.Velocity, rightSpeed*ticksPerInch);
R3.set(ControlMode.Velocity, rightSpeed*ticksPerInch);
}

//Velocity
@@ -92,7 +93,11 @@ public boolean isMoving()
}

public void resetEncoders(){
//add function
L2.setSelectedSensorPosition(0, 0, 10);
L2.getSensorCollection().setQuadraturePosition(0, 10);
R2.setSelectedSensorPosition(0, 0, 10);
R2.getSensorCollection().setQuadraturePosition(0, 10);

}

}
@@ -10,7 +10,6 @@
@BeforeEach
public void setUp(){
System.out.println("setup function");
robot = new Robot();
}

@Test

0 comments on commit 020c2a7

Please sign in to comment.