34 #include "generated/airframe.h"
35 #include "generated/flight_plan.h"
40 #ifndef FIXEDWING_FIRMWARE
41 #error "The module nps_fdm_fixedwing_sim is a basic flight model for fixedwing only"
44 #ifndef ROLL_RESPONSE_FACTOR
45 #define ROLL_RESPONSE_FACTOR 15.
48 #ifndef PITCH_RESPONSE_FACTOR
49 #define PITCH_RESPONSE_FACTOR 1.
52 #ifndef YAW_RESPONSE_FACTOR
53 #define YAW_RESPONSE_FACTOR 1.
60 #ifndef ROLL_MAX_SETPOINT
61 #define ROLL_MAX_SETPOINT RadOfDeg(40.)
64 #ifndef ROLL_RATE_MAX_SETPOINT
65 #define ROLL_RATE_MAX_SETPOINT RadOfDeg(15.)
68 #ifndef NOMINAL_AIRSPEED
69 #error "Please define NOMINAL_AIRSPEED in your airframe file"
72 #ifndef MAXIMUM_AIRSPEED
73 #define MAXIMUM_AIRSPEED (NOMINAL_AIRSPEED * 1.5)
77 #define MAXIMUM_POWER (5. * MAXIMUM_AIRSPEED * WEIGHT)
80 #ifndef AUTO_THROTTLE_NOMINAL_CRUISE_THROTTLE
81 #define AUTO_THROTTLE_NOMINAL_CRUISE_THROTTLE 0.45
164 static bool already_launched =
false;
165 if (launch && !already_launched) {
167 already_launched =
true;
175 double vn2 = NOMINAL_AIRSPEED * NOMINAL_AIRSPEED;
206 double lift = c_z *
v2;
263 llh_nav0.
lat = RadOfDeg((
double)NAV_LAT0 / 1e7);
264 llh_nav0.
lon = RadOfDeg((
double)NAV_LON0 / 1e7);
265 llh_nav0.
alt = (double)(NAV_ALT0) / 1000.0;
302 int turbulence_severity __attribute__((unused)))
307 double h __attribute__((unused)))
static void h(const real32_T x[7], const real32_T q[4], real32_T y[6])
pprz_t commands[COMMANDS_NB]
void double_quat_of_eulers(struct DoubleQuat *q, struct DoubleEulers *e)
#define VECT3_ASSIGN(_a, _x, _y, _z)
#define EULERS_ASSIGN(_e, _phi, _theta, _psi)
double alt
in meters above WGS84 reference ellipsoid
void ltp_def_from_ecef_d(struct LtpDef_d *def, struct EcefCoor_d *ecef)
void ecef_of_enu_vect_d(struct EcefCoor_d *ecef, struct LtpDef_d *def, struct EnuCoor_d *enu)
void ned_of_ecef_vect_d(struct NedCoor_d *ned, struct LtpDef_d *def, struct EcefCoor_d *ecef)
void lla_of_ecef_d(struct LlaCoor_d *lla, struct EcefCoor_d *ecef)
void ned_of_ecef_point_d(struct NedCoor_d *ned, struct LtpDef_d *def, struct EcefCoor_d *ecef)
void ecef_of_lla_d(struct EcefCoor_d *ecef, struct LlaCoor_d *lla)
void ecef_of_enu_point_d(struct EcefCoor_d *ecef, struct LtpDef_d *def, struct EnuCoor_d *enu)
vector in EarthCenteredEarthFixed coordinates
vector in East North Up coordinates Units: meters
vector in Latitude, Longitude and Altitude
definition of the local (flat earth) coordinate system
#define PPRZ_ISA_GRAVITY
earth-surface gravitational acceleration in m/s^2
#define PPRZ_ISA_SEA_LEVEL_PRESSURE
ISA sea level standard atmospheric pressure in Pascal.
struct NedCoor_d ltpprz_ecef_vel
velocity in ltppprz frame, wrt ECEF frame
double pressure_sl
pressure at sea level in Pascal
double total_pressure
total atmospheric pressure in Pascal
struct EcefCoor_d ecef_pos
struct NedCoor_d ltpprz_pos
struct NedCoor_d ltpprz_ecef_accel
accel in ltppprz frame, wrt ECEF frame
double dynamic_pressure
dynamic pressure in Pascal
struct DoubleEulers ltp_to_body_eulers
struct EcefCoor_d ecef_ecef_accel
acceleration in ECEF frame, wrt ECEF frame
double pressure
current (static) atmospheric pressure in Pascal
struct DoubleQuat ltp_to_body_quat
struct DoubleRates body_ecef_rotvel
struct EcefCoor_d ecef_ecef_vel
velocity in ECEF frame, wrt ECEF frame
double temperature
current temperature in degrees Celcius
struct DoubleEulers ltpprz_to_body_eulers
void nps_fdm_set_wind_ned(double wind_north, double wind_east, double wind_down)
void nps_fdm_init(double dt)
NPS FDM rover init.
static void init_ltp(void)
struct DoubleEulers rates
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 c...
#define ROLL_RATE_MAX_SETPOINT
#define AUTO_THROTTLE_NOMINAL_CRUISE_THROTTLE
static struct fixedwing_sim_state sim_state
void nps_fdm_set_temperature(double temp, double h)
Set temperature in degrees Celcius at given height h above MSL.
#define ROLL_MAX_SETPOINT
struct DoubleEulers attitude
#define ROLL_RESPONSE_FACTOR
void nps_fdm_set_turbulence(double wind_speed, int turbulence_severity)
#define YAW_RESPONSE_FACTOR
void nps_fdm_set_wind(double speed, double dir)
#define PITCH_RESPONSE_FACTOR
static struct LtpDef_d ltpdef
Paparazzi generic algebra macros.
Paparazzi floating point algebra.
Paparazzi generic macros for geodetic calculations.
Paparazzi double-precision floating point math for geodetic calculations.
Paparazzi floating point math for geodetic calculations.
Paparazzi atmospheric pressure conversion utilities.
API to get/set the generic vehicle states.