Compare commits

...

6 Commits

Author SHA1 Message Date
Jason Wen 79c398db94 chore: update CHANGELOG for 2026.002.004 2026-11-29 17:03:09 -05:00
discountchubbs 55786bdfc4 bug: camera offset migration from old branches 2026-11-29 17:03:09 -05:00
Jason Wen b8c46b3f6e version: bump to 2026.002.004 2026-11-29 17:03:08 -05:00
Jason Wen 9f1d6552c0 chore: update CHANGELOG for 2026.002.003 2026-11-19 23:35:04 -05:00
Jason Wen cbfc38abf9 lpa: import pyserial lazily 2026-11-19 23:35:04 -05:00
Jason Wen 74154ecab1 version: bump to 2026.002.003 2026-11-19 23:35:03 -05:00
7 changed files with 44 additions and 6 deletions
+10
View File
@@ -1,3 +1,13 @@
sunnypilot Version 2026.002.004 (2026-11-29)
========================
* What's Changed
* bug: camera offset migration from old branches by @Discountchubbs in https://github.com/sunnypilot/sunnypilot/pull/2127
sunnypilot Version 2026.002.003 (2026-11-19)
========================
* What's Changed
* hardware: fix fresh install stuck on comma logo on AGNOS 19.4 to 20.1 by @sunnyhaibin
sunnypilot Version 2026.002.002 (2026-08-05)
========================
* What's Changed
+1 -1
View File
@@ -1 +1 @@
#define SUNNYPILOT_VERSION "2026.002.002"
#define SUNNYPILOT_VERSION "2026.002.004"
@@ -8,6 +8,8 @@ import numpy as np
from openpilot.common.transformations.camera import DEVICE_CAMERAS
MAX_CAMERA_OFFSET = 0.35 # m, the settings' range
class CameraOffsetHelper:
def __init__(self):
@@ -26,6 +28,13 @@ class CameraOffsetHelper:
def set_offset(self, offset):
self.camera_offset = offset
def load_offset(self, params):
offset = params.get("CameraOffset", return_default=True)
if offset is None or not np.isfinite(offset) or abs(offset) > MAX_CAMERA_OFFSET + 1e-6: # older sunnypilot stored whole centimeters
offset = 0.0
params.put("CameraOffset", offset)
self.set_offset(offset)
def update(self, model_transform_main, model_transform_extra, sm, main_wide_camera):
self.actual_camera_offset = (0.9 * self.actual_camera_offset) + (0.1 * self.camera_offset)
dc = DEVICE_CAMERAS[(str(sm['deviceState'].deviceType), str(sm['roadCameraState'].sensor))]
+1 -1
View File
@@ -367,7 +367,7 @@ def main(demo=False):
if sm.frame % 60 == 0:
model.lat_delay = get_lat_delay(params, sm["liveDelay"].lateralDelay)
model.PLANPLUS_CONTROL = params.get("PlanplusControl", return_default=True)
camera_offset_helper.set_offset(params.get("CameraOffset", return_default=True))
camera_offset_helper.load_offset(params)
lat_delay = model.lat_delay + model.LAT_SMOOTH_SECONDS
if sm.updated["liveCalibration"] and sm.seen['roadCameraState'] and sm.seen['deviceState']:
device_from_calib_euler = np.array(sm["liveCalibration"].rpyCalib, dtype=np.float32)
@@ -25,6 +25,18 @@ class TestCameraOffset:
self.camera_offset = CameraOffsetHelper()
self.dc = DEVICE_CAMERAS[('mici', 'os04c10')]
def test_load_offset_resets_out_of_range(self):
class Params:
def __init__(self, v): self.v = v
def get(self, key, return_default=False): return self.v
def put(self, key, v): self.v = v
for stored, used in ((0.2, 0.2), (-0.35, -0.35), (4.0, 0.0), (-35.0, 0.0), (float('nan'), 0.0), (None, 0.0)):
params = Params(stored)
self.camera_offset.load_offset(params)
assert self.camera_offset.camera_offset == used
assert params.v == (stored if used == stored else 0.0)
def test_smoothing(self):
self.camera_offset.set_offset(0.2)
+9 -2
View File
@@ -6,7 +6,6 @@ import fcntl
import hashlib
import os
import requests
import serial
import subprocess
import sys
import termios
@@ -14,13 +13,17 @@ import time
from collections.abc import Callable, Generator
from contextlib import contextmanager
from typing import Any
from typing import TYPE_CHECKING, Any
from pathlib import Path
from openpilot.common.time_helpers import system_time_valid
from openpilot.system.hardware.base import LPABase, LPAError, LPAProfileNotFoundError, Profile
# pyserial is imported where used: AGNOS 19.4 to 20.1 lack it, and the updater imports this module
if TYPE_CHECKING:
import serial
GSMA_CI_BUNDLE = str(Path(__file__).parent / "gsma_ci_bundle.pem")
DEFAULT_DEVICE = "/dev/modem_at0"
@@ -176,6 +179,7 @@ class AtClient:
lines.append(line)
def _ensure_serial(self, reconnect: bool = False) -> None:
import serial
if reconnect:
self.channel = None
try:
@@ -188,6 +192,7 @@ class AtClient:
self._serial = serial.Serial(self._device, baudrate=self._baud, timeout=self._timeout)
def query(self, cmd: str) -> list[str]:
import serial
self._ensure_serial()
try:
self._send(cmd)
@@ -198,6 +203,7 @@ class AtClient:
return self._expect()
def _open_isdr_once(self) -> None:
import serial
if self.channel:
try:
self.query(f"AT+CCHC={self.channel}")
@@ -226,6 +232,7 @@ class AtClient:
subprocess.run(['/usr/comma/lte/lte.sh', 'start'], capture_output=True)
def open_isdr(self) -> None:
import serial
for attempt in range(OPEN_ISDR_RETRIES):
try:
self._open_isdr_once()
+2 -2
View File
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3a94ab8395f20d20a9d5a2a2bacca0694f072df8421cf13adca6250d28065bdc
size 24709205
oid sha256:cb85afe38931bd5b2c8622ff0f7546dc154505090808a6f5f7835ec7a8d78c05
size 24709209