To use the IR sensors for attitude estimation add the infrared module and ahrs infrared subsystem:
<firmware name="fixedwing"> <target name="ap" board="tiny_2.11"/> ... <subsystem name="ahrs" type="infrared"/> </firmware> <modules> <load name="infrared_adc.xml"/> </modules>
The ADC channels are already default to the correct ADCs for your board, but you can of course change the assignments:
<modules> <load name="infrared_adc"/> <configure name="ADC_IR1" value="ADC_1"/> <configure name="ADC_IR2" value="ADC_2"/> <configure name="ADC_IR_TOP" value="ADC_0"/> <configure name="ADC_IR_NB_SAMPLES" value="16"/> </load> </modules>
The INFRARED section describes the configuration of the infrared sensors.
The first definitions are relative to the electronic neutral of the sensors (a sensor here is a pair of thermopiles). A perfect sensor should give 512 if it measures the same value on both sides.
<section name="INFRARED" prefix="IR_"> <define name="ADC_IR1_NEUTRAL" value="512"/> <define name="ADC_IR2_NEUTRAL" value="512"/> <define name="ADC_TOP_NEUTRAL" value="512"/>
These neutrals are tuned with the "cupboard test": Put the sensor in a close box (a cupboard) and read the values of the IR_SENSORS message (ir1, ir2 and vertical). Set the neutrals (they are subtracted from the measurement) to get null values. E.g. if you read 5 for the ir1 value with ADC_IR1_NEUTRAL equal to 512, change the latter to 517.
The next lines define the installation of the horizontal and vertical sensors. The vertical sensor must give a positive value when the temperature under the aircraft is higher than the temperature above. The two channels of the horizontal sensor must give positive values when it is warmer on the right side and the rear side. To adjust these signs, use the following declarations:
<define name="IR1_SIGN" value="-1"/> <define name="IR2_SIGN" value="-1"/> <define name="TOP_SIGN" value="-1"/>
Then, define how the horizontal sensor is connected to the airframe, orientation aligned or tilted.
- In the aligned case, ir1 is along the lateral axis (The axis that passes through the plane from wingtip to wingtip) and ir2 along the longitudinal one.
- In the tilted case, the sensors are tilted by 45 degrees; ir1 is along rear-left -- front-right, and ir2 along rear-right -- front-left.
If the airframe construction allows choose an aligned sensor orientation since this gives the best stabilization response results.
For help with orientation of Previous Versions of Infrared Sensor Boards try here : http://paparazzi.enac.fr/wiki/Previous_Infrared_Sensors
<define name="HORIZ_SENSOR_ALIGNED"/> or <define name="HORIZ_SENSOR_TILTED"/>
The three axis must give similar values for similar contrasts. The following factors can be used to scale these values. For example with an horizontal tilted sensor, the following ratios are usually needed:
<define name="LATERAL_CORRECTION" value="0.7"/> <define name="LONGITUDINAL_CORRECTION" value="0.7"/> <define name="VERTICAL_CORRECTION" value="1."/>
Default values are 1.
It may be hard to align the horizontal sensor with the aircraft. A tuning in flight will be needed to adjust the following neutrals. Adjust the roll neutral to fly straight. Adjust the pitch neutral to fly level with the desired throttle.
<define name="ROLL_NEUTRAL_DEFAULT" value="-2.5" unit="deg"/> <define name="PITCH_NEUTRAL_DEFAULT" value="6" unit="deg"/>
An asymmetric (left/right, front/rear) correction can be added with a last set of factors.
<define name="CORRECTION_UP" value="1."/> <define name="CORRECTION_DOWN" value="1."/> <define name="CORRECTION_LEFT" value="1."/> <define name="CORRECTION_RIGHT" value="1."/> </section>
These corrections are set on the angles. You don't have to set these as they are set to 1. per default, but adjust them if needed.