From 703b05187d7c87768b5ccd203f939f06d6ab146b Mon Sep 17 00:00:00 2001 From: Ted Slesinski Date: Thu, 12 Apr 2018 21:12:45 -0500 Subject: [PATCH] 2017 Honda Ridgeline (#198) * Adds Honda Ridgeline Replaced trim level placeholder Adding 0x301 ridgeline message (I restructured this slightly since we don't need to repeat `commands.append(make_can_msg(0x300, msg_0x300, idx, 1))` so many times Updated dbc name Use pedal_gas to detect gas pressed Remove unnecessary signal check Fix array notation * Tire stiffness factor bumped to 1.5x * Adds safety tests at line 133 * Revert "Adds safety tests at line 133" This reverts commit 349edf5b1a879cac704db3786d0626211497bcb7. * fix failing build due to syntax * update variables for failing build * Update interface.py * Update Tire Slip Factor --- README.md | 7 +++++-- common/fingerprints.py | 4 ++++ selfdrive/car/__init__.py | 3 ++- selfdrive/car/honda/carcontroller.py | 2 +- selfdrive/car/honda/carstate.py | 9 ++++++--- selfdrive/car/honda/hondacan.py | 27 +++++++++++++-------------- selfdrive/car/honda/interface.py | 20 ++++++++++++++++++-- 7 files changed, 49 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 6c53015e7a9440..1222bdf9aabddc 100644 --- a/README.md +++ b/README.md @@ -34,9 +34,12 @@ Supported Cars - Acura RDX 2018 with AcuraWatch Plus (alpha!) - Can only be enabled above 25 mph - + - Honda Pilot 2017 with Honda Sensing (alpha!) - - Can only be enabled above 27 mph + - Can only be enabled above 27 mph + +- Honda Ridgeline 2017 with Honda Sensing (alpha!) + - Can only be enabled above 27 mph - Toyota RAV-4 2016+ non-hybrid with TSS-P - By default it uses stock Toyota ACC for longitudinal control diff --git a/common/fingerprints.py b/common/fingerprints.py index 51d7b938f2d006..be85de8c429603 100644 --- a/common/fingerprints.py +++ b/common/fingerprints.py @@ -5,6 +5,7 @@ class HONDA: ODYSSEY = "HONDA ODYSSEY 2018 EX-L" ACURA_RDX = "ACURA RDX 2018 ACURAWATCH PLUS" PILOT = "HONDA PILOT 2017 TOURING" + RIDGELINE = "HONDA RIDGELINE 2017 BLACK EDITION" class TOYOTA: @@ -45,6 +46,9 @@ class TOYOTA: HONDA.PILOT: [{ 1600L: 5, 1027L: 5, 1668L: 5, 1029L: 8, 1601L: 8, 777L: 8, 891L: 8, 1036L: 8, 399L: 7, 1424L: 5, 145L: 8, 660L: 8, 985L: 3, 1616L: 5, 538L: 3, 795L: 8, 542L: 7, 773L: 7, 800L: 8, 545L: 5, 546L: 3, 419L: 8, 420L: 8, 422L: 8, 1064L: 7, 425L: 8, 426L: 8, 427L: 3, 432L: 7, 819L: 7, 308L: 5, 821L: 5, 57L: 3, 965L: 8, 316L: 8, 829L: 5, 1088L: 8, 1089L: 8, 963L: 8, 837L: 5, 966L: 8, 929L: 8, 780L: 8, 923L: 2, 1613L: 5, 334L: 8, 463L: 8, 464L: 8, 1618L: 5, 1108L: 8, 597L: 8, 342L: 6, 983L: 8, 856L: 7, 804L: 8, 1612L: 5, 476L: 4, 1125L: 8, 344L: 8, 1296L: 8, 379L: 8, 228L: 5, 229L: 4, 871L: 8, 892L: 8, 490L: 8, 808L: 8, 882L: 2, 884L: 7, 967L: 8, 506L: 8, 507L: 1, 380L: 8, }], + HONDA.RIDGELINE: [{ + 57L: 3, 145L: 8, 228L: 5, 229L: 4, 308L: 5, 316L: 8, 339L: 7, 342L: 6, 344L: 8, 380L: 8, 392L: 6, 399L: 7, 419L: 8, 420L: 8, 422L: 8, 425L: 8, 426L: 8, 427L: 3, 432L: 7, 464L: 8, 471L: 3, 476L: 4, 490L: 8, 506L: 8, 545L: 5, 546L: 3, 597L: 8, 660L: 8, 773L: 7, 777L: 8, 780L: 8, 795L: 8, 800L: 8, 804L: 8, 808L: 8, 819L: 7, 821L: 5, 829L: 5, 871L: 8, 882L: 2, 884L: 7, 892L: 8, 923L: 2, 927L: 8, 929L: 8, 963L: 8, 965L: 8, 966L: 8, 967L: 8, 983L: 8, 985L: 3, 1027L: 5, 1029L: 8, 1036L: 8, 1039L: 8, 1064L: 7, 1088L: 8, 1089L: 8, 1108L: 8, 1125L: 8, 1296L: 8, 1365L: 5, 1424L: 5, 1600L: 5, 1601L: 8, 1613L: 5, 1616L: 5, 1618L: 5, 1668L: 5, 2015L: 3 + }], TOYOTA.RAV4: [{ 36L: 8, 37L: 8, 170L: 8, 180L: 8, 186L: 4, 426L: 6, 452L: 8, 464L: 8, 466L: 8, 467L: 8, 547L: 8, 548L: 8, 552L: 4, 562L: 4, 608L: 8, 610L: 5, 643L: 7, 705L: 8, 725L: 2, 740L: 5, 800L: 8, 835L: 8, 836L: 8, 849L: 4, 869L: 7, 870L: 7, 871L: 2, 896L: 8, 897L: 8, 900L: 6, 902L: 6, 905L: 8, 911L: 8, 916L: 3, 918L: 7, 921L: 8, 933L: 8, 944L: 8, 945L: 8, 951L: 8, 955L: 4, 956L: 8, 979L: 2, 998L: 5, 999L: 7, 1000L: 8, 1001L: 8, 1005L: 2, 1008L: 2, 1014L: 8, 1017L: 8, 1041L: 8, 1042L: 8, 1043L: 8, 1044L: 8, 1056L: 8, 1059L: 1, 1114L: 8, 1161L: 8, 1162L: 8, 1163L: 8, 1176L: 8, 1177L: 8, 1178L: 8, 1179L: 8, 1180L: 8, 1181L: 8, 1190L: 8, 1191L: 8, 1192L: 8, 1196L: 8, 1227L: 8, 1228L: 8, 1235L: 8, 1237L: 8, 1263L: 8, 1264L: 8, 1279L: 8, 1408L: 8, 1409L: 8, 1410L: 8, 1552L: 8, 1553L: 8, 1554L: 8, 1555L: 8, 1556L: 8, 1557L: 8, 1561L: 8, 1562L: 8, 1568L: 8, 1569L: 8, 1570L: 8, 1571L: 8, 1572L: 8, 1584L: 8, 1589L: 8, 1592L: 8, 1593L: 8, 1595L: 8, 1596L: 8, 1597L: 8, 1600L: 8, 1656L: 8, 1664L: 8, 1728L: 8, 1745L: 8, 1779L: 8, 1904L: 8, 1912L: 8, 1990L: 8, 1998L: 8 }], diff --git a/selfdrive/car/__init__.py b/selfdrive/car/__init__.py index 3a17192b25697c..bdc123c61288e5 100644 --- a/selfdrive/car/__init__.py +++ b/selfdrive/car/__init__.py @@ -26,8 +26,9 @@ HONDA.ACURA_ILX: HondaInterface, HONDA.CRV: HondaInterface, HONDA.ODYSSEY: HondaInterface, - HONDA.ACURA_RDX: HondaInterface, + HONDA.ACURA_RDX: HondaInterface, HONDA.PILOT: HondaInterface, + HONDA.RIDGELINE: HondaInterface, TOYOTA.PRIUS: ToyotaInterface, diff --git a/selfdrive/car/honda/carcontroller.py b/selfdrive/car/honda/carcontroller.py index e1a492bb68b278..a460664c5d0f81 100644 --- a/selfdrive/car/honda/carcontroller.py +++ b/selfdrive/car/honda/carcontroller.py @@ -115,7 +115,7 @@ def update(self, sendcan, enabled, CS, frame, actuators, \ # *** compute control surfaces *** BRAKE_MAX = 1024/4 - if CS.CP.carFingerprint in (CAR.CIVIC, CAR.ODYSSEY, CAR.PILOT): + if CS.CP.carFingerprint in (CAR.CIVIC, CAR.ODYSSEY, CAR.PILOT, CAR.RIDGELINE): is_fw_modified = os.getenv("DONGLE_ID") in ['99c94dc769b5d96e'] STEER_MAX = 0x1FFF if is_fw_modified else 0x1000 elif CS.CP.carFingerprint in (CAR.CRV, CAR.ACURA_RDX): diff --git a/selfdrive/car/honda/carstate.py b/selfdrive/car/honda/carstate.py index 010a399ae510ef..02d3bb79a7186b 100644 --- a/selfdrive/car/honda/carstate.py +++ b/selfdrive/car/honda/carstate.py @@ -34,8 +34,8 @@ def parse_gear_shifter(can_gear_shifter, car_fingerprint): return "sport" elif can_gear_shifter == 0x20: return "low" - elif car_fingerprint in (CAR.PILOT): - # TODO: neutral? + + elif car_fingerprint in (CAR.PILOT, CAR.RIDGELINE): if can_gear_shifter == 0x8: return "reverse" elif can_gear_shifter == 0x4: @@ -140,6 +140,9 @@ def get_can_signals(CP): dbc_f = 'honda_pilot_touring_2017_can_generated.dbc' signals += [("MAIN_ON", "SCM_BUTTONS", 0), ("CAR_GAS", "GAS_PEDAL_2", 0)] + elif CP.carFingerprint == CAR.RIDGELINE: + dbc_f = 'honda_ridgeline_black_edition_2017_can_generated.dbc' + signals += [("MAIN_ON", "SCM_BUTTONS", 0)] # add gas interceptor reading if we are using it if CP.enableGas: @@ -261,7 +264,7 @@ def update(self, cp): self.pedal_gas = cp.vl["POWERTRAIN_DATA"]['PEDAL_GAS'] # crv doesn't include cruise control - if self.CP.carFingerprint in (CAR.CRV, CAR.ODYSSEY, CAR.ACURA_RDX): + if self.CP.carFingerprint in (CAR.CRV, CAR.ODYSSEY, CAR.ACURA_RDX, CAR.RIDGELINE): self.car_gas = self.pedal_gas else: self.car_gas = cp.vl["GAS_PEDAL_2"]['CAR_GAS'] diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py index 55d9dd8cd0bb8f..66ccbff5f03dad 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -123,20 +123,19 @@ def create_radar_commands(v_ego, car_fingerprint, idx): if car_fingerprint == CAR.CIVIC: msg_0x301 = "\x02\x38\x44\x32\x4f\x00\x00" commands.append(make_can_msg(0x300, msg_0x300, idx + 8, 1)) # add 8 on idx. - elif car_fingerprint == CAR.CRV: - msg_0x301 = "\x00\x00\x50\x02\x51\x00\x00" - commands.append(make_can_msg(0x300, msg_0x300, idx, 1)) - elif car_fingerprint == CAR.ACURA_RDX: - msg_0x301 = "\x0f\x57\x4f\x02\x5a\x00\x00" - commands.append(make_can_msg(0x300, msg_0x300, idx, 1)) - elif car_fingerprint == CAR.ODYSSEY: - msg_0x301 = "\x00\x00\x56\x02\x55\x00\x00" - commands.append(make_can_msg(0x300, msg_0x300, idx, 1)) - elif car_fingerprint == CAR.ACURA_ILX: - msg_0x301 = "\x0f\x18\x51\x02\x5a\x00\x00" - commands.append(make_can_msg(0x300, msg_0x300, idx, 1)) - elif car_fingerprint == CAR.PILOT: - msg_0x301 = "\x00\x00\x56\x02\x58\x00\x00" + 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)) commands.append(make_can_msg(0x301, msg_0x301, idx, 1)) diff --git a/selfdrive/car/honda/interface.py b/selfdrive/car/honda/interface.py index ac8f8e2cd82901..1a3692d0c1734f 100755 --- a/selfdrive/car/honda/interface.py +++ b/selfdrive/car/honda/interface.py @@ -136,6 +136,9 @@ def get_params(candidate, fingerprint): # kg of standard extra cargo to count for drive, gas, etc... std_cargo = 136 + # Ridgeline reqires scaled tire stiffness + ts_factor = 1 + ret = car.CarParams.new_message() ret.carName = "honda" @@ -236,6 +239,19 @@ def get_params(candidate, fingerprint): ret.steerRatio = 16.0 ret.steerKpV, ret.steerKiV = [[0.38], [0.11]] + ret.longitudinalKpBP = [0., 5., 35.] + ret.longitudinalKpV = [1.2, 0.8, 0.5] + ret.longitudinalKiBP = [0., 35.] + ret.longitudinalKiV = [0.18, 0.12] + elif candidate == CAR.RIDGELINE: + stop_and_go = False + ts_factor = 1.4 + ret.mass = 4515./2.205 + std_cargo + ret.wheelbase = 3.18 + ret.centerToFront = ret.wheelbase * 0.41 + ret.steerRatio = 15.59 + ret.steerKpV, ret.steerKiV = [[0.38], [0.11]] + ret.longitudinalKpBP = [0., 5., 35.] ret.longitudinalKpV = [1.2, 0.8, 0.5] ret.longitudinalKiBP = [0., 35.] @@ -258,10 +274,10 @@ def get_params(candidate, fingerprint): # TODO: start from empirically derived lateral slip stiffness for the civic and scale by # mass and CG position, so all cars will have approximately similar dyn behaviors - ret.tireStiffnessFront = tireStiffnessFront_civic * \ + ret.tireStiffnessFront = (tireStiffnessFront_civic * ts_factor) * \ ret.mass / mass_civic * \ (centerToRear / ret.wheelbase) / (centerToRear_civic / wheelbase_civic) - ret.tireStiffnessRear = tireStiffnessRear_civic * \ + ret.tireStiffnessRear = (tireStiffnessRear_civic * ts_factor) * \ ret.mass / mass_civic * \ (ret.centerToFront / ret.wheelbase) / (centerToFront_civic / wheelbase_civic)