Skip to content
Snippets Groups Projects

imu: make it part of InputState

Merged schneider requested to merge schneider/imu-inputstate into main
All threads resolved!
Files
3
# python imports
import random
import time
import math
# flow3r imports
from st3m import InputState
from st3m.application import Application
from st3m.property import BLUE, WHITE
from st3m.goose import Optional
from ctx import Context
from st3m.utils import tau
@@ -32,8 +25,8 @@ class IMUDemo(Application):
def think(self, ins: InputState, delta_ms: int) -> None:
super().think(ins, delta_ms)
self.v_y += ins.acc[0] * delta_ms / 1000.0 * 10
self.v_x += ins.acc[1] * delta_ms / 1000.0 * 10
self.v_y += ins.imu.acc[0] * delta_ms / 1000.0 * 10
self.v_x += ins.imu.acc[1] * delta_ms / 1000.0 * 10
x = self.p_x + self.v_x * delta_ms / 1000.0
y = self.p_y + self.v_y * delta_ms / 1000.0
@@ -44,6 +37,3 @@ class IMUDemo(Application):
else:
self.v_x = 0
self.v_y = 0
app = IMUDemo("imu")
Loading