Paparazzi UAS  v5.15_devel-111-g8fb4629
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
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 }
static void stateSetNedToBodyEulers_f(struct FloatEulers *ned_to_body_eulers)
Set vehicle body attitude from euler angles (float).
Definition: state.h:1105
#define INS_ROLL_NEUTRAL_DEFAULT
Definition: ahrs_sim.c:43
float sim_phi
in radians
Definition: sim_ahrs.c:12
float ins_roll_neutral
Definition: ahrs_sim.c:48
euler angles
Paparazzi floating point algebra.
void ahrs_register_impl(AhrsEnableOutput enable)
Register an AHRS implementation.
Definition: ahrs.c:62
float sim_theta
in radians
Definition: sim_ahrs.c:13
void update_ahrs_from_sim(void)
Definition: ahrs_sim.c:52
float sim_r
in radians/s
Definition: sim_ahrs.c:17
float sim_q
in radians/s
Definition: sim_ahrs.c:16
#define INS_PITCH_NEUTRAL_DEFAULT
Definition: ahrs_sim.c:46
void ahrs_sim_register(void)
Definition: ahrs_sim.c:64
API to get/set the generic vehicle states.
static void stateSetBodyRates_f(struct FloatRates *body_rate)
Set vehicle body angular rate (float).
Definition: state.h:1181
float sim_p
in radians/s
Definition: sim_ahrs.c:15
float sim_psi
in radians
Definition: sim_ahrs.c:14
angular rates
float ins_pitch_neutral
Definition: ahrs_sim.c:49
Interface to set the AHRS from the simple OCaml simulator.