diff --git a/README.md b/README.md index 7af20f07b3fff9..318302164c1051 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,9 @@ 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 - Toyota RAV-4 2016+ non-hybrid with TSS-P - By default it uses stock Toyota ACC for longitudinal control @@ -72,8 +75,6 @@ Community WIP Cars - [Classic Tesla Model S (pre-AP)](https://github.com/commaai/openpilot/pull/145) -- [Honda Pilot 2017 with Honda Sensing](https://github.com/commaai/openpilot/pull/161) - Directory structure ------ diff --git a/common/fingerprints.py b/common/fingerprints.py index 1e0c71da47162f..10faeef0681309 100644 --- a/common/fingerprints.py +++ b/common/fingerprints.py @@ -4,6 +4,7 @@ class HONDA: CRV = "HONDA CR-V 2016 TOURING" ODYSSEY = "HONDA ODYSSEY 2018 EX-L" ACURA_RDX = "ACURA RDX 2018 ACURAWATCH PLUS" + PILOT = "HONDA PILOT 2017 TOURING" class TOYOTA: @@ -36,6 +37,9 @@ class TOYOTA: HONDA.ODYSSEY: { 57L: 3, 148L: 8, 228L: 5, 229L: 4, 316L: 8, 342L: 6, 344L: 8, 380L: 8, 399L: 7, 411L: 5, 419L: 8, 420L: 8, 427L: 3, 432L: 7, 450L: 8, 463L: 8, 464L: 8, 476L: 4, 490L: 8, 506L: 8, 542L: 7, 545L: 6, 597L: 8, 662L: 4, 773L: 7, 777L: 8, 780L: 8, 795L: 8, 800L: 8, 804L: 8, 806L: 8, 808L: 8, 817L: 4, 819L: 7, 821L: 5, 825L: 4, 829L: 5, 837L: 5, 856L: 7, 862L: 8, 871L: 8, 881L: 8, 882L: 4, 884L: 8, 891L: 8, 892L: 8, 905L: 8, 923L: 2, 927L: 8, 929L: 8, 963L: 8, 965L: 8, 966L: 8, 967L: 8, 983L: 8, 985L: 3, 1029L: 8, 1036L: 8, 1052L: 8, 1064L: 7, 1088L: 8, 1089L: 8, 1092L: 1, 1108L: 8, 1110L: 8, 1125L: 8, 1296L: 8, 1302L: 8, 1600L: 5, 1601L: 8, 1612L: 5, 1613L: 5, 1614L: 5, 1615L: 8, 1616L: 5, 1619L: 5, 1623L: 5, 1668L: 5 }, + 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, + }, 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 8b85dbd4a73ba0..3a17192b25697c 100644 --- a/selfdrive/car/__init__.py +++ b/selfdrive/car/__init__.py @@ -26,7 +26,9 @@ HONDA.ACURA_ILX: HondaInterface, HONDA.CRV: HondaInterface, HONDA.ODYSSEY: HondaInterface, - HONDA.ACURA_RDX: HondaInterface, + HONDA.ACURA_RDX: HondaInterface, + HONDA.PILOT: HondaInterface, + TOYOTA.PRIUS: ToyotaInterface, TOYOTA.RAV4: ToyotaInterface, diff --git a/selfdrive/car/honda/carcontroller.py b/selfdrive/car/honda/carcontroller.py index c1b8d7b3db9591..dc23457e5fd594 100644 --- a/selfdrive/car/honda/carcontroller.py +++ b/selfdrive/car/honda/carcontroller.py @@ -116,7 +116,7 @@ def update(self, sendcan, enabled, CS, frame, actuators, \ # *** compute control surfaces *** GAS_MAX = 1004 BRAKE_MAX = 1024/4 - if CS.CP.carFingerprint in (CAR.CIVIC, CAR.ODYSSEY): + if CS.CP.carFingerprint in (CAR.CIVIC, CAR.ODYSSEY, CAR.PILOT): 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 374dfa343158d7..e98596f26e1870 100644 --- a/selfdrive/car/honda/carstate.py +++ b/selfdrive/car/honda/carstate.py @@ -21,6 +21,7 @@ def parse_gear_shifter(can_gear_shifter, car_fingerprint): return "drive" elif can_gear_shifter == 0xa: return "sport" + elif car_fingerprint in (CAR.CIVIC, CAR.CRV, CAR.ACURA_RDX): if can_gear_shifter == 0x4: return "neutral" @@ -30,6 +31,16 @@ def parse_gear_shifter(can_gear_shifter, car_fingerprint): return "sport" elif can_gear_shifter == 0x20: return "low" + + elif car_fingerprint in (CAR.PILOT): + if can_gear_shifter == 0x8: + return "reverse" + elif can_gear_shifter == 0x4: + return "park" + elif can_gear_shifter == 0x20: + return "drive" + elif can_gear_shifter == 0x2: + return "sport" return "unknown" @@ -122,6 +133,10 @@ def get_can_signals(CP): ("EPB_STATE", "EPB_STATUS", 0), ("BRAKE_HOLD_ACTIVE", "VSA_STATUS", 0)] checks += [("EPB_STATUS", 50)] + elif CP.carFingerprint == CAR.PILOT: + dbc_f = 'honda_pilot_touring_2017_can_generated.dbc' + signals += [("MAIN_ON", "SCM_BUTTONS", 0), + ("CAR_GAS", "GAS_PEDAL_2", 0)] # add gas interceptor reading if we are using it if CP.enableGas: @@ -184,9 +199,9 @@ def update(self, cp): cp.vl["DOORS_STATUS"]['DOOR_OPEN_RL'], cp.vl["DOORS_STATUS"]['DOOR_OPEN_RR']]) self.seatbelt = not cp.vl["SEATBELT_STATUS"]['SEATBELT_DRIVER_LAMP'] and cp.vl["SEATBELT_STATUS"]['SEATBELT_DRIVER_LATCHED'] - # 2 = temporary 4 = temporary, hit a bump 5 (permanent) 6 = temporary 7 (permanent) + # 2 = temporary 3= TBD 4 = temporary, hit a bump 5 (permanent) 6 = temporary 7 (permanent) # TODO: Use values from DBC to parse this field - self.steer_error = cp.vl["STEER_STATUS"]['STEER_STATUS'] not in [0, 2, 4, 6] + self.steer_error = cp.vl["STEER_STATUS"]['STEER_STATUS'] not in [0, 2, 3, 4, 6] self.steer_not_allowed = cp.vl["STEER_STATUS"]['STEER_STATUS'] != 0 self.brake_error = cp.vl["STANDSTILL"]['BRAKE_ERROR_1'] or cp.vl["STANDSTILL"]['BRAKE_ERROR_2'] self.esp_disabled = cp.vl["VSA_STATUS"]['ESP_DISABLED'] diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py index 0f9544be1a098a..1758232f5328dd 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -104,6 +104,9 @@ def create_radar_commands(v_ego, car_fingerprint, idx): 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" + 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/interface.py b/selfdrive/car/honda/interface.py index a573b3f23a9531..adac338e60a9bd 100755 --- a/selfdrive/car/honda/interface.py +++ b/selfdrive/car/honda/interface.py @@ -211,6 +211,18 @@ def get_params(candidate, fingerprint): ret.steerRatio = 14.35 ret.steerKp, ret.steerKi = 0.6, 0.18 + 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.PILOT: + stop_and_go = False + ret.mass = 4303./2.205 + std_cargo + ret.wheelbase = 2.81 + ret.centerToFront = ret.wheelbase * 0.41 + ret.steerRatio = 16.0 + ret.steerKp, ret.steerKi = 0.38, 0.11 + ret.longitudinalKpBP = [0., 5., 35.] ret.longitudinalKpV = [1.2, 0.8, 0.5] ret.longitudinalKiBP = [0., 35.]