Compare commits

...

117 Commits

Author SHA1 Message Date
DevTekVE
10124e8e4e Merge branch 'master-new-ESCC' into mads-new-rework
# Conflicts:
#	panda
2024-11-15 19:53:03 +01:00
DevTekVE
1039cac2fd Refactor ACC command parameters order
Rearrange parameters in the `create_acc_commands` function to prioritize `CS.main_cruise_enabled` over `self.ESCC`. This change aligns with the desired order of priorities and improves readability.
2024-11-15 19:50:31 +01:00
DevTekVE
1700f6cdb0 Refactor type hinting for CarState in update method
Changed the type hinting of the CS parameter from structs.CarState to CarState in the update method. This aligns the code with the current naming conventions and improves readability.
2024-11-15 19:50:31 +01:00
DevTekVE
747db17aa1 Refactor spFlags to safetyParam2DEPRECATED
Updated Hyundai car state and interface files to use `sunnyParams.flags` instead of `spFlags` for consistency. This included changes in the conditional checks and flag assignments. The car.capnp struct was also modified to rename `spFlags` to `safetyParam2DEPRECATED`.
2024-11-15 19:50:30 +01:00
DevTekVE
9be2f5628d Remove MADS components and migrate to Opendbc repo
The Modular Assistive Driving System (MADS) related files and tests have been removed from the sunnypilot directory. MADS functionality has been migrated to the opendbc repository, streamlining its structure and integration.
2024-11-15 19:50:30 +01:00
Jason Wen
60d6e7efce fix panda safety 2024-11-15 12:19:16 -05:00
Jason Wen
ba11b97c59 Rename 2024-11-15 12:03:28 -05:00
Jason Wen
aaf35b391e check if engagement is from openpilot's state machine 2024-11-15 11:45:11 -05:00
Jason Wen
a3c9d72a1e not needed 2024-11-15 11:40:18 -05:00
Jason Wen
6fa78b1db4 more fix 2024-11-15 11:39:13 -05:00
Jason Wen
8f0639ca6c combine 2024-11-15 11:34:01 -05:00
Jason Wen
6a0bc76e63 fix 2024-11-15 11:32:15 -05:00
Jason Wen
23e27bea92 make sure to disengage for allow always cars 2024-11-15 11:29:38 -05:00
Jason Wen
3be1fde36b Fix? 2024-11-15 09:01:12 -05:00
Jason Wen
473349e7b7 rename 2024-11-15 07:32:33 -05:00
Jason Wen
71ffd05027 fix 2024-11-15 07:31:41 -05:00
Jason Wen
ab8547d04b bump opendbc 2024-11-15 07:17:21 -05:00
Jason Wen
74eacd2d44 apply pause/resume fix for hyundai (should do this in a separate PR) 2024-11-15 07:17:11 -05:00
Jason Wen
6a059c6877 bump panda 2024-11-15 07:10:14 -05:00
DevTekVE
eb9b9a13ff Merge remote-tracking branch 'origin/master-new' into mads-new
# Conflicts:
#	panda
#	selfdrive/ui/qt/offroad/developer_panel.cc
2024-11-15 09:32:22 +01:00
DevTekVE
1d4da71784 bump opendbc 2024-11-15 09:30:50 +01:00
DevTekVE
094b856509 Sync up submodules for ESCC 2024-11-15 08:27:27 +01:00
Jason Wen
82510dc48c allow re-regage 2024-11-14 23:41:19 -05:00
Jason Wen
5c6750b2ad bump opendbc 2024-11-14 23:34:07 -05:00
Jason Wen
a13e5816bb enforce main 2024-11-14 23:34:02 -05:00
Jason Wen
e1b2b10638 add logging for controls allowed lateral 2024-11-14 23:09:11 -05:00
Jason Wen
58fb1b44b6 hyundai: main button heartbeat 2024-11-14 22:29:38 -05:00
Jason Wen
d78e66deef hyundai: main button handling 2024-11-14 21:46:47 -05:00
Jason Wen
4b1920ecce handle non drive gear events 2024-11-14 20:24:36 -05:00
Jason Wen
dc45bda8b8 no longer needed 2024-11-14 20:00:20 -05:00
Jason Wen
b824810be2 bump panda 2024-11-14 20:00:06 -05:00
Jason Wen
08962ad619 hkg always allow 2024-11-14 19:59:52 -05:00
Jason Wen
652a24f13e only allow lateral when cruise main or state is on 2024-11-14 17:19:23 -05:00
Jason Wen
ca92ffcb57 rename 2024-11-14 17:05:35 -05:00
Jason Wen
80ebb43365 simply checks 2024-11-14 16:59:56 -05:00
Jason Wen
23f417f450 properly 2024-11-13 23:40:44 -05:00
Jason Wen
e63ad5a011 handle available better 2024-11-13 22:44:22 -05:00
Jason Wen
b8a82755e6 support toyota and ford 2024-11-13 20:57:38 -05:00
Jason Wen
70e7747f74 cruise main engage 2024-11-13 20:55:14 -05:00
Jason Wen
de1b084902 enforce cruise main disengage 2024-11-13 20:39:47 -05:00
Jason Wen
097c976a49 Make sure to disengage with long engaged 2024-11-13 20:21:41 -05:00
Jason Wen
5efd1d63bb Unified Engagement Mode: more 2024-11-13 20:15:02 -05:00
Jason Wen
fa3ce0e2a3 add TODO 2024-11-13 20:06:00 -05:00
Jason Wen
835cb71e3b refactor mads params read 2024-11-13 20:04:40 -05:00
Jason Wen
4603fd0f03 Unified Engagement Mode: init 2024-11-13 19:59:19 -05:00
Jason Wen
7f2660d0ad only when mads toggle is enabled 2024-11-13 19:47:51 -05:00
Jason Wen
aa0f588248 change events 2024-11-13 19:42:05 -05:00
Jason Wen
e3e65de225 add lkas enable and disable events 2024-11-13 19:26:22 -05:00
Jason Wen
37b461a591 unused 2024-11-13 16:57:26 -05:00
Jason Wen
2f09489746 enable should carry over from selfdrived 2024-11-13 13:33:00 -05:00
Jason Wen
a9c1e7e277 Expose in settings 2024-11-13 13:25:55 -05:00
Jason Wen
ca0020e613 should be the whole class 2024-11-13 13:12:24 -05:00
Jason Wen
5326b18130 set alt experience in helpers 2024-11-13 13:12:18 -05:00
Jason Wen
c99299af1f no longer needed 2024-11-13 12:56:42 -05:00
Jason Wen
9422a3cf47 implement params 2024-11-13 12:54:02 -05:00
Jason Wen
872abdda17 this is checked after selfdrived states 2024-11-13 11:16:42 -05:00
Jason Wen
1c2e9bd5b1 inherit in carcontroller properly 2024-11-13 03:07:29 -05:00
Jason Wen
70cf693d15 bump panda 2024-11-13 02:38:25 -05:00
Jason Wen
06dc945b09 consolidate 2024-11-13 02:18:29 -05:00
Jason Wen
8fc21127bd use old copy as checks 2024-11-13 02:15:44 -05:00
Jason Wen
eecffb9c8a should be here 2024-11-13 02:08:17 -05:00
Jason Wen
71eb28e1d8 Revert "update in method"
This reverts commit 0403a48e88.
2024-11-13 01:21:12 -05:00
Jason Wen
e605398f55 Revert "reorder"
This reverts commit 1a988c716d.
2024-11-13 01:21:12 -05:00
Jason Wen
1a988c716d reorder 2024-11-13 01:18:51 -05:00
Jason Wen
0403a48e88 update in method 2024-11-13 01:15:22 -05:00
Jason Wen
d9fb57e5f8 Revert "do it prior"
This reverts commit b38798c1a5.
2024-11-13 00:58:37 -05:00
Jason Wen
b38798c1a5 do it prior 2024-11-13 00:00:08 -05:00
Jason Wen
555a753f4c brake check was not handled 2024-11-12 22:52:05 -05:00
Jason Wen
8485cd2013 make sure it's either or 2024-11-12 22:00:44 -05:00
Jason Wen
0fa1ff07f5 try this out 2024-11-12 19:58:22 -05:00
Jason Wen
d2cbdeb683 take them out for all modes 2024-11-12 19:14:37 -05:00
Jason Wen
7c633afe7e skip pedal pressed for MADS 2024-11-12 17:53:50 -05:00
Jason Wen
e5a34e9023 add always available for hyundai 2024-11-12 17:53:25 -05:00
Jason Wen
81708364b8 new logic 2024-11-12 16:15:27 -05:00
Jason Wen
e0e940dd55 do this 2024-11-12 09:17:21 -05:00
Jason Wen
c0b92dee04 more fixes 2024-11-11 22:17:11 -05:00
Jason Wen
249e7c2fa2 fixes 2024-11-11 20:46:56 -05:00
Jason Wen
fae91beaae better 2024-11-11 20:38:10 -05:00
Jason Wen
376cbbdf83 missed 2024-11-11 20:28:00 -05:00
Jason Wen
b497bc607f reset as it should 2024-11-11 09:46:47 -05:00
Jason Wen
90a1ff46b4 Merge branch 'master-new' into mads-new
# Conflicts:
#	cereal/car.capnp
#	cereal/car.capnp~HEAD
#	opendbc_repo
#	panda
2024-11-11 08:23:13 -05:00
DevTekVE
c05191949a Updating submodules 2024-11-02 19:15:58 +01:00
Jason Wen
9d5ea83f5a Add Custom MIT License (#438) 2024-11-02 18:53:31 +01:00
Jason Wen
6a74dc253b typo! 2024-09-30 22:47:24 -04:00
Jason Wen
434a89d83e move to card 2024-09-30 18:51:36 -04:00
Jason Wen
20e6dc4246 hkg dbc 2024-09-30 17:03:50 -04:00
Jason Wen
96b5b7caeb more fix 2024-09-30 16:58:25 -04:00
Jason Wen
85cdce477e fix typo 2024-09-30 16:42:59 -04:00
Jason Wen
cc06b0271c fix typo 2024-09-30 16:40:13 -04:00
Jason Wen
e67833ae7d add events 2024-09-30 16:37:11 -04:00
Jason Wen
42e3061748 Merge branch 'master' into mads-new 2024-09-30 16:31:52 -04:00
Jason Wen
738484e628 some cleanup 2024-09-30 16:28:18 -04:00
Jason Wen
519ab8ec3e traditional state machine with tests 2024-09-30 16:18:59 -04:00
Jason Wen
00bc34b125 test 2024-09-30 15:33:44 -04:00
Jason Wen
ff87abb45b comments 2024-09-30 11:04:56 -04:00
Jason Wen
000bb1b5b3 explicit 2024-09-30 10:56:30 -04:00
Jason Wen
7c95b43e1a should append 2024-09-30 10:45:00 -04:00
Jason Wen
9570a9240f fix type hint 2024-09-30 10:42:57 -04:00
Jason Wen
676702ae3c fixes 2024-09-29 22:43:18 -04:00
Jason Wen
c27b112bbc misra 2024-09-29 12:27:50 -04:00
Jason Wen
0a1a878897 Merge branch 'master' into mads-new
# Conflicts:
#	opendbc_repo
#	panda
2024-09-29 12:11:54 -04:00
Jason Wen
3a593f85dc more 2024-09-29 12:00:46 -04:00
Jason Wen
6db0d94b83 cleanup 2024-09-29 11:58:38 -04:00
Jason Wen
66b900aea6 clearer 2024-09-29 11:55:36 -04:00
Jason Wen
9c57f6bad0 not really 2024-09-29 11:45:47 -04:00
Jason Wen
1b64a7debd move around 2024-09-29 11:30:39 -04:00
Jason Wen
bd19439a4c move around 2024-09-29 11:28:27 -04:00
Jason Wen
18a237c0c0 more update 2024-09-29 11:25:19 -04:00
Jason Wen
dd5ff7e1d3 fix 2024-09-29 11:20:30 -04:00
Jason Wen
515c00c379 fix 2024-09-20 00:01:41 -04:00
Jason Wen
7dc4073c9b safety init 2024-09-19 00:46:26 -04:00
Jason Wen
a9c775bffe no need 2024-09-18 09:01:13 -04:00
Jason Wen
c06d8db015 alternative experience 2024-09-18 08:57:58 -04:00
Jason Wen
8bb6c8fc17 some more infra 2024-09-18 08:22:13 -04:00
Jason Wen
d58be609ac more infra 2024-09-18 07:33:23 -04:00
Jason Wen
434fab00f3 more 2024-09-18 07:15:51 -04:00
Jason Wen
8e62914e69 Modified Assist Driving System: init 2024-09-18 07:15:51 -04:00
25 changed files with 370 additions and 10 deletions

View File

@@ -8,7 +8,23 @@ $Cxx.namespace("cereal");
# cereal, so use these if you want custom events in your fork.
# you can rename the struct, but don't change the identifier
struct CustomReserved0 @0x81c2f05a394cf4af {
struct SelfdriveStateSP @0x81c2f05a394cf4af {
mads @0 :ModularAssistiveDrivingSystem;
struct ModularAssistiveDrivingSystem {
state @0 :ModularAssistiveDrivingSystemState;
enabled @1 :Bool;
active @2 :Bool;
available @3 :Bool;
enum ModularAssistiveDrivingSystemState {
disabled @0;
paused @1;
enabled @2;
softDisabling @3;
overriding @4;
}
}
}
struct CustomReserved1 @0xaedffd8f31e7b55d {

View File

@@ -126,6 +126,17 @@ struct OnroadEvent @0xc4fa6047f024e718 {
personalityChanged @91;
aeb @92;
# sunnypilot
lkasEnable @93;
lkasDisable @94;
manualSteeringRequired @95;
manualLongitudinalRequired @96;
silentPedalPressed @97;
silentLkasEnable @98;
silentBrakeHold @99;
silentWrongGear @100;
silentReverseGear @101;
soundsUnavailableDEPRECATED @47;
}
}
@@ -586,6 +597,7 @@ struct PandaState @0xa7649e2575e4591e {
# safety stuff
controlsAllowed @3 :Bool;
controlsAllowedLat @5 :Bool;
safetyRxInvalid @19 :UInt32;
safetyTxBlocked @24 :UInt32;
safetyModel @14 :Car.CarParams.SafetyModel;
@@ -693,7 +705,6 @@ struct PandaState @0xa7649e2575e4591e {
}
gasInterceptorDetectedDEPRECATED @4 :Bool;
startedSignalDetectedDEPRECATED @5 :Bool;
hasGpsDEPRECATED @6 :Bool;
gmlanSendErrsDEPRECATED @9 :UInt32;
fanSpeedRpmDEPRECATED @11 :UInt16;
@@ -2544,7 +2555,7 @@ struct Event {
customReservedRawData2 @126 :Data;
# *********** Custom: reserved for forks ***********
customReserved0 @107 :Custom.CustomReserved0;
selfdriveStateSP @107 :Custom.SelfdriveStateSP;
customReserved1 @108 :Custom.CustomReserved1;
customReserved2 @109 :Custom.CustomReserved2;
customReserved3 @110 :Custom.CustomReserved3;

View File

@@ -73,6 +73,9 @@ _services: dict[str, tuple] = {
"userFlag": (True, 0., 1),
"microphone": (True, 10., 10),
# sunnypilot
"selfdriveStateSP": (True, 100., 10),
# debug
"uiDebug": (True, 0., 1),
"testJoystick": (True, 0.),

View File

@@ -201,6 +201,12 @@ std::unordered_map<std::string, uint32_t> keys = {
{"UpdaterTargetBranch", CLEAR_ON_MANAGER_START},
{"UpdaterLastFetchTime", PERSISTENT},
{"Version", PERSISTENT},
// sunnypilot params
{"Mads", PERSISTENT},
{"MadsCruiseMain", PERSISTENT},
{"MadsDisengageLateralOnBrake", PERSISTENT},
{"MadsUnifiedEngagementMode", PERSISTENT},
};
} // namespace

2
panda

Submodule panda updated: fdd7f946dc...1ae97c112e

View File

@@ -148,7 +148,8 @@ class CarSpecificEvents:
# To avoid re-engaging when openpilot cancels, check user engagement intention via buttons
# Main button also can trigger an engagement on these cars
self.cruise_buttons.append(any(ev.type in HYUNDAI_ENABLE_BUTTONS for ev in CS.buttonEvents))
events = self.create_common_events(CS, CS_prev, pcm_enable=self.CP.pcmCruise, allow_enable=any(self.cruise_buttons))
events = self.create_common_events(CS, CS_prev, pcm_enable=self.CP.pcmCruise, allow_enable=any(self.cruise_buttons),
allow_cancel=any(self.CP.pcmCruise and b.type == ButtonType.cancel and b.pressed for b in CS.buttonEvents) or not self.CP.pcmCruise)
# low speed steer alert hysteresis logic (only for cars with steer cut off above 10 m/s)
if CS.vEgo < (self.CP.minSteerSpeed + 2.) and self.CP.minSteerSpeed > 10.:
@@ -164,7 +165,8 @@ class CarSpecificEvents:
return events
def create_common_events(self, CS: structs.CarState, CS_prev: car.CarState, extra_gears=None, pcm_enable=True,
allow_enable=True, enable_buttons=(ButtonType.accelCruise, ButtonType.decelCruise)):
allow_enable=True, enable_buttons=(ButtonType.accelCruise, ButtonType.decelCruise),
allow_cancel=True):
events = Events()
if CS.doorOpen:
@@ -215,7 +217,7 @@ class CarSpecificEvents:
if not self.CP.pcmCruise and (b.type in enable_buttons and not b.pressed):
events.add(EventName.buttonEnable)
# Disable on rising and falling edge of cancel for both stock and OP long
if b.type == ButtonType.cancel:
if b.type == ButtonType.cancel and allow_cancel:
events.add(EventName.buttonCancel)
# Handle permanent and temporary steering faults

View File

@@ -22,6 +22,8 @@ from openpilot.selfdrive.pandad import can_capnp_to_list, can_list_to_can_capnp
from openpilot.selfdrive.car.cruise import VCruiseHelper
from openpilot.selfdrive.car.car_specific import MockCarState
from opendbc.sunnypilot.mads.mads import MadsParams
REPLAY = "REPLAY" in os.environ
EventName = log.OnroadEvent.EventName
@@ -113,6 +115,11 @@ class Car:
if not disengage_on_accelerator:
self.CP.alternativeExperience |= ALTERNATIVE_EXPERIENCE.DISABLE_DISENGAGE_ON_GAS
# mads
data_services = list(self.sm.data.keys()) + ['selfdriveStateSP']
self.sm = messaging.SubMaster(data_services, poll='selfdriveStateSP')
MadsParams().set_alternative_experience(self.CP, self.params)
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

View File

@@ -56,6 +56,9 @@ class Controls:
elif self.CP.lateralTuning.which() == 'torque':
self.LaC = LatControlTorque(self.CP, self.CI)
data_services = list(self.sm.data.keys()) + ['selfdriveStateSP']
self.sm = messaging.SubMaster(data_services, poll='selfdriveState')
def update(self):
self.sm.update(15)
if self.sm.updated["liveCalibration"]:
@@ -88,7 +91,12 @@ class Controls:
# Check which actuators can be enabled
standstill = abs(CS.vEgo) <= max(self.CP.minSteerSpeed, MIN_LATERAL_CONTROL_SPEED) or CS.standstill
CC.latActive = self.sm['selfdriveState'].active and not CS.steerFaultTemporary and not CS.steerFaultPermanent and not standstill
ss_sp = self.sm['selfdriveStateSP']
CC.madsActive = ss_sp.mads.available and ss_sp.mads.active
_lat_active = ss_sp.mads.enabled if ss_sp.mads.available else self.sm['selfdriveState'].active
CC.latActive = _lat_active and not CS.steerFaultTemporary and not CS.steerFaultPermanent and not standstill
CC.longActive = CC.enabled and not any(e.overrideLongitudinal for e in self.sm['onroadEvents']) and self.CP.openpilotLongitudinalControl
actuators = CC.actuators

View File

@@ -140,6 +140,7 @@ void fill_panda_state(cereal::PandaState::Builder &ps, cereal::PandaState::Panda
ps.setIgnitionLine(health.ignition_line_pkt);
ps.setIgnitionCan(health.ignition_can_pkt);
ps.setControlsAllowed(health.controls_allowed_pkt);
ps.setControlsAllowedLat(health.controls_allowed_lat_pkt);
ps.setTxBufferOverflow(health.tx_buffer_overflow_pkt);
ps.setRxBufferOverflow(health.rx_buffer_overflow_pkt);
ps.setPandaType(hw_type);

View File

@@ -105,6 +105,17 @@ class Events:
ret.append(event)
return ret
def has(self, event_name: int) -> bool:
return event_name in self.events
def remove(self, event_name: int, static: bool = False) -> None:
if static and event_name in self.static_events:
self.static_events.remove(event_name)
if event_name in self.events:
self.event_counters[event_name] = self.event_counters[event_name] + 1
self.events.remove(event_name)
class Alert:
def __init__(self,
@@ -951,6 +962,85 @@ EVENTS: dict[int, dict[str, Alert | AlertCallbackType]] = {
ET.WARNING: personality_changed_alert,
},
# sunnypilot
EventName.lkasEnable: {
ET.ENABLE: EngagementAlert(AudibleAlert.engage),
},
EventName.lkasDisable: {
ET.USER_DISABLE: EngagementAlert(AudibleAlert.disengage),
},
EventName.manualSteeringRequired: {
ET.USER_DISABLE: Alert(
"Automatic Lane Centering is OFF",
"Manual Steering Required",
AlertStatus.normal, AlertSize.mid,
Priority.LOW, VisualAlert.none, AudibleAlert.disengage, 1.),
},
EventName.manualLongitudinalRequired: {
ET.WARNING: Alert(
"Smart/Adaptive Cruise Control is OFF",
"Manual Gas/Brakes Required",
AlertStatus.normal, AlertSize.mid,
Priority.LOW, VisualAlert.none, AudibleAlert.none, 1.),
},
EventName.silentPedalPressed: {
ET.USER_DISABLE: Alert(
"",
"",
AlertStatus.normal, AlertSize.none,
Priority.MID, VisualAlert.none, AudibleAlert.none, .2),
ET.NO_ENTRY: NoEntryAlert("Pedal Pressed During Attempt",
visual_alert=VisualAlert.brakePressed),
},
EventName.silentLkasEnable: {
ET.ENABLE: Alert(
"",
"",
AlertStatus.normal, AlertSize.none,
Priority.MID, VisualAlert.none, AudibleAlert.none, .2, 0.),
},
EventName.silentBrakeHold: {
ET.USER_DISABLE: Alert(
"",
"",
AlertStatus.normal, AlertSize.none,
Priority.MID, VisualAlert.none, AudibleAlert.none, .2, 0.),
ET.NO_ENTRY: NoEntryAlert("Brake Hold Active"),
},
EventName.silentWrongGear: {
ET.USER_DISABLE: Alert(
"Gear not D",
"openpilot Unavailable",
AlertStatus.normal, AlertSize.mid,
Priority.LOW, VisualAlert.none, AudibleAlert.none, 0., 3.),
ET.NO_ENTRY: Alert(
"Gear not D",
"openpilot Unavailable",
AlertStatus.normal, AlertSize.mid,
Priority.LOW, VisualAlert.none, AudibleAlert.none, 0., 3.),
},
EventName.silentReverseGear: {
ET.PERMANENT: Alert(
"Reverse\nGear",
"",
AlertStatus.normal, AlertSize.full,
Priority.LOWEST, VisualAlert.none, AudibleAlert.none, .2, creation_delay=0.5),
ET.USER_DISABLE: Alert(
"Reverse\nGear",
"",
AlertStatus.normal, AlertSize.full,
Priority.LOWEST, VisualAlert.none, AudibleAlert.none, .2, creation_delay=0.5),
ET.NO_ENTRY: NoEntryAlert("Reverse Gear"),
},
}

View File

@@ -23,6 +23,8 @@ from openpilot.selfdrive.controls.lib.latcontrol import MIN_LATERAL_CONTROL_SPEE
from openpilot.system.version import get_build_metadata
from opendbc.sunnypilot.mads.mads import ModularAssistiveDrivingSystem
REPLAY = "REPLAY" in os.environ
SIMULATION = "SIMULATION" in os.environ
TESTING_CLOSET = "TESTING_CLOSET" in os.environ
@@ -131,6 +133,10 @@ class SelfdriveD:
elif self.CP.passive:
self.events.add(EventName.dashcamMode, static=True)
self.mads = ModularAssistiveDrivingSystem(self)
sock_services = list(self.pm.sock.keys()) + ['selfdriveStateSP']
self.pm = messaging.PubMaster(sock_services)
def update_events(self, CS):
"""Compute onroadEvents from carState"""
@@ -451,11 +457,24 @@ class SelfdriveD:
self.pm.send('onroadEvents', ce_send)
self.events_prev = self.events.names.copy()
# selfdriveStateSP
ss_sp_msg = messaging.new_message('selfdriveStateSP')
ss_sp_msg.valid = True
ss_sp = ss_sp_msg.selfdriveStateSP
mads = ss_sp.mads
mads.state = self.mads.state_machine.state
mads.enabled = self.mads.enabled
mads.active = self.mads.active
mads.available = self.mads.enabled_toggle
self.pm.send('selfdriveStateSP', ss_sp_msg)
def step(self):
CS = self.data_sample()
self.update_events(CS)
if not self.CP.passive and self.initialized:
self.enabled, self.active = self.state_machine.update(self.events)
self.mads.update(CS)
self.update_alerts(CS)
self.publish_selfdriveState(CS)

View File

@@ -49,6 +49,20 @@ void DeveloperPanel::updateToggles(bool _offroad) {
}
offroad = _offroad;
// FIXME-SP: Move to sunnypilot panels before merging
auto madsToggle = new ParamControl("Mads", tr("Modular Assistive Driving System (MADS)"), "", "");
addItem(madsToggle);
// TODO-SP: Rename toggle
auto madsCruiseMainToggle = new ParamControl("MadsCruiseMain", tr("MADS: Cruise Main"), "", "");
addItem(madsCruiseMainToggle);
auto madsDisengageLateralOnBrakeToggle = new ParamControl("MadsDisengageLateralOnBrake", tr("MADS: Disengage Lateral on Brake"), "", "");
addItem(madsDisengageLateralOnBrakeToggle);
auto madsUnifiedEngagementModeToggle = new ParamControl("MadsUnifiedEngagementMode", tr("MADS: Unified Engagement Mode"), "", "");
addItem(madsUnifiedEngagementModeToggle);
}
void DeveloperPanel::showEvent(QShowEvent *event) {

View File

@@ -123,6 +123,22 @@
<source>Longitudinal Maneuver Mode</source>
<translation>وضع المناورة الطولية</translation>
</message>
<message>
<source>MADS: Cruise Main</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>MADS: Disengage Lateral on Brake</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Modular Assistive Driving System (MADS)</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>MADS: Unified Engagement Mode</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>DevicePanel</name>

View File

@@ -123,6 +123,22 @@
<source>Longitudinal Maneuver Mode</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>MADS: Cruise Main</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>MADS: Disengage Lateral on Brake</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Modular Assistive Driving System (MADS)</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>MADS: Unified Engagement Mode</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>DevicePanel</name>

View File

@@ -123,6 +123,22 @@
<source>Longitudinal Maneuver Mode</source>
<translation>Modo de maniobra longitudinal</translation>
</message>
<message>
<source>MADS: Cruise Main</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>MADS: Disengage Lateral on Brake</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Modular Assistive Driving System (MADS)</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>MADS: Unified Engagement Mode</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>DevicePanel</name>

View File

@@ -123,6 +123,22 @@
<source>Longitudinal Maneuver Mode</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>MADS: Cruise Main</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>MADS: Disengage Lateral on Brake</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Modular Assistive Driving System (MADS)</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>MADS: Unified Engagement Mode</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>DevicePanel</name>

View File

@@ -123,6 +123,22 @@
<source>Longitudinal Maneuver Mode</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>MADS: Cruise Main</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>MADS: Disengage Lateral on Brake</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Modular Assistive Driving System (MADS)</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>MADS: Unified Engagement Mode</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>DevicePanel</name>

View File

@@ -123,6 +123,22 @@
<source>Longitudinal Maneuver Mode</source>
<translation> </translation>
</message>
<message>
<source>MADS: Cruise Main</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>MADS: Disengage Lateral on Brake</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Modular Assistive Driving System (MADS)</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>MADS: Unified Engagement Mode</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>DevicePanel</name>

View File

@@ -123,6 +123,22 @@
<source>Longitudinal Maneuver Mode</source>
<translation>Modo Longitudinal Maneuver</translation>
</message>
<message>
<source>MADS: Cruise Main</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>MADS: Disengage Lateral on Brake</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Modular Assistive Driving System (MADS)</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>MADS: Unified Engagement Mode</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>DevicePanel</name>

View File

@@ -123,6 +123,22 @@
<source>Longitudinal Maneuver Mode</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>MADS: Cruise Main</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>MADS: Disengage Lateral on Brake</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Modular Assistive Driving System (MADS)</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>MADS: Unified Engagement Mode</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>DevicePanel</name>

View File

@@ -123,6 +123,22 @@
<source>Longitudinal Maneuver Mode</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>MADS: Cruise Main</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>MADS: Disengage Lateral on Brake</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Modular Assistive Driving System (MADS)</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>MADS: Unified Engagement Mode</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>DevicePanel</name>

View File

@@ -123,6 +123,22 @@
<source>Longitudinal Maneuver Mode</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>MADS: Cruise Main</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>MADS: Disengage Lateral on Brake</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Modular Assistive Driving System (MADS)</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>MADS: Unified Engagement Mode</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>DevicePanel</name>

View File

@@ -123,6 +123,22 @@
<source>Longitudinal Maneuver Mode</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>MADS: Cruise Main</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>MADS: Disengage Lateral on Brake</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Modular Assistive Driving System (MADS)</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>MADS: Unified Engagement Mode</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>DevicePanel</name>

View File

@@ -42,11 +42,18 @@ def manager_init() -> None:
("LongitudinalPersonality", str(log.LongitudinalPersonality.standard)),
]
sunnypilot_default_params: list[tuple[str, str | bytes]] = [
("Mads", "1"),
("MadsCruiseMain", "1"),
("MadsDisengageLateralOnBrake", "0"),
("MadsUnifiedEngagementMode", "1"),
]
if params.get_bool("RecordFrontLock"):
params.put_bool("RecordFront", True)
# set unset params
for k, v in default_params:
for k, v in (default_params + sunnypilot_default_params):
if params.get(k) is None:
params.put(k, v)