From 22cc515effe2d3584bc176fd9e236af569d323a0 Mon Sep 17 00:00:00 2001 From: Ted Slesinski Date: Fri, 24 Aug 2018 23:50:59 -0400 Subject: [PATCH 1/3] Move vehicle state values (that get sent to radar) into values.py file, its a better place for it :) --- selfdrive/car/honda/hondacan.py | 21 ++++----------------- selfdrive/car/honda/values.py | 12 ++++++++++++ 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py index c0b3f1d36ebb79..7d972f5e548623 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -2,7 +2,7 @@ import common.numpy_fast as np from selfdrive.config import Conversions as CV -from selfdrive.car.honda.values import CAR, HONDA_BOSCH +from selfdrive.car.honda.values import CAR, HONDA_BOSCH, VEHICLE_STATE_MSG # *** Honda specific *** def can_cksum(mm): @@ -126,26 +126,13 @@ def create_radar_commands(v_ego, car_fingerprint, new_radar_config, idx): msg_0x300 = ("\xf9" + speed + "\x8a\xd0" + ("\x20" if idx == 0 or idx == 3 else "\x00") + "\x00\x00") + msg_0x301 = VEHICLE_STATE_MSG[car_fingerprint] if car_fingerprint == CAR.CIVIC: - msg_0x301 = "\x02\x38\x44\x32\x4f\x00\x00" idx_offset = 0xc if new_radar_config else 0x8 # radar in civic 2018 requires 0xc - commands.append(make_can_msg(0x300, msg_0x300, idx + idx_offset, 1)) - else: - if car_fingerprint == CAR.CRV: - msg_0x301 = "\x00\x00\x50\x02\x51\x00\x00" - elif car_fingerprint == CAR.ACURA_RDX: - msg_0x301 = "\x0f\x57\x4f\x02\x5a\x00\x00" - elif car_fingerprint == CAR.ODYSSEY: - msg_0x301 = "\x00\x00\x56\x02\x55\x00\x00" - elif car_fingerprint == CAR.ACURA_ILX: - msg_0x301 = "\x0f\x18\x51\x02\x5a\x00\x00" - elif car_fingerprint == CAR.PILOT: - msg_0x301 = "\x00\x00\x56\x02\x58\x00\x00" - elif car_fingerprint == CAR.RIDGELINE: - msg_0x301 = "\x00\x00\x56\x02\x57\x00\x00" - commands.append(make_can_msg(0x300, msg_0x300, idx, 1)) + idx += idx_offset + commands.append(make_can_msg(0x300, msg_0x300, idx, 1)) commands.append(make_can_msg(0x301, msg_0x301, idx, 1)) return commands diff --git a/selfdrive/car/honda/values.py b/selfdrive/car/honda/values.py index 67948fdd9767c9..b256bd4c75f98a 100644 --- a/selfdrive/car/honda/values.py +++ b/selfdrive/car/honda/values.py @@ -138,5 +138,17 @@ class CAR: CAR.RIDGELINE: 1., } +# This message sends car info to the radar that is specific to the model. You +# can determine this message by monitoring the OEM system. +VEHICLE_STATE_MSG = { + CAR.ACURA_ILX: "\x0f\x18\x51\x02\x5a\x00\x00", + CAR.ACURA_RDX: "\x0f\x57\x4f\x02\x5a\x00\x00", + CAR.CIVIC: "\x02\x38\x44\x32\x4f\x00\x00", + CAR.CRV: "\x00\x00\x50\x02\x51\x00\x00", + CAR.ODYSSEY: "\x00\x00\x56\x02\x55\x00\x00", + CAR.PILOT: "\x00\x00\x56\x02\x58\x00\x00", + CAR.RIDGELINE: "\x00\x00\x56\x02\x57\x00\x00", +} + # TODO: get these from dbc file HONDA_BOSCH = [CAR.ACCORD, CAR.ACCORD_15, CAR.CIVIC_HATCH, CAR.CRV_5G] From dd4c87271e8aedd63e0fc7a8a929a5c7f21a7bc9 Mon Sep 17 00:00:00 2001 From: Ted Slesinski Date: Mon, 27 Aug 2018 11:01:28 -0400 Subject: [PATCH 2/3] idx with offset should only be applied to 0x300 --- selfdrive/car/honda/hondacan.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py index 7d972f5e548623..245d2511f17b1a 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -128,11 +128,12 @@ def create_radar_commands(v_ego, car_fingerprint, new_radar_config, idx): "\x00\x00") msg_0x301 = VEHICLE_STATE_MSG[car_fingerprint] + idx_0x300 = idx if car_fingerprint == CAR.CIVIC: idx_offset = 0xc if new_radar_config else 0x8 # radar in civic 2018 requires 0xc - idx += idx_offset + idx_0x300 += idx_offset - commands.append(make_can_msg(0x300, msg_0x300, idx, 1)) + commands.append(make_can_msg(0x300, msg_0x300, idx_0x300, 1)) commands.append(make_can_msg(0x301, msg_0x301, idx, 1)) return commands From b535b890e181a70d493b2e507be024db522f55e0 Mon Sep 17 00:00:00 2001 From: Ted Slesinski Date: Mon, 27 Aug 2018 11:08:32 -0400 Subject: [PATCH 3/3] Adds new honda pilot to vehicle state msg array --- selfdrive/car/honda/values.py | 1 + 1 file changed, 1 insertion(+) diff --git a/selfdrive/car/honda/values.py b/selfdrive/car/honda/values.py index b256bd4c75f98a..fa4b7e82e83c12 100644 --- a/selfdrive/car/honda/values.py +++ b/selfdrive/car/honda/values.py @@ -147,6 +147,7 @@ class CAR: CAR.CRV: "\x00\x00\x50\x02\x51\x00\x00", CAR.ODYSSEY: "\x00\x00\x56\x02\x55\x00\x00", CAR.PILOT: "\x00\x00\x56\x02\x58\x00\x00", + CAR.PILOT_2019: "\x00\x00\x58\x02\x5c\x00\x00", CAR.RIDGELINE: "\x00\x00\x56\x02\x57\x00\x00", }