🐛 Use mpu.heading for heading calculations
This commit is contained in:
@@ -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
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user