🐛 Use mpu.heading for heading calculations

This commit is contained in:
Rune Harlyk
2026-03-20 17:19:41 +01:00
committed by GitHub
parent 37474e840d
commit 0f2a0c65ba
+3 -2
View File
@@ -262,8 +262,9 @@
const rotatedXm = settings.xm * cosTotal - settings.zm * sinTotal const rotatedXm = settings.xm * cosTotal - settings.zm * sinTotal
const rotatedZm = settings.xm * sinTotal + settings.zm * cosTotal const rotatedZm = settings.xm * sinTotal + settings.zm * cosTotal
const cosHead = Math.cos(headingYaw) const mpuHeadingRad = degToRad($mpu.heading)
const sinHead = Math.sin(headingYaw) const cosHead = Math.cos(mpuHeadingRad)
const sinHead = Math.sin(mpuHeadingRad)
const rotatedCumX = body_state.cumulative_x * cosHead - body_state.cumulative_z * sinHead const rotatedCumX = body_state.cumulative_x * cosHead - body_state.cumulative_z * sinHead
const rotatedCumZ = body_state.cumulative_x * sinHead + body_state.cumulative_z * cosHead const rotatedCumZ = body_state.cumulative_x * sinHead + body_state.cumulative_z * cosHead