PR Feedback

Signed-off-by: Jafar Al-Gharaibeh <to.jafar@gmail.com>
pull/988/head
Jafar Al-Gharaibeh 5 years ago committed by Adeeb Shihadeh
parent 0594f00d61
commit 79f54ad9f2
  1. 10
      selfdrive/car/mazda/carcontroller.py
  2. 17
      selfdrive/car/mazda/carstate.py
  3. 4
      selfdrive/car/mazda/interface.py
  4. 2
      selfdrive/car/mazda/mazdacan.py
  5. 3
      selfdrive/car/mazda/values.py

@ -9,8 +9,7 @@ class CarController():
self.packer = CANPacker(dbc_name)
self.steer_rate_limited = False
def update(self, enabled, CS, frame, actuators, pcm_cancel_cmd, visual_alert,
left_lane, right_lane, left_lane_depart, right_lane_depart):
def update(self, enabled, CS, frame, actuators, pcm_cancel_cmd):
""" Controls thread """
can_sends = []
@ -28,13 +27,14 @@ class CarController():
# Mazda Stop and Go requires a RES button (or gas) press if the car stops more than 3 seconds
# Send Resume button at 2hz if we're engaged at standstill to support full stop and go!
# TODO: improve the resume trigger logic by looking at actual radar data
can_sends.append(mazdacan.create_cancel_acc(self.packer, CS.CP.carFingerprint, Buttons.RESUME))
can_sends.append(mazdacan.create_button_cmd(self.packer, CS.CP.carFingerprint, Buttons.RESUME))
else:
apply_steer = 0
if CS.out.cruiseState.enabled and frame % 10 == 0:
self.steer_rate_limited = False
if pcm_cancel_cmd and frame % 10 == 0:
# Cancel Stock ACC if it's engaged with OP disengaged
# Match stock message rate which is sent at 10hz
can_sends.append(mazdacan.create_cancel_acc(self.packer, CS.CP.carFingerprint, Buttons.CANCEL))
can_sends.append(mazdacan.create_button_cmd(self.packer, CS.CP.carFingerprint, Buttons.CANCEL))
self.apply_steer_last = apply_steer

