the "tool" :-)

This commit is contained in:
Martin Dieblich
2010-09-27 15:23:05 +00:00
parent 61b7a31723
commit d499c37d82
2 changed files with 33 additions and 4 deletions
+8 -1
View File
@@ -1,3 +1,10 @@
raw_log_to_ascii: raw_log_to_ascii.c
gcc -I../../ -Wall raw_log_to_ascii.c -o raw_log_to_ascii
gcc -I../../ -Wall raw_log_to_ascii.c -o raw_log_to_ascii
fetch_log:
scp martin@auto3:/tmp/log_test3.bin /home/martin/paparazzi3/trunk/sw/airborne/fms/libeknav
clean:
-rm -f *.o *~ *.d
+25 -3
View File
@@ -4,29 +4,51 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include <stdint.h>
#include "math/pprz_algebra_float.h"
// fixme,put that in a header
struct raw_log_entry {
double time;
float time;
struct FloatRates gyro;
struct FloatVect3 accel;
struct FloatVect3 mag;
};
void print_raw_log_entry(struct raw_log_entry);
#define PRT(a) printf("%f ", a);
int main(int argc, char** argv) {
const char* filename = "log_test3.bin";
int raw_log_fd = open(filename, O_RDONLY);
// if (fd==-1) blaaa
while (1) {
struct raw_log_entry e;
ssize_t nb_read = read(raw_log_fd, &e, sizeof(e));
if (nb_read != sizeof(e)) break;
printf("%f GYRO %f %f %f\n", e.time, e.gyro.p, e.gyro.q, e.gyro.r);
print_raw_log_entry(e);
//printf("%f %f %f %f", e.time, e.gyro.p, e.gyro.q, e.gyro.r);
printf("\n");
}
return 0;
}
void print_raw_log_entry(struct raw_log_entry entry){
printf("%f\t", entry.time);
printf("%+f %+f %+f\t", entry.gyro.p, entry.gyro.q, entry.gyro.r);
printf("%+f %+f %+f\t", entry.accel.x, entry.accel.y, entry.accel.z);
printf("%+f %+f %+f\t", entry.mag.x, entry.mag.y, entry.mag.z);
}