-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLogger.h
179 lines (158 loc) · 4.76 KB
/
Logger.h
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
#ifndef LOGGER_H
#define LOGGER_H
#define kLineLength DriverStationLCD::kLineLength
#include "Kicker.h"
#include "Climber.h"
#include "DriveTrain.h"
#include "RobotCamera.h"
#include "CodeLevel.h"
#include "DashboardDataSender.h"
#include "Vacuum.h"
#include "WPIlib.h"
#include "DashboardDataFormat.h"
#include "Autonomous.h"
#include "GoggleLight.h"
#include "AutonomousKicker.h"
#include <fstream>
using std::ios;
using std::ofstream;
#define ROBOT_MOTORS 8
#define ROBOT_JOYSTICKS 3
class Logger {
public:
Logger();
void Process(); // gets data from robot and sends it to the drivestation and dashboard
void SetKicker(Kicker * k); // sets kicker pointer
void SetClimber(Climber * c); // sets climber pointer
void SetDriveTrain(DriveTrain * dt); // sets drive train pointer
void SetCamera(RoboCam * cam); // sets camera pointer
void SetDashboard(DashboardDataSender * db); // sets dashboard pointer
void SetInput(Input *in);
void SetDriverStationLCD(DriverStationLCD * lcd); // sets driverstation pointer
void SetVacuum(Vacuum *v);
void GetData(); // gets data from robot and assigns that data to variables
void SendDataDashboard(); // sends data to the dashboard
void CodeLevelZero(); // runs when CodeLevel is equal to 0
void CodeLevelOne(); // runs when CodeLevel is equal to 1
void CodeLevelTwo(); // runs when CodeLevel is equal to 2
void CodeLevelThree(); // runs when CodeLevel is equal to 3
void SendToDS(); // sends data to drive station
void SetDashboardDataFormat(DashboardDataFormat * ddf);
void SetGoggleLight(GoggleLight * light);
void SetAutoKicker(AutonomousKicker * the_auto_kicker);
void SetRobot(IterativeRobot * robot);
void SetAutonomous(Autonomous * das_auto);
//void SendDashboardDataFormat();
void PackAndSend(void);
private:
Kicker * kicker;
AutonomousKicker * autokicker;
Climber * climber;
DriveTrain * drivetrain;
RoboCam * camera;
DashboardDataSender * dash;
DashboardDataFormat * dataSender;
DriverStationLCD * dsLCD;
DriverStation * m_ds;
Vacuum * vacuum;
Input * input;
Autonomous * the_auto;
GoggleLight * the_light;
CANJaguar * motors[ROBOT_MOTORS];
Joystick * sticks[ROBOT_JOYSTICKS];
IterativeRobot * the_robot; // the_robot
ofstream outfile;
int since_last;
// camera
float targetLoc;
float targetDistance;
unsigned int packet_counter_check;
// jaguars
//front left, front right, rear left, rear right
// 0, 1, 2, 3
float FrontRightVoltage;
float FrontLeftVoltage;
float RearRightVoltage;
float RearLeftVoltage;
float FrontRightCurrent;
float FrontLeftCurrent;
float RearRightCurrent;
float RearLeftCurrent;
float FrontRightTemp;
float FrontLeftTemp;
float RearRightTemp;
float RearLeftTemp;
double FrontRightSpeed;
double FrontLeftSpeed;
double RearLeftSpeed;
double RearRightSpeed;
int jagnum;
double frontleftp;
double frontlefti;
double frontleftd;
float frontleftbusvolt;
float frontleftoutvolt;
float frontleftoutcur;
float frontlefttemp;
double frontleftpos;
double frontleftspeed;
bool frontleftFlimitok;
bool frontleftBlimitok;
UINT16 frontleftfault;
bool frontleftpowercycle;
UINT32 frontleftFirmVer;
UINT8 frontleftHardVer;
double frontrightp;
double frontrighti;
double frontrightd;
float frontrightbusvolt;
float frontrightoutvolt;
float frontrightoutcur;
float frontrighttemp;
double frontrightpos;
double frontrightspeed;
bool frontrightFlimitok;
bool frontrightBlimitok;
UINT16 frontrightfault;
bool frontrightpowercycle;
UINT32 frontrightFirmVer;
UINT8 frontrightHardVer;
double rearleftp;
double rearlefti;
double rearleftd;
float rearleftbusvolt;
float rearleftoutvolt;
float rearleftoutcur;
float rearlefttemp;
double rearleftpos;
double rearleftspeed;
bool rearleftFlimitok;
bool rearleftBlimitok;
UINT16 rearleftfault;
bool rearleftpowercycle;
UINT32 rearleftFirmVer;
UINT8 rearleftHardVer;
double rearrightp;
double rearrighti;
double rearrightd;
float rearrightbusvolt;
float rearrightoutvolt;
float rearrightoutcur;
float rearrighttemp;
double rearrightpos;
double rearrightspeed;
bool rearrightFlimitok;
bool rearrightBlimitok;
UINT16 rearrightfault;
bool rearrightpowercycle;
UINT32 rearrightFirmVer;
UINT8 rearrightHardVer;
//Kicker
float position;
float setPosition;
float jagVacVolt;
float jagVacCurrent;
bool triggerPulled;
bool ballPossesed;
};
#endif