paparazzi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[paparazzi-commits] [5956] changed...


From: antoine drouin
Subject: [paparazzi-commits] [5956] changed...
Date: Mon, 27 Sep 2010 15:53:09 +0000

Revision: 5956
          http://svn.sv.gnu.org/viewvc/?view=rev&root=paparazzi&revision=5956
Author:   poine
Date:     2010-09-27 15:53:09 +0000 (Mon, 27 Sep 2010)
Log Message:
-----------
changed... some things

Modified Paths:
--------------
    paparazzi3/trunk/sw/airborne/fms/libeknav/Makefile
    paparazzi3/trunk/sw/airborne/fms/libeknav/raw_log_to_ascii.c
    paparazzi3/trunk/sw/airborne/fms/libeknav/test_libeknav_3.cpp

Added Paths:
-----------
    paparazzi3/trunk/sw/airborne/fms/libeknav/raw_log.h

Modified: paparazzi3/trunk/sw/airborne/fms/libeknav/Makefile
===================================================================
--- paparazzi3/trunk/sw/airborne/fms/libeknav/Makefile  2010-09-27 15:48:40 UTC 
(rev 5955)
+++ paparazzi3/trunk/sw/airborne/fms/libeknav/Makefile  2010-09-27 15:53:09 UTC 
(rev 5956)
@@ -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 address@hidden:/tmp/log_test3.bin 
/home/martin/paparazzi3/trunk/sw/airborne/fms/libeknav
-       
+               scp @auto3:/tmp/log_test3.bin .
+
 clean:
        -rm -f *.o *~ *.d

Added: paparazzi3/trunk/sw/airborne/fms/libeknav/raw_log.h
===================================================================
--- paparazzi3/trunk/sw/airborne/fms/libeknav/raw_log.h                         
(rev 0)
+++ paparazzi3/trunk/sw/airborne/fms/libeknav/raw_log.h 2010-09-27 15:53:09 UTC 
(rev 5956)
@@ -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 */
+
+

Modified: paparazzi3/trunk/sw/airborne/fms/libeknav/raw_log_to_ascii.c
===================================================================
--- paparazzi3/trunk/sw/airborne/fms/libeknav/raw_log_to_ascii.c        
2010-09-27 15:48:40 UTC (rev 5955)
+++ paparazzi3/trunk/sw/airborne/fms/libeknav/raw_log_to_ascii.c        
2010-09-27 15:53:09 UTC (rev 5956)
@@ -10,33 +10,32 @@
 
 
 
-#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 build_fake_log(void);
 
-void print_raw_log_entry(struct raw_log_entry);
-
 #define PRT(a) printf("%f ", a);
 
 
 
 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 @@
 
 
 
-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);
+}

Modified: paparazzi3/trunk/sw/airborne/fms/libeknav/test_libeknav_3.cpp
===================================================================
--- paparazzi3/trunk/sw/airborne/fms/libeknav/test_libeknav_3.cpp       
2010-09-27 15:48:40 UTC (rev 5955)
+++ paparazzi3/trunk/sw/airborne/fms/libeknav/test_libeknav_3.cpp       
2010-09-27 15:53:09 UTC (rev 5956)
@@ -18,6 +18,7 @@
 #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 @@
 }
 
 
+
+
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
@@ -207,22 +210,17 @@
 
 
 
+
+
 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);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]