mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-06-06 16:58:48 +08:00
the "tool" :-)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user