@ -16,7 +16,7 @@ class CarState(CarStateBase):
self.acc_active_last = False
self.low_speed_lockout = True
self.low_speed_alert = False
self.lkas_on = False
self.lkas_allowed = False
def update(self, cp, cp_cam):
@ -56,18 +56,12 @@ class CarState(CarStateBase):
ret.gas = cp.vl["ENGINE_DATA"]['PEDAL_GAS']
ret.gasPressed = ret.gas > 0
# No steer if block signal is on
# block = cp.vl["STEER_RATE"]['LKAS_BLOCK'] == 1
# On if no driver torque the last 5 seconds
handsoff = cp.vl["STEER_RATE"]['HANDS_OFF_5_SECONDS'] == 1
# LKAS is enabled at 52kph going up and disabled at 45kph going down
if speed_kph > LKAS_LIMITS.ENABLE_SPEED:
self.lkas_on = True
self.lkas_allowed = True
elif speed_kph < LKAS_LIMITS.DISABLE_SPEED:
self.lkas_on = False
self.lkas_allowed = False
# if any of the cruize buttons is pressed force state update
if any([cp.vl["CRZ_BTNS"]['RES'],
@ -80,7 +74,7 @@ class CarState(CarStateBase):
ret.cruiseState.speed = self.cruise_speed
if ret.cruiseState.enabled:
if not self.lkas_on:
if not self.lkas_allowed:
if not self.acc_active_last:
self.low_speed_lockout = True
else:
@ -89,7 +83,8 @@ class CarState(CarStateBase):
self.low_speed_lockout = False
self.low_speed_alert = False
ret.steerWarning = handsoff
# On if no driver torque the last 5 seconds
ret.steerWarning = cp.vl["STEER_RATE"]['HANDS_OFF_5_SECONDS'] == 1
self.acc_active_last = ret.cruiseState.enabled

@ -87,8 +87,6 @@ class CarInterface(CarInterfaceBase):
def apply(self, c):
can_sends = self.CC.update(c.enabled, self.CS, self.frame, c.actuators,
c.cruiseControl.cancel, c.hudControl.visualAlert,
c.hudControl.leftLaneVisible, c.hudControl.rightLaneVisible,
c.hudControl.leftLaneDepart, c.hudControl.rightLaneDepart)
c.cruiseControl.cancel)
self.frame += 1
return can_sends

@ -57,7 +57,7 @@ def create_steering_control(packer, car_fingerprint, frame, apply_steer, lkas):
return packer.make_can_msg("CAM_LKAS", 0, values)
def create_cancel_acc(packer, car_fingerprint, button):
def create_button_cmd(packer, car_fingerprint, button):
if button == Buttons.CANCEL:
can = 1

@ -34,7 +34,8 @@ FINGERPRINTS = {
# CX-5 2017 GT
{
64: 8, 70: 8, 80: 8, 117: 8, 118: 8, 120: 8, 121: 8, 130: 8, 134: 8, 145: 8, 154: 8, 155: 8, 157: 8, 158: 8, 159: 8, 253: 8, 304: 8, 305: 8, 357: 8, 358: 8, 359: 8, 512: 8, 514: 8, 515: 8, 529: 8, 533: 8, 535: 8, 539: 8, 540: 8, 541: 8, 542: 8, 543: 8, 552: 8, 576: 8, 577: 8, 578: 8, 579: 8, 580: 8, 581: 8, 582: 8, 605: 8, 606: 8, 607: 8, 608: 8, 628: 8, 832: 8, 836: 8, 863: 8, 865: 8, 866: 8, 867: 8, 868: 8, 869: 8, 870: 8, 976: 8, 977: 8, 978: 8, 1034: 8, 1045: 8, 1056: 8, 1061: 8, 1067: 8, 1070: 8, 1078: 8, 1080: 8, 1085: 8, 1086: 8, 1088: 8, 1093: 8, 1108: 8, 1114: 8, 1115: 8, 1116: 8, 1139: 8, 1143: 8, 1147: 8, 1154: 8, 1157: 8, 1160: 8, 1163: 8, 1166: 8, 1177: 8, 1178: 8, 1179: 8, 1180: 8, 1183: 8, 1233: 8, 1236: 8, 1237: 8, 1238: 8, 1239: 8, 1241: 8, 1242: 8, 1243: 8, 1244: 8, 1264: 8, 1266: 8, 1267: 8, 1269: 8, 1270: 8, 1271: 8, 1272: 8, 1274: 8, 1275: 8, 1277: 8, 1278: 8, 1409: 8, 1416: 8, 1425: 8, 1430: 8, 1435: 8, 1440: 8, 1446: 8, 1456: 8, 1479: 8
},
},
# CX-5 2019 GTR
{
64: 8, 70: 8, 80: 8, 117: 8, 118: 8, 120: 8, 121: 8, 130: 8, 134: 8, 145: 8, 154: 8, 155: 8, 157: 8, 158: 8, 159: 8, 253: 8, 254: 8, 304: 8, 305: 8, 357: 8, 358: 8, 359: 8, 512: 8, 514: 8, 515: 8, 529: 8, 533: 8, 535: 8, 539: 8, 540: 8, 541: 8, 542: 8, 543: 8, 552: 8, 576: 8, 577: 8, 578: 8, 579: 8, 580: 8, 581: 8, 582: 8, 605: 8, 606: 8, 607: 8, 608: 8, 628: 8, 736: 8, 832: 8, 836: 8, 863: 8, 865: 8, 866: 8, 867: 8, 868: 8, 869: 8, 870: 8, 976: 8, 977: 8, 978: 8, 1034: 8, 1045: 8, 1056: 8, 1061: 8, 1067: 8, 1078: 8, 1080: 8, 1085: 8, 1086: 8, 1088: 8, 1093: 8, 1108: 8, 1114: 8, 1115: 8, 1116: 8, 1139: 8, 1143: 8, 1147: 8, 1154: 8, 1157: 8, 1160: 8, 1163: 8, 1166: 8, 1170: 8, 1171: 8, 1173: 8, 1177: 8, 1178: 8, 1179: 8, 1180: 8, 1183: 8, 1233: 8, 1236: 8, 1237: 8, 1238: 8, 1239: 8, 1241: 8, 1242: 8, 1244: 8, 1260: 8, 1264: 8, 1266: 8, 1267: 8, 1269: 8, 1270: 8, 1271: 8, 1272: 8, 1274: 8, 1277: 8, 1278: 8, 1409: 8, 1416: 8, 1425: 8, 1430: 8, 1435: 8, 1440: 8, 1446: 8, 1456: 8, 1479: 8, 1776: 8, 1792: 8, 1872: 8, 1937: 8, 1953: 8, 1968: 8, 2015: 8, 2016: 8, 2024: 8

Loading…
Cancel
Save