23 #ifndef SUBSYSTEMS_SENSORS_INFRARED_H
24 #define SUBSYSTEMS_SENSORS_INFRARED_H
27 #include "generated/airframe.h"
45 #if defined IR_HORIZ_SENSOR_ALIGNED
47 #define IR_RollOfIrs(_ir1, _ir2) (_ir1)
48 #define IR_PitchOfIrs(_ir1, _ir2) (_ir2)
49 #elif IR_HORIZ_SENSOR_TILTED
53 #define IR_RollOfIrs(_ir1, _ir2) (_ir1 + _ir2)
54 #define IR_PitchOfIrs(_ir1, _ir2) (-(_ir1) + _ir2)
57 #error "You have to define either HORIZ_SENSOR_ALIGNED or HORIZ_SENSOR_TILTED in the IR section"
62 #define IR_TopOfIr(_ir) (_ir)
69 #ifndef IR_LATERAL_CORRECTION
70 #define IR_LATERAL_CORRECTION 1.
73 #ifndef IR_LONGITUDINAL_CORRECTION
74 #define IR_LONGITUDINAL_CORRECTION 1.
77 #ifndef IR_VERTICAL_CORRECTION
78 #define IR_VERTICAL_CORRECTION 1.
81 #ifndef IR_CORRECTION_LEFT
82 #define IR_CORRECTION_LEFT 1.
85 #ifndef IR_CORRECTION_RIGHT
86 #define IR_CORRECTION_RIGHT 1.
89 #ifndef IR_CORRECTION_UP
90 #define IR_CORRECTION_UP 1.
93 #ifndef IR_CORRECTION_DOWN
94 #define IR_CORRECTION_DOWN 1.
101 #ifndef IR_ROLL_NEUTRAL_DEFAULT
102 #define IR_ROLL_NEUTRAL_DEFAULT 0.0
105 #ifndef IR_PITCH_NEUTRAL_DEFAULT
106 #define IR_PITCH_NEUTRAL_DEFAULT 0.0
149 #define UpdateIRValue(_v) { \
150 infrared.value.ir1 = (IR_IR1_SIGN)*_v.ir1; \
151 infrared.value.ir2 = (IR_IR2_SIGN)*_v.ir2; \
152 infrared.value.ir3 = (IR_TOP_SIGN)*_v.ir3; \
153 infrared.roll = infrared.lateral_correction * IR_RollOfIrs(infrared.value.ir1, infrared.value.ir2); \
154 infrared.pitch = infrared.longitudinal_correction * IR_PitchOfIrs(infrared.value.ir1, infrared.value.ir2); \
155 infrared.top = infrared.vertical_correction * IR_TopOfIr(infrared.value.ir3); \
void infrared_struct_init(void)
Initialisation of ir structure.
float longitudinal_correction
void infrared_event(void)
float vertical_correction
struct Infrared_raw value
void infrared_update(void)