34 #include "generated/airframe.h"
38 #include "subsystems/chibios-libopencm3/chibios_sdlog.h"
42 #ifndef AOA_PWM_CHANNEL
43 #error "AOA_PWM_CHANNEL needs to be defined to use AOA_pwm module"
47 #ifndef AOA_PWM_PERIOD
48 #define AOA_PWM_PERIOD 4096
50 #ifndef AOA_PWM_OFFSET
52 #define AOA_PWM_OFFSET 1
54 #ifndef AOA_ANGLE_OFFSET
56 #define AOA_ANGLE_OFFSET M_PI
60 #define AOA_OFFSET 0.0f
64 #define AOA_FILTER 0.0f
68 #define AOA_SENS ((2.0f*M_PI)/AOA_PWM_PERIOD)
78 #define SEND_SYNC_AOA TRUE
87 #if PERIODIC_TELEMETRY
107 #if PERIODIC_TELEMETRY
113 static float prev_aoa = 0.0f;
136 if(pprzLogFile != -1) {
138 sdLogWriteLog(pprzLogFile,
"AOA_PWM: ANGLE(deg) RAW(int16)\n");
142 sdLogWriteLog(pprzLogFile,
"AOA_PWM: %.3f %d\n", angle,
aoa_pwm.
raw);
Generic transmission transport header.
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.
static const struct usb_device_descriptor dev
float sens
sensitiviy, i.e. scale to conver raw to angle
#define DefaultChannel
SITL.
Common code for AP and FBW telemetry.
float filter
Filtering value [0-1] 0: no filtering 1: output is a constant value.
float angle
Angle of attack in radians.
#define AOA_ANGLE_OFFSET
Default offset value (assuming 0 AOA is in the middle of the range)
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.