50 ts->tv_sec =
mts.tv_sec;
51 ts->tv_nsec =
mts.tv_nsec;
72 printf(
"Press <enter> to continue.\n");
78 return ((
double)
t->tv_sec + (
double)(
t->tv_usec * 1e-6));
83 return ((
double)
t->tv_sec + (
double)(
t->tv_nsec * 1e-9));
115 printf(
"host_time_factor,host_time_elapsed,host_time_now,scaled_initial_time,sim_time_before,display_time_before,sim_time_after,display_time_after\n");
170 static const char *
usage =
171 "Usage: %s [options]\n"
173 " -h Display this help\n"
174 " --fg_host <flight gear host> e.g. 127.0.0.1\n"
175 " --fg_port <flight gear port> e.g. 5501\n"
176 " --fg_port_in <flight gear in port> e.g. 5502\n"
177 " --fg_time_offset <offset in seconds> e.g. 21600 for 6h\n"
178 " -j --js_dev <optional joystick index> e.g. 1 (default 0)\n"
179 " --spektrum_dev <spektrum device> e.g. /dev/ttyUSB0\n"
180 " --rc_script <number> e.g. 0\n"
181 " --norc e.g. disable RC\n"
182 " --ivy_bus <ivy bus> e.g. 127.255.255.255\n"
183 " --time_factor <factor> e.g. 2.5\n"
184 " --nodisplay e.g. disable NPS ivy messages\n"
191 {
"fg_host", 1,
NULL, 0},
192 {
"fg_port", 1,
NULL, 0},
193 {
"fg_time_offset", 1,
NULL, 0},
194 {
"js_dev", 2,
NULL, 0},
195 {
"spektrum_dev", 1,
NULL, 0},
196 {
"rc_script", 1,
NULL, 0},
197 {
"norc", 0,
NULL, 0},
198 {
"ivy_bus", 1,
NULL, 0},
199 {
"time_factor", 1,
NULL, 0},
200 {
"fg_fdm", 0,
NULL, 0},
201 {
"fg_port_in", 1,
NULL, 0},
202 {
"nodisplay", 0,
NULL, 0},
256 printf(
"?? getopt returned character code 0%o ??\n", c);
302 printf(
"FG THREAD: task took longer than one period, exactly %f [ms], but the period is %f [ms]\n",
343 printf(
"IVY DISPLAY THREAD: task took longer than one period, exactly %f [ms], but the period is %f [ms]\n",
static void usage(BaseSequentialStream *lchp, char *p)
void nps_atmosphere_init(void)
void nps_fdm_init(double dt)
NPS FDM rover init.
struct NpsFdm fdm
Holds all necessary NPS FDM state information.
void nps_flightgear_send(void)
Send FlightGear GUI packet For visualization of airplane position and attitude only start fgfs with –...
void nps_flightgear_init(const char *host, unsigned int port, unsigned int port_in, unsigned int time_offset)
void nps_flightgear_send_fdm(void)
Send FlightGear FDM packet For visualization with moving surfaces (elevator, propeller etc).
void nps_ivy_display(struct NpsFdm *fdm_data, struct NpsSensors *sensors_data)
void nps_ivy_init(char *ivy_bus)
#define clock_get_current_time(_x)
void nps_radio_and_autopilot_init(void)
double scaled_initial_time
unsigned int fg_time_offset
int nps_main_init(int argc, char **argv)
bool nps_main_parse_options(int argc, char **argv)
void * nps_main_display(void *data)
void nps_set_time_factor(float time_factor)
void * nps_flight_gear_loop(void *data)
double time_to_double(struct timeval *t)
pthread_mutex_t fdm_mutex
double ntime_to_double(struct timespec *t)
void nps_sensors_init(double time)