Paparazzi UAS  v5.12_stable-4-g9b43e9b
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
nps_fdm.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2009 Antoine Drouin <poinix@gmail.com>
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 
22 #ifndef NPS_FDM
23 #define NPS_FDM
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 #include "std.h"
30 #include "../flight_gear.h"
33 
34 /*
35  Notations for fdm variables
36  ---------------------------
37  coordinate system [ frame ] name
38 
39  ecef_inertial_vel is the time derivative of position
40  with respect to inertial frame expressed in ECEF ( Earth Centered Earth Fixed)
41  coordinate system.
42 */
43 
44 struct NpsFdm {
45 
46  double time;
47  double init_dt;
48  double curr_dt;
49  bool on_ground;
50  int nan_count;
51 
52  /* position */
56  double hmsl;
57  // for debugging
58  struct LlaCoor_d lla_pos_pprz; //lla converted by pprz from ecef
59  struct LlaCoor_d lla_pos_geod; //geodetic lla from jsbsim
60  struct LlaCoor_d lla_pos_geoc; //geocentric lla from jsbsim
61  double agl; //AGL from jsbsim in m
62 
67 
69  struct DoubleVect3 body_ecef_vel; /* aka UVW */
72 
77 
82 
85 
88 
89  /* attitude */
95 
96  /* angular velocity and acceleration in body frame, wrt ECEF frame */
99 
100  /* angular velocity and acceleration in body frame, wrt inertial ECI frame */
103 
106 
107  struct DoubleVect3 wind;
108 
109  double airspeed;
110  double pressure;
111  double total_pressure;
113  double temperature;
114  double pressure_sl;
115  double aoa;
116  double sideslip;
117 
118  // Control surface positions (normalized values)
119  float elevator;
120  float flap;
123  float rudder;
124 
125  //engine state for first engine
127  uint32_t eng_state[FG_NET_FDM_MAX_ENGINES];// Engine state (off, cranking, running)
128  float rpm[FG_NET_FDM_MAX_ENGINES]; // Engine RPM rev/min
129 
130 };
131 
132 extern struct NpsFdm fdm;
133 
134 extern void nps_fdm_init(double dt);
135 extern void nps_fdm_run_step(bool launch, double *commands, int commands_nb);
136 extern void nps_fdm_set_wind(double speed, double dir);
137 extern void nps_fdm_set_wind_ned(double wind_north, double wind_east, double wind_down);
138 extern void nps_fdm_set_turbulence(double wind_speed, int turbulence_severity);
140 extern void nps_fdm_set_temperature(double temp, double h);
141 
142 #ifdef __cplusplus
143 } /* extern "C" */
144 #endif
145 
146 #endif /* NPS_FDM */
Roation quaternion.
double agl
Definition: nps_fdm.h:61
double total_pressure
total atmospheric pressure in Pascal
Definition: nps_fdm.h:111
uint32_t eng_state[FG_NET_FDM_MAX_ENGINES]
Definition: nps_fdm.h:127
struct DoubleQuat ecef_to_body_quat
Definition: nps_fdm.h:90
double time
Definition: nps_fdm.h:46
vector in North East Down coordinates Units: meters
struct NedCoor_d ltpprz_ecef_accel
accel in ltppprz frame, wrt ECEF frame
Definition: nps_fdm.h:81
struct LlaCoor_d lla_pos_geoc
Definition: nps_fdm.h:60
struct DoubleVect3 body_inertial_accel
acceleration in body frame, wrt ECI inertial frame
Definition: nps_fdm.h:84
struct DoubleRates body_ecef_rotvel
Definition: nps_fdm.h:97
struct NpsFdm fdm
Holds all necessary NPS FDM state information.
euler angles
float left_aileron
Definition: nps_fdm.h:121
struct NedCoor_d ltp_ecef_accel
acceleration in LTP frame, wrt ECEF frame
Definition: nps_fdm.h:76
angular rates
bool on_ground
Definition: nps_fdm.h:49
struct DoubleRates body_ecef_rotaccel
Definition: nps_fdm.h:98
struct LlaCoor_d lla_pos_pprz
Definition: nps_fdm.h:58
vector in Latitude, Longitude and Altitude
struct DoubleRates body_inertial_rotvel
Definition: nps_fdm.h:101
int nan_count
Definition: nps_fdm.h:50
void nps_fdm_set_temperature(double temp, double h)
Set temperature in degrees Celcius at given height h above MSL.
struct DoubleEulers ltp_to_body_eulers
Definition: nps_fdm.h:92
struct NedCoor_d ltp_ecef_vel
velocity in LTP frame, wrt ECEF frame
Definition: nps_fdm.h:74
#define FG_NET_FDM_MAX_ENGINES
Definition: flight_gear.h:113
double pressure_sl
pressure at sea level in Pascal
Definition: nps_fdm.h:114
Definition: nps_fdm.h:44
struct NedCoor_d ltpprz_pos
Definition: nps_fdm.h:54
double hmsl
Definition: nps_fdm.h:56
Paparazzi double-precision floating point math for geodetic calculations.
struct EcefCoor_d ecef_ecef_vel
velocity in ECEF frame, wrt ECEF frame
Definition: nps_fdm.h:64
double airspeed
equivalent airspeed in m/s
Definition: nps_fdm.h:109
struct DoubleVect3 body_accel
acceleration in body frame as measured by an accelerometer (incl.
Definition: nps_fdm.h:87
double pressure
current (static) atmospheric pressure in Pascal
Definition: nps_fdm.h:110
float elevator
Definition: nps_fdm.h:119
float right_aileron
Definition: nps_fdm.h:122
void nps_fdm_set_turbulence(double wind_speed, int turbulence_severity)
double init_dt
Definition: nps_fdm.h:47
uint32_t num_engines
Definition: nps_fdm.h:126
unsigned long uint32_t
Definition: types.h:18
struct DoubleVect3 wind
velocity in m/s in NED
Definition: nps_fdm.h:107
struct LlaCoor_d lla_pos_geod
Definition: nps_fdm.h:59
double dynamic_pressure
dynamic pressure in Pascal
Definition: nps_fdm.h:112
void nps_fdm_run_step(bool launch, double *commands, int commands_nb)
Update the simulation state.
vector in EarthCenteredEarthFixed coordinates
void nps_fdm_init(double dt)
Set JSBsim specific fields that are not used for Gazebo.
double curr_dt
Definition: nps_fdm.h:48
struct LlaCoor_d lla_pos
Definition: nps_fdm.h:55
struct DoubleVect3 body_ecef_vel
velocity in body frame, wrt ECEF frame
Definition: nps_fdm.h:69
static void h(const real32_T x[7], const real32_T q[4], real32_T y[6])
double temperature
current temperature in degrees Celcius
Definition: nps_fdm.h:113
pprz_t commands[COMMANDS_NB]
Storage of intermediate command values.
Definition: commands.c:30
float rpm[FG_NET_FDM_MAX_ENGINES]
Definition: nps_fdm.h:128
struct DoubleQuat ltpprz_to_body_quat
Definition: nps_fdm.h:93
struct EcefCoor_d ecef_pos
Definition: nps_fdm.h:53
struct DoubleVect3 body_ecef_accel
acceleration in body frame, wrt ECEF frame
Definition: nps_fdm.h:71
struct DoubleVect3 ltp_g
Definition: nps_fdm.h:104
float rudder
Definition: nps_fdm.h:123
Paparazzi double precision floating point algebra.
struct NedCoor_d ltpprz_ecef_vel
velocity in ltppprz frame, wrt ECEF frame
Definition: nps_fdm.h:79
void nps_fdm_set_wind_ned(double wind_north, double wind_east, double wind_down)
float flap
Definition: nps_fdm.h:120
struct DoubleQuat ltp_to_body_quat
Definition: nps_fdm.h:91
double sideslip
sideslip angle in rad
Definition: nps_fdm.h:116
struct EcefCoor_d ecef_ecef_accel
acceleration in ECEF frame, wrt ECEF frame
Definition: nps_fdm.h:66
void nps_fdm_set_wind(double speed, double dir)
struct DoubleEulers ltpprz_to_body_eulers
Definition: nps_fdm.h:94
struct DoubleRates body_inertial_rotaccel
Definition: nps_fdm.h:102
double aoa
angle of attack in rad
Definition: nps_fdm.h:115
struct DoubleVect3 ltp_h
Definition: nps_fdm.h:105