diff --git a/selfdrive/ui/sunnypilot/ui_state.py b/selfdrive/ui/sunnypilot/ui_state.py index eb19cc6185..37063bc82f 100644 --- a/selfdrive/ui/sunnypilot/ui_state.py +++ b/selfdrive/ui/sunnypilot/ui_state.py @@ -171,6 +171,7 @@ class UIStateSP: self.turn_signals = self.params.get_bool("ShowTurnSignals") self.boot_offroad_mode = self.params.get("DeviceBootMode", return_default=True) self.always_offroad = self.params.get_bool("OffroadMode") + if not self._sp_initialized: self._sp_initialized = True self.reset_onroad_sleep_timer() diff --git a/sunnypilot/selfdrive/car/interfaces.py b/sunnypilot/selfdrive/car/interfaces.py index a76d6e41fb..1304dbd56e 100644 --- a/sunnypilot/selfdrive/car/interfaces.py +++ b/sunnypilot/selfdrive/car/interfaces.py @@ -109,7 +109,6 @@ def setup_interfaces(CI: CarInterfaceBase, params: Params = None) -> None: def initialize_params(params) -> list[dict[str, Any]]: keys: list = [] - # generic radar track mode; currently implemented by Hyundai keys.append("RadarTracks") # hyundai diff --git a/tools/replay/auto_radar_detect.py b/tools/radar/auto_radar_detect.py similarity index 97% rename from tools/replay/auto_radar_detect.py rename to tools/radar/auto_radar_detect.py index 34966054fd..d4947d4668 100755 --- a/tools/replay/auto_radar_detect.py +++ b/tools/radar/auto_radar_detect.py @@ -11,15 +11,15 @@ from collections import Counter, defaultdict import cereal.messaging as messaging from msgq.ipc_pyx import IpcError from opendbc.car.tests.routes import CarTestRoute, routes -from openpilot.tools.replay.custom_routes import CUSTOM_ROUTES -from openpilot.tools.replay.radar_helpers import ( +from openpilot.tools.radar.custom_routes import CUSTOM_ROUTES +from openpilot.tools.radar.radar_helpers import ( build_seen_address_map, get_radar_spec, is_exclusive_full_range_match, ) -REPLAY_PATH = os.path.join(os.path.dirname(__file__), "replay") +REPLAY_PATH = os.path.join(os.path.dirname(__file__), "..", "replay", "replay") REPLAY_PLAYBACK_SPEED = "3.0" REPLAY_ALLOW_SERVICES = "can" DETECTION_TIMEOUT_SECONDS = 20.0 @@ -54,7 +54,7 @@ def build_arg_parser() -> argparse.ArgumentParser: parser.add_argument("--routes", action="store_true", help="Use Hyundai/Kia/Genesis routes from opendbc/car/tests/routes.py.") parser.add_argument("--custom-routes", action="store_true", - help="Use routes from tools/replay/custom_routes.py.") + help="Use routes from tools/radar/custom_routes.py.") parser.add_argument("--route", action="append", default=[], help="Specific route(s) to test. If omitted, use Hyundai/Kia/Genesis routes from opendbc/car/tests/routes.py.") parser.add_argument("--data-dir", default=None, diff --git a/tools/replay/custom_routes.py b/tools/radar/custom_routes.py similarity index 100% rename from tools/replay/custom_routes.py rename to tools/radar/custom_routes.py diff --git a/tools/replay/radar_helpers.py b/tools/radar/radar_helpers.py similarity index 100% rename from tools/replay/radar_helpers.py rename to tools/radar/radar_helpers.py diff --git a/tools/replay/ui_radar.py b/tools/radar/ui_radar.py similarity index 99% rename from tools/replay/ui_radar.py rename to tools/radar/ui_radar.py index daef943fd0..7dbb6e5672 100755 --- a/tools/replay/ui_radar.py +++ b/tools/radar/ui_radar.py @@ -15,7 +15,7 @@ import cereal.messaging as messaging from opendbc.car.tests.routes import routes from openpilot.common.basedir import BASEDIR from openpilot.common.transformations.camera import DEVICE_CAMERAS -from openpilot.tools.replay.custom_routes import CUSTOM_ROUTES +from openpilot.tools.radar.custom_routes import CUSTOM_ROUTES from openpilot.tools.replay.lib.ui_helpers import ( UP, BLACK, @@ -27,7 +27,7 @@ from openpilot.tools.replay.lib.ui_helpers import ( plot_model, to_topdown_pt, ) -from openpilot.tools.replay.radar_helpers import ( +from openpilot.tools.radar.radar_helpers import ( RADAR_SPECS, build_seen_address_map, decode_radar_track, @@ -51,7 +51,7 @@ CAMERA_RADAR_Y_OFFSET = 25 RADAR_HEATMAP_DECAY = 0.975 RADAR_HEATMAP_ALPHA = 0.65 CAMERA_RADAR_HEATMAP_ALPHA = 0.45 -REPLAY_PATH = os.path.join(os.path.dirname(__file__), "replay") +REPLAY_PATH = os.path.join(os.path.dirname(__file__), "..", "replay", "replay") REPLAY_SOCKET_WAIT_TIMEOUT_SECONDS = 10.0 REPLAY_SPEEDS = (0.2, 0.5, 1.0, 2.0, 4.0, 8.0) CAMERA_DRAW_WIDTH = 640 @@ -877,7 +877,7 @@ def get_arg_parser(): parser.add_argument("--route", default=None, help="Route to replay locally before opening the UI.") parser.add_argument("--routes", action="store_true", help="Cycle Hyundai/Kia/Genesis routes from opendbc/car/tests/routes.py.") parser.add_argument("--custom-routes", nargs="?", type=int, const=1, default=None, - help="Cycle routes from tools/replay/custom_routes.py, optionally starting from a 1-based route index.") + help="Cycle routes from tools/radar/custom_routes.py, optionally starting from a 1-based route index.") parser.add_argument("--data-dir", default=None, help="Optional local route data directory to pass to replay.") parser.add_argument("--playback", default="1.0", help="Replay playback speed when using --route.") parser.add_argument("--prefix", default="ui-replay", help="OPENPILOT_PREFIX to use when launching replay from the UI.")