Subversion Repositories FlightCtrl

Rev

Rev 2129 | Rev 2132 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2129 Rev 2131
1
#include <stdlib.h>
1
#include <stdlib.h>
2
#include <avr/io.h>
2
#include <avr/io.h>
3
#include "eeprom.h"
3
#include "eeprom.h"
4
#include "flight.h"
4
#include "flight.h"
5
#include "output.h"
5
#include "output.h"
6
 
6
 
7
// Necessary for external control and motor test
7
// Necessary for external control and motor test
8
#include "uart0.h"
8
#include "uart0.h"
9
#include "timer2.h"
9
#include "timer2.h"
10
#include "analog.h"
10
#include "analog.h"
11
#include "attitude.h"
11
#include "attitude.h"
12
#include "controlMixer.h"
12
#include "controlMixer.h"
13
#include "configuration.h"
13
#include "configuration.h"
14
 
14
 
15
#define CHECK_MIN_MAX(value, min, max) {if(value < min) value = min; else if(value > max) value = max;}
15
#define CHECK_MIN_MAX(value, min, max) {if(value < min) value = min; else if(value > max) value = max;}
16
 
16
 
17
/*
17
/*
18
 * target-directions integrals.
18
 * target-directions integrals.
19
 */
19
 */
20
int32_t target[3];
20
int32_t target[3];
21
 
21
 
22
/*
22
/*
23
 * Error integrals.
23
 * Error integrals.
24
 */
24
 */
25
int32_t error[3];
25
int32_t error[3];
26
 
26
 
27
uint8_t reverse[3];
27
uint8_t reverse[3];
28
int32_t maxError[3];
28
int32_t maxError[3];
29
int32_t IPart[3] = { 0, 0, 0 };
29
int32_t IPart[3] = { 0, 0, 0 };
30
PID_t airspeedPID[3];
30
PID_t airspeedPID[3];
31
 
31
 
32
int16_t controlServos[NUM_CONTROL_SERVOS];
32
int16_t controlServos[NUM_CONTROL_SERVOS];
33
 
33
 
34
/************************************************************************/
34
/************************************************************************/
35
/*  Neutral Readings                                                    */
35
/*  Neutral Readings                                                    */
36
/************************************************************************/
36
/************************************************************************/
37
#define CONTROL_CONFIG_SCALE 10
37
#define CONTROL_CONFIG_SCALE 10
38
 
38
 
39
void flight_setGround(void) {
39
void flight_setGround(void) {
40
        IPart[PITCH] = IPart[ROLL] = IPart[YAW] = 0;
40
        IPart[PITCH] = IPart[ROLL] = IPart[YAW] = 0;
41
        target[PITCH] = attitude[PITCH];
41
        target[PITCH] = attitude[PITCH];
42
        target[ROLL] = attitude[ROLL];
42
        target[ROLL] = attitude[ROLL];
43
        target[YAW] = attitude[YAW];
43
        target[YAW] = attitude[YAW];
44
}
44
}
45
 
45
 
46
void flight_updateFlightParametersToFlightMode(void) {
46
void flight_updateFlightParametersToFlightMode(void) {
47
        debugOut.analog[16] = currentFlightMode;
47
        debugOut.analog[16] = currentFlightMode;
48
        reverse[PITCH] = staticParams.servosReverse & CONTROL_SERVO_REVERSE_ELEVATOR;
48
        reverse[PITCH] = staticParams.servosReverse & CONTROL_SERVO_REVERSE_ELEVATOR;
49
        reverse[ROLL] = staticParams.servosReverse & CONTROL_SERVO_REVERSE_AILERONS;
49
        reverse[ROLL] = staticParams.servosReverse & CONTROL_SERVO_REVERSE_AILERONS;
50
        reverse[YAW] = staticParams.servosReverse & CONTROL_SERVO_REVERSE_RUDDER;
50
        reverse[YAW] = staticParams.servosReverse & CONTROL_SERVO_REVERSE_RUDDER;
51
 
51
 
52
        // At a switch to angles, we want to kill errors first.
52
        // At a switch to angles, we want to kill errors first.
53
        // This should be triggered only once per mode change!
53
        // This should be triggered only once per mode change!
54
        if (currentFlightMode == FLIGHT_MODE_ANGLES) {
54
        if (currentFlightMode == FLIGHT_MODE_ANGLES) {
55
                target[PITCH] = attitude[PITCH];
55
                target[PITCH] = attitude[PITCH];
56
                target[ROLL] = attitude[ROLL];
56
                target[ROLL] = attitude[ROLL];
57
                target[YAW] = attitude[YAW];
57
                target[YAW] = attitude[YAW];
58
        }
58
        }
59
 
59
 
60
        for (uint8_t axis=0; axis<3; axis++) {
60
        for (uint8_t axis=0; axis<3; axis++) {
61
                maxError[axis] = (int32_t)staticParams.gyroPID[axis].iMax * GYRO_DEG_FACTOR;
61
                maxError[axis] = (int32_t)staticParams.gyroPID[axis].iMax * GYRO_DEG_FACTOR;
62
        }
62
        }
63
}
63
}
64
 
