// RobotBuilder Version: 0.0.2
//
// This file was generated by RobotBuilder. It contains sections of
// code that are automatically generated and assigned by robotbuilder.
// These sections will be updated in the future when you export to
// Java from RobotBuilder. Do not put any code or make any change in
// the blocks indicating autogenerated code or it will be lost on an
// update. Deleting the comments indicating the section will prevent
// it from being updated in th future.
package org.usfirst.frc330.Beachbot2013Java.commands;
import edu.wpi.first.wpilibj.command.AutoSpreadsheetCommand;
import edu.wpi.first.wpilibj.command.Command;
import org.usfirst.frc330.Beachbot2013Java.Robot;
/**
 *
 */
public class  TurnGyroRel extends Command implements AutoSpreadsheetCommand {
    double angle;
    boolean stopAtEnd = false;
    
    public TurnGyroRel(double angle) {
        // Use requires() here to declare subsystem dependencies
        // eg. requires(chassis);
        this(angle, 0, 15, false);
    }
    
    public TurnGyroRel(double angle, double tolerance)
    {
        this(angle, tolerance, 15, false);
    }
    
    public TurnGyroRel(double angle, double tolerance, double timeout, boolean stopAtEnd) {
        // Use requires() here to declare subsystem dependencies
        // eg. requires(chassis);
	
        // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=REQUIRES
        requires(Robot.chassis);
    // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=REQUIRES
        this.angle = angle;
        Robot.chassis.gyroPIDLow.setAbsoluteTolerance(tolerance);
        setTimeout(timeout);
        this.stopAtEnd = stopAtEnd;
    }
    // Called just before this Command runs the first time
    protected void initialize() {
        Robot.chassis.gyroPIDLow.setSetpoint(angle+Robot.chassis.getAngle());
        Robot.chassis.gyroPIDLow.enable();
        Robot.chassis.leftDrivePIDLow.disable();
        Robot.chassis.rightDrivePIDLow.disable();
    }
    // Called repeatedly when this Command is scheduled to run
    protected void execute() {
        Robot.chassis.pidDrive();
    }
    // Make this return true when this Command no longer needs to run execute()
    protected boolean isFinished() {
        if (Robot.chassis.gyroPIDLow.onTarget() || isTimedOut())
        {
            return true;            
        }
        else
        {
            return false;
        }
    }
    // Called once after isFinished returns true
    protected void end() {
        if (stopAtEnd)
        {
            Robot.chassis.gyroPIDLow.disable();
            Robot.chassis.tankDrive(0, 0);
        }
    }
    // Called when another command which requires one or more of the same
    // subsystems is scheduled to run
    protected void interrupted() {
        stopAtEnd = true;
        end();
    }
    public void setParam1(double angle) {
        this.angle = angle;
    }
    public void setParam2(double tolerance) {
        Robot.chassis.gyroPIDLow.setAbsoluteTolerance(tolerance);
    }
    public void setParam3(double param3) {
    }
    public void setStopAtEnd(boolean stopAtEnd) {
        this.stopAtEnd = stopAtEnd;
    }
    public Command copy() {
        return new TurnGyroRel(0);
    }
}

@@ -735,23 +735,27 @@
 extends 
-Command
+TurnGyroAbs
  impleme
@@ -787,56 +787,8 @@
 d %7B%0A
-    double angle;%0A    boolean stopAtEnd = false;
 %0A   
@@ -1192,423 +1192,48 @@
     
-// Use requires() here to declare subsystem dependencies%0A        // eg. requires(chassis);%0A%09%0A        // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=REQUIRES%0A        requires(Robot.chassis);%0A    // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=REQUIRES%0A        this.angle = angle;%0A        Robot.chassis.gyroPIDLow.setAbsoluteTolerance(tolerance);%0A        setTimeout(timeout);%0A        this.stopAtEnd = stopAtEnd
+super(angle,tolerance,timeout,stopAtEnd)
 ;%0A  
@@ -1341,76 +1341,26 @@
     
-Robot.chassis.gyroPIDLow.setSetpoint(angle+Robot.chassis.getAngl
+super.initializ
 e()
-)
 ;%0A  
@@ -1357,32 +1357,37 @@
 lize();%0A        
+if (!
 Robot.chassis.gy
@@ -1389,27 +1389,23 @@
 is.g
-yroPIDLow.enable();
+etShiftState())
 %0A   
@@ -1413,1281 +1413,312 @@
     
-Robot.chassis.leftDrivePIDLow.disable();%0A        Robot.chassis.rightDrivePIDLow.disable();%0A    %7D%0A    // Called repeatedly when this Command is scheduled to run%0A    protected void execute() %7B%0A        Robot.chassis.pidDrive();%0A    %7D%0A    // Make this return true when this Command no longer needs to run execut
+%7B%0A            Robot.chassis.gyroPIDLow.setSetpoint(angle+Robot.chassis.getAngl
 e()
+);
 %0A    
-protected boolean isFinished() %7B%0A        if (Robot.chassis.gyroPIDLow.onTarget() %7C%7C isTimedOut())%0A        %7B%0A            return true;            %0A        %7D%0A        else%0A        %7B%0A            return false;%0A        %7D%0A    %7D%0A    // Called once after isFinished returns true%0A    protected void end() %7B%0A        if (stopAtEnd)%0A        %7B%0A            Robot.chassis.gyroPIDLow.disable();%0A            Robot.chassis.tankDrive(0, 0);%0A        %7D%0A    %7D%0A    // Called when another command which requires one or more of the same%0A    // subsystems is scheduled to run%0A    protected void interrupted() %7B%0A        stopAtEnd = true;%0A        end();%0A    %7D%0A    public void setParam1(double angle) %7B%0A        this.angle = a
+        Robot.chassis.gyroPIDLow.enable();%0A        %7D%0A        else%0A        %7B%0A            Robot.chassis.gyroPIDHigh.setSetpoint(angle+Robot.chassis.getA
 ngle
+())
 ;%0A    
-%7D%0A    public void setParam2(double tolerance) %7B%0A        Robot.chassis.gyroPIDLow.setAbsoluteTolerance(tolerance);%0A    %7D%0A    public void setParam3(double param3) %7B%0A    %7D%0A    public void setStopAtEnd(boolean stopAtEnd) %7B%0A        this.stopAtEnd = stopAtEnd;
+        Robot.chassis.gyroPIDHigh.enable();%0A        %7D
 %0A   

make extend TurnGyroAbs