-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCatapult.cpp
More file actions
55 lines (41 loc) · 945 Bytes
/
Catapult.cpp
File metadata and controls
55 lines (41 loc) · 945 Bytes
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
#include <WPILib.h>
#include "Catapult.h"
double motorPower;
double throwTime;
Catapult::Catapult(void){
motorOneTalon = new Talon(1);
motorTwoTalon = new Talon(2);
timer = new Timer();
settings = new SettingsGetter("Settings.txt");
}
void Catapult::RobotInit() {
}
void Catapult::DisabledInit() {
motorOneTalon->Set(0);
motorTwoTalon->Set(0);
timer->Stop();
timer->Reset();
}
void Catapult::AutonomousInit() {
timer->Start();
}
void Catapult::TeleopInit() {
}
void Catapult::DisabledPeriodic() {
settings->rehash();
motorPower = settings->getDouble("motorPower", -1.0, false);
throwTime = settings->getDouble("throwTime", 0.0, false);
}
void Catapult::AutonomousPeriodic() {
if((timer->Get() * 1000.0) < throwTime){
motorOneTalon->Set(motorPower);
motorTwoTalon->Set(motorPower);
}
else{
motorOneTalon->Set(0);
motorTwoTalon->Set(0);
}
}
void Catapult::TeleopPeriodic() {
}
START_ROBOT_CLASS(Catapult);