/*****************************************************************************************************
Readme for modified pprz directory for using with gumstix + IMU for fixed wing UAVs
Author: Haiyang Chao
Configuration files in 5 are generated by Daniel Morgan & Haiyang Chao.
*****************************************************************************************************/
1. Brief
This file is to explain what we have done to make the pprz compatible with IMU (xsens-mtig and microstrain-gx2).
Haiyang Chao on 20080912 for version 1

2. New Airborne files added
~/paparazzi3/sw/airborne/osam_imu_ugear.h
~/paparazzi3/sw/airborne/osam_imu_ugear.c

3. Airborne Files modified (all modifications we made are triggered only if UGEAR is defined)
~/paparazzi3/sw/airborne/main_ap.c
-----Line 122------------------------
#ifdef UGEAR
#include "osam_imu_ugear.h"
#endif 

#ifdef XSENS 
#include "xsens_ins.h"
#endif
-----Line 733------------------------
#ifdef UGEAR
	if (UgearBuffer()){
		ReadUgearBuffer();
	}
	if (ugear_msg_received){
		parse_ugear_msg();
		ugear_msg_received = FALSE;
		if (gps_pos_available){
			gps_downlink();
			gps_verbose_downlink = !launch;
			UseGpsPos(estimator_update_state_gps);
			gps_pos_available = FALSE;
		}
	}
#endif /* UGEAR*/
-----------------------------
~/paparazzi3/sw/airborne/ap_downlink.h
-----Line 165------------------------
#if defined UGEAR
#define PERIODIC_SEND_GPS() DOWNLINK_SEND_GPS(&gps_mode, &gps_utm_east, &gps_utm_north, &gps_course, &gps_alt, &gps_gspeed,&gps_climb, &gps_itow, &gps_utm_zone, &gps_nb_ovrn)
#define PERIODIC_SEND_GPS_SOL() DOWNLINK_SEND_GPS_SOL(&gps_Pacc, &gps_Sacc, &gps_PDOP, &gps_numSV)
#define PERIODIC_SEND_DebugChao() DOWNLINK_SEND_DebugChao(&ugear_debug1, &ugear_debug2, &ugear_debug3, &ugear_debug4, &ugear_debug5, &ugear_debug6)
#endif
-----------------------------
~/paparazzi3/sw/airborne/gps.h
-----Line 42------------------------
#elif defined UGEAR
#define GPS_NB_CHANNELS 16
-----------------------------
~/paparazzi3/sw/airborne/infrared.c
-----Line 42------------------------
#ifdef UGEAR
#include "osam_imu_ugear.h"
#endif 
-----Line 239------------------------
#if defined UGEAR
	#if !(defined IMUIR)
		ugear_debug3 = 333;
  		estimator_phi  = (float)ugear_phi/10000 - ir_roll_neutral;  
  		estimator_theta  = (float)ugear_theta/10000 - ir_pitch_neutral;
	#endif
#endif
-----------------------------

4. Configuration files changed
~/paparazzi3/conf/message.xml
-----Line 31------------------------
   <message name="DebugChao" ID="5">
     <field name="int16_1" type="int16" unit="deg"></field>
     <field name="int16_2" type="int16" unit="deg"></field>
     <field name="int16_3" type="int16" unit="deg"></field>
     <field name="int32_1" type="int32" unit="deg"></field>
     <field name="int32_2" type="int32" unit="deg"></field>
     <field name="int32_3" type="int32" unit="deg"></field>
   </message>
-----------------------------

5. New configuration files added
~/paparazzi3/conf/telemetry/osam_imu.xml
~/paparazzi3/conf/flight_plans/xsens_cachejunction.xml
~/paparazzi3/conf/airframes/osam_xsens_twog.xml

