forked from Team612/612-2014
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
executable file
·103 lines (91 loc) · 2.23 KB
/
main.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#include "main.h"
#include "612.h"
#include <DigitalInput.h>
#include <Relay.h>
#include <Joystick.h>
#include "ports.h"
main_robot* robot=NULL;
main_robot::main_robot()
{
printf("hello\n");
printf("world\n");
robot=this;
}
main_robot::~main_robot()
{
}
void main_robot::RobotInit()
{
printf("robot init\n");
update = new FunctionRegistry();
driverJoy = new SmoothJoystick(DRIVER_JOY_PORT);
gunnerJoy = new SmoothJoystick(GUNNER_JOY_PORT);
pnum = new Pneumatics(PNUM_DIGIN_MODULE, PNUM_DIGIN_CHANNEL, PNUM_RELAY_MODULE, PNUM_RELAY_CHANNEL);
shift = new Shifter(SHIFT_MOD, SHIFT_FCHAN, SHIFT_RCHAN);
shift->setHigh();
drive = new DriveTrain(TALON_FL_MODULE, TALON_FL_CHANNEL,
TALON_RL_MODULE, TALON_RL_CHANNEL,
TALON_FR_MODULE, TALON_FR_CHANNEL,
TALON_RR_MODULE, TALON_RR_CHANNEL);
shoot = new Shooter(SHOOT_JAG_MODULE,
SHOOT_TALON_MODULE, SHOOT_TALON_CHANNEL,
SHOOT_SLNOID_MODULE, SHOOT_SLNOID_FCHAN, SHOOT_SLNOID_RCHAN,
GUNNER_JOY_PORT);
printf("robot init exit\n");
}
void main_robot::TeleopInit()
{
}
void main_robot::AutonomousInit()
{
}
void main_robot::TestInit()
{
}
void main_robot::DisabledInit()
{
}
void main_robot::TeleopPeriodic()
{
printf("Teleop periodic 1\n");
update->updateFunctions();
printf("Teleop periodic 2\n");
float left = driverJoy->GetRawAxis(2);
printf("Teleop periodic 3\n");
float right = driverJoy->GetRawAxis(5);
printf("Teleop periodic 4\n");
drive->TankDrive(left, right);
printf("Teleop periodic end :)\n");
}
void main_robot::AutonomousPeriodic()
{
}
void main_robot::DisabledPeriodic()
{
}
void main_robot::TestPeriodic()
{
static int output=0;
if(output%20==0)
{
printf("test periodic\n");
}
output++;
pnum->checkPressure();
pnum->updateSolenoid();
if(gunnerJoy->GetRawButton(5))
{
if(shift->gear!=Shifter::low)
{
shift->setLow();
}
}
else if(gunnerJoy->GetRawButton(6))
{
if(shift->gear!=Shifter::high)
{
shift->setHigh();
}
}
}
START_ROBOT_CLASS(main_robot)