36 #ifndef PFC_ACTUATORS_MAX_ANGLE_ERROR
37 #define PFC_ACTUATORS_MAX_ANGLE_ERROR 0.05f
43 #ifndef PFC_ACTUATORS_MAX_RPM_ERROR
44 #define PFC_ACTUATORS_MAX_RPM_ERROR 250.0f
50 #ifndef PFC_ACTUATORS_DEBUG
51 #define PFC_ACTUATORS_DEBUG false
121 int rc = vsnprintf(
msg, 200, fmt, args);
132 #if PFC_ACTUATORS_DEBUG
133 #define pfc_actuators_debug pfc_actuators_error
135 #define pfc_actuators_debug(...)
296 for(
uint8_t i = 0; i < num_act; i++) {
Main include for ABI (AirBorneInterface).
#define ABI_BROADCAST
Broadcast address.
Event structure to store callbacks in a linked list.
uint8_t msg[10]
Buffer used for general comunication over SPI (out buffer)
bool position
Position is set.
struct act_feedback_t::act_feedback_set_t set
Bitset registering what is set as feedback.
float position
In radians.
int16_t high
The high value to set the actuator to.
uint8_t feedback_id2
The secondary feedback id of the actuator (255 for none)
enum pfc_actuators_state_t state
The state of the preflight checks.
enum pfc_actuator_state_t act_state
The state of the actuator (during the test)
int16_t low
The low value to set the actuator to.
float high_feedback
The expected feedback value when the actuator is high.
pfc_actuators_state_t
The status of the preflight checks.
@ PFC_ACTUATORS_STATE_ERROR
@ PFC_ACTUATORS_STATE_INIT
@ PFC_ACTUATORS_STATE_SUCCESS
@ PFC_ACTUATORS_STATE_RUNNING
uint8_t feedback_id
The feedback id of the actuator (255 for none)
#define PFC_ACTUATORS_DEBUG
Enable debugging to set the expected feedback values.
uint8_t act_nb
The number of actuators.
void pfc_actuators_init(void)
Register the preflight checks for the actuators.
void pfc_actuators_start(bool start)
Start the actuator testing.
static void pfc_act_feedback_cb(uint8_t sender_id, struct act_feedback_t *feedback, uint8_t num_act)
Callback for the actuator feedback.
static struct preflight_check_t actuators_pfc
float act_start_time
The start time of the actuator (during the test)
float timeout
The timeout for the actuator to move.
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.
float last_feedback
The last measured feedback value of the actuator.
static struct pfc_actuator_t pfc_acts[]
float last_feedback_err2
The last expected secondary feedback error of the actuator (based on RPM/angle)
pfc_actuator_state_t
The state of the actuator during the test.
@ PFC_ACTUATOR_STATE_WAIT
@ PFC_ACTUATOR_STATE_HIGH
static void pfc_actuators_error(const char *fmt,...)
Send an error message to the ground station.
float low_feedback
The expected feedback value when the actuator is low.
#define PFC_ACTUATORS_MAX_RPM_ERROR
Maximum error for the RPM of the actuators.
float last_feedback_err
The last expected feedback error of the actuator (based on RPM/angle)
static struct pfc_actuators_t pfc_actuators
uint8_t act_idx
The current actuator index.
static void pfc_actuators_cb(struct preflight_result_t *result)
Check the actuators with feedback.
float last_feedback2
The last measured secondary feedback value of the actuator.
#define PFC_ACTUATORS_MAX_ANGLE_ERROR
Maximum error for the angle of the actuators (rad)
void pfc_actuators_run(void)
Move the actuators, should be put in the command laws.
static abi_event act_feedback_ev
#define pfc_actuators_debug(...)
Send a debug message to the ground station.
The configuration struct of the actuator.
void preflight_error(struct preflight_result_t *result, const char *fmt,...)
Register a preflight error used inside the preflight checking functions.
void preflight_success(struct preflight_result_t *result, const char *fmt,...)
Register a preflight success used inside the preflight checking functions.
void preflight_check_register(struct preflight_check_t *check, preflight_check_f func)
Register a preflight check and add it to the linked list.
static float get_sys_time_float(void)
Get the time in seconds since startup.
Periodic telemetry system header (includes downlink utility and generated code).
short int16_t
Typedef defining 16 bit short type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.