64
 
65
// Normal at airspeed = 10.
65
// Normal at airspeed = 10.
66
uint8_t calcAirspeedPID(uint8_t pid) {
66
uint8_t calcAirspeedPID(uint8_t pid) {
67
        if (!(staticParams.bitConfig & CFG_USE_AIRSPEED_PID)) {
67
        if (!(staticParams.bitConfig & CFG_USE_AIRSPEED_PID)) {
68
                return pid;
68
                return pid;
69
        }
69
        }
70
 
70
 
71
        uint16_t result = (pid * 10) / airspeedVelocity;
71
        uint16_t result = (pid * 10) / airspeedVelocity;
72
 
72
 
73
        if (result > 240 || airspeedVelocity == 0) {
73
        if (result > 240 || airspeedVelocity == 0) {
74
                result = 240;
74
                result = 240;
75
        }
75
        }
76
 
76
 
77
        return result;
77
        return result;
78
}
78
}
79
 
79
 
80
void setAirspeedPIDs(void) {
80
void setAirspeedPIDs(void) {
81
        for (uint8_t axis = 0; axis<3; axis++) {
81
        for (uint8_t axis = 0; axis<3; axis++) {
82
                airspeedPID[axis].P = calcAirspeedPID(dynamicParams.gyroPID[axis].P);
82
                airspeedPID[axis].P = calcAirspeedPID(dynamicParams.gyroPID[axis].P);
83
                airspeedPID[axis].I = calcAirspeedPID(dynamicParams.gyroPID[axis].I); // Should this be???
83
                airspeedPID[axis].I = calcAirspeedPID(dynamicParams.gyroPID[axis].I); // Should this be???
84
                airspeedPID[axis].D = dynamicParams.gyroPID[axis].D;
84
                airspeedPID[axis].D = dynamicParams.gyroPID[axis].D;
85
        }
85
        }
86
}
86
}
87
 
87
 
88
#define LOG_STICK_SCALE 8
88
#define LOG_STICK_SCALE 8
89
#define LOG_P_SCALE 6
89
#define LOG_P_SCALE 6
90
#define LOG_I_SCALE 10
90
#define LOG_I_SCALE 10
91
#define LOG_D_SCALE 6
91
#define LOG_D_SCALE 6
92
 
92
 
