From a2ae18d1dbd1e59c38ce22fa25ddffbd1d3084e3 Mon Sep 17 00:00:00 2001 From: rbiasini Date: Mon, 23 Dec 2019 13:10:28 -0800 Subject: [PATCH] Honda fwd fixes (#5) - fix chime forwarding - forward radar hud msg from stock - no EON chime during stock fcw --- panda/VERSION | 2 +- panda/board/obj/panda.bin.signed | Bin 31596 -> 31564 bytes panda/board/safety/safety_honda.h | 5 ++--- panda/tests/safety/test_honda.py | 4 ++-- .../tests/safety_replay/test_safety_replay.py | 2 +- selfdrive/car/honda/hondacan.py | 12 ++---------- selfdrive/controls/controlsd.py | 8 ++++++-- selfdrive/controls/lib/alerts.py | 7 +++++++ selfdrive/test/process_replay/ref_commit | 2 +- 9 files changed, 22 insertions(+), 20 deletions(-) diff --git a/panda/VERSION b/panda/VERSION index 538a65cc825174..b7c8e167db982f 100644 --- a/panda/VERSION +++ b/panda/VERSION @@ -1 +1 @@ -v1.6.9 \ No newline at end of file +v1.7.0 \ No newline at end of file diff --git a/panda/board/obj/panda.bin.signed b/panda/board/obj/panda.bin.signed index d7e011d8fb7ecc8846c74abd0543f3f2ba9814c4..8526a5b993edb2d34f1fb74051ff02c758b98ae2 100644 GIT binary patch delta 2074 zcmbW1dr;I>6vxl~u?v?F$zUf}T-jw&K{UZcGDDGdc_We$zA)cFwWyg1nyoKVDyHy8 zrH(fAGC>o#uI~rE(^17JdzCRb6rs=PC<}=^(xaW7zp8NaVKW?$3 zx7f&|i;1jX5HI}?=wH8wYt*pYE**PWcP)o_BRCJvfKu?bNMb?uEwDZX8^MR52-ra( zSO6YA-Ud4dOb3%eCP)WrJ_%|8Fy;drJenF< z@Y+4H&0^QMd{P1nX6_-QPlIf`XTR(6f=}VMoSKvkg%sZEVnzx*=9-tF80RH? z-M>LZ9jaP;wOWiF@U&Jn56Y4O=Na>rwt~Nbdn7*PAhTuqqp6yO_s*`Fr}kHZW`U4u>iR(&dgYdbXhhqHb&a4D;fJtw#0iVELFB8 zK9Kh05sbYrqf+;&(vmild2d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{5NExac42K++QSK0?w5VcAgoUizWpr93_z;xirnWa#y8|tLrrI*>8s8IwA z8%;-K>M%*&H=xB6EGbT#@k_*AcFDl-2So0|C$fk6rCqKgG!PmClyN@sBdS?&bb7ZW zUHg^1%PivYD=DQ>9`${Cdd6RTd_bf|hGAb;Mz*+9lU(qcyFyQ8p~Zs~Lxo&r?Mf6b zOQV8`Vq{J9R-!r59=n3*lx!I1rck!L8s8z;$B!o3Cj*iWY0{89oAgI9xoi8h<&L#| z(e)y-R-l~-cPSs)a=V!9rHtooWPF}r+@{4)2XY5A0ePBO`R0DVfzq`++Ig}fwu2?& z^~t}epCS5LMojT1)eQsnllIggqFRwRbu!uH`Ki$grAwc*c@*nF`D0KA8bC9+1CAFy z5BeQ??Re$2r_af#R%3=1#xH)wxFyP)1!_4K+6t|er>CDJb1jaywzD0_n=6*)k-jVq z<=@b3VQ2Fa=m~HcT#z+0{ndzDTIn0cy8(ZoZTLWFv6&g;cajl=SUEB2Gh_(de9lNn1BCejfeI+9ctpV!|qj zfLDS(p`yxBk@2aUcE!3L19}m{w%s`S&}~qy+=lJcK@G@NXcJW1*KL*fJD~+o4`@8p z3mOjfhU%ccP{SU1@SSJm7CCsNIG7z6;D}@V2&l#^$^hkK_DdPB>X=n~cCblZf`wk@ za_*0FwJJlabxxPJU5v~L_Ocf+{&|thaR^6FkXHko%H=L6LX_qNtI35JOB~4=^78o@ ztYNIH_G08qs9qOpZgg@Es-NfLZYXAa`)XG!J-qdGZmcvKtGO26TH^96kyq>*FqX07 zV{7q!TK(=K#+R?`tc%jzu$NOOG2XJ!#%%IeNe(d{<1GoiS>MXODYlo}S#a`0D8L jqR>_Te>jZAT^|m8bSrn>$Cjd5qYR%+D7!l=fx`a+Xwzoh diff --git a/panda/board/safety/safety_honda.h b/panda/board/safety/safety_honda.h index 4cef17f79d0ed5..ab8ceb52905206 100644 --- a/panda/board/safety/safety_honda.h +++ b/panda/board/safety/safety_honda.h @@ -6,7 +6,7 @@ // accel rising edge // brake rising edge // brake > 0mph -const AddrBus HONDA_N_TX_MSGS[] = {{0xE4, 0}, {0x194, 0}, {0x1FA, 0}, {0x200, 0}, {0x30C, 0}, {0x33D, 0}, {0x39F, 0}}; +const AddrBus HONDA_N_TX_MSGS[] = {{0xE4, 0}, {0x194, 0}, {0x1FA, 0}, {0x200, 0}, {0x30C, 0}, {0x33D, 0}}; const AddrBus HONDA_BH_TX_MSGS[] = {{0xE4, 0}, {0x296, 1}, {0x33D, 0}}; // Bosch Harness const AddrBus HONDA_BG_TX_MSGS[] = {{0xE4, 2}, {0x296, 0}, {0x33D, 2}}; // Bosch Giraffe const int HONDA_GAS_INTERCEPTOR_THRESHOLD = 328; // ratio between offset and gain from dbc file @@ -216,7 +216,6 @@ static int honda_fwd_hook(int bus_num, CAN_FIFOMailBox_TypeDef *to_fwd) { // fwd from car to camera. also fwd certain msgs from camera to car // 0xE4 is steering on all cars except CRV and RDX, 0x194 for CRV and RDX, // 0x1FA is brake control, 0x30C is acc hud, 0x33D is lkas hud, - // 0x39f is radar hud int bus_fwd = -1; if (!relay_malfunction) { @@ -227,7 +226,7 @@ static int honda_fwd_hook(int bus_num, CAN_FIFOMailBox_TypeDef *to_fwd) { // block stock lkas messages and stock acc messages (if OP is doing ACC) int addr = GET_ADDR(to_fwd); bool is_lkas_msg = (addr == 0xE4) || (addr == 0x194) || (addr == 0x33D); - bool is_acc_hud_msg = (addr == 0x30C) || (addr == 0x39F); + bool is_acc_hud_msg = addr == 0x30C; bool is_brake_msg = addr == 0x1FA; bool block_fwd = is_lkas_msg || (is_acc_hud_msg && long_controls_allowed) || diff --git a/panda/tests/safety/test_honda.py b/panda/tests/safety/test_honda.py index 6ab247835af7e4..f89e7a593f4e85 100755 --- a/panda/tests/safety/test_honda.py +++ b/panda/tests/safety/test_honda.py @@ -8,7 +8,7 @@ MAX_BRAKE = 255 INTERCEPTOR_THRESHOLD = 328 -TX_MSGS = [[0xE4, 0], [0x194, 0], [0x1FA, 0], [0x200, 0], [0x30C, 0], [0x33D, 0], [0x39F, 0]] +TX_MSGS = [[0xE4, 0], [0x194, 0], [0x1FA, 0], [0x200, 0], [0x30C, 0], [0x33D, 0]] class TestHondaSafety(unittest.TestCase): @classmethod @@ -253,7 +253,7 @@ def test_fwd_hook(self): self.safety.set_long_controls_allowed(l) blocked_msgs = [0xE4, 0x194, 0x33D] if l: - blocked_msgs += [0x30C, 0x39F] + blocked_msgs += [0x30C] if not f: blocked_msgs += [0x1FA] for b in buss: diff --git a/panda/tests/safety_replay/test_safety_replay.py b/panda/tests/safety_replay/test_safety_replay.py index b4278351fee0b3..4b2f5372df07c5 100755 --- a/panda/tests/safety_replay/test_safety_replay.py +++ b/panda/tests/safety_replay/test_safety_replay.py @@ -11,7 +11,7 @@ # (route, safety mode, param) logs = [ - ("b0c9d2329ad1606b|2019-05-30--20-23-57.bz2", Panda.SAFETY_HONDA, 0), # HONDA.CIVIC + ("2425568437959f9d|2019-12-22--16-24-37.bz2", Panda.SAFETY_HONDA_NIDEC, 0), # HONDA.CIVIC (fcw presents: 0x1FA blocked as expected) ("38bfd238edecbcd7|2019-06-07--10-15-25.bz2", Panda.SAFETY_TOYOTA, 66), # TOYOTA.PRIUS ("f89c604cf653e2bf|2018-09-29--13-46-50.bz2", Panda.SAFETY_GM, 0), # GM.VOLT ("0375fdf7b1ce594d|2019-05-21--20-10-33.bz2", Panda.SAFETY_HONDA_BOSCH, 1), # HONDA.ACCORD diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py index 855a0e7dce8ca9..411d0c881fdbea 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -1,5 +1,5 @@ from selfdrive.config import Conversions as CV -from selfdrive.car.honda.values import CAR, HONDA_BOSCH +from selfdrive.car.honda.values import HONDA_BOSCH def get_pt_bus(car_fingerprint, has_relay): @@ -25,7 +25,7 @@ def create_brake_command(packer, apply_brake, pump_on, pcm_override, pcm_cancel_ "COMPUTER_BRAKE_REQUEST": brake_rq, "SET_ME_1": 1, "BRAKE_LIGHTS": brakelights, - "CHIME": stock_brake["CHIME"], # chime issued when disabling FCM + "CHIME": stock_brake["CHIME"] if fcw else 0, # send the chime for stock fcw "FCW": fcw << 1, # TODO: Why are there two bits for fcw? "AEB_REQ_1": 0, "AEB_REQ_2": 0, @@ -76,14 +76,6 @@ def create_ui_commands(packer, pcm_speed, hud, car_fingerprint, is_metric, idx, } commands.append(packer.make_can_msg('LKAS_HUD', bus_lkas, lkas_hud_values, idx)) - if car_fingerprint in (CAR.CIVIC, CAR.ODYSSEY): - radar_hud_values = { - 'ACC_ALERTS': hud.acc_alert, - 'LEAD_SPEED': 0x1fe, # What are these magic values - 'LEAD_STATE': 0x7, - 'LEAD_DISTANCE': 0x1e, - } - commands.append(packer.make_can_msg('RADAR_HUD', bus_pt, radar_hud_values, idx)) return commands diff --git a/selfdrive/controls/controlsd.py b/selfdrive/controls/controlsd.py index f6a27902bd5f20..ad39b19b879757 100755 --- a/selfdrive/controls/controlsd.py +++ b/selfdrive/controls/controlsd.py @@ -257,10 +257,14 @@ def state_control(frame, rcv_frame, plan, path_plan, CS, CP, state, events, v_cr # add eventual driver distracted events events = driver_status.update(events, driver_engaged, isActive(state), CS.standstill) - # send FCW alert if triggered by planner - if plan.fcw or CS.stockFcw: + if plan.fcw: + # send FCW alert if triggered by planner AM.add(frame, "fcw", enabled) + elif CS.stockFcw: + # send a silent alert when stock fcw triggers, since the car is already beeping + AM.add(frame, "fcwStock", enabled) + # State specific actions if state in [State.preEnabled, State.disabled]: diff --git a/selfdrive/controls/lib/alerts.py b/selfdrive/controls/lib/alerts.py index a7d85058aba4cc..e9295bfef7a110 100644 --- a/selfdrive/controls/lib/alerts.py +++ b/selfdrive/controls/lib/alerts.py @@ -80,6 +80,13 @@ def __gt__(self, alert2): AlertStatus.critical, AlertSize.full, Priority.HIGHEST, VisualAlert.fcw, AudibleAlert.chimeWarningRepeat, 1., 2., 2.), + Alert( + "fcwStock", + "BRAKE!", + "Risk of Collision", + AlertStatus.critical, AlertSize.full, + Priority.HIGHEST, VisualAlert.fcw, AudibleAlert.none, 1., 2., 2.), # no EON chime for stock FCW + Alert( "steerSaturated", "TAKE CONTROL", diff --git a/selfdrive/test/process_replay/ref_commit b/selfdrive/test/process_replay/ref_commit index f603a2498603c3..0c0be19b61858f 100644 --- a/selfdrive/test/process_replay/ref_commit +++ b/selfdrive/test/process_replay/ref_commit @@ -1 +1 @@ -b2364d6239bca0a8caaf11f0433bf766c66e15a4 \ No newline at end of file +89304bdcab73fa43a8dd39cab93bc4ea4c9cbbdb \ No newline at end of file