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"
|
|
|
|
#include "Commands/Collector/OpenCollector.h"
|
|
|
|
#include "Commands/Collector/CloseCollector.h"
|
2015-02-13 19:40:23 -05:00
|
|
|
#include "Commands/Collector/RollIn.h"
|
|
|
|
#include "Commands/Collector/RollOut.h"
|
2015-02-13 21:41:38 -05:00
|
|
|
#include "Commands/BinElevator/BinLower.h"
|
|
|
|
#include "Commands/BinElevator/BinRaise.h"
|
2015-01-11 16:02:49 -05:00
|
|
|
|
|
|
|
OI::OI() {
|
2015-02-07 17:04:16 -05:00
|
|
|
// Joysticks
|
2015-01-17 12:21:16 -05:00
|
|
|
leftStick=new Joystick(0);
|
|
|
|
rightStick=new Joystick(1);
|
2015-02-07 17:04:16 -05:00
|
|
|
// Collector
|
2015-02-07 14:41:30 -05:00
|
|
|
JoystickButton *right1=new JoystickButton(rightStick, 1);
|
|
|
|
JoystickButton *right2=new JoystickButton(rightStick, 2);
|
2015-02-08 16:51:35 -05:00
|
|
|
JoystickButton *left1=new JoystickButton(leftStick, 1);
|
|
|
|
JoystickButton *left2=new JoystickButton(leftStick, 2);
|
|
|
|
right1->WhileHeld(new CloseCollector());
|
|
|
|
right2->WhileHeld(new OpenCollector());
|
2015-02-13 19:40:23 -05:00
|
|
|
left1->WhileHeld(new RollIn());
|
|
|
|
left2->WhileHeld(new RollOut());
|
2015-02-07 17:04:16 -05:00
|
|
|
// Elevator
|
2015-02-12 21:18:48 -05:00
|
|
|
raise=new Raise();
|
|
|
|
lower=new Lower();
|
2015-02-07 14:41:30 -05:00
|
|
|
JoystickButton *right4=new JoystickButton(rightStick, 4);
|
|
|
|
JoystickButton *right6=new JoystickButton(rightStick, 6);
|
2015-02-07 17:34:44 -05:00
|
|
|
right4->WhenPressed(lower);
|
|
|
|
right4->CancelWhenPressed(raise);
|
|
|
|
right6->WhenPressed(raise);
|
|
|
|
right6->CancelWhenPressed(lower);
|
2015-02-13 21:41:38 -05:00
|
|
|
// BinElevator
|
2015-02-14 13:45:54 -05:00
|
|
|
JoystickButton *right3=new JoystickButton(rightStick, 3);
|
|
|
|
JoystickButton *right5=new JoystickButton(rightStick, 5);
|
2015-02-13 21:41:38 -05:00
|
|
|
binRaise=new BinRaise();
|
|
|
|
binLower=new BinLower();
|
2015-02-14 13:45:54 -05:00
|
|
|
right3->WhenPressed(binLower);
|
|
|
|
right3->CancelWhenPressed(binRaise);
|
|
|
|
right5->WhenPressed(binRaise);
|
|
|
|
right5->CancelWhenPressed(binLower);
|
2015-02-07 17:34:44 -05:00
|
|
|
// Cancel
|
|
|
|
JoystickButton *right12=new JoystickButton(rightStick, 12);
|
|
|
|
right12->CancelWhenPressed(raise);
|
|
|
|
right12->CancelWhenPressed(lower);
|
2015-02-13 21:41:38 -05:00
|
|
|
right12->CancelWhenPressed(binRaise);
|
|
|
|
right12->CancelWhenPressed(binLower);
|
2015-01-17 12:21:16 -05:00
|
|
|
}
|
|
|
|
Joystick* OI::GetRightStick(){
|
|
|
|
return rightStick;
|
|
|
|
}
|
|
|
|
Joystick* OI::GetLeftStick(){
|
|
|
|
return leftStick;
|
2015-01-11 16:02:49 -05:00
|
|
|
}
|
2015-02-08 12:26:15 -05:00
|
|
|
// vim: ts=2:sw=2:et
|