93
/************************************************************************/
93
/************************************************************************/
94
/*  Main Flight Control                                                 */
94
/*  Main Flight Control                                                 */
95
/************************************************************************/
95
/************************************************************************/
96
void flight_control(void) {
96
void flight_control(void) {
97
        // Mixer Fractions that are combined for Motor Control
97
        // Mixer Fractions that are combined for Motor Control
98
        int16_t term[4];
98
        int16_t term[4];
99
 
99
 
100
        // PID controller variables
100
        // PID controller variables
101
        int16_t PDPart[3];
101
        int16_t PDPart[3];
102
 
102
 
103
        static int8_t debugDataTimer = 1;
103
        static int8_t debugDataTimer = 1;
104
 
104
 
105
        // High resolution motor values for smoothing of PID motor outputs
105
        // High resolution motor values for smoothing of PID motor outputs
106
        // static int16_t outputFilters[MAX_OUTPUTS];
106
        // static int16_t outputFilters[MAX_OUTPUTS];
107
 
107
 
108
        uint8_t axis;
108
        uint8_t axis;
109
 
109
 
110
        setAirspeedPIDs();
110
        setAirspeedPIDs();
111
 
111
 
112
        term[CONTROL_THROTTLE] = controls[CONTROL_THROTTLE];
112
        term[CONTROL_THROTTLE] = controls[CONTROL_THROTTLE];
113
 
113
 
114
        // These params are just left the same in all modes. In MANUAL and RATE the results are ignored anyway.
114
        // These params are just left the same in all modes. In MANUAL and RATE the results are ignored anyway.
115
        int32_t tmp;
115
        int32_t tmp;
116
 
116
 
117
        tmp = ((int32_t)controls[CONTROL_ELEVATOR] * staticParams.stickIElevator) >> LOG_STICK_SCALE;
117
        tmp = ((int32_t)controls[CONTROL_ELEVATOR] * staticParams.stickIElevator) >> LOG_STICK_SCALE;
118
        if (reverse[PITCH]) target[PITCH] += tmp; else target[PITCH] -= tmp;
118
        if (reverse[PITCH]) target[PITCH] += tmp; else target[PITCH] -= tmp;
119
 
119
 
120
        tmp = ((int32_t)controls[CONTROL_AILERONS] * staticParams.stickIAilerons) >> LOG_STICK_SCALE;
120
        tmp = ((int32_t)controls[CONTROL_AILERONS] * staticParams.stickIAilerons) >> LOG_STICK_SCALE;
121
        if (reverse[ROLL]) target[ROLL] += tmp; else target[ROLL] -= tmp;
121
        if (reverse[ROLL]) target[ROLL] += tmp; else target[ROLL] -= tmp;
122
 
122
 
123
        tmp = ((int32_t)controls[CONTROL_RUDDER] * staticParams.stickIRudder) >> LOG_STICK_SCALE;
123
        tmp = ((int32_t)controls[CONTROL_RUDDER] * staticParams.stickIRudder) >> LOG_STICK_SCALE;
124
        if (reverse[YAW]) target[YAW] += tmp; else target[YAW] -= tmp;
124
        if (reverse[YAW]) target[YAW] += tmp; else target[YAW] -= tmp;
125
 
125
 
126
        for (axis = PITCH; axis <= YAW; axis++) {
126
        for (axis = PITCH; axis <= YAW; axis++) {
127
                if (target[axis] > OVER180) {
127
                if (target[axis] > OVER180) {
128
                        target[axis] -= OVER360;
128
                        target[axis] -= OVER360;
129
                } else if (target[axis] <= -OVER180) {
129
                } else if (target[axis] <= -OVER180) {
130
                        target[axis] += OVER360;
130
                        target[axis] += OVER360;
131
                }
131
                }
132
 
132
 
-
 
133
        error[axis] = attitude[axis] - target[axis];
-
 
134
 
-
 
135
#define ROTATETARGET 1
-
 
136
// #define TRUNCATEERROR 1
-
 
137
 
133
                /* This is the difference limitation only way. The 2 subtrahends stay unmodified. */
138
#ifdef(ROTATETARGET)
-
 
139
                if(abs(error[axis]) > OVER180) {
-
 
140
                  // The shortest way from attitude to target crosses -180.
134
 
141
                  // Well there are 2 possibilities: A is >0 and T is < 0, that makes E a (too) large positive number. It should be wrapped to negative.
-
 
142
                  // Or A is <0 and T is >0, that makes E a (too) large negative number. It should be wrapped to positive.
-
 
143
                  if (error[axis] > 0) {
-
 
144
                    if (error[axis] < OVER360 - maxError[axis]) {
-
 
145
                      // too much err.
-
 
146
                      error[axis] = -maxError[axis];
-
 
147
                      target[axis] = attitude[axis] + maxError[axis];
-
 
148
                      if (target[axis]) > OVER180) target[axis] -= OVER360;
135
                error[axis] = attitude[axis] - target[axis];
149
                    } else {
-
 
150
                      // Normal case, we just need to correct for the wrap. Error will be negative.
-
 
151
                      error[axis] -= OVER360;
136
                if (error[axis] > OVER180) {
152
                    }
-
 
153
                  } else {
-
 
154
            if (error[axis] > maxError[axis] - OVER360) {
-
 
155
              // too much err.
-
 
156
              error[axis] = maxError[axis];
-
 
157
              target[axis] = attitude[axis] - maxError[axis];
-
 
158
              if (target[axis]) < -OVER180) target[axis] += OVER360;
137
                        error[axis] -= OVER360;
159
            } else {
-
 
160
              // Normal case, we just need to correct for the wrap. Error will be negative.
-
 
161
              error[axis] += OVER360;
-
 
162
            }
-
 
163
                  }
-
 
164
                } else {
-
 
165
                  // Simple case, linear range.
-
 
166
                if (error[axis] > maxError[axis]) {
-
 
167
                  error[axis] = maxError[axis];
-
 
168
                  target[axis] = attitude[axis] - maxError[axis];
-
 
169
                } else if (error[axis] < -maxError[axis]) {
-
 
170
              error[axis] = -maxError[axis];
138
                } else if (error[axis] <= -OVER180) {
171
              target[axis] = attitude[axis] + maxError[axis];
-
 
172
            }
139
                        error[axis] += OVER360;
173
                }
140
                }
174
#endif
141
                // Believe it or not, the below limiter does NOT solve the wrapping problem. Must do explicitly.
175
#ifdef(TUNCATEERROR)
142
                if (error[axis] > maxError[axis]) {
176
                if (error[axis] > maxError[axis]) {
143
                  error[axis] = maxError[axis];
177
                  error[axis] = maxError[axis];
144
                } else if (error[axis] < -maxError[axis]) {
178
                } else if (error[axis] < -maxError[axis]) {
145
                  error[axis] = -maxError[axis];
179
                  error[axis] = -maxError[axis];
146
                } else {
180
                } else {
147
                        // update I parts here for angles mode. I parts in rate mode is something different.
181
                        // update I parts here for angles mode. I parts in rate mode is something different.
148
                }
182
                }
-
 
183
#endif
149
 
184
 
150
                /*
185
                /*
151
                 * This is the beginning of a version that adjusts the target to differ from the attitude
186
                 * This is the beginning of a version that adjusts the target to differ from the attitude
152
                 * by a limited amount. This will eliminate memory over large errors but also knock target angles.
187
                 * by a limited amount. This will eliminate memory over large errors but also knock target angles.
153
                 * Idea: The limit could be calculated from the max. servo deflection divided by I factor...
188
                 * Idea: The limit could be calculated from the max. servo deflection divided by I factor...
154
                 *
189
                 *
155
                 */
190
                 */
156
                /*
191
                /*
157
                if(abs(attitude[axis]-target[axis]) > OVER180) {
192
                if(abs(attitude[axis]-target[axis]) > OVER180) {
158
                        if(target[axis] > attitude[axis]) {
193
                        if(target[axis] > attitude[axis]) {
159
 
194
 
160
                        }
195
                        }
161
                }
196
                }
162
                */
197
                */
163
 
198
 
164
                /************************************************************************/
199
                /************************************************************************/
165
                /* Calculate control feedback from angle (gyro integral)                */
200
                /* Calculate control feedback from angle (gyro integral)                */
166
                /* and angular velocity (gyro signal)                                   */
201
                /* and angular velocity (gyro signal)                                   */
167
                /************************************************************************/
202
                /************************************************************************/
168
                if (currentFlightMode == FLIGHT_MODE_ANGLES || currentFlightMode == FLIGHT_MODE_RATE) {
203
                if (currentFlightMode == FLIGHT_MODE_ANGLES || currentFlightMode == FLIGHT_MODE_RATE) {
169
                        PDPart[axis] = +(((int32_t) gyro_PID[axis] * (int32_t) airspeedPID[axis].P) >> LOG_P_SCALE)
204
                        PDPart[axis] = +(((int32_t) gyro_PID[axis] * (int32_t) airspeedPID[axis].P) >> LOG_P_SCALE)
170
                                + (((int16_t)gyroD[axis] * (int16_t) airspeedPID[axis].D) >> LOG_D_SCALE);
205
                                + (((int16_t)gyroD[axis] * (int16_t) airspeedPID[axis].D) >> LOG_D_SCALE);
171
                        //if (reverse[axis])
206
                        //if (reverse[axis])
172
                        //      PDPart[axis] = -PDPart[axis];
207
                        //      PDPart[axis] = -PDPart[axis];
173
                } else {
208
                } else {
174
                        PDPart[axis] = 0;
209
                        PDPart[axis] = 0;
175
                }
210
                }
176
 
211
 
177
                if (currentFlightMode == FLIGHT_MODE_ANGLES) {
212
                if (currentFlightMode == FLIGHT_MODE_ANGLES) {
178
                        int16_t anglePart = (int32_t)(error[axis] * (int32_t) airspeedPID[axis].I) >> LOG_I_SCALE;
213
                        int16_t anglePart = (int32_t)(error[axis] * (int32_t) airspeedPID[axis].I) >> LOG_I_SCALE;
179
                //      if (reverse[axis])
214
                //      if (reverse[axis])
180
                        PDPart[axis] += anglePart;
215
                        PDPart[axis] += anglePart;
181
                //      else
216
                //      else
182
                //              PDPart[axis] -= anglePart;
217
                //              PDPart[axis] -= anglePart;
183
                }
218
                }
184
 
219
 
185
                // Add I parts here... these are integrated errors.
220
                // Add I parts here... these are integrated errors.
186
                if (reverse[axis])
221
                if (reverse[axis])
187
                  term[axis] = controls[axis] - PDPart[axis]; // + IPart[axis];
222
                  term[axis] = controls[axis] - PDPart[axis]; // + IPart[axis];
188
                else
223
                else
189
                  term[axis] = controls[axis] + PDPart[axis]; // + IPart[axis];
224
                  term[axis] = controls[axis] + PDPart[axis]; // + IPart[axis];
190
        }
225
        }
