Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
nps_main.h File Reference
#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"
+ Include dependency graph for nps_main.h:
+ This graph shows which files directly or indirectly include this file:

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)
 
void nps_hitl_impl_init (void)
 END pprzlink_dev. More...
 

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
 

Data Structure Documentation

◆ NpsMain

struct NpsMain

Definition at line 53 of file nps_main.h.

Data Fields
double display_time
int fg_fdm
char * fg_host
unsigned int fg_port
unsigned int fg_port_in
unsigned int fg_time_offset
double host_time_factor
char * ivy_bus
char * js_dev
bool nodisplay
bool norc
int rc_script
double real_initial_time
double scaled_initial_time
double sim_time
char * spektrum_dev

Macro Definition Documentation

◆ clock_get_current_time

#define clock_get_current_time (   _x)    clock_gettime(CLOCK_REALTIME, _x)

Definition at line 17 of file nps_main.h.

◆ DISPLAY_DT

#define DISPLAY_DT   (1./30.)

Definition at line 21 of file nps_main.h.

◆ HOST_TIMEOUT_MS

#define HOST_TIMEOUT_MS   40

Definition at line 22 of file nps_main.h.

◆ SIM_DT

#define SIM_DT   (1./SYS_TIME_FREQUENCY)

Definition at line 20 of file nps_main.h.

Function Documentation

◆ cont_hdl()

void cont_hdl ( int  n)

Definition at line 68 of file nps_main_common.c.

References cont_hdl(), and tstp_hdl().

Referenced by cont_hdl(), and nps_main_init().

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

◆ nps_flight_gear_loop()

void* nps_flight_gear_loop ( void *  data)

Definition at line 265 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().

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

◆ nps_hitl_impl_init()

void nps_hitl_impl_init ( void  )

END pprzlink_dev.

Definition at line 154 of file nps_hitl_sensors.c.

References AP_BAUD, AP_DEV, char_available(), check_free_space(), dev, linkdev::device, SerialPort::fd, linkdev::fds, getch(), nps_ap_data_loop(), nps_sensors_loop(), linkdev::port, linkdev::pprz_tp, put_buffer(), put_byte(), send_message(), serial_port_free(), serial_port_new(), serial_port_open_raw(), th_ap_data, and th_sensors.

Referenced by main().

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

◆ nps_main_display()

void* nps_main_display ( void *  data)

Definition at line 313 of file nps_main_common.c.

References clock_get_current_time, DISPLAY_DT, fdm, NpsMain::ivy_bus, NpsMain::nodisplay, nps_ivy_display(), nps_ivy_init(), nps_main, sensors, and TRUE.

Referenced by main().

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

◆ nps_main_init()

int nps_main_init ( int  argc,
char **  argv 
)

◆ nps_main_loop()

void* nps_main_loop ( void *  data)

◆ nps_main_parse_options()

bool nps_main_parse_options ( int  argc,
char **  argv 
)

◆ nps_main_run_sim_step()

void nps_main_run_sim_step ( void  )

Definition at line 68 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().

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

◆ nps_radio_and_autopilot_init()

void nps_radio_and_autopilot_init ( void  )

Definition at line 58 of file nps_main_hitl.c.

References JOYSTICK, NpsMain::js_dev, NpsMain::norc, NORC, nps_autopilot_init(), nps_main, NpsMain::rc_script, SCRIPT, SPEKTRUM, and NpsMain::spektrum_dev.

Referenced by nps_main_init().

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

◆ nps_set_time_factor()

void nps_set_time_factor ( float  time_factor)

Definition at line 126 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().

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

◆ nps_update_launch_from_dl()

void nps_update_launch_from_dl ( uint8_t  value)

Definition at line 62 of file nps_main_hitl.c.

References NpsAutopilot::launch, and nps_autopilot.

Referenced by on_DL_SETTING().

+ Here is the caller graph for this function:

◆ ntime_to_double()

double ntime_to_double ( struct timespec *  t)

Definition at line 81 of file nps_main_common.c.

Referenced by nps_main_loop().

+ Here is the caller graph for this function:

◆ time_to_double()

double time_to_double ( struct timeval *  t)

Definition at line 76 of file nps_main_common.c.

Referenced by nps_main_init(), nps_main_loop(), and nps_set_time_factor().

+ Here is the caller graph for this function:

◆ tstp_hdl()

void tstp_hdl ( int  n)

Definition at line 56 of file nps_main_common.c.

References pauseSignal.

Referenced by cont_hdl(), and nps_main_init().

+ Here is the caller graph for this function:

Variable Documentation

◆ fdm_mutex

pthread_mutex_t fdm_mutex
extern

◆ nps_main

◆ pauseSignal

int pauseSignal
extern

Definition at line 37 of file nps_main_common.c.

Referenced by nps_main_init(), nps_main_loop(), and tstp_hdl().

◆ th_display_ivy

pthread_t th_display_ivy
extern

Definition at line 34 of file nps_main_common.c.

Referenced by main().

◆ th_flight_gear

pthread_t th_flight_gear
extern

Definition at line 33 of file nps_main_common.c.

Referenced by main().

◆ th_main_loop

pthread_t th_main_loop
extern

Definition at line 35 of file nps_main_common.c.

Referenced by main().