From d499c37d8248be5cfc9d2df020a227aff16ffad8 Mon Sep 17 00:00:00 2001 From: Martin Dieblich Date: Mon, 27 Sep 2010 15:23:05 +0000 Subject: [PATCH] the "tool" :-) --- sw/airborne/fms/libeknav/Makefile | 9 ++++++- sw/airborne/fms/libeknav/raw_log_to_ascii.c | 28 ++++++++++++++++++--- 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/sw/airborne/fms/libeknav/Makefile b/sw/airborne/fms/libeknav/Makefile index b277c372db..3978b2a8d7 100644 --- a/sw/airborne/fms/libeknav/Makefile +++ b/sw/airborne/fms/libeknav/Makefile @@ -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 \ No newline at end of file + 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 diff --git a/sw/airborne/fms/libeknav/raw_log_to_ascii.c b/sw/airborne/fms/libeknav/raw_log_to_ascii.c index da15be6474..0f3c00e038 100644 --- a/sw/airborne/fms/libeknav/raw_log_to_ascii.c +++ b/sw/airborne/fms/libeknav/raw_log_to_ascii.c @@ -4,29 +4,51 @@ #include #include #include +#include +#include + + + #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); +}