Subversion Repositories FlightCtrl

Rev

Rev 1645 | Rev 1775 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1645 Rev 1646
Line 1... Line 1...
1
#ifndef _ANALOG_H
1
#ifndef _ANALOG_H
2
#define _ANALOG_H
2
#define _ANALOG_H
3
#include <inttypes.h>
3
#include <inttypes.h>
Line 4... Line 4...
4
 
4
 
5
// #include "invenSense.h"
5
//#include "invenSense.h"
-
 
6
//#include "ENC-03_FC1.3.h"
Line 6... Line 7...
6
#include "ENC-03_FC1.3.h"
7
#include "ADXRS610_FC2.0.h"
7
 
8
 
8
/*
9
/*
9
 * How much low pass filtering to apply for gyro_PID.
10
 * How much low pass filtering to apply for gyro_PID.
10
 * 0=illegal, 1=no filtering, 2=50% last value + 50% new value, 3=67% last value + 33 % new value etc...
11
 * 0=illegal, 1=no filtering, 2=50% last value + 50% new value, 3=67% last value + 33 % new value etc...
11
 * Temporarily replaced by userparam-configurable variable.
12
 * Temporarily replaced by userparam-configurable variable.
Line 12... Line 13...
12
 */
13
 */
13
#define GYROS_PIDFILTER 1
14
// #define GYROS_PID_FILTER 1
14
 
15
 
15
/*
16
/*
16
 * How much low pass filtering to apply for gyro_ATT.
17
 * How much low pass filtering to apply for gyro_ATT.
17
 * 0=illegal, 1=no filtering, 2=50% last value + 50% new value, 3=67% last value + 33 % new value etc...
18
 * 0=illegal, 1=no filtering, 2=50% last value + 50% new value, 3=67% last value + 33 % new value etc...
Line 18... Line 19...
18
 * Temporarily replaced by userparam-configurable variable.
19
 * Temporarily replaced by userparam-configurable variable.
19
 */
20
 */
Line 20... Line 21...
20
#define GYROS_INTEGRALFILTER 1
21
// #define GYROS_ATT_FILTER 1
21
 
22
 
22
// Temporarily replaced by userparam-configurable variable.
23
// Temporarily replaced by userparam-configurable variable.
23
//#define ACC_FILTER 4
24
// #define ACC_FILTER 4
24
 
25
 
25
/*
26
/*
-
 
27
  About setting constants for different gyros:
-
 
28
  Main parameters are positive directions and voltage/angular speed gain.
-
 
29
  The "Positive direction" is the rotation direction around an axis where
26
  About setting constants for different gyros:
30
  the corresponding gyro outputs a voltage > the no-rotation voltage.
27
  Main parameters are positive directions and voltage/angular speed gain.
31
  A gyro is considered, in this code, to be "forward" if its positive
28
  The "Positive direction" is the rotation direction around an axis where
32
  direction is:
Line 29... Line 33...
29
  the corresponding gyro outputs a voltage > the no-rotation voltage.
33
  - Nose down for pitch
30
  A gyro is considered, in this code, to be "forward" if its positive
34
  - Left hand side down for roll
Line 98... Line 102...
98
 * channelsForStates array in analog.c.
102
 * channelsForStates array in analog.c.
99
 */
103
 */
100
#define GYRO_SUMMATION_FACTOR_PITCHROLL 4
104
#define GYRO_SUMMATION_FACTOR_PITCHROLL 4
101
#define GYRO_SUMMATION_FACTOR_YAW 2
105
#define GYRO_SUMMATION_FACTOR_YAW 2
Line -... Line 106...
-
 
106
 
-
 
107
#define ACC_SUMMATION_FACTOR_PITCHROLL 2
-
 
108
#define ACC_SUMMATION_FACTOR_Z 1
102
 
109
 
103
/*
110
/*
104
  Integration:
111
  Integration:
105
  The HiResXXXX values are divided by 8 (in H&I firmware) before integration.
112
  The HiResXXXX values are divided by 8 (in H&I firmware) before integration.
106
  In the Killagreg rewrite of the H&I firmware, the factor 8 is called
113
  In the Killagreg rewrite of the H&I firmware, the factor 8 is called
Line 158... Line 165...
158
 */
165
 */
159
#define GYRO_NOISE_MEASUREMENT_DAMPING 5
166
#define GYRO_NOISE_MEASUREMENT_DAMPING 5
Line 160... Line 167...
160
 
167
 
161
#define PITCH 0
168
#define PITCH 0
-
 
169
#define ROLL 1
-
 
170
#define YAW 2
162
#define ROLL 1
171
#define Z 2
163
/*
172
/*
164
 * The values that this module outputs
173
 * The values that this module outputs
165
 * These first 2 exported arrays are zero-offset. The "PID" ones are used
174
 * These first 2 exported arrays are zero-offset. The "PID" ones are used
166
 * in the attitude control as rotation rates. The "ATT" ones are for
175
 * in the attitude control as rotation rates. The "ATT" ones are for
Line 178... Line 187...
178
extern volatile int16_t yawGyro;
187
extern volatile int16_t yawGyro;
Line 179... Line 188...
179
 
188
 
180
/*
189
/*
181
 * This is not really for external use - but the ENC-03 gyro modules needs it.
190
 * This is not really for external use - but the ENC-03 gyro modules needs it.
182
 */
191
 */
Line 183... Line 192...
183
extern volatile int16_t rawGyroSum[2], rawYawGyroSum;
192
extern volatile int16_t rawGyroSum[3];
184
 
193
 
185
/*
194
/*
186
 * The acceleration values that this module outputs. They are zero based.
195
 * The acceleration values that this module outputs. They are zero based.
187
 */
196
 */
Line 188... Line 197...
188
extern volatile int16_t acc[2], ZAcc;
197
extern volatile int16_t acc[3];
189
extern volatile int16_t filteredAcc[2];
198
extern volatile int16_t filteredAcc[2];
190
 
199