@@ -16,27 +16,21 @@ void Robot::RobotInit() {
16
16
}
17
17
18
18
void Robot::RobotPeriodic () {
19
- cs:: UsbCamera floorCamera = frc:: CameraServer::GetInstance ()->StartAutomaticCapture (0 );
20
- cs:: UsbCamera driverCamera = frc:: CameraServer::GetInstance ()->StartAutomaticCapture (1 );
19
+ UsbCamera floorCamera = CameraServer::GetInstance ()->StartAutomaticCapture (0 );
20
+ UsbCamera driverCamera = CameraServer::GetInstance ()->StartAutomaticCapture (1 );
21
21
driverCamera.SetResolution (320 , 240 );
22
22
floorCamera.SetResolution (640 , 480 );
23
- cs:: CvSink cvSink = frc:: CameraServer::GetInstance ()->GetVideo ();
24
- cs:: CvSource outputStream = frc:: CameraServer::GetInstance ()->PutVideo (" Rectangle" , 640 , 480 );
25
- cv:: Mat mat;
23
+ CvSink cvSink = CameraServer::GetInstance ()->GetVideo ();
24
+ CvSource outputStream = CameraServer::GetInstance ()->PutVideo (" Rectangle" , 640 , 480 );
25
+ Mat mat;
26
26
while (true ) {
27
27
if (cvSink.GrabFrame (mat) == 0 ) {
28
28
outputStream.NotifyError (cvSink.GetError ());
29
29
}
30
- rectangle (mat, cv:: Point (100 , 100 ), cv:: Point (400 , 400 ), cv:: Scalar (255 , 255 , 255 ), 5 );
30
+ rectangle (mat, Point (100 , 100 ), Point (400 , 400 ), Scalar (255 , 255 , 255 ), 5 );
31
31
outputStream.PutFrame (mat);
32
32
}
33
- }
34
-
35
- void Robot::AutonomousInit () {
36
- // NO AUTONOMOUS
37
- }
38
33
39
- void Robot::AutonomousPeriodic () { // Same code for both Auto and Teleop, can't find a way to continue from one to other so both modes have the same code
40
34
// Compressor
41
35
if (fightStick.GetRawButton (8 ) == 1 ) {
42
36
compressor.Start ();
@@ -67,19 +61,19 @@ void Robot::AutonomousPeriodic() { //Same code for both Auto and Teleop, can't f
67
61
// HAB Lift(???)
68
62
// Font
69
63
if (flightStick.GetRawButton (7 ) == 1 ) {
70
- s_HABfront.Set (frc:: DoubleSolenoid::kForward );
64
+ s_HABfront.Set (DoubleSolenoid::kForward );
71
65
} else if (flightStick.GetRawButton (7 ) == 0 ) {
72
- s_HABfront.Set (frc:: DoubleSolenoid::kReverse );
66
+ s_HABfront.Set (DoubleSolenoid::kReverse );
73
67
} else {
74
- s_HABfront.Set (frc:: DoubleSolenoid::kOff );
68
+ s_HABfront.Set (DoubleSolenoid::kOff );
75
69
}
76
70
// Back
77
71
if (flightStick.GetRawButton (8 ) == 1 ) {
78
- s_HABback.Set (frc:: DoubleSolenoid::kForward );
72
+ s_HABback.Set (DoubleSolenoid::kForward );
79
73
} else if (flightStick.GetRawButton (8 ) == 0 ) {
80
- s_HABback.Set (frc:: DoubleSolenoid::kReverse );
74
+ s_HABback.Set (DoubleSolenoid::kReverse );
81
75
} else {
82
- s_HABback.Set (frc:: DoubleSolenoid::kOff );
76
+ s_HABback.Set (DoubleSolenoid::kOff );
83
77
}
84
78
85
79
// Forklift Thomas special clutch idea for forklift
@@ -118,119 +112,39 @@ void Robot::AutonomousPeriodic() { //Same code for both Auto and Teleop, can't f
118
112
// Hatch Panel Launcher
119
113
// They are set backwards if time is avaible would like to switch them around in both the code and wiring
120
114
if (fightStick.GetRawButton (4 ) == 0 ) {
121
- s_panelLauncherBottom.Set (frc:: DoubleSolenoid::kForward );
122
- s_panelLauncherTop.Set (frc:: DoubleSolenoid::kForward );
115
+ s_panelLauncherBottom.Set (DoubleSolenoid::kForward );
116
+ s_panelLauncherTop.Set (DoubleSolenoid::kForward );
123
117
} else if (fightStick.GetRawButton (4 ) == 1 ) {
124
- s_panelLauncherBottom.Set (frc:: DoubleSolenoid::kReverse );
125
- s_panelLauncherTop.Set (frc:: DoubleSolenoid::kReverse );
118
+ s_panelLauncherBottom.Set (DoubleSolenoid::kReverse );
119
+ s_panelLauncherTop.Set (DoubleSolenoid::kReverse );
126
120
} else {
127
- s_panelLauncherBottom.Set (frc:: DoubleSolenoid::kForward );
128
- s_panelLauncherTop.Set (frc:: DoubleSolenoid::kForward );
121
+ s_panelLauncherBottom.Set (DoubleSolenoid::kForward );
122
+ s_panelLauncherTop.Set (DoubleSolenoid::kForward );
129
123
}
130
- // input.GetVoltage();
124
+ SmartDashboard::PutNumber (" Pi Value" , pi.GetVoltage ());
125
+ // Add delay
131
126
}
132
127
133
- void Robot::TeleopInit () {
134
- // Nothing that I can think of
128
+ void Robot::AutonomousInit () {
129
+ // NO AUTONOMOUS
135
130
}
136
131
137
- void Robot::TeleopPeriodic () {
138
- // Compressor
139
- if (fightStick.GetRawButton (8 ) == 1 ) {
140
- compressor.Start ();
141
- } else {
142
- compressor.Stop ();
143
- }
144
-
145
- // Drive
146
- if (flightStick.GetRawButton (2 ) == 1 ) { // Slow
147
- if (flightStick.GetRawAxis (1 ) > 0 || flightStick.GetRawAxis (1 ) < 0 ) {
148
- Drive.CurvatureDrive ((flightStick.GetRawAxis (1 ) * pow (time.Get (), 2 )) * -1 * speedSlow, flightStick.GetRawAxis (2 ) * turningSpeedFast, flightStick.GetRawButton (1 ));
149
- } else {
150
- time.Reset ();
151
- }
152
- } else if (flightStick.GetRawButton (12 /* Will Change*/ ) == 1 ) { // Fast
153
- if (flightStick.GetRawAxis (1 ) > 0 || flightStick.GetRawAxis (1 ) < 0 ) {
154
- Drive.CurvatureDrive ((flightStick.GetRawAxis (1 ) * pow (time.Get (), 2 )) * -1 * speedFast, flightStick.GetRawAxis (2 ) * turningSpeedFast, flightStick.GetRawButton (1 ));
155
- } else {
156
- time.Reset ();
157
- }
158
- } else { // Normal
159
- if (flightStick.GetRawAxis (1 ) > 0 || flightStick.GetRawAxis (1 ) < 0 ) {
160
- Drive.CurvatureDrive ((flightStick.GetRawAxis (1 ) * pow (time.Get (), 2 )) * -1 * speedNormal, flightStick.GetRawAxis (2 ) * turningSpeedSlow, flightStick.GetRawButton (1 ));
161
- } else {
162
- time.Reset ();
163
- }
164
- }
165
- // HAB Lift(???)
166
- // Font
167
- if (flightStick.GetRawButton (7 ) == 1 ) {
168
- s_HABfront.Set (frc::DoubleSolenoid::kForward );
169
- } else if (flightStick.GetRawButton (7 ) == 0 ) {
170
- s_HABfront.Set (frc::DoubleSolenoid::kReverse );
171
- } else {
172
- s_HABfront.Set (frc::DoubleSolenoid::kOff );
173
- }
174
- // Back
175
- if (flightStick.GetRawButton (8 ) == 1 ) {
176
- s_HABback.Set (frc::DoubleSolenoid::kForward );
177
- } else if (flightStick.GetRawButton (8 ) == 0 ) {
178
- s_HABback.Set (frc::DoubleSolenoid::kReverse );
179
- } else {
180
- s_HABback.Set (frc::DoubleSolenoid::kOff );
181
- }
132
+ void Robot::AutonomousPeriodic () {
133
+ // Nothing
134
+ }
182
135
183
- // Forklift Thomas special clutch idea for forklift
184
- // POV is 0=UP 90=Right 180=Down 270=Left and 45 for all the angles
185
- // .GetPOV("0") is the number for the POV system things switch
186
- if (fightStick.GetPOV (0 ) == 315 ) { // Up
187
- if (fightStick.GetRawButton (5 ) == 1 ) {
188
- m_forklift.Set (upSpeedFast);
189
- } else {
190
- m_forklift.Set (upSpeedNormal);
191
- }
192
- } else if (fightStick.GetPOV (0 ) == 225 ) { // Down
193
- if (fightStick.GetRawButton (5 ) == 1 ) {
194
- m_forklift.Set (downSpeedFast);
195
- } else {
196
- m_forklift.Set (downSpeedNormal);
197
- }
198
- } else if (fightStick.GetPOV (0 ) == 270 ) { // Stall
199
- m_forklift.Set (stall);
200
- } else {
201
- m_forklift.Set (0 );
202
- }
203
-
204
- // Ball Intake
205
- if (fightStick.GetRawButton (1 ) == 1 ) {
206
- m_leftIntake.Set (.5 );// +
207
- m_rightIntake.Set (-.5 );
208
- } else if (fightStick.GetRawButton (3 ) == 1 ) {
209
- m_leftIntake.Set (-.5 );
210
- m_rightIntake.Set (.5 );
211
- } else {
212
- m_leftIntake.Set (0 );
213
- m_rightIntake.Set (0 );
214
- }
136
+ void Robot::TeleopInit () {
137
+ // Nothing
138
+ }
215
139
216
- // Hatch Panel Launcher
217
- // They are set backwards if time is avaible would like to switch them around in both the code and wiring
218
- if (fightStick.GetRawButton (4 ) == 0 ) {
219
- s_panelLauncherBottom.Set (frc::DoubleSolenoid::kForward );
220
- s_panelLauncherTop.Set (frc::DoubleSolenoid::kForward );
221
- } else if (fightStick.GetRawButton (4 ) == 1 ) {
222
- s_panelLauncherBottom.Set (frc::DoubleSolenoid::kReverse );
223
- s_panelLauncherTop.Set (frc::DoubleSolenoid::kReverse );
224
- } else {
225
- s_panelLauncherBottom.Set (frc::DoubleSolenoid::kForward );
226
- s_panelLauncherTop.Set (frc::DoubleSolenoid::kForward );
227
- }
228
- // input.GetVoltage();
140
+ void Robot::TeleopPeriodic () {
141
+ // Nothing
229
142
}
230
143
231
144
void Robot::TestPeriodic () {
145
+ // Nothing
232
146
}
233
147
234
148
#ifndef RUNNING_FRC_TESTS
235
- int main () { return frc:: StartRobot<Robot>(); }
149
+ int main () { return StartRobot<Robot>(); }
236
150
#endif
0 commit comments