Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
nps_fdm_fixedwing_sim.c File Reference
#include "nps_fdm.h"
#include <stdlib.h>
#include <stdio.h>
#include "std.h"
#include "math/pprz_geodetic.h"
#include "math/pprz_geodetic_double.h"
#include "math/pprz_geodetic_float.h"
#include "math/pprz_algebra.h"
#include "math/pprz_algebra_float.h"
#include "math/pprz_isa.h"
#include "generated/airframe.h"
#include "generated/flight_plan.h"
#include "state.h"
+ Include dependency graph for nps_fdm_fixedwing_sim.c:

Go to the source code of this file.

Data Structures

struct  fixedwing_sim_state
 

Macros

#define ROLL_RESPONSE_FACTOR   15.
 
#define PITCH_RESPONSE_FACTOR   1.
 
#define YAW_RESPONSE_FACTOR   1.
 
#define WEIGHT   1.
 
#define ROLL_MAX_SETPOINT   RadOfDeg(40.)
 
#define ROLL_RATE_MAX_SETPOINT   RadOfDeg(15.)
 
#define MAXIMUM_AIRSPEED   (NOMINAL_AIRSPEED * 1.5)
 
#define MAXIMUM_POWER   (5. * MAXIMUM_AIRSPEED * WEIGHT)
 
#define AUTO_THROTTLE_NOMINAL_CRUISE_THROTTLE   0.45
 

Functions

static void init_ltp (void)
 
void nps_fdm_init (double dt)
 NPS FDM rover init. More...
 
void nps_fdm_run_step (bool launch, double *commands, int commands_nb)
 Minimum complexity flight dynamic model In legacy Paparazzi simulator, was implemented in OCaml and correspond to the 'sim' target. More...
 
void nps_fdm_set_wind (double speed, double dir)
 
void nps_fdm_set_wind_ned (double wind_north, double wind_east, double wind_down)
 
void nps_fdm_set_turbulence (double wind_speed, int turbulence_severity)
 
void nps_fdm_set_temperature (double temp, double h)
 Set temperature in degrees Celcius at given height h above MSL. More...
 

Variables

struct NpsFdm fdm
 
static struct LtpDef_d ltpdef
 
static struct fixedwing_sim_state sim_state
 

Data Structure Documentation

◆ fixedwing_sim_state

struct fixedwing_sim_state

Definition at line 93 of file nps_fdm_fixedwing_sim.c.

+ Collaboration diagram for fixedwing_sim_state:
Data Fields
double airspeed
struct DoubleEulers attitude
double delta_pitch
double delta_roll
double delta_thrust
struct EnuCoor_d pos
struct DoubleEulers rates
struct EnuCoor_d speed
struct EnuCoor_d wind

Macro Definition Documentation

◆ AUTO_THROTTLE_NOMINAL_CRUISE_THROTTLE

#define AUTO_THROTTLE_NOMINAL_CRUISE_THROTTLE   0.45

Definition at line 81 of file nps_fdm_fixedwing_sim.c.

◆ MAXIMUM_AIRSPEED

#define MAXIMUM_AIRSPEED   (NOMINAL_AIRSPEED * 1.5)

Definition at line 73 of file nps_fdm_fixedwing_sim.c.

◆ MAXIMUM_POWER

#define MAXIMUM_POWER   (5. * MAXIMUM_AIRSPEED * WEIGHT)

Definition at line 77 of file nps_fdm_fixedwing_sim.c.

◆ PITCH_RESPONSE_FACTOR

#define PITCH_RESPONSE_FACTOR   1.

Definition at line 49 of file nps_fdm_fixedwing_sim.c.

◆ ROLL_MAX_SETPOINT

#define ROLL_MAX_SETPOINT   RadOfDeg(40.)

Definition at line 61 of file nps_fdm_fixedwing_sim.c.

◆ ROLL_RATE_MAX_SETPOINT

#define ROLL_RATE_MAX_SETPOINT   RadOfDeg(15.)

Definition at line 65 of file nps_fdm_fixedwing_sim.c.

◆ ROLL_RESPONSE_FACTOR

#define ROLL_RESPONSE_FACTOR   15.

Definition at line 45 of file nps_fdm_fixedwing_sim.c.

◆ WEIGHT

#define WEIGHT   1.

Definition at line 57 of file nps_fdm_fixedwing_sim.c.

◆ YAW_RESPONSE_FACTOR

#define YAW_RESPONSE_FACTOR   1.

Definition at line 53 of file nps_fdm_fixedwing_sim.c.

Function Documentation

◆ init_ltp()

static void init_ltp ( void  )
static

