#include <stdio.h>#include <stdlib.h>#include <unistd.h>#include <signal.h>#include <string.h>#include <time.h>#include <sys/time.h>#include "gmatrix.h"#include "imu.h"#include "magnetometer.h"#include "gps.h"#include "sonar.h"#include "sensors.h"#include "calibration.h"#include "protocol.h"#include "estimation.h"#include "control.h"#include "datalogger.h"#include "ui.h"#include "mavlink_module.h"#include "threads_linux.h"
Go to the source code of this file.
Macros | |
| #define | TASK1_PERIOD_US 20000 |
| #define | TASK2_PERIOD_US 100000 |
Functions | |
| void | threads_linux_timer_task_1 (union sigval sigval) |
| void | threads_linux_timer_task_2 (union sigval sigval) |
| int | threads_linux_init (void) |
| int | threads_linux_periodic_task_1 (void) |
| int | threads_linux_periodic_task_2 (void) |
| void | threads_linux_timer_task_1 (union sigval sigval) |
| void | threads_linux_timer_task_2 (union sigval sigval) |
| void | threads_linux_timer_start_task_1 (void) |
| void | threads_linux_timer_start_task_2 (void) |
| void | threads_linux_timer_stop_task_1 (void) |
| void | threads_linux_timer_stop_task_2 (void) |
| void | threads_linux_timer_function_task_1 (void) |
| void | threads_linux_timer_function_task_2 (void) |
| int | threads_reset_timer (void) |
| int | threads_get_time (double *time_control_task_s, double *Ts_control_task_s, double *mean_time_control_task_s, double *t0_control_task_s) |
Variables | |
| unsigned char | quittask |
| int | total = 0 |
| int | failure = 0 |
| timer_t | timer_task_1 |
| volatile double | t_task_1_global = 0.0 |
| volatile double | T_task_1_exec_global = 0.0 |
| volatile double | T_task_1_mean_global = 0.0 |
| volatile double | T_task_1_min_global = 0.0 |
| volatile double | T_task_1_max_global = 0.0 |
| volatile int | task_1_period_us = TASK1_PERIOD_US |
| volatile int | flag_task_1_firstexecution = 1 |
| volatile double | t0 = 0.0 |
| timer_t | timer_task_2 |
| volatile double | t_task_2_global = 0.0 |
| volatile double | T_task_2_exec_global = 0.0 |
| volatile double | T_task_2_mean_global = 0.0 |
| volatile double | T_task_2_min_global = 0.0 |
| volatile double | T_task_2_max_global = 0.0 |
| volatile int | task_2_period_us = TASK2_PERIOD_US |
| volatile int | flag_task_2_firstexecution = 1 |
| unsigned int | telemetry_mode = UI_NCURSES_MODE |
| BATTERY_DATA_STRUCT | battery_data |
| GPS_DATA_STRUCT | gps_data |
| IMU_DATA_STRUCT | imu_data |
| PITOT_DATA_STRUCT | pitot_data |
| PWM_READ_DATA_STRUCT | pwm_read_data |
| PWM_WRITE_DATA_STRUCT | pwm_write_data |
| SCP1000_DATA_STRUCT | scp1000_data |
| SONAR_DATA_STRUCT | sonar_data |
| GPSMEASURE | gps_measure |
| IMUMEASURE | imu_measure |
| MAGNETOMETERMEASURE | magnetometer_measure |
| SONARMEASURE | sonar_measure |
| CALIBRATION_ALTIMETER_STRUCT | calibration_altimeter_data |
| CALIBRATION_LOCAL_COORDINATE_SYSTEM_STRUCT | calibration_local_coordinate_system_data |
| CALIBRATION_LOCAL_FIELDS_STRUCT | calibration_local_fields_data |
| ESTIMATION_DATA_STRUCT | estimation_data |
| CONTROL_DATA_STRUCT | control_data |
| #define TASK1_PERIOD_US 20000 |
Definition at line 32 of file threads_linux.c.
Referenced by threads_linux_init().
| #define TASK2_PERIOD_US 100000 |
Definition at line 33 of file threads_linux.c.
Referenced by threads_linux_init().
| int threads_get_time | ( | double * | time_control_task_s, |
| double * | Ts_control_task_s, | ||
| double * | mean_time_control_task_s, | ||
| double * | t0_control_task_s | ||
| ) |
Definition at line 576 of file threads_linux.c.
References t0, t_task_1_global, T_task_1_mean_global, and task_1_period_us.
| int threads_linux_init | ( | void | ) |
Definition at line 94 of file threads_linux.c.
References battery_data, calibration_altimeter_data, calibration_local_coordinate_system_data, calibration_local_fields_data, control_data, datalogger_close(), datalogger_init(), DATALOGGER_RUNNING, datalogger_status(), DATALOGGER_SUCCESS, datalogger_update_IPC(), datalogger_write_file(), estimation_data, gps_data, gps_measure, imu_measure, magnetometer_measure, pitot_data, pwm_read_data, pwm_write_data, quittask, scp1000_data, sonar_data, sonar_measure, status, TASK1_PERIOD_US, TASK2_PERIOD_US, task_1_period_us, threads_linux_timer_start_task_1(), threads_linux_timer_start_task_2(), threads_linux_timer_stop_task_1(), threads_linux_timer_stop_task_2(), ui_close(), and ui_init().

