From f94087822f66e0522b9fed32d8d725a21cac0cf2 Mon Sep 17 00:00:00 2001 From: "IQ.Lvbs CI [bot]" Date: Wed, 22 Jul 2026 20:21:04 -0500 Subject: [PATCH] IQ.Pilot Release Commit @ 0012d8f --- README.md | 8 ++-- common/params.py | 14 ++++--- selfdrive/modeld/SConscript | 5 ++- selfdrive/modeld/prebuilt_models.py | 6 +++ selfdrive/modeld/test_prebuilt_models.py | 51 ++++++++++++++++++++++++ system/loggerd/loggerd.h | 9 ++--- 6 files changed, 76 insertions(+), 17 deletions(-) create mode 100644 selfdrive/modeld/test_prebuilt_models.py diff --git a/README.md b/README.md index 042e3ba..4901a38 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ ## Installation #### Installing Via Installer URL: #### Enter the following into your device custom URL box to install IQ.Pilot: -`IQLvbs/release` +`iqinc/release` #### Having Trouble? If your device is currently running AGNOS 13.1 or older, you should install latest stock openpilot, then install IQ.Pilot, or try one of the alternative methods listed below! @@ -27,11 +27,11 @@ #### Installing Via SSH: #### Once you are connected to your device via SSH, you can paste the following command below to install IQ.Pilot: -`cd .. && rm -rf openpilot && git clone https://github.com/IQLvbs/openpilot.git -b release && cd openpilot && sudo reboot` +`cd .. && rm -rf openpilot && git clone https://github.com/iqinc/openpilot.git -b release && cd openpilot && sudo reboot` #### If you'd like to backup your previous installation as well, paste the following command below to install IQ.Pilot: -`cd .. && mv openpilot openpilot_backup_X && git clone https://github.com/IQLvbs/openpilot.git -b release && cd openpilot && sudo reboot` +`cd .. && mv openpilot openpilot_backup_X && git clone https://github.com/iqinc/openpilot.git -b release && cd openpilot && sudo reboot` #### Alternatively, you can use your existing fork's built in tools to switch your branch as well: -`git remote add iqpilot https://github.com/IQLvbs/openpilot.git && op switch iqpilot release` +`git remote add iqpilot https://github.com/iqinc/openpilot.git && op switch iqpilot release` --- diff --git a/common/params.py b/common/params.py index 9bcde11..2b7165a 100644 --- a/common/params.py +++ b/common/params.py @@ -9,12 +9,14 @@ except ImportError: pass class ParamKeyFlag(IntFlag): - PERSISTENT = 1 - CLEAR_ON_MANAGER_START = 2 - CLEAR_ON_ONROAD_TRANSITION = 4 - CLEAR_ON_OFFROAD_TRANSITION = 8 - DONT_LOG = 16 - DEVELOPMENT_ONLY = 32 + # must stay in lockstep with enum ParamKeyFlag in common/params.h + PERSISTENT = 0x02 + CLEAR_ON_MANAGER_START = 0x04 + CLEAR_ON_ONROAD_TRANSITION = 0x08 + CLEAR_ON_OFFROAD_TRANSITION = 0x10 + DONT_LOG = 0x20 + DEVELOPMENT_ONLY = 0x40 + CLEAR_ON_IGNITION_ON = 0x80 ALL = 0xFFFFFFFF class ParamKeyType(IntEnum): diff --git a/selfdrive/modeld/SConscript b/selfdrive/modeld/SConscript index caf1fcb..40e7401 100644 --- a/selfdrive/modeld/SConscript +++ b/selfdrive/modeld/SConscript @@ -72,7 +72,10 @@ for model_name in ['dmonitoring_model']: # inputs (onnx + tinygrad_repo + flags + metadata script) and output hashes; if it matches, skip # declaring the targets entirely. Any mismatch falls back to a normal on-device compile. if arch == "larch64": - from openpilot.selfdrive.modeld.prebuilt_models import verify_prebuilt, outputs_match + from openpilot.selfdrive.modeld.prebuilt_models import packaged_prebuilt_matches, verify_prebuilt, outputs_match + if packaged_prebuilt_matches(model_name): + print(lenv.PrettyNote('SKIP', f"{model_name} — packaged prebuilt pkl")) + continue if verify_prebuilt(model_name, flags): print(lenv.PrettyNote('SKIP', f"{model_name} — prebuilt pkl")) continue diff --git a/selfdrive/modeld/prebuilt_models.py b/selfdrive/modeld/prebuilt_models.py index 0f62ff3..73a16de 100644 --- a/selfdrive/modeld/prebuilt_models.py +++ b/selfdrive/modeld/prebuilt_models.py @@ -77,7 +77,13 @@ def outputs_match(model_name: str) -> bool: return True +def packaged_prebuilt_matches(model_name: str) -> bool: + return not (MODELS_DIR / f'{model_name}.onnx').is_file() and outputs_match(model_name) + + def verify_prebuilt(model_name: str, flags: str) -> bool: + if not (MODELS_DIR / f'{model_name}.onnx').is_file(): + return False data = _load_checks().get(model_name, {}) if data.get('signature') != compute_signature(model_name, flags): return False diff --git a/selfdrive/modeld/test_prebuilt_models.py b/selfdrive/modeld/test_prebuilt_models.py new file mode 100644 index 0000000..a994982 --- /dev/null +++ b/selfdrive/modeld/test_prebuilt_models.py @@ -0,0 +1,51 @@ +import hashlib +import json + +from openpilot.selfdrive.modeld import prebuilt_models + + +def write_outputs(models_dir, check_path): + outputs = {} + for name, contents in { + 'dmonitoring_model_tinygrad.pkl': b'tinygrad', + 'dmonitoring_model_metadata.pkl': b'metadata', + }.items(): + (models_dir / name).write_bytes(contents) + outputs[name] = hashlib.sha256(contents).hexdigest() + check_path.write_text(json.dumps({'dmonitoring_model': {'outputs': outputs}})) + + +def test_packaged_prebuilt_without_onnx(tmp_path, monkeypatch): + models_dir = tmp_path / 'models' + models_dir.mkdir() + check_path = models_dir / 'prebuilt_check.json' + write_outputs(models_dir, check_path) + monkeypatch.setattr(prebuilt_models, 'MODELS_DIR', models_dir) + monkeypatch.setattr(prebuilt_models, 'CHECK_PATH', check_path) + + assert prebuilt_models.packaged_prebuilt_matches('dmonitoring_model') + assert not prebuilt_models.verify_prebuilt('dmonitoring_model', 'flags') + + +def test_packaged_prebuilt_rejects_corrupt_output(tmp_path, monkeypatch): + models_dir = tmp_path / 'models' + models_dir.mkdir() + check_path = models_dir / 'prebuilt_check.json' + write_outputs(models_dir, check_path) + (models_dir / 'dmonitoring_model_tinygrad.pkl').write_bytes(b'corrupt') + monkeypatch.setattr(prebuilt_models, 'MODELS_DIR', models_dir) + monkeypatch.setattr(prebuilt_models, 'CHECK_PATH', check_path) + + assert not prebuilt_models.packaged_prebuilt_matches('dmonitoring_model') + + +def test_source_checkout_is_not_packaged_prebuilt(tmp_path, monkeypatch): + models_dir = tmp_path / 'models' + models_dir.mkdir() + check_path = models_dir / 'prebuilt_check.json' + write_outputs(models_dir, check_path) + (models_dir / 'dmonitoring_model.onnx').write_bytes(b'onnx') + monkeypatch.setattr(prebuilt_models, 'MODELS_DIR', models_dir) + monkeypatch.setattr(prebuilt_models, 'CHECK_PATH', check_path) + + assert not prebuilt_models.packaged_prebuilt_matches('dmonitoring_model') diff --git a/system/loggerd/loggerd.h b/system/loggerd/loggerd.h index 63f68b5..f4cf803 100644 --- a/system/loggerd/loggerd.h +++ b/system/loggerd/loggerd.h @@ -43,10 +43,7 @@ struct EncoderSettings { } static EncoderSettings QcamEncoderSettings() { - // qcamera.ts is the small "dashcam" copy uploaded to konn3kt. Stock 256kbps @ 526x330 is potato; - // bump the bitrate to match the higher resolution below. Still H264/.ts (web/HLS compatible) and - // ~1/4 the bitrate of fcamera.hevc, so the file stays small. Override with QCAM_BITRATE if needed. - int _qcam_bitrate = getenv("QCAM_BITRATE") ? atoi(getenv("QCAM_BITRATE")) : 1'600'000; + int _qcam_bitrate = getenv("QCAM_BITRATE") ? atoi(getenv("QCAM_BITRATE")) : 3'200'000; return EncoderSettings{.encode_type = cereal::EncodeIndex::Type::QCAMERA_H264, .bitrate = _qcam_bitrate, .gop_size = 15}; } @@ -140,8 +137,8 @@ const EncoderInfo qcam_encoder_info = { .filename = "qcamera.ts", .cbr = true, // enforce the bitrate so upload size stays predictable (no VBR overshoot) .get_settings = [](int){return EncoderSettings::QcamEncoderSettings();}, - .frame_width = 1052, // 2x the stock 526x330, same road-cam aspect ratio - .frame_height = 660, + .frame_width = 1578, // 3x the stock 526x330, same road-cam aspect ratio + .frame_height = 990, .include_audio = Params().getBool("RecordAudio"), INIT_ENCODE_FUNCTIONS(QRoadEncode), };