altb_pmic / Mbed 2 deprecated Test_optical_flow_PX4

Dependencies:   mbed

Revision:
9:be40afb750d3
Parent:
8:cb6d8bc54aaf
Child:
10:c654deb509e2
--- a/main.cpp	Fri Sep 06 09:32:37 2019 +0000
+++ b/main.cpp	Fri Sep 13 10:43:57 2019 +0000
@@ -114,7 +114,7 @@
                 pc.printf("\r\n");
                 */
                 
-                            
+                /*
                 float flowx = (float)PX4.pixel_flow_x_integral()/3.0f; // avg flow x in mm/s
                 float flowy = (float)PX4.pixel_flow_y_integral()/3.0f; // avg flow y in mm/s
                 uint8_t valid_frame_count = (uint8_t)PX4.frame_count_since_last_readout(); // nr. of valid frames (qual > 0) between i2c readings
@@ -122,19 +122,31 @@
                 float update_fs = (float)PX4.integration_timespan()/1000.0f; // Hz
                 float readout_fs = (float)PX4.ground_distance_integral()/1000.0f; // Hz
                 uint8_t quality = PX4.quality_integral(); // avg quality 0...255
-                float gyro_temperature = (float)PX4.gyro_temperature()*0.01f; // avg temp deg
+                float integration_timespan = (float)PX4.gyro_temperature()*0.01f; // integration timespan in ms
                 
                 // compare encoder and px4flow output, branch IndNaV
                 pc.printf("%10i; %10.3f; %10.3f;", counter, velocity, 1.0f/dt);
                 pc.printf("%10.3f; %10.3f; %10.3f;", lsm_gyro[0], lsm_gyro[1], lsm_gyro[2]);
-                pc.printf("%10.3f; %10.3f; %10.3f; %10.3f;", px4_gyro[0], px4_gyro[1], px4_gyro[2], gyro_temperature);
-                pc.printf("%10.3f; %10.3f; %10i;", flowx, flowy, quality);
-                pc.printf("%10.3f; %10.3f; %10d; %10i", update_fs, readout_fs, frame_count, valid_frame_count);
+                pc.printf("%10.3f; %10.3f; %10.3f; %10.3f;", px4_gyro[0], px4_gyro[1], px4_gyro[2], integration_timespan);
+                pc.printf("%10.3f; %10.3f; %4i;", flowx, flowy, quality);
+                pc.printf("%10.3f; %10.3f; %4d; %4i", update_fs, readout_fs, frame_count, valid_frame_count);
                 pc.printf("\r\n");
-                            
+                */
+                
+                // compare encoder and px4flow output, branch IndNaV with new PX4Flow driver functionality
+                pc.printf("%10i; %10.3f; %10.3f;", counter, velocity, 1.0f/dt);
+                pc.printf("%10.3f; %10.3f; %10.3f;", lsm_gyro[0], lsm_gyro[1], lsm_gyro[2]);
+                pc.printf("%10.3f; %10.3f; %10.3f; %10.4f;", PX4.avg_gyro_x(), PX4.avg_gyro_y(), PX4.avg_gyro_z(), PX4.int_timespan());
+                pc.printf("%10.3f; %10.3f; %4i;", PX4.avg_flowx(), PX4.avg_flowy(), PX4.avg_quality());
+                pc.printf("%10.3f; %10.3f; %4d; %4i;", PX4.update_fs(), PX4.readout_fs(), PX4.all_frame_count(), PX4.valid_frame_count());
+                pc.printf("%4i", PX4.avg_scaled_quality());
+                pc.printf("\r\n");           
    
                 counter++;
-                wait(0.0455);
+                wait(0.0455); // 20 Hz USE 20 Hz!!!
+                // wait(0.0955); // 10 Hz
+                // wait(0.4955); // 2 Hz
+                // wait(0.9955); // 1 Hz
                 
             } else {
                 pc.printf("TimeOut\r\n");