37 #include "pprzlink/messages.h"
40 #include "generated/airframe.h"
49 #ifndef AOA_PWM_CHANNEL
50 #error "AOA_PWM_CHANNEL needs to be defined to use AOA_pwm module"
54 #ifndef AOA_PWM_PERIOD
55 #define AOA_PWM_PERIOD 4096
58 #ifndef AOA_PWM_OFFSET
59 #define AOA_PWM_OFFSET 1
62 #ifndef AOA_ANGLE_OFFSET
63 #define AOA_ANGLE_OFFSET M_PI
67 #define AOA_OFFSET 0.0f
71 #define AOA_FILTER 0.0f
75 #define AOA_SENS ((2.0f*M_PI)/AOA_PWM_PERIOD)
85 #define SEND_SYNC_AOA TRUE
97 #if defined USE_SIDESLIP && !(defined SSA_PWM_CHANNEL)
98 #error "SSA_PWM_CHANNEL needs to be defined to use sideslip sensor"
103 #define SSA_OFFSET 0.0f
107 #define SSA_FILTER 0.0f
111 #define SSA_SENS ((2.0f*M_PI)/AOA_PWM_PERIOD)
125 #if PERIODIC_TELEMETRY
128 static void send_aoa(
struct transport_tx *trans,
struct link_device *
dev)
161 #if PERIODIC_TELEMETRY
168 #if USE_AOA || USE_SIDESLIP
171 static float prev_aoa = 0.0f;
189 static float prev_ssa = 0.0f;
205 #if USE_AOA || USE_SIDESLIP
216 sdLogWriteLog(
pprzLogFile,
"AOA_PWM: AOA_ANGLE(deg) AOA_RAW(int16) SSA_ANGLE(deg) SSA_RAW(int16)\n");
Main include for ABI (AirBorneInterface).
#define AOA_OFFSET
Default extra offset that can be ajusted from settings.
#define AOA_SENS
Default sensitivity (2*pi on a PWM of period AOA_PWM_PERIOD)
#define AOA_ANGLE_OFFSET
Default offset value (assuming 0 AOA is in the middle of the range)
void aoa_pwm_update(void)
enum Aoa_Type aoa_send_type
static void send_aoa(struct transport_tx *trans, struct link_device *dev)
#define AOA_PWM_OFFSET
Some sensor may need an initial PWM offset (1 usec in the case of an MA3 sensor)
#define AOA_FILTER
Default filter value.
Angle of Attack sensor on PWM.
float sens
sensitiviy, i.e. scale to conver raw to angle
Aoa_Type
Selection of sensor type to be send over telemetry.
float angle
Angle of attack in radians.
float offset
Angle of attack offset in radians.
uint32_t raw
raw PWM value
float filter
Filtering value [0-1] 0: no filtering 1: output is a constant value.
Common code for AP and FBW telemetry.
static const struct usb_device_descriptor dev
int8_t register_periodic_telemetry(struct periodic_telemetry *_pt, uint8_t _id, telemetry_cb _cb)
Register a telemetry callback function.
Periodic telemetry system header (includes downlink utility and generated code).
#define DefaultPeriodic
Set default periodic telemetry.
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.