-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathJVBotCompetition.c
More file actions
174 lines (149 loc) · 3.68 KB
/
JVBotCompetition.c
File metadata and controls
174 lines (149 loc) · 3.68 KB
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
#pragma config(Motor, port2, clawbaseleft, tmotorNormal, openLoop)
#pragma config(Motor, port3, leftwheel, tmotorNormal, openLoop, reversed)
#pragma config(Motor, port4, rightwheel, tmotorNormal, openLoop)
#pragma config(Motor, port5, clawmidleft, tmotorNormal, openLoop, reversed)
#pragma config(Motor, port6, clawmidright, tmotorNormal, openLoop)
#pragma config(Motor, port7, clawwheel, tmotorNormal, openLoop, reversed)
#pragma config(Motor, port8, motorTest, tmotorNormal, openLoop, reversed)
#pragma config(Motor, port9, clawbaseright, tmotorNormal, openLoop, reversed)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
#pragma platform(VEX)
//Competition Control and Duration Settings
#pragma competitionControl(Competition)
#pragma autonomousDuration(20)
#pragma userControlDuration(120) //Main competition background code...do not modify!
#include "Vex_Competition_Includes.c"
/* BroBots - The Bishop's School 2011-2012 Robotics Team JV Bot */
/* v0.1 */
/*5U clawbaseleft, clawbaseright both 127
5D clawbaseleft, clawbaseright both -127
6U clawmidleft, clawmidright both 127
6D clawmidleft, clawmidright both -127
*/
int threshold = 12.7;
bool RaiseIsActivated = false;
/* Strategy methods */
void AI()
{
return;
}
/* Control flow */
void startAutonomousFunctions()
{
// .....................................................................................
// Insert user code here.
// .....................................................................................
AI();
}
task autonomous()
{
startAutonomousFunctions(); // so we don't have to deal with multitasking weirdness
}
void testManualMode()
{
while(true)
{
motor[clawbaseleft] = 127;
motor[clawbaseright] = 127;
}
}
void startManualMode()
{
// User control code here, inside the loop
while (true)
{
if(vexRT[Btn7D] == 1)
{
motor[motorTest] = 127;
}
else
{
motor[motorTest] = 0;
}
//Base Wheels
//Left Base Wheel
if (abs(vexRT[Ch3]) > threshold)
{
motor[leftwheel] = (vexRT[Ch3]);//Left joystick Y value
}
else
{
motor[leftwheel] = 0;//Stop the left motor
}
//Right Base Wheel
if (abs(vexRT[Ch2]) > threshold)
{
motor[rightwheel] = (vexRT[Ch2]);//Right joystick Y value
}
else
{
motor[rightwheel] = 0;//Stop the right motor
}
if(vexRT[Btn7D] == 1)
{
motor[clawwheel] = 127;
}
else
{
motor[clawwheel] = 0;
}
//Base Wheels
//Left Base Wheel
if (vexRT[Btn5U] == 1)
{
motor[clawbaseleft] = 127;
motor[clawbaseright] = 127;
}
else
{
motor[clawbaseleft] = 0;
motor[clawbaseright] = 0;
}
if (vexRT[Btn5D] == 1)
{
motor[clawbaseleft] = -127;
motor[clawbaseright] = -127;
}
else
{
motor[clawbaseleft] = 0;
motor[clawbaseright] = 0;
}
if (vexRT[Btn6U] == 1)
{
motor[clawmidleft] = 127;
motor[clawmidright] = 127;
}
else
{
motor[clawmidleft] = 0;
motor[clawmidright] = 0;
}
if (vexRT[Btn6D] == 1)
{
motor[clawmidleft] = -127;
motor[clawmidright] = -127;
}
else
{
motor[clawmidleft] = 0;
motor[clawmidright] = 0;
}
}
}
task usercontrol()
{
startManualMode(); // so we don't have to deal with multitasking weirdness
}
void debugMain()
{
//startAutonomousFunctions();
startManualMode();
//testManualMode();
}
void pre_auton()
{
// All activities that occur before the competition starts
// Example: clearing encoders, setting servo positions, ...
// Nothing here.
}