| int threads_linux_periodic_task_1 | ( | void | ) |
Definition at line 287 of file threads_linux.c.
References battery_data, calibration_altimeter_data, calibration_local_coordinate_system_data, calibration_local_fields_data, control_data, DATALOGGER_NOT_RUNNING, DATALOGGER_RUNNING, datalogger_set_Ts(), datalogger_status(), datalogger_update(), estimation_data, failure, gps_data, gps_measure, imu_measure, magnetometer_measure, pitot_data, pwm_read_data, pwm_write_data, scp1000_data, sonar_data, sonar_measure, t0, T_task_1_exec_global, t_task_1_global, T_task_2_exec_global, task_1_period_us, threads_reset_timer(), and total.
Referenced by threads_linux_timer_function_task_1().


| int threads_linux_periodic_task_2 | ( | void | ) |
Definition at line 348 of file threads_linux.c.
References battery_data, calibration_altimeter_data, calibration_local_coordinate_system_data, calibration_local_fields_data, control_data, estimation_data, failure, gps_data, gps_measure, imu_measure, magnetometer_measure, pitot_data, pwm_read_data, pwm_write_data, scp1000_data, sonar_data, t0, t_task_1_global, telemetry_mode, total, UI_NCURSES_MODE, and ui_update().
Referenced by threads_linux_timer_function_task_2().


| void threads_linux_timer_function_task_1 | ( | void | ) |
Definition at line 457 of file threads_linux.c.
References flag_task_1_firstexecution, status, t0, T_task_1_exec_global, t_task_1_global, T_task_1_max_global, T_task_1_mean_global, T_task_1_min_global, and threads_linux_periodic_task_1().
Referenced by threads_linux_timer_task_1().


| void threads_linux_timer_function_task_2 | ( | void | ) |
Definition at line 514 of file threads_linux.c.
References flag_task_2_firstexecution, status, T_task_2_exec_global, t_task_2_global, T_task_2_max_global, T_task_2_mean_global, T_task_2_min_global, and threads_linux_periodic_task_2().
Referenced by threads_linux_timer_task_2().


| void threads_linux_timer_start_task_1 | ( | void | ) |
Definition at line 375 of file threads_linux.c.
References flag_task_1_firstexecution, task_1_period_us, threads_linux_timer_task_1(), and timer_task_1.
Referenced by threads_linux_init().


| void threads_linux_timer_start_task_2 | ( | void | ) |
Definition at line 406 of file threads_linux.c.
References flag_task_2_firstexecution, task_2_period_us, threads_linux_timer_task_2(), and timer_task_2.
Referenced by threads_linux_init().


| void threads_linux_timer_stop_task_1 | ( | void | ) |
Definition at line 437 of file threads_linux.c.
References timer_task_1.
Referenced by threads_linux_init().

| void threads_linux_timer_stop_task_2 | ( | void | ) |
Definition at line 447 of file threads_linux.c.
References timer_task_2.
Referenced by threads_linux_init().

| void threads_linux_timer_task_1 | ( | union sigval | sigval | ) |
Definition at line 363 of file threads_linux.c.
References threads_linux_timer_function_task_1().
Referenced by threads_linux_timer_start_task_1().


