diff --git a/.github/workflows/selfdrive_tests.yaml b/.github/workflows/selfdrive_tests.yaml index fbc0d94194..7800323198 100644 --- a/.github/workflows/selfdrive_tests.yaml +++ b/.github/workflows/selfdrive_tests.yaml @@ -553,7 +553,7 @@ jobs: id: save_diff run: | ${{ env.RUN }} "scons -j$(nproc)" - output=$(${{ env.RUN }} "python selfdrive/debug/print_docs_diff.py --path /tmp/openpilot_cache/base_car_info") + output=$(${{ env.RUN }} "python selfdrive/debug/print_docs_diff.py --path /tmp/openpilot_cache/base_car_info") || true output="${output//$'\n'/'%0A'}" echo "::set-output name=diff::$output" - name: Find comment diff --git a/SConstruct b/SConstruct index 1209894ba4..940b2367fa 100644 --- a/SConstruct +++ b/SConstruct @@ -415,6 +415,7 @@ SConscript(['selfdrive/loggerd/SConscript']) SConscript(['selfdrive/locationd/SConscript']) SConscript(['selfdrive/sensord/SConscript']) SConscript(['selfdrive/ui/SConscript']) +SConscript(['selfdrive/navd/SConscript']) SConscript(['tools/replay/SConscript']) diff --git a/cereal b/cereal index a4c1afa3bf..1c2cba75d6 160000 --- a/cereal +++ b/cereal @@ -1 +1 @@ -Subproject commit a4c1afa3bfcbba989c128ec9b5092f6c91f4da22 +Subproject commit 1c2cba75d66383fb0d0957f9cb2f6ffebb4f8915 diff --git a/common/params.cc b/common/params.cc index c4f65a9e02..1ead28d6cd 100644 --- a/common/params.cc +++ b/common/params.cc @@ -126,6 +126,7 @@ std::unordered_map keys = { {"IsOnroad", PERSISTENT}, {"IsRHD", PERSISTENT}, {"IsTakingSnapshot", CLEAR_ON_MANAGER_START}, + {"IsTestedBranch", CLEAR_ON_MANAGER_START}, {"IsUpdateAvailable", CLEAR_ON_MANAGER_START}, {"JoystickDebugMode", CLEAR_ON_MANAGER_START | CLEAR_ON_IGNITION_OFF}, {"LaikadEphemeris", PERSISTENT | DONT_LOG}, @@ -140,6 +141,7 @@ std::unordered_map keys = { {"LiveParameters", PERSISTENT}, {"NavDestination", CLEAR_ON_MANAGER_START | CLEAR_ON_IGNITION_OFF}, {"NavSettingTime24h", PERSISTENT}, + {"NavSettingLeftSide", PERSISTENT}, {"NavdRender", PERSISTENT}, {"OpenpilotEnabledToggle", PERSISTENT}, {"PandaHeartbeatLost", CLEAR_ON_MANAGER_START | CLEAR_ON_IGNITION_OFF}, @@ -153,6 +155,7 @@ std::unordered_map keys = { {"SnoozeUpdate", CLEAR_ON_MANAGER_START | CLEAR_ON_IGNITION_OFF}, {"SshEnabled", PERSISTENT}, {"SubscriberInfo", PERSISTENT}, + {"SwitchToBranch", CLEAR_ON_MANAGER_START}, {"TermsVersion", PERSISTENT}, {"Timezone", PERSISTENT}, {"TrainingVersion", PERSISTENT}, diff --git a/docs/CARS.md b/docs/CARS.md index 754052085d..834e8e402f 100644 --- a/docs/CARS.md +++ b/docs/CARS.md @@ -2,20 +2,9 @@ A supported vehicle is one that just works when you install a comma device. Every car performs differently with openpilot, but all supported cars should provide a better experience than any stock system. -Cars are organized into three tiers: - -- Gold - The best openpilot experience. Great highway driving and beyond. -- Silver - A solid highway driving experience, but is limited by stock longitudinal. May be upgraded in the future. -- Bronze - A good highway experience, but may have limited performance in traffic and on sharp turns. - How We Rate The Cars --- -### openpilot Adaptive Cruise Control (ACC) -- - openpilot is able to control the gas and brakes. -- - openpilot is able to control the gas and brakes with some restrictions. -- - The gas and brakes are controlled by the car's stock Adaptive Cruise Control (ACC) system. - ### Stop and Go - - Adaptive Cruise Control (ACC) operates down to 0 mph. - - Adaptive Cruise Control (ACC) available only above certain speeds. See your car's manual for the minimum speed. @@ -25,211 +14,206 @@ How We Rate The Cars - - No steering control below certain speeds. ### Steering Torque -- - Car has enough steering torque to take tighter turns. -- - Car has enough steering torque for comfortable highway driving. +- - Car has enough steering torque to take tight turns. - - Limited ability to make turns. -### Actively Maintained -- - Mainline software support, harness hardware sold by comma, lots of users, primary development target. -- - Low user count, community maintained, harness hardware not sold by comma. - -**All supported cars can move between the tiers as support changes.** - -# Gold - 30 cars - -|Make|Model|Supported Package|openpilot ACC|Stop and Go|Steer to 0|Steering Torque|Actively Maintained| -|---|---|---|:---:|:---:|:---:|:---:|:---:| -|comma|body|All|||||| -|Genesis|G70 2020|All|||||| -|Hyundai|Palisade 2020-21|All|||||| -|Hyundai|Santa Fe 2019-20|All|||||| -|Hyundai|Sonata 2020-22|All|||||| -|Hyundai|Sonata Hybrid 2020-22|All|||||| -|Kia|Niro Electric 2019-20|All|||||| -|Kia|Niro Electric 2021|All|||||| -|Kia|Niro Electric 2022|All|||||| -|Kia|Telluride 2020|SCC + LKAS|||||| -|Lexus|ES 2019-22|All|||||| -|Lexus|ES Hybrid 2019-22|All|||||| -|Lexus|NX 2020-21|All|||||| -|Lexus|NX Hybrid 2020-21|All|||||| -|Lexus|RX 2020-22|All|||||| -|Lexus|UX Hybrid 2019-22|All|||||| -|Toyota|Avalon 2022|All|||||| -|Toyota|Avalon Hybrid 2022|All|||||| -|Toyota|Camry 2021-22|All||[4](#footnotes)|||| -|Toyota|Camry Hybrid 2021-22|All|||||| -|Toyota|Corolla 2020-22|All|||||| -|Toyota|Corolla Hatchback 2019-22|All|||||| -|Toyota|Corolla Hybrid 2020-22|All|||||| -|Toyota|Highlander 2020-22|All|||||| -|Toyota|Highlander Hybrid 2020-22|All|||||| -|Toyota|Mirai 2021|All|||||| -|Toyota|Prius 2021-22|All|||||| -|Toyota|Prius Prime 2021-22|All|||||| -|Toyota|RAV4 2019-21|All|||||| -|Toyota|RAV4 Hybrid 2019-21|All|||||| - -# Silver - 70 cars - -|Make|Model|Supported Package|openpilot ACC|Stop and Go|Steer to 0|Steering Torque|Actively Maintained| -|---|---|---|:---:|:---:|:---:|:---:|:---:| -|Audi|A3 2014-19|ACC + Lane Assist|||||| -|Audi|A3 Sportback e-tron 2017-18|ACC + Lane Assist|||||| -|Audi|RS3 2018|ACC + Lane Assist|||||| -|Audi|S3 2015-17|ACC + Lane Assist|||||| -|Chevrolet|Volt 2017-18[1](#footnotes)|Adaptive Cruise|||||| -|Genesis|G70 2018-19|All|||||| -|Genesis|G80 2017-19|All|||||| -|Hyundai|Elantra 2021-22|SCC + LKAS|||||| -|Hyundai|Elantra Hybrid 2021-22|SCC + LKAS|||||| -|Hyundai|Ioniq Electric 2020|SCC + LKAS|||||| -|Hyundai|Ioniq Hybrid 2020-22|SCC + LFA|||||| -|Hyundai|Ioniq Plug-in Hybrid 2020-21|SCC + LKAS|||||| -|Hyundai|Kona 2020|SCC + LKAS|||||| -|Hyundai|Kona Electric 2018-21|SCC + LKAS|||||| -|Hyundai|Kona Hybrid 2020|SCC + LKAS|||||| -|Hyundai|Santa Fe 2021-22|All|||||| -|Hyundai|Santa Fe Hybrid 2022|All|||||| -|Hyundai|Santa Fe Plug-in Hybrid 2022|All|||||| -|Hyundai|Tucson Diesel 2019|SCC + LKAS|||||| -|Kia|Ceed 2019|SCC + LKAS|||||| -|Kia|EV6 2022|All|||||| -|Kia|Forte 2018|SCC + LKAS|||||| -|Kia|Forte 2019-21|SCC + LKAS|||||| -|Kia|K5 2021-22|SCC|||||| -|Kia|Niro Hybrid 2021|SCC + LKAS|||||| -|Kia|Niro Hybrid 2022|SCC + LKAS|||||| -|Kia|Optima 2019|SCC + LKAS|||||| -|Kia|Seltos 2021|SCC + LKAS|||||| -|Kia|Sorento 2018|SCC + LKAS|||||| -|Kia|Sorento 2019|SCC + LKAS|||||| -|Kia|Stinger 2018-20|SCC + LKAS|||||| -|Lexus|CT Hybrid 2017-18|LSS|[3](#footnotes)||||| -|Lexus|ES Hybrid 2017-18|LSS|[3](#footnotes)||||| -|Lexus|NX 2018-19|All|[3](#footnotes)||||| -|Lexus|NX Hybrid 2018-19|All|[3](#footnotes)||||| -|Lexus|RX Hybrid 2020-21|All|||||| -|Nissan|Altima 2019-20|ProPILOT|||||| -|Nissan|Leaf 2018-22|ProPILOT|||||| -|Nissan|Rogue 2018-20|ProPILOT|||||| -|Nissan|X-Trail 2017|ProPILOT|||||| -|SEAT|Ateca 2018|Driver Assistance|||||| -|SEAT|Leon 2014-20|Driver Assistance|||||| -|Subaru|Ascent 2019-21|All|||||| -|Subaru|Crosstrek 2020-21|EyeSight|||||| -|Subaru|Forester 2019-22|All|||||| -|Subaru|Impreza 2020-22|EyeSight|||||| -|Subaru|XV 2020-21|EyeSight|||||| -|Toyota|Alphard 2019-20|All|||||| -|Toyota|Alphard Hybrid 2021|All|||||| -|Toyota|Camry 2018-20|All||[4](#footnotes)|||| -|Toyota|Camry Hybrid 2018-20|All||[4](#footnotes)|||| -|Toyota|Corolla Cross 2020-21 (Non-US only)|All|||||| -|Toyota|Highlander 2017-19|All|[3](#footnotes)||||| -|Toyota|Highlander Hybrid 2017-19|All|[3](#footnotes)||||| -|Toyota|Prius 2016-20|TSS-P|[3](#footnotes)||||| -|Toyota|Prius Prime 2017-20|All|[3](#footnotes)||||| -|Toyota|RAV4 2022|All|||||| -|Toyota|RAV4 Hybrid 2016-18|TSS-P|[3](#footnotes)||||| -|Toyota|RAV4 Hybrid 2022|All|||||| -|Volkswagen|Atlas 2018-19, 2022[7](#footnotes)|Driver Assistance|||||| -|Volkswagen|e-Golf 2014, 2018-20|Driver Assistance|||||| -|Volkswagen|Golf 2015-20|Driver Assistance|||||| -|Volkswagen|Golf Alltrack 2017-18|Driver Assistance|||||| -|Volkswagen|Golf GTE 2016|Driver Assistance|||||| -|Volkswagen|Golf GTI 2018-21|Driver Assistance|||||| -|Volkswagen|Golf R 2016-19|Driver Assistance|||||| -|Volkswagen|Golf SportsVan 2016|Driver Assistance|||||| -|Volkswagen|Golf SportWagen 2015|Driver Assistance|||||| -|Volkswagen|Passat 2015-19[6](#footnotes)|Driver Assistance|||||| -|Volkswagen|Polo 2020|Driver Assistance|||||| - -# Bronze - 80 cars - -|Make|Model|Supported Package|openpilot ACC|Stop and Go|Steer to 0|Steering Torque|Actively Maintained| -|---|---|---|:---:|:---:|:---:|:---:|:---:| -|Acura|ILX 2016-19|AcuraWatch Plus|||||| -|Acura|RDX 2016-18|AcuraWatch Plus|||||| -|Acura|RDX 2019-22|All|||||| -|Audi|Q2 2018|ACC + Lane Assist|||||| -|Audi|Q3 2020-21|ACC + Lane Assist|||||| -|Cadillac|Escalade ESV 2016[1](#footnotes)|ACC + LKAS|||||| -|Chrysler|Pacifica 2017-18|Adaptive Cruise|||||| -|Chrysler|Pacifica 2019-20|Adaptive Cruise|||||| -|Chrysler|Pacifica Hybrid 2017-18|Adaptive Cruise|||||| -|Chrysler|Pacifica Hybrid 2019-22|Adaptive Cruise|||||| -|Genesis|G90 2017-18|All|||||| -|GMC|Acadia 2018[1](#footnotes)|Adaptive Cruise|||||| -|Honda|Accord 2018-22|All|||||| -|Honda|Accord Hybrid 2018-22|All|||||| -|Honda|Civic 2016-18|Honda Sensing|||||| -|Honda|Civic 2019-21|All|||[2](#footnotes)||| -|Honda|Civic 2022|All|||||| -|Honda|Civic Hatchback 2017-21|Honda Sensing|||||| -|Honda|Civic Hatchback 2022|All|||||| -|Honda|CR-V 2015-16|Touring|||||| -|Honda|CR-V 2017-22|Honda Sensing|||||| -|Honda|CR-V Hybrid 2017-19|Honda Sensing|||||| -|Honda|e 2020|All|||||| -|Honda|Fit 2018-20|Honda Sensing|||||| -|Honda|Freed 2020|Honda Sensing|||||| -|Honda|HR-V 2019-22|Honda Sensing|||||| -|Honda|Insight 2019-22|All|||||| -|Honda|Inspire 2018|All|||||| -|Honda|Odyssey 2018-22|Honda Sensing|||||| -|Honda|Passport 2019-21|All|||||| -|Honda|Pilot 2016-22|Honda Sensing|||||| -|Honda|Ridgeline 2017-22|Honda Sensing|||||| -|Hyundai|Elantra 2017-19|SCC + LKAS|||||| -|Hyundai|Genesis 2015-16|SCC + LKAS|||||| -|Hyundai|Ioniq Electric 2019|SCC + LKAS|||||| -|Hyundai|Ioniq Hybrid 2017-19|SCC + LKAS|||||| -|Hyundai|Ioniq Plug-in Hybrid 2019|SCC + LKAS|||||| -|Hyundai|Sonata 2018-19|SCC + LKAS|||||| -|Hyundai|Tucson 2021|SCC + LKAS|||||| -|Hyundai|Veloster 2019-20|SCC + LKAS|||||| -|Jeep|Grand Cherokee 2016-18|Adaptive Cruise|||||| -|Jeep|Grand Cherokee 2019-21|Adaptive Cruise|||||| -|Kia|Niro Plug-in Hybrid 2019|SCC + LKAS|||||| -|Kia|Optima 2017|SCC + LKAS|||||| -|Lexus|IS 2017-19|All|||||| -|Lexus|RC 2017-2020|All|||||| -|Lexus|RX 2016-18|All|[3](#footnotes)||||| -|Lexus|RX Hybrid 2016-19|All|[3](#footnotes)||||| -|Mazda|CX-5 2022|All|||||| -|Mazda|CX-9 2021-22|All|||||| -|Ram|1500 2019-22|Adaptive Cruise|||||| -|Subaru|Crosstrek 2018-19|EyeSight|||||| -|Subaru|Impreza 2017-19|EyeSight|||||| -|Subaru|XV 2018-19|EyeSight|||||| -|Škoda|Kamiq 2021[5](#footnotes)|Driver Assistance|||||| -|Škoda|Karoq 2019|Driver Assistance|||||| -|Škoda|Kodiaq 2018-19|Driver Assistance|||||| -|Škoda|Octavia 2015, 2018-19|Driver Assistance|||||| -|Škoda|Octavia RS 2016|Driver Assistance|||||| -|Škoda|Scala 2020|Driver Assistance|||||| -|Škoda|Superb 2015-18|Driver Assistance|||||| -|Toyota|Avalon 2016-18|TSS-P|[3](#footnotes)||||| -|Toyota|Avalon 2019-21|TSS-P|[3](#footnotes)||||| -|Toyota|Avalon Hybrid 2019-21|TSS-P|[3](#footnotes)||||| -|Toyota|C-HR 2017-21|All|||||| -|Toyota|C-HR Hybrid 2017-19|All|||||| -|Toyota|Corolla 2017-19|All|[3](#footnotes)||||| -|Toyota|Prius v 2017|TSS-P|[3](#footnotes)||||| -|Toyota|RAV4 2016-18|TSS-P|[3](#footnotes)||||| -|Toyota|Sienna 2018-20|All|[3](#footnotes)||||| -|Volkswagen|Arteon 2018, 2021[7](#footnotes)|Driver Assistance|||||| -|Volkswagen|California 2021[7](#footnotes)|Driver Assistance|||||| -|Volkswagen|Caravelle 2020[7](#footnotes)|Driver Assistance|||||| -|Volkswagen|Jetta 2018-21|Driver Assistance|||||| -|Volkswagen|Jetta GLI 2021|Driver Assistance|||||| -|Volkswagen|T-Cross 2021[7](#footnotes)|Driver Assistance|||||| -|Volkswagen|T-Roc 2021[7](#footnotes)|Driver Assistance|||||| -|Volkswagen|Taos 2022[7](#footnotes)|Driver Assistance|||||| -|Volkswagen|Tiguan 2019-22[7](#footnotes)|Driver Assistance|||||| -|Volkswagen|Touran 2017|Driver Assistance|||||| +# 192 Supported Cars + +|Make|Model|Supported Package|openpilot ACC|Stop and Go|Steer to 0|Steering Torque| +|---|---|---|:---:|:---:|:---:|:---:| +|Acura|ILX 2016-19|AcuraWatch Plus||||| +|Acura|RDX 2016-18|AcuraWatch Plus||||| +|Acura|RDX 2019-22|All||||| +|Audi|A3 2014-19|ACC + Lane Assist||||| +|Audi|A3 Sportback e-tron 2017-18|ACC + Lane Assist||||| +|Audi|Q2 2018|ACC + Lane Assist||||| +|Audi|Q3 2020-21|ACC + Lane Assist||||| +|Audi|RS3 2018|ACC + Lane Assist||||| +|Audi|S3 2015-17|ACC + Lane Assist||||| +|Cadillac|Escalade ESV 2016[1](#footnotes)|ACC + LKAS||||| +|Chevrolet|Volt 2017-18[1](#footnotes)|Adaptive Cruise||||| +|Chrysler|Pacifica 2017-18|Adaptive Cruise||||| +|Chrysler|Pacifica 2019-20|Adaptive Cruise||||| +|Chrysler|Pacifica 2021|All||||| +|Chrysler|Pacifica Hybrid 2017-18|Adaptive Cruise||||| +|Chrysler|Pacifica Hybrid 2019-22|Adaptive Cruise||||| +|comma|body|All||||| +|Genesis|G70 2018-19|All||||| +|Genesis|G70 2020|All||||| +|Genesis|G80 2017-19|All||||| +|Genesis|G90 2017-18|All||||| +|GMC|Acadia 2018[1](#footnotes)|Adaptive Cruise||||| +|Honda|Accord 2018-22|All||||| +|Honda|Accord Hybrid 2018-22|All||||| +|Honda|Civic 2016-18|Honda Sensing||||| +|Honda|Civic 2019-21|All|||[2](#footnotes)|| +|Honda|Civic 2022|All||||| +|Honda|Civic Hatchback 2017-21|Honda Sensing||||| +|Honda|Civic Hatchback 2022|All||||| +|Honda|CR-V 2015-16|Touring||||| +|Honda|CR-V 2017-22|Honda Sensing||||| +|Honda|CR-V Hybrid 2017-19|Honda Sensing||||| +|Honda|e 2020|All||||| +|Honda|Fit 2018-20|Honda Sensing||||| +|Honda|Freed 2020|Honda Sensing||||| +|Honda|HR-V 2019-22|Honda Sensing||||| +|Honda|Insight 2019-22|All||||| +|Honda|Inspire 2018|All||||| +|Honda|Odyssey 2018-22|Honda Sensing||||| +|Honda|Passport 2019-21|All||||| +|Honda|Pilot 2016-22|Honda Sensing||||| +|Honda|Ridgeline 2017-22|Honda Sensing||||| +|Hyundai|Elantra 2017-19|SCC + LKAS||||| +|Hyundai|Elantra 2021-22|SCC + LKAS||||| +|Hyundai|Elantra Hybrid 2021-22|SCC + LKAS||||| +|Hyundai|Genesis 2015-16|SCC + LKAS||||| +|Hyundai|Ioniq Electric 2019|SCC + LKAS||||| +|Hyundai|Ioniq Electric 2020|SCC + LKAS||||| +|Hyundai|Ioniq Hybrid 2017-19|SCC + LKAS||||| +|Hyundai|Ioniq Hybrid 2020-22|SCC + LFA||||| +|Hyundai|Ioniq Plug-in Hybrid 2019|SCC + LKAS||||| +|Hyundai|Ioniq Plug-in Hybrid 2020-21|SCC + LKAS||||| +|Hyundai|Kona 2020|SCC + LKAS||||| +|Hyundai|Kona Electric 2018-21|SCC + LKAS||||| +|Hyundai|Kona Hybrid 2020|SCC + LKAS||||| +|Hyundai|Palisade 2020-21|All||||| +|Hyundai|Santa Fe 2019-20|All||||| +|Hyundai|Santa Fe 2021-22|All||||| +|Hyundai|Santa Fe Hybrid 2022|All||||| +|Hyundai|Santa Fe Plug-in Hybrid 2022|All||||| +|Hyundai|Sonata 2018-19|SCC + LKAS||||| +|Hyundai|Sonata 2020-22|All||||| +|Hyundai|Sonata Hybrid 2020-22|All||||| +|Hyundai|Tucson 2021|SCC + LKAS||||| +|Hyundai|Tucson Diesel 2019|SCC + LKAS||||| +|Hyundai|Veloster 2019-20|SCC + LKAS||||| +|Jeep|Grand Cherokee 2016-18|Adaptive Cruise||||| +|Jeep|Grand Cherokee 2019-21|Adaptive Cruise||||| +|Kia|Ceed 2019|SCC + LKAS||||| +|Kia|EV6 2022|All||||| +|Kia|Forte 2018|SCC + LKAS||||| +|Kia|Forte 2019-21|SCC + LKAS||||| +|Kia|K5 2021-22|SCC||||| +|Kia|Niro Electric 2019-20|All||||| +|Kia|Niro Electric 2021|All||||| +|Kia|Niro Electric 2022|All||||| +|Kia|Niro Hybrid 2021|SCC + LKAS||||| +|Kia|Niro Hybrid 2022|SCC + LKAS||||| +|Kia|Niro Plug-in Hybrid 2019|SCC + LKAS||||| +|Kia|Optima 2017|SCC + LKAS||||| +|Kia|Optima 2019|SCC + LKAS||||| +|Kia|Seltos 2021|SCC + LKAS||||| +|Kia|Sorento 2018|SCC + LKAS||||| +|Kia|Sorento 2019|SCC + LKAS||||| +|Kia|Stinger 2018-20|SCC + LKAS||||| +|Kia|Telluride 2020|SCC + LKAS||||| +|Lexus|CT Hybrid 2017-18|LSS|[3](#footnotes)|||| +|Lexus|ES 2019-22|All||||| +|Lexus|ES Hybrid 2017-18|LSS|[3](#footnotes)|||| +|Lexus|ES Hybrid 2019-22|All||||| +|Lexus|IS 2017-19|All||||| +|Lexus|NX 2018-19|All|[3](#footnotes)|||| +|Lexus|NX 2020-21|All||||| +|Lexus|NX Hybrid 2018-19|All|[3](#footnotes)|||| +|Lexus|NX Hybrid 2020-21|All||||| +|Lexus|RC 2017-20|All||||| +|Lexus|RX 2016-18|All|[3](#footnotes)|||| +|Lexus|RX 2020-22|All||||| +|Lexus|RX Hybrid 2016-19|All|[3](#footnotes)|||| +|Lexus|RX Hybrid 2020-21|All||||| +|Lexus|UX Hybrid 2019-22|All||||| +|Mazda|CX-5 2022|All||||| +|Mazda|CX-9 2021-22|All||||| +|Nissan|Altima 2019-20|ProPILOT||||| +|Nissan|Leaf 2018-22|ProPILOT||||| +|Nissan|Rogue 2018-20|ProPILOT||||| +|Nissan|X-Trail 2017|ProPILOT||||| +|Ram|1500 2019-22|Adaptive Cruise||||| +|SEAT|Ateca 2018|Driver Assistance||||| +|SEAT|Leon 2014-20|Driver Assistance||||| +|Subaru|Ascent 2019-21|All||||| +|Subaru|Crosstrek 2018-19|EyeSight||||| +|Subaru|Crosstrek 2020-21|EyeSight||||| +|Subaru|Forester 2019-22|All||||| +|Subaru|Impreza 2017-19|EyeSight||||| +|Subaru|Impreza 2020-22|EyeSight||||| +|Subaru|XV 2018-19|EyeSight||||| +|Subaru|XV 2020-21|EyeSight||||| +|Škoda|Kamiq 2021[5](#footnotes)|Driver Assistance||||| +|Škoda|Karoq 2019|Driver Assistance||||| +|Škoda|Kodiaq 2018-19|Driver Assistance||||| +|Škoda|Octavia 2015, 2018-19|Driver Assistance||||| +|Škoda|Octavia RS 2016|Driver Assistance||||| +|Škoda|Scala 2020|Driver Assistance||||| +|Škoda|Superb 2015-18|Driver Assistance||||| +|Toyota|Alphard 2019-20|All||||| +|Toyota|Alphard Hybrid 2021|All||||| +|Toyota|Avalon 2016-18|TSS-P|[3](#footnotes)|||| +|Toyota|Avalon 2019-21|TSS-P|[3](#footnotes)|||| +|Toyota|Avalon 2022|All||||| +|Toyota|Avalon Hybrid 2019-21|TSS-P|[3](#footnotes)|||| +|Toyota|Avalon Hybrid 2022|All||||| +|Toyota|C-HR 2017-21|All||||| +|Toyota|C-HR Hybrid 2017-19|All||||| +|Toyota|Camry 2018-20|All||[4](#footnotes)||| +|Toyota|Camry 2021-22|All||[4](#footnotes)||| +|Toyota|Camry Hybrid 2018-20|All||[4](#footnotes)||| +|Toyota|Camry Hybrid 2021-22|All||||| +|Toyota|Corolla 2017-19|All|[3](#footnotes)|||| +|Toyota|Corolla 2020-22|All||||| +|Toyota|Corolla Cross (Non-US only) 2020-21|All||||| +|Toyota|Corolla Cross Hybrid (Non-US only) 2020-22|All||||| +|Toyota|Corolla Hatchback 2019-22|All||||| +|Toyota|Corolla Hybrid 2020-22|All||||| +|Toyota|Highlander 2017-19|All|[3](#footnotes)|||| +|Toyota|Highlander 2020-22|All||||| +|Toyota|Highlander Hybrid 2017-19|All|[3](#footnotes)|||| +|Toyota|Highlander Hybrid 2020-22|All||||| +|Toyota|Mirai 2021|All||||| +|Toyota|Prius 2016-20|TSS-P|[3](#footnotes)|||| +|Toyota|Prius 2021-22|All||||| +|Toyota|Prius Prime 2017-20|All|[3](#footnotes)|||| +|Toyota|Prius Prime 2021-22|All||||| +|Toyota|Prius v 2017|TSS-P|[3](#footnotes)|||| +|Toyota|RAV4 2016-18|TSS-P|[3](#footnotes)|||| +|Toyota|RAV4 2019-21|All||||| +|Toyota|RAV4 2022|All||||| +|Toyota|RAV4 Hybrid 2016-18|TSS-P|[3](#footnotes)|||| +|Toyota|RAV4 Hybrid 2019-21|All||||| +|Toyota|RAV4 Hybrid 2022|All||||| +|Toyota|Sienna 2018-20|All|[3](#footnotes)|||| +|Volkswagen|Arteon 2018-22[7](#footnotes)|Driver Assistance||||| +|Volkswagen|Arteon eHybrid 2020-22[7](#footnotes)|Driver Assistance||||| +|Volkswagen|Arteon R 2020-22[7](#footnotes)|Driver Assistance||||| +|Volkswagen|Atlas 2018-22[7](#footnotes)|Driver Assistance||||| +|Volkswagen|Atlas Cross Sport 2021-22[7](#footnotes)|Driver Assistance||||| +|Volkswagen|California 2021[7](#footnotes)|Driver Assistance||||| +|Volkswagen|Caravelle 2020[7](#footnotes)|Driver Assistance||||| +|Volkswagen|CC 2018-22[7](#footnotes)|Driver Assistance||||| +|Volkswagen|e-Golf 2014-20|Driver Assistance||||| +|Volkswagen|Golf 2015-20[8](#footnotes)|Driver Assistance||||| +|Volkswagen|Golf Alltrack 2015-19|Driver Assistance||||| +|Volkswagen|Golf GTD 2015-20|Driver Assistance||||| +|Volkswagen|Golf GTE 2015-20|Driver Assistance||||| +|Volkswagen|Golf GTI 2015-21|Driver Assistance||||| +|Volkswagen|Golf R 2015-19[8](#footnotes)|Driver Assistance||||| +|Volkswagen|Golf SportsVan 2015-20|Driver Assistance||||| +|Volkswagen|Jetta 2018-22[7](#footnotes)|Driver Assistance||||| +|Volkswagen|Jetta GLI 2021-22[7](#footnotes)|Driver Assistance||||| +|Volkswagen|Passat 2015-22[7](#footnotes)|Driver Assistance||||| +|Volkswagen|Passat Alltrack 2015-22[7](#footnotes)|Driver Assistance||||| +|Volkswagen|Passat GTE 2015-22[7](#footnotes)|Driver Assistance||||| +|Volkswagen|Polo 2020-22[7](#footnotes)|Driver Assistance||||| +|Volkswagen|Polo GTI 2020-22[7](#footnotes)|Driver Assistance||||| +|Volkswagen|T-Cross 2021[7](#footnotes)|Driver Assistance||||| +|Volkswagen|T-Roc 2021[7](#footnotes)|Driver Assistance||||| +|Volkswagen|Taos 2022[7](#footnotes)|Driver Assistance||||| +|Volkswagen|Teramont 2018-22[7](#footnotes)|Driver Assistance||||| +|Volkswagen|Teramont Cross Sport 2021-22[7](#footnotes)|Driver Assistance||||| +|Volkswagen|Teramont X 2021-22[7](#footnotes)|Driver Assistance||||| +|Volkswagen|Tiguan 2019-22[7](#footnotes)|Driver Assistance||||| +|Volkswagen|Touran 2017|Driver Assistance||||| 1Requires an OBD-II car harness and community built ASCM harness. NOTE: disconnecting the ASCM disables Automatic Emergency Braking (AEB).
@@ -239,6 +223,7 @@ How We Rate The Cars 5Not including the China market Kamiq, which is based on the (currently) unsupported PQ34 platform.
6Not including the USA/China market Passat, which is based on the (currently) unsupported PQ35/NMS platform.
7Model-years 2021 and beyond may have a new camera harness design, which isn't yet available from the comma store. Before ordering, remove the Lane Assist camera cover and check to see if the connector is black (older design) or light brown (newer design). For the newer design, in the interim, choose "VW J533 Development" from the vehicle drop-down for a harness that integrates at the CAN gateway inside the dashboard.
+8Includes versions with extra rear cargo space (may be called Variant, Estate, SportWagen, Shooting Brake, etc.)
## Community Maintained Cars Although they're not upstream, the community has openpilot running on other makes and models. See the 'Community Supported Models' section of each make [on our wiki](https://wiki.comma.ai/). \ No newline at end of file diff --git a/release/files_common b/release/files_common index 38f86d247a..411e4ff6dc 100644 --- a/release/files_common +++ b/release/files_common @@ -380,7 +380,9 @@ selfdrive/modeld/runners/run.h selfdrive/monitoring/dmonitoringd.py selfdrive/monitoring/driver_monitor.py -selfdrive/navd/*.py +selfdrive/navd/__init__.py +selfdrive/navd/navd.py +selfdrive/navd/helpers.py selfdrive/assets/.gitignore selfdrive/assets/assets.qrc diff --git a/selfdrive/car/CARS_template.md b/selfdrive/car/CARS_template.md index 891445a558..8603f31434 100644 --- a/selfdrive/car/CARS_template.md +++ b/selfdrive/car/CARS_template.md @@ -5,12 +5,6 @@ A supported vehicle is one that just works when you install a comma device. Every car performs differently with openpilot, but all supported cars should provide a better experience than any stock system. -Cars are organized into three tiers: - -{% for tier in tiers %} -- {{tier.name.title()}} - {{tier.value}} -{% endfor %} - How We Rate The Cars --- @@ -23,20 +17,16 @@ How We Rate The Cars {% endfor %} {% endfor %} -**All supported cars can move between the tiers as support changes.** -{% for tier, cars in tiers.items() %} -# {{tier.name.title()}} - {{cars | length}} cars +# {{all_car_info | length}} Supported Cars |{{Column | map(attribute='value') | join('|')}}| -|---|---|---|:---:|:---:|:---:|:---:|:---:| -{% for car_info in cars %} +|---|---|---|:---:|:---:|:---:|:---:| +{% for car_info in all_car_info %} |{% for column in Column %}{{car_info.get_column(column, star_icon, footnote_tag)}}|{% endfor %} {% endfor %} -{% endfor %} - {% for footnote in footnotes %} {{loop.index}}{{footnote}}
diff --git a/selfdrive/car/chrysler/values.py b/selfdrive/car/chrysler/values.py index 80baba9bd6..5a979776ec 100644 --- a/selfdrive/car/chrysler/values.py +++ b/selfdrive/car/chrysler/values.py @@ -14,7 +14,7 @@ class CAR: PACIFICA_2017_HYBRID = "CHRYSLER PACIFICA HYBRID 2017" PACIFICA_2018_HYBRID = "CHRYSLER PACIFICA HYBRID 2018" PACIFICA_2019_HYBRID = "CHRYSLER PACIFICA HYBRID 2019" - PACIFICA_2018 = "CHRYSLER PACIFICA 2018" # includes 2017 Pacifica + PACIFICA_2018 = "CHRYSLER PACIFICA 2018" PACIFICA_2020 = "CHRYSLER PACIFICA 2020" # Jeep @@ -51,7 +51,10 @@ CAR_INFO: Dict[str, Optional[Union[ChryslerCarInfo, List[ChryslerCarInfo]]]] = { CAR.PACIFICA_2018_HYBRID: None, # same platforms CAR.PACIFICA_2019_HYBRID: ChryslerCarInfo("Chrysler Pacifica Hybrid 2019-22"), CAR.PACIFICA_2018: ChryslerCarInfo("Chrysler Pacifica 2017-18"), - CAR.PACIFICA_2020: ChryslerCarInfo("Chrysler Pacifica 2019-20"), + CAR.PACIFICA_2020: [ + ChryslerCarInfo("Chrysler Pacifica 2019-20"), + ChryslerCarInfo("Chrysler Pacifica 2021", package="All"), + ], CAR.JEEP_CHEROKEE: ChryslerCarInfo("Jeep Grand Cherokee 2016-18", video_link="https://www.youtube.com/watch?v=eLR9o2JkuRk"), CAR.JEEP_CHEROKEE_2019: ChryslerCarInfo("Jeep Grand Cherokee 2019-21", video_link="https://www.youtube.com/watch?v=jBe4lWnRSu4"), CAR.RAM_1500: ChryslerCarInfo("Ram 1500 2019-22"), diff --git a/selfdrive/car/docs.py b/selfdrive/car/docs.py index 860503dbdd..eb2f1923c8 100755 --- a/selfdrive/car/docs.py +++ b/selfdrive/car/docs.py @@ -7,10 +7,9 @@ from natsort import natsorted from typing import Dict, List from common.basedir import BASEDIR -from selfdrive.car.docs_definitions import STAR_DESCRIPTIONS, CarInfo, Column, Star, Tier +from selfdrive.car.docs_definitions import STAR_DESCRIPTIONS, StarColumns, TierColumns, CarInfo, Column, Star from selfdrive.car.car_helpers import interfaces, get_interface_attr from selfdrive.car.hyundai.radar_interface import RADAR_START_ADDR as HKG_RADAR_START_ADDR -from selfdrive.car.tests.routes import non_tested_cars def get_all_footnotes() -> Dict[Enum, int]: @@ -40,32 +39,28 @@ def get_all_car_info() -> List[CarInfo]: car_info = (car_info,) for _car_info in car_info: - all_car_info.append(_car_info.init(CP, non_tested_cars, ALL_FOOTNOTES)) + all_car_info.append(_car_info.init(CP, ALL_FOOTNOTES)) # Sort cars by make and model + year - sorted_cars: List[CarInfo] = natsorted(all_car_info, key=lambda car: (car.make + car.model).lower()) + sorted_cars: List[CarInfo] = natsorted(all_car_info, key=lambda car: car.name.lower()) return sorted_cars -def sort_by_tier(all_car_info: List[CarInfo]) -> Dict[Tier, List[CarInfo]]: - tier_car_info: Dict[Tier, List[CarInfo]] = {tier: [] for tier in Tier} - for car_info in all_car_info: - tier_car_info[car_info.tier].append(car_info) - - # Sort cars by make and model + year - for tier, cars in tier_car_info.items(): - tier_car_info[tier] = natsorted(cars, key=lambda car: (car.make + car.model).lower()) - - return tier_car_info - - -def generate_cars_md(all_car_info: List[CarInfo], template_fn: str) -> str: +def generate_cars_md(all_car_info: List[CarInfo], template_fn: str, only_tier_cols: bool) -> str: with open(template_fn, "r") as f: template = jinja2.Template(f.read(), trim_blocks=True, lstrip_blocks=True) + cols = list(Column) + if only_tier_cols: + hide_cols = set(StarColumns) - set(TierColumns) + cols = [c for c in cols if c not in hide_cols] + for car in all_car_info: + for c in hide_cols: + del car.row[c] + footnotes = [fn.value.text for fn in ALL_FOOTNOTES] - cars_md: str = template.render(tiers=sort_by_tier(all_car_info), all_car_info=all_car_info, - footnotes=footnotes, Star=Star, Column=Column, star_descriptions=STAR_DESCRIPTIONS) + cars_md: str = template.render(all_car_info=all_car_info, + footnotes=footnotes, Star=Star, Column=cols, star_descriptions=STAR_DESCRIPTIONS) return cars_md @@ -73,10 +68,11 @@ if __name__ == "__main__": parser = argparse.ArgumentParser(description="Auto generates supported cars documentation", formatter_class=argparse.ArgumentDefaultsHelpFormatter) + parser.add_argument("--tier-columns", action="store_true", help="Include only columns that count in the tier") parser.add_argument("--template", default=CARS_MD_TEMPLATE, help="Override default template filename") parser.add_argument("--out", default=CARS_MD_OUT, help="Override default generated filename") args = parser.parse_args() with open(args.out, 'w') as f: - f.write(generate_cars_md(get_all_car_info(), args.template)) + f.write(generate_cars_md(get_all_car_info(), args.template, args.tier_columns)) print(f"Generated and written to {args.out}") diff --git a/selfdrive/car/docs_definitions.py b/selfdrive/car/docs_definitions.py index 1efa23037f..3c58b30436 100644 --- a/selfdrive/car/docs_definitions.py +++ b/selfdrive/car/docs_definitions.py @@ -1,20 +1,19 @@ -import math +import re from cereal import car from collections import namedtuple from dataclasses import dataclass from enum import Enum -from typing import Dict, List, Optional, Union, no_type_check +from typing import Dict, List, Optional, Tuple, Union, no_type_check -TACO_TORQUE_THRESHOLD = 2.5 # m/s^2 -GREAT_TORQUE_THRESHOLD = 1.4 # m/s^2 GOOD_TORQUE_THRESHOLD = 1.0 # m/s^2 +MODEL_YEARS_RE = r"(?<= )((\d{4}-\d{2})|(\d{4}))(,|$)" class Tier(Enum): - GOLD = "The best openpilot experience. Great highway driving and beyond." - SILVER = "A solid highway driving experience, but is limited by stock longitudinal. May be upgraded in the future." - BRONZE = "A good highway experience, but may have limited performance in traffic and on sharp turns." + GOLD = 0 + SILVER = 1 + BRONZE = 2 class Column(Enum): @@ -25,7 +24,6 @@ class Column(Enum): FSR_LONGITUDINAL = "Stop and Go" FSR_STEERING = "Steer to 0" STEERING_TORQUE = "Steering Torque" - MAINTAINED = "Actively Maintained" class Star(Enum): @@ -35,6 +33,7 @@ class Star(Enum): StarColumns = list(Column)[3:] +TierColumns = (Column.FSR_LONGITUDINAL, Column.FSR_STEERING, Column.STEERING_TORQUE) CarFootnote = namedtuple("CarFootnote", ["text", "column", "star"], defaults=[None]) @@ -47,6 +46,16 @@ def get_footnote(footnotes: Optional[List[Enum]], column: Column) -> Optional[En return None +def split_name(name: str) -> Tuple[str, str, str]: + make, model = name.split(" ", 1) + years = "" + match = re.search(MODEL_YEARS_RE, model) + if match is not None: + years = model[match.start():] + model = model[:match.start() - 1] + return make, model, years + + @dataclass class CarInfo: name: str @@ -57,7 +66,7 @@ class CarInfo: min_enable_speed: Optional[float] = None harness: Optional[Enum] = None - def init(self, CP: car.CarParams, non_tested_cars: List[str], all_footnotes: Dict[Enum, int]): + def init(self, CP: car.CarParams, all_footnotes: Dict[Enum, int]): # TODO: set all the min steer speeds in carParams and remove this min_steer_speed = CP.minSteerSpeed if self.min_steer_speed is not None: @@ -72,7 +81,8 @@ class CarInfo: min_enable_speed = self.min_enable_speed self.car_name = CP.carName - self.make, self.model = self.name.split(' ', 1) + self.car_fingerprint = CP.carFingerprint + self.make, self.model, self.years = split_name(self.name) self.row = { Column.MAKE: self.make, Column.MODEL: self.model, @@ -81,18 +91,13 @@ class CarInfo: Column.LONGITUDINAL: Star.FULL if CP.openpilotLongitudinalControl and not CP.radarOffCan else Star.EMPTY, Column.FSR_LONGITUDINAL: Star.FULL if min_enable_speed <= 0. else Star.EMPTY, Column.FSR_STEERING: Star.FULL if min_steer_speed <= 0. else Star.EMPTY, - # Column.STEERING_TORQUE set below - Column.MAINTAINED: Star.FULL if CP.carFingerprint not in non_tested_cars and self.harness is not Harness.none else Star.EMPTY, + Column.STEERING_TORQUE: Star.EMPTY, } # Set steering torque star from max lateral acceleration - if not math.isnan(CP.maxLateralAccel): - if CP.maxLateralAccel >= GREAT_TORQUE_THRESHOLD: - self.row[Column.STEERING_TORQUE] = Star.FULL - elif CP.maxLateralAccel >= GOOD_TORQUE_THRESHOLD: - self.row[Column.STEERING_TORQUE] = Star.HALF - else: - self.row[Column.STEERING_TORQUE] = Star.EMPTY + assert CP.maxLateralAccel > 0.1 + if CP.maxLateralAccel >= GOOD_TORQUE_THRESHOLD: + self.row[Column.STEERING_TORQUE] = Star.FULL if CP.notCar: for col in StarColumns: @@ -105,7 +110,15 @@ class CarInfo: if footnote is not None and footnote.value.star is not None: self.row[column] = footnote.value.star - self.tier = {5: Tier.GOLD, 4: Tier.SILVER}.get(list(self.row.values()).count(Star.FULL), Tier.BRONZE) + # openpilot ACC star doesn't count for tiers + full_stars = [s for col, s in self.row.items() if col in TierColumns].count(Star.FULL) + if full_stars == len(TierColumns): + self.tier = Tier.GOLD + elif full_stars == len(TierColumns) - 1: + self.tier = Tier.SILVER + else: + self.tier = Tier.BRONZE + return self @no_type_check @@ -113,6 +126,8 @@ class CarInfo: item: Union[str, Star] = self.row[column] if column in StarColumns: item = star_icon.format(item.value) + elif column == Column.MODEL and len(self.years): + item += f" {self.years}" footnote = get_footnote(self.footnotes, column) if footnote is not None: @@ -156,11 +171,6 @@ class Harness(Enum): STAR_DESCRIPTIONS = { "Gas & Brakes": { # icon and row name - "openpilot Adaptive Cruise Control (ACC)": [ # star column - [Star.FULL.value, "openpilot is able to control the gas and brakes."], - [Star.HALF.value, "openpilot is able to control the gas and brakes with some restrictions."], - [Star.EMPTY.value, "The gas and brakes are controlled by the car's stock Adaptive Cruise Control (ACC) system."], - ], Column.FSR_LONGITUDINAL.value: [ [Star.FULL.value, "Adaptive Cruise Control (ACC) operates down to 0 mph."], [Star.EMPTY.value, "Adaptive Cruise Control (ACC) available only above certain speeds. See your car's manual for the minimum speed."], @@ -172,15 +182,8 @@ STAR_DESCRIPTIONS = { [Star.EMPTY.value, "No steering control below certain speeds."], ], Column.STEERING_TORQUE.value: [ - [Star.FULL.value, "Car has enough steering torque to take tighter turns."], - [Star.HALF.value, "Car has enough steering torque for comfortable highway driving."], + [Star.FULL.value, "Car has enough steering torque to take tight turns."], [Star.EMPTY.value, "Limited ability to make turns."], ], }, - "Support": { - Column.MAINTAINED.value: [ - [Star.FULL.value, "Mainline software support, harness hardware sold by comma, lots of users, primary development target."], - [Star.EMPTY.value, "Low user count, community maintained, harness hardware not sold by comma."], - ], - }, } diff --git a/selfdrive/car/fw_versions.py b/selfdrive/car/fw_versions.py index 5a33cdf6b7..ee2c0f31d4 100755 --- a/selfdrive/car/fw_versions.py +++ b/selfdrive/car/fw_versions.py @@ -99,6 +99,11 @@ CHRYSLER_VERSION_RESPONSE = bytes([uds.SERVICE_TYPE.READ_DATA_BY_IDENTIFIER + 0x CHRYSLER_RX_OFFSET = -0x280 +FORD_VERSION_REQUEST = bytes([uds.SERVICE_TYPE.READ_DATA_BY_IDENTIFIER]) + \ + p16(uds.DATA_IDENTIFIER_TYPE.VEHICLE_MANUFACTURER_ECU_SOFTWARE_NUMBER) +FORD_VERSION_RESPONSE = bytes([uds.SERVICE_TYPE.READ_DATA_BY_IDENTIFIER + 0x40]) + \ + p16(uds.DATA_IDENTIFIER_TYPE.VEHICLE_MANUFACTURER_ECU_SOFTWARE_NUMBER) + @dataclass class Request: @@ -207,6 +212,20 @@ REQUESTS: List[Request] = [ [CHRYSLER_VERSION_REQUEST], [CHRYSLER_VERSION_RESPONSE], ), + # Ford + Request( + "ford", + [TESTER_PRESENT_REQUEST, FORD_VERSION_REQUEST], + [TESTER_PRESENT_RESPONSE, FORD_VERSION_RESPONSE], + whitelist_ecus=[Ecu.engine], + ), + Request( + "ford", + [TESTER_PRESENT_REQUEST, FORD_VERSION_REQUEST], + [TESTER_PRESENT_RESPONSE, FORD_VERSION_RESPONSE], + bus=0, + whitelist_ecus=[Ecu.eps, Ecu.esp, Ecu.fwdRadar, Ecu.fwdCamera], + ), ] @@ -216,13 +235,13 @@ def chunks(l, n=128): def build_fw_dict(fw_versions, filter_brand=None): - fw_versions_dict = {} + fw_versions_dict = defaultdict(set) for fw in fw_versions: if filter_brand is None or fw.brand == filter_brand: addr = fw.address sub_addr = fw.subAddress if fw.subAddress != 0 else None - fw_versions_dict[(addr, sub_addr)] = fw.fwVersion - return fw_versions_dict + fw_versions_dict[(addr, sub_addr)].add(fw.fwVersion) + return dict(fw_versions_dict) def get_brand_addrs(): @@ -259,17 +278,18 @@ def match_fw_to_car_fuzzy(fw_versions_dict, log=True, exclude=None): match_count = 0 candidate = None - for addr, version in fw_versions_dict.items(): - # All cars that have this FW response on the specified address - candidates = all_fw_versions[(addr[0], addr[1], version)] - - if len(candidates) == 1: - match_count += 1 - if candidate is None: - candidate = candidates[0] - # We uniquely matched two different cars. No fuzzy match possible - elif candidate != candidates[0]: - return set() + for addr, versions in fw_versions_dict.items(): + for version in versions: + # All cars that have this FW response on the specified address + candidates = all_fw_versions[(addr[0], addr[1], version)] + + if len(candidates) == 1: + match_count += 1 + if candidate is None: + candidate = candidates[0] + # We uniquely matched two different cars. No fuzzy match possible + elif candidate != candidates[0]: + return set() if match_count >= 2: if log: @@ -291,23 +311,23 @@ def match_fw_to_car_exact(fw_versions_dict): for ecu, expected_versions in fws.items(): ecu_type = ecu[0] addr = ecu[1:] - found_version = fw_versions_dict.get(addr, None) - if ecu_type == Ecu.esp and candidate in (TOYOTA.RAV4, TOYOTA.COROLLA, TOYOTA.HIGHLANDER, TOYOTA.SIENNA, TOYOTA.LEXUS_IS) and found_version is None: + found_versions = fw_versions_dict.get(addr, set()) + if ecu_type == Ecu.esp and candidate in (TOYOTA.RAV4, TOYOTA.COROLLA, TOYOTA.HIGHLANDER, TOYOTA.SIENNA, TOYOTA.LEXUS_IS) and not len(found_versions): continue # On some Toyota models, the engine can show on two different addresses - if ecu_type == Ecu.engine and candidate in (TOYOTA.CAMRY, TOYOTA.COROLLA_TSS2, TOYOTA.CHR, TOYOTA.LEXUS_IS) and found_version is None: + if ecu_type == Ecu.engine and candidate in (TOYOTA.CAMRY, TOYOTA.COROLLA_TSS2, TOYOTA.CHR, TOYOTA.LEXUS_IS) and not len(found_versions): continue # Ignore non essential ecus - if ecu_type not in ESSENTIAL_ECUS and found_version is None: + if ecu_type not in ESSENTIAL_ECUS and not len(found_versions): continue # Virtual debug ecu doesn't need to match the database if ecu_type == Ecu.debug: continue - if found_version not in expected_versions: + if not any([found_version in expected_versions for found_version in found_versions]): invalid.append(candidate) break @@ -315,19 +335,16 @@ def match_fw_to_car_exact(fw_versions_dict): def match_fw_to_car(fw_versions, allow_fuzzy=True): - versions = get_interface_attr('FW_VERSIONS', ignore_none=True) - # Try exact matching first exact_matches = [(True, match_fw_to_car_exact)] if allow_fuzzy: exact_matches.append((False, match_fw_to_car_fuzzy)) for exact_match, match_func in exact_matches: - # For each brand, attempt to fingerprint using FW returned from its queries + # TODO: For each brand, attempt to fingerprint using only FW returned from its queries matches = set() - for brand in versions.keys(): - fw_versions_dict = build_fw_dict(fw_versions, filter_brand=brand) - matches |= match_func(fw_versions_dict) + fw_versions_dict = build_fw_dict(fw_versions, filter_brand=None) + matches |= match_func(fw_versions_dict) if len(matches): return exact_match, matches @@ -396,7 +413,9 @@ def get_fw_versions_ordered(logcan, sendcan, ecu_rx_addrs, timeout=0.1, debug=Fa for brand in sorted(brand_matches, key=lambda b: len(brand_matches[b]), reverse=True): car_fw = get_fw_versions(logcan, sendcan, query_brand=brand, timeout=timeout, debug=debug, progress=progress) all_car_fw.extend(car_fw) - matches = match_fw_to_car_exact(build_fw_dict(car_fw)) + + # TODO: Until erroneous FW versions are removed, try to fingerprint on all possible combinations so far + _, matches = match_fw_to_car(all_car_fw, allow_fuzzy=False) if len(matches) == 1: break diff --git a/selfdrive/car/honda/values.py b/selfdrive/car/honda/values.py index c665b1cd03..3ce467e298 100644 --- a/selfdrive/car/honda/values.py +++ b/selfdrive/car/honda/values.py @@ -1407,6 +1407,7 @@ FW_VERSIONS = { b'38897-T20-A510\x00\x00', b'38897-T21-A010\x00\x00', b'38897-T20-A210\x00\x00', + b'38897-T20-A310\x00\x00', ], (Ecu.srs, 0x18DA53F1, None): [ b'77959-T20-A970\x00\x00', @@ -1417,6 +1418,7 @@ FW_VERSIONS = { b'78108-T21-A620\x00\x00', b'78108-T23-A110\x00\x00', b'78108-T21-A230\x00\x00', + b'78108-T22-A020\x00\x00', ], (Ecu.vsa, 0x18DA28F1, None): [ b'57114-T20-AB40\x00\x00', @@ -1426,12 +1428,14 @@ FW_VERSIONS = { b'28101-65D-A020\x00\x00', b'28101-65D-A120\x00\x00', b'28101-65H-A020\x00\x00', + b'28101-65H-A120\x00\x00', ], (Ecu.programmedFuelInjection, 0x18da10f1, None): [ b'37805-64L-A540\x00\x00', b'37805-64S-A540\x00\x00', b'37805-64S-A720\x00\x00', b'37805-64A-A540\x00\x00', + b'37805-64A-A620\x00\x00', ], }, } diff --git a/selfdrive/car/hyundai/values.py b/selfdrive/car/hyundai/values.py index ffa29c60d4..1567544745 100644 --- a/selfdrive/car/hyundai/values.py +++ b/selfdrive/car/hyundai/values.py @@ -617,6 +617,7 @@ FW_VERSIONS = { b'\xf1\x82TACVN5GSI3XXXH0A', b'\xf1\x82TMCFD5MMCXXXXG0A', b'\xf1\x870\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xf1\x82TMDWN5TMD3TXXJ1A', + b'\xf1\x81HM6M2_0a0_G00', ], (Ecu.eps, 0x7d4, None): [ b'\xf1\x00TM MDPS C 1.00 1.02 56370-S2AA0 0B19', @@ -635,6 +636,7 @@ FW_VERSIONS = { b'\xf1\x87954A02N250\x00\x00\x00\x00\x00\xf1\x81T02730A1 \xf1\x00T02601BL T02730A1 VTMPT25XXX730NS2\xa6\x06\x88\xf7', b'\xf1\x87KMMYBU034207SB72x\x89\x88\x98h\x88\x98\x89\x87fhvvfWf33_\xff\x87\xff\x8f\xfa\x81\xe5\xf1\x89HT6TAF00A1\xf1\x82STM0M25GS1\x00\x00\x00\x00\x00\x00', b'\xf1\x87954A02N250\x00\x00\x00\x00\x00\xf1\x81T02730A1 \xf1\x00T02601BL T02730A1 VTMPT25XXX730NS2\xa6', + b'\xf1\x00HT6TA290BLHT6TAF00A1STM0M25GS1\x00\x00\x00\x00\x00\x006\xd8\x97\x15', ], }, CAR.SANTA_FE_HEV_2022: { diff --git a/selfdrive/car/tests/test_docs.py b/selfdrive/car/tests/test_docs.py index 98c909a9be..e31ad0d5c1 100755 --- a/selfdrive/car/tests/test_docs.py +++ b/selfdrive/car/tests/test_docs.py @@ -1,9 +1,11 @@ #!/usr/bin/env python3 +import re import unittest from selfdrive.car.car_helpers import interfaces, get_interface_attr from selfdrive.car.docs import CARS_MD_OUT, CARS_MD_TEMPLATE, generate_cars_md, get_all_car_info from selfdrive.car.docs_definitions import Column, Star +from selfdrive.car.honda.values import CAR as HONDA class TestCarDocs(unittest.TestCase): @@ -11,7 +13,7 @@ class TestCarDocs(unittest.TestCase): self.all_cars = get_all_car_info() def test_generator(self): - generated_cars_md = generate_cars_md(self.all_cars, CARS_MD_TEMPLATE) + generated_cars_md = generate_cars_md(self.all_cars, CARS_MD_TEMPLATE, False) with open(CARS_MD_OUT, "r") as f: current_cars_md = f.read() @@ -43,11 +45,17 @@ class TestCarDocs(unittest.TestCase): # Asserts brand-specific assumptions around steering torque star for car in self.all_cars: with self.subTest(car=car): - if car.car_name == "honda": - self.assertIn(car.row[Column.STEERING_TORQUE], (Star.EMPTY, Star.HALF), f"{car.name} has full torque star") + # honda sanity check, it's the definition of a no torque star + if car.car_fingerprint in (HONDA.ACCORD, HONDA.CIVIC, HONDA.CRV, HONDA.ODYSSEY, HONDA.PILOT): + self.assertEqual(car.row[Column.STEERING_TORQUE], Star.EMPTY, f"{car.name} has full torque star") elif car.car_name in ("toyota", "hyundai"): self.assertNotEqual(car.row[Column.STEERING_TORQUE], Star.EMPTY, f"{car.name} has no torque star") + def test_year_format(self): + for car in self.all_cars: + with self.subTest(car=car): + self.assertIsNone(re.search(r"\d{4}-\d{4}", car.name), f"Format years correctly: {car.name}") + if __name__ == "__main__": unittest.main() diff --git a/selfdrive/car/toyota/interface.py b/selfdrive/car/toyota/interface.py index 337c039565..21a5d47f62 100644 --- a/selfdrive/car/toyota/interface.py +++ b/selfdrive/car/toyota/interface.py @@ -93,20 +93,12 @@ class CarInterface(CarInterfaceBase): if candidate not in (CAR.CAMRY_TSS2, CAR.CAMRYH_TSS2): set_lat_tune(ret.lateralTuning, LatTunes.PID_C) - elif candidate in (CAR.HIGHLANDER_TSS2, CAR.HIGHLANDERH_TSS2): + elif candidate in (CAR.HIGHLANDER, CAR.HIGHLANDERH, CAR.HIGHLANDER_TSS2, CAR.HIGHLANDERH_TSS2): stop_and_go = True - ret.wheelbase = 2.84988 # 112.2 in = 2.84988 m + ret.wheelbase = 2.8194 # average of 109.8 and 112.2 in ret.steerRatio = 16.0 tire_stiffness_factor = 0.8 - ret.mass = 4700. * CV.LB_TO_KG + STD_CARGO_KG # 4260 + 4-5 people - set_lat_tune(ret.lateralTuning, LatTunes.PID_G) - - elif candidate in (CAR.HIGHLANDER, CAR.HIGHLANDERH): - stop_and_go = True - ret.wheelbase = 2.78 - ret.steerRatio = 16.0 - tire_stiffness_factor = 0.8 - ret.mass = 4607. * CV.LB_TO_KG + STD_CARGO_KG # mean between normal and hybrid limited + ret.mass = 4516. * CV.LB_TO_KG + STD_CARGO_KG # mean between normal and hybrid set_lat_tune(ret.lateralTuning, LatTunes.PID_G) elif candidate in (CAR.AVALON, CAR.AVALON_2019, CAR.AVALONH_2019, CAR.AVALON_TSS2, CAR.AVALONH_TSS2): diff --git a/selfdrive/car/toyota/values.py b/selfdrive/car/toyota/values.py index 63b7240e2f..2bbf951d78 100644 --- a/selfdrive/car/toyota/values.py +++ b/selfdrive/car/toyota/values.py @@ -119,11 +119,12 @@ CAR_INFO: Dict[str, Union[ToyotaCarInfo, List[ToyotaCarInfo]]] = { CAR.COROLLA: ToyotaCarInfo("Toyota Corolla 2017-19", footnotes=[Footnote.DSU]), CAR.COROLLA_TSS2: [ ToyotaCarInfo("Toyota Corolla 2020-22", video_link="https://www.youtube.com/watch?v=_66pXk0CBYA"), - ToyotaCarInfo("Toyota Corolla Cross 2020-21 (Non-US only)", min_enable_speed=7.5), + ToyotaCarInfo("Toyota Corolla Cross (Non-US only) 2020-21", min_enable_speed=7.5), ToyotaCarInfo("Toyota Corolla Hatchback 2019-22", video_link="https://www.youtube.com/watch?v=_66pXk0CBYA"), ], CAR.COROLLAH_TSS2: [ ToyotaCarInfo("Toyota Corolla Hybrid 2020-22"), + ToyotaCarInfo("Toyota Corolla Cross Hybrid (Non-US only) 2020-22", min_enable_speed=7.5), ToyotaCarInfo("Lexus UX Hybrid 2019-22"), ], CAR.HIGHLANDER: ToyotaCarInfo("Toyota Highlander 2017-19", video_link="https://www.youtube.com/watch?v=0wS0wXSLzoo", footnotes=[Footnote.DSU]), @@ -140,7 +141,7 @@ CAR_INFO: Dict[str, Union[ToyotaCarInfo, List[ToyotaCarInfo]]] = { ToyotaCarInfo("Toyota Prius Prime 2021-22", video_link="https://www.youtube.com/watch?v=J58TvCpUd4U"), ], CAR.RAV4: ToyotaCarInfo("Toyota RAV4 2016-18", "TSS-P", footnotes=[Footnote.DSU]), - CAR.RAV4H: ToyotaCarInfo("Toyota RAV4 Hybrid 2016-18", "TSS-P", footnotes=[Footnote.DSU]), + CAR.RAV4H: ToyotaCarInfo("Toyota RAV4 Hybrid 2016-18", "TSS-P", video_link="https://youtu.be/LhT5VzJVfNI?t=26", footnotes=[Footnote.DSU]), CAR.RAV4_TSS2: ToyotaCarInfo("Toyota RAV4 2019-21", video_link="https://www.youtube.com/watch?v=wJxjDd42gGA"), CAR.RAV4_TSS2_2022: ToyotaCarInfo("Toyota RAV4 2022"), CAR.RAV4H_TSS2: ToyotaCarInfo("Toyota RAV4 Hybrid 2019-21"), @@ -158,7 +159,7 @@ CAR_INFO: Dict[str, Union[ToyotaCarInfo, List[ToyotaCarInfo]]] = { CAR.LEXUS_NXH: ToyotaCarInfo("Lexus NX Hybrid 2018-19", footnotes=[Footnote.DSU]), CAR.LEXUS_NX_TSS2: ToyotaCarInfo("Lexus NX 2020-21"), CAR.LEXUS_NXH_TSS2: ToyotaCarInfo("Lexus NX Hybrid 2020-21"), - CAR.LEXUS_RC: ToyotaCarInfo("Lexus RC 2017-2020"), + CAR.LEXUS_RC: ToyotaCarInfo("Lexus RC 2017-20"), CAR.LEXUS_RX: ToyotaCarInfo("Lexus RX 2016-18", footnotes=[Footnote.DSU]), CAR.LEXUS_RXH: ToyotaCarInfo("Lexus RX Hybrid 2016-19", footnotes=[Footnote.DSU]), CAR.LEXUS_RX_TSS2: ToyotaCarInfo("Lexus RX 2020-22"), @@ -788,6 +789,7 @@ FW_VERSIONS = { (Ecu.eps, 0x7a1, None): [ b'8965B12361\x00\x00\x00\x00\x00\x00', b'8965B12451\x00\x00\x00\x00\x00\x00', + b'8965B16011\x00\x00\x00\x00\x00\x00', b'8965B76012\x00\x00\x00\x00\x00\x00', b'8965B76050\x00\x00\x00\x00\x00\x00', b'\x018965B12350\x00\x00\x00\x00\x00\x00', @@ -808,15 +810,16 @@ FW_VERSIONS = { b'F152612800\x00\x00\x00\x00\x00\x00', b'F152612820\x00\x00\x00\x00\x00\x00', b'F152612840\x00\x00\x00\x00\x00\x00', + b'F152612842\x00\x00\x00\x00\x00\x00', b'F152612890\x00\x00\x00\x00\x00\x00', b'F152612A00\x00\x00\x00\x00\x00\x00', b'F152612A10\x00\x00\x00\x00\x00\x00', + b'F152612D00\x00\x00\x00\x00\x00\x00', + b'F152616011\x00\x00\x00\x00\x00\x00', b'F152642540\x00\x00\x00\x00\x00\x00', b'F152676293\x00\x00\x00\x00\x00\x00', b'F152676303\x00\x00\x00\x00\x00\x00', b'F152676304\x00\x00\x00\x00\x00\x00', - b'F152612D00\x00\x00\x00\x00\x00\x00', - b'F152612842\x00\x00\x00\x00\x00\x00', ], (Ecu.fwdRadar, 0x750, 0xf): [ b'\x018821F3301100\x00\x00\x00\x00', @@ -832,6 +835,7 @@ FW_VERSIONS = { b'\x028646F1202000\x00\x00\x00\x008646G2601200\x00\x00\x00\x00', b'\x028646F1202100\x00\x00\x00\x008646G2601400\x00\x00\x00\x00', b'\x028646F1202200\x00\x00\x00\x008646G2601500\x00\x00\x00\x00', + b'\x028646F1601100\x00\x00\x00\x008646G2601400\x00\x00\x00\x00', b"\x028646F1601300\x00\x00\x00\x008646G2601400\x00\x00\x00\x00", b'\x028646F4203400\x00\x00\x00\x008646G2601200\x00\x00\x00\x00', b'\x028646F76020C0\x00\x00\x00\x008646G26011A0\x00\x00\x00\x00', diff --git a/selfdrive/car/volkswagen/values.py b/selfdrive/car/volkswagen/values.py index 42f2240f03..0b9b8d1cb1 100755 --- a/selfdrive/car/volkswagen/values.py +++ b/selfdrive/car/volkswagen/values.py @@ -109,6 +109,9 @@ class Footnote(Enum): "(older design) or light brown (newer design). For the newer design, in the interim, choose \"VW J533 Development\" " + "from the vehicle drop-down for a harness that integrates at the CAN gateway inside the dashboard.", Column.MODEL) + VW_VARIANT = CarFootnote( + "Includes versions with extra rear cargo space (may be called Variant, Estate, SportWagen, Shooting Brake, etc.)", + Column.MODEL) @dataclass @@ -118,24 +121,42 @@ class VWCarInfo(CarInfo): CAR_INFO: Dict[str, Union[VWCarInfo, List[VWCarInfo]]] = { - CAR.ARTEON_MK1: VWCarInfo("Volkswagen Arteon 2018, 2021", footnotes=[Footnote.VW_HARNESS], harness=Harness.j533), - CAR.ATLAS_MK1: VWCarInfo("Volkswagen Atlas 2018-19, 2022", footnotes=[Footnote.VW_HARNESS], harness=Harness.j533), + CAR.ARTEON_MK1: [ + VWCarInfo("Volkswagen Arteon 2018-22", footnotes=[Footnote.VW_HARNESS, Footnote.VW_VARIANT], harness=Harness.j533), + VWCarInfo("Volkswagen Arteon R 2020-22", footnotes=[Footnote.VW_HARNESS, Footnote.VW_VARIANT], harness=Harness.j533), + VWCarInfo("Volkswagen Arteon eHybrid 2020-22", footnotes=[Footnote.VW_HARNESS, Footnote.VW_VARIANT], harness=Harness.j533), + VWCarInfo("Volkswagen CC 2018-22", footnotes=[Footnote.VW_HARNESS, Footnote.VW_VARIANT], harness=Harness.j533), + ], + CAR.ATLAS_MK1: [ + VWCarInfo("Volkswagen Atlas 2018-22", footnotes=[Footnote.VW_HARNESS], harness=Harness.j533), + VWCarInfo("Volkswagen Atlas Cross Sport 2021-22", footnotes=[Footnote.VW_HARNESS], harness=Harness.j533), + VWCarInfo("Volkswagen Teramont 2018-22", footnotes=[Footnote.VW_HARNESS], harness=Harness.j533), + VWCarInfo("Volkswagen Teramont Cross Sport 2021-22", footnotes=[Footnote.VW_HARNESS], harness=Harness.j533), + VWCarInfo("Volkswagen Teramont X 2021-22", footnotes=[Footnote.VW_HARNESS], harness=Harness.j533), + ], CAR.GOLF_MK7: [ - VWCarInfo("Volkswagen e-Golf 2014, 2018-20"), - VWCarInfo("Volkswagen Golf 2015-20"), - VWCarInfo("Volkswagen Golf Alltrack 2017-18"), - VWCarInfo("Volkswagen Golf GTE 2016"), - VWCarInfo("Volkswagen Golf GTI 2018-21"), - VWCarInfo("Volkswagen Golf R 2016-19"), - VWCarInfo("Volkswagen Golf SportsVan 2016"), - VWCarInfo("Volkswagen Golf SportWagen 2015"), + VWCarInfo("Volkswagen e-Golf 2014-20"), + VWCarInfo("Volkswagen Golf 2015-20", footnotes=[Footnote.VW_VARIANT]), + VWCarInfo("Volkswagen Golf Alltrack 2015-19"), + VWCarInfo("Volkswagen Golf GTD 2015-20"), + VWCarInfo("Volkswagen Golf GTE 2015-20"), + VWCarInfo("Volkswagen Golf GTI 2015-21"), + VWCarInfo("Volkswagen Golf R 2015-19", footnotes=[Footnote.VW_VARIANT]), + VWCarInfo("Volkswagen Golf SportsVan 2015-20"), ], CAR.JETTA_MK7: [ - VWCarInfo("Volkswagen Jetta 2018-21"), - VWCarInfo("Volkswagen Jetta GLI 2021"), + VWCarInfo("Volkswagen Jetta 2018-22", footnotes=[Footnote.VW_HARNESS], harness=Harness.j533), + VWCarInfo("Volkswagen Jetta GLI 2021-22", footnotes=[Footnote.VW_HARNESS], harness=Harness.j533), + ], + CAR.PASSAT_MK8: [ + VWCarInfo("Volkswagen Passat 2015-22", footnotes=[Footnote.VW_HARNESS, Footnote.PASSAT, Footnote.VW_VARIANT], harness=Harness.j533), + VWCarInfo("Volkswagen Passat Alltrack 2015-22", footnotes=[Footnote.VW_HARNESS], harness=Harness.j533), + VWCarInfo("Volkswagen Passat GTE 2015-22", footnotes=[Footnote.VW_HARNESS, Footnote.VW_VARIANT], harness=Harness.j533), + ], + CAR.POLO_MK6: [ + VWCarInfo("Volkswagen Polo 2020-22", footnotes=[Footnote.VW_HARNESS], harness=Harness.j533), + VWCarInfo("Volkswagen Polo GTI 2020-22", footnotes=[Footnote.VW_HARNESS], harness=Harness.j533), ], - CAR.PASSAT_MK8: VWCarInfo("Volkswagen Passat 2015-19", footnotes=[Footnote.PASSAT]), - CAR.POLO_MK6: VWCarInfo("Volkswagen Polo 2020"), CAR.TAOS_MK1: VWCarInfo("Volkswagen Taos 2022", footnotes=[Footnote.VW_HARNESS], harness=Harness.j533), CAR.TCROSS_MK1: VWCarInfo("Volkswagen T-Cross 2021", footnotes=[Footnote.VW_HARNESS], harness=Harness.j533), CAR.TIGUAN_MK2: VWCarInfo("Volkswagen Tiguan 2019-22", footnotes=[Footnote.VW_HARNESS], harness=Harness.j533), diff --git a/selfdrive/controls/controlsd.py b/selfdrive/controls/controlsd.py index b344705f9d..a20a3a9f37 100755 --- a/selfdrive/controls/controlsd.py +++ b/selfdrive/controls/controlsd.py @@ -96,7 +96,11 @@ class Controls: self.sm = sm if self.sm is None: - ignore = ['driverCameraState', 'managerState'] if SIMULATION else None + ignore = [] + if SIMULATION: + ignore += ['driverCameraState', 'managerState'] + if params.get_bool('WideCameraOnly'): + ignore += ['roadCameraState'] self.sm = messaging.SubMaster(['deviceState', 'pandaStates', 'peripheralState', 'modelV2', 'liveCalibration', 'driverMonitoringState', 'longitudinalPlan', 'lateralPlan', 'liveLocationKalman', 'managerState', 'liveParameters', 'radarState'] + self.camera_packets + joystick_packet, @@ -224,12 +228,8 @@ class Controls: if not self.CP.notCar: self.events.add_from_msg(self.sm['driverMonitoringState'].events) - # Handle car events. Ignore when CAN is invalid - if CS.canTimeout: - self.events.add(EventName.canBusMissing) - elif not CS.canValid: - self.events.add(EventName.canError) - else: + # Add car events, ignore if CAN isn't valid + if CS.canValid: self.events.add_from_msg(CS.events) # Create events for temperature, disk space, and memory @@ -309,14 +309,19 @@ class Controls: self.events.add(EventName.cameraFrameRate) if self.rk.lagging: self.events.add(EventName.controlsdLagging) - if len(self.sm['radarState'].radarErrors): + if len(self.sm['radarState'].radarErrors) or not self.sm.all_checks(['radarState']): self.events.add(EventName.radarFault) if not self.sm.valid['pandaStates']: self.events.add(EventName.usbError) + if CS.canTimeout: + self.events.add(EventName.canBusMissing) + elif not CS.canValid: + self.events.add(EventName.canError) # generic catch-all. ideally, a more specific event should be added above instead - no_system_errors = len(self.events) != num_events - if (not self.sm.all_checks() or self.can_rcv_error) and no_system_errors and CS.canValid and not CS.canTimeout: + has_disable_events = self.events.any(ET.NO_ENTRY) and (self.events.any(ET.SOFT_DISABLE) or self.events.any(ET.IMMEDIATE_DISABLE)) + no_system_errors = (not has_disable_events) or (len(self.events) == num_events) + if (not self.sm.all_checks() or self.can_rcv_error) and no_system_errors: if not self.sm.all_alive(): self.events.add(EventName.commIssue) elif not self.sm.all_freq_ok(): diff --git a/selfdrive/debug/test_fw_query_on_routes.py b/selfdrive/debug/test_fw_query_on_routes.py index 9ce0ebb3f5..191411f45a 100755 --- a/selfdrive/debug/test_fw_query_on_routes.py +++ b/selfdrive/debug/test_fw_query_on_routes.py @@ -89,24 +89,9 @@ if __name__ == "__main__": print("not in supported cars") break - # Older routes only have carFw from their brand - old_route = not any([len(fw.brand) for fw in car_fw]) - brands = SUPPORTED_BRANDS if not old_route else [None] - - # Exact match - exact_matches, fuzzy_matches = [], [] - for brand in brands: - fw_versions_dict = build_fw_dict(car_fw, filter_brand=brand) - exact_matches = match_fw_to_car_exact(fw_versions_dict) - if len(exact_matches) == 1: - break - - # Fuzzy match - for brand in brands: - fw_versions_dict = build_fw_dict(car_fw, filter_brand=brand) - fuzzy_matches = match_fw_to_car_fuzzy(fw_versions_dict) - if len(fuzzy_matches) == 1: - break + fw_versions_dict = build_fw_dict(car_fw) + exact_matches = match_fw_to_car_exact(fw_versions_dict) + fuzzy_matches = match_fw_to_car_fuzzy(fw_versions_dict) if (len(exact_matches) == 1) and (list(exact_matches)[0] == live_fingerprint): good_exact += 1 diff --git a/selfdrive/locationd/laikad.py b/selfdrive/locationd/laikad.py index 13829b22a9..b67c483497 100755 --- a/selfdrive/locationd/laikad.py +++ b/selfdrive/locationd/laikad.py @@ -79,8 +79,8 @@ class Laikad: cloudlog.exception("Error parsing cache") timestamp = self.last_fetch_orbits_t.as_datetime() if self.last_fetch_orbits_t is not None else 'Nan' cloudlog.debug( - f"Loaded nav and orbits cache with timestamp: {timestamp}. Unique orbit and nav sats: {list(cache['orbits'].keys())} {list(cache['nav'].keys())} " + - f"Total: {sum([len(v) for v in cache['orbits']])} and {sum([len(v) for v in cache['nav']])}") + f"Loaded nav ({sum([len(v) for v in cache['nav']])}) and orbits ({sum([len(v) for v in cache['orbits']])}) cache with timestamp: {timestamp}. Unique orbit and nav sats: {list(cache['orbits'].keys())} {list(cache['nav'].keys())} " + + f"With time range: {[f'{start.as_datetime()}, {end.as_datetime()}' for (start,end) in self.astro_dog.orbit_fetched_times._ranges]}") def cache_ephemeris(self, t: GPSTime): if self.save_ephemeris and (self.last_cached_t is None or t - self.last_cached_t > SECS_IN_MIN): @@ -94,10 +94,15 @@ class Laikad: if self.last_pos_fix_t is None or abs(self.last_pos_fix_t - t) >= 2: min_measurements = 6 if any(p.constellation_id == ConstellationId.GLONASS for p in processed_measurements) else 5 pos_fix, pos_fix_residual = calc_pos_fix_gauss_newton(processed_measurements, self.posfix_functions, min_measurements=min_measurements) - if len(pos_fix) > 0 and np.median(np.abs(pos_fix_residual)) < POS_FIX_RESIDUAL_THRESHOLD: - self.last_pos_fix = pos_fix[:3] - self.last_pos_residual = pos_fix_residual + if len(pos_fix) > 0: self.last_pos_fix_t = t + residual_median = np.median(np.abs(pos_fix_residual)) + if np.median(np.abs(pos_fix_residual)) < POS_FIX_RESIDUAL_THRESHOLD: + cloudlog.debug(f"Pos fix is within threshold with median: {residual_median.round()}") + self.last_pos_fix = pos_fix[:3] + self.last_pos_residual = pos_fix_residual + else: + cloudlog.debug(f"Pos fix failed with median: {residual_median.round()}. All residuals: {np.round(pos_fix_residual)}") return self.last_pos_fix def process_ublox_msg(self, ublox_msg, ublox_mono_time: int, block=False): @@ -115,10 +120,11 @@ class Laikad: new_meas = [m for m in new_meas if 1e7 < m.observables['C1C'] < 3e7] processed_measurements = process_measurements(new_meas, self.astro_dog) - est_pos = self.get_est_pos(t, processed_measurements) corrected_measurements = correct_measurements(processed_measurements, est_pos, self.astro_dog) if len(est_pos) > 0 else [] + if ublox_mono_time % 10 == 0: + cloudlog.debug(f"Measurements Incoming/Processed/Corrected: {len(new_meas), len(processed_measurements), len(corrected_measurements)}") self.update_localizer(est_pos, t, corrected_measurements) kf_valid = all(self.kf_valid(t)) @@ -212,6 +218,8 @@ def get_orbit_data(t: GPSTime, valid_const, auto_update, valid_ephem_types, cach try: astro_dog.get_orbit_data(t, only_predictions=True) cloudlog.info(f"Done parsing orbits. Took {time.monotonic() - start_time:.1f}s") + cloudlog.debug(f"Downloaded orbits ({sum([len(v) for v in astro_dog.orbits])}): {list(astro_dog.orbits.keys())}" + + f"With time range: {[f'{start.as_datetime()}, {end.as_datetime()}' for (start,end) in astro_dog.orbit_fetched_times._ranges]}") return astro_dog.orbits, astro_dog.orbit_fetched_times, t except (DownloadFailed, RuntimeError, ValueError, IOError) as e: cloudlog.warning(f"No orbit data found or parsing failure: {e}") diff --git a/selfdrive/manager/manager.py b/selfdrive/manager/manager.py index 140c7f1d44..9c370cb3d8 100755 --- a/selfdrive/manager/manager.py +++ b/selfdrive/manager/manager.py @@ -20,7 +20,7 @@ from selfdrive.manager.process_config import managed_processes from selfdrive.athena.registration import register, UNREGISTERED_DONGLE_ID from system.swaglog import cloudlog, add_file_handler from system.version import is_dirty, get_commit, get_version, get_origin, get_short_branch, \ - terms_version, training_version + terms_version, training_version, is_tested_branch sys.path.append(os.path.join(BASEDIR, "pyextra")) @@ -78,6 +78,7 @@ def manager_init() -> None: params.put("GitCommit", get_commit(default="")) params.put("GitBranch", get_short_branch(default="")) params.put("GitRemote", get_origin(default="")) + params.put_bool("IsTestedBranch", is_tested_branch()) # set dongle id reg_res = register(show_spinner=True) diff --git a/selfdrive/navd/.gitignore b/selfdrive/navd/.gitignore new file mode 100644 index 0000000000..a070fe32bb --- /dev/null +++ b/selfdrive/navd/.gitignore @@ -0,0 +1,5 @@ +moc_* +*.moc + +map_renderer +libmap_renderer.so diff --git a/selfdrive/navd/SConscript b/selfdrive/navd/SConscript new file mode 100644 index 0000000000..4fbe41e80b --- /dev/null +++ b/selfdrive/navd/SConscript @@ -0,0 +1,20 @@ +Import('qt_env', 'arch', 'common', 'messaging', 'visionipc', 'cereal', 'transformations') + +base_libs = [common, messaging, cereal, visionipc, transformations, 'zmq', + 'capnp', 'kj', 'm', 'OpenCL', 'ssl', 'crypto', 'pthread'] + qt_env["LIBS"] + +if arch == 'larch64': + base_libs.append('EGL') + +if arch in ['larch64', 'x86_64']: + if arch == 'x86_64': + rpath = [Dir(f"#third_party/mapbox-gl-native-qt/{arch}").srcnode().abspath] + qt_env["RPATH"] += rpath + + qt_libs = ["qt_widgets", "qt_util", "qmapboxgl"] + base_libs + + nav_src = ["main.cc", "map_renderer.cc"] + qt_env.Program("map_renderer", nav_src, LIBS=qt_libs + ['common', 'json11']) + + if GetOption('extras'): + qt_env.SharedLibrary("map_renderer", ["map_renderer.cc"], LIBS=qt_libs + ['common', 'messaging']) diff --git a/selfdrive/navd/main.cc b/selfdrive/navd/main.cc new file mode 100644 index 0000000000..3a2fedb7d2 --- /dev/null +++ b/selfdrive/navd/main.cc @@ -0,0 +1,31 @@ +#include +#include +#include + +#include "selfdrive/ui/qt/util.h" +#include "selfdrive/ui/qt/maps/map_helpers.h" +#include "selfdrive/navd/map_renderer.h" +#include "selfdrive/hardware/hw.h" + + + +void sigHandler(int s) { + qInfo() << "Shutting down"; + std::signal(s, SIG_DFL); + + qApp->quit(); +} + + +int main(int argc, char *argv[]) { + qInstallMessageHandler(swagLogMessageHandler); + + QApplication app(argc, argv); + std::signal(SIGINT, sigHandler); + std::signal(SIGTERM, sigHandler); + + MapRenderer * m = new MapRenderer(get_mapbox_settings()); + assert(m); + + return app.exec(); +} diff --git a/selfdrive/navd/map_renderer.cc b/selfdrive/navd/map_renderer.cc new file mode 100644 index 0000000000..cb24f2087e --- /dev/null +++ b/selfdrive/navd/map_renderer.cc @@ -0,0 +1,236 @@ +#include "selfdrive/navd/map_renderer.h" + +#include +#include +#include + +#include "common/timing.h" +#include "selfdrive/ui/qt/maps/map_helpers.h" + +const float ZOOM = 13.5; // Don't go below 13 or features will start to disappear +const int WIDTH = 256; +const int HEIGHT = WIDTH; + +const int NUM_VIPC_BUFFERS = 4; + +MapRenderer::MapRenderer(const QMapboxGLSettings &settings, bool online) : m_settings(settings) { + QSurfaceFormat fmt; + fmt.setRenderableType(QSurfaceFormat::OpenGLES); + + ctx = std::make_unique(); + ctx->setFormat(fmt); + ctx->create(); + assert(ctx->isValid()); + + surface = std::make_unique(); + surface->setFormat(ctx->format()); + surface->create(); + + ctx->makeCurrent(surface.get()); + assert(QOpenGLContext::currentContext() == ctx.get()); + + gl_functions.reset(ctx->functions()); + gl_functions->initializeOpenGLFunctions(); + + QOpenGLFramebufferObjectFormat fbo_format; + fbo.reset(new QOpenGLFramebufferObject(WIDTH, HEIGHT, fbo_format)); + + m_map.reset(new QMapboxGL(nullptr, m_settings, fbo->size(), 1)); + m_map->setCoordinateZoom(QMapbox::Coordinate(0, 0), ZOOM); + m_map->setStyleUrl("mapbox://styles/commaai/ckvmksrpd4n0a14pfdo5heqzr"); + m_map->createRenderer(); + + m_map->resize(fbo->size()); + m_map->setFramebufferObject(fbo->handle(), fbo->size()); + gl_functions->glViewport(0, 0, WIDTH, HEIGHT); + + if (online) { + vipc_server.reset(new VisionIpcServer("navd")); + vipc_server->create_buffers(VisionStreamType::VISION_STREAM_MAP, NUM_VIPC_BUFFERS, false, WIDTH, HEIGHT); + vipc_server->start_listener(); + + pm.reset(new PubMaster({"navThumbnail"})); + sm.reset(new SubMaster({"liveLocationKalman", "navRoute"})); + + timer = new QTimer(this); + QObject::connect(timer, SIGNAL(timeout()), this, SLOT(msgUpdate())); + timer->start(50); + } +} + +void MapRenderer::msgUpdate() { + sm->update(0); + + if (sm->updated("liveLocationKalman")) { + auto location = (*sm)["liveLocationKalman"].getLiveLocationKalman(); + auto pos = location.getPositionGeodetic(); + auto orientation = location.getCalibratedOrientationNED(); + + bool localizer_valid = (location.getStatus() == cereal::LiveLocationKalman::Status::VALID) && pos.getValid(); + if (localizer_valid) { + updatePosition(QMapbox::Coordinate(pos.getValue()[0], pos.getValue()[1]), RAD2DEG(orientation.getValue()[2])); + } + } + + if (sm->updated("navRoute")) { + QList route; + auto coords = (*sm)["navRoute"].getNavRoute().getCoordinates(); + for (auto const &c : coords) { + route.push_back(QGeoCoordinate(c.getLatitude(), c.getLongitude())); + } + updateRoute(route); + } +} + +void MapRenderer::updatePosition(QMapbox::Coordinate position, float bearing) { + if (m_map.isNull()) { + return; + } + + m_map->setCoordinate(position); + m_map->setBearing(bearing); + update(); +} + +bool MapRenderer::loaded() { + return m_map->isFullyLoaded(); +} + +void MapRenderer::update() { + gl_functions->glClear(GL_COLOR_BUFFER_BIT); + m_map->render(); + gl_functions->glFlush(); + + sendVipc(); +} + +void MapRenderer::sendVipc() { + if (!vipc_server || !loaded()) { + return; + } + + QImage cap = fbo->toImage().convertToFormat(QImage::Format_RGB888, Qt::AutoColor); + uint64_t ts = nanos_since_boot(); + VisionBuf* buf = vipc_server->get_buffer(VisionStreamType::VISION_STREAM_MAP); + VisionIpcBufExtra extra = { + .frame_id = frame_id, + .timestamp_sof = ts, + .timestamp_eof = ts, + }; + + assert(cap.sizeInBytes() >= buf->len); + uint8_t* dst = (uint8_t*)buf->addr; + uint8_t* src = cap.bits(); + + // RGB to greyscale + memset(dst, 128, buf->len); + for (int i = 0; i < WIDTH * HEIGHT; i++) { + dst[i] = src[i * 3]; + } + + vipc_server->send(buf, &extra); + + if (frame_id % 100 == 0) { + // Write jpeg into buffer + QByteArray buffer_bytes; + QBuffer buffer(&buffer_bytes); + buffer.open(QIODevice::WriteOnly); + cap.save(&buffer, "JPG", 50); + + kj::Array buffer_kj = kj::heapArray((const capnp::byte*)buffer_bytes.constData(), buffer_bytes.size()); + + // Send thumbnail + MessageBuilder msg; + auto thumbnaild = msg.initEvent().initNavThumbnail(); + thumbnaild.setFrameId(frame_id); + thumbnaild.setTimestampEof(ts); + thumbnaild.setThumbnail(buffer_kj); + pm->send("navThumbnail", msg); + } + + frame_id++; +} + +uint8_t* MapRenderer::getImage() { + QImage cap = fbo->toImage().convertToFormat(QImage::Format_RGB888, Qt::AutoColor); + uint8_t* buf = new uint8_t[cap.sizeInBytes()]; + memcpy(buf, cap.bits(), cap.sizeInBytes()); + + return buf; +} + +void MapRenderer::updateRoute(QList coordinates) { + if (m_map.isNull()) return; + initLayers(); + + auto route_points = coordinate_list_to_collection(coordinates); + QMapbox::Feature feature(QMapbox::Feature::LineStringType, route_points, {}, {}); + QVariantMap navSource; + navSource["type"] = "geojson"; + navSource["data"] = QVariant::fromValue(feature); + m_map->updateSource("navSource", navSource); + m_map->setLayoutProperty("navLayer", "visibility", "visible"); +} + +void MapRenderer::initLayers() { + if (!m_map->layerExists("navLayer")) { + QVariantMap nav; + nav["id"] = "navLayer"; + nav["type"] = "line"; + nav["source"] = "navSource"; + m_map->addLayer(nav, "road-intersection"); + m_map->setPaintProperty("navLayer", "line-color", QColor("grey")); + m_map->setPaintProperty("navLayer", "line-width", 3); + m_map->setLayoutProperty("navLayer", "line-cap", "round"); + } +} + +MapRenderer::~MapRenderer() { +} + +extern "C" { + MapRenderer* map_renderer_init() { + char *argv[] = { + (char*)"navd", + nullptr + }; + int argc = 0; + QApplication *app = new QApplication(argc, argv); + assert(app); + + QMapboxGLSettings settings; + settings.setApiBaseUrl(MAPS_HOST); + settings.setAccessToken(get_mapbox_token()); + + return new MapRenderer(settings, false); + } + + void map_renderer_update_position(MapRenderer *inst, float lat, float lon, float bearing) { + inst->updatePosition({lat, lon}, bearing); + QApplication::processEvents(); + } + + void map_renderer_update_route(MapRenderer *inst, char* polyline) { + inst->updateRoute(polyline_to_coordinate_list(QString::fromUtf8(polyline))); + } + + void map_renderer_update(MapRenderer *inst) { + inst->update(); + } + + void map_renderer_process(MapRenderer *inst) { + QApplication::processEvents(); + } + + bool map_renderer_loaded(MapRenderer *inst) { + return inst->loaded(); + } + + uint8_t * map_renderer_get_image(MapRenderer *inst) { + return inst->getImage(); + } + + void map_renderer_free_image(MapRenderer *inst, uint8_t * buf) { + delete[] buf; + } +} diff --git a/selfdrive/navd/map_renderer.h b/selfdrive/navd/map_renderer.h new file mode 100644 index 0000000000..855dc91894 --- /dev/null +++ b/selfdrive/navd/map_renderer.h @@ -0,0 +1,53 @@ +#pragma once + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "cereal/visionipc/visionipc_server.h" +#include "cereal/messaging/messaging.h" + + +class MapRenderer : public QObject { + Q_OBJECT + +public: + MapRenderer(const QMapboxGLSettings &, bool online=true); + uint8_t* getImage(); + void update(); + bool loaded(); + ~MapRenderer(); + + +private: + std::unique_ptr ctx; + std::unique_ptr surface; + std::unique_ptr gl_functions; + std::unique_ptr fbo; + + std::unique_ptr vipc_server; + std::unique_ptr pm; + std::unique_ptr sm; + void sendVipc(); + + QMapboxGLSettings m_settings; + QScopedPointer m_map; + + void initLayers(); + + uint32_t frame_id = 0; + + QTimer* timer; + +public slots: + void updatePosition(QMapbox::Coordinate position, float bearing); + void updateRoute(QList coordinates); + void msgUpdate(); +}; diff --git a/selfdrive/navd/map_renderer.py b/selfdrive/navd/map_renderer.py new file mode 100755 index 0000000000..dc39f335c7 --- /dev/null +++ b/selfdrive/navd/map_renderer.py @@ -0,0 +1,78 @@ +#!/usr/bin/env python3 +# You might need to uninstall the PyQt5 pip package to avoid conflicts + +import os +import time +from cffi import FFI + +from common.ffi_wrapper import suffix +from common.basedir import BASEDIR + +HEIGHT = WIDTH = 256 + + +def get_ffi(): + lib = os.path.join(BASEDIR, "selfdrive", "navd", "libmap_renderer" + suffix()) + + ffi = FFI() + ffi.cdef(""" +void* map_renderer_init(); +void map_renderer_update_position(void *inst, float lat, float lon, float bearing); +void map_renderer_update_route(void *inst, char *polyline); +void map_renderer_update(void *inst); +void map_renderer_process(void *inst); +bool map_renderer_loaded(void *inst); +uint8_t* map_renderer_get_image(void *inst); +void map_renderer_free_image(void *inst, uint8_t *buf); +""") + return ffi, ffi.dlopen(lib) + + +def wait_ready(lib, renderer): + while not lib.map_renderer_loaded(renderer): + lib.map_renderer_update(renderer) + + # The main qt app is not execed, so we need to periodically process events for e.g. network requests + lib.map_renderer_process(renderer) + + time.sleep(0.01) + + +def get_image(lib, renderer): + buf = lib.map_renderer_get_image(renderer) + r = list(buf[0:3 * WIDTH * HEIGHT]) + lib.map_renderer_free_image(renderer, buf) + + # Convert to numpy + r = np.asarray(r) + return r.reshape((WIDTH, HEIGHT, 3)) + + +if __name__ == "__main__": + import matplotlib.pyplot as plt + import numpy as np + + ffi, lib = get_ffi() + renderer = lib.map_renderer_init() + wait_ready(lib, renderer) + + geometry = r"{yxk}@|obn~Eg@@eCFqc@J{RFw@?kA@gA?q|@Riu@NuJBgi@ZqVNcRBaPBkG@iSD{I@_H@cH?gG@mG@gG?aD@{LDgDDkVVyQLiGDgX@q_@@qI@qKhS{R~[}NtYaDbGoIvLwNfP_b@|f@oFnF_JxHel@bf@{JlIuxAlpAkNnLmZrWqFhFoh@jd@kX|TkJxH_RnPy^|[uKtHoZ~Um`DlkCorC``CuShQogCtwB_ThQcr@fk@sVrWgRhVmSb\\oj@jxA{Qvg@u]tbAyHzSos@xjBeKbWszAbgEc~@~jCuTrl@cYfo@mRn\\_m@v}@ij@jp@om@lk@y|A`pAiXbVmWzUod@xj@wNlTw}@|uAwSn\\kRfYqOdS_IdJuK`KmKvJoOhLuLbHaMzGwO~GoOzFiSrEsOhD}PhCqw@vJmnAxSczA`Vyb@bHk[fFgl@pJeoDdl@}}@zIyr@hG}X`BmUdBcM^aRR}Oe@iZc@mR_@{FScHxAn_@vz@zCzH~GjPxAhDlB~DhEdJlIbMhFfG|F~GlHrGjNjItLnGvQ~EhLnBfOn@p`@AzAAvn@CfC?fc@`@lUrArStCfSxEtSzGxM|ElFlBrOzJlEbDnC~BfDtCnHjHlLvMdTnZzHpObOf^pKla@~G|a@dErg@rCbj@zArYlj@ttJ~AfZh@r]LzYg@`TkDbj@gIdv@oE|i@kKzhA{CdNsEfOiGlPsEvMiDpLgBpHyB`MkB|MmArPg@|N?|P^rUvFz~AWpOCdAkB|PuB`KeFfHkCfGy@tAqC~AsBPkDs@uAiAcJwMe@s@eKkPMoXQux@EuuCoH?eI?Kas@}Dy@wAUkMOgDL" + lib.map_renderer_update_route(renderer, geometry.encode()) + + POSITIONS = [ + (32.71569271952601, -117.16384270868463, 0), (32.71569271952601, -117.16384270868463, 45), # San Diego + (52.378641991483136, 4.902623379456488, 0), (52.378641991483136, 4.902623379456488, 45), # Amsterdam + ] + plt.figure() + + for i, pos in enumerate(POSITIONS): + t = time.time() + lib.map_renderer_update_position(renderer, *pos) + wait_ready(lib, renderer) + + print(f"{pos} took {time.time() - t:.2f} s") + + plt.subplot(2, 2, i + 1) + plt.imshow(get_image(lib, renderer)) + + plt.show() diff --git a/selfdrive/test/process_replay/ref_commit b/selfdrive/test/process_replay/ref_commit index dff232911e..00bf28ed83 100644 --- a/selfdrive/test/process_replay/ref_commit +++ b/selfdrive/test/process_replay/ref_commit @@ -1 +1 @@ -fa52fa6c6703269e23610b1c6aba8a56b911fbbb \ No newline at end of file +7c1168af0311d2fef67b82812cd863a0e97c030e \ No newline at end of file diff --git a/selfdrive/test/process_replay/regen.py b/selfdrive/test/process_replay/regen.py index 1a2d436f1a..39f75ce428 100755 --- a/selfdrive/test/process_replay/regen.py +++ b/selfdrive/test/process_replay/regen.py @@ -263,7 +263,7 @@ def regen_segment(lr, frs=None, outdir=FAKEDATA, disable_tqdm=False): seg_path = os.path.join(outdir, segment) # check to make sure openpilot is engaged in the route if not check_enabled(LogReader(os.path.join(seg_path, "rlog"))): - raise Exception(f"Route never enabled: {segment}") + raise Exception(f"Route did not engage for long enough: {segment}") return seg_path diff --git a/selfdrive/test/process_replay/test_processes.py b/selfdrive/test/process_replay/test_processes.py index 4ebb0701dd..08933d143f 100755 --- a/selfdrive/test/process_replay/test_processes.py +++ b/selfdrive/test/process_replay/test_processes.py @@ -38,18 +38,18 @@ original_segments = [ segments = [ ("BODY", "regen660D86654BA|2022-07-06--14-27-15--0"), - ("HYUNDAI", "regen657E25856BB|2022-07-06--14-26-51--0"), + ("HYUNDAI", "regen114E5FF24D8|2022-07-14--17-08-47--0"), ("HYUNDAI", "d824e27e8c60172c|2022-07-08--21-21-15--0"), ("TOYOTA", "regenBA97410FBEC|2022-07-06--14-26-49--0"), ("TOYOTA2", "regenDEDB1D9C991|2022-07-06--14-54-08--0"), ("TOYOTA3", "regenDDC1FE60734|2022-07-06--14-32-06--0"), - ("HONDA", "regen17B09D158B8|2022-07-06--14-31-46--0"), - ("HONDA2", "regen041739C3E9A|2022-07-06--15-08-02--0"), - ("CHRYSLER", "regenBB2F9C1425C|2022-07-06--14-31-41--0"), + ("HONDA", "regenE62960EEC38|2022-07-14--19-33-24--0"), + ("HONDA2", "regenC3EBD92F029|2022-07-14--19-29-47--0"), + ("CHRYSLER", "regen38346FB33D0|2022-07-14--18-05-26--0"), ("RAM", "2f4452b03ccb98f0|2022-07-07--08-01-56--3"), - ("SUBARU", "regen732B69F33B1|2022-07-06--14-36-18--0"), + ("SUBARU", "regen54A1E2BE5AA|2022-07-14--18-07-50--0"), ("GM", "regen01D09D915B5|2022-07-06--14-36-20--0"), - ("NISSAN", "regenEA6FB2773F5|2022-07-06--14-58-23--0"), + ("NISSAN", "regenCA0B0DC946E|2022-07-14--18-10-17--0"), ("VOLKSWAGEN", "regen007098CA0EF|2022-07-06--15-01-26--0"), ("MAZDA", "regen61BA413D53B|2022-07-06--14-39-42--0"), ] diff --git a/selfdrive/ui/qt/maps/map_helpers.cc b/selfdrive/ui/qt/maps/map_helpers.cc index 66acb7a25d..f97137a7f9 100644 --- a/selfdrive/ui/qt/maps/map_helpers.cc +++ b/selfdrive/ui/qt/maps/map_helpers.cc @@ -101,6 +101,48 @@ QMapbox::CoordinatesCollections coordinate_list_to_collection(QList polyline_to_coordinate_list(const QString &polylineString) { + QList path; + if (polylineString.isEmpty()) + return path; + + QByteArray data = polylineString.toLatin1(); + + bool parsingLatitude = true; + + int shift = 0; + int value = 0; + + QGeoCoordinate coord(0, 0); + + for (int i = 0; i < data.length(); ++i) { + unsigned char c = data.at(i) - 63; + + value |= (c & 0x1f) << shift; + shift += 5; + + // another chunk + if (c & 0x20) + continue; + + int diff = (value & 1) ? ~(value >> 1) : (value >> 1); + + if (parsingLatitude) { + coord.setLatitude(coord.latitude() + (double)diff/1e6); + } else { + coord.setLongitude(coord.longitude() + (double)diff/1e6); + path.append(coord); + } + + parsingLatitude = !parsingLatitude; + + value = 0; + shift = 0; + } + + return path; +} + std::optional coordinate_from_param(std::string param) { QString json_str = QString::fromStdString(Params().get(param)); if (json_str.isEmpty()) return {}; diff --git a/selfdrive/ui/qt/maps/map_helpers.h b/selfdrive/ui/qt/maps/map_helpers.h index 1c08c541c3..2e1402ccea 100644 --- a/selfdrive/ui/qt/maps/map_helpers.h +++ b/selfdrive/ui/qt/maps/map_helpers.h @@ -24,6 +24,7 @@ QMapbox::CoordinatesCollections model_to_collection( QMapbox::CoordinatesCollections coordinate_to_collection(QMapbox::Coordinate c); QMapbox::CoordinatesCollections capnp_coordinate_list_to_collection(const capnp::List::Reader &coordinate_list); QMapbox::CoordinatesCollections coordinate_list_to_collection(QList coordinate_list); +QList polyline_to_coordinate_list(const QString &polylineString); std::optional coordinate_from_param(std::string param); double angle_difference(double angle1, double angle2); diff --git a/selfdrive/ui/qt/offroad/settings.cc b/selfdrive/ui/qt/offroad/settings.cc index 9a6e203966..65b9e3e4cc 100644 --- a/selfdrive/ui/qt/offroad/settings.cc +++ b/selfdrive/ui/qt/offroad/settings.cc @@ -24,6 +24,7 @@ #include "selfdrive/ui/ui.h" #include "selfdrive/ui/qt/util.h" #include "selfdrive/ui/qt/qt_window.h" +#include "selfdrive/ui/qt/widgets/input.h" TogglesPanel::TogglesPanel(SettingsWindow *parent) : ListWidget(parent) { // param, title, desc, icon @@ -71,6 +72,12 @@ TogglesPanel::TogglesPanel(SettingsWindow *parent) : ListWidget(parent) { tr("Use 24h format instead of am/pm"), "../assets/offroad/icon_metric.png", }, + { + "NavSettingLeftSide", + tr("Show Map on Left Side of UI"), + tr("Show map on left side when in split screen view."), + "../assets/offroad/icon_road.png", + }, #endif }; @@ -247,7 +254,19 @@ SoftwarePanel::SoftwarePanel(QWidget* parent) : ListWidget(parent) { } std::system("pkill -1 -f selfdrive.updated"); }); - + connect(uiState(), &UIState::offroadTransition, updateBtn, &QPushButton::setEnabled); + + branchSwitcherBtn = new ButtonControl(tr("Switch Branch"), tr("ENTER")); + connect(branchSwitcherBtn, &ButtonControl::clicked, [=]() { + QString branch = InputDialog::getText(tr("Enter name of new branch"), this); + if (branch.isEmpty()) { + params.remove("SwitchToBranch"); + } else { + params.put("SwitchToBranch", branch.toStdString()); + } + std::system("pkill -1 -f selfdrive.updated"); + }); + connect(uiState(), &UIState::offroadTransition, branchSwitcherBtn, &QPushButton::setEnabled); auto uninstallBtn = new ButtonControl(tr("Uninstall %1").arg(getBrand()), tr("UNINSTALL")); connect(uninstallBtn, &ButtonControl::clicked, [&]() { @@ -257,8 +276,11 @@ SoftwarePanel::SoftwarePanel(QWidget* parent) : ListWidget(parent) { }); connect(uiState(), &UIState::offroadTransition, uninstallBtn, &QPushButton::setEnabled); - QWidget *widgets[] = {versionLbl, lastUpdateLbl, updateBtn, gitBranchLbl, gitCommitLbl, osVersionLbl, uninstallBtn}; + QWidget *widgets[] = {versionLbl, lastUpdateLbl, updateBtn, branchSwitcherBtn, gitBranchLbl, gitCommitLbl, osVersionLbl, uninstallBtn}; for (QWidget* w : widgets) { + if (w == branchSwitcherBtn && params.getBool("IsTestedBranch")) { + continue; + } addItem(w); } diff --git a/selfdrive/ui/qt/offroad/settings.h b/selfdrive/ui/qt/offroad/settings.h index 160f10f99f..45efe255cf 100644 --- a/selfdrive/ui/qt/offroad/settings.h +++ b/selfdrive/ui/qt/offroad/settings.h @@ -71,6 +71,7 @@ private: LabelControl *versionLbl; LabelControl *lastUpdateLbl; ButtonControl *updateBtn; + ButtonControl *branchSwitcherBtn; Params params; QFileSystemWatcher *fs_watch; diff --git a/selfdrive/ui/qt/onroad.cc b/selfdrive/ui/qt/onroad.cc index ca39a89ae4..fe39cd0cfc 100644 --- a/selfdrive/ui/qt/onroad.cc +++ b/selfdrive/ui/qt/onroad.cc @@ -52,6 +52,12 @@ void OnroadWindow::updateState(const UIState &s) { alerts->updateAlert(alert, bgColor); } + if (s.scene.map_on_left) { + split->setDirection(QBoxLayout::LeftToRight); + } else { + split->setDirection(QBoxLayout::RightToLeft); + } + nvg->updateState(s); if (bg != bgColor) { @@ -80,7 +86,7 @@ void OnroadWindow::offroadTransition(bool offroad) { QObject::connect(uiState(), &UIState::offroadTransition, m, &MapWindow::offroadTransition); m->setFixedWidth(topWidget(this)->width() / 2); - split->addWidget(m, 0, Qt::AlignRight); + split->insertWidget(0, m); // Make map visible after adding to split m->offroadTransition(offroad); diff --git a/selfdrive/ui/qt/widgets/controls.h b/selfdrive/ui/qt/widgets/controls.h index aed99edae8..4245a9c04a 100644 --- a/selfdrive/ui/qt/widgets/controls.h +++ b/selfdrive/ui/qt/widgets/controls.h @@ -24,9 +24,9 @@ signals: protected: void paintEvent(QPaintEvent *event) override; void resizeEvent(QResizeEvent* event) override; - void mouseReleaseEvent(QMouseEvent *event) override { + void mouseReleaseEvent(QMouseEvent *event) override { if (rect().contains(event->pos())) { - emit clicked(); + emit clicked(); } } QString lastText_, elidedText_; diff --git a/selfdrive/ui/tests/test_translations.py b/selfdrive/ui/tests/test_translations.py index 3230a99543..d5409dd416 100755 --- a/selfdrive/ui/tests/test_translations.py +++ b/selfdrive/ui/tests/test_translations.py @@ -61,6 +61,7 @@ class TestTranslations(unittest.TestCase): self.assertEqual(cur_translations, new_translations, f"{file} ({name}) {file_ext.upper()} translation file out of date. Run selfdrive/ui/update_translations.py --release to update the translation files") + @unittest.skip("Only test unfinished translations before going to release") def test_unfinished_translations(self): for name, file in self.translation_files.items(): with self.subTest(name=name, file=file): diff --git a/selfdrive/ui/translations/main_ko.ts b/selfdrive/ui/translations/main_ko.ts index 07d6877463..4662a862bc 100644 --- a/selfdrive/ui/translations/main_ko.ts +++ b/selfdrive/ui/translations/main_ko.ts @@ -108,152 +108,152 @@ DevicePanel - + Dongle ID Dongle ID - + N/A N/A - + Serial Serial - + Driver Camera 운전자 카메라 - + PREVIEW 미리보기 - + Preview the driver facing camera to ensure that driver monitoring has good visibility. (vehicle must be off) 운전자 모니터링이 좋은 가시성을 갖도록 운전자를 향한 카메라를 미리 봅니다. (차량연결은 해제되어있어야 합니다) - + Reset Calibration 캘리브레이션 재설정 - + RESET 재설정 - + Are you sure you want to reset calibration? 캘리브레이션을 재설정하시겠습니까? - + Review Training Guide 트레이닝 가이드 다시보기 - + REVIEW 다시보기 - + Review the rules, features, and limitations of openpilot openpilot의 규칙, 기능 및 제한 다시보기 - + Are you sure you want to review the training guide? 트레이닝 가이드를 다시보시겠습니까? - + Regulatory 규제 - + VIEW 보기 - + Change Language 언어 변경 - + CHANGE 변경 - + Select a language 언어를 선택하세요 - + Reboot 재부팅 - + Power Off 전원 종료 - + openpilot requires the device to be mounted within 4° left or right and within 5° up or 8° down. openpilot is continuously calibrating, resetting is rarely required. openpilot은 장치를 좌측 또는 우측은 4° 이내, 위쪽 5° 또는 아래쪽은 8° 이내로 설치해야 합니다. openpilot은 지속적으로 보정되므로 리셋이 거의 필요하지 않습니다. - + Your device is pointed %1° %2 and %3° %4. 사용자의 장치가 %1° %2 및 %3° %4를 가리키고 있습니다. - + down 아래로 - + up 위로 - + left 좌측으로 - + right 우측으로 - + Are you sure you want to reboot? 재부팅 하시겠습니까? - + Disengage to Reboot 재부팅 하려면 해제하세요 - + Are you sure you want to power off? 전원을 종료하시겠습니까? - + Disengage to Power Off 전원을 종료하려면 해제하세요 @@ -488,30 +488,30 @@ location set NvgWindow - + km/h km/h - + mph mph - - + + MAX MAX - - + + SPEED SPEED - - + + LIMIT LIMIT @@ -710,33 +710,33 @@ location set SettingsWindow - + × × - + Device 장치 - - + + Network 네트워크 - + Toggles 토글 - + Software 소프트웨어 - + Navigation 네비게이션 @@ -975,68 +975,83 @@ location set SoftwarePanel - + Git Branch Git 브렌치 - + Git Commit Git 커밋 - + OS Version OS 버전 - + Version 버전 - + Last Update Check 최신 업데이트 검사 - + The last time openpilot successfully checked for an update. The updater only runs while the car is off. 최근에 openpilot이 업데이트를 성공적으로 확인했습니다. 업데이트 프로그램은 차량 연결이 해제되었을때만 작동합니다. - + Check for Update 업데이트 확인 - + CHECKING 확인중 - + + Switch Branch + + + + + ENTER + + + + + Enter name of new branch + + + + UNINSTALL 제거 - + Uninstall %1 제거 %1 - + Are you sure you want to uninstall? 제거하시겠습니까? - + failed to fetch update 업데이트를 가져올수없습니다 - - + + CHECK 확인 @@ -1124,82 +1139,92 @@ location set TogglesPanel - + Enable openpilot openpilot 사용 - + Use the openpilot system for adaptive cruise control and lane keep driver assistance. Your attention is required at all times to use this feature. Changing this setting takes effect when the car is powered off. 어댑티브 크루즈 컨트롤 및 차선 유지 운전자 보조를 위해 openpilot 시스템을 사용하십시오. 이 기능을 사용하려면 항상 주의를 기울여야 합니다. 이 설정을 변경하면 차량 전원이 꺼질 때 적용됩니다. - + Enable Lane Departure Warnings 차선 이탈 경고 사용 - + Receive alerts to steer back into the lane when your vehicle drifts over a detected lane line without a turn signal activated while driving over 31 mph (50 km/h). 차량이 50km/h(31mph) 이상의 속도로 주행하는 동안 방향 지시등이 활성화되지 않은 상태에서 감지된 차선 위를 주행할 경우 차선이탈 경고를 사용합니다. - + Enable Right-Hand Drive 우측핸들 사용 - + Allow openpilot to obey left-hand traffic conventions and perform driver monitoring on right driver seat. openpilot이 좌측 교통 규칙을 준수하고 우측 운전석에서 운전자 모니터링을 수행합니다. - + Use Metric System 미터법 사용 - + Display speed in km/h instead of mph. mph 대신 km/h로 속도를 표시합니다. - + Record and Upload Driver Camera 운전자 카메라 녹화 및 업로드 - + Upload data from the driver facing camera and help improve the driver monitoring algorithm. 운전자 카메라에서 데이터를 업로드하고 운전자 모니터링 알고리즘을 개선합니다. - + Disengage On Accelerator Pedal 가속페달 조작시 해제 - + When enabled, pressing the accelerator pedal will disengage openpilot. 활성화된 경우 가속 페달을 누르면 openpilot이 해제됩니다. - + Show ETA in 24h format 24시간 형식으로 도착예정시간 표시 - + Use 24h format instead of am/pm 오전/오후 대신 24시간 형식 사용 - + + Show Map on Left Side of UI + + + + + Show map on left side when in split screen view. + + + + openpilot Longitudinal Control openpilot Longitudinal Control - + openpilot will disable the car's radar and will take over control of gas and brakes. Warning: this disables AEB! openpilot은 차량'의 레이더를 무력화시키고 가속페달과 브레이크의 제어를 인계받을 것이다. 경고: AEB를 비활성화합니다! diff --git a/selfdrive/ui/translations/main_zh-CHS.ts b/selfdrive/ui/translations/main_zh-CHS.ts index 424488fc56..744cf90345 100644 --- a/selfdrive/ui/translations/main_zh-CHS.ts +++ b/selfdrive/ui/translations/main_zh-CHS.ts @@ -108,152 +108,152 @@ DevicePanel - + Dongle ID 设备ID(Dongle ID) - + N/A N/A - + Serial 序列号 - + Driver Camera 驾驶员摄像头 - + PREVIEW 预览 - + Preview the driver facing camera to ensure that driver monitoring has good visibility. (vehicle must be off) 打开并预览驾驶员摄像头,以确保驾驶员监控具有良好视野。仅熄火时可用。 - + Reset Calibration 重置设备校准 - + RESET 重置 - + Are you sure you want to reset calibration? 您确定要重置设备校准吗? - + Review Training Guide 新手指南 - + REVIEW 查看 - + Review the rules, features, and limitations of openpilot 查看openpilot的使用规则,以及其功能和限制。 - + Are you sure you want to review the training guide? 您确定要查看新手指南吗? - + Regulatory 监管信息 - + VIEW 查看 - + Change Language 切换语言 - + CHANGE 切换 - + Select a language 选择语言 - + Reboot 重启 - + Power Off 关机 - + openpilot requires the device to be mounted within 4° left or right and within 5° up or 8° down. openpilot is continuously calibrating, resetting is rarely required. openpilot要求设备安装的偏航角在左4°和右4°之间,俯仰角在上5°和下8°之间。一般来说,openpilot会持续更新校准,很少需要重置。 - + Your device is pointed %1° %2 and %3° %4. 您的设备校准为%1° %2、%3° %4。 - + down 朝下 - + up 朝上 - + left 朝左 - + right 朝右 - + Are you sure you want to reboot? 您确定要重新启动吗? - + Disengage to Reboot 取消openpilot以重新启动 - + Are you sure you want to power off? 您确定要关机吗? - + Disengage to Power Off 取消openpilot以关机 @@ -486,30 +486,30 @@ location set NvgWindow - + km/h km/h - + mph mph - - + + MAX 最高定速 - - + + SPEED SPEED - - + + LIMIT LIMIT @@ -708,33 +708,33 @@ location set SettingsWindow - + × × - + Device 设备 - - + + Network 网络 - + Toggles 设定 - + Software 软件 - + Navigation 导航 @@ -973,68 +973,83 @@ location set SoftwarePanel - + Git Branch Git Branch - + Git Commit Git Commit - + OS Version 系统版本 - + Version 软件版本 - + Last Update Check 上次检查更新 - + The last time openpilot successfully checked for an update. The updater only runs while the car is off. 上一次成功检查更新的时间。更新程序仅在汽车熄火时运行。 - + Check for Update 检查更新 - + CHECKING 正在检查更新 - + + Switch Branch + + + + + ENTER + + + + + Enter name of new branch + + + + UNINSTALL 卸载 - + Uninstall %1 卸载 %1 - + Are you sure you want to uninstall? 您确定要卸载吗? - + failed to fetch update 获取更新失败 - - + + CHECK 查看 @@ -1122,82 +1137,92 @@ location set TogglesPanel - + Enable openpilot 启用openpilot - + Use the openpilot system for adaptive cruise control and lane keep driver assistance. Your attention is required at all times to use this feature. Changing this setting takes effect when the car is powered off. 使用openpilot进行自适应巡航和车道保持辅助。使用此功能时您必须时刻保持注意力。该设置的更改在熄火时生效。 - + Enable Lane Departure Warnings 启用车道偏离警告 - + Receive alerts to steer back into the lane when your vehicle drifts over a detected lane line without a turn signal activated while driving over 31 mph (50 km/h). 车速超过31mph(50km/h)时,若检测到车辆越过车道线且未打转向灯,系统将发出警告以提醒您返回车道。 - + Enable Right-Hand Drive 启用右舵模式 - + Allow openpilot to obey left-hand traffic conventions and perform driver monitoring on right driver seat. 允许openpilot遵守左侧交通惯例并在右侧驾驶座上执行驾驶员监控。 - + Use Metric System 使用公制单位 - + Display speed in km/h instead of mph. 显示车速时,以km/h代替mph。 - + Record and Upload Driver Camera 录制并上传驾驶员摄像头 - + Upload data from the driver facing camera and help improve the driver monitoring algorithm. 上传驾驶员摄像头的数据,帮助改进驾驶员监控算法。 - + Disengage On Accelerator Pedal 踩油门时取消控制 - + When enabled, pressing the accelerator pedal will disengage openpilot. 启用后,踩下油门踏板将取消openpilot。 - + Show ETA in 24h format 以24小时格式显示预计到达时间 - + Use 24h format instead of am/pm 使用24小时制代替am/pm - + + Show Map on Left Side of UI + + + + + Show map on left side when in split screen view. + + + + openpilot Longitudinal Control openpilot纵向控制 - + openpilot will disable the car's radar and will take over control of gas and brakes. Warning: this disables AEB! openpilot将禁用车辆的雷达并接管油门和刹车的控制。警告:AEB将被禁用! diff --git a/selfdrive/ui/translations/main_zh-CHT.ts b/selfdrive/ui/translations/main_zh-CHT.ts index 1eab75a6b4..30fd666edd 100644 --- a/selfdrive/ui/translations/main_zh-CHT.ts +++ b/selfdrive/ui/translations/main_zh-CHT.ts @@ -108,152 +108,152 @@ DevicePanel - + Dongle ID Dongle ID - + N/A 無法使用 - + Serial 序號 - + Driver Camera 駕駛員攝像頭 - + PREVIEW 預覽 - + Preview the driver facing camera to ensure that driver monitoring has good visibility. (vehicle must be off) 預覽駕駛員監控鏡頭畫面,以確保其具有良好視野。僅在熄火時可用。 - + Reset Calibration 重置校準 - + RESET 重置 - + Are you sure you want to reset calibration? 您確定要重置校準嗎? - + Review Training Guide 觀看使用教學 - + REVIEW 觀看 - + Review the rules, features, and limitations of openpilot 觀看 openpilot 的使用規則、功能和限制 - + Are you sure you want to review the training guide? 您確定要觀看使用教學嗎? - + Regulatory 法規/監管 - + VIEW 觀看 - + Change Language 更改語言 - + CHANGE 更改 - + Select a language 選擇語言 - + Reboot 重新啟動 - + Power Off 關機 - + openpilot requires the device to be mounted within 4° left or right and within 5° up or 8° down. openpilot is continuously calibrating, resetting is rarely required. openpilot 需要將裝置固定在左右偏差 4° 以內,朝上偏差 5° 以内或朝下偏差 8° 以内。鏡頭在後台會持續自動校準,很少有需要重置的情况。 - + Your device is pointed %1° %2 and %3° %4. 你的設備目前朝%2 %1° 以及朝%4 %3° 。 - + down - + up - + left - + right - + Are you sure you want to reboot? 您確定要重新啟動嗎? - + Disengage to Reboot 請先取消控車才能重新啟動 - + Are you sure you want to power off? 您確定您要關機嗎? - + Disengage to Power Off 請先取消控車才能關機 @@ -488,30 +488,30 @@ location set NvgWindow - + km/h km/h - + mph mph - - + + MAX 最高 - - + + SPEED 速度 - - + + LIMIT 速限 @@ -713,33 +713,33 @@ location set SettingsWindow - + × × - + Device 設備 - - + + Network 網路 - + Toggles 設定 - + Software 軟體 - + Navigation 導航 @@ -978,68 +978,83 @@ location set SoftwarePanel - + Git Branch Git 分支 - + Git Commit Git 提交 - + OS Version 系統版本 - + Version 版本 - + Last Update Check 上次檢查時間 - + The last time openpilot successfully checked for an update. The updater only runs while the car is off. 上次成功檢查更新的時間。更新系統只會在車子熄火時執行。 - + Check for Update 檢查更新 - + CHECKING 檢查中 - + + Switch Branch + + + + + ENTER + + + + + Enter name of new branch + + + + UNINSTALL 卸載 - + Uninstall %1 卸載 %1 - + Are you sure you want to uninstall? 您確定您要卸載嗎? - + failed to fetch update 下載更新失敗 - - + + CHECK 檢查 @@ -1127,82 +1142,92 @@ location set TogglesPanel - + Enable openpilot 啟用 openpilot - + Use the openpilot system for adaptive cruise control and lane keep driver assistance. Your attention is required at all times to use this feature. Changing this setting takes effect when the car is powered off. 使用 openpilot 的主動式巡航和車道保持功能,開啟後您需要持續集中注意力,設定變更在重新啟動車輛後生效。 - + Enable Lane Departure Warnings 啟用車道偏離警告 - + Receive alerts to steer back into the lane when your vehicle drifts over a detected lane line without a turn signal activated while driving over 31 mph (50 km/h). 車速在時速 50 公里 (31 英里) 以上且未打方向燈的情況下,如果偵測到車輛駛出目前車道線時,發出車道偏離警告。 - + Enable Right-Hand Drive 啟用右駕模式 - + Allow openpilot to obey left-hand traffic conventions and perform driver monitoring on right driver seat. openpilot 將對右側駕駛進行監控 (但仍遵守靠左駕的交通慣例)。 - + Use Metric System 使用公制單位 - + Display speed in km/h instead of mph. 啟用後,速度單位顯示將從 mp/h 改為 km/h。 - + Record and Upload Driver Camera 記錄並上傳駕駛監控影像 - + Upload data from the driver facing camera and help improve the driver monitoring algorithm. 上傳駕駛監控的錄像來協助我們提升駕駛監控的準確率。 - + Disengage On Accelerator Pedal 油門取消控車 - + When enabled, pressing the accelerator pedal will disengage openpilot. 啟用後,踩踏油門將會取消 openpilot 控制。 - + Show ETA in 24h format 預計到達時間單位改用 24 小時制 - + Use 24h format instead of am/pm 使用 24 小時制。(預設值為 12 小時制) - + + Show Map on Left Side of UI + + + + + Show map on left side when in split screen view. + + + + openpilot Longitudinal Control openpilot 縱向控制 - + openpilot will disable the car's radar and will take over control of gas and brakes. Warning: this disables AEB! openpilot 將會關閉雷達訊號並接管油門和剎車的控制。注意:這也會關閉自動緊急煞車 (AEB) 系統! diff --git a/selfdrive/ui/ui.cc b/selfdrive/ui/ui.cc index 7922714c17..317ef497a5 100644 --- a/selfdrive/ui/ui.cc +++ b/selfdrive/ui/ui.cc @@ -192,7 +192,9 @@ static void update_state(UIState *s) { } void ui_update_params(UIState *s) { - s->scene.is_metric = Params().getBool("IsMetric"); + auto params = Params(); + s->scene.is_metric = params.getBool("IsMetric"); + s->scene.map_on_left = params.getBool("NavSettingLeftSide"); } void UIState::updateStatus() { diff --git a/selfdrive/ui/ui.h b/selfdrive/ui/ui.h index 1aee3df9a1..16f78cdef4 100644 --- a/selfdrive/ui/ui.h +++ b/selfdrive/ui/ui.h @@ -101,7 +101,7 @@ typedef struct UIScene { QPointF lead_vertices[2]; float light_sensor, accel_sensor, gyro_sensor; - bool started, ignition, is_metric, longitudinal_control; + bool started, ignition, is_metric, map_on_left, longitudinal_control; uint64_t started_frame; } UIScene; diff --git a/selfdrive/ui/watch3.cc b/selfdrive/ui/watch3.cc index 00d23ea976..d6b5cc67a7 100644 --- a/selfdrive/ui/watch3.cc +++ b/selfdrive/ui/watch3.cc @@ -19,6 +19,7 @@ int main(int argc, char *argv[]) { { QHBoxLayout *hlayout = new QHBoxLayout(); layout->addLayout(hlayout); + hlayout->addWidget(new CameraViewWidget("navd", VISION_STREAM_MAP, false)); hlayout->addWidget(new CameraViewWidget("camerad", VISION_STREAM_ROAD, false)); } diff --git a/selfdrive/updated.py b/selfdrive/updated.py index bdec383f52..e8905962b2 100755 --- a/selfdrive/updated.py +++ b/selfdrive/updated.py @@ -314,18 +314,26 @@ def fetch_update(wait_helper: WaitTimeHelper) -> bool: new_version: bool = cur_hash != upstream_hash git_fetch_result = check_git_fetch_result(git_fetch_output) + new_branch = Params().get("SwitchToBranch", encoding='utf8') + if new_branch is not None: + new_version = True + cloudlog.info(f"comparing {cur_hash} to {upstream_hash}") if new_version or git_fetch_result: cloudlog.info("Running update") if new_version: cloudlog.info("git reset in progress") - r = [ - run(["git", "reset", "--hard", "@{u}"], OVERLAY_MERGED, low_priority=True), - run(["git", "clean", "-xdf"], OVERLAY_MERGED, low_priority=True ), - run(["git", "submodule", "init"], OVERLAY_MERGED, low_priority=True), - run(["git", "submodule", "update"], OVERLAY_MERGED, low_priority=True), + cmds = [ + ["git", "reset", "--hard", "@{u}"], + ["git", "clean", "-xdf"], + ["git", "submodule", "init"], + ["git", "submodule", "update"], ] + if new_branch is not None: + cloudlog.info(f"switching to branch {repr(new_branch)}") + cmds.insert(0, ["git", "checkout", "-f", new_branch]) + r = [run(cmd, OVERLAY_MERGED, low_priority=True) for cmd in cmds] cloudlog.info("git reset success: %s", '\n'.join(r)) if AGNOS: diff --git a/tools/replay/logreader.cc b/tools/replay/logreader.cc index f27224ac53..9b7a07a83f 100644 --- a/tools/replay/logreader.cc +++ b/tools/replay/logreader.cc @@ -47,22 +47,22 @@ LogReader::~LogReader() { } bool LogReader::load(const std::string &url, std::atomic *abort, bool local_cache, int chunk_size, int retries) { - FileReader f(local_cache, chunk_size, retries); - std::string data = f.read(url, abort); - if (data.empty()) return false; + raw_ = FileReader(local_cache, chunk_size, retries).read(url, abort); + if (raw_.empty()) return false; - return load((std::byte*)data.data(), data.size(), abort); + if (url.find(".bz2") != std::string::npos) { + raw_ = decompressBZ2(raw_, abort); + if (raw_.empty()) return false; + } + return parse(abort); } bool LogReader::load(const std::byte *data, size_t size, std::atomic *abort) { - raw_ = decompressBZ2(data, size, abort); - if (raw_.empty()) { - if (!(abort && *abort)) { - rWarning("failed to decompress log"); - } - return false; - } + raw_.assign((const char *)data, size); + return parse(abort); +} +bool LogReader::parse(std::atomic *abort) { try { kj::ArrayPtr words((const capnp::word *)raw_.data(), raw_.size() / sizeof(capnp::word)); while (words.size() > 0 && !(abort && *abort)) { diff --git a/tools/replay/logreader.h b/tools/replay/logreader.h index fb63bf3913..bd666d0a74 100644 --- a/tools/replay/logreader.h +++ b/tools/replay/logreader.h @@ -52,10 +52,10 @@ public: ~LogReader(); bool load(const std::string &url, std::atomic *abort = nullptr, bool local_cache = false, int chunk_size = -1, int retries = 0); bool load(const std::byte *data, size_t size, std::atomic *abort = nullptr); - std::vector events; private: + bool parse(std::atomic *abort); std::string raw_; #ifdef HAS_MEMORY_RESOURCE std::pmr::monotonic_buffer_resource *mbr_ = nullptr; diff --git a/tools/replay/route.cc b/tools/replay/route.cc index 5b47090229..c91b27ae81 100644 --- a/tools/replay/route.cc +++ b/tools/replay/route.cc @@ -82,9 +82,9 @@ void Route::addFileToSegment(int n, const QString &file) { const int pos = name.lastIndexOf("--"); name = pos != -1 ? name.mid(pos + 2) : name; - if (name == "rlog.bz2") { + if (name == "rlog.bz2" || name == "rlog") { segments_[n].rlog = file; - } else if (name == "qlog.bz2") { + } else if (name == "qlog.bz2" || name == "qlog") { segments_[n].qlog = file; } else if (name == "fcamera.hevc") { segments_[n].road_cam = file; diff --git a/tools/replay/tests/test_replay.cc b/tools/replay/tests/test_replay.cc index bd5dee013c..d6482c3ca2 100644 --- a/tools/replay/tests/test_replay.cc +++ b/tools/replay/tests/test_replay.cc @@ -71,6 +71,7 @@ TEST_CASE("LogReader") { FileReader reader(true); std::string corrupt_content = reader.read(TEST_RLOG_URL); corrupt_content.resize(corrupt_content.length() / 2); + corrupt_content = decompressBZ2(corrupt_content); LogReader log; REQUIRE(log.load((std::byte *)corrupt_content.data(), corrupt_content.size())); REQUIRE(log.events.size() > 0); diff --git a/tools/sim/start_carla.sh b/tools/sim/start_carla.sh index 67ced7eb21..7ead6699f0 100755 --- a/tools/sim/start_carla.sh +++ b/tools/sim/start_carla.sh @@ -22,6 +22,7 @@ if [[ "$DETACH" ]]; then EXTRA_ARGS="-d" fi +docker kill carla_sim || true docker run \ --name carla_sim \ --rm \