37 #include "pprzlink/messages.h"
39 #include "generated/airframe.h"
48 #ifndef AOA_PWM_CHANNEL
49 #error "AOA_PWM_CHANNEL needs to be defined to use AOA_pwm module"
53 #ifndef AOA_PWM_PERIOD
54 #define AOA_PWM_PERIOD 4096
56 #ifndef AOA_PWM_OFFSET
58 #define AOA_PWM_OFFSET 1
60 #ifndef AOA_ANGLE_OFFSET
62 #define AOA_ANGLE_OFFSET M_PI
66 #define AOA_OFFSET 0.0f
70 #define AOA_FILTER 0.0f
74 #define AOA_SENS ((2.0f*M_PI)/AOA_PWM_PERIOD)
84 #define SEND_SYNC_AOA TRUE
96 #if defined USE_SIDESLIP && !(defined SSA_PWM_CHANNEL)
97 #error "SSA_PWM_CHANNEL needs to be defined to use sideslip sensor"
102 #define SSA_OFFSET 0.0f
106 #define SSA_FILTER 0.0f
110 #define SSA_SENS ((2.0f*M_PI)/AOA_PWM_PERIOD)
124 #if PERIODIC_TELEMETRY
127 static void send_aoa(
struct transport_tx *trans,
struct link_device *
dev)
160 #if PERIODIC_TELEMETRY
167 static float prev_aoa = 0.0f;
185 static float prev_ssa = 0.0f;
208 sdLogWriteLog(
pprzLogFile,
"AOA_PWM: AOA_ANGLE(deg) AOA_RAW(int16) SSA_ANGLE(deg) SSA_RAW(int16)\n");
Aoa_Type
Selection of sensor type to be send over telemetry.
Periodic telemetry system header (includes downlink utility and generated code).
#define AOA_PWM_OFFSET
Some sensor may need an initial PWM offset (1 usec in the case of an MA3 sensor)
#define AOA_OFFSET
Default extra offset that can be ajusted from settings.
static void stateSetAngleOfAttack_f(float aoa)
Set angle of attack in radians (float).
Angle of Attack sensor on PWM.
void aoa_pwm_update(void)
float angle
Angle of attack in radians.
#define AOA_SENS
Default sensitivity (2*pi on a PWM of period AOA_PWM_PERIOD)
#define AOA_FILTER
Default filter value.
uint32_t raw
raw PWM value
#define DefaultPeriodic
Set default periodic telemetry.
enum Aoa_Type aoa_send_type
static const struct usb_device_descriptor dev
float sens
sensitiviy, i.e. scale to conver raw to angle
Common code for AP and FBW telemetry.
float filter
Filtering value [0-1] 0: no filtering 1: output is a constant value.
#define AOA_ANGLE_OFFSET
Default offset value (assuming 0 AOA is in the middle of the range)
static void send_aoa(struct transport_tx *trans, struct link_device *dev)
static void stateSetSideslip_f(float sideslip)
Set sideslip angle in radians (float).
int8_t register_periodic_telemetry(struct periodic_telemetry *_pt, uint8_t _id, telemetry_cb _cb)
Register a telemetry callback function.
float offset
Angle of attack offset in radians.