Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
ahrs_sim.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2011 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 
29 #include "modules/ahrs/ahrs_sim.h"
31 #include "generated/airframe.h"
32 #include "state.h"
33 
34 extern float sim_phi;
35 extern float sim_theta;
36 extern float sim_psi;
37 extern float sim_p;
38 extern float sim_q;
39 extern float sim_r;
40 
41 // for sim of e.g. Xsens ins
42 #ifndef INS_ROLL_NEUTRAL_DEFAULT
43 #define INS_ROLL_NEUTRAL_DEFAULT 0
44 #endif
45 #ifndef INS_PITCH_NEUTRAL_DEFAULT
46 #define INS_PITCH_NEUTRAL_DEFAULT 0
47 #endif
50 
51 
53 {
54  struct FloatEulers ltp_to_imu_euler = { sim_phi, sim_theta, sim_psi };
55  struct FloatRates imu_rate = { sim_p, sim_q, sim_r };
56  /* set ltp_to_body to same as ltp_to_imu, currently no difference simulated */
57  stateSetNedToBodyEulers_f(MODULE_AHRS_SIM_ID, &ltp_to_imu_euler);
58  stateSetBodyRates_f(MODULE_AHRS_SIM_ID, &imu_rate);
59 }
60 
float sim_q
#define INS_PITCH_NEUTRAL_DEFAULT
Definition: ahrs_sim.c:46
void update_ahrs_from_sim(void)
Definition: ahrs_sim.c:52
float ins_roll_neutral
Definition: ahrs_sim.c:48
float sim_psi
float sim_r
float ins_pitch_neutral
Definition: ahrs_sim.c:49
float sim_p
float sim_theta
#define INS_ROLL_NEUTRAL_DEFAULT
Definition: ahrs_sim.c:43
float sim_phi
Interface to set the AHRS from the simple OCaml simulator.
euler angles
angular rates
static void stateSetNedToBodyEulers_f(uint16_t id, struct FloatEulers *ned_to_body_eulers)
Set vehicle body attitude from euler angles (float).
Definition: state.h:1267
static void stateSetBodyRates_f(uint16_t id, struct FloatRates *body_rate)
Set vehicle body angular rate (float).
Definition: state.h:1346
Paparazzi floating point algebra.
API to get/set the generic vehicle states.