2015-01-11 16:02:49 -05:00
|
|
|
#include "OI.h"
|
2015-02-03 15:55:11 -05:00
|
|
|
#include "Commands/Elevator/Lower.h"
|
|
|
|
#include "Commands/Elevator/Raise.h"
|
2015-03-24 14:42:11 -04:00
|
|
|
#include "Commands/Elevator/ElevatorCycle.h"
|
2015-02-13 19:40:23 -05:00
|
|
|
#include "Commands/Collector/RollIn.h"
|
|
|
|
#include "Commands/Collector/RollOut.h"
|
2015-03-21 10:24:33 -04:00
|
|
|
#include "Commands/Collector/RollVar.h"
|
2015-02-13 21:41:38 -05:00
|
|
|
#include "Commands/BinElevator/BinLower.h"
|
|
|
|
#include "Commands/BinElevator/BinRaise.h"
|
2015-10-23 14:13:17 -04:00
|
|
|
#include "Commands/BinCollector/BinCloseArms.h"
|
|
|
|
#include "Commands/BinCollector/BinOpenArms.h"
|
2015-10-23 14:45:39 -04:00
|
|
|
#include "Commands/BinCollector/BinCloseClaw.h"
|
|
|
|
#include "Commands/BinCollector/BinOpenClaw.h"
|
2015-04-06 20:36:35 -04:00
|
|
|
#include "Commands/BinCollector/BinIn.h"
|
|
|
|
#include "Commands/BinCollector/BinOut.h"
|
2015-02-24 12:02:30 -05:00
|
|
|
#include "Commands/Autonomous/CollectTote.h"
|
|
|
|
#include "Commands/Autonomous/ReleaseTote.h"
|
2015-10-09 13:44:30 -04:00
|
|
|
#include "Commands/Pneumatics/EnableCompressor.h"
|
|
|
|
#include "Commands/Pneumatics/DisableCompressor.h"
|
2015-07-31 12:52:15 -04:00
|
|
|
OI::OI() {
|
2015-02-07 17:04:16 -05:00
|
|
|
// Joysticks
|
2015-03-23 10:52:02 -04:00
|
|
|
leftStick = new Joystick(0);
|
|
|
|
rightStick = new Joystick(1);
|
2015-02-07 17:04:16 -05:00
|
|
|
// Collector
|
2015-03-23 10:52:02 -04:00
|
|
|
JoystickButton *left1 = new JoystickButton(leftStick, 1);
|
|
|
|
JoystickButton *left2 = new JoystickButton(leftStick, 2);
|
|
|
|
JoystickButton *left7 = new JoystickButton(leftStick, 7);
|
2015-10-09 13:44:30 -04:00
|
|
|
JoystickButton *left8 = new JoystickButton(leftStick, 8);
|
2015-10-09 19:21:03 -04:00
|
|
|
JoystickButton *left9 = new JoystickButton(leftStick, 9);
|
|
|
|
JoystickButton *left10 = new JoystickButton(leftStick, 10);
|
2015-02-21 08:43:19 -05:00
|
|
|
left1->WhileHeld(new RollIn(GetLeftThrottle()));
|
2015-03-08 15:32:45 -04:00
|
|
|
left2->WhileHeld(new RollOut(2.0));
|
2015-10-09 13:44:30 -04:00
|
|
|
//Disable/enable the compressor
|
|
|
|
left7->WhenPressed(new DisableCompressor(2));
|
|
|
|
left8->WhenPressed(new EnableCompressor(2));
|
|
|
|
//Open front collector wheels
|
|
|
|
left9->WhenPressed(new BinOpenArms(2));
|
|
|
|
left10->WhenPressed(new BinCloseArms(2));
|
2015-10-10 03:08:21 -04:00
|
|
|
|
2015-02-07 17:04:16 -05:00
|
|
|
// Elevator
|
2015-10-23 14:45:39 -04:00
|
|
|
JoystickButton *right1 = new JoystickButton(rightStick, 1);
|
|
|
|
JoystickButton *right2 = new JoystickButton(rightStick, 2);
|
2015-10-09 19:21:03 -04:00
|
|
|
JoystickButton *right3 = new JoystickButton(rightStick, 3);
|
2015-03-23 10:52:02 -04:00
|
|
|
JoystickButton *right4 = new JoystickButton(rightStick, 4);
|
2015-10-09 19:04:28 -04:00
|
|
|
JoystickButton *right5 = new JoystickButton(rightStick, 5);
|
2015-03-23 10:52:02 -04:00
|
|
|
JoystickButton *right6 = new JoystickButton(rightStick, 6);
|
2015-10-09 19:21:03 -04:00
|
|
|
|
2015-10-09 13:10:34 -04:00
|
|
|
//Full speed lift
|
2015-10-09 19:21:03 -04:00
|
|
|
right3->WhileHeld(new Lower(3.5,false,0.5));
|
|
|
|
right5->WhileHeld(new Lower(3.5,false,1));
|
|
|
|
right4->WhileHeld(new Raise(3.4,false,-0.5));
|
2015-10-09 19:55:17 -04:00
|
|
|
right4->WhileHeld(new RollIn(1));
|
2015-10-09 19:21:03 -04:00
|
|
|
right6->WhileHeld(new Raise(3.5,false,-1));
|
2015-10-09 19:36:37 -04:00
|
|
|
|
2015-10-23 14:45:39 -04:00
|
|
|
right1->WhenPressed(new BinOpenClaw(2));
|
|
|
|
right2->WhenPressed(new BinCloseClaw(2));
|
2015-01-17 12:21:16 -05:00
|
|
|
}
|
2015-07-31 12:52:15 -04:00
|
|
|
Joystick* OI::GetRightStick() {
|
2015-01-17 12:21:16 -05:00
|
|
|
return rightStick;
|
|
|
|
}
|
2015-07-31 12:52:15 -04:00
|
|
|
Joystick* OI::GetLeftStick() {
|
2015-01-17 12:21:16 -05:00
|
|
|
return leftStick;
|
2015-01-11 16:02:49 -05:00
|
|
|
}
|
2015-07-31 12:52:15 -04:00
|
|
|
double OI::GetRightThrottle() {
|
2015-02-15 17:10:20 -05:00
|
|
|
return (-rightStick->GetRawAxis(3)+1.0)/2;
|
|
|
|
}
|
2015-07-31 12:52:15 -04:00
|
|
|
double OI::GetLeftThrottle() {
|
2015-02-15 17:10:20 -05:00
|
|
|
return (-leftStick->GetRawAxis(3)+1.0)/2;
|
|
|
|
}
|
2015-02-08 12:26:15 -05:00
|
|
|
// vim: ts=2:sw=2:et
|