Compare commits

..

5 Commits

Author SHA1 Message Date
DevTekVE a3201845f2 Merge branch 'temp-squash-long-distance-btn-exp-mode' into master-dev-c3-new-test 2025-01-18 19:39:08 +01:00
DevTekVE 9567c074c1 Longitudinal: Distance button hold to toggle Chill/Experimental Mode (#576)
Source commit: 13cb725652

Original commits:

* Sync: `commaai/openpilot:master` into `sunnypilot/sunnypilot:master-new` (#580)
* test_processes: update ref logs to afde277
* # Conflicts:
* #    .github/workflows/ui_preview.yaml
* #    opendbc_repo
* #    panda
* #    release/release_files.py
* #    selfdrive/test/process_replay/ref_commit
* #    selfdrive/ui/tests/test_ui/run.py
* bring back ui.py (#34396)
* * bring back uipy
* * fix it
* * fix
* Log satellite count in GpsLocationData (#34395)
* * Log satellite count in GpsLocationData
* * update refs
* * forgot to build
* Toyota: allow brake hold (#34394)
* toyota okay
* fix uv (#34393)
* uv fix
* Update RELEASES.md
* release this month
* no need
* fix
* unused
* Longitudinal: Distance button hold to toggle Chill/Experimental Mode
* Hyundai: match cancel button panda safety logic (#34390)
* * rising edge
* * should work
* * TODO
* * fix
* card: fix cruise speed initialization w/ buttons (#34386)
* * fix initialize w/ buttons
* * what
* * comment
* VW: switch to common pcmCruise check (#34389)
* Update car_specific.py
* card: vcruise all in one place (#34387)
* * no reason to not be here
* * oh this was off by a frame!
* * ref
* Fix missing visual car dash alerts (#34385)
* * fix missing visual dash alerts
* * update refs
* process_replay: add cast in migrate_longitudinalPlan (#34383)
* * Cast
* * Something
* * Remove newline
* process_replay: ignore unknown members in the migration code (#34382)
* * Fix the migration for the events
* * clean up
* clean up
* clean up
* * no continue
* ---------
* Co-authored-by: Shane Smiskol <shane@smiskol.com>
* Getting rid of openpilot.common.numpy_fast (#34368)
* * Got rid openpilot.common.numpy_fast
* * fixed some data type erros
* * importing numpy instead of importing specific functions
* * fixing some numpy importing mistakes
* * Update selfdrive/car/cruise.py
* ---------
* Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
* Toyota: remove longitudinal derivative (#34378)
* * Update Python packages
* * update refs
* ---------
* Co-authored-by: Vehicle Researcher <user@comma.ai>
* Co-authored-by: Shane Smiskol <shane@smiskol.com>
* PlotJuggler: Layout for debugging locationdTemporaryError (#34381)
* * PlotJuggler: layout for debugging locationd
* * not needed, and codespell doesn't like it
* raylib: revert auto fit screen size (#34380)
* revert auto fit screen size
* Remove release files (conceptually) (#34379)
* * Remove release files (conceptually)
* * fix
* raylib: refactor to implement new App class (#34375)
* refactor to implement new App class
* [bot] Update Python packages (#34376)
* * Update Python packages
* * time -> time_helpers
* ---------
* Co-authored-by: Vehicle Researcher <user@comma.ai>
* Co-authored-by: Maxime Desroches <desroches.maxime@gmail.com>
* CI: Add missing uppercase_keyboard UI view (#34347)
* * add-uppercase-preview
* * testing-UI-on-fork
* * change back
* * add-my-branch
* * needs to see sha from fork for test
* * fix missing sha
* * change back
* * get correct named artifact
* * try this
* * experimenting coordinates
* * try these coordinates
* * try these coordinates
* * draws circles to see touches - changes coordinates
* * try these changes
* * better coordinates
* * click is more centered
* * try again
* * revert back
* * revert these too
* * last revert...
* Keyboard: add missing control btns to uppercase (#34344)
* * add-slash-to uppercase
* * Trigger UI preview workflow
* Move uds.py (#34374)
* * rm uds pt. 1
* * rm uds pt. 2
* * imports
* oops need raw
* third_party: add raygui (#34369)
* swaglog: fix locale dependence (#34367)
* encoderd: refactor VideoEncoder::publisher_publish to standardize member variable access (#34342)
* remove redundant pointer parameter
* modeld: properly release OpenCL context in  `__dealloc__` method (#34353)
* release OpenCL context in __dealloc__
* release soon
* loggerd: typing and remove unused default arg (#34349)
* deleter cleanups (#34345)
2025-01-18 19:39:07 +01:00
DevTekVE a79a2ac494 Merge branch 'temp-squash-long-distance-btn-exp-mode' into master-dev-c3-new-test 2025-01-18 19:35:46 +01:00
DevTekVE e6055d68be Longitudinal: Distance button hold to toggle Chill/Experimental Mode (#576)
Original commits:

* Sync: `commaai/openpilot:master` into `sunnypilot/sunnypilot:master-new` (#580)
* test_processes: update ref logs to afde277
* # Conflicts:
* #    .github/workflows/ui_preview.yaml
* #    opendbc_repo
* #    panda
* #    release/release_files.py
* #    selfdrive/test/process_replay/ref_commit
* #    selfdrive/ui/tests/test_ui/run.py
* bring back ui.py (#34396)
* * bring back uipy
* * fix it
* * fix
* Log satellite count in GpsLocationData (#34395)
* * Log satellite count in GpsLocationData
* * update refs
* * forgot to build
* Toyota: allow brake hold (#34394)
* toyota okay
* fix uv (#34393)
* uv fix
* Update RELEASES.md
* release this month
* no need
* fix
* unused
* Longitudinal: Distance button hold to toggle Chill/Experimental Mode
* Hyundai: match cancel button panda safety logic (#34390)
* * rising edge
* * should work
* * TODO
* * fix
* card: fix cruise speed initialization w/ buttons (#34386)
* * fix initialize w/ buttons
* * what
* * comment
* VW: switch to common pcmCruise check (#34389)
* Update car_specific.py
* card: vcruise all in one place (#34387)
* * no reason to not be here
* * oh this was off by a frame!
* * ref
* Fix missing visual car dash alerts (#34385)
* * fix missing visual dash alerts
* * update refs
* process_replay: add cast in migrate_longitudinalPlan (#34383)
* * Cast
* * Something
* * Remove newline
* process_replay: ignore unknown members in the migration code (#34382)
* * Fix the migration for the events
* * clean up
* clean up
* clean up
* * no continue
* ---------
* Co-authored-by: Shane Smiskol <shane@smiskol.com>
* Getting rid of openpilot.common.numpy_fast (#34368)
* * Got rid openpilot.common.numpy_fast
* * fixed some data type erros
* * importing numpy instead of importing specific functions
* * fixing some numpy importing mistakes
* * Update selfdrive/car/cruise.py
* ---------
* Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
* Toyota: remove longitudinal derivative (#34378)
* * Update Python packages
* * update refs
* ---------
* Co-authored-by: Vehicle Researcher <user@comma.ai>
* Co-authored-by: Shane Smiskol <shane@smiskol.com>
* PlotJuggler: Layout for debugging locationdTemporaryError (#34381)
* * PlotJuggler: layout for debugging locationd
* * not needed, and codespell doesn't like it
* raylib: revert auto fit screen size (#34380)
* revert auto fit screen size
* Remove release files (conceptually) (#34379)
* * Remove release files (conceptually)
* * fix
* raylib: refactor to implement new App class (#34375)
* refactor to implement new App class
* [bot] Update Python packages (#34376)
* * Update Python packages
* * time -> time_helpers
* ---------
* Co-authored-by: Vehicle Researcher <user@comma.ai>
* Co-authored-by: Maxime Desroches <desroches.maxime@gmail.com>
* CI: Add missing uppercase_keyboard UI view (#34347)
* * add-uppercase-preview
* * testing-UI-on-fork
* * change back
* * add-my-branch
* * needs to see sha from fork for test
* * fix missing sha
* * change back
* * get correct named artifact
* * try this
* * experimenting coordinates
* * try these coordinates
* * try these coordinates
* * draws circles to see touches - changes coordinates
* * try these changes
* * better coordinates
* * click is more centered
* * try again
* * revert back
* * revert these too
* * last revert...
* Keyboard: add missing control btns to uppercase (#34344)
* * add-slash-to uppercase
* * Trigger UI preview workflow
* Move uds.py (#34374)
* * rm uds pt. 1
* * rm uds pt. 2
* * imports
* oops need raw
* third_party: add raygui (#34369)
* swaglog: fix locale dependence (#34367)
* encoderd: refactor VideoEncoder::publisher_publish to standardize member variable access (#34342)
* remove redundant pointer parameter
* modeld: properly release OpenCL context in  `__dealloc__` method (#34353)
* release OpenCL context in __dealloc__
* release soon
* loggerd: typing and remove unused default arg (#34349)
* deleter cleanups (#34345)
2025-01-18 19:35:46 +01:00
DevTekVE 3b907acfe7 Longitudinal: Distance button hold to toggle Chill/Experimental Mode
Original commits:

* no need
* fix
* unused
* Longitudinal: Distance button hold to toggle Chill/Experimental Mode
2025-01-15 21:42:38 +01:00
153 changed files with 184 additions and 1745 deletions
-43
View File
@@ -1,43 +0,0 @@
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
@@ -1,29 +0,0 @@
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 }}
-44
View File
@@ -29,50 +29,6 @@ then means breaking backwards-compatibility with all old logs of your fork. So w
[custom.capnp](custom.capnp) that we will leave empty in mainline cereal/openpilot. **If you only modify those, you can ensure your
fork will remain backwards-compatible with all versions of mainline openpilot and your fork.**
An example of compatible changes:
```diff
diff --git a/cereal/custom.capnp b/cereal/custom.capnp
index 3348e859e..3365c7b98 100644
--- a/cereal/custom.capnp
+++ b/cereal/custom.capnp
@@ -10,7 +10,11 @@ $Cxx.namespace("cereal");
# DO rename the structs
# DON'T change the identifier (e.g. @0x81c2f05a394cf4af)
-struct CustomReserved0 @0x81c2f05a394cf4af {
+struct SteeringInfo @0x81c2f05a394cf4af {
+ active @0 :Bool;
+ steeringAngleDeg @1 :Float32;
+ steeringRateDeg @2 :Float32;
+ steeringAccelDeg @3 :Float32;
}
struct CustomReserved1 @0xaedffd8f31e7b55d {
diff --git a/cereal/log.capnp b/cereal/log.capnp
index 1209f3fd9..b189f58b6 100644
--- a/cereal/log.capnp
+++ b/cereal/log.capnp
@@ -2558,14 +2558,14 @@ struct Event {
# DO change the name of the field
# DON'T change anything after the "@"
- customReservedRawData0 @124 :Data;
+ rawCanData @124 :Data;
customReservedRawData1 @125 :Data;
customReservedRawData2 @126 :Data;
# DO change the name of the field and struct
# DON'T change the ID (e.g. @107)
# DON'T change which struct it points to
- customReserved0 @107 :Custom.CustomReserved0;
+ steeringInfo @107 :Custom.SteeringInfo;
customReserved1 @108 :Custom.CustomReserved1;
customReserved2 @109 :Custom.CustomReserved2;
customReserved3 @110 :Custom.CustomReserved3;
```
---
Example
---
```python
+3 -47
View File
@@ -7,9 +7,7 @@ $Cxx.namespace("cereal");
# These structs are guaranteed to remain reserved and empty in mainline
# cereal, so use these if you want custom events in your fork.
# DO rename the structs
# DON'T change the identifier (e.g. @0x81c2f05a394cf4af)
# you can rename the struct, but don't change the identifier
struct SelfdriveStateSP @0x81c2f05a394cf4af {
mads @0 :ModularAssistiveDrivingSystem;
@@ -66,7 +64,7 @@ struct ModelManagerSP @0xaedffd8f31e7b55d {
progress @1 :Float32;
eta @2 :UInt32;
}
enum Runner {
snpe @0;
tinygrad @1;
@@ -84,19 +82,7 @@ struct ModelManagerSP @0xaedffd8f31e7b55d {
}
}
struct LongitudinalPlanSP @0xf35cc4560bbf6ec2 {
dec @0 :DynamicExperimentalControl;
struct DynamicExperimentalControl {
state @0 :DynamicExperimentalControlState;
enabled @1 :Bool;
active @2 :Bool;
enum DynamicExperimentalControlState {
acc @0;
blended @1;
}
}
struct CustomReserved2 @0xf35cc4560bbf6ec2 {
}
struct CustomReserved3 @0xda96579883444c35 {
@@ -119,33 +105,3 @@ struct CustomReserved8 @0xf416ec09499d9d19 {
struct CustomReserved9 @0xa1680744031fdb2d {
}
struct CustomReserved10 @0xcb9fd56c7057593a {
}
struct CustomReserved11 @0xc2243c65e0340384 {
}
struct CustomReserved12 @0x9ccdc8676701b412 {
}
struct CustomReserved13 @0xcd96dafb67a082d0 {
}
struct CustomReserved14 @0xb057204d7deadf3f {
}
struct CustomReserved15 @0xbd443b539493bc68 {
}
struct CustomReserved16 @0xfc6241ed8877b611 {
}
struct CustomReserved17 @0xa30662f84033036c {
}
struct CustomReserved18 @0xc86a3d38d13eb3ef {
}
struct CustomReserved19 @0xa4f1eb3323f5f582 {
}
+2 -18
View File
@@ -2629,20 +2629,14 @@ struct Event {
livestreamWideRoadEncodeData @121 :EncodeData;
livestreamDriverEncodeData @122 :EncodeData;
# *********** Custom: reserved for forks ***********
# DO change the name of the field
# DON'T change anything after the "@"
customReservedRawData0 @124 :Data;
customReservedRawData1 @125 :Data;
customReservedRawData2 @126 :Data;
# DO change the name of the field and struct
# DON'T change the ID (e.g. @107)
# DON'T change which struct it points to
# *********** Custom: reserved for forks ***********
selfdriveStateSP @107 :Custom.SelfdriveStateSP;
modelManagerSP @108 :Custom.ModelManagerSP;
longitudinalPlanSP @109 :Custom.LongitudinalPlanSP;
customReserved2 @109 :Custom.CustomReserved2;
customReserved3 @110 :Custom.CustomReserved3;
customReserved4 @111 :Custom.CustomReserved4;
customReserved5 @112 :Custom.CustomReserved5;
@@ -2650,16 +2644,6 @@ struct Event {
customReserved7 @114 :Custom.CustomReserved7;
customReserved8 @115 :Custom.CustomReserved8;
customReserved9 @116 :Custom.CustomReserved9;
customReserved10 @136 :Custom.CustomReserved10;
customReserved11 @137 :Custom.CustomReserved11;
customReserved12 @138 :Custom.CustomReserved12;
customReserved13 @139 :Custom.CustomReserved13;
customReserved14 @140 :Custom.CustomReserved14;
customReserved15 @141 :Custom.CustomReserved15;
customReserved16 @142 :Custom.CustomReserved16;
customReserved17 @143 :Custom.CustomReserved17;
customReserved18 @144 :Custom.CustomReserved18;
customReserved19 @145 :Custom.CustomReserved19;
# *********** legacy + deprecated ***********
model @9 :Legacy.ModelData; # TODO: rename modelV2 and mark this as deprecated
-1
View File
@@ -77,7 +77,6 @@ _services: dict[str, tuple] = {
# sunnypilot
"modelManagerSP": (False, 1., 1),
"selfdriveStateSP": (True, 100., 10),
"longitudinalPlanSP": (True, 20., 10),
# debug
"uiDebug": (True, 0., 1),
-2
View File
@@ -229,8 +229,6 @@ std::unordered_map<std::string, uint32_t> keys = {
{"HyundaiRadarTracksConfirmed", PERSISTENT},
{"HyundaiRadarTracksPersistent", PERSISTENT},
{"HyundaiRadarTracksToggle", PERSISTENT},
{"DynamicExperimentalControl", PERSISTENT},
};
} // namespace
-13
View File
@@ -294,17 +294,4 @@ std::string check_output(const std::string& command) {
return result;
}
bool system_time_valid() {
// Default to August 26, 2024
tm min_tm = {.tm_year = 2024 - 1900, .tm_mon = 7, .tm_mday = 26};
time_t min_date = mktime(&min_tm);
struct stat st;
if (stat("/lib/systemd/systemd", &st) == 0) {
min_date = std::max(min_date, st.st_mtime + 86400); // Add 1 day (86400 seconds)
}
return time(nullptr) > min_date;
}
} // namespace util
-2
View File
@@ -96,8 +96,6 @@ bool create_directories(const std::string &dir, mode_t mode);
std::string check_output(const std::string& command);
bool system_time_valid();
inline void sleep_for(const int milliseconds) {
if (milliseconds > 0) {
std::this_thread::sleep_for(std::chrono::milliseconds(milliseconds));
+1 -1
Submodule panda updated: d3252abcc4...96632fa921
+1 -1
View File
@@ -191,7 +191,7 @@ class CarSpecificEvents:
events.add(EventName.speedTooHigh)
if CS.cruiseState.nonAdaptive:
events.add(EventName.wrongCruiseMode)
if CS.brakeHoldActive and self.CP.openpilotLongitudinalControl:
if CS.brakeHoldActive and self.CP.openpilotLongitudinalControl and self.CP.carName != 'toyota':
events.add(EventName.brakeHold)
if CS.parkingBrake:
events.add(EventName.parkBrake)
+4 -23
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 import interfaces
from openpilot.sunnypilot.selfdrive.car.interfaces import setup_car_interface_sp, initialize_car_interface_sp
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)
interfaces.setup_car_interface_sp(self.CI.CP, self.params)
setup_car_interface_sp(self.CI.CP, self.params)
self.RI = get_radar_interface(self.CI.CP)
self.CP = self.CI.CP
@@ -122,9 +122,6 @@ class Car:
MadsParams().set_alternative_experience(self.CP)
MadsParams().set_car_specific_params(self.CP)
# Dynamic Experimental Control
self.dynamic_experimental_control = self.params.get_bool("DynamicExperimentalControl")
openpilot_enabled_toggle = self.params.get_bool("OpenpilotEnabledToggle")
controller_available = self.CI.CC is not None and openpilot_enabled_toggle and not self.CP.dashcamOnly
@@ -136,15 +133,6 @@ class Car:
self.CP.safetyConfigs = [safety_config]
if self.CP.secOcRequired and not self.params.get_bool("IsReleaseBranch"):
# Copy user key if available
try:
with open("/cache/params/SecOCKey") as f:
user_key = f.readline().strip()
if len(user_key) == 32:
self.params.put("SecOCKey", user_key)
except Exception:
pass
secoc_key = self.params.get("SecOCKey", encoding='utf8')
if secoc_key is not None:
saved_secoc_key = bytes.fromhex(secoc_key.strip())
@@ -176,9 +164,6 @@ 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"""
@@ -207,7 +192,7 @@ class Car:
self.v_cruise_helper.update_v_cruise(CS, self.sm['carControl'].enabled, self.is_metric)
if self.sm['carControl'].enabled and not self.CC_prev.enabled:
# Use CarState w/ buttons from the step selfdrived enables on
self.v_cruise_helper.initialize_v_cruise(self.CS_prev, self.experimental_mode, self.dynamic_experimental_control)
self.v_cruise_helper.initialize_v_cruise(self.CS_prev, self.experimental_mode)
# TODO: mirror the carState.cruiseState struct?
CS.vCruise = float(self.v_cruise_helper.v_cruise_kph)
@@ -252,7 +237,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)
interfaces.initialize_car_interface_sp(self.CP, self.params, *self.can_callbacks)
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)
@@ -281,10 +266,6 @@ class Car:
while not evt.is_set():
self.is_metric = self.params.get_bool("IsMetric")
self.experimental_mode = self.params.get_bool("ExperimentalMode") and self.CP.openpilotLongitudinalControl
# sunnypilot
self.dynamic_experimental_control = self.params.get_bool("DynamicExperimentalControl")
time.sleep(0.1)
def card_thread(self):
+2 -3
View File
@@ -120,13 +120,12 @@ class VCruiseHelper:
self.button_timers[b.type.raw] = 1 if b.pressed else 0
self.button_change_states[b.type.raw] = {"standstill": CS.cruiseState.standstill, "enabled": enabled}
def initialize_v_cruise(self, CS, experimental_mode: bool, dynamic_experimental_control: bool) -> None:
def initialize_v_cruise(self, CS, experimental_mode: bool) -> None:
# initializing is handled by the PCM
if self.CP.pcmCruise:
return
initial_experimental_mode = experimental_mode and not dynamic_experimental_control
initial = V_CRUISE_INITIAL_EXPERIMENTAL_MODE if initial_experimental_mode else V_CRUISE_INITIAL
initial = V_CRUISE_INITIAL_EXPERIMENTAL_MODE if experimental_mode else V_CRUISE_INITIAL
if any(b.type in (ButtonType.accelCruise, ButtonType.resumeCruise) for b in CS.buttonEvents) and self.v_cruise_initialized:
self.v_cruise_kph = self.v_cruise_kph_last
+12 -13
View File
@@ -57,16 +57,16 @@ class TestVCruiseHelper:
for _ in range(2):
self.v_cruise_helper.update_v_cruise(car.CarState(cruiseState={"available": False}), enabled=False, is_metric=False)
def enable(self, v_ego, experimental_mode, dynamic_experimental_control):
def enable(self, v_ego, experimental_mode):
# Simulates user pressing set with a current speed
self.v_cruise_helper.initialize_v_cruise(car.CarState(vEgo=v_ego), experimental_mode, dynamic_experimental_control)
self.v_cruise_helper.initialize_v_cruise(car.CarState(vEgo=v_ego), experimental_mode)
def test_adjust_speed(self):
"""
Asserts speed changes on falling edges of buttons.
"""
self.enable(V_CRUISE_INITIAL * CV.KPH_TO_MS, False, False)
self.enable(V_CRUISE_INITIAL * CV.KPH_TO_MS, False)
for btn in (ButtonType.accelCruise, ButtonType.decelCruise):
for pressed in (True, False):
@@ -90,7 +90,7 @@ class TestVCruiseHelper:
CS.buttonEvents = [ButtonEvent(type=ButtonType.decelCruise, pressed=pressed)]
self.v_cruise_helper.update_v_cruise(CS, enabled=enabled, is_metric=False)
if pressed:
self.enable(V_CRUISE_INITIAL * CV.KPH_TO_MS, False, False)
self.enable(V_CRUISE_INITIAL * CV.KPH_TO_MS, False)
# Expected diff on enabling. Speed should not change on falling edge of pressed
assert not pressed == self.v_cruise_helper.v_cruise_kph == self.v_cruise_helper.v_cruise_kph_last
@@ -100,7 +100,7 @@ class TestVCruiseHelper:
Asserts we don't increment set speed if user presses resume/accel to exit cruise standstill.
"""
self.enable(0, False, False)
self.enable(0, False)
for standstill in (True, False):
for pressed in (True, False):
@@ -120,7 +120,7 @@ class TestVCruiseHelper:
for v_ego in np.linspace(0, 100, 101):
self.reset_cruise_speed_state()
self.enable(V_CRUISE_INITIAL * CV.KPH_TO_MS, False, False)
self.enable(V_CRUISE_INITIAL * CV.KPH_TO_MS, False)
# first decrement speed, then perform gas pressed logic
expected_v_cruise_kph = self.v_cruise_helper.v_cruise_kph - IMPERIAL_INCREMENT
@@ -142,11 +142,10 @@ class TestVCruiseHelper:
"""
for experimental_mode in (True, False):
for dynamic_experimental_control in (True, False):
for v_ego in np.linspace(0, 100, 101):
self.reset_cruise_speed_state()
assert not self.v_cruise_helper.v_cruise_initialized
for v_ego in np.linspace(0, 100, 101):
self.reset_cruise_speed_state()
assert not self.v_cruise_helper.v_cruise_initialized
self.enable(float(v_ego), experimental_mode, dynamic_experimental_control)
assert V_CRUISE_INITIAL <= self.v_cruise_helper.v_cruise_kph <= V_CRUISE_MAX
assert self.v_cruise_helper.v_cruise_initialized
self.enable(float(v_ego), experimental_mode)
assert V_CRUISE_INITIAL <= self.v_cruise_helper.v_cruise_kph <= V_CRUISE_MAX
assert self.v_cruise_helper.v_cruise_initialized
@@ -15,8 +15,6 @@ from openpilot.selfdrive.controls.lib.drive_helpers import CONTROL_N, get_speed_
from openpilot.selfdrive.car.cruise import V_CRUISE_MAX, V_CRUISE_UNSET
from openpilot.common.swaglog import cloudlog
from openpilot.sunnypilot.selfdrive.controls.lib.longitudinal_planner import LongitudinalPlannerSP
LON_MPC_STEP = 0.2 # first step is 0.2s
A_CRUISE_MIN = -1.2
A_CRUISE_MAX_VALS = [1.6, 1.2, 0.8, 0.6]
@@ -68,11 +66,10 @@ def get_accel_from_plan(speeds, accels, action_t=DT_MDL, vEgoStopping=0.05):
return a_target, should_stop
class LongitudinalPlanner(LongitudinalPlannerSP):
class LongitudinalPlanner:
def __init__(self, CP, init_v=0.0, init_a=0.0, dt=DT_MDL):
self.CP = CP
self.mpc = LongitudinalMpc(dt=dt)
LongitudinalPlannerSP.__init__(self, self.CP, self.mpc)
self.fcw = False
self.dt = dt
self.allow_throttle = True
@@ -107,10 +104,7 @@ class LongitudinalPlanner(LongitudinalPlannerSP):
return x, v, a, j, throttle_prob
def update(self, sm):
LongitudinalPlannerSP.update(self, sm)
self.mpc.mode = 'blended' if sm['selfdriveState'].experimentalMode else 'acc'
if dec_mpc_mode := self.get_mpc_mode():
self.mpc.mode = dec_mpc_mode
if len(sm['carControl'].orientationNED) == 3:
accel_coast = get_coast_accel(sm['carControl'].orientationNED[1])
@@ -211,5 +205,3 @@ class LongitudinalPlanner(LongitudinalPlannerSP):
longitudinalPlan.allowThrottle = bool(self.allow_throttle)
pm.send('longitudinalPlan', plan_send)
self.publish_longitudinal_plan_sp(sm, pm)
+1 -1
View File
@@ -18,7 +18,7 @@ def main():
ldw = LaneDepartureWarning()
longitudinal_planner = LongitudinalPlanner(CP)
pm = messaging.PubMaster(['longitudinalPlan', 'driverAssistance', 'longitudinalPlanSP'])
pm = messaging.PubMaster(['longitudinalPlan', 'driverAssistance'])
sm = messaging.SubMaster(['carControl', 'carState', 'controlsState', 'liveParameters', 'radarState', 'modelV2', 'selfdriveState'],
poll='modelV2', ignore_avg_freq=['radarState'])
+2 -5
View File
@@ -652,11 +652,8 @@ EVENTS: dict[int, dict[str, Alert | AlertCallbackType]] = {
},
EventName.brakeHold: {
ET.WARNING: Alert(
"Press Resume to Exit Brake Hold",
"",
AlertStatus.userPrompt, AlertSize.small,
Priority.LOW, VisualAlert.none, AudibleAlert.none, .2),
ET.USER_DISABLE: EngagementAlert(AudibleAlert.disengage),
ET.NO_ENTRY: NoEntryAlert("Brake Hold Active"),
},
EventName.parkBrake: {
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6e1555145a4482e4148c2e7a5cdbf370720a3cf684f18686a50bf25de0b55650
size 356302
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:eb4235545588e617a82d698721503bdd048a5858da9d60b9b90eeecc8c969498
size 356186
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0720a28167410da8dc5aa940f9ff916dcd3e1863ba4fb5b91c73ddf8c7e10c6c
size 256451
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c02a2432cb761440b9b5a0e432a13f05f5b03b9890bc5fe99f6c533be4f459f1
size 256426
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:221caa376d9052d375dc82225f6c6f894fa684f4be2f387bf2cf46927ed3cd15
size 332404
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:58c05f3c0b39e0525a586598982923b13e9b54c5ec9f41f87d88156552374a71
size 332428
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d02a7e8de6fcc2f0d2c8371116d9acef752e53f3a0c701f89a8c12927c666678
size 268879
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d66335e9f34ac3baff73188c5042e2292c42979d9c6769a7953ecd17dc9e3956
size 268874
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b17cefe94984aa855dc21f63afabf3514619cc0b4dc5eafc9c3f3594577a655c
size 435709
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:fc70028fe66f0292f208dc4449e9f1291f5b28a8c44ebf8076f24b690364d256
size 435674
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:333ea99fc2d88f0ec405f2ea5f1d86881a5879dc77ceee14700da1063a1319ac
size 308602
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:11025e5a2cc0c21c3525dd002b4834db18006016a606b7ad83e7ec2c2aa8d710
size 308599
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:426f453cd17daaa3db48d98a8e2a34f7f113b91bdfe3da2dbe6d8c13c72f37f6
size 392249
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:177c3c81df0a10f4e56122196ecfc2ebc807491171b405f7caa4f62363856c7a
size 393110
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:88e0d29b9a909c9cb97e47f62e0b42bb5761ac65d6836eb4d415982954df28f0
size 334267
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d35c3b33f528bfcd9f15b53a41031c37d47739604b4b6f721670af44df901280
size 334227
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:77a887290be2730ba5b3d558de4a7c72598c3a20372038f5c9de08b57a84c33b
size 470504
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:572a2b5a4ea929451b3f6aaa8786029f198eb3f3d823ba72e579a791fd0c8af8
size 470462
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6e152e4ffbfb1fa9cfaf3971859ea47ca5815735a3c391dc9b8c6e233a26658d
size 260279
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e55efae47740ead32d95e4d1c677ce07f95441c5cfea72a80c7f2a5cda996633
size 260412
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:03aa9d65b2da189437de176269c698deb3fecd6167e958caf3530737cf15a431
size 217479
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3b1ed44ae652a3eeb4786c989219e2fd09e0755b5003ca53ba1c0ec01cd7d8c0
size 217471
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:bd67adc5e5ea3353ef7cdd306b2e3b0f1b02862739ef3e313f0e4a20372c696a
size 293071
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:05249897ed80e89bfecd69f3719ce6e58112994718d0e0a02b0cd1003beab761
size 293036
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:70fe8b2843fb4721d72e9c7fc524825b067e0b550afec181b636ef329687fc4a
size 260872
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:4b1514a19e37f8bcf252380a258633f2496f1c038cc3411aff10bbc934a0ae0e
size 260925
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e5142666f3f837848db872917bd344b05209ddab82c2671a75b13682b709a9f8
size 100116
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c97c909cce68a14b255c91d7dac8cd29aa4e73537d0b4ca4dddd1954471713bb
size 100071
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2808066b4828ae0591957ab3b5ea654843c5a6f3051a0b734e0869dd903f82dc
size 262864
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f3b0432ded38813b7bc9ea00e9c48eb4d35d05cb459b6a574a18079ad19c45f0
size 262901
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:cb2755f77239c319a9528b00fb17f1696c67085b825e2d08cbbe8d47545316cd
size 258556
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d2e934ace7fa186b1989f25cf29c40aaad1a1a1a0a469f298c93c0533c3b44d9
size 259272
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:4643cd4e30aec5e5256f6da72748f959310f99ba763bbbf6981f077c64391327
size 268090
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e1889b550401eea6817f397bcce895660710d4d8d81ba715ba48f203ed0152b6
size 268159
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c4a4a300062f80c37686b58ee1382569dcf8e51be523a67d0134e9de8660f8ab
size 305130
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ca312b930dce74d532f8630f4dffa1e8e3596cc9a33e83f655c3c7f823d19a06
size 305087
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a3b26b9065a9f9f8afeea2f5e754e7b4443d234bedfa1752cd30bfecdf864878
size 255666
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:dbd2ec6c65fdf73eeb0b372f34b59969125d5ee6bc2f6c6fa477ca567d96ed81
size 255744

Some files were not shown because too many files have changed in this diff Show More