From 53cba4d5050ac9878cd082b11eea74e78bc2e4aa Mon Sep 17 00:00:00 2001 From: rav4kumar <36933347+rav4kumar@users.noreply.github.com> Date: Fri, 31 Jul 2026 13:55:17 -0700 Subject: [PATCH] arizona mode --- .../selfdrive/controls/lib/accel_controller/constants.py | 2 +- .../selfdrive/controls/lib/accel_controller/lead.py | 2 +- .../selfdrive/controls/lib/accel_controller/state.py | 2 +- .../lib/accel_controller/tests/test_accel_controller.py | 2 +- .../tests/test_accel_controller_interfaces.py | 2 +- .../controls/lib/tests/test_lane_turn_desire.py | 2 -- .../selfdrive/test/longitudinal_maneuvers/plant.py | 2 +- openpilot/system/hardware/fan_controller.py | 9 +++++++-- 8 files changed, 13 insertions(+), 10 deletions(-) diff --git a/openpilot/sunnypilot/selfdrive/controls/lib/accel_controller/constants.py b/openpilot/sunnypilot/selfdrive/controls/lib/accel_controller/constants.py index 3025878796..dff2530409 100644 --- a/openpilot/sunnypilot/selfdrive/controls/lib/accel_controller/constants.py +++ b/openpilot/sunnypilot/selfdrive/controls/lib/accel_controller/constants.py @@ -2,7 +2,7 @@ import math import numpy as np -from cereal import custom +from openpilot.cereal import custom AccelProfile = custom.LongitudinalPlanSP.AccelController.Profile diff --git a/openpilot/sunnypilot/selfdrive/controls/lib/accel_controller/lead.py b/openpilot/sunnypilot/selfdrive/controls/lib/accel_controller/lead.py index 0ae3f44867..fb33c9c27e 100644 --- a/openpilot/sunnypilot/selfdrive/controls/lib/accel_controller/lead.py +++ b/openpilot/sunnypilot/selfdrive/controls/lib/accel_controller/lead.py @@ -10,7 +10,7 @@ from typing import NamedTuple import numpy as np -from cereal import log +from openpilot.cereal import log from openpilot.selfdrive.controls.lib.longitudinal_mpc_lib.long_mpc import ( LongitudinalMpc, LongitudinalPlanSource, STOP_DISTANCE, T_IDXS, get_T_FOLLOW, get_stopped_equivalence_factor, ) diff --git a/openpilot/sunnypilot/selfdrive/controls/lib/accel_controller/state.py b/openpilot/sunnypilot/selfdrive/controls/lib/accel_controller/state.py index 0d4b631254..4465c2de6b 100644 --- a/openpilot/sunnypilot/selfdrive/controls/lib/accel_controller/state.py +++ b/openpilot/sunnypilot/selfdrive/controls/lib/accel_controller/state.py @@ -3,7 +3,7 @@ from statistics import median import numpy as np -from cereal import custom +from openpilot.cereal import custom from openpilot.sunnypilot.selfdrive.controls.lib.accel_controller.constants import ( CAP_FILTER_FRAMES, DEPARTURE_MOTION_NOISE_FLOOR, DEPARTURE_MOTION_STEP_MIN, SPEED_RELIEF_DEADBAND, STOP_HOLD_CREEP_DISTANCE, STOP_HOLD_CREEP_SPEED, STOP_HOLD_EXIT_FRAMES, diff --git a/openpilot/sunnypilot/selfdrive/controls/lib/accel_controller/tests/test_accel_controller.py b/openpilot/sunnypilot/selfdrive/controls/lib/accel_controller/tests/test_accel_controller.py index 08bbe70dd4..f907d45f63 100644 --- a/openpilot/sunnypilot/selfdrive/controls/lib/accel_controller/tests/test_accel_controller.py +++ b/openpilot/sunnypilot/selfdrive/controls/lib/accel_controller/tests/test_accel_controller.py @@ -4,7 +4,7 @@ from types import SimpleNamespace import numpy as np import pytest -from cereal import log +from openpilot.cereal import log from opendbc.car.interfaces import ACCEL_MAX, ACCEL_MIN from openpilot.common.realtime import DT_MDL from openpilot.selfdrive.controls.lib.longitudinal_mpc_lib.long_mpc import ( diff --git a/openpilot/sunnypilot/selfdrive/controls/lib/accel_controller/tests/test_accel_controller_interfaces.py b/openpilot/sunnypilot/selfdrive/controls/lib/accel_controller/tests/test_accel_controller_interfaces.py index 5dceea4c90..cd788e32a6 100644 --- a/openpilot/sunnypilot/selfdrive/controls/lib/accel_controller/tests/test_accel_controller_interfaces.py +++ b/openpilot/sunnypilot/selfdrive/controls/lib/accel_controller/tests/test_accel_controller_interfaces.py @@ -5,7 +5,7 @@ from types import SimpleNamespace import numpy as np import pytest -from cereal import custom, log, messaging +from openpilot.cereal import custom, log, messaging from opendbc.car.interfaces import ACCEL_MAX, ACCEL_MIN from openpilot.common.realtime import DT_MDL from openpilot.selfdrive.controls.lib.longitudinal_planner import LongitudinalPlanner diff --git a/openpilot/sunnypilot/selfdrive/controls/lib/tests/test_lane_turn_desire.py b/openpilot/sunnypilot/selfdrive/controls/lib/tests/test_lane_turn_desire.py index aea5b9fa22..4c818e8e63 100644 --- a/openpilot/sunnypilot/selfdrive/controls/lib/tests/test_lane_turn_desire.py +++ b/openpilot/sunnypilot/selfdrive/controls/lib/tests/test_lane_turn_desire.py @@ -1,7 +1,6 @@ import pytest from openpilot.cereal import log, custom from openpilot.common.params import Params - from openpilot.selfdrive.controls.lib.desire_helper import DesireHelper from openpilot.sunnypilot.selfdrive.controls.lib.lane_turn_desire import LaneTurnController, LANE_CHANGE_SPEED_MIN from openpilot.sunnypilot.selfdrive.controls.lib.auto_lane_change import AutoLaneChangeMode @@ -116,4 +115,3 @@ def test_desire_helper_integration(carstate, lateral_active, lane_change_prob, e dh.update(carstate, lateral_active, lane_change_prob, left_edge_detected=relc.left_edge_detected, right_edge_detected=relc.right_edge_detected) assert dh.desire == expected_desire # The first four tests were unit tests to test the controller, where this tests the integration in desire helpers - diff --git a/openpilot/sunnypilot/selfdrive/test/longitudinal_maneuvers/plant.py b/openpilot/sunnypilot/selfdrive/test/longitudinal_maneuvers/plant.py index a92c5a2110..9970c689c3 100644 --- a/openpilot/sunnypilot/selfdrive/test/longitudinal_maneuvers/plant.py +++ b/openpilot/sunnypilot/selfdrive/test/longitudinal_maneuvers/plant.py @@ -14,7 +14,7 @@ from typing import Any import numpy as np -from cereal import log +from openpilot.cereal import log import cereal.messaging as messaging from openpilot.common.realtime import DT_MDL, Ratekeeper from openpilot.selfdrive.modeld.constants import ModelConstants diff --git a/openpilot/system/hardware/fan_controller.py b/openpilot/system/hardware/fan_controller.py index 869fe19c3d..b3c6c0ad4d 100755 --- a/openpilot/system/hardware/fan_controller.py +++ b/openpilot/system/hardware/fan_controller.py @@ -15,8 +15,13 @@ class FanController: self.controller = PIDController(k_p=0, k_i=4e-3, rate=rate) def update(self, cur_temp: float, ignition: bool) -> int: - self.controller.pos_limit = 100 if ignition else 30 - self.controller.neg_limit = 30 if ignition else 0 + if ignition: + # always run fan at max onroad, prioritize cooling over noise + self.last_ignition = ignition + return 100 + + self.controller.pos_limit = 30 + self.controller.neg_limit = 0 if ignition != self.last_ignition: self.controller.reset()