# Tactiverge Academy — companion code for "Sensing position and motion"
# Lesson: https://tactiverge.win/academy/robotics-foundations/sensors-and-actuators/sensing-position-and-motion/
# Licence: MIT (see https://tactiverge.win/open-engineering/). Examples appear in lesson order.

# ── Example 1 ────────────────────────────────────────
bias = 0.5      # deg/s, made-up gyro bias for illustration
dt = 0.01       # 100 readings per second
angle = 0.0
for step in range(1, 6001):   # 60 seconds with the robot perfectly still
    true_rate = 0.0
    measured = true_rate + bias
    angle += measured * dt
    if step % 1500 == 0:
        print(f"t = {step * dt:4.0f} s   estimated angle = {angle:5.1f} deg")
