Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
pfc_actuators.c File Reference
#include "preflight_checks.h"
#include "core/abi.h"
#include "modules/datalink/telemetry.h"
#include <stdio.h>
+ Include dependency graph for pfc_actuators.c:

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.1f
 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
 

Detailed Description

Author
Freek van Tienen freek.nosp@m..v.t.nosp@m.ienen.nosp@m.@gma.nosp@m.il.co.nosp@m.m Checks the actuators with feedback before takeoff

Definition in file pfc_actuators.c.


Data Structure Documentation

◆ pfc_actuator_t

struct pfc_actuator_t

The configuration struct of the actuator.

Definition at line 75 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.

◆ pfc_actuators_t

struct pfc_actuators_t

Definition at line 87 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.

Macro Definition Documentation

◆ PFC_ACTUATORS_DEBUG

#define PFC_ACTUATORS_DEBUG   false

Enable debugging to set the expected feedback values.

Definition at line 50 of file pfc_actuators.c.

◆ pfc_actuators_debug

#define pfc_actuators_debug (   ...)

Send a debug message to the ground station.

Definition at line 134 of file pfc_actuators.c.

◆ PFC_ACTUATORS_MAX_ANGLE_ERROR

#define PFC_ACTUATORS_MAX_ANGLE_ERROR   0.1f

Maximum error for the angle of the actuators (rad)

Definition at line 36 of file pfc_actuators.c.

◆ PFC_ACTUATORS_MAX_RPM_ERROR

#define PFC_ACTUATORS_MAX_RPM_ERROR   250.0f

Maximum error for the RPM of the actuators.

Definition at line 43 of file pfc_actuators.c.

Enumeration Type Documentation

◆ 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 66 of file pfc_actuators.c.

◆ pfc_actuators_state_t

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 56 of file pfc_actuators.c.

Function Documentation

◆ pfc_act_feedback_cb()

◆ pfc_actuators_cb()

static void pfc_actuators_cb ( struct preflight_result_t result)
static

Check the actuators with feedback.

Parameters
resultThe result of the preflight checks

Definition at line 268 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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pfc_actuators_error()

static void pfc_actuators_error ( const char *  fmt,
  ... 
)
static

Send an error message to the ground station.

Parameters
fmtThe format of the message
...The arguments for the format

Definition at line 114 of file pfc_actuators.c.

References DefaultChannel, DefaultDevice, and msg.

Referenced by pfc_actuators_run().

+ Here is the caller graph for this function:

◆ pfc_actuators_init()

◆ pfc_actuators_run()

◆ pfc_actuators_start()

◆ pfc_actuators_value()

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.

Parameters
idxThe index of the actuator in the preflight checks struct
valueThe value if no checks are performed on this actuator

Definition at line 248 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.

Variable Documentation

◆ act_feedback_ev

abi_event act_feedback_ev
static

Definition at line 105 of file pfc_actuators.c.

Referenced by pfc_actuators_init(), and stabilization_indi_init().

◆ actuators_pfc

struct preflight_check_t actuators_pfc
static

Definition at line 1 of file pfc_actuators.c.

Referenced by pfc_actuators_init().

◆ pfc_acts

struct pfc_actuator_t pfc_acts[] = PFC_ACTUATORS
static

◆ pfc_actuators