Paparazzi UAS
v5.14.0_stable-0-g3f680d1
Paparazzi is a free software Unmanned Aircraft System.
|
#include <pthread.h>
#include <sys/time.h>
#include "nps_fdm.h"
#include "mcu_periph/sys_time.h"
#include "nps_atmosphere.h"
#include "nps_sensors.h"
#include "nps_autopilot.h"
Go to the source code of this file.
Data Structures | |
struct | NpsMain |
Macros | |
#define | clock_get_current_time(_x) clock_gettime(CLOCK_REALTIME, _x) |
#define | SIM_DT (1./SYS_TIME_FREQUENCY) |
#define | DISPLAY_DT (1./30.) |
#define | HOST_TIMEOUT_MS 40 |
Functions | |
bool | nps_main_parse_options (int argc, char **argv) |
int | nps_main_init (int argc, char **argv) |
void | nps_radio_and_autopilot_init (void) |
void | nps_main_run_sim_step (void) |
void | nps_set_time_factor (float time_factor) |
void * | nps_main_loop (void *data) |
void * | nps_flight_gear_loop (void *data) |
void * | nps_main_display (void *data) |
void | tstp_hdl (int n) |
void | cont_hdl (int n) |
double | time_to_double (struct timeval *t) |
double | ntime_to_double (struct timespec *t) |
void | nps_update_launch_from_dl (uint8_t value) |
Variables | |
pthread_t | th_flight_gear |
pthread_t | th_display_ivy |
pthread_t | th_main_loop |
pthread_mutex_t | fdm_mutex |
int | pauseSignal |
struct NpsMain | nps_main |
struct NpsMain |
Definition at line 51 of file nps_main.h.
#define clock_get_current_time | ( | _x | ) | clock_gettime(CLOCK_REALTIME, _x) |
Definition at line 17 of file nps_main.h.
Referenced by nps_flight_gear_loop(), nps_ins_data_loop(), nps_main_display(), and nps_main_loop().
#define DISPLAY_DT (1./30.) |
Definition at line 21 of file nps_main.h.
Referenced by nps_flight_gear_loop(), and nps_main_display().
#define HOST_TIMEOUT_MS 40 |
Definition at line 22 of file nps_main.h.
Referenced by nps_main_loop().
#define SIM_DT (1./SYS_TIME_FREQUENCY) |
Definition at line 20 of file nps_main.h.
Referenced by nps_main_init(), nps_main_loop(), and nps_main_run_sim_step().
void cont_hdl | ( | int | n | ) |
Definition at line 61 of file nps_main_common.c.
References tstp_hdl().
Referenced by nps_main_init().
void* nps_flight_gear_loop | ( | void * | data | ) |
Definition at line 258 of file nps_main_common.c.
References clock_get_current_time, DISPLAY_DT, fdm_mutex, NpsMain::fg_fdm, NpsMain::fg_host, NpsMain::fg_port, NpsMain::fg_port_in, NpsMain::fg_time_offset, nps_flightgear_init(), nps_flightgear_send(), nps_flightgear_send_fdm(), nps_main, and TRUE.
Referenced by main().
void* nps_main_display | ( | void * | data | ) |
Definition at line 306 of file nps_main_common.c.
References clock_get_current_time, DISPLAY_DT, fdm, fdm_mutex, NpsMain::ivy_bus, NpsMain::nodisplay, nps_ivy_display(), nps_ivy_init(), nps_main, sensors, and TRUE.
Referenced by main().
int nps_main_init | ( | int | argc, |
char ** | argv | ||
) |
Definition at line 79 of file nps_main_common.c.
References cont_hdl(), NpsMain::display_time, NpsMain::host_time_factor, nps_atmosphere_init(), nps_fdm_init(), nps_main, nps_main_parse_options(), nps_radio_and_autopilot_init(), nps_sensors_init(), pauseSignal, NpsMain::real_initial_time, NpsMain::scaled_initial_time, SIM_DT, NpsMain::sim_time, time_to_double(), and tstp_hdl().
Referenced by main().
void* nps_main_loop | ( | void * | data | ) |
Definition at line 305 of file nps_main_hitl.c.
References clock_get_current_time, NpsMain::display_time, fdm, fdm_mutex, NpsMain::host_time_factor, HOST_TIMEOUT_MS, nps_main, nps_main_run_sim_step(), ntime_to_double(), pauseSignal, NpsMain::real_initial_time, NpsMain::scaled_initial_time, SIM_DT, NpsMain::sim_time, NpsFdm::time, time_to_double(), and TRUE.
Referenced by main().
bool nps_main_parse_options | ( | int | argc, |
char ** | argv | ||
) |
Definition at line 147 of file nps_main_common.c.
References NpsMain::fg_fdm, NpsMain::fg_host, NpsMain::fg_port, NpsMain::fg_port_in, NpsMain::fg_time_offset, NpsMain::host_time_factor, NpsMain::ivy_bus, NpsMain::js_dev, NpsMain::nodisplay, NpsMain::norc, nps_main, NpsMain::rc_script, NpsMain::spektrum_dev, and TRUE.
Referenced by nps_main_init().
void nps_main_run_sim_step | ( | void | ) |
Definition at line 99 of file nps_main_hitl.c.
References NpsAutopilot::commands, NpsAutopilot::launch, nps_atmosphere_update(), nps_autopilot, nps_autopilot_run_step(), nps_autopilot_run_systime_step(), NPS_COMMANDS_NB, nps_fdm_run_step(), nps_main, nps_sensors_run_step(), SIM_DT, and NpsMain::sim_time.
Referenced by nps_main_loop().
void nps_radio_and_autopilot_init | ( | void | ) |
Definition at line 75 of file nps_main_hitl.c.
References JOYSTICK, NpsMain::js_dev, NORC, NpsMain::norc, nps_autopilot_init(), nps_main, NpsMain::rc_script, SCRIPT, SPEKTRUM, and NpsMain::spektrum_dev.
Referenced by nps_main_init().
void nps_set_time_factor | ( | float | time_factor | ) |
Definition at line 119 of file nps_main_common.c.
References NpsMain::host_time_factor, nps_main, NpsMain::scaled_initial_time, and time_to_double().
Referenced by on_WORLD_ENV().
void nps_update_launch_from_dl | ( | uint8_t | value | ) |
Definition at line 93 of file nps_main_hitl.c.
References NpsAutopilot::launch, and nps_autopilot.
Referenced by on_DL_SETTING().
double ntime_to_double | ( | struct timespec * | t | ) |
Definition at line 74 of file nps_main_common.c.
Referenced by nps_main_loop().
double time_to_double | ( | struct timeval * | t | ) |
Definition at line 69 of file nps_main_common.c.
Referenced by nps_main_init(), nps_main_loop(), and nps_set_time_factor().
void tstp_hdl | ( | int | n | ) |
Definition at line 49 of file nps_main_common.c.
References pauseSignal.
Referenced by cont_hdl(), and nps_main_init().
pthread_mutex_t fdm_mutex |
Definition at line 28 of file nps_main.h.
Referenced by nps_ap_data_loop(), nps_flight_gear_loop(), nps_flightgear_receive(), nps_ins_data_loop(), nps_main_display(), and nps_main_loop().
struct NpsMain nps_main |
Definition at line 70 of file nps_main.h.
Referenced by main(), nps_flight_gear_loop(), nps_main_display(), nps_main_init(), nps_main_loop(), nps_main_parse_options(), nps_main_run_sim_step(), nps_radio_and_autopilot_init(), and nps_set_time_factor().
int pauseSignal |
Definition at line 30 of file nps_main.h.
Referenced by nps_main_init(), nps_main_loop(), and tstp_hdl().
pthread_t th_display_ivy |
Definition at line 25 of file nps_main.h.
Referenced by main().
pthread_t th_flight_gear |
Definition at line 24 of file nps_main.h.
Referenced by main().
pthread_t th_main_loop |
Definition at line 26 of file nps_main.h.
Referenced by main().