feat: 10fps daytime / 4fps night modeld + 2Hz GPS

Reduced-rate modeld path now branches on IsDaylight:
- daylight: skip 1/2 frames → 10fps (better model responsiveness when
  lighting gives the net more signal)
- night: skip 4/5 frames → 4fps (unchanged, conservative for power)

IsDaylight is already in /dev/shm (memory) via gpsd.py. Gated the
IsDaylight write on change — it flips twice a day, no reason to rewrite
every 30s. GPS polling bumped from 1Hz → 2Hz.

ModelFps publishes "10" / "4" / "20" so longitudinal_planner's dt and
FCW-threshold scaling (if re-enabled) still track actual rate.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-16 21:41:29 -05:00
parent 02f25f83c4
commit ef4e02e354
2 changed files with 15 additions and 7 deletions

View File

@@ -273,17 +273,21 @@ def main(demo=False):
last_vipc_frame_id = meta_main.frame_id
continue
# Reduced framerate: 4fps when not lat active and not standstill
# Skip 4 out of every 5 frames (20fps -> 4fps)
# Reduced framerate: daylight 10fps (skip 1/2), night 4fps (skip 4/5)
# Daytime runs twice as fast — better model responsiveness when lighting is good
# and the neural net has more signal. Night stays conservative for power.
# Write standby timestamp so controlsd suppresses transient errors
if not full_rate:
if params_memory.get("ModelFps") != b"4":
params_memory.put("ModelFps", "4")
is_daylight = params_memory.get_bool("IsDaylight")
skip_interval = 2 if is_daylight else 5
target_fps = b"10" if is_daylight else b"4"
if params_memory.get("ModelFps") != target_fps:
params_memory.put("ModelFps", target_fps.decode())
now = _time.monotonic()
if now - last_standby_ts_write > 1.0:
params_memory.put("ModelStandbyTs", str(now))
last_standby_ts_write = now
if run_count % 5 != 0:
if run_count % skip_interval != 0:
last_vipc_frame_id = meta_main.frame_id
run_count += 1
continue