191
 
226
 
192
        debugOut.analog[12] = term[PITCH];
227
        debugOut.analog[12] = term[PITCH];
193
        debugOut.analog[13] = term[ROLL];
228
        debugOut.analog[13] = term[ROLL];
194
        debugOut.analog[14] = term[YAW];
229
        debugOut.analog[14] = term[YAW];
195
        debugOut.analog[15] = term[THROTTLE];
230
        debugOut.analog[15] = term[THROTTLE];
196
 
231
 
197
        for (uint8_t i = 0; i < NUM_CONTROL_SERVOS; i++) {
232
        for (uint8_t i = 0; i < NUM_CONTROL_SERVOS; i++) {
198
                int16_t tmp;
233
                int16_t tmp;
199
                if (servoTestActive) {
234
                if (servoTestActive) {
200
                        controlServos[i] = ((int16_t) servoTest[i] - 128) * 8;
235
                        controlServos[i] = ((int16_t) servoTest[i] - 128) * 8;
201
                } else {
236
                } else {
202
                        // Follow the normal order of servos: Ailerons, elevator, throttle, rudder.
237
                        // Follow the normal order of servos: Ailerons, elevator, throttle, rudder.
203
                        switch (i) {
238
                        switch (i) {
204
                        case 0:
239
                        case 0:
205
                                tmp = term[ROLL];
240
                                tmp = term[ROLL];
206
                                break;
241
                                break;
207
                        case 1:
242
                        case 1:
208
                                tmp = term[PITCH];
243
                                tmp = term[PITCH];
209
                                break;
244
                                break;
210
                        case 2:
245
                        case 2:
211
                                tmp = term[THROTTLE];
246
                                tmp = term[THROTTLE];
212
                                break;
247
                                break;
213
                        case 3:
248
                        case 3:
214
                                tmp = term[YAW];
249
                                tmp = term[YAW];
215
                                break;
250
                                break;
216
                        default:
251
                        default:
217
                                tmp = 0;
252
                                tmp = 0;
218
                        }
253
                        }
219
                        // These are all signed and in the same units as the RC stuff in rc.c.
254
                        // These are all signed and in the same units as the RC stuff in rc.c.
220
                        controlServos[i] = tmp;
255
                        controlServos[i] = tmp;
221
                }
256
                }
222
        }
257
        }
