pull/23977/merge
Shane Smiskol 2022-03-25 19:04:39 -07:00 committed by GitHub
commit ef69b62ec9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 29 additions and 11 deletions

View File

@ -22,7 +22,7 @@ Following Hazard and Risk Analysis and FMEA, at a very high level, we have desig
ensuring two main safety requirements.
1. The driver must always be capable to immediately retake manual control of the vehicle,
by stepping on either pedal or by pressing the cancel button.
by stepping on the brake pedal or by pressing the cancel button.
2. The vehicle must not alter its trajectory too quickly for the driver to safely
react. This means that while the system is engaged, the actuators are constrained
to operate within reasonable limits.

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

@ -98,6 +98,7 @@ std::unordered_map<std::string, uint32_t> keys = {
{"DisableRadar_Allow", PERSISTENT},
{"DisableRadar", PERSISTENT}, // WARNING: THIS DISABLES AEB
{"DisableUpdates", PERSISTENT},
{"DisengageOnAccelerator", PERSISTENT},
{"DongleId", PERSISTENT},
{"DoReboot", CLEAR_ON_MANAGER_START},
{"DoShutdown", CLEAR_ON_MANAGER_START},

View File

@ -94,7 +94,10 @@ class Controls:
get_one_can(self.can_sock)
self.CI, self.CP = get_car(self.can_sock, self.pm.sock['sendcan'])
self.CP.alternativeExperience = 0 # see panda/board/safety_declarations.h for allowed values
# see panda/board/safety_declarations.h for allowed values
self.disengage_on_accelerator = Params().get_bool("DisengageOnAccelerator")
self.CP.alternativeExperience = 1 if not self.disengage_on_accelerator else 0
# read params
self.is_metric = params.get_bool("IsMetric")
@ -194,9 +197,9 @@ class Controls:
self.events.add(EventName.controlsInitializing)
return
# Disable on rising edge of gas or brake. Also disable on brake when speed > 0
if (CS.gasPressed and not self.CS_prev.gasPressed) or \
(CS.brakePressed and (not self.CS_prev.brakePressed or not CS.standstill)):
# Disable on rising edge of accelerator or brake. Also disable on brake when speed > 0
if (CS.gasPressed and not self.CS_prev.gasPressed and self.disengage_on_accelerator) or \
(CS.brakePressed and (not self.CS_prev.brakePressed or not CS.standstill)):
self.events.add(EventName.pedalPressed)
self.events.add_from_msg(CS.events)
@ -490,7 +493,7 @@ class Controls:
# Check which actuators can be enabled
CC.latActive = self.active and not CS.steerFaultTemporary and not CS.steerFaultPermanent and \
CS.vEgo > self.CP.minSteerSpeed and not CS.standstill
CC.longActive = self.active
CC.longActive = self.active and not CS.gasPressed
actuators = CC.actuators
actuators.longControlState = self.LoC.long_control_state

View File

@ -357,11 +357,11 @@ EVENTS: Dict[int, Dict[str, Union[Alert, AlertCallbackType]]] = {
# ********** events only containing alerts that display while engaged **********
EventName.gasPressed: {
ET.PRE_ENABLE: Alert(
"Release Gas Pedal to Engage",
ET.WARNING: Alert(
"Release Accelerator Pedal to Engage",
"",
AlertStatus.normal, AlertSize.small,
Priority.LOWEST, VisualAlert.none, AudibleAlert.none, .1, creation_delay=1.),
Priority.LOWEST, VisualAlert.none, AudibleAlert.none, .1),
},
# openpilot tries to learn certain parameters about your car by observing

View File

@ -87,7 +87,7 @@ class LongControl():
v_target, v_target_future, CS.brakePressed,
CS.cruiseState.standstill)
if self.long_control_state == LongCtrlState.off or CS.gasPressed:
if self.long_control_state == LongCtrlState.off:
self.reset(CS.vEgo)
output_accel = 0.

View File

@ -69,7 +69,6 @@ class Planner:
# Reset current state when not engaged, or user is controlling the speed
reset_state = long_control_state == LongCtrlState.off
reset_state = reset_state or sm['carState'].gasPressed
# No change cost when user is controlling the speed, or when standstill
prev_accel_constraint = not (reset_state or sm['carState'].standstill)

View File

@ -38,6 +38,7 @@ def manager_init() -> None:
default_params: List[Tuple[str, Union[str, bytes]]] = [
("CompletedTrainingVersion", "0"),
("DisengageOnAccelerator", "1"),
("HasAcceptedTerms", "0"),
("OpenpilotEnabledToggle", "1"),
]

View File

@ -346,6 +346,7 @@ def setup_env(simulation=False):
params.clear_all()
params.put_bool("OpenpilotEnabledToggle", True)
params.put_bool("Passive", False)
params.put_bool("DisengageOnAccelerator", True)
os.environ["NO_RADAR_SLEEP"] = "1"
os.environ["REPLAY"] = "1"

View File

@ -65,6 +65,12 @@ TogglesPanel::TogglesPanel(SettingsWindow *parent) : ListWidget(parent) {
"In this mode openpilot will ignore lanelines and just drive how it thinks a human would.",
"../assets/offroad/icon_road.png",
},
{
"DisengageOnAccelerator",
"Disengage On Accelerator Pedal",
"openpilot will disengage when accelerator pedal is pressed.",
"../assets/offroad/icon_disengage_on_accelerator.svg",
},
#ifdef ENABLE_MAPS
{
"NavSettingTime24h",