altb_pmic / Mbed 2 deprecated Test_optical_flow_PX4

Dependencies:   mbed

Revision:
6:db20dd57a30a
Parent:
5:d97332d7f812
Child:
7:692d01d007f9
diff -r d97332d7f812 -r db20dd57a30a main.cpp
--- a/main.cpp	Thu Aug 29 06:40:14 2019 +0000
+++ b/main.cpp	Tue Sep 03 10:40:40 2019 +0000
@@ -68,7 +68,7 @@
     * int16_t ground_distance;    // Ground distance in meters*1000. Positive value: distance known. Negative value: Unknown distance 20
     */
     while(1) {
-        if(1) {
+        if(0) {
             if(PX4.update()) {
 
                 imu.readGyro();
@@ -88,7 +88,8 @@
                 dt = timer.read();
                 timer.reset();
                 
-                /*pc.printf("Frame Count: %4.0d\t", PX4.frame_count());
+                /*
+                pc.printf("Frame Count: %4.0d\t", PX4.frame_count());
                 pc.printf("Pixel Flow X Sum: %d\t", -PX4.pixel_flow_y_sum());
                 pc.printf("Pixel Flow Y Sum: %d\t", -PX4.pixel_flow_x_sum());
                 pc.printf("Flow Comp. M X.: %4d\t", -PX4.flow_comp_m_y());
@@ -99,16 +100,8 @@
                 pc.printf("Gyro Z: %d\t", PX4.gyro_z_rate());
                 pc.printf("Gyro Range: %d\t", PX4.gyro_range());
                 pc.printf("Sonar Timestamp: %3.d\t", PX4.sonar_timestamp());
-                pc.printf("z: %.3f\t", (float)PX4.ground_distance()/1000);*/
-
-                /*pc.printf("LSM gyro x: %.3f\t", lsm_gyro[0]);
-                pc.printf("LSM gyro y: %.3f\t", lsm_gyro[1]);
-                pc.printf("LSM gyro z: %.3f\t", lsm_gyro[2]);
-                pc.printf("PX4 gyro x: %.3f\t", px4_gyro[0]);
-                pc.printf("PX4 gyro y: %.3f\t", px4_gyro[1]);
-                pc.printf("PX4 gyro z: %.3f\t", px4_gyro[2]);
-                pc.printf("Updaterate  px4flow in Hz: %.3f\t", 1.0f/dt);
-                pc.printf("\r\n");*/
+                pc.printf("z: %.3f\t", (float)PX4.ground_distance()/1000);
+                */
                 
                 // compare gyros
                 // pc.printf("%i, %.3f, %.3f, %.3f, %.3f, %.3f, %.3f, %.3f; \r\n", counter, lsm_gyro[0], lsm_gyro[1], lsm_gyro[2], px4_gyro[0], px4_gyro[1], px4_gyro[2], 1.0f/dt);
@@ -122,6 +115,8 @@
             }
         } else {
             if(PX4.update_integral()) {
+                
+                ///*
                 pc.printf("Frame Count: %3.0d\t", PX4.frame_count_since_last_readout());
                 pc.printf("Pixel Flow X Integral: %3.0d\t", PX4.pixel_flow_x_integral());
                 pc.printf("Pixel Flow Y Integral: %3.0d\t", PX4.pixel_flow_y_integral());
@@ -134,6 +129,10 @@
                 pc.printf("Gyro Temperature: %3.d\t", PX4.gyro_temperature());
                 pc.printf("Integration Timespan: %8.0d\t", PX4.integration_timespan());
                 pc.printf("\r\n");
+                //*/
+                   
+                counter++;
+                // wait_us(1600); // -> 200 Hz
 
             } else {
                 pc.printf("TimeOut\r\n");