From 84ef9d50b7545e5948209a40cfc13aa46b48e1a2 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Mon, 25 Nov 2019 23:40:51 -0600 Subject: [PATCH 1/4] Fix typo (#891) --- selfdrive/controls/lib/latcontrol_indi.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/selfdrive/controls/lib/latcontrol_indi.py b/selfdrive/controls/lib/latcontrol_indi.py index db1192f83..d98b2efd8 100644 --- a/selfdrive/controls/lib/latcontrol_indi.py +++ b/selfdrive/controls/lib/latcontrol_indi.py @@ -32,7 +32,7 @@ class LatControlINDI(): self.A_K = A - np.dot(K, C) self.x = np.matrix([[0.], [0.], [0.]]) - self.enfore_rate_limit = CP.carName == "toyota" + self.enforce_rate_limit = CP.carName == "toyota" self.RC = CP.lateralTuning.indi.timeConstant self.G = CP.lateralTuning.indi.actuatorEffectiveness @@ -81,7 +81,7 @@ class LatControlINDI(): delta_u = g_inv * accel_error # Enforce rate limit - if self.enfore_rate_limit: + if self.enforce_rate_limit: steer_max = float(SteerLimitParams.STEER_MAX) new_output_steer_cmd = steer_max * (self.delayed_output + delta_u) prev_output_steer_cmd = steer_max * self.output_steer From e70b8e80ba8ad85ee37dd883d0824d44e7d31d29 Mon Sep 17 00:00:00 2001 From: dragonpilot Date: Thu, 28 Nov 2019 14:38:12 +1000 Subject: [PATCH 2/4] add china 2019 corolla --- selfdrive/car/toyota/values.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/selfdrive/car/toyota/values.py b/selfdrive/car/toyota/values.py index 10cd731b1..71db6d4be 100644 --- a/selfdrive/car/toyota/values.py +++ b/selfdrive/car/toyota/values.py @@ -186,6 +186,10 @@ FINGERPRINTS = { 36: 8, 37: 8, 166: 8, 170: 8, 180: 8, 295: 8, 296: 8, 401: 8, 426: 6, 452: 8, 466: 8, 467: 8, 550: 8, 552: 4, 560: 7, 562: 6, 581: 5, 608: 8, 610: 8, 643: 7, 713: 8, 728: 8, 740: 5, 742: 8, 743: 8, 761: 8, 765: 8, 800: 8, 810: 2, 812: 8, 829: 2, 830: 7, 835: 8, 836: 8, 863: 8, 865: 8, 869: 7, 870: 7, 871: 2, 877: 8, 881: 8, 882: 8, 885: 8, 896: 8, 898: 8, 913: 8, 921: 8, 944: 8, 945: 8, 950: 8, 951: 8, 953: 8, 955: 8, 956: 8, 971: 7, 975: 5, 993: 8, 1002: 8, 1014: 8, 1017: 8, 1020: 8, 1041: 8, 1042: 8, 1044: 8, 1056: 8, 1057: 8, 1059: 1, 1063: 8, 1071: 8, 1114: 8, 1161: 8, 1162: 8, 1163: 8, 1172: 8, 1235: 8, 1237: 8, 1279: 8, 1541: 8, 1552: 8, 1553: 8, 1556: 8, 1557: 8, 1568: 8, 1570: 8, 1571: 8, 1572: 8, 1592: 8, 1594: 8, 1595: 8, 1696: 8, 1745: 8, 1775: 8, 1779: 8 }], CAR.COROLLA_TSS2: [ + # from shell, 2019 corolla in China + { + 36: 8, 37: 8, 166: 8, 170: 8, 180: 8, 295: 8, 296: 8, 401: 8, 426: 6, 452: 8, 466: 8, 467: 8, 550: 8, 552: 4, 560: 7, 562: 6, 581: 5, 608: 8, 610: 8, 643: 7, 713: 8, 728: 8, 740: 5, 742: 8, 743: 8, 761: 8, 765: 8, 800: 8, 810: 2, 829: 2, 830: 7, 835: 8, 836: 8, 865: 8, 869: 7, 870: 7, 871: 2, 877: 8, 881: 8, 885: 8, 896: 8, 898: 8, 918: 7, 921: 8, 944: 8, 945: 8, 950: 8, 951: 8, 953: 8, 955: 8, 956: 8, 971: 7, 975: 5, 987: 8, 993: 8, 1002: 8, 1014: 8, 1017: 8, 1020: 8, 1041: 8, 1042: 8, 1044: 8, 1056: 8, 1057: 8, 1059: 1, 1071: 8, 1082: 8, 1112: 8, 1114: 8, 1161: 8, 1162: 8, 1163: 8, 1172: 8, 1235: 8, 1237: 8, 1279: 8, 1541: 8, 1552: 8, 1553: 8, 1556: 8, 1557: 8, 1568: 8, 1570: 8, 1571: 8, 1572: 8, 1592: 8, 1594: 8, 1595: 8, 1745: 8, 1775: 8, 1779: 8 + }, # hatch 2019+ and sedan 2020+ { 36: 8, 37: 8, 114: 5, 170: 8, 180: 8, 186: 4, 401: 8, 426: 6, 452: 8, 464: 8, 466: 8, 467: 8, 544: 4, 550: 8, 552: 4, 562: 6, 608: 8, 610: 8, 643: 7, 705: 8, 728: 8, 740: 5, 742: 8, 743: 8, 761: 8, 764: 8, 765: 8, 800: 8, 810: 2, 812: 8, 824: 8, 829: 2, 830: 7, 835: 8, 836: 8, 865: 8, 869: 7, 870: 7, 871: 2, 877: 8, 881: 8, 896: 8, 898: 8, 900: 6, 902: 6, 905: 8, 913: 8, 921: 8, 933: 8, 934: 8, 935: 8, 944: 8, 945: 8, 951: 8, 955: 8, 956: 8, 976: 1, 998: 5, 999: 7, 1000: 8, 1001: 8, 1002: 8, 1014: 8, 1017: 8, 1020: 8, 1041: 8, 1042: 8, 1044: 8, 1056: 8, 1059: 1, 1076: 8, 1077: 8, 1114: 8, 1161: 8, 1162: 8, 1163: 8, 1164: 8, 1165: 8, 1166: 8, 1167: 8, 1172: 8, 1235: 8, 1237: 8, 1279: 8, 1541: 8, 1552: 8, 1553: 8, 1556: 8, 1557: 8, 1568: 8, 1570: 8, 1571: 8, 1572: 8, 1592: 8, 1595: 8, 1649: 8, 1745: 8, 1775: 8, 1779: 8, 1786: 8, 1787: 8, 1788: 8, 1789: 8, 1808: 8, 1809: 8, 1816: 8, 1817: 8, 1840: 8, 1848: 8, 1904: 8, 1912: 8, 1940: 8, 1941: 8, 1948: 8, 1949: 8, 1952: 8, 1960: 8, 1981: 8, 1986: 8, 1990: 8, 1994: 8, 1998: 8, 2004: 8 From 02c4ade94883d6ee09ec49bc9eaacce523e9e7ec Mon Sep 17 00:00:00 2001 From: Arne Schwarck Date: Wed, 4 Dec 2019 20:46:39 +0100 Subject: [PATCH 3/4] Battery protection (#888) * Battery protection If your car battery voltage is lower than 0% switch off charging to stop the Eon from damaging the 12v car battery. Leaving you with a car that can not start but has a fully charged eon ;-) * add rbiasini comment && !ignition * Update Offroad_ChargeDisabled with voltage low * simplify alert * non-temporal hysteresis from @rbiasini And up the start charge limit to 12v. i.e. 50% car battery voltage * once battery power recovers to 11.500 volts charge This leaves 1v inbetween for any fluctuations that could occur. * fix indent * Fix indent of whole block It looks like sometimes when you copy and paste into the github web interface some white spacing gets added or removed. BE AWARE! --- selfdrive/boardd/boardd.cc | 12 +++++++++++- selfdrive/controls/lib/alerts_offroad.json | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/selfdrive/boardd/boardd.cc b/selfdrive/boardd/boardd.cc index b94bf3a3e..573b1aee0 100644 --- a/selfdrive/boardd/boardd.cc +++ b/selfdrive/boardd/boardd.cc @@ -57,6 +57,8 @@ bool loopback_can = false; cereal::HealthData::HwType hw_type = cereal::HealthData::HwType::UNKNOWN; bool is_pigeon = false; const uint32_t NO_IGNITION_CNT_MAX = 2 * 60 * 60 * 24 * 3; // turn off charge after 3 days +const uint32_t VBATT_START_CHARGING = 11500; +const uint32_t VBATT_PAUSE_CHARGING = 10500; uint32_t no_ignition_cnt = 0; bool connected_once = false; bool ignition_last = false; @@ -353,12 +355,20 @@ void can_health(PubSocket *publisher) { } #ifndef __x86_64__ - if ((no_ignition_cnt > NO_IGNITION_CNT_MAX) && (health.usb_power_mode == (uint8_t)(cereal::HealthData::UsbPowerMode::CDP))) { + bool cdp_mode = health.usb_power_mode == (uint8_t)(cereal::HealthData::UsbPowerMode::CDP); + bool no_ignition_exp = no_ignition_cnt > NO_IGNITION_CNT_MAX; + if ((no_ignition_exp || (health.voltage < VBATT_PAUSE_CHARGING)) && cdp_mode && !ignition) { printf("TURN OFF CHARGING!\n"); pthread_mutex_lock(&usb_lock); libusb_control_transfer(dev_handle, 0xc0, 0xe6, (uint16_t)(cereal::HealthData::UsbPowerMode::CLIENT), 0, NULL, 0, TIMEOUT); pthread_mutex_unlock(&usb_lock); } + if (!no_ignition_exp && (health.voltage > VBATT_START_CHARGING) && !cdp_mode) { + printf("TURN ON CHARGING!\n"); + pthread_mutex_lock(&usb_lock); + libusb_control_transfer(dev_handle, 0xc0, 0xe6, (uint16_t)(cereal::HealthData::UsbPowerMode::CDP), 0, NULL, 0, TIMEOUT); + pthread_mutex_unlock(&usb_lock); + } #endif // clear VIN, CarParams, and set new safety on car start diff --git a/selfdrive/controls/lib/alerts_offroad.json b/selfdrive/controls/lib/alerts_offroad.json index 534deae2f..92a41ac85 100644 --- a/selfdrive/controls/lib/alerts_offroad.json +++ b/selfdrive/controls/lib/alerts_offroad.json @@ -1,6 +1,6 @@ { "Offroad_ChargeDisabled": { - "text": "EON charging disabled after car being off for more than 3 days. Turn ignition on to start charging again.", + "text": "EON charging disabled after car being off for more than 3 days or car voltage too low. Turn ignition on to start charging again.", "severity": 0 }, "Offroad_TemperatureTooHigh": { From d8e166f7d96ed1deee8f511e2f8196ecfba836b0 Mon Sep 17 00:00:00 2001 From: dragonpilot Date: Tue, 10 Dec 2019 16:12:05 +1000 Subject: [PATCH 4/4] add 17' Civic Hatchback LX fingerprint from CFranHonda --- selfdrive/car/honda/values.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/selfdrive/car/honda/values.py b/selfdrive/car/honda/values.py index a86038fcb..f0d3b270f 100644 --- a/selfdrive/car/honda/values.py +++ b/selfdrive/car/honda/values.py @@ -84,6 +84,10 @@ FINGERPRINTS = { CAR.CIVIC_BOSCH: [{ # 2017 Civic Hatchback EX, 2019 Civic Sedan Touring Canadian, and 2018 Civic Hatchback Executive Premium 1.0L CVT European 57: 3, 148: 8, 228: 5, 304: 8, 330: 8, 344: 8, 380: 8, 399: 7, 401: 8, 420: 8, 427: 3, 428: 8, 432: 7, 441: 5, 450: 8, 460: 3, 464: 8, 470: 2, 476: 7, 477: 8, 479: 8, 490: 8, 493: 5, 495: 8, 506: 8, 545: 6, 597: 8, 662: 4, 773: 7, 777: 8, 780: 8, 795: 8, 800: 8, 804: 8, 806: 8, 808: 8, 829: 5, 862: 8, 884: 8, 891: 8, 892: 8, 927: 8, 929: 8, 985: 3, 1024: 5, 1027: 5, 1029: 8, 1036: 8, 1039: 8, 1108: 8, 1302: 8, 1322: 5, 1361: 5, 1365: 5, 1424: 5, 1600: 5, 1601: 8, 1625: 5, 1629: 5, 1633: 8, + }, + { + # 2017 Civic Hatchback LX + 228: 5, 229: 8, 513: 8, 576: 8, 577: 8, 579: 8, 580: 8, 582: 8, 583: 8, 585: 8, 586: 8, 640: 8, 641: 8, 642: 8, 643: 8, 644: 8, 645: 8, 646: 8, 647: 8, 648: 8, 649: 8, 650: 8, 651: 8, 652: 8, 653: 8, 654: 8, 655: 8, 656: 8, 657: 8, 658: 8, 659: 8, 660: 8, 661: 8, 662: 8, 663: 8, 712: 8, 713: 8, 714: 8, 715: 8, 716: 8, 717: 8, 718: 8, 719: 8, 720: 8, 721: 8, 722: 8, 723: 8, 724: 8, 725: 8, 726: 8, 727: 8, 728: 8, 729: 8, 730: 8, 731: 8, 732: 8, 733: 8, 734: 8, 735: 8, 736: 8, 737: 8, 738: 8, 739: 8, 740: 8, 741: 8, 742: 8, 743: 8, 744: 8, 745: 8, 746: 8, 747: 8, 748: 8, 749: 8, 750: 8, 751: 8, 752: 8, 753: 8, 754: 8, 755: 8, 756: 8, 757: 8, 758: 8, 759: 8, 760: 8, 761: 8, 762: 8, 763: 8, 764: 8, 765: 8, 766: 8, 767: 8, 829: 5, 1024: 4, 1040: 6, 1056: 8, 1088: 3, 1104: 8, 1641: 8, 1872: 8 }], CAR.CRV: [{ 57: 3, 145: 8, 316: 8, 340: 8, 342: 6, 344: 8, 380: 8, 398: 3, 399: 6, 401: 8, 404: 4, 420: 8, 422: 8, 426: 8, 432: 7, 464: 8, 474: 5, 476: 4, 487: 4, 490: 8, 493: 3, 506: 8, 507: 1, 512: 6, 513: 6, 542: 7, 545: 4, 597: 8, 660: 8, 661: 4, 773: 7, 777: 8, 780: 8, 800: 8, 804: 8, 808: 8, 829: 5, 882: 2, 884: 7, 888: 8, 891: 8, 892: 8, 923: 2, 929: 8, 983: 8, 985: 3, 1024: 5, 1027: 5, 1029: 8, 1033: 5, 1036: 8, 1039: 8, 1057: 5, 1064: 7, 1108: 8, 1125: 8, 1296: 8, 1365: 5, 1424: 5, 1600: 5, 1601: 8,