backend: 20Hz report rate and pitch/roll match

This commit is contained in:
Mikkeli Matlock
2026-02-02 19:30:55 +09:00
parent 83cc6bed19
commit 18fbc63281
2 changed files with 8 additions and 6 deletions

View File

@@ -298,9 +298,11 @@ class ArduinoService:
result[name] = float('nan')
# IMU axis correction for mounting orientation
# Roll needs inverting for motorcycle frame alignment
if 'roll' in result and not math.isnan(result['roll']):
result['roll'] = -result['roll']
# Pitch/yaw inverted for motorcycle frame alignment (roll left as-is)
if 'pitch' in result and not math.isnan(result['pitch']):
result['pitch'] = -result['pitch']
if 'yaw' in result and not math.isnan(result['yaw']):
result['yaw'] = -result['yaw']
return result

View File

@@ -20,8 +20,8 @@ socketio = SocketIO(app, async_mode="gevent", cors_allowed_origins="*")
gps = GPSService()
arduino = ArduinoService()
# Throttles for emission rate limiting (2Hz for arduino, 1Hz for GPS)
arduino_throttle = Throttle(min_interval=0.5) # 2Hz max
# Throttles for emission rate limiting (20Hz for arduino, 1Hz for GPS)
arduino_throttle = Throttle(min_interval=0.05) # 20Hz max
gps_throttle = Throttle(min_interval=1.0) # 1Hz max
# Track connected clients
@@ -157,7 +157,7 @@ def throttle_flusher():
"""Periodically flush pending throttled data."""
import gevent
while True:
gevent.sleep(0.5)
gevent.sleep(0.05) # 20Hz flush rate
if arduino_throttle.has_pending:
arduino_throttle.flush(lambda d: socketio.emit("arduino", d))