Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mazda: alert when LKAS is disabled #23273

Merged
merged 4 commits into from
Dec 20, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion selfdrive/car/mazda/carstate.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def __init__(self, CP):
self.acc_active_last = False
self.low_speed_alert = False
self.lkas_allowed_speed = False
self.lkas_disabled = False

def update(self, cp, cp_cam):

Expand Down Expand Up @@ -91,9 +92,12 @@ def update(self, cp, cp_cam):

self.acc_active_last = ret.cruiseState.enabled

self.crz_btns_counter = cp.vl["CRZ_BTNS"]["CTR"]

# camera signals
self.lkas_disabled = cp_cam.vl["CAM_LANEINFO"]["LANE_LINES"] == 0
self.cam_lkas = cp_cam.vl["CAM_LKAS"]
self.cam_laneinfo = cp_cam.vl["CAM_LANEINFO"]
self.crz_btns_counter = cp.vl["CRZ_BTNS"]["CTR"]
ret.steerError = cp_cam.vl["CAM_LKAS"]["ERR_BIT_1"] == 1

return ret
Expand Down
6 changes: 4 additions & 2 deletions selfdrive/car/mazda/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,10 @@ def update(self, c, can_strings):
# events
events = self.create_common_events(ret)

if self.CS.low_speed_alert:
events.add(EventName.belowSteerSpeed)
if self.CS.lkas_disabled:
events.add(EventName.lkasDisabled)
elif self.CS.low_speed_alert:
events.add(EventName.belowSteerSpeed)
adeebshihadeh marked this conversation as resolved.
Show resolved Hide resolved

ret.events = events.to_msg()

Expand Down
5 changes: 5 additions & 0 deletions selfdrive/controls/lib/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -832,4 +832,9 @@ def joystick_alert(CP: car.CarParams, sm: messaging.SubMaster, metric: bool, sof
ET.NO_ENTRY: NoEntryAlert("Cruise Fault: Restart the Car"),
},

EventName.lkasDisabled: {
ET.PERMANENT: NormalPermanentAlert("LKAS Disabled: Check the car's LKAS setting"),
adeebshihadeh marked this conversation as resolved.
Show resolved Hide resolved
ET.NO_ENTRY: NoEntryAlert("LKAS Disabled"),
},

}