Permalink
Browse files

changed speed variable name

  • Loading branch information...
elizarg committed Nov 24, 2018
1 parent 813815e commit 9c86a3c6514962a9b59a5da2a657be4a59cfdeaa
@@ -1,4 +1,3 @@

package org.usfirst.frc.team1700.robot;

import edu.wpi.first.wpilibj.IterativeRobot;
@@ -18,8 +17,8 @@
public static final DriveSubsystem driveSubsystem = new DriveSubsystem();

// Control variables
public static double leftSpeed = 0;
public static double rightSpeed = 0;
public static double leftPercentOutput = 0;
public static double rightPercentOutput = 0;

/**
* This function is run when the robot is first started up and should be
@@ -43,20 +42,10 @@ public void disabledInit() {
@Override
public void disabledPeriodic() {
}

@Override
public void autonomousInit() {
}

/**
* This function is called periodically during autonomous
*/
@Override
public void autonomousPeriodic() {
}

@Override
//Everything in teleopInit starts when teleop mode is turned on (so we don't want anything in it).
@Override
public void teleopInit() {
driveSubsystem.driveTank(leftPercentOutput, rightPercentOutput);
}

/**
@@ -66,11 +55,11 @@ public void teleopInit() {
public void teleopPeriodic() {

// UPDATE ROBOT STATE
leftSpeed = OI.leftJoy.getRawAxis(1);
rightSpeed = OI.rightJoy.getRawAxis(1);
leftPercentOutput = OI.leftJoy.getRawAxis(1);
rightPercentOutput = OI.rightJoy.getRawAxis(1);

// EXECUTE
driveSubsystem.driveTank(leftSpeed, rightSpeed);
driveSubsystem.driveTank(leftPercentOutput, rightPercentOutput);
}

/**
@@ -14,10 +14,11 @@
TalonSRX LB = RobotMap.leftBackDrive;
TalonSRX RB = RobotMap.rightBackDrive;

public void driveTank(double leftSpeed, double rightSpeed) {
LF.set(ControlMode.PercentOutput, -leftSpeed);
LB.set(ControlMode.PercentOutput, -leftSpeed);
RF.set(ControlMode.PercentOutput, rightSpeed);
RB.set(ControlMode.PercentOutput, rightSpeed);
//Intakes the speeds of joysticks and updates motor speeds
public void driveTank(double leftPercentOutput, double rightPercentOutput) {
LF.set(ControlMode.PercentOutput, -leftPercentOutput);
LB.set(ControlMode.PercentOutput, -leftPercentOutput);
RF.set(ControlMode.PercentOutput, rightPercentOutput);
RB.set(ControlMode.PercentOutput, rightPercentOutput);
}
}

0 comments on commit 9c86a3c

Please sign in to comment.