1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-13 11:29:58 +03:00

Collision Detection (#13010)

This commit is contained in:
Jan Post 2024-11-30 17:20:15 +01:00 committed by GitHub
parent cfa5f0b2a1
commit db44e9df9e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 99 additions and 56 deletions

View file

@ -20,9 +20,14 @@
#pragma once
#include "common/axis.h"
#include "common/time.h"
#include "pg/pg.h"
#include "common/vector.h"
#include "drivers/accgyro/accgyro.h"
#include "pg/pg.h"
#include "sensors/sensors.h"
// Type of accelerometer used/detected
@ -54,10 +59,11 @@ typedef enum {
typedef struct acc_s {
accDev_t dev;
uint16_t sampleRateHz;
vector3_t accADC;
vector3_t accADC; // rotated but unscaled ADC value
vector3_t jerk;
float accMagnitude; // in multiples of 1G
float jerkMagnitude; // in multiples of 1G/s (measure of collision strength)
bool isAccelUpdatedAtLeastOnce;
float accMagnitude;
float accDelta;
} acc_t;
extern acc_t acc;
@ -74,7 +80,7 @@ typedef union rollAndPitchTrims_u {
#if defined(USE_ACC)
typedef struct accelerometerConfig_s {
uint16_t acc_lpf_hz; // cutoff frequency for the low pass filter used on the acc z-axis for althold in Hz
uint16_t acc_lpf_hz; // cutoff frequency for attitude anti-aliasing filter
uint8_t acc_hardware; // Which acc hardware to use on boards with more than one device
bool acc_high_fsr;
flightDynamicsTrims_t accZero;