Paparazzi UAS v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
Loading...
Searching...
No Matches
aoa_t4.c File Reference

Angle of Attack sensor using T4 Actuators Board and a modified serial bus servo added wind vane. More...

#include "modules/sensors/aoa_t4.h"
#include "generated/airframe.h"
#include "modules/core/abi.h"
#include "state.h"
#include "std.h"
#include "mcu_periph/uart.h"
#include "pprzlink/messages.h"
#include "filters/low_pass_filter.h"
#include "modules/datalink/telemetry.h"
+ Include dependency graph for aoa_t4.c:

Go to the source code of this file.

Macros

#define AOA_ANGLE_OFFSET   M_PI
 Default offset value (assuming 0 AOA is in the middle of the range)
 
#define AOA_T4_OFFSET   0.0f
 Small offset value in radians to get the sensor perfectly lined out.
 
#define AOA_T4_USE_FILTER   FALSE
 Use lowpass filter for AOA.
 
#define AOA_T4_FILTER   0.15f
 Default filter value for reasonable minimum filtering.
 
#define AOA_T4_SIGN   1
 To set reverse direction on readings use true.
 
#define AOA_T4_SYNC_SEND   FALSE
 
#define AOA_T4_FILTER_SAMPLING_TIME   0.0005
 
#define AOA_T4_USE_COMPENSATION   FALSE
 Enable A1 A2 to Theta compensation for AOA sensor angle.
 
#define AOA_T4_COMP_A1   0.0f
 
#define AOA_T4_COMP_B1   0.0f
 
#define AOA_T4_COMP_A2   -0.5457f
 
#define AOA_T4_COMP_B2   0.0f
 
#define SSA_ANGLE_OFFSET   M_PI
 Default offset value (assuming 0 SSA is in the middle of the range)
 
#define SSA_T4_OFFSET   0.0f
 Small offset value in radians to get the sensor perfectly lined out.
 
#define SSA_T4_USE_FILTER   FALSE
 Use lowpass filter for SSA.
 
#define SSA_T4_FILTER   0.20f
 
#define SSA_T4_SIGN   1
 

Functions

static void send_aoa (struct transport_tx *trans, struct link_device *dev)
 
uint32_t convert_angle_x100_to_raw (int16_t angle)
 
static void actuators_t4_abi_in (uint8_t sender_id, struct ActuatorsT4In *actuators_t4_in_ptr, float *actuators_t4_extra_data_in_ptr)
 
void aoa_t4_init_filters (void)
 
void ssa_t4_init_filters (void)
 
void aoa_t4_init (void)
 
void aoa_t4_update (void)
 

Variables

Butterworth2LowPass aoa_t4_lowpass_filter
 Servo ID to use for the modified servo as AOA sensor.
 
struct Aoa_T4 aoa_t4
 
Butterworth2LowPass ssa_t4_lowpass_filter
 
struct Aoa_T4 ssa_t4
 
struct ActuatorsT4In actuators_t4_in_local
 
static abi_event ACTUATORS_T4_IN
 
struct FloatEulers eulers_t4
 
float aoa_t4_a1 = AOA_T4_COMP_A1
 
float aoa_t4_b1 = AOA_T4_COMP_B1
 
float aoa_t4_a2 = AOA_T4_COMP_A2
 
float aoa_t4_b2 = AOA_T4_COMP_B2
 
enum Aoa_Type aoa_send_type
 

Detailed Description

Angle of Attack sensor using T4 Actuators Board and a modified serial bus servo added wind vane.

The SBS must be of hall effect type to minimize friction.

Author
: Sunyou Hwang, OpenUAS

Definition in file aoa_t4.c.

Macro Definition Documentation

◆ AOA_ANGLE_OFFSET

#define AOA_ANGLE_OFFSET   M_PI

Default offset value (assuming 0 AOA is in the middle of the range)

Definition at line 41 of file aoa_t4.c.

◆ AOA_T4_COMP_A1

#define AOA_T4_COMP_A1   0.0f

Definition at line 98 of file aoa_t4.c.

◆ AOA_T4_COMP_A2

#define AOA_T4_COMP_A2   -0.5457f

Definition at line 106 of file aoa_t4.c.

◆ AOA_T4_COMP_B1

#define AOA_T4_COMP_B1   0.0f

Definition at line 102 of file aoa_t4.c.

◆ AOA_T4_COMP_B2

#define AOA_T4_COMP_B2   0.0f

Definition at line 110 of file aoa_t4.c.

◆ AOA_T4_FILTER

#define AOA_T4_FILTER   0.15f

Default filter value for reasonable minimum filtering.

Time constant for second order Butterworth low pass filter Default of 0.15 should give cut-off freq of 1/(2*pi*tau) ~= 1Hz (0.01->15.9 / 0.05->3.2 / 0.1->1.59 / 0.2->0.79 / 0.3->0.53)

Definition at line 60 of file aoa_t4.c.

◆ AOA_T4_FILTER_SAMPLING_TIME

#define AOA_T4_FILTER_SAMPLING_TIME   0.0005

Definition at line 83 of file aoa_t4.c.

◆ AOA_T4_OFFSET

#define AOA_T4_OFFSET   0.0f

Small offset value in radians to get the sensor perfectly lined out.

Definition at line 46 of file aoa_t4.c.

◆ AOA_T4_SIGN

#define AOA_T4_SIGN   1

To set reverse direction on readings use true.

Definition at line 67 of file aoa_t4.c.

◆ AOA_T4_SYNC_SEND

#define AOA_T4_SYNC_SEND   FALSE

Definition at line 72 of file aoa_t4.c.

◆ AOA_T4_USE_COMPENSATION

