Paparazzi UAS  v5.8.2_stable-0-g6260b7c
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
ahrs_aligner.c File Reference

Low-pass IMU measurements at startup to align the AHRS. More...

#include "ahrs_aligner.h"
#include <stdlib.h>
#include "subsystems/imu.h"
#include "led.h"
#include "subsystems/abi.h"
#include "mcu_periph/sys_time.h"
+ Include dependency graph for ahrs_aligner.c:

Go to the source code of this file.

Macros

#define SAMPLES_NB   100
 
#define AHRS_ALIGNER_IMU_ID   ABI_BROADCAST
 
#define LOW_NOISE_THRESHOLD   90000
 
#define LOW_NOISE_TIME   5
 Number of cycles (100 samples each) with low noise. More...
 

Functions

static void gyro_cb (uint8_t sender_id, uint32_t stamp, struct Int32Rates *gyro)
 
void ahrs_aligner_init (void)
 
void ahrs_aligner_run (void)
 

Variables

struct AhrsAligner ahrs_aligner
 
static struct Int32Rates gyro_sum
 
static struct Int32Vect3 accel_sum
 
static struct Int32Vect3 mag_sum
 
static int32_t ref_sensor_samples [SAMPLES_NB]
 
static uint32_t samples_idx
 
static abi_event gyro_ev
 

Detailed Description

Low-pass IMU measurements at startup to align the AHRS.

Definition in file ahrs_aligner.c.

Macro Definition Documentation

#define AHRS_ALIGNER_IMU_ID   ABI_BROADCAST

Definition at line 48 of file ahrs_aligner.c.

Referenced by ahrs_aligner_init().

#define LOW_NOISE_THRESHOLD   90000

Definition at line 99 of file ahrs_aligner.c.

Referenced by ahrs_aligner_run().

#define LOW_NOISE_TIME   5

Number of cycles (100 samples each) with low noise.

Definition at line 103 of file ahrs_aligner.c.

Referenced by ahrs_aligner_run().

#define SAMPLES_NB   100

Definition at line 39 of file ahrs_aligner.c.

Referenced by ahrs_aligner_run().

Function Documentation

void ahrs_aligner_init ( void  )

Definition at line 79 of file ahrs_aligner.c.

References accel_sum, ahrs_aligner, AHRS_ALIGNER_IMU_ID, AHRS_ALIGNER_RUNNING, DefaultPeriodic, gyro_cb(), gyro_sum, INT_RATES_ZERO, INT_VECT3_ZERO, AhrsAligner::low_noise_cnt, mag_sum, AhrsAligner::noise, register_periodic_telemetry(), samples_idx, and AhrsAligner::status.

Referenced by init_ap(), and main_init().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void gyro_cb ( uint8_t  sender_id,
uint32_t  stamp,
struct Int32Rates gyro 
)
static

Definition at line 52 of file ahrs_aligner.c.

References ahrs_aligner, AHRS_ALIGNER_LOCKED, ahrs_aligner_run(), and AhrsAligner::status.

Referenced by ahrs_aligner_init().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

struct Int32Vect3 accel_sum
static

Definition at line 42 of file ahrs_aligner.c.

Referenced by ahrs_aligner_init(), and ahrs_aligner_run().

struct AhrsAligner ahrs_aligner

Definition at line 37 of file ahrs_aligner.c.

Referenced by ahrs_aligner_init(), ahrs_aligner_run(), and gyro_cb().

abi_event gyro_ev
static

Definition at line 50 of file ahrs_aligner.c.

struct Int32Rates gyro_sum
static

Definition at line 41 of file ahrs_aligner.c.

Referenced by ahrs_aligner_init(), and ahrs_aligner_run().

struct Int32Vect3 mag_sum
static

Definition at line 43 of file ahrs_aligner.c.

Referenced by ahrs_aligner_init(), and ahrs_aligner_run().

int32_t ref_sensor_samples[SAMPLES_NB]
static

Definition at line 44 of file ahrs_aligner.c.

Referenced by ahrs_aligner_run().

uint32_t samples_idx
static

Definition at line 45 of file ahrs_aligner.c.

Referenced by ahrs_aligner_init(), and ahrs_aligner_run().