Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
danielgilbers committed Sep 23, 2024
1 parent 10b19f5 commit 14fd02d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions js/sensor.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ function handleMotion (event) {

if (!isNaN(groundAccel.ax)) {
const intervall = 0.02
globalAX = globalAX * intervall + 0.5 * groundAccel.ax * Math.pow(intervall, 2)
globalAY = globalAY * intervall + 0.5 * groundAccel.ay * Math.pow(intervall, 2)
globalX = globalX + globalAX * intervall
globalY = globalY + globalAY * intervall
globalAX = globalAX + groundAccel.ax * intervall
globalAY = globalAY + groundAccel.ay * intervall
globalX = globalX + globalAX * intervall + 0.5 * groundAccel.ax * Math.pow(intervall, 2)
globalY = globalY + globalAY * intervall + 0.5 * groundAccel.ay * Math.pow(intervall, 2)
}

updateFieldIfNotNull('X_position', globalX)
Expand Down

0 comments on commit 14fd02d

Please sign in to comment.