-
Notifications
You must be signed in to change notification settings - Fork 0
/
CommandBasedRobot.cpp
86 lines (77 loc) · 2.44 KB
/
CommandBasedRobot.cpp
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/* Include Standerd C Libs */
using namespace std;
/* Include WPILib Headers */
#include "WPILib.h"
#include "DigitalOutput.h"
/* Include Custom Headers */
#include "CommandBase.h"
/* Include Custom Commands */
#include "Commands/Command.h"
#include "Commands/AutoGroup.h"
#include "Commands/DAG.h"
#include "Commands/ArmLevel.h"
#include "FiringSolution.h"
#include "Commands/ShootGroup.h"
#include "Commands/StopAll.h"
class Robot : public IterativeRobot {
private:
CommandBase *armLevel;
Command *autonomousCommand;
private:
virtual void RobotInit()
{
//Wait(.2);
//SmartDashboard::init();
CommandBase::init();
autonomousCommand = new AutoGroup();
//delete autonomousCommand;
//autonomousCommand = new ArmLevel(0.0);
//SmartDashboard sd = SmartDashboard::GetInstance();
}
virtual void AutonomousInit() {
autonomousCommand->Start();
}
virtual void AutonomousPeriodic() {
Scheduler::GetInstance()->Run();
}
virtual void TeleopInit() {
//autonomousCommand->Cancel();
}
virtual void TeleopPeriodic(){
Scheduler::GetInstance()->Run();
/*
if (CommandBase::GetOIInstance()->GetRawButton(1,3) && !armLevel->IsRunning()){
armLevel = new ArmLevel((float)45.0);
armLevel->Start();
} else if (CommandBase::GetOIInstance()->GetRawButton(1,2) && !armLevel->IsRunning()){
armLevel = new ArmLevel((float)-45.0);
armLevel->Start();
}
if (CommandBase::GetOIInstance()->GetRawButton(2,3) && armLevel->IsRunning()){
armLevel->Cancel();
delete(armLevel);
}
if (CommandBase::GetOIInstance()->GetRawButton(2,3) && armLevel->IsRunning()){
armLevel->Cancel();
delete(armLevel);
}
if (CommandBase::GetOIInstance()->GetRawButton(1,4)){// && !turn->IsRunning()){
new ShootGroup();
//turn = new Turn();
//turn->Start();
} else if (CommandBase::GetOIInstance()->GetRawButton(1,5)){// && !turn->IsRunning()){
new ShootGroup();
}
*/
if (CommandBase::GetOIInstance()->GetRawButton(1,1) && !autonomousCommand->IsRunning()){// && turn->IsRunning()){
delete autonomousCommand; autonomousCommand = NULL;
autonomousCommand = new AutoGroup();
autonomousCommand->Start();
}
//if (CommandBase::GetOIInstance()->GetRawButton(1,3) && !autonomousCommand->IsRunning()){// && turn->IsRunning()){
// autonomousCommand = new DAG();
// autonomousCommand->Start();
//}
}
};
START_ROBOT_CLASS(Robot);