Skip to content

Commit f5a0238

Browse files
committed
Added a drive method for the DifferentialDrive class to the interface.
1 parent 929a7c5 commit f5a0238

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

src/main/java/org/usfirst/frc/team69/util/driving/ArcadeDriveParams.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package org.usfirst.frc.team69.util.driving;
22

33
import edu.wpi.first.wpilibj.RobotDrive;
4+
import edu.wpi.first.wpilibj.drive.DifferentialDrive;
45

56
/**
67
* A class which represents arcade drive. Arcade drive uses two values: move and
@@ -48,6 +49,12 @@ public ArcadeDriveParams(double move, double rotate, boolean squareInputs) {
4849
public void drive(RobotDrive driveTrain, double currentGyro) {
4950
driveTrain.arcadeDrive(m_move, m_rotate, m_squareInputs);
5051
}
52+
53+
@Override
54+
public void drive(DifferentialDrive driveTrain, double currentGyro) {
55+
// TODO Auto-generated method stub
56+
driveTrain.arcadeDrive(m_move, m_rotate, m_squareInputs);
57+
}
5158

5259
/**
5360
* Get the move parameter
@@ -75,5 +82,4 @@ public double rotate() {
7582
public boolean squareInputs() {
7683
return m_squareInputs;
7784
}
78-
7985
}

src/main/java/org/usfirst/frc/team69/util/driving/DriveParameters.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package org.usfirst.frc.team69.util.driving;
22

33
import edu.wpi.first.wpilibj.RobotDrive;
4+
import edu.wpi.first.wpilibj.drive.DifferentialDrive;
45

56
/**
67
* The {@link DriveParameters} interface allows one to use polymorphism to
@@ -36,4 +37,5 @@ public interface DriveParameters {
3637
* this right now, so just pass in 0.0 if you're not sure.
3738
*/
3839
void drive(RobotDrive driveTrain, double currentGyro);
40+
void drive(DifferentialDrive driveTrain, double currentGyro);
3941
}

src/main/java/org/usfirst/frc/team69/util/driving/TankDriveParams.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package org.usfirst.frc.team69.util.driving;
22

33
import edu.wpi.first.wpilibj.RobotDrive;
4+
import edu.wpi.first.wpilibj.drive.DifferentialDrive;
45

56
/**
67
* A class which represents tank drive. This mode takes two inputs: left and
@@ -46,7 +47,14 @@ public TankDriveParams(double left, double right, boolean squareInputs) {
4647
public void drive(RobotDrive driveTrain, double currentGyro) {
4748
driveTrain.tankDrive(m_left, m_right, m_squareInputs);
4849
}
50+
51+
@Override
52+
public void drive(DifferentialDrive driveTrain, double currentGyro) {
53+
// TODO Auto-generated method stub
54+
driveTrain.tankDrive(m_left, m_right, m_squareInputs);
55+
}
4956

57+
5058
/**
5159
* Get the left parameter
5260
*

0 commit comments

Comments
 (0)