Getter & setter for algorithm parameters (#23)

* Getter & setter for algorithm parameters

Getter and setter for Madgwick (beta) and Mahony (Kp & Ki).

* clang-format
This commit is contained in:
Frédéric Bourgeois 2021-07-17 19:38:34 +02:00 committed by GitHub
parent 1425f14fbd
commit f7534cf5f9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

View file

@ -49,6 +49,8 @@ public:
// q0 + 2.0f * q3 * q3 - 1.0f);}; float getRoll(){return -1.0f * asinf(2.0f *
// q1 * q3 + 2.0f * q0 * q2);}; float getYaw(){return atan2f(2.0f * q1 * q2
// - 2.0f * q0 * q3, 2.0f * q0 * q0 + 2.0f * q1 * q1 - 1.0f);};
float getBeta() { return beta; }
void setBeta(float beta) { this->beta = beta; }
float getRoll() {
if (!anglesComputed)
computeAngles();

View file

@ -42,6 +42,10 @@ public:
void update(float gx, float gy, float gz, float ax, float ay, float az,
float mx, float my, float mz);
void updateIMU(float gx, float gy, float gz, float ax, float ay, float az);
float getKp() { return twoKp / 2.0f; }
void setKp(float Kp) { twoKp = 2.0f * Kp; }
float getKi() { return twoKi / 2.0f; }
void setKi(float Ki) { twoKi = 2.0f * Ki; }
float getRoll() {
if (!anglesComputed)
computeAngles();