Skip to content

Commit

Permalink
Fixed calibration calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
aburt2 committed Nov 29, 2023
1 parent a77f00e commit 6c31cd7
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions puara_gestures.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,16 +230,16 @@ void PuaraGestures::calibrateMagnetometer(float magX, float magY, float magZ) {

void PuaraGestures::calibrateAccelerometer(float accelX, float accelY, float accelZ) {
// Calibrate accelerometer
accelCal[0] -= accel_zerog[0];
accelCal[1] -= accel_zerog[1];
accelCal[2] -= accel_zerog[2];
accelCal[0] = accelX - accel_zerog[0];
accelCal[1] = accelY - accel_zerog[1];
accelCal[2] = accelZ - accel_zerog[2];
}

void PuaraGestures::calibrateGyroscope(float gyroX, float gyroY, float gyroZ) {
// Calibrate magnetometer
gyroCal[0]-= gyro_zerorate[0];
gyroCal[1]-= gyro_zerorate[1];
gyroCal[2]-= gyro_zerorate[2];
gyroCal[0] = gyroX - gyro_zerorate[0];
gyroCal[1] = gyroY - gyro_zerorate[1];
gyroCal[2] = gyroZ - gyro_zerorate[2];
}


Expand Down

0 comments on commit 6c31cd7

Please sign in to comment.