mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-12-02 05:23:43 +08:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 79c398db94 | |||
| 55786bdfc4 | |||
| b8c46b3f6e | |||
| 9f1d6552c0 | |||
| cbfc38abf9 | |||
| 74154ecab1 |
@@ -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 @@
|
||||
#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))]
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:3a94ab8395f20d20a9d5a2a2bacca0694f072df8421cf13adca6250d28065bdc
|
||||
size 24709205
|
||||
oid sha256:cb85afe38931bd5b2c8622ff0f7546dc154505090808a6f5f7835ec7a8d78c05
|
||||
size 24709209
|
||||
|
||||
Reference in New Issue
Block a user