Merge branch 'master-new' into dec-redo

This commit is contained in:
DevTekVE
2025-01-18 20:41:04 +01:00
committed by GitHub
99 changed files with 247 additions and 81 deletions
+43
View File
@@ -0,0 +1,43 @@
exclude-labels:
- 'no-changelog'
categories:
- title: '🚀 Features'
labels:
- 'feature'
- 'enhancement'
- title: '🐛 Bug Fixes'
collapse-after: 5
labels:
- 'fix'
- 'bugfix'
- 'bug'
- title: '🧰 Maintenance'
collapse-after: 5
label: 'chore'
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
change-title-escapes: '\<*_&'
replacers:
- search: '/[Ss][Uu][Nn][Nn][Yy][Pp][Ii][Ll][Oo][Tt]/g'
replace: 'sunnypilot'
- search: '/\b[Ss][Pp]\b/g'
replace: 'SP'
version-resolver:
major:
labels:
- 'major'
minor:
labels:
- 'minor'
patch:
labels:
- 'patch'
default: patch
name-template: 'v$RESOLVED_VERSION 🚀'
tag-template: 'v$RESOLVED_VERSION'
version-template: "0.$MAJOR.$MINOR.$PATCH" # The day OP becomes v1, we need to bump this
tag-prefix: "v0." # The day OP becomes v1, we need to bump this
prerelease-identifier: "staging"
template: |
## Changes
$CHANGES
+29
View File
@@ -0,0 +1,29 @@
name: Release Drafter
on:
push:
branches:
- master-new
- master
tags:
- 'v*'
pull_request_target:
types: [opened, reopened, synchronize]
workflow_dispatch:
permissions:
contents: read
jobs:
update_release_draft:
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: release-drafter/release-drafter@v6
with:
config-name: release-drafter.yml
prerelease: ${{ !startsWith(github.ref, 'refs/tags/v') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+1 -1
Submodule panda updated: 96632fa921...7b0e3f1955
+6 -3
View File
@@ -23,7 +23,7 @@ from openpilot.selfdrive.car.cruise import VCruiseHelper
from openpilot.selfdrive.car.car_specific import MockCarState
from openpilot.sunnypilot.mads.mads import MadsParams
from openpilot.sunnypilot.selfdrive.car.interfaces import setup_car_interface_sp, initialize_car_interface_sp
from openpilot.sunnypilot.selfdrive.car import interfaces
REPLAY = "REPLAY" in os.environ
@@ -102,7 +102,7 @@ class Car:
cached_params = _cached_params
self.CI = get_car(*self.can_callbacks, obd_callback(self.params), experimental_long_allowed, num_pandas, cached_params)
setup_car_interface_sp(self.CI.CP, self.params)
interfaces.setup_car_interface_sp(self.CI.CP, self.params)
self.RI = get_radar_interface(self.CI.CP)
self.CP = self.CI.CP
@@ -167,6 +167,9 @@ class Car:
# card is driven by can recv, expected at 100Hz
self.rk = Ratekeeper(100, print_delay_threshold=None)
# log fingerprint in sentry
interfaces.log_fingerprint(self.CP)
def state_update(self) -> tuple[car.CarState, structs.RadarDataT | None]:
"""carState update loop, driven by can"""
@@ -240,7 +243,7 @@ class Car:
# Initialize CarInterface, once controls are ready
# TODO: this can make us miss at least a few cycles when doing an ECU knockout
self.CI.init(self.CP, *self.can_callbacks)
initialize_car_interface_sp(self.CP, self.params, *self.can_callbacks)
interfaces.initialize_car_interface_sp(self.CP, self.params, *self.can_callbacks)
# signal pandad to switch to car safety mode
self.params.put_bool_nonblocking("ControlsReady", True)
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6e1555145a4482e4148c2e7a5cdbf370720a3cf684f18686a50bf25de0b55650
size 356302
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:eb4235545588e617a82d698721503bdd048a5858da9d60b9b90eeecc8c969498
size 356186
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0720a28167410da8dc5aa940f9ff916dcd3e1863ba4fb5b91c73ddf8c7e10c6c
size 256451
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c02a2432cb761440b9b5a0e432a13f05f5b03b9890bc5fe99f6c533be4f459f1
size 256426
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:221caa376d9052d375dc82225f6c6f894fa684f4be2f387bf2cf46927ed3cd15
size 332404
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:58c05f3c0b39e0525a586598982923b13e9b54c5ec9f41f87d88156552374a71
size 332428
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d02a7e8de6fcc2f0d2c8371116d9acef752e53f3a0c701f89a8c12927c666678
size 268879
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d66335e9f34ac3baff73188c5042e2292c42979d9c6769a7953ecd17dc9e3956
size 268874
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b17cefe94984aa855dc21f63afabf3514619cc0b4dc5eafc9c3f3594577a655c
size 435709
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:fc70028fe66f0292f208dc4449e9f1291f5b28a8c44ebf8076f24b690364d256
size 435674
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:333ea99fc2d88f0ec405f2ea5f1d86881a5879dc77ceee14700da1063a1319ac
size 308602
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:11025e5a2cc0c21c3525dd002b4834db18006016a606b7ad83e7ec2c2aa8d710
size 308599
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:426f453cd17daaa3db48d98a8e2a34f7f113b91bdfe3da2dbe6d8c13c72f37f6
size 392249
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:177c3c81df0a10f4e56122196ecfc2ebc807491171b405f7caa4f62363856c7a
size 393110
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:88e0d29b9a909c9cb97e47f62e0b42bb5761ac65d6836eb4d415982954df28f0
size 334267
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d35c3b33f528bfcd9f15b53a41031c37d47739604b4b6f721670af44df901280
size 334227
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:77a887290be2730ba5b3d558de4a7c72598c3a20372038f5c9de08b57a84c33b
size 470504
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:572a2b5a4ea929451b3f6aaa8786029f198eb3f3d823ba72e579a791fd0c8af8
size 470462
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6e152e4ffbfb1fa9cfaf3971859ea47ca5815735a3c391dc9b8c6e233a26658d
size 260279
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e55efae47740ead32d95e4d1c677ce07f95441c5cfea72a80c7f2a5cda996633
size 260412
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:03aa9d65b2da189437de176269c698deb3fecd6167e958caf3530737cf15a431
size 217479
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3b1ed44ae652a3eeb4786c989219e2fd09e0755b5003ca53ba1c0ec01cd7d8c0
size 217471
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:bd67adc5e5ea3353ef7cdd306b2e3b0f1b02862739ef3e313f0e4a20372c696a
size 293071
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:05249897ed80e89bfecd69f3719ce6e58112994718d0e0a02b0cd1003beab761
size 293036
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:70fe8b2843fb4721d72e9c7fc524825b067e0b550afec181b636ef329687fc4a
size 260872
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:4b1514a19e37f8bcf252380a258633f2496f1c038cc3411aff10bbc934a0ae0e
size 260925
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e5142666f3f837848db872917bd344b05209ddab82c2671a75b13682b709a9f8
size 100116
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c97c909cce68a14b255c91d7dac8cd29aa4e73537d0b4ca4dddd1954471713bb
size 100071
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2808066b4828ae0591957ab3b5ea654843c5a6f3051a0b734e0869dd903f82dc
size 262864
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f3b0432ded38813b7bc9ea00e9c48eb4d35d05cb459b6a574a18079ad19c45f0
size 262901
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:cb2755f77239c319a9528b00fb17f1696c67085b825e2d08cbbe8d47545316cd
size 258556
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d2e934ace7fa186b1989f25cf29c40aaad1a1a1a0a469f298c93c0533c3b44d9
size 259272
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:4643cd4e30aec5e5256f6da72748f959310f99ba763bbbf6981f077c64391327
size 268090
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e1889b550401eea6817f397bcce895660710d4d8d81ba715ba48f203ed0152b6
size 268159
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c4a4a300062f80c37686b58ee1382569dcf8e51be523a67d0134e9de8660f8ab
size 305130
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ca312b930dce74d532f8630f4dffa1e8e3596cc9a33e83f655c3c7f823d19a06
size 305087
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a3b26b9065a9f9f8afeea2f5e754e7b4443d234bedfa1752cd30bfecdf864878
size 255666
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:dbd2ec6c65fdf73eeb0b372f34b59969125d5ee6bc2f6c6fa477ca567d96ed81
size 255744
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:4713277cec728e3e1c8730afea7d6eea97c67a9ff012ce3218b846bfcbc54a20
size 272007
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:799b230f211c69b1706b1226fe87989fd726d96a2cebbaaacf30180e89137b75
size 272009
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:88d6b2eac79535aaff96a0f821d4ab44ea05ebebfc6430c9528ac8ea4e26d90d
size 332386
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2c0b370f4926ae2a366f115952ab37a6ba4b8a957553c4369870b077d95e1282
size 332381
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ff8caec6050e351803e5e6c9a7924706706c2cc23564952cdb00f1c674cc62d3
size 294534
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:93e3b5fcf899ae095b8a1a34126436fd14f101aeca7749925b3958aec04e6b61
size 294565
+1 -1
View File
@@ -1 +1 @@
afde2771f8a70171349c733f4a9500d33988edff
4b12690274eb951346624fbf58075c82ad5e73d1
+2
View File
@@ -267,6 +267,7 @@ DevicePanel::DevicePanel(SettingsWindow *parent) : ListWidget(parent) {
}
});
addItem(translateBtn);
#endif
QObject::connect(uiState(), &UIState::offroadTransition, [=](bool offroad) {
for (auto btn : findChildren<ButtonControl *>()) {
@@ -276,6 +277,7 @@ DevicePanel::DevicePanel(SettingsWindow *parent) : ListWidget(parent) {
}
});
#ifndef SUNNYPILOT
// power buttons
QHBoxLayout *power_layout = new QHBoxLayout();
power_layout->setSpacing(30);
@@ -65,6 +65,12 @@ DevicePanelSP::DevicePanelSP(SettingsWindowSP *parent) : DevicePanel(parent) {
addItem(device_grid_layout);
QObject::connect(uiState(), &UIState::offroadTransition, [=](bool offroad) {
for (auto btn : findChildren<PushButtonSP*>()) {
btn->setEnabled(offroad);
}
});
// offroad mode and power buttons
QHBoxLayout *power_layout = new QHBoxLayout();
+9
View File
@@ -12,6 +12,15 @@ from opendbc.car.hyundai.radar_interface import RADAR_START_ADDR
from opendbc.car.hyundai.values import HyundaiFlags, DBC as HYUNDAI_DBC
from opendbc.sunnypilot.car.hyundai.values import HyundaiFlagsSP
import openpilot.system.sentry as sentry
def log_fingerprint(CP: structs.CarParams) -> None:
if CP.carFingerprint == "MOCK":
sentry.capture_fingerprint_mock()
else:
sentry.capture_fingerprint(CP.carFingerprint, CP.carName)
def setup_car_interface_sp(CP: structs.CarParams, params):
if CP.carName == 'hyundai':
+83 -9
View File
@@ -1,26 +1,35 @@
"""Install exception handler for process crash."""
import os
import traceback
from datetime import datetime
import sentry_sdk
from enum import Enum
from sentry_sdk.integrations.threading import ThreadingIntegration
from openpilot.common.params import Params
from openpilot.system.athena.registration import is_registered_device
from openpilot.system.hardware import HARDWARE, PC
from openpilot.system.athena.registration import UNREGISTERED_DONGLE_ID
from openpilot.system.hardware import HARDWARE
from openpilot.system.hardware.hw import Paths
from openpilot.common.swaglog import cloudlog
from openpilot.system.version import get_build_metadata, get_version
from openpilot.sunnypilot.sunnylink.api import UNREGISTERED_SUNNYLINK_DONGLE_ID
CRASHES_DIR = Paths.crash_log_root()
class SentryProject(Enum):
# python project
SELFDRIVE = "https://6f3c7076c1e14b2aa10f5dde6dda0cc4@o33823.ingest.sentry.io/77924"
SELFDRIVE = "https://186a6736b7927e5ae9b92c869ba81b6b@o1138119.ingest.us.sentry.io/4508660076052480"
# native project
SELFDRIVE_NATIVE = "https://3e4b586ed21a4479ad5d85083b639bc6@o33823.ingest.sentry.io/157615"
SELFDRIVE_NATIVE = SELFDRIVE
def report_tombstone(fn: str, message: str, contents: str) -> None:
cloudlog.error({'tombstone': message})
with sentry_sdk.configure_scope() as scope:
set_user()
scope.set_extra("tombstone_fn", fn)
scope.set_extra("tombstone", contents)
sentry_sdk.capture_message(message=message)
@@ -31,25 +40,89 @@ def capture_exception(*args, **kwargs) -> None:
cloudlog.error("crash", exc_info=kwargs.get('exc_info', 1))
try:
save_exception(traceback.format_exc())
set_user()
sentry_sdk.capture_exception(*args, **kwargs)
sentry_sdk.flush() # https://github.com/getsentry/sentry-python/issues/291
except Exception:
cloudlog.exception("sentry exception")
def save_exception(content: str) -> None:
try:
if not os.path.exists(CRASHES_DIR):
os.makedirs(CRASHES_DIR)
files = [
os.path.join(CRASHES_DIR, datetime.now().strftime("%Y-%m-%d--%H-%M-%S.log")),
os.path.join(CRASHES_DIR, "error.log")
]
for fn in files:
with open(fn, 'w') as f:
if fn == "error.log":
lines = content.splitlines()[-3:]
f.write("\n".join(lines))
else:
f.write(content)
cloudlog.error(f"logged crash to {files}")
except Exception:
cloudlog.exception("error when attempting to save exception")
def capture_fingerprint_mock() -> None:
try:
set_user()
message = "car doesn't match any fingerprints"
sentry_sdk.capture_message(message=message, level="error")
sentry_sdk.flush()
except Exception as e:
cloudlog.exception(f"sentry fingerprint MOCK exception: {e}")
def capture_fingerprint(candidate: str, car_name: str) -> None:
try:
set_user()
sentry_sdk.set_tag("carFingerprint", candidate)
sentry_sdk.set_tag("carName", car_name)
message = f"Fingerprinted {candidate}"
sentry_sdk.capture_message(message=message, level="info")
sentry_sdk.flush()
except Exception as e:
cloudlog.exception(f"sentry fingerprint exception: {e}")
def set_tag(key: str, value: str) -> None:
sentry_sdk.set_tag(key, value)
def set_user() -> None:
dongle_id, git_username, _ = get_properties()
sentry_sdk.set_user({"id": dongle_id, "name": git_username})
def get_properties() -> tuple[str, str, str]:
params = Params()
hardware_serial: str = params.get("HardwareSerial", encoding='utf-8') or ""
git_username: str = params.get("GithubUsername", encoding='utf-8') or ""
dongle_id: str = params.get("DongleId", encoding='utf-8') or f"{UNREGISTERED_DONGLE_ID}-{hardware_serial}"
sunnylink_dongle_id: str = params.get("SunnylinkDongleId", encoding='utf-8') or UNREGISTERED_SUNNYLINK_DONGLE_ID
return dongle_id, git_username, sunnylink_dongle_id
def init(project: SentryProject) -> bool:
build_metadata = get_build_metadata()
# forks like to mess with this, so double check
comma_remote = build_metadata.openpilot.comma_remote and "commaai" in build_metadata.openpilot.git_origin
if not comma_remote or not is_registered_device() or PC:
return False
# comma_remote = build_metadata.openpilot.comma_remote and "commaai" in build_metadata.openpilot.git_origin
# if not comma_remote or not is_registered_device() or PC:
# return False
env = "release" if build_metadata.tested_channel else "master"
dongle_id = Params().get("DongleId", encoding='utf-8')
dongle_id, git_username, sunnylink_dongle_id = get_properties()
integrations = []
if project == SentryProject.SELFDRIVE:
@@ -63,11 +136,12 @@ def init(project: SentryProject) -> bool:
max_value_length=8192,
environment=env)
sentry_sdk.set_user({"id": dongle_id})
sentry_sdk.set_user({"id": dongle_id, "name": git_username})
sentry_sdk.set_tag("dirty", build_metadata.openpilot.is_dirty)
sentry_sdk.set_tag("origin", build_metadata.openpilot.git_origin)
sentry_sdk.set_tag("branch", build_metadata.channel)
sentry_sdk.set_tag("commit", build_metadata.openpilot.git_commit)
sentry_sdk.set_tag("device", HARDWARE.get_device_type())
sentry_sdk.set_tag("sunnylink_dongle_id", sunnylink_dongle_id)
return True