Skip to content

Commit

Permalink
Improved comments/docs
Browse files Browse the repository at this point in the history
  • Loading branch information
seanboe committed Aug 6, 2021
1 parent 5e2438a commit f922ebd
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
20 changes: 18 additions & 2 deletions src/simpleFusion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

SimpleFusion::SimpleFusion(void) {};


/*!
* @brief Initializes filter parameters.
* @param filterUpdateRate The frequency of filter updates up to 1000000 Hertz
* @param pitchGyroFavoring The amount that the gyroscope is favored in the pitch direction as a decimal percent less than 1
* @param rollGyroFavoring The amount that the gyroscope is favored in the roll direction as a decimal percent less than 1
* @returns false if any gyro favoring is an invalid value, true if they are valid.
*/
bool SimpleFusion::init(int16_t filterUpdateRate, float pitchGyroFavoring, float rollGyroFavoring) {
_filterUpdateRate = filterUpdateRate;
_pitchGyroFavoring = pitchGyroFavoring;
Expand All @@ -21,7 +29,10 @@ bool SimpleFusion::init(int16_t filterUpdateRate, float pitchGyroFavoring, float
return true;
};


/*!
* @brief Allows you to update the library at the desired frequency. You should update the sensor only when the library is running
* @returns true if it is time to update the library, false if it isn't
*/
bool SimpleFusion::shouldUpdateData() {
long dt = (micros() - _previousTime);

Expand All @@ -35,7 +46,12 @@ bool SimpleFusion::shouldUpdateData() {
return false;
};


/*!
* @brief Calculates rotation angles based on gyroscope and accelerometer readings
* @param accelerometer The accelerometer readings from the IMU as ThreeAxis struct variables
* @param gyroscope The gyroscope readings from the IMU as ThreeAxis struct variables
* @param angleOutputs The address of a FusedAngles struct variable for holding angular outputs
*/
void SimpleFusion::getFilteredAngles(ThreeAxis &accelerometer, ThreeAxis &gyroscope, FusedAngles *angleOutputs, AngleUnit angleUnit) {

float pitchFromAccel = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/simpleFusion.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include <Arduino.h>

#define DATA_UPDATE_POLL_TOLERANCE 50 //microseconds
#define DATA_UPDATE_POLL_TOLERANCE 50 // The leniency of shouldUpdateData(), in microseconds

typedef struct {
float x;
Expand Down

0 comments on commit f922ebd

Please sign in to comment.