mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-06-06 07:53:43 +08:00
changed... some things
This commit is contained in:
@@ -1,10 +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../../ -std=gnu99 -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
|
||||
|
||||
scp @auto3:/tmp/log_test3.bin .
|
||||
|
||||
clean:
|
||||
-rm -f *.o *~ *.d
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
#ifndef LIBEKNAV_RAW_LOG_H
|
||||
#define LIBEKNAV_RAW_LOG_H
|
||||
|
||||
#include "math/pprz_algebra_float.h"
|
||||
|
||||
struct raw_log_entry {
|
||||
float time;
|
||||
struct FloatRates gyro;
|
||||
struct FloatVect3 accel;
|
||||
struct FloatVect3 mag;
|
||||
};
|
||||
|
||||
#endif /* LIBEKNAV_RAW_LOG_H */
|
||||
|
||||
|
||||
@@ -10,16 +10,10 @@
|
||||
|
||||
|
||||
|
||||
#include "math/pprz_algebra_float.h"
|
||||
#include "fms/libeknav/raw_log.h"
|
||||
|
||||
struct raw_log_entry {
|
||||
float time;
|
||||
struct FloatRates gyro;
|
||||
struct FloatVect3 accel;
|
||||
struct FloatVect3 mag;
|
||||
};
|
||||
|
||||
void print_raw_log_entry(struct raw_log_entry);
|
||||
void print_raw_log_entry(struct raw_log_entry*);
|
||||
void build_fake_log(void);
|
||||
|
||||
#define PRT(a) printf("%f ", a);
|
||||
|
||||
@@ -27,16 +21,21 @@ void print_raw_log_entry(struct raw_log_entry);
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
|
||||
// build_fake_log();
|
||||
|
||||
const char* filename = "log_test3.bin";
|
||||
int raw_log_fd = open(filename, O_RDONLY);
|
||||
|
||||
// if (fd==-1) blaaa
|
||||
if (raw_log_fd == -1) {
|
||||
perror("opening log\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
while (1) {
|
||||
struct raw_log_entry e;
|
||||
ssize_t nb_read = read(raw_log_fd, &e, sizeof(e));
|
||||
if (nb_read != sizeof(e)) break;
|
||||
print_raw_log_entry(e);
|
||||
print_raw_log_entry(&e);
|
||||
//printf("%f %f %f %f", e.time, e.gyro.p, e.gyro.q, e.gyro.r);
|
||||
printf("\n");
|
||||
}
|
||||
@@ -46,9 +45,21 @@ int main(int argc, char** argv) {
|
||||
|
||||
|
||||
|
||||
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);
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void build_fake_log(void) {
|
||||
int raw_log_fd = open( "log_test3.bin", O_WRONLY|O_CREAT, 00644);
|
||||
for (int i=0; i<5000; i++) {
|
||||
struct raw_log_entry e;
|
||||
e.time = i;
|
||||
write(raw_log_fd, &e, sizeof(e));
|
||||
}
|
||||
close(raw_log_fd);
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ extern "C" {
|
||||
#include "fms/fms_spi_link.h"
|
||||
#include "fms/fms_autopilot_msg.h"
|
||||
#include "booz/booz_imu.h"
|
||||
#include "fms/libeknav/raw_log.h"
|
||||
/* our sensors */
|
||||
struct BoozImuFloat imu;
|
||||
/* raw log */
|
||||
@@ -185,6 +186,8 @@ static void main_run_ins() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
@@ -207,22 +210,17 @@ static void on_foo_event(int fd __attribute__((unused)), short event __attribute
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static void main_rawlog_init(const char* filename) {
|
||||
|
||||
raw_log_fd = open(filename, O_WRONLY|O_CREAT);
|
||||
raw_log_fd = open(filename, O_WRONLY|O_CREAT, 00644);
|
||||
if (raw_log_fd == -1) {
|
||||
TRACE(TRACE_ERROR, "failed to open rawlog outfile (%s)\n", filename);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
struct raw_log_entry {
|
||||
float time;
|
||||
struct FloatRates gyro;
|
||||
struct FloatVect3 accel;
|
||||
struct FloatVect3 mag;
|
||||
};
|
||||
|
||||
static void main_rawlog_dump(void) {
|
||||
struct timespec now;
|
||||
clock_gettime(TIMER, &now);
|
||||
|
||||
Reference in New Issue
Block a user