mirror of
https://github.com/infiniteCable2/opendbc.git
synced 2026-02-18 13:03:52 +08:00
@@ -5,7 +5,6 @@ LEN_TO_DLC = {length: dlc for (dlc, length) in enumerate(DLC_TO_LEN)}
|
||||
|
||||
class ALTERNATIVE_EXPERIENCE:
|
||||
DEFAULT = 0
|
||||
DISABLE_DISENGAGE_ON_GAS = 1
|
||||
DISABLE_STOCK_AEB = 2
|
||||
RAISE_LONGITUDINAL_LIMITS_TO_ISO_MAX = 8
|
||||
ALLOW_AEB = 16
|
||||
|
||||
@@ -347,10 +347,6 @@ static void relay_malfunction_set(void) {
|
||||
}
|
||||
|
||||
static void generic_rx_checks(void) {
|
||||
// exit controls on rising edge of gas press
|
||||
if (gas_pressed && !gas_pressed_prev && !(alternative_experience & ALT_EXP_DISABLE_DISENGAGE_ON_GAS)) {
|
||||
controls_allowed = false;
|
||||
}
|
||||
gas_pressed_prev = gas_pressed;
|
||||
|
||||
// exit controls on rising edge of brake press
|
||||
|
||||
@@ -271,11 +271,11 @@ extern uint32_t ts_angle_last;
|
||||
extern int desired_angle_last;
|
||||
extern struct sample_t angle_meas; // last 6 steer angles/curvatures
|
||||
|
||||
// This can be set with a USB command
|
||||
// Alt experiences can be set with a USB command
|
||||
// It enables features that allow alternative experiences, like not disengaging on gas press
|
||||
// It is only either 0 or 1 on mainline comma.ai openpilot
|
||||
|
||||
#define ALT_EXP_DISABLE_DISENGAGE_ON_GAS 1
|
||||
//#define ALT_EXP_DISABLE_DISENGAGE_ON_GAS 1 // not used anymore, but reserved
|
||||
|
||||
// If using this flag, make sure to communicate to your users that a stock safety feature is now disabled.
|
||||
#define ALT_EXP_DISABLE_STOCK_AEB 2
|
||||
|
||||
@@ -944,17 +944,10 @@ class PandaCarSafetyTest(PandaSafetyTest):
|
||||
self._rx(self._user_gas_msg(1))
|
||||
self.assertTrue(self.safety.get_controls_allowed())
|
||||
|
||||
def test_disengage_on_gas(self):
|
||||
def test_no_disengage_on_gas(self):
|
||||
self._rx(self._user_gas_msg(0))
|
||||
self.safety.set_controls_allowed(True)
|
||||
self._rx(self._user_gas_msg(self.GAS_PRESSED_THRESHOLD + 1))
|
||||
self.assertFalse(self.safety.get_controls_allowed())
|
||||
|
||||
def test_alternative_experience_no_disengage_on_gas(self):
|
||||
self._rx(self._user_gas_msg(0))
|
||||
self.safety.set_controls_allowed(True)
|
||||
self.safety.set_alternative_experience(ALTERNATIVE_EXPERIENCE.DISABLE_DISENGAGE_ON_GAS)
|
||||
self._rx(self._user_gas_msg(self.GAS_PRESSED_THRESHOLD + 1))
|
||||
# Test we allow lateral, but not longitudinal
|
||||
self.assertTrue(self.safety.get_controls_allowed())
|
||||
self.assertFalse(self.safety.get_longitudinal_allowed())
|
||||
|
||||
Reference in New Issue
Block a user