This repository has been archived by the owner on Aug 26, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
OI.h
117 lines (91 loc) · 3.4 KB
/
OI.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/**
* @file OI.h
* @brief Declaration of the Operator Interface
* @author Nyle Rodgers
*/
#ifndef OI_H
#define OI_H
#include "WPILib.h"
#include "CompilationSettings.h"
/**
* @brief The operator interface
*
* Provides means for the robot code to access the operator interface through
* Joystick objects, etc.
*
* @author Nyle Rodgers
*/
class OI {
public:
/// Constructor for the Operator Interface
OI();
#ifdef USE_PS3_CONTROLLER
Joystick* getPrimaryJoystick() { return primaryJoystick; }
#else
Joystick* getLeftPrimaryJoystick() { return leftPrimaryJoystick; }
Joystick* getRightPrimaryJoystick() { return rightPrimaryJoystick; }
#endif
Joystick* getSecondaryJoystick() { return secondaryJoystick; }
bool lowSpeedButtonPressed() { return lowSpeedButton->Get(); }
bool halfSpeedButtonPressed() { return halfSpeedButton->Get(); }
bool fullSpeedButtonPressed() { return fullSpeedButton->Get(); }
// TODO: Resolve line below not being <= 80 columns
bool quarterTurnSpeedButtonPressed() { return quarterTurnSpeedButton->Get(); }
bool halfTurnSpeedButtonPressed() { return halfTurnSpeedButton->Get(); }
bool fullTurnSpeedButtonPressed() { return fullTurnSpeedButton->Get(); }
bool turn180ButtonPressed() { return turn180Button->Get(); }
bool toggleClimberButtonPressed() { return toggleClimberButton->Get(); }
#ifdef USE_PISTON_ARTICULATOR
#ifdef PRIMARY_CONTROLS_ARTICULATOR
bool toggleArticulatorButtonPressed() { return toggleArticulatorButton->Get(); }
#endif
#endif
bool fireButtonPressed() { return fireButton->Get(); }
bool stopShooterButtonPressed() { return stopShooterButton->Get(); }
bool lowSetpointButtonPressed() { return lowSetpointButton->Get(); }
bool midSetpointButtonPressed() { return midSetpointButton->Get(); }
bool highSetpointButtonPressed() { return highSetpointButton->Get(); }
// TODO: Resolve lines below not being <= 80 columns
bool increaseSetpointButtonPressed() { return increaseSetpointButton->Get(); }
bool decreaseSetpointButtonPressed() { return decreaseSetpointButton->Get(); }
// Underglow controls
bool toggleRedButtonPressed() { return toggleRedButton->Get(); }
bool toggleGreenButtonPressed() { return toggleGreenButton->Get(); }
bool toggleBlueButtonPressed() { return toggleBlueButton->Get(); }
bool liftResetButtonPressed() { return liftResetButton->Get(); }
private:
#ifdef USE_PS3_CONTROLLER
Joystick *primaryJoystick;
#else
Joystick *leftPrimaryJoystick,
*rightPrimaryJoystick;
#endif
Joystick *secondaryJoystick;
// Primary driver buttons
JoystickButton *lowSpeedButton,
*halfSpeedButton,
*fullSpeedButton,
*quarterTurnSpeedButton,
*halfTurnSpeedButton,
*fullTurnSpeedButton,
*turn180Button,
*toggleClimberButton,
#ifdef USE_PISTON_ARTICULATOR
#ifdef PRIMARY_CONTROLS_ARTICULATOR
*toggleArticulatorButton,
#endif
#endif
// Secondary driver buttons
*fireButton,
*stopShooterButton,
*lowSetpointButton,
*midSetpointButton,
*highSetpointButton,
*increaseSetpointButton,
*decreaseSetpointButton,
*toggleRedButton,
*toggleGreenButton,
*toggleBlueButton,
*liftResetButton;
};
#endif // OI_H