diff --git a/RELEASES.md b/RELEASES.md index 49479b568a1082..6f73dd76dfb2f7 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1,3 +1,14 @@ +Version 0.6.0.4-ku7 (2019-07-**) +======================== +* HKG - Log to cloudlog rather than print to stdout +* HKG - WIP: mapd is going to need a lot of reworking +* HKG - Forward LKAS_Icon (not really an icon) +* HKG - Disengage Properly +* HKG - Fixed Brute Force Checksum Learner +* HKG - Detect Genesis and default min speed +* HLG - Fix Min Speed Code + + Version 0.6.0.3-ku7 (2019-07-09) ======================== * HKG - Send fingerprints to Sentry diff --git a/selfdrive/car/hyundai/carcontroller.py b/selfdrive/car/hyundai/carcontroller.py index b90be1525cfe49..6ce0930c45668c 100644 --- a/selfdrive/car/hyundai/carcontroller.py +++ b/selfdrive/car/hyundai/carcontroller.py @@ -9,6 +9,8 @@ import selfdrive.messaging as messaging from selfdrive.config import Conversions as CV from common.params import Params +from selfdrive.swaglog import cloudlog + # Steer torque limits @@ -34,9 +36,8 @@ def __init__(self, dbc_name, car_fingerprint): self.last_resume_cnt = 0 self.map_speed = 0 - #context = zmq.Context() - #self.map_data_sock = messaging.sub_sock(context, service_list['liveMapData'].port, conflate=True) - #self.params = Params() + self.map_data_sock = messaging.sub_sock(service_list['liveMapData'].port) + self.params = Params() self.speed_conv = 3.6 self.speed_offset = 1.03 # Multiplier for cruise speed vs speed limit TODO: Add to UI self.speed_enable = True # Enable Auto Speed Set TODO: Add to UI @@ -46,7 +47,6 @@ def __init__(self, dbc_name, car_fingerprint): self.checksum_learn_cnt = 0 self.turning_signal_timer = 0 - self.min_steer_speed = 0. self.camera_disconnected = False self.packer = CANPacker(dbc_name) @@ -61,7 +61,7 @@ def update(self, enabled, CS, actuators, pcm_cancel_cmd, hud_alert): # Learn Checksum from the Camera if self.checksum == "NONE": self.checksum = learn_checksum(self.packer, CS.lkas11) - print ("Discovered Checksum", self.checksum) + cloudlog.info("Discovered Checksum") if self.checksum == "NONE" and self.checksum_learn_cnt < 50: self.checksum_learn_cnt += 1 return @@ -69,33 +69,27 @@ def update(self, enabled, CS, actuators, pcm_cancel_cmd, hud_alert): # If MDPS is faulted from bad checksum, then cycle through all Checksums until 1 works if CS.steer_error == 1: self.camera_disconnected = True - print ("Camera Not Detected: Brute Forcing Checksums") + cloudlog.warning("Camera Not Detected: Brute Forcing Checksums") if self.checksum_learn_cnt > 250: self.checksum_learn_cnt = 50 if self.checksum == "NONE": - print ("Testing 6B Checksum") - self.checksum == "6B" + cloudlog.info("Testing 6B Checksum") + self.checksum = "6B" elif self.checksum == "6B": - print ("Testing 7B Checksum") - self.checksum == "7B" + cloudlog.info("Testing 7B Checksum") + self.checksum = "7B" elif self.checksum == "7B": - print ("Testing CRC8 Checksum") - self.checksum == "crc8" + cloudlog.info("Testing CRC8 Checksum") + self.checksum = "crc8" else: - self.checksum == "NONE" + self.checksum = "NONE" else: self.checksum_learn_cnt += 1 ### Minimum Steer Speed ### - # Learn Minimum Steer Speed - if CS.mdps12_flt != 0 and CS.v_ego_raw > 0. and abs(CS.angle_steers) < 10.0 : - if CS.v_ego_raw > self.min_steer_speed: - self.min_steer_speed = CS.v_ego_raw + 0.1 - print ("Discovered new Min Speed as", self.min_steer_speed) - # Apply Usage of Minimum Steer Speed - if CS.v_ego_raw < self.min_steer_speed: + if CS.v_ego_raw < CS.min_steer_speed: disable_steer = True ### Turning Indicators ### @@ -112,8 +106,9 @@ def update(self, enabled, CS, actuators, pcm_cancel_cmd, hud_alert): if not enabled or disable_steer: apply_steer = 0 - - steer_req = 1 if enabled else 0 + steer_req = 0 + else: + steer_req = 1 self.apply_steer_last = apply_steer diff --git a/selfdrive/car/hyundai/carstate.py b/selfdrive/car/hyundai/carstate.py index 684ef84ec116b7..575dbfa43c94bf 100644 --- a/selfdrive/car/hyundai/carstate.py +++ b/selfdrive/car/hyundai/carstate.py @@ -136,7 +136,6 @@ def get_camera_parser(CP): return CANParser(DBC[CP.carFingerprint]['pt'], signals, checks, 2, timeout=100) - class CarState(object): def __init__(self, CP): @@ -160,9 +159,6 @@ def __init__(self, CP): self.right_blinker_flash = 0 self.has_scc = False self.min_steer_speed = 0 - - def update_min_speed(speed): - self.min_steer_speed = speed def update(self, cp, cp_cam): if (cp.vl["SCC11"]['TauGapSet'] > 0): @@ -224,8 +220,9 @@ def update(self, cp, cp_cam): self.steer_torque_driver = cp.vl["MDPS12"]['CR_Mdps_StrColTq'] self.steer_torque_motor = cp.vl["MDPS12"]['CR_Mdps_OutTq'] self.stopped = cp.vl["SCC11"]['SCCInfoDisplay'] == 4. if self.has_scc else False - self.mdps11_strang = cp.vl["MDPS11"]["CR_Mdps_StrAng"] - self.mdps11_stat = cp.vl["MDPS11"]["CF_Mdps_Stat"] + self.mdps11_strang = cp.vl["MDPS11"]['CR_Mdps_StrAng'] + self.mdps11_stat = cp.vl["MDPS11"]['CF_Mdps_Stat'] + self.lkas11_icon = cp_cam.vl["LKAS11"]['CF_Lkas_Icon'] self.mdps12_flt = cp.vl["MDPS12"]['CF_Mdps_ToiFlt'] self.user_brake = 0 @@ -238,6 +235,14 @@ def update(self, cp, cp_cam): self.pedal_gas = cp.vl["EMS12"]['TPS'] self.car_gas = cp.vl["EMS12"]['TPS'] + # Learn Minimum Steer Speed + if self.mdps12_flt != 0 and self.v_ego_raw > 0. and abs(self.angle_steers) < 5.0 and self.lkas11_icon != 2: + if self.v_ego_raw > self.min_steer_speed: + self.min_steer_speed = self.v_ego_raw + 0.1 + # If we have LKAS_Icon == 2, then we know its 16.7m/s + elif self.lkas11_icon == 2 and self.min_steer_speed < 16.7: + self.min_steer_speed = 16.7 + # Gear Selecton - This is not compatible with all Kia/Hyundai's, But is the best way for those it is compatible with gear = cp.vl["LVR12"]["CF_Lvr_Gear"] if gear == 5: diff --git a/selfdrive/car/hyundai/hyundaican.py b/selfdrive/car/hyundai/hyundaican.py index 7590e5601a452b..bdddc44f26e635 100644 --- a/selfdrive/car/hyundai/hyundaican.py +++ b/selfdrive/car/hyundai/hyundaican.py @@ -7,7 +7,7 @@ def make_can_msg(addr, dat, alt): def create_lkas11(packer, car_fingerprint, apply_steer, steer_req, cnt, enabled, lkas11, hud_alert, keep_stock, checksum): values = { - "CF_Lkas_Icon": 2, + "CF_Lkas_Icon": lkas11["CF_Lkas_Icon"] if keep_stock else 3, "CF_Lkas_LdwsSysState": 3 if steer_req else 1, "CF_Lkas_SysWarning": hud_alert, "CF_Lkas_LdwsLHWarning": lkas11["CF_Lkas_LdwsLHWarning"] if keep_stock else 0, diff --git a/selfdrive/car/hyundai/interface.py b/selfdrive/car/hyundai/interface.py index 05da0bf6aa9230..89d29ae0c8d4c5 100644 --- a/selfdrive/car/hyundai/interface.py +++ b/selfdrive/car/hyundai/interface.py @@ -178,10 +178,10 @@ def update(self, c): ret.seatbeltUnlatched = not self.CS.seatbelt # low speed steer alert hysteresis logic (only for cars with steer cut off above 10 m/s) - if ret.vEgo < (self.CS.min_steer_speed + 2.) and self.CS.min_steer_speed > 10.: - self.low_speed_alert = True - if ret.vEgo > (self.CS.min_steer_speed + 4.): - self.low_speed_alert = False + #if self.CS.v_ego_raw < (self.CS.min_steer_speed) and self.CS.min_steer_speed > 2.: + # self.low_speed_alert = True + #if self.CS.v_ego_raw > (self.CS.min_steer_speed + 0.2): + self.low_speed_alert = False events = [] if (self.CS.gear_shifter != 'drive') and (self.CS.gear_tcu != 'drive') and (self.CS.gear_shifter_cluster != 'drive'): diff --git a/selfdrive/common/version.h b/selfdrive/common/version.h index 219f916614ba41..99ba8fb5f4dad0 100644 --- a/selfdrive/common/version.h +++ b/selfdrive/common/version.h @@ -1 +1 @@ -#define COMMA_VERSION "0.6.0.3-ku7" \ No newline at end of file +#define COMMA_VERSION "0.6.0.4-dev" \ No newline at end of file diff --git a/selfdrive/manager.py b/selfdrive/manager.py index bfa38dc72b491b..b6e697d3ae3a39 100755 --- a/selfdrive/manager.py +++ b/selfdrive/manager.py @@ -100,7 +100,7 @@ def unblock_stdout(): "plannerd": "selfdrive.controls.plannerd", "radard": "selfdrive.controls.radard", "ubloxd": ("selfdrive/locationd", ["./ubloxd"]), - # "mapd": "selfdrive.mapd.mapd", + #"mapd": "selfdrive.mapd.mapd", "loggerd": ("selfdrive/loggerd", ["./loggerd"]), "logmessaged": "selfdrive.logmessaged", "tombstoned": "selfdrive.tombstoned", @@ -152,7 +152,7 @@ def get_running(): 'proclogd', 'ubloxd', 'gpsd', - # 'mapd', + #'mapd', 'deleter', ] diff --git a/selfdrive/mapd/mapd.py b/selfdrive/mapd/mapd.py index f20c8ba3da12bf..6dea07e06a6609 100755 --- a/selfdrive/mapd/mapd.py +++ b/selfdrive/mapd/mapd.py @@ -137,11 +137,10 @@ def save_gps_data(gps): def mapsd_thread(): global last_gps - context = zmq.Context() poller = zmq.Poller() - gps_sock = messaging.sub_sock(context, service_list['gpsLocation'].port, conflate=True) - gps_external_sock = messaging.sub_sock(context, service_list['gpsLocationExternal'].port, conflate=True, poller=poller) - map_data_sock = messaging.pub_sock(context, service_list['liveMapData'].port) + gps_sock = messaging.sub_sock(service_list['gpsLocation'].port) + gps_external_sock = messaging.sub_sock(service_list['gpsLocationExternal'].port) + map_data_sock = messaging.pub_sock(service_list['liveMapData'].port) cur_way = None curvature_valid = False