/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.stuy.commands;

import edu.wpi.first.wpilibj.command.CommandGroup;
import edu.stuy.commands.CommandBase;

/**
 *
 * @author Kevin Wang
 */
public class Autonomous extends CommandGroup {

    /* For inches to fender */
    private static final int DIST_FENDER_TO_KEY = 110;
    private static final double BUMPER_EDGE_TO_WHEEL_CENTER = 9.5;
    private static final int BOT_LENGTH_WITH_BUMPERS = 44;
    private static final double DIST_ALLIANCESTATION_TO_BRIDGE = 280.4;
    public static final double FENDER_DEPTH = 38.5;
    private static final double TOLERANCE = 2;
    public static final double INCHES_TO_FENDER = DIST_FENDER_TO_KEY - (BOT_LENGTH_WITH_BUMPERS - BUMPER_EDGE_TO_WHEEL_CENTER);

    /* For inches to bridge from fender */
    public static final double INCHES_TO_BRIDGE = DIST_ALLIANCESTATION_TO_BRIDGE - FENDER_DEPTH - BOT_LENGTH_WITH_BUMPERS -TOLERANCE;
    
    public static final double INCHES_FROM_EDGE_TO_SONAR = 13;
    
    public static final double RAMPING_DISTANCE = 5;
    public static final double RAMPING_CONSTANT = 10/9;

    public Autonomous() {
        addSequential(new DrivetrainSetGear(true));
        switch(CommandBase.oi.getAutonSetting()){
            case 0:
                addSequential(new AutonSetting1());
                break;
            case 1:
                addSequential(new AutonSetting2());
                break;
            case 2:
                addSequential(new AutonSetting3());
                break;
            case 3:
                addSequential(new AutonSetting4());
                break;
            case 4:
                addSequential(new AutonSetting5());
                break;
            default:
                addSequential(new AutonSetting6());
                break;
        }
    }
}

@@ -169,51 +169,8 @@
 mand
-Group;%0Aimport edu.stuy.commands.CommandBase
 ;%0A%0A/
@@ -244,13 +244,12 @@
 mand
-Group
+Base
  %7B%0A%0A
@@ -1119,16 +1119,20 @@
 = 10/9;%0A
+    
 %0A    pub
@@ -1154,38 +1154,223 @@
 ) %7B%0A        
-addSequential(
+// Use requires() here to declare subsystem dependencies%0A        // eg. requires(chassis);%0A    %7D%0A%0A    // Called just before this Command runs the first time%0A    protected void initialize() %7B%0A        
 new Drivetra
@@ -1384,19 +1384,56 @@
 ar(true)
+.start(
 );%0A
+        Command autonCommand;%0A
         
@@ -1507,37 +1507,38 @@
            a
-ddSequential(
+utonCommand = 
 new AutonSet
@@ -1544,17 +1544,16 @@
 tting1()
-)
 ;%0A      
@@ -1602,37 +1602,38 @@
            a
-ddSequential(
+utonCommand = 
 new AutonSet
@@ -1639,17 +1639,16 @@
 tting2()
-)
 ;%0A      
@@ -1697,37 +1697,38 @@
            a
-ddSequential(
+utonCommand = 
 new AutonSet
@@ -1734,17 +1734,16 @@
 tting3()
-)
 ;%0A      
@@ -1792,37 +1792,38 @@
            a
-ddSequential(
+utonCommand = 
 new AutonSet
@@ -1829,17 +1829,16 @@
 tting4()
-)
 ;%0A      
@@ -1887,37 +1887,38 @@
            a
-ddSequential(
+utonCommand = 
 new AutonSet
@@ -1924,17 +1924,16 @@
 tting5()
-)
 ;%0A      
@@ -1991,21 +1991,22 @@
    a
-ddSequential(
+utonCommand = 
 new 
@@ -2020,17 +2020,16 @@
 tting6()
-)
 ;%0A      
@@ -2055,16 +2055,530 @@
       %7D%0A
+        autonCommand.start();%0A    %7D%0A%0A    // Called repeatedly when this Command is scheduled to run%0A    protected void execute() %7B%0A    %7D%0A%0A    // Make this return true when this Command no longer needs to run execute()%0A    protected boolean isFinished() %7B%0A        return false;%0A    %7D%0A%0A    // Called once after isFinished returns true%0A    protected void end() %7B%0A    %7D%0A%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
     %7D%0A%7D%0A

Change Autonomous command to check for the auton setting only when auton begins.