-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathdataLogger.cpp
More file actions
25 lines (23 loc) · 795 Bytes
/
Copy pathdataLogger.cpp
File metadata and controls
25 lines (23 loc) · 795 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
#include <cstdio>
#include <Timer.h>
#include "dataLogger.h"
#include "EnhancedShooter.h"
#include "EnhancedJoystick.h"
#include "Controls.h"
DataLogger::DataLogger(EnhancedShooter* s,void* o):shooter(s) {
gunner = &((robot_class*)o) -> gunner_gamepad;
gunner -> addBtn(GUNNER_BTN_SUCCESS_LOG,&successLog,(void*)this);
}
void DataLogger::successLog(void* o) {
EnhancedShooter* shooter = ((DataLogger*)o) -> shooter;
// float angle=shooter->getCurrentAngle();
float pot=shooter->getPot();
double timestamp=Timer::GetFPGATimestamp();
char filename[128];
snprintf(filename,128,"%f_SuccessfulShot.log",timestamp);
FILE* file=fopen(filename,"w");
// fprintf(file,"Angle = %f\n",angle);
fprintf(file,"Pot = %f\n",pot);
fflush(file);
fclose(file);
}