35 int main(
int argc,
char **argv)
91 struct timespec requestStart;
92 struct timespec requestEnd;
93 struct timespec waitFor;
97 struct timeval tv_now;
106 gettimeofday(&tv_now, NULL);
111 printf(
"Press <enter> to continue (or CTRL-Z to suspend).\nEnter a new time factor if needed (current: %f): ",
114 if (fgets(line, 127, stdin)) {
115 if ((sscanf(line,
" %le ", &tf) == 1)) {
116 if (tf > 0 && tf < 1000) {
122 gettimeofday(&tv_now, NULL);
134 gettimeofday(&tv_now, NULL);
139 printf(
"%f,%f,%f,%f,%f,%f,",
nps_main.
host_time_factor, host_time_elapsed, host_time_now,
nps_main.
scaled_initial_time,
144 static int prev_cnt = 0;
145 static int grow_cnt = 0;
155 if (cnt > (prev_cnt)) {grow_cnt++;}
157 if (grow_cnt < 0) {grow_cnt = 0;}
161 printf(
"Warning: The time factor is too large for efficient operation! Please reduce the time factor.\n");
171 task_ns = (requestEnd.tv_sec - requestStart.tv_sec) * 1000000000L + (requestEnd.tv_nsec - requestStart.tv_nsec);
175 waitFor.tv_nsec = period_ns - task_ns;
176 nanosleep(&waitFor, NULL);
180 printf(
"MAIN THREAD: task took longer than one period, exactly %f [ms], but the period is %f [ms]\n",
181 (
double)task_ns / 1E6, (
double)period_ns / 1E6);
void nps_atmosphere_update(double dt)
struct NpsAutopilot nps_autopilot
#ifndef NPS_NO_MOTOR_MIXING #include "modules/actuators/motor_mixing.h"
double commands[NPS_COMMANDS_NB]
void nps_autopilot_run_step(double time)
#define NPS_COMMANDS_NB
Number of commands sent to the FDM of NPS.
void nps_autopilot_run_systime_step(void)
void nps_autopilot_init(enum NpsRadioControlType type, int num_script, char *js_dev)
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...
void * nps_flight_gear_loop(void *data)
#define clock_get_current_time(_x)
int nps_main_init(int argc, char **argv)
void * nps_main_display(void *data)
double scaled_initial_time
double time_to_double(struct timeval *t)
pthread_mutex_t fdm_mutex
int main(int argc, char **argv)
void nps_radio_and_autopilot_init(void)
void nps_update_launch_from_dl(uint8_t value)
void nps_main_run_sim_step(void)
void * nps_main_loop(void *data)
void nps_sensors_run_step(double time)
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.