How arduino-libraries/madgwickahrs works
MadgwickAHRS is a small Arduino C++ library that estimates orientation from accelerometer and gyroscope readings, with an optional magnetometer for the AHRS update. A caller configures the sample frequency, supplies sensor samples to update() or updateIMU(), then reads roll, pitch, or yaw in degrees or radians. The implementation maintains quaternion state, computes angles lazily, and falls back to the IMU algorithm when magnetometer input is zero. The README mentions this capability; the graph focuses on the two core source files and the documented sensor-to-orientation workflow.
Main entry points: MadgwickAHRS.h Madgwick API · MadgwickAHRS.cpp AHRS and IMU update
Components 4
Orientation library
- Madgwick API
src/MadgwickAHRS.h
Estimation internals
- AHRS and IMU update
src/MadgwickAHRS.cpp - Orientation angles
src/MadgwickAHRS.cpp
Other components
- Arduino caller
Connections 5
- Arduino caller → Madgwick API: configures and supplies samples
src/MadgwickAHRS.h - Madgwick API → AHRS and IMU update: updates state
src/MadgwickAHRS.cpp - Arduino caller → Madgwick API: reads angles
src/MadgwickAHRS.h - Madgwick API → Orientation angles: computes on demand
src/MadgwickAHRS.h - AHRS and IMU update → Orientation angles: derives from quaternion
src/MadgwickAHRS.cpp