package com.frc2879.knight_fury;

import com.frc2879.knight_fury.commands.*;
import com.frc2879.xboxcontroller.XboxController;

/**
 * This class is the glue that binds the controls on the physical operator
 * interface to the commands and command groups that allow control of the robot.
 */
public class OI {
    //// CREATING BUTTONS
    // One type of button is a joystick button which is any button on a joystick.
    // You create one by telling it which joystick it's on and which button
    // number it is.
    // Joystick stick = new Joystick(port);
    // Button button = new JoystickButton(stick, buttonNumber);
    
    // There are a few additional built in buttons you can use. Additionally,
    // by subclassing Button you can create custom triggers and bind those to
    // commands the same as any other Button.
    
    //// TRIGGERING COMMANDS WITH BUTTONS
    // Once you have a button, it's trivial to bind it to a button in one of
    // three ways:
    
    // Start the command when the button is pressed and let it run the command
    // until it is finished as determined by it's isFinished method.
    // button.whenPressed(new ExampleCommand());
    
    // Run the command while the button is being held down and interrupt it once
    // the button is released.
    // button.whileHeld(new ExampleCommand());
    
    // Start the command when the button is released  and let it run the command
    // until it is finished as determined by it's isFinished method.
    // button.whenReleased(new ExampleCommand());
	
	
	private final XboxController controllerDriver;
	private final XboxController controllerCoDriver;
	
	public OI() {
	    
	    controllerDriver = new XboxController(RobotConfig.CONTROLLER_DRIVER);
	    controllerCoDriver = new XboxController(RobotConfig.CONTROLLER_CODRIVER);
		
	    controllerDriver.rt.setTriggerSensitivity(0.3);
	    controllerDriver.lt.setTriggerSensitivity(0.3);
	    
	    controllerDriver.lb.whenPressed(new GrabberToggle());
		controllerDriver.rb.whenPressed(new ShootBall());
		
		controllerDriver.lt.whenPressed(new MoveArmDownCont());
		controllerDriver.rt.whenPressed(new MoveArmUpCont());
		
		controllerDriver.dPad.left.whenPressed(new RotateWithGyro(67, 0.8, true));
		controllerDriver.dPad.right.whenPressed(new RotateWithGyro(67, 0.8, false));
		controllerDriver.dPad.down.whenPressed(new RotateWithGyro(157, 0.8, false));
	    
	}
	
	public XboxController getcontrollerDriver() {
		return controllerDriver;
	}
	
	public XboxController getcontrollerCoDriver() {
        return controllerCoDriver;
    }
    
	
}


@@ -1826,32 +1826,34 @@
 %0A%09    controller
+Co
 Driver.rt.setTri
@@ -1881,32 +1881,34 @@
 %0A%09    controller
+Co
 Driver.lt.setTri
@@ -1942,32 +1942,34 @@
 %0A%09    controller
+Co
 Driver.lb.whenPr
@@ -1978,16 +1978,267 @@
 sed(new 
+MoveArmDown(0.5));%0A%09    controllerCoDriver.rb.whenPressed(new MoveArmUp(0.5));%0A%09%09%0A%09    controllerCoDriver.lt.whenPressed(new MoveArmDownCont());%0A%09    controllerCoDriver.rt.whenPressed(new MoveArmUpCont());%0A%09%09%0A%09    controllerCoDriver.b.whenPressed(new 
 GrabberT
@@ -2244,25 +2244,28 @@
 Toggle());%0A%09
-%09
+    
 controllerDr
@@ -2262,25 +2262,26 @@
 ntroller
+Co
 Driver.
-rb
+x
 .whenPre
@@ -2300,28 +2300,276 @@
 otBall());%0A%09
-%09%0A%09%09
+    %0A%09    controllerDriver.rt.setTriggerSensitivity(0.3);%0A%09    controllerDriver.lt.setTriggerSensitivity(0.3);%0A        %0A%09    controllerDriver.lb.whenPressed(new MoveArmDown(0.5));%0A%09    controllerDriver.rb.whenPressed(new MoveArmUp(0.5));%0A        %0A%09    
 controllerDr
@@ -2609,25 +2609,28 @@
 wnCont());%0A%09
-%09
+    
 controllerDr
@@ -2667,24 +2667,145 @@
 mUpCont());%0A
+        %0A%09    controllerDriver.b.whenPressed(new GrabberToggle());%0A%09    controllerDriver.x.whenPressed(new ShootBall());%0A
 %09%09%0A%09%09control

Add new buttons for co driver and driver