package org.inceptus.chassis;

import edu.wpi.first.wpilibj.CANJaguar;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.RobotDrive.MotorType;
import edu.wpi.first.wpilibj.can.CANTimeoutException;
import org.inceptus.debug.Debug;

/**
 *
 * @author innoying
 */
public class Drive {
    //Motors
    private CANJaguar leftFront;
    private CANJaguar rightFront;
    private CANJaguar leftRear;
    private CANJaguar rightRear;
    //Drive
    private RobotDrive robotDrive;

    //Initilize
    public Drive(){
        //Try catch for errors
        try {

            //Setup the drive motors
            leftFront = new CANJaguar(12);
            rightFront = new CANJaguar(11);
            leftRear = new CANJaguar(10);
            rightRear = new CANJaguar(5);

            //Setup the Drive
            robotDrive = new RobotDrive(leftFront, leftRear, rightFront, rightRear);

            //Invert the motors
            robotDrive.setInvertedMotor(MotorType.kFrontLeft, true);
            robotDrive.setInvertedMotor(MotorType.kRearRight, false);
            robotDrive.setInvertedMotor(MotorType.kFrontLeft, true);
            robotDrive.setInvertedMotor(MotorType.kRearLeft, true);

        } catch (CANTimeoutException ex) { //Catch CANTimeout Error
            
            //Print Error
            Debug.fatal(ex, "CAN Timeout in " + this.getClass().getName());

        } catch (Exception ex){ //Catch all for errors

            //Print Error
            Debug.fatal(ex, "Unknown error in " + this.getClass().getName());
        }
    }

    public boolean driveWithValues(double x, double y, double rotation){
        //Try catch for errors
        try {
            //Drive using values
            robotDrive.mecanumDrive_Cartesian(x, y, rotation, 0);

        } catch (Exception ex){ //Catch all for errors

            //Print Error
            Debug.fatal(ex, "Unknown error in DriveWithValues");
            //Return failure
            return false;

        }

        //Return Success
        return true;
    }
}

@@ -527,60 +527,38 @@
 ve()
-%7B%0A        //Try catch for errors%0A        try %7B%0A%0A    
+ throws CANTimeoutException%7B%0A%0A
     
@@ -590,28 +590,24 @@
 ors%0A        
-    
 leftFront = 
@@ -629,28 +629,24 @@
 2);%0A        
-  
-  
 rightFront =
@@ -665,20 +665,16 @@
 ar(11);%0A
-    
         
@@ -707,28 +707,24 @@
 0);%0A        
-    
 rightRear = 
@@ -746,28 +746,24 @@
 );%0A%0A        
-    
 //Setup the 
@@ -768,20 +768,16 @@
 e Drive%0A
-    
         
@@ -858,20 +858,16 @@
         
-    
 //Invert
@@ -874,28 +874,24 @@
  the motors%0A
-    
         robo
@@ -935,36 +935,32 @@
 ontLeft, true);%0A
-    
         robotDri
@@ -1009,36 +1009,32 @@
 false);%0A        
-    
 robotDrive.setIn
@@ -1074,36 +1074,32 @@
  true);%0A        
-  
-  
 robotDrive.setIn
@@ -1143,362 +1143,8 @@
 );%0A%0A
-        %7D catch (CANTimeoutException ex) %7B //Catch CANTimeout Error%0A            %0A            //Print Error%0A            Debug.fatal(ex, %22CAN Timeout in %22 + this.getClass().getName());%0A%0A        %7D catch (Exception ex)%7B //Catch all for errors%0A%0A            //Print Error%0A            Debug.fatal(ex, %22Unknown error in %22 + this.getClass().getName());%0A        %7D%0A
     
@@ -1161,15 +1161,12 @@
 lic 
-boolean
+void
  dri
@@ -1220,57 +1220,9 @@
 n)%7B%0A
-        //Try catch for errors%0A        try %7B%0A    
+%0A
     
@@ -1246,20 +1246,16 @@
  values%0A
-    
         
@@ -1312,268 +1312,20 @@
 0);%0A
-%0A        %7D catch (Exception ex)%7B //Catch all for errors%0A%0A            //Print Error%0A            Debug.fatal(ex, %22Unknown error in DriveWithValues%22);%0A            //Return failure%0A            return false;%0A%0A        %7D%0A%0A        //Return Success%0A        return true;
+            
 %0A   

Move Error code out of classes