9
9
10
10
#include " Robot.h"
11
11
12
+
12
13
void Robot::RobotInit () {
13
14
compressor.Stop ();
15
+ timer.Start ();
14
16
}
15
17
16
18
void Robot::RobotPeriodic () {
17
19
// Vision
18
- // CHECK THIS BASIL
19
20
UsbCamera floorCamera = CameraServer::GetInstance ()->StartAutomaticCapture (0 );
20
21
UsbCamera driverCamera = CameraServer::GetInstance ()->StartAutomaticCapture (1 );
21
22
driverCamera.SetResolution (320 , 240 );
@@ -27,11 +28,11 @@ void Robot::RobotPeriodic() {
27
28
while (true ) {
28
29
if (cvSink.GrabFrame (mat) == 0 ) {
29
30
outputStream.NotifyError (cvSink.GetError ());
31
+ }
32
+ rectangle (mat, Point (100 , 100 ), Point (400 , 400 ), Scalar (255 , 255 , 255 ), 5 );
33
+ outputStream.PutFrame (mat);
30
34
}
31
- rectangle (mat, Point (100 , 100 ), Point (400 , 400 ), Scalar (255 , 255 , 255 ), 5 );
32
- outputStream.PutFrame (mat);
33
- }
34
- // END OF CHECK THIS BASIL
35
+
35
36
// Compressor
36
37
if (fightStick.GetRawButton (8 ) == 1 ) {
37
38
compressor.Start ();
@@ -42,33 +43,33 @@ void Robot::RobotPeriodic() {
42
43
// Drive
43
44
if (flightStick.GetRawButton (2 ) == 1 ) { // Slow
44
45
if (flightStick.GetRawAxis (1 ) > 0 || flightStick.GetRawAxis (1 ) < 0 ) {
45
- if (0 <time .Get <(f/2 )) {
46
- Drive.CurvatureDrive (( flightStick.GetRawAxis (1 )/ 2 *sin ((((2 * M_PI)/f)*time .Get ()) - M_PI_2)+ flightStick.GetRawAxis (1 )/ 2 ) * -1 * speedSlow, flightStick.GetRawAxis (2 ) * turningSpeedSlow, flightStick.GetRawButton (1 ));
46
+ if (0 <timer .Get () <(f/2 )) {
47
+ Drive.CurvatureDrive (flightStick.GetRawAxis (1 ) / 2 *sin ((((2 * M_PI) / f) * timer .Get () - M_PI_2) + flightStick.GetRawAxis (1 ) / 2 ) * -1 * speedSlow, flightStick.GetRawAxis (2 ) * turningSpeedSlow, flightStick.GetRawButton (1 ));
47
48
} else {
48
49
Drive.CurvatureDrive (flightStick.GetRawAxis (1 ) * -1 * speedSlow, flightStick.GetRawAxis (2 ) * turningSpeedSlow, flightStick.GetRawButton (1 ));
49
50
}
50
51
} else {
51
- time .Reset ();
52
+ timer .Reset ();
52
53
}
53
54
} else if (flightStick.GetRawButton (11 /* Will Change*/ ) == 1 ) { // Fast
54
55
if (flightStick.GetRawAxis (1 ) > 0 || flightStick.GetRawAxis (1 ) < 0 ) {
55
- if (0 <time .Get ()<(f/2 )) {
56
- Drive.CurvatureDrive (( flightStick.GetRawAxis (1 )/2 *sin ((((2 * M_PI)/f)*time .Get () ) - M_PI_2)+flightStick.GetRawAxis (1 )/2 ) * -1 * speedFast, flightStick.GetRawAxis (2 ) * turningSpeedFast, flightStick.GetRawButton (1 ));
56
+ if (0 <timer .Get ()<(f/2 )) {
57
+ Drive.CurvatureDrive (flightStick.GetRawAxis (1 )/2 *sin ((((2 * M_PI)/f)*timer .Get () - M_PI_2)+flightStick.GetRawAxis (1 )/2 ) * -1 * speedFast, flightStick.GetRawAxis (2 ) * turningSpeedFast, flightStick.GetRawButton (1 ));
57
58
} else {
58
59
Drive.CurvatureDrive (flightStick.GetRawAxis (1 ) * -1 * speedFast, flightStick.GetRawAxis (2 ) * turningSpeedFast, flightStick.GetRawButton (1 ));
59
60
}
60
61
} else {
61
- time .Reset ();
62
+ timer .Reset ();
62
63
}
63
64
} else { // Normal
64
65
if (flightStick.GetRawAxis (1 ) > 0 || flightStick.GetRawAxis (1 ) < 0 ) {
65
- if (0 <time .Get ()<(f/2 )) {
66
- Drive.CurvatureDrive (( flightStick.GetRawAxis (1 )/2 *sin ((((2 * M_PI)/f)*time .Get () ) - M_PI_2)+flightStick.GetRawAxis (1 )/2 ) * -1 * speedNormal, flightStick.GetRawAxis (2 ) * turningSpeedSlow, flightStick.GetRawButton (1 ));
66
+ if (0 <timer .Get ()<(f/2 )) {
67
+ Drive.CurvatureDrive (flightStick.GetRawAxis (1 )/2 *sin ((((2 * M_PI)/f)*timer .Get () - M_PI_2)+flightStick.GetRawAxis (1 )/2 ) * -1 * speedNormal, flightStick.GetRawAxis (2 ) * turningSpeedSlow, flightStick.GetRawButton (1 ));
67
68
} else {
68
69
Drive.CurvatureDrive (flightStick.GetRawAxis (1 ) * -1 * speedNormal, flightStick.GetRawAxis (2 ) * turningSpeedSlow, flightStick.GetRawButton (1 ));
69
70
}
70
71
} else {
71
- time .Reset ();
72
+ timer .Reset ();
72
73
}
73
74
}
74
75
// HAB Lift(???)
@@ -123,7 +124,7 @@ void Robot::RobotPeriodic() {
123
124
}
124
125
125
126
// Hatch Panel Launcher
126
- // They are set backwards if time is avaible would like to switch them around in both the code and wiring
127
+ // They are set backwards if timerr is avaible would like to switch them around in both the code and wiring
127
128
if (fightStick.GetRawButton (4 ) == 0 ) {
128
129
s_panelLauncherBottom.Set (DoubleSolenoid::kForward );
129
130
s_panelLauncherTop.Set (DoubleSolenoid::kForward );
0 commit comments