Skip to content

Commit bd88019

Browse files
committed
working madgwick filter
1 parent 67af5c8 commit bd88019

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

components/esp-box/example/main/esp_box_example.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,8 @@ extern "C" void app_main(void) {
204204
float roll = 0, pitch = 0;
205205
static espp::KalmanFilter kalmanPitch;
206206
static espp::KalmanFilter kalmanRoll;
207-
static espp::MadgwickFilter f(0.01f);
207+
static constexpr float beta = 0.1f; // higher = more accelerometer, lower = more gyro
208+
static espp::MadgwickFilter f(beta);
208209

209210
// Compute pitch and roll from accelerometer
210211
float accelPitch =
@@ -239,7 +240,7 @@ extern "C" void app_main(void) {
239240
float vz = -cos(pitchRad) * cos(rollRad);
240241

241242
int x1 = x0 + 50 * vx;
242-
int y1 = y0 - 50 * vy;
243+
int y1 = y0 + 50 * vy;
243244

244245
static lv_point_precise_t line_points[] = {{x0, y0}, {x1, y1}};
245246
line_points[1].x = x1;

0 commit comments

Comments
 (0)