Paparazzi UAS  v5.18.0_stable
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 
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 
55  struct FloatEulers ltp_to_imu_euler = { sim_phi, sim_theta, sim_psi };
56  struct FloatRates imu_rate = { sim_p, sim_q, sim_r };
57  /* set ltp_to_body to same as ltp_to_imu, currently no difference simulated */
58  stateSetNedToBodyEulers_f(&ltp_to_imu_euler);
59  stateSetBodyRates_f(&imu_rate);
60 
61 }
62 
63 
65 {
66  // dummy, simple ocaml sim only supports one basic fake AHRS anyway
67  ahrs_register_impl(NULL);
68 }
sim_phi
float sim_phi
in radians
Definition: sim_ahrs.c:12
ins_roll_neutral
float ins_roll_neutral
Definition: ahrs_sim.c:48
INS_PITCH_NEUTRAL_DEFAULT
#define INS_PITCH_NEUTRAL_DEFAULT
Definition: ahrs_sim.c:46
INS_ROLL_NEUTRAL_DEFAULT
#define INS_ROLL_NEUTRAL_DEFAULT
Definition: ahrs_sim.c:43
update_ahrs_from_sim
void update_ahrs_from_sim(void)
Definition: ahrs_sim.c:52
sim_r
float sim_r
in radians/s
Definition: sim_ahrs.c:17
pprz_algebra_float.h
Paparazzi floating point algebra.
ahrs_sim.h
sim_psi
float sim_psi
in radians
Definition: sim_ahrs.c:14
ins_pitch_neutral
float ins_pitch_neutral
Definition: ahrs_sim.c:49
stateSetBodyRates_f
static void stateSetBodyRates_f(struct FloatRates *body_rate)
Set vehicle body angular rate (float).
Definition: state.h:1181
stateSetNedToBodyEulers_f
static void stateSetNedToBodyEulers_f(struct FloatEulers *ned_to_body_eulers)
Set vehicle body attitude from euler angles (float).
Definition: state.h:1105
sim_theta
float sim_theta
in radians
Definition: sim_ahrs.c:13
FloatEulers
euler angles
Definition: pprz_algebra_float.h:84
sim_p
float sim_p
in radians/s
Definition: sim_ahrs.c:15
ahrs_register_impl
void ahrs_register_impl(AhrsEnableOutput enable)
Register an AHRS implementation.
Definition: ahrs.c:62
state.h
sim_q
float sim_q
in radians/s
Definition: sim_ahrs.c:16
ahrs_sim_register
void ahrs_sim_register(void)
Definition: ahrs_sim.c:64
FloatRates
angular rates
Definition: pprz_algebra_float.h:93