Paparazzi UAS  v4.0.4_stable-3-gf39211a
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
stabilization_attitude_ref_int.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2010 The Paparazzi Team
3  *
4  * This file is part of paparazzi.
5  *
6  * paparazzi is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2, or (at your option)
9  * any later version.
10  *
11  * paparazzi is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with paparazzi; see the file COPYING. If not, write to
18  * the Free Software Foundation, 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  */
21 
27 #ifndef STABILISATION_ATTITUDE_REF_INT_H
28 #define STABILISATION_ATTITUDE_REF_INT_H
29 
30 #include "math/pprz_algebra_int.h"
31 
32 #include "subsystems/ahrs.h"
33 
34 extern struct Int32Eulers stab_att_sp_euler;
35 extern struct Int32Quat stab_att_sp_quat;
36 extern struct Int32Eulers stab_att_ref_euler;
37 extern struct Int32Quat stab_att_ref_quat;
38 extern struct Int32Rates stab_att_ref_rate;
39 extern struct Int32Rates stab_att_ref_accel;
40 
41 struct Int32RefModel {
42  struct Int32Rates omega;
43  struct Int32Rates zeta;
44 };
45 
46 extern struct Int32RefModel stab_att_ref_model;
47 
48 #define REF_ACCEL_FRAC 12
49 #define REF_RATE_FRAC 16
50 #define REF_ANGLE_FRAC 20
51 
52 #define REF_ANGLE_PI BFP_OF_REAL(3.1415926535897932384626433832795029, REF_ANGLE_FRAC)
53 #define REF_ANGLE_TWO_PI BFP_OF_REAL(2.*3.1415926535897932384626433832795029, REF_ANGLE_FRAC)
54 #define ANGLE_REF_NORMALIZE(_a) { \
55  while (_a > REF_ANGLE_PI) _a -= REF_ANGLE_TWO_PI; \
56  while (_a < -REF_ANGLE_PI) _a += REF_ANGLE_TWO_PI; \
57  }
58 
59 
60 static inline void reset_psi_ref_from_body(void) {
62  stab_att_ref_rate.r = 0;
64 }
65 
66 #endif /* STABILISATION_ATTITUDE_REF_INT_H */
static void reset_psi_ref_from_body(void)
Attitude and Heading Reference System interface.
Rotation quaternion.
struct Ahrs ahrs
global AHRS state (fixed point version)
Definition: ahrs.c:24
struct Int32Quat stab_att_sp_quat
with INT32_QUAT_FRAC
struct Int32Rates stab_att_ref_accel
with REF_ACCEL_FRAC
struct Int32RefModel stab_att_ref_model
struct Int32Eulers stab_att_ref_euler
with REF_ANGLE_FRAC
#define INT32_ANGLE_FRAC
struct Int32Rates stab_att_ref_rate
with REF_RATE_FRAC
#define REF_ANGLE_FRAC
angular rates
struct Int32Quat stab_att_ref_quat
with INT32_QUAT_FRAC
struct Int32Eulers ltp_to_body_euler
Rotation from LocalTangentPlane to body frame as Euler angles.
Definition: ahrs.h:50
struct Int32Eulers stab_att_sp_euler
with INT32_ANGLE_FRAC
int32_t psi
in rad with INT32_ANGLE_FRAC
int32_t r
in rad/s^2 with INT32_RATE_FRAC
Paparazzi fixed point algebra.
euler angles