diff --git a/pi/backend/arduino_service.py b/pi/backend/arduino_service.py index 1795105..feb5f35 100644 --- a/pi/backend/arduino_service.py +++ b/pi/backend/arduino_service.py @@ -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 diff --git a/pi/backend/main.py b/pi/backend/main.py index df11a1a..1e9a590 100644 --- a/pi/backend/main.py +++ b/pi/backend/main.py @@ -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))