| void threads_linux_timer_task_1 | ( | union sigval sigval | ) |
Definition at line 363 of file threads_linux.c.
References threads_linux_timer_function_task_1().
Referenced by threads_linux_timer_start_task_1().


| void threads_linux_timer_task_2 | ( | union sigval | sigval | ) |
Definition at line 369 of file threads_linux.c.
References threads_linux_timer_function_task_2().
Referenced by threads_linux_timer_start_task_2().


| void threads_linux_timer_task_2 | ( | union sigval sigval | ) |
Definition at line 369 of file threads_linux.c.
References threads_linux_timer_function_task_2().
Referenced by threads_linux_timer_start_task_2().


| int threads_reset_timer | ( | void | ) |
Definition at line 570 of file threads_linux.c.
References t0, and t_task_1_global.
Referenced by threads_linux_periodic_task_1().

| BATTERY_DATA_STRUCT battery_data |
Definition at line 68 of file threads_linux.c.
Referenced by threads_linux_init(), threads_linux_periodic_task_1(), and threads_linux_periodic_task_2().
| CALIBRATION_ALTIMETER_STRUCT calibration_altimeter_data |
Definition at line 84 of file threads_linux.c.
Referenced by threads_linux_init(), threads_linux_periodic_task_1(), and threads_linux_periodic_task_2().
| CALIBRATION_LOCAL_COORDINATE_SYSTEM_STRUCT calibration_local_coordinate_system_data |
Definition at line 85 of file threads_linux.c.
Referenced by threads_linux_init(), threads_linux_periodic_task_1(), and threads_linux_periodic_task_2().
| CALIBRATION_LOCAL_FIELDS_STRUCT calibration_local_fields_data |
Definition at line 86 of file threads_linux.c.
Referenced by threads_linux_init(), threads_linux_periodic_task_1(), and threads_linux_periodic_task_2().
| CONTROL_DATA_STRUCT control_data |
Definition at line 92 of file threads_linux.c.
Referenced by threads_linux_init(), threads_linux_periodic_task_1(), and threads_linux_periodic_task_2().
| ESTIMATION_DATA_STRUCT estimation_data |
Definition at line 89 of file threads_linux.c.
Referenced by threads_linux_init(), threads_linux_periodic_task_1(), and threads_linux_periodic_task_2().
| int failure = 0 |
Definition at line 42 of file threads_linux.c.
Referenced by threads_linux_periodic_task_1(), and threads_linux_periodic_task_2().
| volatile int flag_task_1_firstexecution = 1 |
Definition at line 52 of file threads_linux.c.
Referenced by threads_linux_timer_function_task_1(), and threads_linux_timer_start_task_1().
| volatile int flag_task_2_firstexecution = 1 |
Definition at line 63 of file threads_linux.c.
Referenced by threads_linux_timer_function_task_2(), and threads_linux_timer_start_task_2().
| GPS_DATA_STRUCT gps_data |
Definition at line 69 of file threads_linux.c.
Referenced by threads_linux_init(), threads_linux_periodic_task_1(), and threads_linux_periodic_task_2().
| GPSMEASURE gps_measure |
Definition at line 78 of file threads_linux.c.
Referenced by threads_linux_init(), threads_linux_periodic_task_1(), and threads_linux_periodic_task_2().
| IMU_DATA_STRUCT imu_data |
Definition at line 70 of file threads_linux.c.
| IMUMEASURE imu_measure |
Definition at line 79 of file threads_linux.c.
Referenced by threads_linux_init(), threads_linux_periodic_task_1(), and threads_linux_periodic_task_2().
| MAGNETOMETERMEASURE magnetometer_measure |
Definition at line 80 of file threads_linux.c.
Referenced by threads_linux_init(), threads_linux_periodic_task_1(), and threads_linux_periodic_task_2().
| PITOT_DATA_STRUCT pitot_data |
Definition at line 71 of file threads_linux.c.
Referenced by threads_linux_init(), threads_linux_periodic_task_1(), and threads_linux_periodic_task_2().
| PWM_READ_DATA_STRUCT pwm_read_data |
Definition at line 72 of file threads_linux.c.
Referenced by threads_linux_init(), threads_linux_periodic_task_1(), and threads_linux_periodic_task_2().
| PWM_WRITE_DATA_STRUCT pwm_write_data |
Definition at line 73 of file threads_linux.c.
Referenced by threads_linux_init(), threads_linux_periodic_task_1(), and threads_linux_periodic_task_2().
| unsigned char quittask |
Definition at line 39 of file main.c.
Referenced by exit_program(), main(), and threads_linux_init().
| SCP1000_DATA_STRUCT scp1000_data |
Definition at line 74 of file threads_linux.c.
Referenced by threads_linux_init(), threads_linux_periodic_task_1(), and threads_linux_periodic_task_2().
| SONAR_DATA_STRUCT sonar_data |
Definition at line 75 of file threads_linux.c.
Referenced by threads_linux_init(), threads_linux_periodic_task_1(), and threads_linux_periodic_task_2().
| SONARMEASURE sonar_measure |
Definition at line 81 of file threads_linux.c.
Referenced by threads_linux_init(), and threads_linux_periodic_task_1().
| volatile double t0 = 0.0 |
Definition at line 53 of file threads_linux.c.
Referenced by threads_get_time(), threads_linux_periodic_task_1(), threads_linux_periodic_task_2(), threads_linux_timer_function_task_1(), and threads_reset_timer().
| volatile double T_task_1_exec_global = 0.0 |
Definition at line 47 of file threads_linux.c.
Referenced by threads_linux_periodic_task_1(), and threads_linux_timer_function_task_1().
| volatile double t_task_1_global = 0.0 |
Definition at line 46 of file threads_linux.c.
Referenced by threads_get_time(), threads_linux_periodic_task_1(), threads_linux_periodic_task_2(), threads_linux_timer_function_task_1(), and threads_reset_timer().
| volatile double T_task_1_max_global = 0.0 |
Definition at line 50 of file threads_linux.c.
Referenced by threads_linux_timer_function_task_1().
| volatile double T_task_1_mean_global = 0.0 |
Definition at line 48 of file threads_linux.c.
Referenced by threads_get_time(), and threads_linux_timer_function_task_1().
| volatile double T_task_1_min_global = 0.0 |
Definition at line 49 of file threads_linux.c.
Referenced by threads_linux_timer_function_task_1().
| volatile double T_task_2_exec_global = 0.0 |
Definition at line 58 of file threads_linux.c.
Referenced by threads_linux_periodic_task_1(), and threads_linux_timer_function_task_2().
| volatile double t_task_2_global = 0.0 |
Definition at line 57 of file threads_linux.c.
Referenced by threads_linux_timer_function_task_2().
| volatile double T_task_2_max_global = 0.0 |
Definition at line 61 of file threads_linux.c.
Referenced by threads_linux_timer_function_task_2().
| volatile double T_task_2_mean_global = 0.0 |
Definition at line 59 of file threads_linux.c.
Referenced by threads_linux_timer_function_task_2().
| volatile double T_task_2_min_global = 0.0 |
Definition at line 60 of file threads_linux.c.
Referenced by threads_linux_timer_function_task_2().
| volatile int task_1_period_us = TASK1_PERIOD_US |
Definition at line 51 of file threads_linux.c.
Referenced by threads_get_time(), threads_linux_init(), threads_linux_periodic_task_1(), and threads_linux_timer_start_task_1().
| volatile int task_2_period_us = TASK2_PERIOD_US |
Definition at line 62 of file threads_linux.c.
Referenced by threads_linux_timer_start_task_2().
| unsigned int telemetry_mode = UI_NCURSES_MODE |
Definition at line 64 of file threads_linux.c.
Referenced by threads_linux_periodic_task_2().
| timer_t timer_task_1 |
Definition at line 45 of file threads_linux.c.
Referenced by threads_linux_timer_start_task_1(), and threads_linux_timer_stop_task_1().
| timer_t timer_task_2 |
Definition at line 56 of file threads_linux.c.
Referenced by threads_linux_timer_start_task_2(), and threads_linux_timer_stop_task_2().
| int total = 0 |
Definition at line 41 of file threads_linux.c.
Referenced by threads_linux_periodic_task_1(), and threads_linux_periodic_task_2().
1.8.6