float scale_accel = 1;
float scale_gyro = 1150;
float scale_magnetic = 1;
-
-int pitch_phase_compensation = -1;
-int roll_phase_compensation = -1;
-int azimuth_phase_compensation = -1;
int magnetic_alignment_factor = -1;
void pre_process_data(sensor_data<float> *data_out, sensor_data<float> *data_in, float *bias, int *sign, float scale)
pre_process_data(magnetic_data, magnetic_data, bias_magnetic, sign_magnetic, scale_magnetic);
normalize(*magnetic_data);
- orien_filter.m_pitch_phase_compensation = pitch_phase_compensation;
- orien_filter.m_roll_phase_compensation = roll_phase_compensation;
- orien_filter.m_azimuth_phase_compensation = azimuth_phase_compensation;
orien_filter.m_magnetic_alignment_factor = magnetic_alignment_factor;
orien_filter.get_device_orientation(accel_data, gyro_data, magnetic_data);
#define ORIENTATION_DATA_PATH "../../../design/data/100ms/orientation/roll_pitch_yaw/"
#define ORIENTATION_DATA_SIZE 1095
+int pitch_phase_compensation = -1;
+int roll_phase_compensation = -1;
+int azimuth_phase_compensation = -1;
int main()
{
orien_sensor.get_device_orientation(&accel_data, &gyro_data, &magnetic_data);
- orien_file << orien_sensor.orien_filter.m_orientation.m_ang;
+ orientation = orien_sensor.orien_filter.m_orientation;
- cout << "Orientation angles\t" << orien_sensor.orien_filter.m_orientation.m_ang << "\n\n";
+ orientation = rad2deg(orientation);
+
+ orientation.m_ang.m_vec[0] *= pitch_phase_compensation;
+ orientation.m_ang.m_vec[1] *= roll_phase_compensation;
+ orientation.m_ang.m_vec[2] *= azimuth_phase_compensation;
+
+ if (orientation.m_ang.m_vec[2] < 0)
+ orientation.m_ang.m_vec[2] += 360;
+
+ orien_file << orientation.m_ang;
+
+ cout << "Orientation angles\t" << orientation.m_ang << "\n\n";
cout << "Orientation matrix\t" << orien_sensor.orien_filter.m_rot_matrix.m_rot_mat << "\n\n";