Skip to main content

listener.rs — Incoming Packet Handler

run_listener() is the main receive loop. It runs for the lifetime of the app as a spawned async task. On every received UDP datagram it:

  1. Decodes the raw bytes as a PbEnvelope using prost
  2. Extracts the inner payload variant
  3. Checks a per-payload throttle — events are forwarded to the frontend at most once every 100ms per payload type, regardless of how fast the rover sends
  4. Emits a Tauri event to the frontend with the decoded message as the payload

Throttling

Each payload type has its own independent Throttle instance. This prevents high-frequency streams (e.g. IMU at 50Hz) from flooding the frontend with more updates than it can usefully render.

Tauri events emitted

These are the event names the frontend can listen to with listen():

Note for future developers: If you add new protobufers you must add them here or you want be able to listen to them