#define AOA_T4_USE_COMPENSATION   FALSE

Enable A1 A2 to Theta compensation for AOA sensor angle.

Definition at line 91 of file aoa_t4.c.

◆ AOA_T4_USE_FILTER

#define AOA_T4_USE_FILTER   FALSE

Use lowpass filter for AOA.

Definition at line 51 of file aoa_t4.c.

◆ SSA_ANGLE_OFFSET

#define SSA_ANGLE_OFFSET   M_PI

Default offset value (assuming 0 SSA is in the middle of the range)

Definition at line 117 of file aoa_t4.c.

◆ SSA_T4_FILTER

#define SSA_T4_FILTER   0.20f

Definition at line 131 of file aoa_t4.c.

◆ SSA_T4_OFFSET

#define SSA_T4_OFFSET   0.0f

Small offset value in radians to get the sensor perfectly lined out.

Definition at line 122 of file aoa_t4.c.

◆ SSA_T4_SIGN

#define SSA_T4_SIGN   1

Definition at line 137 of file aoa_t4.c.

◆ SSA_T4_USE_FILTER

#define SSA_T4_USE_FILTER   FALSE

Use lowpass filter for SSA.

Definition at line 127 of file aoa_t4.c.

Function Documentation

◆ actuators_t4_abi_in()

static void actuators_t4_abi_in ( uint8_t  sender_id,
struct ActuatorsT4In actuators_t4_in_ptr,
float actuators_t4_extra_data_in_ptr 
)
static

Definition at line 192 of file aoa_t4.c.

References actuators_t4_in_local, aoa_t4, convert_angle_x100_to_raw(), foo, Aoa_T4::raw, and ssa_t4.

Referenced by aoa_t4_init().

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

◆ aoa_t4_init()

◆ aoa_t4_init_filters()

void aoa_t4_init_filters ( void  )

Definition at line 287 of file aoa_t4.c.

References AOA_T4_FILTER, AOA_T4_FILTER_SAMPLING_TIME, aoa_t4_lowpass_filter, and init_butterworth_2_low_pass().

Referenced by aoa_t4_init().

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

◆ aoa_t4_update()

◆ convert_angle_x100_to_raw()

uint32_t convert_angle_x100_to_raw ( int16_t  angle)

Definition at line 180 of file aoa_t4.c.

References foo.

Referenced by actuators_t4_abi_in().

+ Here is the caller graph for this function:

◆ send_aoa()

static void send_aoa ( struct transport_tx trans,
struct link_device dev 
)
static

Definition at line 162 of file aoa_t4.c.

References Aoa_T4::angle, aoa_send_type, aoa_t4, dev, foo, Aoa_T4::raw, SEND_TYPE_AOA, SEND_TYPE_SIDESLIP, and ssa_t4.

Referenced by aoa_t4_init(), and aoa_t4_update().

+ Here is the caller graph for this function:

◆ ssa_t4_init_filters()

void ssa_t4_init_filters ( void  )

Definition at line 293 of file aoa_t4.c.

References AOA_T4_FILTER_SAMPLING_TIME, init_butterworth_2_low_pass(), SSA_T4_FILTER, and ssa_t4_lowpass_filter.

Referenced by aoa_t4_init().

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

Variable Documentation

◆ ACTUATORS_T4_IN

abi_event ACTUATORS_T4_IN
static

Definition at line 149 of file aoa_t4.c.

Referenced by aoa_t4_init().

◆ actuators_t4_in_local

struct ActuatorsT4In actuators_t4_in_local

Definition at line 147 of file aoa_t4.c.

Referenced by actuators_t4_abi_in().

◆ aoa_send_type

enum Aoa_Type aoa_send_type

Definition at line 157 of file aoa_t4.c.

Referenced by aoa_t4_init(), and send_aoa().

◆ aoa_t4

struct Aoa_T4 aoa_t4

Definition at line 87 of file aoa_t4.c.

Referenced by actuators_t4_abi_in(), aoa_t4_init(), aoa_t4_update(), and send_aoa().

◆ aoa_t4_a1

float aoa_t4_a1 = AOA_T4_COMP_A1

Definition at line 152 of file aoa_t4.c.

Referenced by aoa_t4_update().

◆ aoa_t4_a2

float aoa_t4_a2 = AOA_T4_COMP_A2

Definition at line 154 of file aoa_t4.c.

Referenced by aoa_t4_update().

◆ aoa_t4_b1

float aoa_t4_b1 = AOA_T4_COMP_B1

Definition at line 153 of file aoa_t4.c.

Referenced by aoa_t4_update().

◆ aoa_t4_b2

float aoa_t4_b2 = AOA_T4_COMP_B2

Definition at line 155 of file aoa_t4.c.

Referenced by aoa_t4_update().

◆ aoa_t4_lowpass_filter

Butterworth2LowPass aoa_t4_lowpass_filter

Servo ID to use for the modified servo as AOA sensor.

Definition at line 81 of file aoa_t4.c.

Referenced by aoa_t4_init_filters(), and aoa_t4_update().

◆ eulers_t4

struct FloatEulers eulers_t4

Definition at line 151 of file aoa_t4.c.

Referenced by aoa_t4_update().

◆ ssa_t4

struct Aoa_T4 ssa_t4

Definition at line 145 of file aoa_t4.c.

Referenced by actuators_t4_abi_in(), aoa_t4_init(), aoa_t4_update(), and send_aoa().

◆ ssa_t4_lowpass_filter

Butterworth2LowPass ssa_t4_lowpass_filter

Definition at line 141 of file aoa_t4.c.

Referenced by ssa_t4_init_filters().