/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2008. All Rights Reserved.                             */
/* Open Source Software - may be modified and shared by FRC teams. The code   */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project.                                                               */
/*----------------------------------------------------------------------------*/
package edu.wpi.first.wpilibj.templates;

import edu.wpi.first.wpilibj.Compressor;
import edu.wpi.first.wpilibj.Jaguar;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.Servo;
import edu.wpi.first.wpilibj.SimpleRobot;

/**
 * The VM is configured to automatically run this class, and to call the
 * functions corresponding to each mode, as described in the SimpleRobot
 * documentation. If you change the name of this class or the package after
 * creating this project, you must also update the manifest file in the resource
 * directory.
 */
public class RobotTemplate extends SimpleRobot {

    private Joystick joystick = new Joystick(1);
    private Drivetrain drivetrain;
    private BowlerArm arm;
    Compressor compressor;
    Pan pan;
    //int port_1 = 7; //these ports were placeholders, no longer applicable
    //int port_2 = 7;

    public RobotTemplate() {
        drivetrain = new Drivetrain();
        arm = new BowlerArm();
        pan = new Pan();
        compressor = new Compressor(7, 7);//1 for the switch, 7 for the relay

    }

    /**
     * This function is called once each time the robot enters autonomous mode.
     */
    public void autonomous() {
        drivetrain.set(1, 1);
        sleep(1000);
        drivetrain.set(0,0);
        arm.auto();
    }

    /**
     * This function is called once each time the robot enters operator control.
     */
    public void operatorControl() {
        compressor.start();
        arm.setSolenoid(-1);
        //drivetrain=new Drivetrain();
        //Pan pan= new Pan();
        //arm= new BowlerArm();
        while (isOperatorControl()) {
            //drivetrain updates
            double lstick = -joystick.getRawAxis(2);
            double rstick = -joystick.getRawAxis(4);
            drivetrain.set(Math.abs(lstick) * lstick, Math.abs(rstick) * rstick); //If I'm not mistaken, this is the most convenient way to square in Java?
            
            
            //pan updates version 2 (Amita); this is basic and can be used for backup
            if(joystick.getRawButton(10)){
                pan.endGame();
            }
            else{
                pan.resetServo();
            }

            //pan updates version 1 (Chris)
            // If the button wasn't being pressed before, and is now pressed, will change the state of the servo. (and vice-versa)
            /*
            if (pan.getPrevState() != joystick.getRawButton(10)) {
                pan.set((pan.get() + 1) % 2);
                pan.changeState();
            }

            //joystick.getRawButton(10); //what is the purpose of this line?
             * 
             */
            
            //bowler arm updates
            /*
            if (joystick.getRawButton(6)) {
                try {
                    arm.auto();
                } catch (InterruptedException ex) {
                    ex.printStackTrace();
                }
            }
            */
            if (joystick.getRawButton(7)) {
                arm.rampDown();
                //arm.setRamp(1);
            } else if (joystick.getRawButton(5)) {
                arm.rampUp();
                //arm.setRamp(-1);
            } else {
                arm.setRamp(0);
            }
            arm.setSolenoid((int) joystick.getRawAxis(6));
            
        }
    }
    /*
     *changes the servo state based on the button being pressed. 
     *once it is pressed, it is set to the opposite of what is was at the start, ditto for release. 
     */

    /**
     * This function is called once each time the robot enters test mode.
     */
    public void test() {

    }
    public static void sleep(long ms){
        long t=System.currentTimeMillis()+ms;
        while(System.currentTimeMillis()<t){
            //do nothing!
        }
    }
}

@@ -1510,17 +1510,17 @@
 7, 7);//
-1
+7
  for the
@@ -1980,109 +1980,8 @@
 1);%0A
-        //drivetrain=new Drivetrain();%0A        //Pan pan= new Pan();%0A        //arm= new BowlerArm();%0A
     
@@ -2580,483 +2580,8 @@
  %7D%0A%0A
-            //pan updates version 1 (Chris)%0A            // If the button wasn't being pressed before, and is now pressed, will change the state of the servo. (and vice-versa)%0A            /*%0A            if (pan.getPrevState() != joystick.getRawButton(10)) %7B%0A                pan.set((pan.get() + 1) %25 2);%0A                pan.changeState();%0A            %7D%0A%0A            //joystick.getRawButton(10); //what is the purpose of this line?%0A             * %0A             */%0A            %0A
     
@@ -2617,27 +2617,24 @@
             
-/*%0A
             
@@ -2637,234 +2637,16 @@
     
-if (joystick.getRawButton(6)) %7B%0A                try %7B%0A                    arm.auto();%0A                %7D catch (InterruptedException ex) %7B%0A                    ex.printStackTrace();%0A                %7D%0A            %7D%0A            */
+        
 %0A   
@@ -2722,42 +2722,8 @@
 ();%0A
-                //arm.setRamp(1);%0A
     
@@ -2815,28 +2815,75 @@
     
-    //arm.setRamp(-1
+%7D else if (joystick.getRawButton(6)) %7B%0A                   arm.auto(
 );%0A 
@@ -3218,16 +3218,20 @@
      */%0A
+    
 %0A    /**
@@ -3335,24 +3335,163 @@
 d test() %7B%0A%0A
+    %7D%0A    public void updateDrivetrain()%7B%0A        %0A    %7D%0A    public void updateArm()%7B%0A        %0A    %7D%0A    public void updatePan()%7B%0A        %0A
     %7D%0A    pu

Change signs of ramp speed