-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAllieHoop.h
130 lines (118 loc) · 4.28 KB
/
AllieHoop.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
118
119
120
121
122
123
124
125
126
127
128
129
130
#include "WPILib.h"
class RobotDemo : public SimpleRobot
{
//cRIO Slots
static const UINT8 ANALOG_SIDECAR_MODULE_1 = 1;
static const UINT8 DIGITAL_SIDECAR_MODULE_1 = 1;
static const UINT8 SOLENOID_SIDECAR_MODULE_1 = 1;
static const UINT8 DIGITAL_SIDECAR_MODULE_2 = 2;
// Sidecars
static const UINT8 SCOOP_MOTOR_SIDECAR = DIGITAL_SIDECAR_MODULE_1;
static const UINT8 REAR_LEFT_MOTOR_SIDECAR = DIGITAL_SIDECAR_MODULE_2;
static const UINT8 REAR_RIGHT_MOTOR_SIDECAR = DIGITAL_SIDECAR_MODULE_1;
static const UINT8 FRONT_LEFT_MOTOR_SIDECAR = DIGITAL_SIDECAR_MODULE_2;
static const UINT8 FRONT_RIGHT_MOTOR_SIDECAR = DIGITAL_SIDECAR_MODULE_1;
static const UINT8 BRUSH_MOTOR_SIDECAR = DIGITAL_SIDECAR_MODULE_2;
static const UINT8 ELEVATOR_SIDECAR = DIGITAL_SIDECAR_MODULE_2;
static const UINT8 COMPRESSOR_SIDECAR = DIGITAL_SIDECAR_MODULE_1;
static const UINT8 BOTTOM_WHEELS_MOTOR_SIDECAR = DIGITAL_SIDECAR_MODULE_1;
static const UINT8 LAUNCHER_IN_SIDECAR = SOLENOID_SIDECAR_MODULE_1;
static const UINT8 LAUNCHER_OUT_SIDECAR = SOLENOID_SIDECAR_MODULE_1;
static const UINT8 WHEELS_DOWN_SIDECAR = SOLENOID_SIDECAR_MODULE_1;
static const UINT8 LOW_LIGHT_SENSOR_SIDECAR = DIGITAL_SIDECAR_MODULE_2;
static const UINT8 HIGH_LIGHT_SENSOR_SIDECAR = DIGITAL_SIDECAR_MODULE_2;
static const UINT8 SCOOP_UP_SIDECAR = DIGITAL_SIDECAR_MODULE_1;
static const UINT8 SCOOP_DOWN_SIDECAR = DIGITAL_SIDECAR_MODULE_1;
static const UINT8 COMPRESSOR_SWITCH_SIDECAR = DIGITAL_SIDECAR_MODULE_2;
static const UINT8 BOTTOM_WHEELS_ENCODER_SIDECAR_A = DIGITAL_SIDECAR_MODULE_2;
static const UINT8 BOTTOM_WHEELS_ENCODER_SIDECAR_B = DIGITAL_SIDECAR_MODULE_2;
// PWMS
static const UINT32 SCOOP_MOTOR_PWM = 5;
static const UINT32 REAR_LEFT_MOTOR_PWM = 2;
static const UINT32 REAR_RIGHT_MOTOR_PWM = 2;
static const UINT32 FRONT_LEFT_MOTOR_PWM = 1;
static const UINT32 FRONT_RIGHT_MOTOR_PWM = 1;
static const UINT32 BRUSH_MOTOR_PWM = 2;
static const UINT32 ELEVATOR_PWM = 1;
static const UINT32 COMPRESSOR_PWM = 4;
static const UINT32 BOTTOM_WHEELS_MOTOR_PWM = 8;
static const UINT32 LAUNCHER_IN_PWM = 3;
static const UINT32 LAUNCHER_OUT_PWM = 2;
static const UINT32 WHEELS_DOWN_PWM = 1;
static const UINT32 LOW_LIGHT_SENSOR_PWM = 7;
static const UINT32 HIGH_LIGHT_SENSOR_PWM = 8;
static const UINT32 SCOOP_UP_PWM = 3; // LIMIT SWITCH
static const UINT32 SCOOP_DOWN_PWM = 4;// LIMIT SWITCH
static const UINT32 COMPRESSOR_SWITCH_PWM = 9;
static const UINT32 BOTTOM_WHEELS_ENCODER_PWM_A = 5;
static const UINT32 BOTTOM_WHEELS_ENCODER_PWM_B = 6;
// Joystick 1 buttons
static const UINT32 GRIPPYS_DOWN = 2;
static const UINT32 SCOOP_BRIDGE = 9;
static const UINT32 SCOOP_BALLS = 7;
static const UINT32 SCOOP_DOWN = 11;
static const UINT32 SCOOP_UP = 12;
// Joystick 2 buttons
static const UINT32 FIRE_BUTTON = 1;
static const UINT32 ELEVATOR_FOWARD = 11;
static const UINT32 ELEVATOR_REVERSE = 10;
static const UINT32 FENDER_BUTTON = 2;
static const UINT32 KEY_BUTTON = 3;
static const UINT32 REDUCE_FLYWHEEL_SPEED = 4;
static const UINT32 INCREASE_FLYWHEEL_SPEED = 5;
static const UINT32 FLYWHEELS_ON = 9;
static const UINT32 FLYWHEELS_OFF = 6;
static const UINT32 RUN_BRUSH_MOTOR = 8;
static const float fender ;
static const float key ;
int autostate;
int ballsInHigh;
int ballsInLow;
float pidOutput;
float scoopMotorValue;
bool launcherOutSet;
bool launcherInSet;
bool waitForLeaving;
bool fireButton;
bool flywheelsOn;
bool autoscoop;
bool runBrush;
bool ballInTop;
bool previousLowLightSensorValue;
bool button1;
Joystick stick1;
Joystick stick2;
Jaguar scoopMotor;
Jaguar rearLeftMotor;
Jaguar rearRightMotor;//inverted
Jaguar frontLeftMotor;
Jaguar frontRightMotor;//inverted
Relay brushMotor;
Relay elevator;
Relay compressor;
Victor bottomWheelsMotor;
Solenoid launcherIn;
Solenoid launcherOut;
Solenoid wheelsDown;
DigitalInput lowLightSensor;
DigitalInput highLightSensor;
DigitalInput scoopUp;
DigitalInput scoopDown;
DigitalInput compressorSwitch;
Encoder leftWheels;
Encoder rightWheels;
Encoder bottomWheels;
PIDController flywheelspeed;
Timer stopwatch;
Timer stopwatch1;
RobotDrive myRobot; // robot drive system
void Drive();
void Scoop();
void Elevator();
void Shoot();
float ConvertAxis(float input);
public:
RobotDemo(void);
void Autonomous(void);
void OperatorControl(void);
};