mirror of
https://github.com/MoreTore/openpilot.git
synced 2026-07-26 12:22:04 +08:00
latching detection
This commit is contained in:
@@ -48,10 +48,15 @@ addr_checks mazda_ti_rx_checks = {mazda_ti_addr_checks, MAZDA_TI_ADDR_CHECKS_LEN
|
||||
// track msgs coming from OP so that we know what CAM msgs to drop and what to forward
|
||||
static int mazda_rx_hook(CANPacket_t *to_push) {
|
||||
bool valid = addr_safety_check(to_push, &mazda_rx_checks, NULL, NULL, NULL);
|
||||
|
||||
if (((GET_ADDR(to_push) == TI_STEER_TORQUE)) &&
|
||||
((GET_BYTE(to_push, 0) == GET_BYTE(to_push, 1)))) {
|
||||
torque_interceptor_detected = 1;
|
||||
torque_interceptor_detected = true;
|
||||
}
|
||||
if (torque_interceptor_detected){
|
||||
torque_interceptor_detected_latch = true;
|
||||
}
|
||||
if (torque_interceptor_detected_latch){
|
||||
torque_interceptor_detected = true;
|
||||
valid &= addr_safety_check(to_push, &mazda_ti_rx_checks, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
|
||||
@@ -113,6 +113,7 @@ float vehicle_speed = 0;
|
||||
bool vehicle_moving = false;
|
||||
bool acc_main_on = false; // referred to as "ACC off" in ISO 15622:2018
|
||||
bool torque_interceptor_detected = false;
|
||||
bool torque_interceptor_detected_latch = false;
|
||||
|
||||
// for safety modes with torque steering control
|
||||
int desired_torque_last = 0; // last desired steer torque
|
||||
|
||||
@@ -32,6 +32,7 @@ class CarInterfaceBase(ABC):
|
||||
self.steering_unpressed = 0
|
||||
self.low_speed_alert = False
|
||||
self.silent_steer_warning = True
|
||||
self.CP.enableTorqueInterceptor = False
|
||||
|
||||
if CarState is not None:
|
||||
self.CS = CarState(CP)
|
||||
@@ -100,9 +101,6 @@ class CarInterfaceBase(ABC):
|
||||
ret.longitudinalActuatorDelayUpperBound = 0.15
|
||||
ret.steerLimitTimer = 1.0
|
||||
|
||||
# No Torque Interceptor by default
|
||||
ret.enableTorqueInterceptor = False
|
||||
|
||||
return ret
|
||||
|
||||
@abstractmethod
|
||||
|
||||
Reference in New Issue
Block a user