30#include "generated/airframe.h"
35#include "pprzlink/messages.h"
40#ifndef AOA_ANGLE_OFFSET
41#define AOA_ANGLE_OFFSET M_PI
46#define AOA_T4_OFFSET 0.0f
50#ifndef AOA_T4_USE_FILTER
51#define AOA_T4_USE_FILTER FALSE
60#define AOA_T4_FILTER 0.15f
71#ifndef AOA_T4_SYNC_SEND
72#define AOA_T4_SYNC_SEND FALSE
76#ifndef AOA_T4_SERVO_ID
77#error "No AOA_T4_SERVO_ID defined, however it must be defined to be able to use the aoa_t4 module"
80#ifdef AOA_T4_USE_FILTER
82#ifndef AOA_T4_FILTER_SAMPLING_TIME
83#define AOA_T4_FILTER_SAMPLING_TIME 0.0005
90#ifndef AOA_T4_USE_COMPENSATION
91#define AOA_T4_USE_COMPENSATION FALSE
98#define AOA_T4_COMP_A1 0.0f
101#ifndef AOA_T4_COMP_B1
102#define AOA_T4_COMP_B1 0.0f
105#ifndef AOA_T4_COMP_A2
106#define AOA_T4_COMP_A2 -0.5457f
109#ifndef AOA_T4_COMP_B2
110#define AOA_T4_COMP_B2 0.0f
116#ifndef SSA_ANGLE_OFFSET
117#define SSA_ANGLE_OFFSET M_PI
122#define SSA_T4_OFFSET 0.0f
126#ifndef SSA_T4_USE_FILTER
127#define SSA_T4_USE_FILTER FALSE
131#define SSA_T4_FILTER 0.20f
135#define SSA_T4_SIGN -1
140#ifdef SSA_T4_USE_FILTER
159#if PERIODIC_TELEMETRY
162static void send_aoa(
struct transport_tx *trans,
struct link_device *
dev)
186 uint32_t output_max = abs(input_min) + input_max;
198 switch (AOA_T4_SERVO_ID)
241#ifdef SSA_T4_SERVO_ID
245 switch (SSA_T4_SERVO_ID)
324#if PERIODIC_TELEMETRY
331#if USE_AOA || USE_SIDESLIP
338 if (a_rad > M_PI) a_rad -= 2 * M_PI;
341#if AOA_T4_USE_COMPENSATION
359 if (a_rad > M_PI) a_rad -= 2 * M_PI;
376#if USE_AOA || USE_SIDESLIP
Main include for ABI (AirBorneInterface).
struct abi_struct abi_event
#define ABI_BROADCAST
Broadcast address.
#define AOA_ANGLE_OFFSET
Default offset value (assuming 0 AOA is in the middle of the range).
enum Aoa_Type aoa_send_type
static void send_aoa(struct transport_tx *trans, struct link_device *dev)
Aoa_Type
Selection of sensor type to be send over telemetry.
Butterworth2LowPass aoa_t4_lowpass_filter
Servo ID to use for the modified servo as AOA sensor.
#define AOA_T4_FILTER
Default filter value for reasonable minimum filtering.
void aoa_t4_init_filters(void)
#define AOA_T4_OFFSET
Small offset value in radians to get the sensor perfectly lined out.
struct FloatEulers eulers_t4
Butterworth2LowPass ssa_t4_lowpass_filter
#define SSA_T4_OFFSET
Small offset value in radians to get the sensor perfectly lined out.
struct ActuatorsT4In actuators_t4_in_local
void ssa_t4_init_filters(void)
#define SSA_ANGLE_OFFSET
Default offset value (assuming 0 SSA is in the middle of the range).
#define AOA_T4_SIGN
To set reverse direction on readings use true.
static void actuators_t4_abi_in(uint8_t sender_id, struct ActuatorsT4In *actuators_t4_in_ptr, float *actuators_t4_extra_data_in_ptr)
static abi_event ACTUATORS_T4_IN
uint32_t convert_angle_x100_to_raw(int16_t angle)
static void send_aoa(struct transport_tx *trans, struct link_device *dev)
#define AOA_T4_FILTER_SAMPLING_TIME
Angle of Attack and optionally Sideslip Angle sensor using T4 Actuators Board and a modified serial b...
static struct uart_periph * dev
static struct FloatEulers * stateGetNedToBodyEulersZxy_f(void)
Get vehicle body attitude ZXY euler angles (float).
Simple first order low pass filter with bilinear transform.
struct SecondOrderLowPass Butterworth2LowPass
Second order Butterworth low pass filter.
static void init_butterworth_2_low_pass(Butterworth2LowPass *filter, const float tau, const float sample_time, const float value)
Init a second order Butterworth filter.
static float update_butterworth_2_low_pass(Butterworth2LowPass *filter, const float value)
Update second order Butterworth low pass filter state with a new value.
API to get/set the generic vehicle states.
int16_t register_periodic_telemetry(struct periodic_telemetry *_pt, uint16_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.
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
int int32_t
Typedef defining 32 bit int type.
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
short int16_t
Typedef defining 16 bit short type.
unsigned long long uint64_t
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.