Definition at line 258 of file nps_fdm_fixedwing_sim.c.

References LlaCoor_d::alt, ecef_of_lla_d(), NpsFdm::ecef_pos, fdm, LlaCoor_d::lat, LlaCoor_d::lon, ltp_def_from_ecef_d(), NpsFdm::ltp_g, NpsFdm::ltp_h, ltpdef, DoubleVect3::x, DoubleVect3::y, and DoubleVect3::z.

Referenced by nps_fdm_init().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nps_fdm_init()

◆ nps_fdm_run_step()

void nps_fdm_run_step ( bool  launch,
double *  commands,
int  commands_nb 
)

Minimum complexity flight dynamic model In legacy Paparazzi simulator, was implemented in OCaml and correspond to the 'sim' target.

Johnson, E.N., Fontaine, S.G., and Kahn, A.D., “Minimum Complexity Uninhabited Air Vehicle Guidance And Flight Control System,” Proceedings of the 20th Digital Avionics Systems Conference, 2001. http://www.ae.gatech.edu/~ejohnson/JohnsonFontaineKahn.pdf

Johnson, E.N. and Fontaine, S.G., “Use Of Flight Simulation To Complement Flight Testing Of Low-Cost UAVs,” Proceedings of the AIAA Modeling and Simulation Technology Conference, 2001. http://www.ae.gatech.edu/~ejohnson/AIAA%202001-4059.pdf

Definition at line 156 of file nps_fdm_fixedwing_sim.c.

References fixedwing_sim_state::airspeed, alpha, fixedwing_sim_state::attitude, AUTO_THROTTLE_NOMINAL_CRUISE_THROTTLE, NpsFdm::body_ecef_rotvel, commands, NpsFdm::curr_dt, fixedwing_sim_state::delta_pitch, fixedwing_sim_state::delta_roll, fixedwing_sim_state::delta_thrust, double_quat_of_eulers(), NpsFdm::ecef_ecef_accel, NpsFdm::ecef_ecef_vel, ecef_of_enu_point_d(), ecef_of_enu_vect_d(), NpsFdm::ecef_pos, fdm, NpsFdm::hmsl, lla_of_ecef_d(), NpsFdm::lla_pos, NpsFdm::ltp_to_body_eulers, NpsFdm::ltp_to_body_quat, ltpdef, NpsFdm::ltpprz_ecef_accel, NpsFdm::ltpprz_ecef_vel, NpsFdm::ltpprz_pos, MAX_PPRZ, MAXIMUM_AIRSPEED, MAXIMUM_POWER, ned_of_ecef_point_d(), ned_of_ecef_vect_d(), DoubleRates::p, DoubleEulers::phi, PITCH_RESPONSE_FACTOR, fixedwing_sim_state::pos, PPRZ_ISA_GRAVITY, DoubleEulers::psi, DoubleRates::q, DoubleRates::r, fixedwing_sim_state::rates, ROLL_MAX_SETPOINT, ROLL_RATE_MAX_SETPOINT, ROLL_RESPONSE_FACTOR, sim_state, fixedwing_sim_state::speed, DoubleEulers::theta, v2, WEIGHT, fixedwing_sim_state::wind, EnuCoor_d::x, EnuCoor_d::y, YAW_RESPONSE_FACTOR, NedCoor_d::z, and EnuCoor_d::z.

+ Here is the call graph for this function:

◆ nps_fdm_set_temperature()

void nps_fdm_set_temperature ( double  temp,
double  h 
)

Set temperature in degrees Celcius at given height h above MSL.

Definition at line 305 of file nps_fdm_fixedwing_sim.c.

◆ nps_fdm_set_turbulence()

void nps_fdm_set_turbulence ( double  wind_speed,
int  turbulence_severity 
)

Definition at line 300 of file nps_fdm_fixedwing_sim.c.

◆ nps_fdm_set_wind()

void nps_fdm_set_wind ( double  speed,
double  dir 
)

◆ nps_fdm_set_wind_ned()

void nps_fdm_set_wind_ned ( double  wind_north,
double  wind_east,
double  wind_down 
)

Variable Documentation

◆ fdm

struct NpsFdm fdm

Definition at line 1 of file nps_fdm_fixedwing_sim.c.

Referenced by init_ltp(), nps_fdm_init(), and nps_fdm_run_step().

◆ ltpdef

struct LtpDef_d ltpdef
static

Definition at line 1 of file nps_fdm_fixedwing_sim.c.

Referenced by init_ltp(), and nps_fdm_run_step().

◆ sim_state

struct fixedwing_sim_state sim_state
static