Skip to content

Commit

Permalink
Fix pedal timeout message when no pedal is installed (commaai#138)
Browse files Browse the repository at this point in the history
* fixed EON on screen warning about pedal interceptor timeout when no pedal was installed
* removed faulty and unnecessary button state checks/calls. PCC button auto switches to ACC mode and back, so PCCState.OFF effectively never happens
* pedal dbc cleanup
  • Loading branch information
neon-dev committed Jan 2, 2020
1 parent 9f3d864 commit 0b0a96e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 48 deletions.
15 changes: 0 additions & 15 deletions opendbc/tesla_can.dbc
Original file line number Diff line number Diff line change
Expand Up @@ -356,20 +356,6 @@ BO_ 840 GTW_status: 8 GTW
SG_ GTW_statusChecksum : 63|8@0+ (1,0) [0|255] "" NEO
SG_ GTW_statusCounter : 51|4@0+ (1,0) [0|15] "" NEO

BO_ 1361 GAS_COMMAND: 6 EON
SG_ GAS_COMMAND : 7|16@0+ (0.0507968128,-22.85856576) [0|1] "" INTERCEPTOR
SG_ GAS_COMMAND2 : 23|16@0+ (0.1015936256,-22.85856576) [0|1] "" INTERCEPTOR
SG_ ENABLE : 39|1@0+ (1,0) [0|1] "" INTERCEPTOR
SG_ IDX : 35|4@0+ (1,0) [0|15] "" INTERCEPTOR
SG_ CHECKSUM : 47|8@0+ (1,0) [0|3] "" INTERCEPTOR

BO_ 1362 GAS_SENSOR: 6 INTERCEPTOR
SG_ INTERCEPTOR_GAS : 7|16@0+ (0.0507968128,-22.85856576) [0|1] "" EON
SG_ INTERCEPTOR_GAS2 : 23|16@0+ (0.1015936256,-22.85856576) [0|1] "" EON
SG_ STATE : 35|4@0+ (1,0) [0|15] "" EON
SG_ IDX : 39|4@0+ (1,0) [0|15] "" EON
SG_ CHECKSUM : 47|8@0+ (1,0) [0|3] "" EON

BO_ 920 GTW_carConfig: 8 GTW
SG_ GTW_performanceConfig : 2|3@0+ (1,0) [0|0] "" NEO
SG_ GTW_fourWheelDrive : 4|2@0+ (1,0) [0|0] "" NEO
Expand Down Expand Up @@ -734,7 +720,6 @@ VAL_ 904 MCU_clusterReadyForDrive 0 "NO_SNA" 1 "YES" ;
VAL_ 1160 DAS_steeringAngleRequest 16384 "ZERO_ANGLE" ;
VAL_ 1160 DAS_steeringControlType 1 "ANGLE_CONTROL" 3 "DISABLED" 0 "NONE" 2 "RESERVED" ;
VAL_ 1160 DAS_steeringHapticRequest 1 "ACTIVE" 0 "IDLE" ;
VAL_ 1362 STATE 5 "FAULT_TIMEOUT" 4 "FAULT_STARTUP" 3 "FAULT_SCE" 2 "FAULT_SEND" 1 "FAULT_BAD_CHECKSUM" 0 "NO_FAULT" ;


CM_ "CHFFR_METRIC 1160 DAS_steeringAngleRequest STEER_ANGLE 0.1098666 180; CHFFR_METRIC 264 DI_motorRPM ENGINE_RPM 1 0";
15 changes: 0 additions & 15 deletions opendbc/tesla_can1916.dbc
Original file line number Diff line number Diff line change
Expand Up @@ -356,20 +356,6 @@ BO_ 840 GTW_status: 8 GTW
SG_ GTW_statusChecksum : 63|8@0+ (1,0) [0|255] "" NEO
SG_ GTW_statusCounter : 51|4@0+ (1,0) [0|15] "" NEO

BO_ 1361 GAS_COMMAND: 6 EON
SG_ GAS_COMMAND : 7|16@0+ (0.0507968128,-22.85856576) [0|1] "" INTERCEPTOR
SG_ GAS_COMMAND2 : 23|16@0+ (0.1015936256,-22.85856576) [0|1] "" INTERCEPTOR
SG_ ENABLE : 39|1@0+ (1,0) [0|1] "" INTERCEPTOR
SG_ IDX : 35|4@0+ (1,0) [0|15] "" INTERCEPTOR
SG_ CHECKSUM : 47|8@0+ (1,0) [0|3] "" INTERCEPTOR

BO_ 1362 GAS_SENSOR: 6 INTERCEPTOR
SG_ INTERCEPTOR_GAS : 7|16@0+ (0.0507968128,-22.85856576) [0|1] "" EON
SG_ INTERCEPTOR_GAS2 : 23|16@0+ (0.1015936256,-22.85856576) [0|1] "" EON
SG_ STATE : 35|4@0+ (1,0) [0|15] "" EON
SG_ IDX : 39|4@0+ (1,0) [0|15] "" EON
SG_ CHECKSUM : 47|8@0+ (1,0) [0|3] "" EON

BO_ 920 GTW_carConfig: 8 GTW
SG_ GTW_performanceConfig : 2|3@0+ (1,0) [0|0] "" NEO
SG_ GTW_fourWheelDrive : 4|2@0+ (1,0) [0|0] "" NEO
Expand Down Expand Up @@ -734,7 +720,6 @@ VAL_ 904 MCU_clusterReadyForDrive 0 "NO_SNA" 1 "YES" ;
VAL_ 1160 DAS_steeringAngleRequest 16384 "ZERO_ANGLE" ;
VAL_ 1160 DAS_steeringControlType 1 "ANGLE_CONTROL" 3 "DISABLED" 0 "NONE" 2 "RESERVED" ;
VAL_ 1160 DAS_steeringHapticRequest 1 "ACTIVE" 0 "IDLE" ;
VAL_ 1362 STATE 5 "FAULT_TIMEOUT" 4 "FAULT_STARTUP" 3 "FAULT_SCE" 2 "FAULT_SEND" 1 "FAULT_BAD_CHECKSUM" 0 "NO_FAULT" ;


CM_ "CHFFR_METRIC 1160 DAS_steeringAngleRequest STEER_ANGLE 0.1098666 180; CHFFR_METRIC 264 DI_motorRPM ENGINE_RPM 1 0";
3 changes: 2 additions & 1 deletion opendbc/tesla_can_pedal.dbc
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,5 @@ BO_ 1362 GAS_SENSOR: 6 INTERCEPTOR
SG_ STATE : 35|4@0+ (1,0) [0|15] "" EON
SG_ IDX : 39|4@0+ (1,0) [0|15] "" EON
SG_ CHECKSUM : 47|8@0+ (1,0) [0|3] "" EON


VAL_ 1362 STATE 5 "FAULT_TIMEOUT" 4 "FAULT_STARTUP" 3 "FAULT_SCE" 2 "FAULT_SEND" 1 "FAULT_BAD_CHECKSUM" 0 "NO_FAULT" ;
30 changes: 13 additions & 17 deletions selfdrive/car/tesla/PCC_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,9 @@ def max_v_in_mapped_curve_ms(map_data, pedal_set_speed_kph):


class PCCState():
# Possible state of the ACC system, following the DI_cruiseState naming
# scheme.
OFF = 0 # Disabled by UI.
STANDBY = 1 # Ready to be enaged.
# Possible state of the PCC system, following the DI_cruiseState naming scheme.
OFF = 0 # Disabled by UI (effectively never happens since button switches over to ACC mode).
STANDBY = 1 # Ready to be engaged.
ENABLED = 2 # Engaged.
NOT_READY = 9 # Not ready to be engaged due to the state of the car.

Expand Down Expand Up @@ -235,19 +234,16 @@ def update_stat(self, CS, frame):
self._update_pedal_state(CS, frame)

can_sends = []
if self.pcc_available and CS.cstm_btns.get_button_status(PCCModes.BUTTON_NAME) == PCCState.OFF:
CS.cstm_btns.set_button_status(PCCModes.BUTTON_NAME, PCCState.STANDBY)
elif not self.pcc_available:
if CS.cstm_btns.get_button_status(PCCModes.BUTTON_NAME) != PCCState.OFF:
CS.cstm_btns.set_button_status(PCCModes.BUTTON_NAME, PCCState.OFF)
if CS.pedal_interceptor_state > 0:
CS.UE.custom_alert_message(4, "Pedal Interceptor fault (state %s)" % CS.pedal_interceptor_state, 200, 4)
elif frame >= self.pedal_timeout_frame:
CS.UE.custom_alert_message(4, "Pedal Interceptor timed out", 200, 4)
# send reset command
idx = self.pedal_idx
self.pedal_idx = (self.pedal_idx + 1) % 16
can_sends.append(teslacan.create_pedal_command_msg(0, 0, idx))
if not self.pcc_available:
timed_out = frame >= self.pedal_timeout_frame
if timed_out or CS.pedal_interceptor_state > 0:
if self.prev_pcc_available:
CS.UE.custom_alert_message(4, "Pedal Interceptor %s" % ("timed out" if timed_out else "fault (state %s)" % CS.pedal_interceptor_state), 200, 4)
if frame % 50 == 0:
# send reset command
idx = self.pedal_idx
self.pedal_idx = (self.pedal_idx + 1) % 16
can_sends.append(teslacan.create_pedal_command_msg(0, 0, idx))
return can_sends

# disable on brake
Expand Down

0 comments on commit 0b0a96e

Please sign in to comment.