-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAutonomous_Chooser.c
177 lines (154 loc) · 5 KB
/
Autonomous_Chooser.c
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
#pragma config(Hubs, S1, HTMotor, HTMotor, HTMotor, HTServo)
#pragma config(Sensor, S1, , sensorI2CMuxController)
#pragma config(Sensor, S2, Ultra, sensorSONAR)
#pragma config(Sensor, S3, Ultra2, sensorSONAR)
#pragma config(Sensor, S4, IR, sensorHiTechnicIRSeeker600)
#pragma config(Motor, motorA, , tmotorNXT, openLoop)
#pragma config(Motor, motorB, , tmotorNXT, openLoop)
#pragma config(Motor, motorC, , tmotorNXT, openLoop)
#pragma config(Motor, mtr_S1_C1_1, mLift2, tmotorTetrix, openLoop, reversed)
#pragma config(Motor, mtr_S1_C1_2, mRight, tmotorTetrix, openLoop, reversed, encoder)
#pragma config(Motor, mtr_S1_C2_1, mLift1, tmotorTetrix, openLoop, reversed)
#pragma config(Motor, mtr_S1_C2_2, mFlag, tmotorTetrix, openLoop)
#pragma config(Motor, mtr_S1_C3_1, mLeft, tmotorTetrix, openLoop)
#pragma config(Motor, mtr_S1_C3_2, mWrist, tmotorTetrix, openLoop)
#pragma config(Servo, srvo_S1_C4_1, AutoHook, tServoStandard)
#pragma config(Servo, srvo_S1_C4_2, servo2, tServoNone)
#pragma config(Servo, srvo_S1_C4_3, servo3, tServoNone)
#pragma config(Servo, srvo_S1_C4_4, servo4, tServoNone)
#pragma config(Servo, srvo_S1_C4_5, servo5, tServoNone)
#pragma config(Servo, srvo_S1_C4_6, servo6, tServoNone)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
#define left 1
#define right -1
// whether the user has finished selecting a delay time
bool timeSelected = false;
// whether the robot will wait for the FCS to start (disable when testing)
bool startSelected = false;
// whether the user has selected to delay at the beginning of autonomous
bool waitSelected = true;
// how many seconds to delay before starting autonomous (used for coordinating with
// other teams)
int waitTime = 0;
// the message used by the wait prompt
string wait = "Yes";
//holds which autonomous program we will be running
int programCounter = 1;
//holds the maximum amount of autonomous programs we can run
int max = 6;
//holds which beacon the robot is at
int beacon = 0;
//holds the IR sensor value
int i = 0;
int additional = 0;
// standard library for talking to Samantha FCS
#include "JoystickDriver.c"
// our team-built function library
#include "FunctionLibrary.c"
//our team-built Autonomous library
#include "AutonomousLibrary_NorCal.c"
task main()
{
selectTime();
startSelect();
while(true)
{
counter();
if(programCounter == 1)
{
nxtDisplayCenteredTextLine(2, "Regular Autonomous");
if(nNxtButtonPressed == 3)
{
PlaySound(soundBlip);
if(waitSelected){waitForStart();}
wait1Msec(waitTime*1000);
Auto_Encoder();
wait1Msec(500);
}
}
else if(programCounter == 2)
{
nxtDisplayCenteredTextLine(2, "FA to FR");
if(nNxtButtonPressed == 3)
{
PlaySound(soundBlip);
if(waitSelected){waitForStart();}
wait1Msec(waitTime*1000);
Auto_Front_Ramp();
wait1Msec(500);
}
}
else if(programCounter == 3)
{
nxtDisplayCenteredTextLine(2, "FA to BR");
if(nNxtButtonPressed == 3)
{
PlaySound(soundBlip);
if(waitSelected){waitForStart();}
wait1Msec(waitTime*1000);
Auto_Back_Ramp();
wait1Msec(500);
}
}
else if(programCounter == 4)
{
nxtDisplayCenteredTextLine(2, "Hardcoded Autonomous()");
if(nNxtButtonPressed == 3)
{
PlaySound(soundBlip);
Hardcoded_Autonomous();
if(waitSelected){waitForStart();}
wait1Msec(waitTime*1000);
wait1Msec(500);
}
}
else if(programCounter == 5)
{
nxtDisplayCenteredTextLine(2, "Hardcoded Reverse");
if(nNxtButtonPressed == 3)
{
PlaySound(soundBlip);
if(waitSelected){waitForStart();}
wait1Msec(waitTime * 1000);
Hardcoded_Reverse();
wait1Msec(500);
}
}
else if(programCounter == 5)
{
nxtDisplayCenteredTextLine(2, "New IR");
if(nNxtButtonPressed == 3)
{
PlaySound(soundBlip);
if(waitSelected){waitForStart();}
wait1Msec(waitTime*1000);
IR_Tester();
wait1Msec(500);
}
}
//else if(programCounter == 6)
//{
// nxtDisplayCenteredTextLine(2, "RA to FR");
// if(nNxtButtonPressed == 3)
// {
// PlaySound(soundBlip);
// if(waitSelected){waitForStart();}
// wait1Msec(waitTime*1000);
// Reverse_Auto_Front_Ramp();
// wait1Msec(500);
// }
//}
//else if(programCounter == 7)
//{
// nxtDisplayCenteredTextLine(2, "RA to BR");
// if(nNxtButtonPressed == 3)
// {
// PlaySound(soundBlip);
// if(waitSelected) {waitForStart();}
// wait1Msec(waitTime * 1000);
// Reverse_Auto_Back_Ramp();
// wait1Msec(500);
// }
//}
}
}