move instantiation of physical components to map
[ozzloy@gmail.com/3501-spark-go] / src / org / usfirst / frc / team3501 / robot / subsystems / Drivetrain.java
index 72428e4a7ca5e757f42529fbac5adc98c906e5f4..de1efe61d9b239ce71822b240a41af4a3f4cb5b0 100644 (file)
@@ -3,29 +3,24 @@ package org.usfirst.frc.team3501.robot.subsystems;
 import org.usfirst.frc.team3501.robot.RobotMap;
 import org.usfirst.frc.team3501.robot.commands.DriveWithJoysticks;
 
-import edu.wpi.first.wpilibj.CANJaguar;
 import edu.wpi.first.wpilibj.RobotDrive;
 import edu.wpi.first.wpilibj.command.Subsystem;
 
 public class Drivetrain extends Subsystem {
 
-    private RobotDrive robotDrive;
+    private final RobotDrive robotDrive;
 
     public Drivetrain() {
-        CANJaguar frontLeft  = new CANJaguar(RobotMap.FRONT_LEFT_ADDRESS);
-        CANJaguar frontRight = new CANJaguar(RobotMap.FRONT_RIGHT_ADDRESS);
-        CANJaguar rearLeft   = new CANJaguar(RobotMap.REAR_LEFT_ADDRESS);
-        CANJaguar rearRight  = new CANJaguar(RobotMap.REAR_RIGHT_ADDRESS);
 
         robotDrive = new RobotDrive(
-                frontLeft,  rearLeft,
-                frontRight, rearRight);
+                RobotMap.frontLeft,  RobotMap.rearLeft,
+                RobotMap.frontRight, RobotMap.rearRight);
     }
 
     public void drive(double forward, double twist) {
         if (Math.abs(forward) < RobotMap.MIN_DRIVE_JOYSTICK_INPUT)
             forward = 0;
-        if (Math.abs(twist) < RobotMap.MIN_DRIVE_JOYSTICK_INPUT)
+        if (Math.abs(twist)   < RobotMap.MIN_DRIVE_JOYSTICK_INPUT)
             twist = 0;
 
         robotDrive.arcadeDrive(
@@ -34,6 +29,10 @@ public class Drivetrain extends Subsystem {
                 false);
     }
 
+    public void driveRaw(double forward, double twist) {
+        robotDrive.arcadeDrive(forward, twist, false);
+    }
+
     public void goForward(double speed) {
         robotDrive.arcadeDrive(speed, 0);
     }