Subversion Repositories FlightCtrl

Rev

Rev 2160 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1645 - 1
/*********************************************************************************/
2
/* Attitude sense system (processing of gyro, accelerometer and altimeter data)  */
3
/*********************************************************************************/
1612 dongfang 4
 
5
#ifndef _ATTITUDE_H
6
#define _ATTITUDE_H
7
 
8
#include <inttypes.h>
2189 - 9
#include <math.h>
1612 dongfang 10
 
11
#include "analog.h"
2189 - 12
//#include "timer0.h"
13
//#define _PI 3.1415926535897932384626433832795
1612 dongfang 14
 
2189 - 15
#define ACC_MS2_FACTOR (1.0f / ACC_G_FACTOR_XY)
1612 dongfang 16
 
2189 - 17
// 57.3
18
#define RAD_DEG_FACTOR (180.0 / M_PI)
1612 dongfang 19
 
20
/*
1645 - 21
 * Attitudes calculated by numerical integration of gyro rates
1612 dongfang 22
 */
2189 - 23
extern int16_t attitude[3];
1612 dongfang 24
 
25
/*
26
 * Re-init flight attitude, setting all angles to 0 (or to whatever can be derived from acc. sensor).
27
 * To be called when the pilot commands gyro calibration (eg. by moving the left stick up-left or up-right).
28
 */
29
void attitude_setNeutral(void);
30
 
31
/*
32
 * Main routine, called from the flight loop.
33
 */
2189 - 34
void attitude_update(void);
2035 - 35
 
1612 dongfang 36
#endif //_ATTITUDE_H