/*
 * Operator Interface methods
 */
package net.pvschools.robotics.javabot.practice;

import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.buttons.Button;
import edu.wpi.first.wpilibj.buttons.JoystickButton;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import net.pvschools.robotics.javabot.practice.commands.StartPickup;
import net.pvschools.robotics.javabot.practice.commands.StopPickup;
import net.pvschools.robotics.javabot.practice.commands.Shoot;
import net.pvschools.robotics.javabot.practice.commands.piston.CloseCatcher;
import net.pvschools.robotics.javabot.practice.commands.piston.CloseLatch;
import net.pvschools.robotics.javabot.practice.commands.piston.ExtendBigKicker;
import net.pvschools.robotics.javabot.practice.commands.piston.ExtendLittleKicker;
import net.pvschools.robotics.javabot.practice.commands.piston.ExtendPickup;
import net.pvschools.robotics.javabot.practice.commands.piston.LowerRamp;
import net.pvschools.robotics.javabot.practice.commands.piston.OpenCatcher;
import net.pvschools.robotics.javabot.practice.commands.piston.OpenLatch;
import net.pvschools.robotics.javabot.practice.commands.piston.RaiseRamp;
import net.pvschools.robotics.javabot.practice.commands.piston.RetractBigKicker;
import net.pvschools.robotics.javabot.practice.commands.piston.RetractLittleKicker;
import net.pvschools.robotics.javabot.practice.commands.piston.RetractPickup;

public class OI
{
    private static final OI instance = new OI();

    private final Joystick mainJoystick = new Joystick(Map.joystickPort);
    
    /** Shoot */
    private final Button button1 = new JoystickButton(mainJoystick, 1);
    
    /** Extend Feed <p> Keep extended while holding */
    private final Button button2 = new JoystickButton(mainJoystick, 2);
    
    /** Side Arms Down */
    private final Button button3 = new JoystickButton(mainJoystick, 3);
    
    /** Side Arms Up */
    private final Button button5 = new JoystickButton(mainJoystick, 5);
    
    /** Ramp Down */
    private final Button button4 = new JoystickButton(mainJoystick, 4);
    
    /** Ramp Up */
    private final Button button6 = new JoystickButton(mainJoystick, 6);
    
    private final Button button7 = new JoystickButton(mainJoystick, 7);
    
    private final Button button8 = new JoystickButton(mainJoystick, 8);
    
    private final Button button9 = new JoystickButton(mainJoystick, 9);
    
    private final Button button10 = new JoystickButton(mainJoystick, 10);
    
    private final Button button11 = new JoystickButton(mainJoystick, 11);
    
    /** Spew */
    private final Button button12 = new JoystickButton(mainJoystick, 12);

    private OI()
    {
        SmartDashboard.putNumber("Dampening", .5);
		
        //Button Command Initialization
        button2.whenPressed(new StartPickup());
        button2.whenReleased(new StopPickup());
//		
//		button11.whenPressed(new PushFeedRollerSpeed(FeedRoller.spewSpeed));
//		button11.whenReleased(new PopFeedRollerSpeed());
        
        button7.whenPressed(new OpenCatcher());
        button7.whenReleased(new CloseCatcher());
        button8.whenPressed(new RaiseRamp());
        button8.whenReleased(new LowerRamp());
        button9.whenPressed(new ExtendPickup());
        button9.whenReleased(new RetractPickup());
        button10.whenPressed(new ExtendLittleKicker());
        button10.whenReleased(new RetractLittleKicker());
        button11.whenPressed(new ExtendBigKicker());
        button11.whenReleased(new RetractBigKicker());
        button12.whenPressed(new OpenLatch());
        button12.whenReleased(new CloseLatch());
        
        button1.whenPressed(new Shoot(button5.get()));
    }
    
    public double getDampening()
    {
        return SmartDashboard.getNumber("Dampening");
    }
    
    public double getDriveThrottle()
    {
        return mainJoystick.getThrottle();
    }
    
    public double getDriveX()
    {
        return mainJoystick.getY();
    }
    
    public double getDriveY()
    {
        return mainJoystick.getX();
    }
    
    public double getDriveTwist()
    {
        return mainJoystick.getTwist();
    }
    
    public static OI getInstance()
    {
        return instance;
    }
}

@@ -1409,16 +1409,81 @@
 tPickup;
+%0Aimport net.pvschools.robotics.javabot.practice.subsystems.Sonar;
 %0A%0Apublic
@@ -3067,24 +3067,490 @@
 erSpeed());%0A
+//        private static Boolean catching;%0A//        if (button12.get())%0A//        %7B%0A//           Sonar Sonar = new Sonar(Map.SonarPingChannel,Map.SonarEchoChannel);%0A//           if (Sonar.getDistanceInInches()%3C13 and !catching)%0A//           %7B%0A//              CloseCatcher Catcher = new CloseCatcher();%0A//              Catcher.start();%0A//              catching = true;%0A//           %7D else%0A//           %7B%0A//               catching = false;%0A//           %7D%0A//        %7D%0A
         %0A   
@@ -4215,24 +4215,33 @@
 n5.get()));%0A
+        %0A
     %7D%0A    %0A 

Add Sonar close catcher