Skip to content

Commit f3be79e

Browse files
zhiquanyeoZhiquan Yeo
andauthored
Use MadgwickAHRS (#13)
* AHRS Implementation * Fix updateIMU bug --------- Co-authored-by: Zhiquan Yeo <[email protected]>
1 parent 97c0573 commit f3be79e

File tree

4 files changed

+270
-67
lines changed

4 files changed

+270
-67
lines changed

include/imu.h

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,24 @@ bool imuIsEnabled();
1616
void imuInit(uint8_t addr, TwoWire *theWire);
1717
void imuCalibrate(unsigned long calibrationTime);
1818

19-
bool imuPeriodic();
19+
void imuPeriodic();
20+
bool imuDataReady();
2021

21-
float gyroGetAngleX();
22-
float gyroGetRateX();
22+
float imuGetAccelX();
23+
float imuGetAccelY();
24+
float imuGetAccelZ();
2325

24-
float gyroGetAngleY();
25-
float gyroGetRateY();
26+
float imuGetGyroRateX();
27+
float imuGetGyroRateY();
28+
float imuGetGyroRateZ();
2629

27-
float gyroGetAngleZ();
28-
float gyroGetRateZ();
30+
float imuGetRoll();
31+
float imuGetPitch();
32+
float imuGetYaw();
33+
34+
void imuResetRoll();
35+
void imuResetPitch();
36+
void imuResetYaw();
2937

3038
void gyroReset();
3139

platformio.ini

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ lib_deps =
1212
Wire
1313
adafruit/Adafruit LSM6DS@^4.7.0
1414
adafruit/Adafruit BusIO@^1.14.1
15-
adafruit/Adafruit Unified Sensor@^1.1.9
15+
adafruit/Adafruit Unified Sensor@^1.1.9
16+
arduino-libraries/Madgwick@^1.2.0

0 commit comments

Comments
 (0)