cea422b075
locationd: ignore gpsLocation observations entirely (clearpilot_disable_gps const at the top of handle_gps; falls through to determine_gps_mode's no-GPS path). gpsd.py keeps publishing real GPS for UI / dashcam / clock / night-mode — only locationd ignores it. The previous gpsd.py path was hard-coding vNED=[0,0,0] while the car was moving 28 m/s, feeding the Kalman contradictory GPS-vs-IMU velocity observations that propagated into latcontrol_torque through liveLocationKalman.angularVelocityCalibrated and caused a real "drift right on straight roads" symptom. controlsd: short-circuit state_control() while parked. Skips LaC/LoC PID, MPC, model_v2 reads, lane-change logic — all wasted work when the car isn't moving. Returns the same enabled=False/latActive=False/longActive=False CC the original code would have produced, so publish_logs runs unchanged and card.controls_update keeps the sendcan / tester-present heartbeat flowing at 100Hz. controlsd CPU dropped from ~59% to ~3% in park. controlsd: also wire self.FPCC.noLatLaneChange = True/False in the existing lane-change suppression branch. The Hyundai carcontroller already reads off frogpilot_variables.no_lat_lane_change for the no-steer signal, but the UI's distinctive yellow CHANGE_LANE_PATH_COLOR (onroad.cc:901) reads from frogpilotCarControl.NoLatLaneChange — which nobody was setting, so the yellow line never appeared during lane-change suppression. plannerd: skip longitudinal_planner.update + publish + publish_ui_plan while parked. Downstream controlsd already short-circuits in park, so longitudinalPlan / uiPlan staleness is fine. frogpilot_process: same idea — skip frogpilot_planner.update + publish while parked. dmonitoringmodeld: mirror the cached-output trick from modeld. Add carState to the SubMaster, cache the last (model_output, dsp_execution_time) tuple, and serve it on every frame while gear is in park instead of running DSP inference on the driver camera. Together with the existing modeld park-cached-output, the heavy onroad processing pipeline (modeld → plannerd → controlsd → carcontroller) now all idles in park and only fires when the car leaves park. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
109 lines
3.4 KiB
Python
Executable File
109 lines
3.4 KiB
Python
Executable File
import datetime
|
|
import http.client
|
|
import os
|
|
import socket
|
|
import time
|
|
import urllib.error
|
|
import urllib.request
|
|
|
|
import cereal.messaging as messaging
|
|
|
|
from cereal import car, log
|
|
from openpilot.common.params import Params
|
|
from openpilot.common.realtime import DT_MDL, Priority, config_realtime_process
|
|
from openpilot.common.time import system_time_valid
|
|
from openpilot.system.hardware import HARDWARE
|
|
|
|
from openpilot.selfdrive.frogpilot.controls.frogpilot_planner import FrogPilotPlanner
|
|
from openpilot.selfdrive.frogpilot.controls.lib.frogpilot_functions import FrogPilotFunctions
|
|
from openpilot.selfdrive.frogpilot.controls.lib.model_manager import DEFAULT_MODEL, DEFAULT_MODEL_NAME, download_model, populate_models
|
|
from openpilot.selfdrive.frogpilot.controls.lib.theme_manager import ThemeManager
|
|
|
|
WIFI = log.DeviceState.NetworkType.wifi
|
|
|
|
# clearpilot disabled
|
|
def automatic_update_check(params):
|
|
return
|
|
# update_available = params.get_bool("UpdaterFetchAvailable")
|
|
# update_ready = params.get_bool("UpdateAvailable")
|
|
# update_state = params.get("UpdaterState", encoding='utf8')
|
|
|
|
# if update_ready:
|
|
# HARDWARE.reboot()
|
|
# elif update_available:
|
|
# os.system("pkill -SIGHUP -f selfdrive.updated.updated")
|
|
# elif update_state == "idle":
|
|
# os.system("pkill -SIGUSR1 -f selfdrive.updated.updated")
|
|
|
|
def github_pinged(url="https://github.com", timeout=5):
|
|
try:
|
|
urllib.request.urlopen(url, timeout=timeout)
|
|
return True
|
|
except (urllib.error.URLError, socket.timeout, http.client.RemoteDisconnected):
|
|
return False
|
|
|
|
# clearpilot disabled
|
|
def time_checks(automatic_updates, deviceState, params):
|
|
return
|
|
# if github_pinged():
|
|
# populate_models()
|
|
|
|
# screen_off = deviceState.screenBrightnessPercent == 0
|
|
# wifi_connection = deviceState.networkType == WIFI
|
|
|
|
# if automatic_updates and screen_off and wifi_connection:
|
|
# automatic_update_check(params)
|
|
|
|
def frogpilot_thread():
|
|
config_realtime_process(5, Priority.CTRL_LOW)
|
|
|
|
params = Params()
|
|
params_memory = Params("/dev/shm/params")
|
|
|
|
frogpilot_functions = FrogPilotFunctions()
|
|
theme_manager = ThemeManager()
|
|
|
|
CP = None
|
|
|
|
time_validated = system_time_valid()
|
|
|
|
pm = messaging.PubMaster(['frogpilotPlan'])
|
|
sm = messaging.SubMaster(['carState', 'controlsState', 'deviceState', 'frogpilotCarControl', 'frogpilotNavigation',
|
|
'frogpilotPlan', 'liveLocationKalman', 'longitudinalPlan', 'modelV2', 'radarState'],
|
|
poll='modelV2', ignore_avg_freq=['radarState'])
|
|
|
|
while True:
|
|
sm.update()
|
|
|
|
deviceState = sm['deviceState']
|
|
started = deviceState.started
|
|
|
|
if started:
|
|
if CP is None:
|
|
with car.CarParams.from_bytes(params.get("CarParams", block=True)) as msg:
|
|
CP = msg
|
|
frogpilot_planner = FrogPilotPlanner(CP)
|
|
frogpilot_planner.update_frogpilot_params()
|
|
|
|
# CLEARPILOT: skip planner work while parked.
|
|
parked = sm['carState'].gearShifter == car.CarState.GearShifter.park
|
|
if sm.updated['modelV2'] and not parked:
|
|
frogpilot_planner.update(sm['carState'], sm['controlsState'], sm['frogpilotCarControl'], sm['frogpilotNavigation'],
|
|
sm['liveLocationKalman'], sm['modelV2'], sm['radarState'])
|
|
frogpilot_planner.publish(sm, pm)
|
|
|
|
if not time_validated:
|
|
time_validated = system_time_valid()
|
|
if not time_validated:
|
|
continue
|
|
|
|
time.sleep(DT_MDL)
|
|
|
|
|
|
|
|
def main():
|
|
frogpilot_thread()
|
|
|
|
if __name__ == "__main__":
|
|
main()
|