1
- bool prevState = false;
2
- bool currState = false;
3
- bool driveTankMode = false;
4
-
5
- while (IsOperatorControl())
6
- {
7
- //
8
- // Check for button 6 press.
9
- //
10
- currState = secondaryController->GetRawButton(6);
11
- if (currState != prevState)
12
- {
13
- if (currState)
14
- {
15
- //
16
- // Button has been pressed.
17
- //
18
- driveTankMode = !driveTankMode;
19
- }
20
- else
21
- {
22
- //
23
- // Button has been released.
24
- //
25
- }
26
- prevState = currState;
27
- }
28
-
29
- if (driveTankMode)
30
- {
31
- //
32
- // Do tank drive.
33
- //
34
- }
35
- else
36
- {
37
- //
38
- // Do arcade drive.
39
- //
40
- }
41
-
42
- wait(0.02);
43
- }
44
-
45
-
46
-
47
-
48
1
/*----------------------------------------------------------------------------*/
49
2
/* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
50
3
/* Open Source Software - may be modified and shared by FRC teams. The code */
@@ -66,27 +19,37 @@ class Robot : public frc::TimedRobot {
66
19
public:
67
20
Robot() {}
68
21
69
- void RobotInit() override {}
22
+ void RobotInit() override {
23
+ compressor.Start();
24
+ };
70
25
void RobotPeriodic() override {}
71
- void AutonomousInit() override {}
72
- void AutonomousPeriodic() override {}
73
-
74
- void TeleopInit() override {
75
- compressor.Start();
76
- }
26
+ void AutonomousInit() override {
27
+ time.Reset();
28
+ time.Start();
29
+ };
30
+
31
+ void AutonomousPeriodic() override {
32
+ };
33
+ void TeleopInit() override {}
77
34
78
35
void TeleopPeriodic() override {
36
+ //Miscelanious
37
+ //Compressor Toggle(Later Amigo)
38
+
39
+ //Drive(Workds)
79
40
//Drivebase(Works)
80
- //The * -1 is to inverse motors, and the / 2 is to slow down regular turing and the / 3 if for presicion drive
41
+ //Want to test /3 for presion turning only
42
+ //The * -1 is to inverse motors, and the / 2 is to slow down regular turing and the / 2 if for presicion drive
81
43
//the else if statments is mostly likely unneeded, will test with and without so see if it is needed
82
44
// 3 = A button
83
45
if (xbox.GetRawButton(3) == 1) {
84
46
Drive.ArcadeDrive(xbox.GetRawAxis(1) * -1 / 2, xbox.GetRawAxis(0) / 2);
85
47
} else if (xbox.GetRawButton(3) == 0) {
86
- Drive.ArcadeDrive(xbox.GetRawAxis(1) * -1, xbox.GetRawAxis(0) / 2);
48
+ Drive.ArcadeDrive(xbox.GetRawAxis(1) * -1 * .7 , xbox.GetRawAxis(0) / 2);
87
49
} else {
88
- Drive.ArcadeDrive(xbox.GetRawAxis(1) * -1, xbox.GetRawAxis(0) / 2);
50
+ Drive.ArcadeDrive(xbox.GetRawAxis(1) * -1 * .7 , xbox.GetRawAxis(0) / 2);
89
51
}
52
+ //HAB Lift(Untested)
90
53
//HAB lift
91
54
//Front(Untested)
92
55
//Using trigger axis for ease of use for operator but idk if the code will work like I have it
@@ -105,28 +68,28 @@ class Robot : public frc::TimedRobot {
105
68
} else {
106
69
s_HABback.Set(frc::DoubleSolenoid::kOff);
107
70
}
108
-
71
+ //Forklift(Workds)
109
72
//Forlift (Works)
110
73
//POV is 0=UP 90=Right 180=Down 270=Left and 45 for all the angles
111
- // the "== 1" might have to be "== 0/180" corresponcding to the angle
74
+ //.GetPOV("0") is the number for the POV system things switch
112
75
if (arcadePad.GetPOV(0) == 0) {
113
76
m_forklift.Set(.5);
114
77
} else if (arcadePad.GetPOV(0) == 180) {
115
78
m_forklift.Set(-.5);
116
79
} else {
117
80
m_forklift.Set(0);
118
81
}
119
-
120
- //Ball Intake (Untested)
82
+ //Ball Intake(Works)
83
+ //Ball Intake (Does not work)
84
+ //RJ wants this for button layout coherancy
121
85
//This is the button test
122
- // / 3 is to small need to change on next upload
123
86
// the / 3 is since one of the motors is currently missing a gearbox but we will have the gear box before comp
124
87
if (arcadePad.GetRawButton(1) == 1) {
125
- m_leftIntake.Set(-1 / 3);
126
- m_rightIntake.Set(-1 );
88
+ m_leftIntake.Set(-.16);//+
89
+ m_rightIntake.Set(.5 );
127
90
} else if (arcadePad.GetRawButton(3) == 1) {
128
- m_leftIntake.Set(1 / 3 );
129
- m_rightIntake.Set(1 );
91
+ m_leftIntake.Set(.16 );
92
+ m_rightIntake.Set(-.5 );
130
93
} else {
131
94
m_leftIntake.Set(0);
132
95
m_rightIntake.Set(0);
@@ -135,11 +98,13 @@ class Robot : public frc::TimedRobot {
135
98
//This is the button/axis test, this is what we want if it works but can use code abouve incase this does not work
136
99
//The button layout with the top code is better than this one so idk what we will use in the end
137
100
//R2 and L2 axis(buttons on physical board)
138
- m_leftIntake.Set(arcadePad.GetRawAxis(3) * -1 / 3); //devide 3 only there for now since we don't have the 2nd gearbox
139
- m_rightIntake.Set(arcadePad.GetRawAxis(2));
140
-
101
+ // m_leftIntake.Set(arcadePad.GetRawAxis(3) * -1 / 3); //divide 3 only there for now since we don't have the 2nd gearbox
102
+ // m_rightIntake.Set(arcadePad.GetRawAxis(2));
103
+ //Hatch Panel Launcher(Works)
141
104
//Hatch Panel Launcher(Works)
105
+ //Set for 2 solenoids, still deciding wither it will be 1 or 2 solenoids
142
106
//4 = Y on Qanda Arcade
107
+ //1
143
108
if (arcadePad.GetRawButton(4) == 1) {
144
109
s_panelLauncher.Set(frc::DoubleSolenoid::kForward);
145
110
s_panelGetter.Set(frc::DoubleSolenoid::kForward);
@@ -150,7 +115,9 @@ class Robot : public frc::TimedRobot {
150
115
s_panelLauncher.Set(frc::DoubleSolenoid::kOff);
151
116
s_panelGetter.Set(frc::DoubleSolenoid::kOff);
152
117
}
118
+ //Slider/Panel Getter(Untested)
153
119
//Slider/Panel Getter(Untested)
120
+ //Will only used if Hatch Panel uses only 1 solenoids
154
121
/*
155
122
if (arcadePad.GetRawButton(6) == 1) {
156
123
s_panelGetter.Set(frc::DoubleSolenoid::kReverse);
@@ -161,12 +128,13 @@ class Robot : public frc::TimedRobot {
161
128
}
162
129
*/
163
130
}
164
-
131
+ //Private
165
132
private:
166
133
//Declartions
167
134
frc::Joystick xbox{1};
168
135
frc::Joystick arcadePad{2};
169
136
frc::Compressor compressor;
137
+ frc::Timer time;
170
138
//Motors
171
139
//Drivebase
172
140
frc::PWMVictorSPX m_frontLeft{0};
@@ -188,11 +156,12 @@ class Robot : public frc::TimedRobot {
188
156
//Pneumatics/Solenoids
189
157
//Hatch Panel Launcher
190
158
frc::DoubleSolenoid s_panelLauncher{0, 1};
191
- frc::DoubleSolenoid s_panelGetter{2, 3};
159
+ frc::DoubleSolenoid s_panelGetter{2, 3}; // will have to change this variable and the one above depending on if we have the Getter/Slider or not
192
160
frc::DoubleSolenoid s_HABfront{4, 5};
193
161
frc::DoubleSolenoid s_HABback{6, 7};
194
162
};
195
163
164
+ //Main
196
165
#ifndef RUNNING_FRC_TESTS
197
166
int main() { return frc::StartRobot<Robot>(); }
198
167
#endif
0 commit comments