AerospaceNU / AerospaceNU/stm32-avionics
Generalized class to replace running buffers used in filters
- Dominant language
- C
- Stars
- 5
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
To run some averaging to get a gravity estimate and a gyro zero bias during preflight, we have a lot of buffers that we use to give data and get averages out of data
All of the
```#define kPrevPresMedianCount 10
#define kPrevPresCount 10
#define kGravityRefCount 10
#define kGyroRefCount 10
static double runningPresMedians[kPrevPresMedianCount + 1];
static CircularBuffer_s runningPresMediansBuffer;
static uint8_t runningPresMedianCount;
static double runningPres[kPrevPresCount + 1];
static CircularBuffer_s runningPresBuffer;
static uint8_t runningPresCount;
static double gravityRefBuffer[kGravityRefCount];
static double runningGravityRef[kGravityRefCount + 1];
static CircularBuffer_s runningGravityRefBuffer;
static float gyroXRefBack[kGyroRefCount + 1];
static CircularBuffer_s gyroXRefBuffer;
static float gyroXOffset;
static float gyroYRefBack[kGyroRefCount + 1];
static CircularBuffer_s gyroYRefBuffer;
static float gyroYOffset;
static float gyroZRefBack[kGyroRefCount + 1];
static CircularBuffer_s gyroZRefBuffer;
static float gyroZOffset;
```
stuff is basically the same code for different variables.
This is used with all of the running pres/gravity/gyro buffers in filters and it would be nice if that was all covered as one class rather than repeated a lot.
Useful class methods:
- Average of all values
- Median of all values
- Erase all values
- Add new value
- Get nth value
- Get total number of values
- Sum of values
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.