Paparazzi UAS v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
nps_main.h
Go to the documentation of this file.
1#ifndef NPS_MAIN_H
2#define NPS_MAIN_H
3
4#include <pthread.h>
5#include <sys/time.h>
6#include "nps_fdm.h"
8#include "nps_atmosphere.h"
9#include "nps_sensors.h"
10#include "nps_autopilot.h"
11
12#ifdef __MACH__ // OS X does not have clock_gettime, use clock_get_time
13#include <mach/clock.h>
14#include <mach/mach.h>
15void clock_get_current_time(struct timespec *ts);
16#else // Linux
17#define clock_get_current_time(_x) clock_gettime(CLOCK_REALTIME, _x)
18#endif // #ifdef __MACH__
19
20#define SIM_DT (1./SYS_TIME_FREQUENCY)
21#define DISPLAY_DT (1./30.)
22#define HOST_TIMEOUT_MS 40
23
24extern pthread_t th_flight_gear; // sends/receives flight gear packets
25extern pthread_t th_display_ivy; // sends Ivy messages
26extern pthread_t th_main_loop; // handles simulation
27
28extern pthread_mutex_t fdm_mutex; // mutex for fdm data
29
30extern int pauseSignal; // for catching SIGTSTP
31
32extern bool nps_main_parse_options(int argc, char **argv);
33
34extern int nps_main_init(int argc, char **argv);
35extern void nps_radio_and_autopilot_init(void);
36extern void nps_main_run_sim_step(void);
37extern void nps_set_time_factor(float time_factor);
38
39extern void* nps_main_loop(void* data __attribute__((unused)));
40extern void* nps_flight_gear_loop(void* data __attribute__((unused)));
41extern void* nps_main_display(void* data __attribute__((unused)));
42
43extern void tstp_hdl(int n __attribute__((unused)));
44extern void cont_hdl(int n __attribute__((unused)));
45
46extern double time_to_double(struct timeval *t);
47extern double ntime_to_double(struct timespec *t);
48
50
51extern void nps_hitl_impl_init(void); // implement for HITL specific implementation
52
53struct NpsMain {
57 double sim_time;
59 char *fg_host;
60 unsigned int fg_port;
61 unsigned int fg_port_in;
62 unsigned int fg_time_offset;
63 int fg_fdm;
64 char *js_dev;
67 bool norc;
68 char *ivy_bus;
70};
71
72extern struct NpsMain nps_main;
73
74#endif /* NPS_MAIN_H */
uint16_t foo
Definition main_demo5.c:58
Atmosphere model (pressure, wind) for NPS.
char * spektrum_dev
Definition nps_main.h:65
char * js_dev
Definition nps_main.h:64
void tstp_hdl(int n)
void * nps_main_loop(void *data)
double display_time
Definition nps_main.h:58
int rc_script
Definition nps_main.h:66
unsigned int fg_port_in
Definition nps_main.h:61
#define clock_get_current_time(_x)
Definition nps_main.h:17
pthread_t th_display_ivy
bool norc
Definition nps_main.h:67
void cont_hdl(int n)
bool nodisplay
Definition nps_main.h:69
double host_time_factor
Definition nps_main.h:56
struct NpsMain nps_main
void nps_radio_and_autopilot_init(void)
int fg_fdm
Definition nps_main.h:63
void nps_update_launch_from_dl(uint8_t value)
double sim_time
Definition nps_main.h:57
char * fg_host
Definition nps_main.h:59
int nps_main_init(int argc, char **argv)
char * ivy_bus
Definition nps_main.h:68
void nps_main_run_sim_step(void)
bool nps_main_parse_options(int argc, char **argv)
void * nps_main_display(void *data)
int pauseSignal
void nps_hitl_impl_init(void)
END pprzlink_dev.
void nps_set_time_factor(float time_factor)
double scaled_initial_time
Definition nps_main.h:55
void * nps_flight_gear_loop(void *data)
double time_to_double(struct timeval *t)
pthread_mutex_t fdm_mutex
pthread_t th_main_loop
double real_initial_time
Definition nps_main.h:54
unsigned int fg_time_offset
Definition nps_main.h:62
unsigned int fg_port
Definition nps_main.h:60
pthread_t th_flight_gear
double ntime_to_double(struct timespec *t)
Architecture independent timing functions.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.