Updating geo_rv and gyro_rv support for sensor fusion test file 21/45621/7
authorRamasamy <ram.kannan@samsung.com>
Mon, 10 Aug 2015 02:26:22 +0000 (11:26 +0900)
committerMu-Woong Lee <muwoong.lee@samsung.com>
Mon, 7 Sep 2015 05:10:30 +0000 (22:10 -0700)
- Added NULL input handling in test file for gyro and geo rotation
vector standalone tests.

Change-Id: Ia2a3f6a7d0221b27ee1edbcf7d91413bd13c6f95

src/sensor_fusion/test/orientation_sensor.cpp

index decb3cc..f6cd55c 100644 (file)
@@ -46,15 +46,20 @@ void orientation_sensor::get_device_orientation(sensor_data<float> *accel_data,
 
        pre_process_data(accel_data, accel_data, bias_accel, sign_accel, scale_accel);
        normalize(*accel_data);
-       pre_process_data(gyro_data, gyro_data, bias_gyro, sign_gyro, scale_gyro);
-       pre_process_data(magnetic_data, magnetic_data, bias_magnetic, sign_magnetic, scale_magnetic);
-       normalize(*magnetic_data);
 
-       orien_filter.m_magnetic_alignment_factor = magnetic_alignment_factor;
+       if (gyro_data != NULL) {
+               pre_process_data(gyro_data, gyro_data, bias_gyro, sign_gyro, scale_gyro);
+       }
+
+       if (magnetic_data != NULL) {
+               pre_process_data(magnetic_data, magnetic_data, bias_magnetic, sign_magnetic, scale_magnetic);
+               normalize(*magnetic_data);
+
+               orien_filter.m_magnetic_alignment_factor = magnetic_alignment_factor;
+       }
 
        orien_filter.get_device_orientation(accel_data, gyro_data, magnetic_data);
 
-       orien_filter.m_gyro_bias = orien_filter.m_gyro_bias + vec_bias_gyro;
 }
 
 #endif