Paparazzi UAS
v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
|
#include "preflight_checks.h"
#include "core/abi.h"
#include "modules/datalink/telemetry.h"
#include <stdio.h>
#include <math.h>
Go to the source code of this file.
Data Structures | |
struct | pfc_actuator_t |
The configuration struct of the actuator. More... | |
struct | pfc_actuators_t |
Macros | |
#define | PFC_ACTUATORS_MAX_ANGLE_ERROR 0.05f |
Maximum error for the angle of the actuators (rad) More... | |
#define | PFC_ACTUATORS_MAX_RPM_ERROR 250.0f |
Maximum error for the RPM of the actuators. More... | |
#define | PFC_ACTUATORS_DEBUG false |
Enable debugging to set the expected feedback values. More... | |
#define | pfc_actuators_debug(...) |
Send a debug message to the ground station. More... | |
Enumerations | |
enum | pfc_actuators_state_t { PFC_ACTUATORS_STATE_INIT , PFC_ACTUATORS_STATE_RUNNING , PFC_ACTUATORS_STATE_SUCCESS , PFC_ACTUATORS_STATE_ERROR } |
The status of the preflight checks. More... | |
enum | pfc_actuator_state_t { PFC_ACTUATOR_STATE_WAIT , PFC_ACTUATOR_STATE_LOW , PFC_ACTUATOR_STATE_HIGH } |
The state of the actuator during the test. More... | |
Functions | |
static void | pfc_actuators_cb (struct preflight_result_t *result) |
Check the actuators with feedback. More... | |
static void | pfc_act_feedback_cb (uint8_t sender_id, struct act_feedback_t *feedback, uint8_t num_act) |
Callback for the actuator feedback. More... | |
static void | pfc_actuators_error (const char *fmt,...) |
Send an error message to the ground station. More... | |
void | pfc_actuators_init (void) |
Register the preflight checks for the actuators. More... | |
void | pfc_actuators_run (void) |
Move the actuators, should be put in the command laws. More... | |
void | pfc_actuators_start (bool start) |
Start the actuator testing. More... | |
int16_t | pfc_actuators_value (uint8_t idx, int16_t value) |
Get the actuator value in the command laws to move the actuator during the preflight checks. More... | |
Variables | |
static struct pfc_actuator_t | pfc_acts [] = PFC_ACTUATORS |
static struct pfc_actuators_t | pfc_actuators |
static struct preflight_check_t | actuators_pfc |
static abi_event | act_feedback_ev |
Definition in file pfc_actuators.c.
struct pfc_actuator_t |
The configuration struct of the actuator.
Definition at line 76 of file pfc_actuators.c.
Data Fields | ||
---|---|---|
uint8_t | feedback_id | The feedback id of the actuator (255 for none) |
uint8_t | feedback_id2 | The secondary feedback id of the actuator (255 for none) |
int16_t | high | The high value to set the actuator to. |
float | high_feedback | The expected feedback value when the actuator is high. |
int16_t | low | The low value to set the actuator to. |
float | low_feedback | The expected feedback value when the actuator is low. |
float | timeout | The timeout for the actuator to move. |
struct pfc_actuators_t |
Definition at line 88 of file pfc_actuators.c.
Data Fields | ||
---|---|---|
uint8_t | act_idx | The current actuator index. |
uint8_t | act_nb | The number of actuators. |
float | act_start_time | The start time of the actuator (during the test) |
enum pfc_actuator_state_t | act_state | The state of the actuator (during the test) |
float | last_feedback | The last measured feedback value of the actuator. |
float | last_feedback2 | The last measured secondary feedback value of the actuator. |
float | last_feedback_err | The last expected feedback error of the actuator (based on RPM/angle) |
float | last_feedback_err2 | The last expected secondary feedback error of the actuator (based on RPM/angle) |
enum pfc_actuators_state_t | state | The state of the preflight checks. |
#define PFC_ACTUATORS_DEBUG false |
Enable debugging to set the expected feedback values.
Definition at line 51 of file pfc_actuators.c.
#define pfc_actuators_debug | ( | ... | ) |
Send a debug message to the ground station.
Definition at line 135 of file pfc_actuators.c.
#define PFC_ACTUATORS_MAX_ANGLE_ERROR 0.05f |
Maximum error for the angle of the actuators (rad)
Definition at line 37 of file pfc_actuators.c.
#define PFC_ACTUATORS_MAX_RPM_ERROR 250.0f |
Maximum error for the RPM of the actuators.
Definition at line 44 of file pfc_actuators.c.
enum pfc_actuator_state_t |
The state of the actuator during the test.
Enumerator | |
---|---|
PFC_ACTUATOR_STATE_WAIT | |
PFC_ACTUATOR_STATE_LOW | |
PFC_ACTUATOR_STATE_HIGH |
Definition at line 67 of file pfc_actuators.c.
The status of the preflight checks.
Enumerator | |
---|---|
PFC_ACTUATORS_STATE_INIT | |
PFC_ACTUATORS_STATE_RUNNING | |
PFC_ACTUATORS_STATE_SUCCESS | |
PFC_ACTUATORS_STATE_ERROR |
Definition at line 57 of file pfc_actuators.c.
|
static |
Callback for the actuator feedback.
Definition at line 290 of file pfc_actuators.c.
References pfc_actuators_t::act_idx, pfc_actuators_t::act_nb, pfc_actuator_t::feedback_id, pfc_actuator_t::feedback_id2, idx, pfc_actuators_t::last_feedback, pfc_actuators_t::last_feedback2, pfc_actuators_t::last_feedback_err, pfc_actuators_t::last_feedback_err2, pfc_acts, pfc_actuators, PFC_ACTUATORS_MAX_ANGLE_ERROR, PFC_ACTUATORS_MAX_RPM_ERROR, PFC_ACTUATORS_STATE_RUNNING, act_feedback_t::act_feedback_set_t::position, act_feedback_t::position, act_feedback_t::act_feedback_set_t::rpm, act_feedback_t::rpm, act_feedback_t::set, and pfc_actuators_t::state.
Referenced by pfc_actuators_init().
|
static |
Check the actuators with feedback.
result | The result of the preflight checks |
Definition at line 269 of file pfc_actuators.c.
References pfc_actuators_t::act_idx, pfc_actuators_t::act_nb, pfc_actuators, PFC_ACTUATORS_STATE_ERROR, PFC_ACTUATORS_STATE_INIT, PFC_ACTUATORS_STATE_RUNNING, PFC_ACTUATORS_STATE_SUCCESS, preflight_error(), preflight_success(), and pfc_actuators_t::state.
Referenced by pfc_actuators_init().
|
static |
Send an error message to the ground station.
fmt | The format of the message |
... | The arguments for the format |
Definition at line 115 of file pfc_actuators.c.
References DefaultChannel, DefaultDevice, and msg.
Referenced by pfc_actuators_run().
void pfc_actuators_init | ( | void | ) |
Register the preflight checks for the actuators.
Definition at line 141 of file pfc_actuators.c.
References ABI_BROADCAST, act_feedback_ev, pfc_actuators_t::act_idx, pfc_actuators_t::act_nb, pfc_actuators_t::act_state, actuators_pfc, pfc_actuators_t::last_feedback, pfc_actuators_t::last_feedback2, pfc_act_feedback_cb(), pfc_acts, PFC_ACTUATOR_STATE_WAIT, pfc_actuators, pfc_actuators_cb(), PFC_ACTUATORS_STATE_INIT, preflight_check_register(), and pfc_actuators_t::state.
void pfc_actuators_run | ( | void | ) |
Move the actuators, should be put in the command laws.
Definition at line 156 of file pfc_actuators.c.
References pfc_actuators_t::act_idx, pfc_actuators_t::act_nb, pfc_actuators_t::act_start_time, pfc_actuators_t::act_state, pfc_actuator_t::feedback_id, pfc_actuator_t::feedback_id2, get_sys_time_float(), pfc_actuator_t::high_feedback, pfc_actuators_t::last_feedback, pfc_actuators_t::last_feedback2, pfc_actuators_t::last_feedback_err, pfc_actuators_t::last_feedback_err2, pfc_actuator_t::low_feedback, pfc_acts, PFC_ACTUATOR_STATE_HIGH, PFC_ACTUATOR_STATE_LOW, PFC_ACTUATOR_STATE_WAIT, pfc_actuators, PFC_ACTUATORS_DEBUG, pfc_actuators_debug, pfc_actuators_error(), PFC_ACTUATORS_STATE_ERROR, PFC_ACTUATORS_STATE_RUNNING, PFC_ACTUATORS_STATE_SUCCESS, pfc_actuators_t::state, and pfc_actuator_t::timeout.
void pfc_actuators_start | ( | bool | start | ) |
Start the actuator testing.
Definition at line 227 of file pfc_actuators.c.
References pfc_actuators_t::act_idx, pfc_actuators_t::act_start_time, pfc_actuators_t::act_state, pfc_actuators_t::last_feedback, pfc_actuators_t::last_feedback2, PFC_ACTUATOR_STATE_WAIT, pfc_actuators, PFC_ACTUATORS_STATE_INIT, PFC_ACTUATORS_STATE_RUNNING, and pfc_actuators_t::state.
Get the actuator value in the command laws to move the actuator during the preflight checks.
idx | The index of the actuator in the preflight checks struct |
value | The value if no checks are performed on this actuator |
Definition at line 249 of file pfc_actuators.c.
References pfc_actuators_t::act_idx, pfc_actuators_t::act_state, pfc_actuator_t::high, idx, pfc_actuator_t::low, pfc_acts, PFC_ACTUATOR_STATE_HIGH, PFC_ACTUATOR_STATE_LOW, pfc_actuators, PFC_ACTUATORS_STATE_RUNNING, and pfc_actuators_t::state.
|
static |
Definition at line 106 of file pfc_actuators.c.
Referenced by pfc_actuators_init(), and stabilization_indi_init().
|
static |
Definition at line 1 of file pfc_actuators.c.
Referenced by pfc_actuators_init().
|
static |
Definition at line 1 of file pfc_actuators.c.
Referenced by pfc_act_feedback_cb(), pfc_actuators_init(), pfc_actuators_run(), and pfc_actuators_value().
|
static |
Definition at line 1 of file pfc_actuators.c.
Referenced by pfc_act_feedback_cb(), pfc_actuators_cb(), pfc_actuators_init(), pfc_actuators_run(), pfc_actuators_start(), and pfc_actuators_value().