223
 
258
 
224
        calculateControlServoValues();
259
        calculateControlServoValues();
225
 
260
 
226
        // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
261
        // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
227
        // Debugging
262
        // Debugging
228
        // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
263
        // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
229
        if (!(--debugDataTimer)) {
264
        if (!(--debugDataTimer)) {
230
                debugDataTimer = 24; // update debug outputs at 488 / 24 = 20.3 Hz.
265
                debugDataTimer = 24; // update debug outputs at 488 / 24 = 20.3 Hz.
231
                debugOut.analog[0] = gyro_PID[PITCH]; // in 0.1 deg
266
                debugOut.analog[0] = gyro_PID[PITCH]; // in 0.1 deg
232
                debugOut.analog[1] = gyro_PID[ROLL]; // in 0.1 deg
267
                debugOut.analog[1] = gyro_PID[ROLL]; // in 0.1 deg
233
                debugOut.analog[2] = gyro_PID[YAW];
268
                debugOut.analog[2] = gyro_PID[YAW];
234
 
269
 
235
                debugOut.analog[3] = attitude[PITCH] / (GYRO_DEG_FACTOR / 10); // in 0.1 deg
270
                debugOut.analog[3] = attitude[PITCH] / (GYRO_DEG_FACTOR / 10); // in 0.1 deg
236
                debugOut.analog[4] = attitude[ROLL] / (GYRO_DEG_FACTOR / 10); // in 0.1 deg
271
                debugOut.analog[4] = attitude[ROLL] / (GYRO_DEG_FACTOR / 10); // in 0.1 deg
237
                debugOut.analog[5] = attitude[YAW] / (GYRO_DEG_FACTOR / 10);
272
                debugOut.analog[5] = attitude[YAW] / (GYRO_DEG_FACTOR / 10);
238
 
273
 
239
                debugOut.analog[6] = target[PITCH] / (GYRO_DEG_FACTOR / 10); // in 0.1 deg
274
                debugOut.analog[6] = target[PITCH] / (GYRO_DEG_FACTOR / 10); // in 0.1 deg
240
                debugOut.analog[7] = target[ROLL] / (GYRO_DEG_FACTOR / 10); // in 0.1 deg
275
                debugOut.analog[7] = target[ROLL] / (GYRO_DEG_FACTOR / 10); // in 0.1 deg
241
                debugOut.analog[8] = target[YAW] / (GYRO_DEG_FACTOR / 10);
276
                debugOut.analog[8] = target[YAW] / (GYRO_DEG_FACTOR / 10);
242
 
277
 
243
                debugOut.analog[9] = error[PITCH] / (GYRO_DEG_FACTOR / 10); // in 0.1 deg
278
                debugOut.analog[9] = error[PITCH] / (GYRO_DEG_FACTOR / 10); // in 0.1 deg
244
                debugOut.analog[10] = error[ROLL] / (GYRO_DEG_FACTOR / 10); // in 0.1 deg
279
                debugOut.analog[10] = error[ROLL] / (GYRO_DEG_FACTOR / 10); // in 0.1 deg
245
                debugOut.analog[11] = error[YAW] / (GYRO_DEG_FACTOR / 10);
280
                debugOut.analog[11] = error[YAW] / (GYRO_DEG_FACTOR / 10);
246
 
281
 
247
                debugOut.analog[12] = term[PITCH];
282
                debugOut.analog[12] = term[PITCH];
248
                debugOut.analog[13] = term[ROLL];
283
                debugOut.analog[13] = term[ROLL];
249
                debugOut.analog[14] = term[YAW];
284
                debugOut.analog[14] = term[YAW];
250
 
285
 
251
                //DebugOut.Analog[18] = (10 * controlIntegrals[CONTROL_ELEVATOR]) / GYRO_DEG_FACTOR_PITCHROLL; // in 0.1 deg
286
                //DebugOut.Analog[18] = (10 * controlIntegrals[CONTROL_ELEVATOR]) / GYRO_DEG_FACTOR_PITCHROLL; // in 0.1 deg
252
                //DebugOut.Analog[19] = (10 * controlIntegrals[CONTROL_AILERONS]) / GYRO_DEG_FACTOR_PITCHROLL; // in 0.1 deg
287
                //DebugOut.Analog[19] = (10 * controlIntegrals[CONTROL_AILERONS]) / GYRO_DEG_FACTOR_PITCHROLL; // in 0.1 deg
253
                //debugOut.analog[22] = (10 * IPart[PITCH]) / GYRO_DEG_FACTOR; // in 0.1 deg
288
                //debugOut.analog[22] = (10 * IPart[PITCH]) / GYRO_DEG_FACTOR; // in 0.1 deg
254
                //debugOut.analog[23] = (10 * IPart[ROLL]) / GYRO_DEG_FACTOR; // in 0.1 deg
289
                //debugOut.analog[23] = (10 * IPart[ROLL]) / GYRO_DEG_FACTOR; // in 0.1 deg
255
        }
290
        }
256
}
291
}
257
 
292