Skip to content

Commit 0dafe4a

Browse files
Update Literal Actual Program
1 parent 186a81a commit 0dafe4a

File tree

1 file changed

+40
-71
lines changed

1 file changed

+40
-71
lines changed

Literal Actual Program

Lines changed: 40 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,3 @@
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-
481
/*----------------------------------------------------------------------------*/
492
/* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
503
/* Open Source Software - may be modified and shared by FRC teams. The code */
@@ -66,27 +19,37 @@ class Robot : public frc::TimedRobot {
6619
public:
6720
Robot() {}
6821

69-
void RobotInit() override {}
22+
void RobotInit() override {
23+
compressor.Start();
24+
};
7025
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 {}
7734

7835
void TeleopPeriodic() override {
36+
//Miscelanious
37+
//Compressor Toggle(Later Amigo)
38+
39+
//Drive(Workds)
7940
//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
8143
//the else if statments is mostly likely unneeded, will test with and without so see if it is needed
8244
// 3 = A button
8345
if (xbox.GetRawButton(3) == 1) {
8446
Drive.ArcadeDrive(xbox.GetRawAxis(1) * -1 / 2, xbox.GetRawAxis(0) / 2);
8547
} 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);
8749
} else {
88-
Drive.ArcadeDrive(xbox.GetRawAxis(1) * -1, xbox.GetRawAxis(0) / 2);
50+
Drive.ArcadeDrive(xbox.GetRawAxis(1) * -1 * .7, xbox.GetRawAxis(0) / 2);
8951
}
52+
//HAB Lift(Untested)
9053
//HAB lift
9154
//Front(Untested)
9255
//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 {
10568
} else {
10669
s_HABback.Set(frc::DoubleSolenoid::kOff);
10770
}
108-
71+
//Forklift(Workds)
10972
//Forlift (Works)
11073
//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
11275
if (arcadePad.GetPOV(0) == 0) {
11376
m_forklift.Set(.5);
11477
} else if (arcadePad.GetPOV(0) == 180) {
11578
m_forklift.Set(-.5);
11679
} else {
11780
m_forklift.Set(0);
11881
}
119-
120-
//Ball Intake (Untested)
82+
//Ball Intake(Works)
83+
//Ball Intake (Does not work)
84+
//RJ wants this for button layout coherancy
12185
//This is the button test
122-
// / 3 is to small need to change on next upload
12386
// the / 3 is since one of the motors is currently missing a gearbox but we will have the gear box before comp
12487
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);
12790
} 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);
13093
} else {
13194
m_leftIntake.Set(0);
13295
m_rightIntake.Set(0);
@@ -135,11 +98,13 @@ class Robot : public frc::TimedRobot {
13598
//This is the button/axis test, this is what we want if it works but can use code abouve incase this does not work
13699
//The button layout with the top code is better than this one so idk what we will use in the end
137100
//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)
141104
//Hatch Panel Launcher(Works)
105+
//Set for 2 solenoids, still deciding wither it will be 1 or 2 solenoids
142106
//4 = Y on Qanda Arcade
107+
//1
143108
if (arcadePad.GetRawButton(4) == 1) {
144109
s_panelLauncher.Set(frc::DoubleSolenoid::kForward);
145110
s_panelGetter.Set(frc::DoubleSolenoid::kForward);
@@ -150,7 +115,9 @@ class Robot : public frc::TimedRobot {
150115
s_panelLauncher.Set(frc::DoubleSolenoid::kOff);
151116
s_panelGetter.Set(frc::DoubleSolenoid::kOff);
152117
}
118+
//Slider/Panel Getter(Untested)
153119
//Slider/Panel Getter(Untested)
120+
//Will only used if Hatch Panel uses only 1 solenoids
154121
/*
155122
if (arcadePad.GetRawButton(6) == 1) {
156123
s_panelGetter.Set(frc::DoubleSolenoid::kReverse);
@@ -161,12 +128,13 @@ class Robot : public frc::TimedRobot {
161128
}
162129
*/
163130
}
164-
131+
//Private
165132
private:
166133
//Declartions
167134
frc::Joystick xbox{1};
168135
frc::Joystick arcadePad{2};
169136
frc::Compressor compressor;
137+
frc::Timer time;
170138
//Motors
171139
//Drivebase
172140
frc::PWMVictorSPX m_frontLeft{0};
@@ -188,11 +156,12 @@ class Robot : public frc::TimedRobot {
188156
//Pneumatics/Solenoids
189157
//Hatch Panel Launcher
190158
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
192160
frc::DoubleSolenoid s_HABfront{4, 5};
193161
frc::DoubleSolenoid s_HABback{6, 7};
194162
};
195163

164+
//Main
196165
#ifndef RUNNING_FRC_TESTS
197166
int main() { return frc::StartRobot<Robot>(); }
198167
#endif

0 commit comments

Comments
 (0)