diff --git a/.gitignore b/.gitignore index 5f44371e5..810756400 100644 --- a/.gitignore +++ b/.gitignore @@ -44,9 +44,6 @@ selfdrive/mapd/default_speeds_by_region.json system/proclogd/proclogd selfdrive/ui/_ui selfdrive/test/longitudinal_maneuvers/out -selfdrive/visiond/visiond -selfdrive/sensord/_gpsd -selfdrive/sensord/_sensord system/camerad/camerad system/camerad/test/ae_gray_test selfdrive/modeld/_modeld @@ -64,7 +61,7 @@ panda_jungle provisioning .coverage* -coverage.xml +coverage.xmlcar htmlcov pandaextra @@ -85,3 +82,7 @@ build/ poetry.toml selfdrive/ui/_ui_nonav +*events.po~ +selfdrive/loggerd/bootlog +selfdrive/loggerd/loggerd +selfdrive/proclogd/proclogd diff --git a/CHANGELOGS.md b/CHANGELOGS.md index 8e0389608..33bd70667 100644 --- a/CHANGELOGS.md +++ b/CHANGELOGS.md @@ -1,95 +1,34 @@ -dragonpilot [Latest] - EON/C2 Release -======================== +dragonpilot [2023.2.15] +======================= * Synced with openpilot master 2022.12.14 commits. -* TWEAK: Ability to disable build-in NAV completely. (reduced CPU/memory load) -* NEW: Lateral Controller Selector - * Ability to select between DEFAULT / PID / LQR / Torque Controller. -* NEW: Redesigned UI to match Comma's new UI/UX style. -* NEW: Dynamic End-to-End can be turned on when lead car is going below x km/h. (Useful for stop and go traffic.) -* NEW: Toggle to adapt Dynamic End-to-End to Following Dist. Mode. -* NEW: Toggle to adapt Dynamic End-to-End to Accel Mode. +* Comma 0.9.1 release + * New driving model + * 30% improved height estimation resulting in better driving performance for tall cars + * UI updates + * Adjust alert volume using ambient noise level + * Driver monitoring icon shows driver's head pose * NEW: Always On Lateral v2 (For Toyota/VAG/HKG/Honda). -* NEW: VAG - vw-spam-resume (Thanks to @jyoung8607) -* FIXED: Bugs in updated. -* FIXED: Issue in C2 fan control. -* TWEAK: Bug fixes and improvement. +* NEW: Block ALC if it's close to the road edges. +* NEW: Rinbow path toggle. (This effect is purely cosmetic) +* IMPROVEMENT: Better TSS2 Long and DF tune. @cgw1968-5779 +* Bug fixes and improvement. -dragonpilot 2022.11.09 - EON/C2 Release -======================== -* Synced with openpilot master 2022.10.26 commits. -* COMMA: Torque controller used on all Toyota, Lexus, Hyundai, Kia, and Genesis models. -* NEW: Mapd Database selector menu to use mapd offline located in software. When installing Database it will take some time. It is not stuck just be patience run `tmux a` for more info. DO NOT RESTART When database is being installed. - * Ability to use MapD without internet connection. -* NEW: TOYOTA - Better TSS2 Long and DF tune. @cgw1968-5779 -* NEW: MAZDA - Toggle to bypass dashcam mode. -* NEW: Added lanelines mode. - * Ability to adjust camera/path offset. -* NEW: Lateral Planner option. - * Ability to select 0.8.13, 0.8.16 and the latest/current planner. -* NEW: Offline OSM map database. -* NEW: Turn and BSM indicator. (turn = blink green, turn + bsm = blink yellow, bsm = solid yellow) -* TWEAK: Better Optimization for Vision Turn Controller with laneline mode. -* FIXED: When going offroad, the screen does not turn off. (w/ CP or w/ Battery) -* bug fix and improvement. +dragonpilot [2023.1.10] +======================= +* Synced with openpilot master 2023.1.3 commits. +* IMPROVEMENT: Dynamic end to end refactored. It will automatically turn on and off for red light for smoother u/x. Now Supports (honda and vw that cab take advantage of VOACC). +* IMPROVEMENT: Better TSS2 Long and DF tune. @cgw1968-5779 +* ADDED: support for Chevrolet Trailblazer 2022 (Thanks @TurboCE) +* ADDED: support for Honda odyssey hybrid 2022 China (Thanks @lijunhao731) +* ADDED: GPS accuracy on the sidebar. +* Bug fixes and improvement. +HOTFIX: +======================= +* Allow Experimental Mode in release branch. (@Stupefacient) +* Happy Holiday / New Years! Safe Travel, cya in 2023! -dragonpilot 2022.10.17 - EON/C2 Release -======================== -* Synced with openpilot master 2022.09.22 commits. - * Live Torque Tune (Only available to certain vehicle models with op long.) -* NEW: TOYOTA - Added a TSS2 RAV4 Special PID Tune toggle. -* NEW: TOYOTA - Added a PRIUS 2017 Special Torque Tune toggle. -* NEW: TOYOTA - PRIUS_TSS2 (2020-2022) now uses torque as default and auto learns. -* NEW: Added a toggle to force enable torque controller. (may not work on some vehicles) -* NEW: Added a toggle to force enable live torque tune. (may not work on some vehicles) -* NEW: VAG - Added auto resume fix toggle. -* NEW: refactored dynamic follow. support all car with op long. -* NEW: New blinker and BSM indicators. -* NEW: Lead Info is now displaying both speed and distance. -* FIXED: Minor bug fixes and improvement. - -dragonpilot 2022.09.22 - EON/C2 Release -======================== -* Synced with openpilot master 2022.09.17 commits. - * e2e longitudinal toggle. (Extremely alpha feature) - * Deprecated SNPE lib and switched to tinygrad. -* NEW: Added back nav support on EON/C2. -* WARNING: DUE TO THE INTRODUCTION OF END TO END LONGITUDINAL FEATURE, FOLLOWING FEATURES HAS BEEN CHANGED: - * WIP: Dynamic Follow has been temporary removed for refactoring. - * WIP: Vision Turn Control has been temporary removed for refactoring. - * REMOVED: Camera offset has been removed permanently due to new e2e implementation. - * EON/C2 WILL NO LONGER RECEIVE ANY DRIVING/DRIVER MONITORING MODEL UPDATES. - -dragonpilot 2022.08.29 - EON/C2 Release -======================== -* NEW: Synced to openpilot master 2022.08.23 commits. - * New driving model. -* NEW: Added back honda eps mod toggle. -* NEW: Added back camera offset toggle. -* TWEAK: Resume logic to adapt ATL mode. - -dragonpilot 2022.08.17 - EON/C2 Release -======================== -* NEW: Synced to openpilot master 2022.08.07 commits. -* NEW: Added back auto shutdown toggle. -* NEW: Added back On-Road Dashcam toggle. (You should not replace this with your dashcam!!!) -* NEW: Added back LQR tune toggle. -* NEW: MAZDA - Ability to enable/disable below steer speed alert. (Thanks to @TheCrowd) -* NEW: Included all vehicles. -* TWEAK: Panda Recovery should kill boardd process first. -* FIXED: Fixed stop working issue when mapd crashed. - -dragonpilot 2022.07.29 - EON/C2 Release -======================== -* NEW: Synced to openpilot 2022.07.27 commits. -* NEW: Included Mazda vehicles. -* TWEAK: Only show road name bar when it's not empty. -* TWEAK: Enlarged lead car distance text. -* TWEAK: TOYOTA - Updated lowest speed override feature. -* FIXED: Fixed Panda Flash/Recovery buttons. -* FIXED: Included dp_patcher.py execution. - -dragonpilot [latest] +dragonpilot 2022.12.13 ======================= * Synced with openpilot master 2022.12.13 commits. * COMMA: New model, Toyota users can now configure SWAY settings. @@ -217,30 +156,6 @@ TWEAK: TOYOTA - Updated lowest speed override feature. FIXED: Fixed Panda Flash/Recovery buttons. FIXED: Included dp_patcher.py execution. -dragonpilot 2022.07.20 - EON/C2 Release -======================== -* FIXED: Included correct camera/path offset values for EON/C2. -* FIXED: Param bug in HKG. (Thanks to @sunnyhaibin). -* FIXED: Included fan controller for UNO (C2). -* TWEAK: Auto set a decent date/time to prevent onroad incorrect date/time detection. -* TWEAK: Removed sounds unavailable warning. -* TWEAK: Removed unused loggers. -* TWEAK: Disabled IR controls completely. - -dragonpilot 2022.07.14 - EON/C2 Release -======================== -* FIXED: DM bug. -* FIXED: white / grey panda support. -* FIXED: Removed No GPS signal warning. - -dragonpilot 2022.07.12 - EON/C2 Release -======================== -* Synced up with dragonpilot 2022.06.25 C3 release -* Running on latest AI model. -* Steering monitor only. -* Works on EON/C2 + white/grey/black panda (tested only on Toyotas). -* Buggy! - dragonpilot [2022.08.07] ======================== * Synced to openpilot master 2022.08.07 commits. diff --git a/CHANGELOGS_c2.md b/CHANGELOGS_c2.md new file mode 100644 index 000000000..3fa205e27 --- /dev/null +++ b/CHANGELOGS_c2.md @@ -0,0 +1,965 @@ +dragonpilot [Latest] - EON/C2 Release +======================== +* Synced with openpilot master 2023.03.08 commits. +* DP Highlight + * Refactored cameraview widget. + * Updated VisionIPC to match current version. + * Rainbow mode. (fancy lol) + * Different color when Always On Lateral is enabled. + * IMPROVEMENT: Better TSS2 Long and DF tune. @cgw1968-5779 + * NEW: Alternative Lateral Controller + * Ability to switch to another lateral controller when SET speed is higher than configure speed. + * E.g. Use Torque + Laneless when belows 80kph and use PID + Laneline when above. + * DM reverted back to 0.8.13 model and algorithm. + +dragonpilot 2023.02.08 - EON/C2 Release +======================== +* Synced with openpilot master 2022.12.14 commits. +* TWEAK: Ability to disable build-in NAV completely. (reduced CPU/memory load) +* NEW: Lateral Controller Selector + * Ability to select between DEFAULT / PID / LQR / Torque Controller. +* NEW: Redesigned UI to match Comma's new UI/UX style. +* NEW: Dynamic End-to-End can be turned on when lead car is going below x km/h. (Useful for stop and go traffic.) +* NEW: Toggle to adapt Dynamic End-to-End to Following Dist. Mode. +* NEW: Toggle to adapt Dynamic End-to-End to Accel Mode. +* NEW: Always On Lateral v2 (For Toyota/VAG/HKG/Honda). +* NEW: VAG - vw-spam-resume (Thanks to @jyoung8607) +* FIXED: Bugs in updated. +* FIXED: Issue in C2 fan control. +* TWEAK: Bug fixes and improvement. + +dragonpilot 2022.11.09 - EON/C2 Release +======================== +* Synced with openpilot master 2022.10.26 commits. +* COMMA: Torque controller used on all Toyota, Lexus, Hyundai, Kia, and Genesis models. +* NEW: Mapd Database selector menu to use mapd offline located in software. When installing Database it will take some time. It is not stuck just be patience run `tmux a` for more info. DO NOT RESTART When database is being installed. + * Ability to use MapD without internet connection. +* NEW: TOYOTA - Better TSS2 Long and DF tune. @cgw1968-5779 +* NEW: MAZDA - Toggle to bypass dashcam mode. +* NEW: Added lanelines mode. + * Ability to adjust camera/path offset. +* NEW: Lateral Planner option. + * Ability to select 0.8.13, 0.8.16 and the latest/current planner. +* NEW: Offline OSM map database. +* NEW: Turn and BSM indicator. (turn = blink green, turn + bsm = blink yellow, bsm = solid yellow) +* TWEAK: Better Optimization for Vision Turn Controller with laneline mode. +* FIXED: When going offroad, the screen does not turn off. (w/ CP or w/ Battery) +* bug fix and improvement. + + +dragonpilot 2022.10.17 - EON/C2 Release +======================== +* Synced with openpilot master 2022.09.22 commits. + * Live Torque Tune (Only available to certain vehicle models with op long.) +* NEW: TOYOTA - Added a TSS2 RAV4 Special PID Tune toggle. +* NEW: TOYOTA - Added a PRIUS 2017 Special Torque Tune toggle. +* NEW: TOYOTA - PRIUS_TSS2 (2020-2022) now uses torque as default and auto learns. +* NEW: Added a toggle to force enable torque controller. (may not work on some vehicles) +* NEW: Added a toggle to force enable live torque tune. (may not work on some vehicles) +* NEW: VAG - Added auto resume fix toggle. +* NEW: refactored dynamic follow. support all car with op long. +* NEW: New blinker and BSM indicators. +* NEW: Lead Info is now displaying both speed and distance. +* FIXED: Minor bug fixes and improvement. + +dragonpilot 2022.09.22 - EON/C2 Release +======================== +* Synced with openpilot master 2022.09.17 commits. + * e2e longitudinal toggle. (Extremely alpha feature) + * Deprecated SNPE lib and switched to tinygrad. +* NEW: Added back nav support on EON/C2. +* WARNING: DUE TO THE INTRODUCTION OF END TO END LONGITUDINAL FEATURE, FOLLOWING FEATURES HAS BEEN CHANGED: + * WIP: Dynamic Follow has been temporary removed for refactoring. + * WIP: Vision Turn Control has been temporary removed for refactoring. + * REMOVED: Camera offset has been removed permanently due to new e2e implementation. + * EON/C2 WILL NO LONGER RECEIVE ANY DRIVING/DRIVER MONITORING MODEL UPDATES. + +dragonpilot 2022.08.29 - EON/C2 Release +======================== +* NEW: Synced to openpilot master 2022.08.23 commits. + * New driving model. +* NEW: Added back honda eps mod toggle. +* NEW: Added back camera offset toggle. +* TWEAK: Resume logic to adapt ATL mode. + +dragonpilot 2022.08.17 - EON/C2 Release +======================== +* NEW: Synced to openpilot master 2022.08.07 commits. +* NEW: Added back auto shutdown toggle. +* NEW: Added back On-Road Dashcam toggle. (You should not replace this with your dashcam!!!) +* NEW: Added back LQR tune toggle. +* NEW: MAZDA - Ability to enable/disable below steer speed alert. (Thanks to @TheCrowd) +* NEW: Included all vehicles. +* TWEAK: Panda Recovery should kill boardd process first. +* FIXED: Fixed stop working issue when mapd crashed. + +dragonpilot 2022.07.29 - EON/C2 Release +======================== +* NEW: Synced to openpilot 2022.07.27 commits. +* NEW: Included Mazda vehicles. +* TWEAK: Only show road name bar when it's not empty. +* TWEAK: Enlarged lead car distance text. +* TWEAK: TOYOTA - Updated lowest speed override feature. +* FIXED: Fixed Panda Flash/Recovery buttons. +* FIXED: Included dp_patcher.py execution. + +dragonpilot 2022.07.20 - EON/C2 Release +======================== +* FIXED: Included correct camera/path offset values for EON/C2. +* FIXED: Param bug in HKG. (Thanks to @sunnyhaibin). +* FIXED: Included fan controller for UNO (C2). +* TWEAK: Auto set a decent date/time to prevent onroad incorrect date/time detection. +* TWEAK: Removed sounds unavailable warning. +* TWEAK: Removed unused loggers. +* TWEAK: Disabled IR controls completely. + +dragonpilot 2022.07.14 - EON/C2 Release +======================== +* FIXED: DM bug. +* FIXED: white / grey panda support. +* FIXED: Removed No GPS signal warning. + +dragonpilot 2022.07.12 - EON/C2 Release +======================== +* Synced up with dragonpilot 2022.06.25 C3 release +* Running on latest AI model. +* Steering monitor only. +* Works on EON/C2 + white/grey/black panda (tested only on Toyotas). +* Buggy! + +dragonpilot 2022.07.01 +======================== +* Synced with openpilot master 2022.06.29 commits. +* ADDED: MapD based off @move-fast. Thanks to @sunnyhaibin for mapbox as datapoint and ui refactor. (setting destination will use mapxbox speedlimit data which is more accurate. MapD priority: Mapbox(if nav active), OSM, RSA ) + +dragonpilot 2022.06.25 +======================== +* Synced with openpilot master 2022.06.25 commits. +* Updated zh-TW translation. +* ADDED: Dynamid follow @krkeegan version. (press the distance button) +* ADDED: dp ui vol. +* ADDED: dp ui brightness. +* ADDED: dp ui top/side bar. +* ADDED: dp display mode (0=off/normal, 1=turn off the screen when onroad). + +dragonpilot 2022.06.16 +======================== +* Synced with openpilot master 2022.06.16 commits. +* ADDED: Toyota SnG hack. +* ADDED: Accel Profile. +* FIXED: Car Selection. +* FLXED: ALCA Delay Setting UI. +* FIXED: Lane lines mode (w/ DLP built-in). + +dragonpilot 2022.06.11 +======================== +* Synced with openpilot master 2022.06.07 commits +* Migrating more features soon, stay tuned! + +dragonpilot 0.8.13-1 +======================== +* Based on openpilot 0.8.13 devel. +* ADDED: Support for SDSU. Can now control distance with the button on the steering wheel. (Thanks to @CT9212) +* FIXED: DLP fix. (Thank to @Hikari1023) +* Bug fixes. + +dragonpilot 0.8.12-3 +======================== +* Bug fixes. +* ADDED: Car Selector for C3. +* ADDED: ColorBlind mode eon only. (thanks to @ihsakashi) +* TUNNING: Toyota long improvement. +* Reimplement: Following Distance and added @krkeegan implementation (toyota only with sdsu/tss2). + +dragonpilot 0.8.12-2 +======================== +* Bug fixes. +* ADDED: FTP to easily manage storage. +* Readded: camera offset, path offset and autoshutdown. + +dragonpilot 0.8.12-1 +======================== +* Based on openpilot 0.8.12 devel. +* ADDED: Support for no gps (mr.one panda). +* Reimplement: camera offset, path offset, nav for c2 and autoshutdown. + +dragonpilot 0.8.10-4 +======================== +* FIXED: Allow gas press. (Thanks to @loveloveses) +* FIXED: Honda SnG. (Thanks to @loveloveses +* ADDED: Toyota: Display Blue Barriers When Engaged. (Thanks to @krkeegan) + +dragonpilot 0.8.10-3 +======================== +* NAV: Gaode/amap to use new key combination. (Thanks to @loveloveses) + +dragonpilot 0.8.10 +======================== +* Based on openpilot 0.8.10 devel. +* Reimplement: Following Distance. +* Better Subaru support. (Thanks to @martinl https://github.com/martinl/openpilot) +* NAV: Added use of Navigation tab to access home/work/recent dest. +* NAV: Added auto Day/Night Mode. +* NAV: Added customizable style. +* NAV: Added Gaode/amap Search. (Thanks to @loveloveses) +* FIXED: Device w/ battery no longer need to set auto shutdown to 1 min. +* FIXED: Auto shutdown while on bench (Thanks to @sunnyhaibin) +* REMOVED: Timebomb feature for VW. +* REMOVED: Support of running Android apps. + +dragonpilot 0.8.9-3 +======================== +* Bug fixes. +* Fixed up auto updater. +* Fixed Honda Jade dbc. (Thanks to @lijunhao731) +* ADDED: 0.8.10 model. +* ADDED: Nav for all device. +* ADDED: Support for Nvidia Xavier. + +dragonpilot 0.8.9-2 +======================== +* Bug fixes. +* Refactor UI related changes. +* Updated Simplified Chinese translation. (Thanks to @CCZ) +* WARNING: Due to recent OP change, Device w/ battery recommended setting autoshutdown to 1 min to prevent libusb error. +* Re-tuned acceleraton profile. (Thank to @wer5lcy) +* ADDED: Car port for Toyota Prius Alpha. (Thanks to @CT921) + +dragonpilot 0.8.9-1 +======================== +* Based on openpilot 0.8.8 devel. +* Re-introduce Follow Distance 4th profile (2.2s / 1.8s / 1.5s / 1.2s). +* ADDED: New softer sound for c3. +* ADDED: Dynamic Lane Profile. (Thanks to @sunnyhaibin) +* Bug Fixes. + +dragonpilot 0.8.8-2 +======================== +* ADDED: newer faster and modularized mapd and slow down for curve. (Thanks to @move-fast) +* ADDED: Street name on the bottom bar. +* ADDED: Now supports 1+3t / C2 / C3 / Jetson Xavier NX. +* ADDED: Smoother tune for PRIUS_TSS2. +* Bug fixes. + +dragonpilot 0.8.8-1 +======================== +** BETA TESTING ONLY ** +* Based on openpilot 0.8.8 devel. +* FIXED: dashcam issue. +* FIXED: some VW vehicles issue. (Thanks to @yayism) +* FIXED: white panda + j533 acc issue. (Thanks to @lirudy) +* ADDED: Auto fake black panda. +* ADDED: 2018 chinese camry hybrid fingerprint (Thanks to @stingshen) +* WIP: mapd. + +dragonpilot 0.8.7-4 +======================== +* 2017 JADE w/ Added Comma Pedal Support. (Thanks to @lijunhao731) +* Fixed toyota / honda brake light display. (Thanks to @loveloveses) +* Fixed UI toggle. (Thanks to @鄧育林、@謝聖鴻) +* Fixed VW resume/display issue. (Thanks to @SKY) +* Fixed CJK font installation issue. + +dragonpilot 0.8.7-3 +======================== +* Bug fixes. +* Fixed gpxd. +* Added some Chinese support. + +dragonpilot 0.8.7-2 +======================== +* Fixed sound issue. +* Changed gpx logs to OSM compatible format. +* HONDA: Added BSM support for CRV-Hybrid. +* HONDA: Added toggle to force displaying km/h in HUD. +* TOYOTA: Add new Toggles under DP - Cars to enable/disable Following Modes / Accel Modes with physical button feature. + +dragonpilot 0.8.7-1 +======================== +* Based on openpilot 0.8.7 devel. +* Support 1+3t / C2 / Jetson Xavier NX. +* Support White / Grey Panda. +* TOYOTA: Can now change Following Modes with physical button from the steering wheel. +* TOYOTA: Can now change Acceleration Modes with physical button if your car supports it. +* TOYOTA: Added Low speed override toggles. +* Dev UI now displays RPM reading. +* Added Prebuilt toggle for faster boot. +* Lexus RX high RPM fix. (Thanks to @crazysim). +* Added toggle to launch Language settings. +* Added toggle to launch Volume settings. +* Added toggle to launch date/time settings. +* Added toggle to flash panda. +* Added toggle to recover panda firmware. +* Added toggle to delete logging (/sdcard/realdata). +* Added GPS Logger. + +dragonpilot 0.8.6-1 +======================== +* Based on openpilot 0.8.6 devel. +* Support 1+3t / C2 / Jetson Xavier NX. +* Support White / Grey Panda. + +dragonpilot 0.8.5-4 +======================== +* Added multiple toggles. +* Code clean up. +* Android app support. (see selfdrive/dragonpilot/HOWTO-APPD.md) +* Better support for VW MPQ (Thanks to @Saber) + +dragonpilot 0.8.5-3 +======================== +* Added Jetson support toggle. +* Added Steering Ratio controller. +* Reduce Following Profile to 3 modes only. (1.8s / 1.5s / 1.2s) +* Bug fixes. + +dragonpilot 0.8.5-2 +======================== +* Added black panda simulation toggle. +* Added No GPS toggle. +* Added No Battery Toggle. +* Bug fixes. + +dragonpilot 0.8.5-1 +======================== +* Based on openpilot 0.8.5 devel. +* 基於 openpilot 0.8.5 devel. +* Support 1+3t / C2 / Jetson Xavier NX. +* 支持 1+3t / C2 / Jetson Xavier NX. +* No White/Grey Panda Support. +* 不支持白灰熊. + +dragonpilot 0.8.4-3 +======================== +* 簡化 1+3t 安裝方法. (請查閱 HOWTO-ONEPLUS.md) +* Simplied 1+3t installation. (See HOWTO-ONEPLUS.md) +* 加回舊 ssh 登錄. +* Good old ssh key. +* 修復本田錯誤. (感謝 @loveloveses) +* Fixed Honda bug. (Thanks to @loveloveses) + +dragonpilot 0.8.4-2 +======================== +* 加回可調整加速/跟車設定. +* Added back Accel/Following Profile. +* 支持 Headless Jetson Xavier NX (https://github.com/efinilan/xnxpilot.git) +* Support Headless Jetson Xavier NX (https://github.com/efinilan/xnxpilot.git) +* 支持 1+3t (需額外安裝手續) +* Support 1+3t (Require additional install procedure) +* 支持白/灰熊 +* Support White/Grey Panda. + +dragonpilot 0.8.4-1 +======================== +* 基於 openpilot 0.8.4 devel. +* Based on openpilot 0.8.4 devel. + +dragonpilot 0.8.1 +======================== +* 基於最新 openpilot 0.8.1 devel. +* Based on latest openpilot 0.8.1 devel. +* 加入行車記錄按鈕。(感謝 @toyboxZ 提供) +* Added REC screen button. (Thanks to @toyboxZ) + +dragonpilot 0.8.0 +======================== +* 基於最新 openpilot 0.8.0 devel. +* Based on latest openpilot 0.8.0 devel. +* 加入 git 錯誤修正。(感謝 @toyboxZ 提供) +* Added git error fix. (Thanks to @toyboxZ) + +dragonpilot 0.7.10.1 +======================== +* HYUNDAI_GENESIS 使用 INDI 控制器。(感謝 @donfyffe 提供) +* HYUNDAI_GENESIS uses INDI controller. (Thanks to @donfyffe) +* HYUNDAI_GENESIS 加入 Cruise 按紐 和 lkMode 支援。(感謝 @donfyffe 建議) +* HYUNDAI_GENESIS added Cruise button event and lkMode feature. (Thanks to @donfyffe) +* 支援台灣版 2018 Huyndai IONIQ + smart MDPS (dp_hkg_smart_mdps) (感謝 @andy741217 提供) +* Support 2018 Taiwan Hyundai IONIQ + smart MDPS (dp_hkg_smart_mdps) (Thanks to @andy741217) +* 使用 openpilot v0.8 的模型。(感謝 @eisenheim) +* Use openpilot v0.8 model. (Thanks to @eisenheim) +* 加入 0.8 測試版的部分優化。 +* Added optimizations from pre-0.8. +* 加入 dp_honda_eps_mod 設定來使用更高的扭力 (需 eps mod)。(感謝 @Wuxl_369 提供) +* Added dp_honda_eps_mod setting to enable higher torque (eps mod required). (Thanks to @Wuxl_369) +* 修正 VW 對白/灰熊的支援 (感謝 @lirudy 提供) +* Fixed issue with white/grey panda support for VW (Thanks to @lirudy) +* GENESIS_G70 優化 (感謝 @sebastian4k 提供) +* GENESIS_G70 Optimisation (Thanks to @sebastian4k) +* HYUNDAI_GENESIS 優化 (感謝 @donfyffe 提供) +* HYUNDAI_GENESIS Optimisation (Thanks to @donfyffe) +* 加入 Dynamic gas Lite。(感謝 @toyboxZ 提供) +* Added Dynamic Gas Lite. (Thanks to @toyboxZ) +* 加入來自 afa 的 Honda inspire, accord, crv SnG 優化。(感謝 @menwenliang 提供) +* Added Honda inspire, accord, crv SnG optimisation from afa fork. (Thanks to @menwenliang) +* 加入 dp_toyota_lowest_cruise_override_vego。(感謝 @toyboxZ 提供) +* Added dp_toyota_lowest_cruise_override_vego. (Thanks to @toyboxZ) + +dragonpilot 0.7.10.0 +======================== +* 基於最新 openpilot 0.7.10 devel. +* Based on latest openpilot 0.7.10 devel. +* 修正 Prius 特定情況下無法操控方向盤的問題。 +* Fixed unable to regain Prius steering control under certain condition. +* 更新 VW MQB 的支援。(需執行 scripts/vw.sh 腳本) +* Updated support of VW MQB. (scripts/vw.sh script required) +* 新增 2018 China Toyota CHR 指紋v2。(感謝 @xiaohongcheung 提供) +* Added 2018 China Toyota CHR FPv2. (Thanks to @xiaohongcheung) +* 加入 Headunit Reloaded Android Auto App 支援。(感謝 @Ninjaa 提供) +* Added Headunit Reloaded Android Auto App Support. (Thanks to @Ninjaa) +* 優化 nanovg。(感謝 @piggy 提供) +* Optomized nanovg. (Thanks to @piggy) +* 加入 complete_setup.sh (感謝 @深鲸希西 提供) +* Added complete_setup.sh (Thanks to @深鲸希西) +* Based on latest openpilot 0.7.10 devel. +* 修正 EON 接 PC/USB 充電器時仍會自動關機的錯誤。(感謝 @小愛 回報) +* Fixed auto shutdown issue when EON connect to PC/USB Charger. (Thanks to @LOVEChen) +* HYUNDAI_GENESIS 使用 INDI 控制器。(感謝 @donfyffe 提供) +* HYUNDAI_GENESIS uses INDI controller. (Thanks to @donfyffe) + +dragonpilot 0.7.8.3 +======================== +* VW 加入 6 分鐘時間方向盤控制限制輔助方案。(特別感謝 @actuallylemoncurd 提供代碼) +* VW added 6 minutes timebomb assist. (dp_timebomb_assist, special thanks to @actuallylemoncurd) + +dragonpilot 0.7.8.2 +======================== +* 修正在沒網路的情況下,開機超過五分鐘的問題。 +* Fixed 5+ minutes boot time issue when there is no internet connection. +* 錯誤回傳改使用 dp 的主機。 +* Used dp server for error reporting. +* 更新服務改使用 gitee 的 IP 檢查連線狀態。 +* updated service uses gitee IP address instead. + +dragonpilot 0.7.8.1 +======================== +* 加入 ko-KR 翻譯。 +* Added ko-KR translation. +* 加入 Honda Jade 支援。(感謝 @李俊灝) +* Added Honda Jade support. (Thanks to @lijunhao731) +* 修正 ui.cc 內存越界的問題。(感謝 @piggy 提供) +* Fixed ui.cc memory out of bound issue. (Thanks to @piggy) +* gpxd 記錄改自動存成 zip 格式。 +* gpxd now store in zip format. +* 強制關閉 panda 檢查 DOS 硬體。 +* Force disabled DOS hardware check in panda. + +dragonpilot 0.7.8.0 +======================== +* 基於最新 openpilot 0.7.8 devel. +* Based on latest openpilot 0.7.8 devel. +* 加入重置 DP 設定按鈕。(感謝 @LOVEChen 建議) +* Added "Reset DP Settings" button. (Thanks to @LOVEChen) +* 將警示訊息更改為類似於概念 UI 的設計。 +* Alert messages changed to concept UI alike design. +* 當 manager 出現錯誤後,按 Exit 按鈕會執行 reset_update 腳本。 +* Added ability to execute reset_update.sh when press "Exit" button once manager returned errors. + +dragonpilot 0.7.7.3 +======================== +* 修正方向盤監控。 +* Fixed steering monitor timer param. +* 修正行駛時關閉畫面導致當機的錯誤。(感謝 @salmankhan, @stevej99, @bobbydough 回報) +* Fixed screen frozen issue when "screen off while driving" toggle is enabled. (Thanks to @salmankhan, @stevej99, @bobbydough) +* 加回 Dev Mini UI 開關。(感謝 @Ninjaa 建議) +* Re-added Dev Mini UI. (Thanks to @Ninjaa) +* 新增 (dp_reset_live_parameters_on_start) 每次發車重設 LiveParameters 值。(感謝 @eisenheim) +* Added ability (dp_reset_live_param_on_start) to reset LiveParameters on each start. (Thanks @eisenheim) +* 修正同時開啟 dp_toyota_zss 和 dp_lqr 產生的錯誤。(感謝 @bobbydough) +* Fixed error cuased by enabling both dp_toyota_zss and dp_lqr at the same time. (Thanks to @bobbydough) +* 新增 (dp_gpxd) 將 GPS 軌跡導出至 GPX 格式 (/sdcard/gpx_logs/)的功能。 (感謝 @mageymoo1) +* Added ability (dp_gpxd) to export GPS track into GPX files (/sdcard/gpx_logs/). (Thanks to @mageymoo1) +* 使用德國的車道寬度估算值。 (感謝 @arne182) +* Used lane width estimate value from Germany. (Thanks to @arne182) + +dragonpilot 0.7.7.2 +======================== +* 加入 d_poly offset。 (感謝 @ShaneSmiskol) +* Added d_poly offset. (Thanks to @ShaneSmiskol) +* 加入 ZSS 支援。(感謝 @bobbydough, @WilliamPrius 建議, @bobbydough 測試) +* Added ZSS support. (Thanks to @bobbydough, @WilliamPrius for recommendation, @bobbydough for testing) +* 加入錯誤記錄至 /sdcard/crash_logs/ (感謝 @ShaneSmiskol 提供代碼) +* Added error logs to /sdcard/crash_logs/ (Special Thanks to @ShaneSmiskol) +* 加入 LQR 控制器開關進設定畫面。 +* Added LQR Controller toggle to settings. + +dragonpilot 0.7.7.1 +======================== +* 加入 C2 風扇靜音模式。(感謝 @dingliangxue) +* Added C2 quiet fan mode. (Thanks to @dingliangxue) +* 加入「輔助換道最低啟動速度」、「自動換道最低啟動速度」設定。 +* Added "Assisted Lane Change Min Engage Speed" and "Auto Lane Change Min Engage Speed" settings. +* 加入回調校介面。(感謝 @Kent) +* Re-added Dev UI. (Thanks to @Kent) +* 加入 "dp_lqr" 設定來強制使用 RAV4 的 lqr 調校。(感謝 @eisenheim) +* Added "dp_lqr" setting to force enable lqr tuning from RAV4. (Thanks to eisenheim) + +dragonpilot 0.7.7.0 +======================== +* 基於最新 openpilot 0.7.7 devel. +* Based on latest openpilot 0.7.7 devel. +* 當 Manager 出現錯誤時,顯示 IP 位置。(感謝 @dingliangxue) +* When Manager failed, display IP address. (Thanks to @dingliangxue) +* 加回 sr learner 開關。 +* Re-added sr learner toggle. +* 加回 加速模式 開關。 +* Re-added Accel Profile toggle. +* Toyota 加入改寫最低巡航速度功能。(感謝 @Mojo) +* Added Toyota to override lowerest cruise speed. (Thanks to @Mojo) +* 介面加入盲點偵測顯示。(感謝 @wabes) +* Added BSM indicator to UI. (Thanks to @wabes) +* 加回彎道減速功能。(感謝 @Mojo) +* re-added Slow On Curve functionality. (Thanks to @Mojo) + +dragonpilot 0.7.6.2 +======================== +* 修正無法正確關閉駕駛監控的問題。 +* Fixed unable to properly turn off driver monitor issue. + +dragonpilot 0.7.6.1 +======================== +* 基於最新 openpilot 0.7.6.1 devel. +* Based on latest openpilot 0.7.6.1 devel. +* 優化並整合 dp 服務。 (所有的設定檔已改名,請重新設定所有的功能) +* Optimized and integrated several dp services. (Settings have been renamed, please re-config all settings) +* 完全關閉 steer ratio learner。 +* Completely disabled steer ratio learner. +* 移除「加速模式」。 +* Removed Accel Profile. +* 加入本田皓影混電版指紋v1。(感謝 @劉駿) +* Added Honda Breeze Hybrid FPv1. (Thanks to @劉駿) +* 加入台灣版 Toyota Prius 4.5 指紋v1。(感謝 @jeekid) +* Added Taiwan Toyota Prius 4.5 FPv1. (Thanks to @jeekid) + +dragonpilot 0.7.5.4 +======================== +* Dynamic Follow 更新模型。(感謝 @ShaneSmiskol 提供代碼、 @cgw1968 測試) +* Updated Dynamic Follow model. (Special Thanks to @ShaneSmiskol for the feature and @cgw1968 for testing) + +dragonpilot 0.7.5.3 +======================== +* Dynamic Follow 更新至 ShaneSmiskol:stock_additions 0.7.5 版。(感謝 @ShaneSmiskol 提供代碼、 @Wei 測試) +* Updated Dynamic Follow to ShaneSmiskol:stock_additions 0.7.5. (Special Thanks to @ShaneSmiskol for the feature and @Wei for testing) +* 優化 Lexus GSH 轉向。(感謝 @簡銘佑 測試) +* Optimize Lexus GSH steering. (Thanks to @簡銘佑) +* C2 支援自動關機「DragonAutoShutdownAt」參數。(感謝 @cgw1968 建議) +* C2 to support auto shutdown "DragonAutoShutDownAt" param. (Thanks to @cgw1968) +* 修正出現「pedalPressed」的錯誤。(感謝 @Wei 回報) +* Fixed issue showing "pedalPressed" error. (Thanks to @Wei) +* 將剎車狀熊顯示於 dp 資訊欄。 +* Added brake indicator to dp infobar. +* 修正「溫度監控」燈示。 +* Fixed "Temp monitor" indicator. +* 加入「方向燈取消控制」延遲控制設。(感謝 @wabes 建議) +* Added delay config to "Disable Lat Control on Blinker". (Thanks to @wabes) +* 加入巴西版 2020 Corolla Hybrid 指紋v2。(感謝 @berno22 提供) +* Added Brazil 2020 Corolla Hybrid FPv2. (Thanks to @berno22) + +dragonpilot 0.7.5.2 +======================== +* 加入對 VW MQB/PQ 的支援。(感謝 @dingliangxue 移植) +* Added support to VW MQB/PQ platform. (Thanks to @dingliangxue) +* 修改成 3 小時後停止供電。(感謝 @Wei 建議) +* Updated to stop charging after 3 hrs. (Thanks to @Wei) +* 移除行車記錄下的「碰撞偵測」功能。 +* Removed Impact Detection in Dashcam. +* 修正開啟「Noctua 風扇」模式導致的錯誤。(感謝 @阿濤 回報) +* Fixed a bug caused by enabling "Noctua Mod". (Thanks to @阿濤) +* 修正「位智模式」無法顯示警示的問題。(感謝 @axandres 回報) +* Fixed alert issue in waze mode. (Thanks to @axandres) +* 修正無法顯示更新中圖示的問題。 +* Fixed unable to display "UPDATING" icon issue. +* 加入「允許多次自動換道」功能。(感謝 @阿濤 建議) +* Added "Allow Continuous Auto Lane Change" Toggle. (Thanks to @阿濤) +* 修正開機後設定頁面有時會錯誤的問題。(感謝 @salmankhan、@Wei 回報) +* Fixed setting page crash issue. (Thanks to @salmankhan, @Wei) +* 修正熄火後一直出現更新訊息的錯誤。(感謝 @Sky Chang 回報) +* Fixed issue that keep showing update prompt. (Thanks to @Sky Chang) + +dragonpilot 0.7.5.1 +======================== +* 修正因同時使用「社群功能」和「自定車型」造成的加減速問題。(特別感謝 @Wei、@Sky Chang、@Han9365、@鄧育林 的測試以及回報。) +* Fixed acceleration issue caused by used of both "Community Maintain Feature" and "Custom Car Model". (Special Thanks to @Wei, @Sky Chang, @Han9365, @鄧育林) +* 新增 DragonMaxSpeedLimit 設定值 (mph),當如果車速高於此值 op 將會停止操控。(感謝 @Anthony 建議) +* Added DragonMaxSpeedLimit parameter (mph), op will stop controlling when car speed is high than the value. (Thanks to @Anthony) +* 更新 appd 使用 cnpmjs 來下載 APKs。 +* Updated appd to use cnpmjs to download APKs. +* 修正更新服務。(感謝 @Wei) +* Fixed Update Service. (Thanks to @Wei) +* 新增加拿大版 2018 Toyota Sienna LTD 指紋(v2)。(感謝 明峰 提供) +* Added Canada 2018 Toyota Sienna LTD fingerprint (v2). (Thanks to 明峰) +* 新增「通過移動網路上傳」開關 +* Added Upload Over Mobile Network toggle. +* 新增「通過熱點上傳」開關 +* Added Upload Over Hotspot toggle. +* 新增加拿大版 2018 Toyota Sienna LTD 指紋(v1)。(感謝 明峰 提供) +* Added Canada 2018 Toyota Sienna LTD fingerprint (v1). (Thanks to 明峰) +* 新增大陸版 Volkswagen Golf GTI 指紋 (v1)。(感謝 easyeiji 提供) +* Added China Volkswagen Golf GTI fingerprint (v1). (Thanks to easyeiji) + +dragonpilot 0.7.5.0 +======================== +* 基於最新 openpilot 0.7.5 devel-staging. +* Based on latest openpilot 0.7.5 devel-staging. +* 更新 dp 圖示 (特別感謝 @wabes 的設計與提供)。 +* Updated dp logo, special thanks to @wabes for the design. +* 簡/繁中文版和 i18n 整合成為單一版本。 +* Merged zhs/zht/i18n versions into one. +* 新增大陸版 CAMRY HYBRID 指紋v2。(感謝 @杜子腾) +* Added China Camery Hybrid FPv2. (Thanks to @杜子腾) +* 新增台灣版 Altis HYBRID 指紋v1。(感謝 @Fish) +* Added Taiwan Altis Hybrid FPv1. (Thanks to @Fish) +* 新增行駛時關閉畫面功能。 +* Added Screen off while driving feature. +* 新增倒車時關閉畫面功能。 +* Added Screen off while reversing feature. +* 新增駕駛介面加入「加速模式」切換鈕。 +* Added acceleration profile toggle onto driving UI. +* 新增自定車型功能,取代指紋暫存功能。 +* Replaced fingerprint cache with custom car model selector. +* 新增可調亮度。 +* Added Brightness changer. +* 新增部分德語支持。(特別感謝 @arne182 提供) +* Added partial de_DE language support (Thanks to @arne182) +* 新增停車碰撞偵測記錄功能。 +* Added off road impact detection to dashcam. + +2020-05-06 +======================== +* 更新 dp 圖示 (特別感謝 @wabes 的設計與提供)。 +* 中文版整合進 i18n 版。 +* 刪除指紋暫存功能。 +* 新增 CAMERY HIBRID 指紋。(感謝 @杜子腾) +* 新增行駛時關閉畫面功能。 +* 新增倒車時關閉畫面功能。 +* 新增駕駛介面加入「加速模式」切換鈕。 +* 新增自定義車型。 + +2020-04-16 +======================== +* [DEVEL] 加入台灣版 2016 Lexus IS200t 指紋。(感謝 Philip / Cody Dai) +* [DEVEL] 加入台灣版 2016 Toyota Prius 4.5 代指紋。(感謝 Philip) +* [DEVEL] 加入台灣版 201x Toyota RAV4 4WD 指紋。(感謝 Philip) +* [DEVEL] 加入台灣版 2020 Toyota Auris w/ LTA 指紋。(感謝 Philip) +* [DEVEL] 修正 commIssue 錯誤。(感謝 Kent 協助) + +2020-04-13 +======================== +* [DEVEL] 加入可調整 Toyota Sng 起步反應值 (DragonToyotaSngResponse)。 (特別感謝 @Wei 提供 PR) +* [DEVEL] 駕駛介面加入「動態調整車距」按鈕。(感謝 @cgw1968-5779 建議) +* [DEVEL] 更新 update script。(感謝 深鯨希西 回報) + +2020-04-10 +======================== +* [DEVEL] 更新 panda 至最新的 comma:master 分支。 +* [DEVEL] 移除所有的第三方應用改為自動下載。 +* [DEVEL] 移除「啟用原廠 DSU 模式」、「安全帶檢查」、「車門檢查」開關。 + +2020-03-31 +======================== +* [DEVEL] 更新至 2020-03-31 testing 分支。 + +2020-03-27 +======================== +* [DEVEL] 更新至最新的 testing 分支: + * 加入波蘭版 2015 Lexus NX200T 支援。(感謝 wabes 提供) + * 調整「啟用原廠 DSU 模式」為不再需要 AHB 。(Enable Stock DSU Mode no longer requires "AHB" toggle) + * 加入「安全帶檢查」、「車門檢查」、「檔位檢查」、「溫度檢查」開關。 + * 加入曲率學習功能 - Curvature Learner 。(感謝 zorrobyte 提供) + * 加入大陸版 2018 Toyota Highlander 支援。(感謝 toyboxZ 提供) + * 加入大陸版 2018 Toyota Camry 2.0 支援。(感謝 Rming 提供) + * 加入韓文支持。(感謝 crwusiz 提供) + * 調整 OFFROAD 主頁翻譯將 "dragonpilot" 改回 "openpilot"。 + +2020-03-22 +======================== +* [DEVEL] 更新至最新的 testing 分支。 + +2020-03-17 +======================== +* [DEVEL] 更新至最新的 testing 分支 (commaai:devel-staging 0.7.4)。 +* [DEVEL] 加入動態調整車距功能。(特別感謝 @ShaneSmiskol 提供 PR) + +2020-03-14 +======================== +* [DEVEL] 更新 pt-Br (葡萄牙語) 翻譯。(感謝 berno22 提供) +* [DEVEL] 加入自動關機開關。(感謝 Rzxd 建議) +* [DEVEL] 調高 Toyota 扭力容錯值。 +* [DEVEL] 優化讀取 dp 設定值。 +* [DEVEL] 加入 2019 手動 Civic 指紋。感謝 (AlexNoop 提供) +* [DEVEL] dp 功能加入對 Subaru 車系的支援。 + +2020-03-06 +======================== +* [DEVEL] 加入葡萄牙語支持。(感謝 berno22 提供) +* [DEVEL] 加入大陸 2018 Camry、2020 RAV4 指紋。(感謝 笨木匠 提供) +* [DEVEL] 建立 devel-i18n 取代 devel-en。 +* [DEVEL] devel-en is deprecated, please switch to devel-i18n instead. + +2020-03-04 +======================== +* [DEVEL] 加入顯示駕駛監控畫面。 +* [DEVEL] 加入加速模式選項。(特別感謝 @arne182, @cgw1968-5779 提供 PR) +* [DEVEL] 修正 shutdownd 在 comma two 可能會不正常關機的錯誤。(感謝 @Wei, @Rzxd 回報) + +2020-02-25 +======================== +* [DEVEL] 更新至最新的 commaai:devel (0.7.3)。 + +2020-02-21 +======================== +* [DEVEL] 更新至最新的 commaai:devel (0.7.3)。 + +2020-02-14 +======================== +* [DEVEL] 更新至最新的 commaai:devel (0.7.2)。 +* [DEVEL] 修正錯誤。 + +2020-02-08 +======================== +* [DEVEL] 更新至最新的 commaai:devel (0.7.2)。 +* [DEVEL] dp 功能加入對現代 (Hyundai) 車系的支援。 +* [DEVEL] 加入神盾測速照相自動啟動的開關。 +* [DEVEL] 更新高德地圖至 v4.5.0.600053。 +* [DEVEL] 使用 0.6.6 版的更新系統。 +* [DEVEL] 修正急剎問題。(感謝 kumar 提供) + +2020-01-31 +======================== +* [DEVEL] 移除行車介面電量、溫度顯示,(修正畫面當機、黑屏問題) + +2020-01-29 +======================== +* [DEVEL] 修正行車介面錯誤。(感謝 深鲸希西 測試;eisenheim、HeatNation 反應) + +2020-01-23 +======================== +* [DEVEL] 加入 Steer Ratio Learner 關閉。(感謝 eisenheim 建議) +* [DEVEL] 行車介面加入電量、溫度。(感謝 eisenheim 建議) +* [DEVEL] 優化 appd。 + +2020-01-19 +======================== +* [DEVEL] 更新至最新的 commaai:devel (0.7.1)。 +* [DEVEL] 調整 appd 和 ALC 邏輯。 + +2020-01-14 +======================== +* [DEVEL] 加入開機啟動個人熱點。(感謝 eisenheim 建議) + +2020-01-08 +======================== +* [DEVEL] 加入大陸版 2018 Lexus RX300 支援。(感謝 cafe 提供) +* [DEVEL] 加入 DragonBTG 設定。(感謝 CloudJ、低調哥、歐姓Altis車主 提供) + +2019-12-31 +======================== +* [DEVEL-ZHS] 加回第三方應用。 + +2019-12-29 +======================== +* [DEVEL] 更新至最新的 commaai:devel (0.7.0)。 +* [DEVEL] 輔助/自動變道改為可調整參數 (進階用戶)。(DragonAssistedLCMinMPH、DragonAutoLCMinMPH、DragonAutoLCDelay) +* [DEVEL-ZHS] 修正無法運行第三方應用錯誤。(感謝 深鲸希西 反應) + +2019-12-18 +======================== +* [DEVEL] 修正自動換道邏輯。 +* [DEVEL] 更新 offroad 翻譯。 +* [DEVEL] 錯誤修正。 +* [DEVEL] 移除美版 2017 Civic Hatchback 指紋。(與其它車型衝突) + +2019-12-17 +======================== +* [DEVEL] 更新至最新的 commaai:devel (0.7.0)。 +* [DEVEL] 加入輔助換道開關。(24mph / 40kph 以上) +* [DEVEL] 加入自動換道開關。(40mph / 65kph 以上) +* [DEVEL] 加入大陸版 2019 雷凌汽油版指紋。 (感謝 Shell 提供) +* [DEVEL] 加入大陸版 2019 卡羅拉汽油版指紋。 (感謝 Shell 提供) +* [DEVEL] 加入美版 2017 Civic Hatchback 指紋。(感謝 CFranHonda 提供) + +2019-12-10 +======================== +* [DEVEL] 加入位智車機模式。 (Waze Mode) + +2019-11-21 +======================== +* [DEVEL] 修正 offroad 翻譯。(感謝 鄧育林 回報) +* [DEVEL] 調整前車靜止移動偵測參數。 +* [DEVEL] 前車靜止移動偵測可在未啟用 dp 時運作。 + +2019-11-18 +======================== +* [DEVEL] 修正 offroad 翻譯。(感謝 Cody、鄧育林 回報) + +2019-11-18 +======================== +* [DEVEL] 修正 frame 翻譯。 + +2019-11-15 +======================== +* [DEVEL] 修正不會充電的錯誤。 (感謝 袁昊 反應) + +2019-11-15 +======================== +* [DEVEL] 修正充電控制。 (感謝 KT 反應) +* [DEVEL] 更新 frame 翻譯,改為多語言版。 (感謝 深鲸希西、shaoching885、鄧育林 反應) +* [DEVEL] 更新至最新的 commaai:devel (0.6.6)。 + +2019-11-12 +======================== +* [DEVEL] 只顯示電量文字 (注意:有時不會更新,需要拔插 USB 線) +* [DEVEL] 自動偵測並鎖定硬體 (EON / UNO)。 + +2019-11-12 +======================== +* [DEVEL] 加入鎖定硬體 (EON / UNO) 的程式碼。 + +2019-11-11 +======================== +* [DEVEL] 更新高德地圖至 v4.3.0.600310 R2098NSLAE +* [DEVEL] 更新 MiXplorer 至 v6.40.3 +* [DEVEL] 更新至最新的 commaai:devel (0.6.6)。 +* [DEVEL] 前車靜止移動偵測加入偵測警示。 + +2019-11-07 +======================== +* [DEVEL] 讓 Bosch 系統顯示三角。 (感謝 ching885 回報) +* [DEVEL] 更新 offroad 多語言版簡體中文翻譯 (感謝 Rming 提供) + +2019-11-06 +======================== +* [DEVEL] 修正 0.6.6 appd 和 dashcamd 錯誤。 (感謝 鄧育林 回報) +* [DEVEL] 更新至最新的 commaai:devel (0.6.6)。 + +2019-11-05 +======================== +* [DEVEL] 加入台灣 Lexus 2017 GS450h 支援。 (感謝 簡銘佑 提供指紋) + +2019-11-01 +======================== +* [DEVEL] 新增神盾測速照相。 (感謝 Sky Chang 和 Wei Yi Chen) +* [DEVEL] 修正 offroad 翻譯。 (感謝 Leo Hsieh) + +2019-11-01 +======================== +* [DEVEL] 移除 Miui 字型,縮小 dp 使用空間。 +* [DEVEL] 更新 offroad 為多語言版 +* [DEVEL] 更新至最新的 commaai:devel (0.6.5)。 + +2019-10-29 +======================== +* [DEVEL] 加入 SnG 補丁。(感謝 楊雅智) + +2019-10-28 +======================== +* [DEVEL] 更新至最新的 commaai:devel (0.6.5)。 +* [DEVEL] 調整 dragon_allow_gas 邏輯 (請回報任何問題,需更新 Panda 韌體) + +2019-10-18 +======================== +* [DEVEL] 加入前車靜止移動偵測。(測試版,感謝 ucolchen) +* [DEVEL] 移除強迫網路連線提示。(感謝 Shell) +* [DEVEL] 修正 allow_gas 功能。 + +2019-10-18 +======================== +* [DEVEL] 加入彎道減速功能開關。 +* [DEVEL] 強迫使用 dp 版 Panda 韌體。 +* [DEVEL] 更新至最新的 commaai:devel (0.6.5)。 + +2019-10-17 +======================== +* [DEVEL] 加入「車型」顯示於 dp 設定畫面。 +* [DEVEL] 修正充電控制讀取預設值的錯誤。 +* [DEVEL] 修正無法顯示更新記錄的錯誤。 + +2019-10-16 +======================== +* [DEVEL] 刷新 Panda 韌體按鈕將會自動重啟 EON。(感謝 鄧育林 建議) +* [DEVEL] 下載更新記錄時使用 "no-cache" 標頭。 +* [DEVEL] 更新高德地圖至 v4.3.0 +* [DEVEL] 刪除 bs (Branch Switcher) + +2019-10-14 +======================== +* [DEVEL] 啟用自動更新功能。(感謝 鄧育林 提供) +* [DEVEL] 清除不再使用的 dp params。 +* [DEVEL] 加入數字電量指示。(感謝 鄧育林 建議) +* [DEVEL] 加入刷新 Panda 韌體按鈕。 + +2019-10-11 +======================== +* [DEVEL] 更新至最新的 commaai:devel (0.6.5)。 +* [DEVEL] 加入台灣 2019 RAV4 汽油版指紋。 (感謝 Max Duan / CloudJ 提供) + +2019-10-09 +======================== +* [DEVEL] 加入當 LatCtrl 關閉時,畫面顯示提示訊息。 + +2019-10-08 +======================== +* [DEVEL] 加回駕駛監控開關。 +* [DEVEL] 加入 bs (branch switcher) 程式。 + +2019-10-07 +======================== +* [DEVEL] 加入台灣版 2019 RAV4H 油電版指紋。(感謝 Max Duan 提供) + +2019-10-05 +======================== +* [DEVEL] 移除 curvature learner: 轉角明顯比原廠小。 +* [DEVEL] 更新至最新的 commaai:devel (0.6.4)。 + +2019-09-30 +======================== +* [DEVEL] 更新 curvature learner 版本至 v4。 +* [DEVEL] Lexus ISH 使用更精確的 EPS Steering Angle Sensor + +2019-09-27 +======================== +* [DEVEL] 加入 Zorrobyte 的 curvature learner (https://github.com/zorrobyte/openpilot) +* [DEVEL] 加入可開關駕駛監控的程式碼。 +* [DEVEL] 取消當 steering 出現錯誤時,自動切斷方向控制 2 秒的機制。 +* [DEVEL] 讓行車介面的「方向盤」/「轉彎」圖示半透明化。 + +2019-09-26 +======================== +* [DEVEL] 修正當「啟用記錄服務」關閉時,make 會有問題的錯誤。 (感謝 shaoching885 和 afa 回報) + +2019-09-24 +======================== +* [DEVEL] 行車介面加入可開關的「前車」、「路線」、「車道」設定。 +* [DEVEL] 行車介面加入可開關的「方向燈號」提示。 (感謝 CloudJ 建議,程式碼來源: https://github.com/kegman/openpilot) + +2019-09-23 +======================== +* [DEVEL] 優化讀取 params 的次數。 +* [DEVEL] 加入可開關的車道偏移警示。 +* [DEVEL] 修正充電控制邏輯。 +* [DEVEL] 加入台灣 Prius 4.5 指紋。 (感謝 Lin Hsin Hung 提供) + +2019-09-20 +======================== +* [DEVEL] 加入充電控制功能。 (感謝 loveloveses 和 KT 建議) + +2019-09-16 +======================== +* [DEVEL] 加入台灣 CT200h 指紋。 (感謝 CloudJ 提供) +* [DEVEL] 加入美版 CT200h 移植。 (感謝 thomaspich 提供) + +2019-09-13 +======================== +* [DEVEL] 行車介面加入可開關的「速度顯示」設定。 + +2019-09-09 +======================== +* [DEVEL] 加入 GreyPanda 模式。 + +2019-08-28 +======================== +* [DEVEL] 加入可調警示音量。 + +2019-08-27 +======================== +* [DEVEL] 自動關機改為可調時長。 diff --git a/README.md b/README.md index cfeb625bf..c9181f19c 100755 --- a/README.md +++ b/README.md @@ -1,3 +1,15 @@ +LIMITATION +------ +* CAN-FD vehicles WILL NOT WORK: this is due to the library in EON/C2 is old and cannot build red panda firmware. +* Body WILL NOT WORK: again this is due to the library in EON/C2 cannot build its firmware. +* AI Model REMAINS IN 0.8.16: Too much effort to port tinygrad/pyopencl onto EON/C2, still investigating workarounds. +* NOO (Navigation On Openpilot) WILL NOT WORK: NOO requires newer driving model to work with nav model, until we resolved the last statement. +* Logger WILL NOT WORK: It's running at near full capacity with the 0.8.16 driving model, Logger will cause performance/thermal issue. + +** In short, consider it as openpilot 0.8.16 version PLUS latest vehicle model support from openpilot master branch.** + +** THE BUILD IS VERY DIRTY, for porting/logging purpose we suggest using [openpilot mastertwo branch](https://github.com/commaai/openpilot/tree/commatwo_master).** + ![](https://i.imgur.com/b0ZyIx5.jpg) Table of Contents @@ -143,7 +155,4 @@ NO WARRANTY EXPRESSED OR IMPLIED.** [![openpilot tests](https://github.com/commaai/openpilot/workflows/openpilot%20tests/badge.svg?event=push)](https://github.com/commaai/openpilot/actions) -[![Total alerts](https://img.shields.io/lgtm/alerts/g/commaai/openpilot.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/commaai/openpilot/alerts/) -[![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/commaai/openpilot.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/commaai/openpilot/context:python) -[![Language grade: C/C++](https://img.shields.io/lgtm/grade/cpp/g/commaai/openpilot.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/commaai/openpilot/context:cpp) [![codecov](https://codecov.io/gh/commaai/openpilot/branch/master/graph/badge.svg)](https://codecov.io/gh/commaai/openpilot) diff --git a/RELEASES.md b/RELEASES.md index 7d55887ec..9cfcbafea 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1,11 +1,28 @@ -Version 0.9.1 (2022-12-XX) +Version 0.9.2 (2023-03-XX) ======================== -* Adjust alert volume using ambient noise level -* Removed driver monitoring timer resetting on interaction if face detected and distracted +* Draw MPC path instead of model predicted path, this is a more accurate representation of what the car will do. +* Škoda Fabia 2022-23 support thanks to jyoung8607! + +Version 0.9.1 (2023-02-28) +======================== +* New driving model + * 30% improved height estimation resulting in better driving performance for tall cars +* Driver monitoring: removed timer resetting on user interaction if distracted +* UI updates + * Adjust alert volume using ambient noise level + * Driver monitoring icon shows driver's head pose + * German translation thanks to Vrabetz and CzokNorris! +* Cadillac Escalade 2017 support thanks to rickygilleland! * Chevrolet Bolt EV 2022-23 support thanks to JasonJShuler! * Genesis GV60 2023 support thanks to sunnyhaibin! * Hyundai Tucson 2022-23 support +* Kia K5 Hybrid 2020 support thanks to sunnyhaibin! +* Kia Niro Hybrid 2023 support thanks to sunnyhaibin! +* Kia Sorento 2022-23 support thanks to sunnyhaibin! * Kia Sorento Plug-in Hybrid 2022 support thanks to sunnyhaibin! +* Toyota C-HR 2021 support thanks to eFiniLan! +* Toyota C-HR Hybrid 2022 support thanks to Korben00! +* Volkswagen Crafter and MAN TGE 2017-23 support thanks to jyoung8607! Version 0.9.0 (2022-11-21) ======================== diff --git a/cereal/.gitignore b/cereal/.gitignore index 14cd02eff..d6ec0036c 100644 --- a/cereal/.gitignore +++ b/cereal/.gitignore @@ -1,6 +1,4 @@ -gen -node_modules -package-lock.json +/gen/ *.tmp *.pyc __pycache__ @@ -18,4 +16,3 @@ services.h .sconsign.dblite libcereal_shared.* .mypy_cache/ -catch2/ diff --git a/cereal/Dockerfile b/cereal/Dockerfile index 21902d197..49a84719a 100644 --- a/cereal/Dockerfile +++ b/cereal/Dockerfile @@ -39,11 +39,12 @@ RUN pyenv install 3.8.10 && \ pyenv rehash && \ pip3 install --no-cache-dir pyyaml==5.1.2 Cython==0.29.14 scons==3.1.1 pycapnp==1.0.0 pre-commit==2.15.0 pylint==2.5.2 parameterized==0.7.4 coverage==5.1 numpy==1.21.1 -WORKDIR /project/cereal/messaging -RUN git clone https://github.com/catchorg/Catch2.git && \ +WORKDIR /project/ +RUN cd /tmp/ && \ + git clone https://github.com/catchorg/Catch2.git && \ cd Catch2 && \ git checkout 229cc4823c8cbe67366da8179efc6089dd3893e9 && \ - mv single_include/catch2 ../catch2 && \ + mv single_include/catch2/ /project/ && \ cd .. \ rm -rf Catch2 diff --git a/cereal/README.md b/cereal/README.md index cc9cd9145..a07953b97 100644 --- a/cereal/README.md +++ b/cereal/README.md @@ -1,4 +1,4 @@ -What is cereal? [![cereal tests](https://github.com/commaai/cereal/workflows/Tests/badge.svg?event=push)](https://github.com/commaai/cereal/actions) [![codecov](https://codecov.io/gh/commaai/cereal/branch/master/graph/badge.svg)](https://codecov.io/gh/commaai/cereal) +What is cereal? [![cereal tests](https://github.com/commaai/cereal/workflows/tests/badge.svg?event=push)](https://github.com/commaai/cereal/actions) [![codecov](https://codecov.io/gh/commaai/cereal/branch/master/graph/badge.svg)](https://codecov.io/gh/commaai/cereal) ---- cereal is both a messaging spec for robotics systems as well as generic high performance IPC pub sub messaging with a single publisher and multiple subscribers. diff --git a/cereal/car.capnp b/cereal/car.capnp index 47fc84a43..4a6793a0f 100644 --- a/cereal/car.capnp +++ b/cereal/car.capnp @@ -209,9 +209,6 @@ struct CarState { # clutch (manual transmission only) clutchPressed @28 :Bool; - # which packets this state came from - canMonoTimes @12: List(UInt64); - # blindspot sensors leftBlindspot @33 :Bool; # Is there something blocking the left lane change rightBlindspot @34 :Bool; # Is there something blocking the right lane change @@ -220,9 +217,13 @@ struct CarState { charging @43 :Bool; # dp - cruiseActualEnabled @46 :Bool; - engineRPM @47 :Float32; - distanceLines @48:UInt8; + engineRPM @46 :Float32; + distanceLines @47 :UInt8; + rightBlindspotD1 @48 :Float32; + rightBlindspotD2 @49 :Float32; + leftBlindspotD1 @50 :Float32; + leftBlindspotD2 @51 :Float32; + blindspotside @52 :Float32; struct WheelSpeeds { # optional wheel speeds @@ -277,9 +278,11 @@ struct CarState { } } + # deprecated errorsDEPRECATED @0 :List(CarEvent.EventName); brakeLightsDEPRECATED @19 :Bool; steeringRateLimitedDEPRECATED @29 :Bool; + canMonoTimesDEPRECATED @12: List(UInt64); } # ******* radar state @ 20hz ******* @@ -288,9 +291,6 @@ struct RadarData @0x888ad6581cf0aacb { errors @0 :List(Error); points @1 :List(RadarPoint); - # which packets this state came from - canMonoTimes @2 :List(UInt64); - enum Error { canError @0; fault @1; @@ -314,6 +314,9 @@ struct RadarData @0x888ad6581cf0aacb { # some radars flag measurements VS estimates measured @6 :Bool; } + + # deprecated + canMonoTimesDEPRECATED @2 :List(UInt64); } # ******* car controls @ 100hz ******* @@ -341,6 +344,8 @@ struct CarControl { cruiseControl @4 :CruiseControl; hudControl @5 :HUDControl; + latController @17 :Text; + struct Actuators { # range from 0.0 - 1.0 gas @0: Float32; @@ -437,6 +442,15 @@ struct CarParams { enableBsm @56 :Bool; # blind spot monitoring flags @64 :UInt32; # flags for car specific quirks experimentalLongitudinalAvailable @71 :Bool; + #dp: enable torque interceptor + enableTorqueInterceptor @72 :Bool; + #dp: alt tune collection + latTuneCollection @73 :LatTunes; + struct LatTunes { + pid @0 :LateralPIDTuning; + lqr @1 :LateralLQRTuning; + torque @2 :LateralTorqueTuning; + } minEnableSpeed @7 :Float32; minSteerSpeed @8 :Float32; @@ -475,7 +489,7 @@ struct CarParams { vEgoStarting @59 :Float32; # Speed at which the car goes into starting state stoppingControl @31 :Bool; # Does the car allow full control even at lows speeds when stopping steerControlType @34 :SteerControlType; - radarOffCan @35 :Bool; # True when radar objects aren't visible on CAN + radarUnavailable @35 :Bool; # True when radar objects aren't visible on CAN or aren't parsed out stopAccel @60 :Float32; # Required acceleration to keep vehicle stationary stoppingDecelRate @52 :Float32; # m/s^2/s while trying to stop startAccel @32 :Float32; # Required acceleration to get car moving @@ -593,10 +607,11 @@ struct CarParams { subaruLegacy @22; # pre-Global platform hyundaiLegacy @23; hyundaiCommunity @24; - stellantisDEPRECATED @25; # Consolidated with Chrysler; may be recycled for the next new model + volkswagenMlb @25; hongqi @26; body @27; hyundaiCanfd @28; + volvoC1 @29; } enum SteerControlType { @@ -622,6 +637,7 @@ struct CarParams { request @5 :List(Data); brand @6 :Text; bus @7 :UInt8; + logging @8 :Bool; } enum Ecu { diff --git a/cereal/dp.capnp b/cereal/dp.capnp index a4176eebb..227a4974f 100644 --- a/cereal/dp.capnp +++ b/cereal/dp.capnp @@ -14,10 +14,10 @@ struct DragonConf { dpLateralLanelines @6 :Bool; dpLateralCameraOffset @7 :Int8; dpLateralPathOffset @8 :Int8; - dpIpAddr @9 :Text; - dpUiTop @10 :Bool; - dpUiSide @11 :Bool; - dpUiVolume @12 :Int8; + dpLateralRoadEdgeDetected @9 :Bool; + dpIpAddr @10 :Text; + dpUiTop @11 :Bool; + dpUiSide @12 :Bool; dpUiBrightness @13 :UInt8; dpUiDisplayMode @14 :UInt8; dpUiSpeed @15 :Bool; @@ -27,24 +27,30 @@ struct DragonConf { dpUiLaneline @19 :Bool; dpUiChevron @20 :Bool; dpUiDmCam @21 :Bool; - dpToyotaSng @22 :Bool; - dpAccelProfileCtrl @23 :Bool; - dpAccelProfile @24 :UInt8; - dpToyotaCruiseOverride @25 :Bool; - dpToyotaCruiseOverrideSpeed @26 :UInt8; - dpToyotaAutoLock @27 :Bool; - dpToyotaAutoUnlock @28 :Bool; - dpMapd @29 :Bool; - dpLocalDb @30 :Bool; - dpDashcamd @31 :Bool; - dpMazdaSteerAlert @32 :Bool; - dpSpeedCheck @33 :Bool; - dpFollowingProfileCtrl @34 :Bool; - dpFollowingProfile @35 :UInt8; - dpE2EConditional @36 :Bool; - dpE2EConditionalAtSpeed @37 :UInt8; - dpE2EConditionalAtSpeedLead @38 :UInt8; - dpE2EConditionalAdaptFp @39 :Bool; - dpE2EConditionalAdaptAp @40 :Bool; - dpE2EConditionalVoacc @41 :Bool; + dpUiRainbow @22 :Bool; + dpToyotaSng @23 :Bool; + dpAccelProfileCtrl @24 :Bool; + dpAccelProfile @25 :UInt8; + dpToyotaCruiseOverride @26 :Bool; + dpToyotaCruiseOverrideSpeed @27 :UInt8; + dpToyotaAutoLock @28 :Bool; + dpToyotaAutoUnlock @29 :Bool; + dpToyotaDebugBsm @30 :Bool; + dpMapd @31 :Bool; + dpLocalDb @32 :Bool; + dpDashcamd @33 :Bool; + dpMazdaSteerAlert @34 :Bool; + dpSpeedCheck @35 :Bool; + dpFollowingProfileCtrl @36 :Bool; + dpFollowingProfile @37 :UInt8; + dpLateralAlt @38 :Bool; + dpLateralAltSpeed @39 :UInt8; + dpLateralAltCtrl @40 :UInt8; + dpLateralAltLanelines @41 :Bool; + dpLateralAltCameraOffset @42 :Int8; + dpLateralAltPathOffset @43 :Int8; + dpE2EConditional @44 :Bool; + dpE2EConditionalAdaptFp @45 :Bool; + dpE2EConditionalAdaptAp @46 :Bool; + dpE2EConditionalVoacc @47 :Bool; } diff --git a/cereal/libcereal_shared.so b/cereal/libcereal_shared.so index ea7642913..218734b67 100755 Binary files a/cereal/libcereal_shared.so and b/cereal/libcereal_shared.so differ diff --git a/cereal/log.capnp b/cereal/log.capnp index bd39fb9d4..713672c7e 100644 --- a/cereal/log.capnp +++ b/cereal/log.capnp @@ -166,7 +166,7 @@ struct FrameData { sensor @26 :ImageSensor; enum ImageSensor { unknown @0; - ar0321 @1; + ar0231 @1; ox03c10 @2; } @@ -428,6 +428,8 @@ struct PandaState @0xa7649e2575e4591e { safetyParam @27 :UInt16; alternativeExperience @23 :Int16; safetyRxChecksInvalid @32 :Bool; + #dp: enable torque interceptor + torqueInterceptorDetected @33 :Bool; enum FaultStatus { none @0; @@ -544,7 +546,6 @@ struct PeripheralState { } struct RadarState @0x9a185389d6fdd05f { - canMonoTimes @10 :List(UInt64); mdMonoTime @6 :UInt64; carStateMonoTime @11 :UInt64; radarErrors @12 :List(Car.RadarData.Error); @@ -579,6 +580,7 @@ struct RadarState @0x9a185389d6fdd05f { calStatusDEPRECATED @2 :Int8; calCycleDEPRECATED @8 :Int32; calPercDEPRECATED @9 :Int8; + canMonoTimesDEPRECATED @10 :List(UInt64); } struct LiveCalibrationData { @@ -615,7 +617,6 @@ struct LiveTracks { struct ControlsState @0x97ff69c53601abf1 { startMonoTime @48 :UInt64; - canMonoTimes @21 :List(UInt64); longitudinalPlanMonoTime @28 :UInt64; lateralPlanMonoTime @50 :UInt64; @@ -652,6 +653,9 @@ struct ControlsState @0x97ff69c53601abf1 { cumLagMs @15 :Float32; canErrorCounter @57 :UInt32; + # dp - for alt lateral + dpLateralAltActive @66 :Bool; + lateralControlState :union { indiState @52 :LateralINDIState; pidState @53 :LateralPIDState; @@ -794,6 +798,18 @@ struct ControlsState @0x97ff69c53601abf1 { jerkFactorDEPRECATED @12 :Float32; steerOverrideDEPRECATED @20 :Bool; steeringAngleDesiredDegDEPRECATED @29 :Float32; + canMonoTimesDEPRECATED @21 :List(UInt64); +} + +# All SI units and in device frame +struct XYZTData @0xc3cbae1fd505ae80 { + x @0 :List(Float32); + y @1 :List(Float32); + z @2 :List(Float32); + t @3 :List(Float32); + xStd @4 :List(Float32); + yStd @5 :List(Float32); + zStd @6 :List(Float32); } struct ModelDataV2 { @@ -829,16 +845,6 @@ struct ModelDataV2 { # Model perceived motion temporalPose @21 :Pose; - # All SI units and in device frame - struct XYZTData { - x @0 :List(Float32); - y @1 :List(Float32); - z @2 :List(Float32); - t @3 :List(Float32); - xStd @4 :List(Float32); - yStd @5 :List(Float32); - zStd @6 :List(Float32); - } struct LeadDataV2 { prob @0 :Float32; # probability that car is your lead at time t @@ -1034,6 +1040,10 @@ struct LongitudinalPlan @0xe00b5b3eba12876c { leaving @3; # Road ahead straightens. Start to allow positive acceleration. } } +struct UiPlan { + position @0 :XYZTData; + accel @1 :List(Float32); +} struct LateralPlan @0xe1e9318e2ae8b51e { modelMonoTime @31 :UInt64; @@ -1210,16 +1220,16 @@ struct ProcLog { } struct GnssMeasurements { - ubloxMonoTime @0 :UInt64; + measTime @0 :UInt64; gpsWeek @1 :Int16; gpsTimeOfWeek @2 :Float64; correctedMeasurements @3 :List(CorrectedMeasurement); - positionECEF @4 :LiveLocationKalman.Measurement; - velocityECEF @5 :LiveLocationKalman.Measurement; - # Used for debugging: - positionFixECEF @6 :LiveLocationKalman.Measurement; + kalmanPositionECEF @4 :LiveLocationKalman.Measurement; + kalmanVelocityECEF @5 :LiveLocationKalman.Measurement; + positionECEF @6 :LiveLocationKalman.Measurement; + velocityECEF @7 :LiveLocationKalman.Measurement; # Todo sync this with timing pulse of ublox struct CorrectedMeasurement { @@ -1245,14 +1255,14 @@ struct GnssMeasurements { } enum ConstellationId { - # Satellite Constellation using the Ublox gnssid as index - gps @0; - sbas @1; - galileo @2; - beidou @3; - imes @4; - qznss @5; - glonass @6; + # Satellite Constellation using the Ublox gnssid as index + gps @0; + sbas @1; + galileo @2; + beidou @3; + imes @4; + qznss @5; + glonass @6; } enum EphemerisSourceType { @@ -1260,6 +1270,7 @@ struct GnssMeasurements { # Different ultra-rapid files: nasaUltraRapid @1; glonassIacUltraRapid @2; + # dp - eon/c2 need this renamed qcompoly @3; } } @@ -1271,6 +1282,7 @@ struct UbloxGnss { ionoData @2 :IonoData; hwStatus @3 :HwStatus; hwStatus2 @4 :HwStatus2; + glonassEphemeris @5 :GlonassEphemeris; } struct MeasurementReport { @@ -1381,6 +1393,7 @@ struct UbloxGnss { ionoAlpha @38 :List(Float64); ionoBeta @39 :List(Float64); + towCount @40 :UInt32; } struct IonoData { @@ -1435,6 +1448,44 @@ struct UbloxGnss { flash @4; } } + + struct GlonassEphemeris { + svId @0 :UInt16; + year @1 :UInt16; + dayInYear @2 :UInt16; + hour @3 :UInt16; + minute @4 :UInt16; + second @5 :Float32; + + x @6 :Float64; + xVel @7 :Float64; + xAccel @8 :Float64; + y @9 :Float64; + yVel @10 :Float64; + yAccel @11 :Float64; + z @12 :Float64; + zVel @13 :Float64; + zAccel @14 :Float64; + + svType @15 :UInt8; + svURA @16 :Float32; + age @17 :UInt8; + + svHealth @18 :UInt8; + tk @19 :UInt16; + tb @20 :UInt16; + + tauN @21 :Float64; + deltaTauN @22 :Float64; + gammaN @23 :Float64; + + p1 @24 :UInt8; + p2 @25 :UInt8; + p3 @26 :UInt8; + p4 @27 :UInt8; + + freqNum @28 :UInt32; + } } struct QcomGnss @0xde94674b07ae51c1 { @@ -2107,6 +2158,7 @@ struct Event { carControl @23 :Car.CarControl; longitudinalPlan @24 :LongitudinalPlan; lateralPlan @64 :LateralPlan; + uiPlan @106 :UiPlan; ubloxGnss @34 :UbloxGnss; ubloxRaw @39 :Data; qcomGnss @31 :QcomGnss; @@ -2156,7 +2208,7 @@ struct Event { # UI services userFlag @93 :UserFlag; uiDebug @102 :UIDebug; - # dp reserve 105,106 + # dp reserve 107,108 # *********** debug *********** testJoystick @52 :Joystick; roadEncodeData @86 :EncodeData; @@ -2164,8 +2216,8 @@ struct Event { wideRoadEncodeData @88 :EncodeData; qRoadEncodeData @89 :EncodeData; - dragonConf @106 :Dp.DragonConf; - liveMapData @107: LiveMapData; + dragonConf @107 :Dp.DragonConf; + liveMapData @108 :LiveMapData; # *********** legacy + deprecated *********** model @9 :Legacy.ModelData; # TODO: rename modelV2 and mark this as deprecated @@ -2203,6 +2255,7 @@ struct Event { kalmanOdometryDEPRECATED @65 :Legacy.KalmanOdometry; uiLayoutStateDEPRECATED @57 :Legacy.UiLayoutState; pandaStateDEPRECATED @12 :PandaState; + # dp - legacy driverState @59 :DriverState; sensorEvents @11 :List(SensorEventData); } diff --git a/cereal/messaging/__init__.py b/cereal/messaging/__init__.py index e1ba4e97b..c695769e6 100644 --- a/cereal/messaging/__init__.py +++ b/cereal/messaging/__init__.py @@ -259,4 +259,4 @@ class PubMaster: self.sock[s].send(dat) def all_readers_updated(self, s: str) -> bool: - return self.sock[s].all_readers_updated() + return self.sock[s].all_readers_updated() # type: ignore diff --git a/cereal/messaging/bridge b/cereal/messaging/bridge index 09ddb155f..dbdef67a8 100755 Binary files a/cereal/messaging/bridge and b/cereal/messaging/bridge differ diff --git a/cereal/messaging/impl_msgq.h b/cereal/messaging/impl_msgq.h index b67aae622..fdad52f9e 100644 --- a/cereal/messaging/impl_msgq.h +++ b/cereal/messaging/impl_msgq.h @@ -1,8 +1,10 @@ #pragma once -#include "messaging.h" -#include "msgq.h" -#include + #include +#include + +#include "cereal/messaging/messaging.h" +#include "cereal/messaging/msgq.h" #define MAX_POLLERS 128 diff --git a/cereal/messaging/impl_zmq.h b/cereal/messaging/impl_zmq.h index bb232049e..deeac859c 100644 --- a/cereal/messaging/impl_zmq.h +++ b/cereal/messaging/impl_zmq.h @@ -1,7 +1,10 @@ #pragma once -#include "messaging.h" + #include #include +#include + +#include "cereal/messaging/messaging.h" #define MAX_POLLERS 128 diff --git a/cereal/messaging/messaging.h b/cereal/messaging/messaging.h index 4a184ff70..483b2465c 100644 --- a/cereal/messaging/messaging.h +++ b/cereal/messaging/messaging.h @@ -1,10 +1,15 @@ #pragma once + #include #include #include #include +#include +#include + #include -#include "../gen/cpp/log.capnp.h" + +#include "cereal/gen/cpp/log.capnp.h" #ifdef __APPLE__ #define CLOCK_BOOTTIME CLOCK_MONOTONIC @@ -18,7 +23,7 @@ class Context { public: virtual void * getRawContext() = 0; static Context * create(); - virtual ~Context(){}; + virtual ~Context(){} }; class Message { @@ -66,7 +71,7 @@ public: class SubMaster { public: - SubMaster(const std::vector &service_list, + SubMaster(const std::vector &service_list, const std::vector &poll = {}, const char *address = nullptr, const std::vector &ignore_alive = {}); void update(int timeout = 1000); void update_msgs(uint64_t current_time, const std::vector> &messages); diff --git a/cereal/messaging/messaging.pxd b/cereal/messaging/messaging.pxd index de232da5f..38c6b09e1 100644 --- a/cereal/messaging/messaging.pxd +++ b/cereal/messaging/messaging.pxd @@ -6,7 +6,7 @@ from libcpp.vector cimport vector from libcpp cimport bool -cdef extern from "messaging.h": +cdef extern from "cereal/messaging/messaging.h": cdef cppclass Context: @staticmethod Context * create() diff --git a/cereal/messaging/messaging_pyx.cpp b/cereal/messaging/messaging_pyx.cpp index e6cf5df84..04b3605d3 100644 --- a/cereal/messaging/messaging_pyx.cpp +++ b/cereal/messaging/messaging_pyx.cpp @@ -1,4 +1,4 @@ -/* Generated by Cython 0.29.24 */ +/* Generated by Cython 0.29.26 */ /* BEGIN: Cython Metadata { @@ -6,9 +6,6 @@ "depends": [ "cereal/messaging/messaging.h" ], - "include_dirs": [ - "./cereal/messaging" - ], "language": "c++", "name": "cereal.messaging.messaging_pyx", "sources": [ @@ -28,8 +25,8 @@ END: Cython Metadata */ #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) #error Cython requires Python 2.6+ or Python 3.3+. #else -#define CYTHON_ABI "0_29_24" -#define CYTHON_HEX_VERSION 0x001D18F0 +#define CYTHON_ABI "0_29_26" +#define CYTHON_HEX_VERSION 0x001D1AF0 #define CYTHON_FUTURE_DIVISION 1 #include #ifndef offsetof @@ -176,7 +173,7 @@ END: Cython Metadata */ #ifndef CYTHON_USE_UNICODE_INTERNALS #define CYTHON_USE_UNICODE_INTERNALS 1 #endif - #if PY_VERSION_HEX < 0x030300F0 + #if PY_VERSION_HEX < 0x030300F0 || PY_VERSION_HEX >= 0x030B00A2 #undef CYTHON_USE_UNICODE_WRITER #define CYTHON_USE_UNICODE_WRITER 0 #elif !defined(CYTHON_USE_UNICODE_WRITER) @@ -195,7 +192,7 @@ END: Cython Metadata */ #define CYTHON_FAST_THREAD_STATE 1 #endif #ifndef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 1 + #define CYTHON_FAST_PYCALL (PY_VERSION_HEX < 0x030B00A1) #endif #ifndef CYTHON_PEP489_MULTI_PHASE_INIT #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000) @@ -214,7 +211,9 @@ END: Cython Metadata */ #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) #endif #if CYTHON_USE_PYLONG_INTERNALS - #include "longintrepr.h" + #if PY_MAJOR_VERSION < 3 + #include "longintrepr.h" + #endif #undef SHIFT #undef BASE #undef MASK @@ -345,9 +344,68 @@ class __Pyx_FakeReference { #define __Pyx_DefaultClassType PyClass_Type #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" -#if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2 - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) + #define __Pyx_DefaultClassType PyType_Type +#if PY_VERSION_HEX >= 0x030B00A1 + static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int k, int l, int s, int f, + PyObject *code, PyObject *c, PyObject* n, PyObject *v, + PyObject *fv, PyObject *cell, PyObject* fn, + PyObject *name, int fline, PyObject *lnos) { + PyObject *kwds=NULL, *argcount=NULL, *posonlyargcount=NULL, *kwonlyargcount=NULL; + PyObject *nlocals=NULL, *stacksize=NULL, *flags=NULL, *replace=NULL, *call_result=NULL, *empty=NULL; + const char *fn_cstr=NULL; + const char *name_cstr=NULL; + PyCodeObject* co=NULL; + PyObject *type, *value, *traceback; + PyErr_Fetch(&type, &value, &traceback); + if (!(kwds=PyDict_New())) goto end; + if (!(argcount=PyLong_FromLong(a))) goto end; + if (PyDict_SetItemString(kwds, "co_argcount", argcount) != 0) goto end; + if (!(posonlyargcount=PyLong_FromLong(0))) goto end; + if (PyDict_SetItemString(kwds, "co_posonlyargcount", posonlyargcount) != 0) goto end; + if (!(kwonlyargcount=PyLong_FromLong(k))) goto end; + if (PyDict_SetItemString(kwds, "co_kwonlyargcount", kwonlyargcount) != 0) goto end; + if (!(nlocals=PyLong_FromLong(l))) goto end; + if (PyDict_SetItemString(kwds, "co_nlocals", nlocals) != 0) goto end; + if (!(stacksize=PyLong_FromLong(s))) goto end; + if (PyDict_SetItemString(kwds, "co_stacksize", stacksize) != 0) goto end; + if (!(flags=PyLong_FromLong(f))) goto end; + if (PyDict_SetItemString(kwds, "co_flags", flags) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_code", code) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_consts", c) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_names", n) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_varnames", v) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_freevars", fv) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_cellvars", cell) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_linetable", lnos) != 0) goto end; + if (!(fn_cstr=PyUnicode_AsUTF8AndSize(fn, NULL))) goto end; + if (!(name_cstr=PyUnicode_AsUTF8AndSize(name, NULL))) goto end; + if (!(co = PyCode_NewEmpty(fn_cstr, name_cstr, fline))) goto end; + if (!(replace = PyObject_GetAttrString((PyObject*)co, "replace"))) goto cleanup_code_too; + if (!(empty = PyTuple_New(0))) goto cleanup_code_too; // unfortunately __pyx_empty_tuple isn't available here + if (!(call_result = PyObject_Call(replace, empty, kwds))) goto cleanup_code_too; + Py_XDECREF((PyObject*)co); + co = (PyCodeObject*)call_result; + call_result = NULL; + if (0) { + cleanup_code_too: + Py_XDECREF((PyObject*)co); + co = NULL; + } + end: + Py_XDECREF(kwds); + Py_XDECREF(argcount); + Py_XDECREF(posonlyargcount); + Py_XDECREF(kwonlyargcount); + Py_XDECREF(nlocals); + Py_XDECREF(stacksize); + Py_XDECREF(replace); + Py_XDECREF(call_result); + Py_XDECREF(empty); + if (type) { + PyErr_Restore(type, value, traceback); + } + return co; + } #else #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) @@ -585,10 +643,10 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #if PY_VERSION_HEX < 0x030200A4 typedef long Py_hash_t; #define __Pyx_PyInt_FromHash_t PyInt_FromLong - #define __Pyx_PyInt_AsHash_t PyInt_AsLong + #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsHash_t #else #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t - #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t + #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t #endif #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func)) @@ -656,7 +714,7 @@ static CYTHON_INLINE float __PYX_NAN() { #include "typeinfo" #include #include -#include "messaging.h" +#include "cereal/messaging/messaging.h" #ifdef _OPENMP #include #endif /* _OPENMP */ @@ -753,6 +811,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj)) static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*); #if CYTHON_ASSUME_SAFE_MACROS #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) #else @@ -1120,6 +1179,7 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, #ifndef Py_MEMBER_SIZE #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member) #endif +#if CYTHON_FAST_PYCALL static size_t __pyx_pyframe_localsplus_offset = 0; #include "frameobject.h" #define __Pxy_PyFrame_Initialize_Offsets()\ @@ -1127,6 +1187,7 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus))) #define __Pyx_PyFrame_GetLocalsplus(frame)\ (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset)) +#endif // CYTHON_FAST_PYCALL #endif /* PyObjectCallMethO.proto */ @@ -3922,6 +3983,9 @@ static PyTypeObject __pyx_type_6cereal_9messaging_13messaging_pyx_Context = { #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 0, /*tp_print*/ #endif + #if CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM+0 >= 0x06000000 + 0, /*tp_pypy_flags*/ + #endif }; static PyObject *__pyx_tp_new_6cereal_9messaging_13messaging_pyx_Poller(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { @@ -4055,6 +4119,9 @@ static PyTypeObject __pyx_type_6cereal_9messaging_13messaging_pyx_Poller = { #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 0, /*tp_print*/ #endif + #if CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM+0 >= 0x06000000 + 0, /*tp_pypy_flags*/ + #endif }; static struct __pyx_vtabstruct_6cereal_9messaging_13messaging_pyx_SubSocket __pyx_vtable_6cereal_9messaging_13messaging_pyx_SubSocket; @@ -4169,6 +4236,9 @@ static PyTypeObject __pyx_type_6cereal_9messaging_13messaging_pyx_SubSocket = { #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 0, /*tp_print*/ #endif + #if CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM+0 >= 0x06000000 + 0, /*tp_pypy_flags*/ + #endif }; static PyObject *__pyx_tp_new_6cereal_9messaging_13messaging_pyx_PubSocket(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { @@ -4279,6 +4349,9 @@ static PyTypeObject __pyx_type_6cereal_9messaging_13messaging_pyx_PubSocket = { #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 0, /*tp_print*/ #endif + #if CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM+0 >= 0x06000000 + 0, /*tp_pypy_flags*/ + #endif }; static PyMethodDef __pyx_methods[] = { @@ -6080,7 +6153,7 @@ static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int } if (!use_cline) { c_line = 0; - PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); + (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); } else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) { c_line = 0; @@ -6177,30 +6250,31 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( const char *funcname, int c_line, int py_line, const char *filename) { - PyCodeObject *py_code = 0; - PyObject *py_srcfile = 0; - PyObject *py_funcname = 0; + PyCodeObject *py_code = NULL; + PyObject *py_funcname = NULL; #if PY_MAJOR_VERSION < 3 + PyObject *py_srcfile = NULL; py_srcfile = PyString_FromString(filename); - #else - py_srcfile = PyUnicode_FromString(filename); - #endif if (!py_srcfile) goto bad; + #endif if (c_line) { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + if (!py_funcname) goto bad; #else py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + if (!py_funcname) goto bad; + funcname = PyUnicode_AsUTF8(py_funcname); + if (!funcname) goto bad; #endif } else { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromString(funcname); - #else - py_funcname = PyUnicode_FromString(funcname); + if (!py_funcname) goto bad; #endif } - if (!py_funcname) goto bad; + #if PY_MAJOR_VERSION < 3 py_code = __Pyx_PyCode_New( 0, 0, @@ -6219,11 +6293,16 @@ static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( __pyx_empty_bytes /*PyObject *lnotab*/ ); Py_DECREF(py_srcfile); - Py_DECREF(py_funcname); + #else + py_code = PyCode_NewEmpty(filename, funcname, py_line); + #endif + Py_XDECREF(py_funcname); // XDECREF since it's only set on Py3 if cline return py_code; bad: - Py_XDECREF(py_srcfile); Py_XDECREF(py_funcname); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(py_srcfile); + #endif return NULL; } static void __Pyx_AddTraceback(const char *funcname, int c_line, @@ -7071,6 +7150,23 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_DECREF(x); return ival; } +static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) { + if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) { + return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o); +#if PY_MAJOR_VERSION < 3 + } else if (likely(PyInt_CheckExact(o))) { + return PyInt_AS_LONG(o); +#endif + } else { + Py_ssize_t ival; + PyObject *x; + x = PyNumber_Index(o); + if (!x) return -1; + ival = PyInt_AsLong(x); + Py_DECREF(x); + return ival; + } +} static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) { return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False); } diff --git a/cereal/messaging/messaging_pyx.so b/cereal/messaging/messaging_pyx.so index df3dddf07..94cb67415 100755 Binary files a/cereal/messaging/messaging_pyx.so and b/cereal/messaging/messaging_pyx.so differ diff --git a/cereal/messaging/msgq.h b/cereal/messaging/msgq.h index 470d404d7..170578351 100644 --- a/cereal/messaging/msgq.h +++ b/cereal/messaging/msgq.h @@ -1,15 +1,17 @@ #pragma once + #include #include #include #include #define DEFAULT_SEGMENT_SIZE (10 * 1024 * 1024) -#define NUM_READERS 13 //default comma is 12 +#define NUM_READERS 18 //default comma is 12 #define ALIGN(n) ((n + (8 - 1)) & -8) +#define UNUSED(x) (void)x #define UNPACK64(higher, lower, input) do {uint64_t tmp = input; higher = tmp >> 32; lower = tmp & 0xFFFFFFFF;} while (0) -#define PACK64(output, higher, lower) output = ((uint64_t)higher << 32 ) | ((uint64_t)lower & 0xFFFFFFFF) +#define PACK64(output, higher, lower) output = ((uint64_t)higher << 32) | ((uint64_t)lower & 0xFFFFFFFF) struct msgq_header_t { uint64_t num_readers; diff --git a/cereal/services.h b/cereal/services.h index 082210c7b..41cb56298 100644 --- a/cereal/services.h +++ b/cereal/services.h @@ -3,74 +3,63 @@ #define __SERVICES_H struct service { char name[0x100]; int port; bool should_log; int frequency; int decimation; }; static struct service services[] = { - { "gyroscope", 8001, true, 104, 104 }, - { "gyroscope2", 8002, true, 100, 100 }, - { "accelerometer", 8003, true, 104, 104 }, - { "accelerometer2", 8004, true, 100, 100 }, - { "magnetometer", 8005, true, 100, 100 }, - { "lightSensor", 8006, true, 100, 100 }, - { "temperatureSensor", 8007, true, 100, 100 }, - { "gpsNMEA", 8008, true, 9, -1 }, - { "deviceState", 8009, true, 2, 1 }, - { "can", 8010, true, 100, -1 }, - { "controlsState", 8011, true, 100, 10 }, - { "pandaStates", 8012, true, 2, 1 }, - { "peripheralState", 8013, true, 2, 1 }, - { "radarState", 8014, true, 20, 5 }, - { "roadEncodeIdx", 8015, false, 20, 1 }, - { "liveTracks", 8016, true, 20, -1 }, - { "sendcan", 8017, true, 100, 139 }, - { "logMessage", 8018, true, 0, -1 }, - { "errorLogMessage", 8019, true, 0, 1 }, - { "liveCalibration", 8020, true, 4, 4 }, - { "liveTorqueParameters", 8021, true, 4, 1 }, - { "androidLog", 8023, true, 0, -1 }, - { "carState", 8024, true, 100, 10 }, - { "carControl", 8025, true, 100, 10 }, - { "longitudinalPlan", 8026, true, 20, 5 }, - { "procLog", 8027, true, 0, -1 }, - { "gpsLocationExternal", 8028, true, 10, 10 }, - { "gpsLocation", 8029, true, 1, 1 }, - { "ubloxGnss", 8030, true, 10, -1 }, - { "qcomGnss", 8031, true, 2, -1 }, - { "gnssMeasurements", 8032, true, 10, 10 }, - { "clocks", 8033, true, 1, 1 }, - { "ubloxRaw", 8034, true, 20, -1 }, - { "liveLocationKalman", 8035, true, 20, 5 }, - { "liveParameters", 8036, true, 20, 5 }, - { "cameraOdometry", 8037, true, 20, 5 }, - { "lateralPlan", 8038, true, 20, 5 }, - { "thumbnail", 8039, true, 0, 1 }, - { "carEvents", 8040, true, 1, 1 }, - { "carParams", 8041, true, 0, 1 }, - { "roadCameraState", 8042, true, 20, 20 }, - { "driverCameraState", 8043, true, 10, 10 }, - { "driverEncodeIdx", 8044, false, 10, 1 }, - { "driverStateV2", 8045, true, 20, 10 }, - { "driverState", 8046, true, 10, 5 }, - { "driverMonitoringState", 8047, true, 10, 5 }, - { "wideRoadEncodeIdx", 8048, false, 20, 1 }, - { "wideRoadCameraState", 8049, true, 20, 20 }, - { "modelV2", 8050, true, 20, 40 }, - { "managerState", 8051, true, 2, 1 }, - { "uploaderState", 8052, true, 0, 1 }, - { "navInstruction", 8053, true, 1, 10 }, - { "navRoute", 8054, true, 0, -1 }, - { "navThumbnail", 8055, true, 0, -1 }, - { "navModel", 8056, true, 2, 4 }, - { "mapRenderState", 8057, true, 2, 1 }, - { "qRoadEncodeIdx", 8058, false, 20, -1 }, - { "userFlag", 8059, true, 0, 1 }, - { "microphone", 8060, true, 10, 10 }, - { "uiDebug", 8061, true, 0, 1 }, - { "testJoystick", 8062, true, 0, -1 }, - { "roadEncodeData", 8063, false, 20, -1 }, - { "driverEncodeData", 8064, false, 20, -1 }, - { "wideRoadEncodeData", 8065, false, 20, -1 }, - { "qRoadEncodeData", 8066, false, 20, -1 }, - { "dragonConf", 8067, false, 1, -1 }, - { "liveMapData", 8068, true, 0, -1 }, - { "sensorEvents", 8069, true, 100, 100 }, + { "deviceState", 8001, true, 2, 1 }, + { "can", 8002, true, 100, 1223 }, + { "controlsState", 8003, true, 100, 10 }, + { "pandaStates", 8004, true, 2, 1 }, + { "peripheralState", 8005, true, 2, 1 }, + { "radarState", 8006, true, 20, 5 }, + { "roadEncodeIdx", 8007, false, 20, 1 }, + { "liveTracks", 8008, true, 20, -1 }, + { "sendcan", 8009, true, 100, 139 }, + { "logMessage", 8010, true, 0, -1 }, + { "errorLogMessage", 8011, true, 0, 1 }, + { "liveCalibration", 8012, true, 4, 4 }, + { "liveTorqueParameters", 8013, true, 4, 1 }, + { "androidLog", 8014, true, 0, -1 }, + { "carState", 8015, true, 100, 10 }, + { "carControl", 8016, true, 100, 10 }, + { "longitudinalPlan", 8017, true, 20, 5 }, + { "procLog", 8018, true, 0, -1 }, + { "gpsLocationExternal", 8019, true, 10, 10 }, + { "gpsLocation", 8020, true, 1, 1 }, + { "ubloxGnss", 8021, true, 10, -1 }, + { "qcomGnss", 8023, true, 2, -1 }, + { "gnssMeasurements", 8024, true, 10, 10 }, + { "clocks", 8025, true, 1, 1 }, + { "ubloxRaw", 8026, true, 20, -1 }, + { "liveLocationKalman", 8027, true, 20, 5 }, + { "liveParameters", 8028, true, 20, 5 }, + { "cameraOdometry", 8029, true, 20, 5 }, + { "lateralPlan", 8030, true, 20, 5 }, + { "thumbnail", 8031, true, 0, 1 }, + { "carEvents", 8032, true, 1, 1 }, + { "carParams", 8033, true, 0, 1 }, + { "roadCameraState", 8034, true, 20, 20 }, + { "modelV2", 8035, true, 20, 40 }, + { "managerState", 8036, true, 2, 1 }, + { "uploaderState", 8037, true, 0, 1 }, + { "navInstruction", 8038, true, 1, 10 }, + { "navRoute", 8039, true, 0, -1 }, + { "navThumbnail", 8040, true, 0, -1 }, + { "navModel", 8041, true, 2, 4 }, + { "mapRenderState", 8042, true, 2, 1 }, + { "uiPlan", 8043, true, 20, 40 }, + { "qRoadEncodeIdx", 8044, false, 20, -1 }, + { "userFlag", 8045, true, 0, 1 }, + { "uiDebug", 8046, true, 0, 1 }, + { "testJoystick", 8047, true, 0, -1 }, + { "roadEncodeData", 8048, false, 20, -1 }, + { "driverEncodeData", 8049, false, 20, -1 }, + { "wideRoadEncodeData", 8050, false, 20, -1 }, + { "qRoadEncodeData", 8051, false, 20, -1 }, + { "driverCameraState", 8052, true, 10, 10 }, + { "driverEncodeIdx", 8053, false, 10, 1 }, + { "driverState", 8054, true, 10, 5 }, + { "driverMonitoringState", 8055, true, 10, 5 }, + { "sensorEvents", 8056, true, 100, 100 }, + { "dragonConf", 8057, false, 1, -1 }, + { "liveMapData", 8058, true, 0, -1 }, }; #endif diff --git a/cereal/services.py b/cereal/services.py index bf8f3f0e5..52d1cb12f 100755 --- a/cereal/services.py +++ b/cereal/services.py @@ -21,16 +21,16 @@ class Service: services = { # service: (should_log, frequency, qlog decimation (optional)) # note: the "EncodeIdx" packets will still be in the log - "gyroscope": (True, 104., 104), - "gyroscope2": (True, 100., 100), - "accelerometer": (True, 104., 104), - "accelerometer2": (True, 100., 100), - "magnetometer": (True, 100., 100), - "lightSensor": (True, 100., 100), - "temperatureSensor": (True, 100., 100), - "gpsNMEA": (True, 9.), + # "gyroscope": (True, 104., 104), + # "gyroscope2": (True, 100., 100), + # "accelerometer": (True, 104., 104), + # "accelerometer2": (True, 100., 100), + # "magnetometer": (True, 100., 100), + # "lightSensor": (True, 100., 100), + # "temperatureSensor": (True, 100., 100), + # "gpsNMEA": (True, 9.), "deviceState": (True, 2., 1), - "can": (True, 100.), + "can": (True, 100., 1223), # decimation gives ~5 msgs in a full segment "controlsState": (True, 100., 10), "pandaStates": (True, 2., 1), "peripheralState": (True, 2., 1), @@ -62,13 +62,12 @@ services = { "carEvents": (True, 1., 1), "carParams": (True, 0.02, 1), "roadCameraState": (True, 20., 20), - "driverCameraState": (True, 10., 10), - "driverEncodeIdx": (False, 10., 1), - "driverStateV2": (True, 20., 10), - "driverState": (True, 10, 5), - "driverMonitoringState": (True, 10., 5), - "wideRoadEncodeIdx": (False, 20., 1), - "wideRoadCameraState": (True, 20., 20), + # "driverCameraState": (True, 20., 20), + # "driverEncodeIdx": (False, 20., 1), + # "driverStateV2": (True, 20., 10), + # "driverMonitoringState": (True, 20., 10), + # "wideRoadEncodeIdx": (False, 20., 1), + # "wideRoadCameraState": (True, 20., 20), "modelV2": (True, 20., 40), "managerState": (True, 2., 1), "uploaderState": (True, 0., 1), @@ -77,9 +76,10 @@ services = { "navThumbnail": (True, 0.), "navModel": (True, 2., 4.), "mapRenderState": (True, 2., 1.), + "uiPlan": (True, 20., 40.), "qRoadEncodeIdx": (False, 20.), "userFlag": (True, 0., 1), - "microphone": (True, 10., 10), + # "microphone": (True, 10., 10), # debug "uiDebug": (True, 0., 1), @@ -90,9 +90,16 @@ services = { "qRoadEncodeData": (False, 20.), # dp - "dragonConf": (False, 1.), - "liveMapData": (True, 0.), + # legacy + "driverCameraState": (True, 10., 10), + "driverEncodeIdx": (False, 10., 1), + "driverState": (True, 10, 5), + "driverMonitoringState": (True, 10., 5), "sensorEvents": (True, 100., 100), + # conf + "dragonConf": (False, 1.), + # mapd + "liveMapData": (True, 0.), } service_list = {name: Service(new_port(idx), *vals) for # type: ignore idx, (name, vals) in enumerate(services.items())} diff --git a/cereal/visionipc/__init__.py b/cereal/visionipc/__init__.py index e69de29bb..89915b8ef 100644 --- a/cereal/visionipc/__init__.py +++ b/cereal/visionipc/__init__.py @@ -0,0 +1,4 @@ +from cereal.visionipc.visionipc_pyx import VisionIpcClient, VisionIpcServer, VisionStreamType # pylint: disable=no-name-in-module, import-error +assert VisionIpcClient +assert VisionIpcServer +assert VisionStreamType diff --git a/cereal/visionipc/visionbuf.h b/cereal/visionipc/visionbuf.h index 864fac97d..7f5b01233 100644 --- a/cereal/visionipc/visionbuf.h +++ b/cereal/visionipc/visionbuf.h @@ -1,5 +1,6 @@ #pragma once -#include "visionipc.h" + +#include "cereal/visionipc/visionipc.h" #define CL_USE_DEPRECATED_OPENCL_1_2_APIS #ifdef __APPLE__ @@ -20,7 +21,7 @@ enum VisionStreamType { VISION_STREAM_DRIVER, VISION_STREAM_WIDE_ROAD, - VISION_STREAM_RGB_MAP, + VISION_STREAM_MAP, VISION_STREAM_MAX, }; @@ -36,11 +37,13 @@ class VisionBuf { size_t width = 0; size_t height = 0; size_t stride = 0; + size_t uv_offset = 0; // YUV uint8_t * y = nullptr; uint8_t * u = nullptr; uint8_t * v = nullptr; + uint8_t * uv = nullptr; // Visionipc uint64_t server_id = 0; @@ -58,7 +61,7 @@ class VisionBuf { void import(); void init_cl(cl_device_id device_id, cl_context ctx); void init_rgb(size_t width, size_t height, size_t stride); - void init_yuv(size_t width, size_t height); + void init_yuv(size_t width, size_t height, size_t stride, size_t uv_offset); int sync(int dir); int free(); diff --git a/cereal/visionipc/visionipc.pxd b/cereal/visionipc/visionipc.pxd index 5cb729f7e..87999e27b 100644 --- a/cereal/visionipc/visionipc.pxd +++ b/cereal/visionipc/visionipc.pxd @@ -6,7 +6,7 @@ from libcpp.vector cimport vector from libc.stdint cimport uint32_t, uint64_t from libcpp cimport bool -cdef extern from "visionbuf.h": +cdef extern from "cereal/visionipc/visionbuf.h": cdef enum VisionStreamType: pass @@ -16,22 +16,25 @@ cdef extern from "visionbuf.h": size_t width size_t height size_t stride + size_t uv_offset + void set_frame_id(uint64_t id) -cdef extern from "visionipc.h": +cdef extern from "cereal/visionipc/visionipc.h": struct VisionIpcBufExtra: uint32_t frame_id uint64_t timestamp_sof uint64_t timestamp_eof -cdef extern from "visionipc_server.h": +cdef extern from "cereal/visionipc/visionipc_server.h": cdef cppclass VisionIpcServer: VisionIpcServer(string, void*, void*) void create_buffers(VisionStreamType, size_t, bool, size_t, size_t) + void create_buffers_with_sizes(VisionStreamType, size_t, bool, size_t, size_t, size_t, size_t, size_t) VisionBuf * get_buffer(VisionStreamType) void send(VisionBuf *, VisionIpcBufExtra *, bool) void start_listener() -cdef extern from "visionipc_client.h": +cdef extern from "cereal/visionipc/visionipc_client.h": cdef cppclass VisionIpcClient: VisionIpcClient(string, VisionStreamType, bool, void*, void*) VisionBuf * recv(VisionIpcBufExtra *, int) diff --git a/cereal/visionipc/visionipc_client.h b/cereal/visionipc/visionipc_client.h index a6426ce92..8dff9b2e0 100644 --- a/cereal/visionipc/visionipc_client.h +++ b/cereal/visionipc/visionipc_client.h @@ -1,11 +1,13 @@ #pragma once -#include + +#include #include +#include #include -#include "messaging/messaging.h" -#include "visionipc/visionipc.h" -#include "visionipc/visionbuf.h" +#include "cereal/messaging/messaging.h" +#include "cereal/visionipc/visionipc.h" +#include "cereal/visionipc/visionbuf.h" class VisionIpcClient { private: @@ -14,8 +16,6 @@ private: SubSocket * sock; Poller * poller; - VisionStreamType type; - cl_device_id device_id = nullptr; cl_context ctx = nullptr; @@ -23,6 +23,7 @@ private: public: bool connected = false; + VisionStreamType type; int num_buffers = 0; VisionBuf buffers[VISIONIPC_MAX_FDS]; VisionIpcClient(std::string name, VisionStreamType type, bool conflate, cl_device_id device_id=nullptr, cl_context ctx=nullptr); @@ -30,4 +31,5 @@ public: VisionBuf * recv(VisionIpcBufExtra * extra=nullptr, const int timeout_ms=100); bool connect(bool blocking=true); bool is_connected() { return connected; } + static std::set getAvailableStreams(const std::string &name, bool blocking = true); }; diff --git a/cereal/visionipc/visionipc_pyx.cpp b/cereal/visionipc/visionipc_pyx.cpp index 1484539b7..c97d6e7f2 100644 --- a/cereal/visionipc/visionipc_pyx.cpp +++ b/cereal/visionipc/visionipc_pyx.cpp @@ -9,9 +9,6 @@ "cereal/visionipc/visionipc_client.h", "cereal/visionipc/visionipc_server.h" ], - "include_dirs": [ - "./cereal/visionipc" - ], "language": "c++", "name": "cereal.visionipc.visionipc_pyx", "sources": [ @@ -729,10 +726,10 @@ static CYTHON_INLINE float __PYX_NAN() { #include "stdexcept" #include "typeinfo" #include -#include "visionbuf.h" -#include "visionipc.h" -#include "visionipc_server.h" -#include "visionipc_client.h" +#include "cereal/visionipc/visionbuf.h" +#include "cereal/visionipc/visionipc.h" +#include "cereal/visionipc/visionipc_server.h" +#include "cereal/visionipc/visionipc_client.h" #include "pythread.h" #include #include "pystate.h" @@ -1353,7 +1350,7 @@ enum __pyx_t_6cereal_9visionipc_13visionipc_pyx_VisionStreamType { __pyx_e_6cereal_9visionipc_13visionipc_pyx_VISION_STREAM_ROAD, __pyx_e_6cereal_9visionipc_13visionipc_pyx_VISION_STREAM_DRIVER, __pyx_e_6cereal_9visionipc_13visionipc_pyx_VISION_STREAM_WIDE_ROAD, - __pyx_e_6cereal_9visionipc_13visionipc_pyx_VISION_STREAM_RGB_MAP + __pyx_e_6cereal_9visionipc_13visionipc_pyx_VISION_STREAM_MAP }; /* "cereal/visionipc/visionipc_pyx.pyx":28 @@ -1369,7 +1366,7 @@ struct __pyx_obj_6cereal_9visionipc_13visionipc_pyx_VisionIpcServer { }; -/* "cereal/visionipc/visionipc_pyx.pyx":58 +/* "cereal/visionipc/visionipc_pyx.pyx":62 * * * cdef class VisionIpcClient: # <<<<<<<<<<<<<< @@ -2555,6 +2552,7 @@ static const char __pyx_k_name_2[] = "__name__"; static const char __pyx_k_pickle[] = "pickle"; static const char __pyx_k_reduce[] = "__reduce__"; static const char __pyx_k_stream[] = "stream"; +static const char __pyx_k_stride[] = "stride"; static const char __pyx_k_struct[] = "struct"; static const char __pyx_k_unpack[] = "unpack"; static const char __pyx_k_update[] = "update"; @@ -2580,6 +2578,7 @@ static const char __pyx_k_enumerate[] = "enumerate"; static const char __pyx_k_metaclass[] = "__metaclass__"; static const char __pyx_k_pyx_state[] = "__pyx_state"; static const char __pyx_k_reduce_ex[] = "__reduce_ex__"; +static const char __pyx_k_uv_offset[] = "uv_offset"; static const char __pyx_k_IndexError[] = "IndexError"; static const char __pyx_k_ValueError[] = "ValueError"; static const char __pyx_k_pyx_result[] = "__pyx_result"; @@ -2606,6 +2605,7 @@ static const char __pyx_k_dtype_is_object[] = "dtype_is_object"; static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError"; static const char __pyx_k_setstate_cython[] = "__setstate_cython__"; static const char __pyx_k_VisionStreamType[] = "VisionStreamType"; +static const char __pyx_k_VISION_STREAM_MAP[] = "VISION_STREAM_MAP"; static const char __pyx_k_pyx_unpickle_Enum[] = "__pyx_unpickle_Enum"; static const char __pyx_k_Pyx_EnumBase___new[] = "__Pyx_EnumBase.__new__"; static const char __pyx_k_Pyx_EnumBase___str[] = "__Pyx_EnumBase.__str__"; @@ -2616,7 +2616,6 @@ static const char __pyx_k_Pyx_EnumBase___repr[] = "__Pyx_EnumBase.__repr__"; static const char __pyx_k_Unknown_enum_value_s[] = "Unknown enum value: '%s'"; static const char __pyx_k_VISION_STREAM_DRIVER[] = "VISION_STREAM_DRIVER"; static const char __pyx_k_strided_and_indirect[] = ""; -static const char __pyx_k_VISION_STREAM_RGB_MAP[] = "VISION_STREAM_RGB_MAP"; static const char __pyx_k_contiguous_and_direct[] = ""; static const char __pyx_k_MemoryView_of_r_object[] = ""; static const char __pyx_k_VISION_STREAM_RGB_ROAD[] = "VISION_STREAM_RGB_ROAD"; @@ -2681,8 +2680,8 @@ static PyObject *__pyx_n_s_TypeError; static PyObject *__pyx_kp_s_Unable_to_convert_item_to_object; static PyObject *__pyx_kp_s_Unknown_enum_value_s; static PyObject *__pyx_n_s_VISION_STREAM_DRIVER; +static PyObject *__pyx_n_s_VISION_STREAM_MAP; static PyObject *__pyx_n_s_VISION_STREAM_RGB_DRIVER; -static PyObject *__pyx_n_s_VISION_STREAM_RGB_MAP; static PyObject *__pyx_n_s_VISION_STREAM_RGB_ROAD; static PyObject *__pyx_n_s_VISION_STREAM_RGB_WIDE_ROAD; static PyObject *__pyx_n_s_VISION_STREAM_ROAD; @@ -2778,6 +2777,7 @@ static PyObject *__pyx_n_s_step; static PyObject *__pyx_n_s_stop; static PyObject *__pyx_n_s_str; static PyObject *__pyx_n_s_stream; +static PyObject *__pyx_n_s_stride; static PyObject *__pyx_kp_s_strided_and_direct; static PyObject *__pyx_kp_s_strided_and_direct_or_indirect; static PyObject *__pyx_kp_s_strided_and_indirect; @@ -2794,22 +2794,25 @@ static PyObject *__pyx_kp_s_unable_to_allocate_array_data; static PyObject *__pyx_kp_s_unable_to_allocate_shape_and_str; static PyObject *__pyx_n_s_unpack; static PyObject *__pyx_n_s_update; +static PyObject *__pyx_n_s_uv_offset; static PyObject *__pyx_n_s_v; static PyObject *__pyx_n_s_value; static PyObject *__pyx_n_s_values; static PyObject *__pyx_n_s_width; static int __pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer___init__(struct __pyx_obj_6cereal_9visionipc_13visionipc_pyx_VisionIpcServer *__pyx_v_self, std::string __pyx_v_name); /* proto */ static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_2create_buffers(struct __pyx_obj_6cereal_9visionipc_13visionipc_pyx_VisionIpcServer *__pyx_v_self, enum __pyx_t_6cereal_9visionipc_13visionipc_pyx_VisionStreamType __pyx_v_tp, size_t __pyx_v_num_buffers, bool __pyx_v_rgb, size_t __pyx_v_width, size_t __pyx_v_height); /* proto */ -static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_4send(struct __pyx_obj_6cereal_9visionipc_13visionipc_pyx_VisionIpcServer *__pyx_v_self, enum __pyx_t_6cereal_9visionipc_13visionipc_pyx_VisionStreamType __pyx_v_tp, __Pyx_memviewslice __pyx_v_data, uint32_t __pyx_v_frame_id, uint64_t __pyx_v_timestamp_sof, uint64_t __pyx_v_timestamp_eof); /* proto */ -static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_6start_listener(struct __pyx_obj_6cereal_9visionipc_13visionipc_pyx_VisionIpcServer *__pyx_v_self); /* proto */ -static void __pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_8__dealloc__(struct __pyx_obj_6cereal_9visionipc_13visionipc_pyx_VisionIpcServer *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_10__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6cereal_9visionipc_13visionipc_pyx_VisionIpcServer *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_12__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6cereal_9visionipc_13visionipc_pyx_VisionIpcServer *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_4create_buffers_with_sizes(struct __pyx_obj_6cereal_9visionipc_13visionipc_pyx_VisionIpcServer *__pyx_v_self, enum __pyx_t_6cereal_9visionipc_13visionipc_pyx_VisionStreamType __pyx_v_tp, size_t __pyx_v_num_buffers, bool __pyx_v_rgb, size_t __pyx_v_width, size_t __pyx_v_height, size_t __pyx_v_size, size_t __pyx_v_stride, size_t __pyx_v_uv_offset); /* proto */ +static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_6send(struct __pyx_obj_6cereal_9visionipc_13visionipc_pyx_VisionIpcServer *__pyx_v_self, enum __pyx_t_6cereal_9visionipc_13visionipc_pyx_VisionStreamType __pyx_v_tp, __Pyx_memviewslice __pyx_v_data, uint32_t __pyx_v_frame_id, uint64_t __pyx_v_timestamp_sof, uint64_t __pyx_v_timestamp_eof); /* proto */ +static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_8start_listener(struct __pyx_obj_6cereal_9visionipc_13visionipc_pyx_VisionIpcServer *__pyx_v_self); /* proto */ +static void __pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_10__dealloc__(struct __pyx_obj_6cereal_9visionipc_13visionipc_pyx_VisionIpcServer *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_12__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6cereal_9visionipc_13visionipc_pyx_VisionIpcServer *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_14__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6cereal_9visionipc_13visionipc_pyx_VisionIpcServer *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ static int __pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcClient___cinit__(struct __pyx_obj_6cereal_9visionipc_13visionipc_pyx_VisionIpcClient *__pyx_v_self, std::string __pyx_v_name, enum __pyx_t_6cereal_9visionipc_13visionipc_pyx_VisionStreamType __pyx_v_stream, bool __pyx_v_conflate); /* proto */ static void __pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcClient_2__dealloc__(struct __pyx_obj_6cereal_9visionipc_13visionipc_pyx_VisionIpcClient *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcClient_5width___get__(struct __pyx_obj_6cereal_9visionipc_13visionipc_pyx_VisionIpcClient *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcClient_6height___get__(struct __pyx_obj_6cereal_9visionipc_13visionipc_pyx_VisionIpcClient *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcClient_6stride___get__(struct __pyx_obj_6cereal_9visionipc_13visionipc_pyx_VisionIpcClient *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcClient_9uv_offset___get__(struct __pyx_obj_6cereal_9visionipc_13visionipc_pyx_VisionIpcClient *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcClient_4recv(struct __pyx_obj_6cereal_9visionipc_13visionipc_pyx_VisionIpcClient *__pyx_v_self, int __pyx_v_timeout_ms); /* proto */ static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcClient_6connect(struct __pyx_obj_6cereal_9visionipc_13visionipc_pyx_VisionIpcClient *__pyx_v_self, bool __pyx_v_blocking); /* proto */ static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcClient_8is_connected(struct __pyx_obj_6cereal_9visionipc_13visionipc_pyx_VisionIpcClient *__pyx_v_self); /* proto */ @@ -2991,7 +2994,7 @@ static int __pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer___init_ * def __init__(self, string name): * self.server = new cppVisionIpcServer(name, NULL, NULL) # <<<<<<<<<<<<<< * - * def create_buffers(self, VisionStreamType tp, size_t num_buffers, bool rgb, size_t width, size_t height): + * def create_buffers(self, VisionStreamType tp, size_t num_buffers, bool rgb, size_t width, size_t height): */ __pyx_v_self->server = new VisionIpcServer(__pyx_v_name, NULL, NULL); @@ -3012,7 +3015,7 @@ static int __pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer___init_ /* "cereal/visionipc/visionipc_pyx.pyx":34 * self.server = new cppVisionIpcServer(name, NULL, NULL) * - * def create_buffers(self, VisionStreamType tp, size_t num_buffers, bool rgb, size_t width, size_t height): # <<<<<<<<<<<<<< + * def create_buffers(self, VisionStreamType tp, size_t num_buffers, bool rgb, size_t width, size_t height): # <<<<<<<<<<<<<< * self.server.create_buffers(tp, num_buffers, rgb, width, height) * */ @@ -3121,17 +3124,17 @@ static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_2 /* "cereal/visionipc/visionipc_pyx.pyx":35 * - * def create_buffers(self, VisionStreamType tp, size_t num_buffers, bool rgb, size_t width, size_t height): + * def create_buffers(self, VisionStreamType tp, size_t num_buffers, bool rgb, size_t width, size_t height): * self.server.create_buffers(tp, num_buffers, rgb, width, height) # <<<<<<<<<<<<<< * - * def send(self, VisionStreamType tp, const unsigned char[:] data, uint32_t frame_id=0, uint64_t timestamp_sof=0, uint64_t timestamp_eof=0): + * def create_buffers_with_sizes(self, VisionStreamType tp, size_t num_buffers, bool rgb, size_t width, size_t height, size_t size, size_t stride, size_t uv_offset): */ __pyx_v_self->server->create_buffers(((enum VisionStreamType)__pyx_v_tp), __pyx_v_num_buffers, __pyx_v_rgb, __pyx_v_width, __pyx_v_height); /* "cereal/visionipc/visionipc_pyx.pyx":34 * self.server = new cppVisionIpcServer(name, NULL, NULL) * - * def create_buffers(self, VisionStreamType tp, size_t num_buffers, bool rgb, size_t width, size_t height): # <<<<<<<<<<<<<< + * def create_buffers(self, VisionStreamType tp, size_t num_buffers, bool rgb, size_t width, size_t height): # <<<<<<<<<<<<<< * self.server.create_buffers(tp, num_buffers, rgb, width, height) * */ @@ -3146,14 +3149,181 @@ static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_2 /* "cereal/visionipc/visionipc_pyx.pyx":37 * self.server.create_buffers(tp, num_buffers, rgb, width, height) * + * def create_buffers_with_sizes(self, VisionStreamType tp, size_t num_buffers, bool rgb, size_t width, size_t height, size_t size, size_t stride, size_t uv_offset): # <<<<<<<<<<<<<< + * self.server.create_buffers_with_sizes(tp, num_buffers, rgb, width, height, size, stride, uv_offset) + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_5create_buffers_with_sizes(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_5create_buffers_with_sizes(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + enum __pyx_t_6cereal_9visionipc_13visionipc_pyx_VisionStreamType __pyx_v_tp; + size_t __pyx_v_num_buffers; + bool __pyx_v_rgb; + size_t __pyx_v_width; + size_t __pyx_v_height; + size_t __pyx_v_size; + size_t __pyx_v_stride; + size_t __pyx_v_uv_offset; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("create_buffers_with_sizes (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tp,&__pyx_n_s_num_buffers,&__pyx_n_s_rgb,&__pyx_n_s_width,&__pyx_n_s_height,&__pyx_n_s_size,&__pyx_n_s_stride,&__pyx_n_s_uv_offset,0}; + PyObject* values[8] = {0,0,0,0,0,0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + CYTHON_FALLTHROUGH; + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tp)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_num_buffers)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("create_buffers_with_sizes", 1, 8, 8, 1); __PYX_ERR(1, 37, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rgb)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("create_buffers_with_sizes", 1, 8, 8, 2); __PYX_ERR(1, 37, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_width)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("create_buffers_with_sizes", 1, 8, 8, 3); __PYX_ERR(1, 37, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_height)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("create_buffers_with_sizes", 1, 8, 8, 4); __PYX_ERR(1, 37, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 5: + if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_size)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("create_buffers_with_sizes", 1, 8, 8, 5); __PYX_ERR(1, 37, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 6: + if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_stride)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("create_buffers_with_sizes", 1, 8, 8, 6); __PYX_ERR(1, 37, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 7: + if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_uv_offset)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("create_buffers_with_sizes", 1, 8, 8, 7); __PYX_ERR(1, 37, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "create_buffers_with_sizes") < 0)) __PYX_ERR(1, 37, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 8) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + } + __pyx_v_tp = ((enum __pyx_t_6cereal_9visionipc_13visionipc_pyx_VisionStreamType)__Pyx_PyInt_As_enum____pyx_t_6cereal_9visionipc_13visionipc_pyx_VisionStreamType(values[0])); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 37, __pyx_L3_error) + __pyx_v_num_buffers = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_num_buffers == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 37, __pyx_L3_error) + __pyx_v_rgb = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_rgb == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(1, 37, __pyx_L3_error) + __pyx_v_width = __Pyx_PyInt_As_size_t(values[3]); if (unlikely((__pyx_v_width == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 37, __pyx_L3_error) + __pyx_v_height = __Pyx_PyInt_As_size_t(values[4]); if (unlikely((__pyx_v_height == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 37, __pyx_L3_error) + __pyx_v_size = __Pyx_PyInt_As_size_t(values[5]); if (unlikely((__pyx_v_size == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 37, __pyx_L3_error) + __pyx_v_stride = __Pyx_PyInt_As_size_t(values[6]); if (unlikely((__pyx_v_stride == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 37, __pyx_L3_error) + __pyx_v_uv_offset = __Pyx_PyInt_As_size_t(values[7]); if (unlikely((__pyx_v_uv_offset == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 37, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("create_buffers_with_sizes", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 37, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("cereal.visionipc.visionipc_pyx.VisionIpcServer.create_buffers_with_sizes", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_4create_buffers_with_sizes(((struct __pyx_obj_6cereal_9visionipc_13visionipc_pyx_VisionIpcServer *)__pyx_v_self), __pyx_v_tp, __pyx_v_num_buffers, __pyx_v_rgb, __pyx_v_width, __pyx_v_height, __pyx_v_size, __pyx_v_stride, __pyx_v_uv_offset); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_4create_buffers_with_sizes(struct __pyx_obj_6cereal_9visionipc_13visionipc_pyx_VisionIpcServer *__pyx_v_self, enum __pyx_t_6cereal_9visionipc_13visionipc_pyx_VisionStreamType __pyx_v_tp, size_t __pyx_v_num_buffers, bool __pyx_v_rgb, size_t __pyx_v_width, size_t __pyx_v_height, size_t __pyx_v_size, size_t __pyx_v_stride, size_t __pyx_v_uv_offset) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("create_buffers_with_sizes", 0); + + /* "cereal/visionipc/visionipc_pyx.pyx":38 + * + * def create_buffers_with_sizes(self, VisionStreamType tp, size_t num_buffers, bool rgb, size_t width, size_t height, size_t size, size_t stride, size_t uv_offset): + * self.server.create_buffers_with_sizes(tp, num_buffers, rgb, width, height, size, stride, uv_offset) # <<<<<<<<<<<<<< + * + * def send(self, VisionStreamType tp, const unsigned char[:] data, uint32_t frame_id=0, uint64_t timestamp_sof=0, uint64_t timestamp_eof=0): + */ + __pyx_v_self->server->create_buffers_with_sizes(((enum VisionStreamType)__pyx_v_tp), __pyx_v_num_buffers, __pyx_v_rgb, __pyx_v_width, __pyx_v_height, __pyx_v_size, __pyx_v_stride, __pyx_v_uv_offset); + + /* "cereal/visionipc/visionipc_pyx.pyx":37 + * self.server.create_buffers(tp, num_buffers, rgb, width, height) + * + * def create_buffers_with_sizes(self, VisionStreamType tp, size_t num_buffers, bool rgb, size_t width, size_t height, size_t size, size_t stride, size_t uv_offset): # <<<<<<<<<<<<<< + * self.server.create_buffers_with_sizes(tp, num_buffers, rgb, width, height, size, stride, uv_offset) + * + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cereal/visionipc/visionipc_pyx.pyx":40 + * self.server.create_buffers_with_sizes(tp, num_buffers, rgb, width, height, size, stride, uv_offset) + * * def send(self, VisionStreamType tp, const unsigned char[:] data, uint32_t frame_id=0, uint64_t timestamp_sof=0, uint64_t timestamp_eof=0): # <<<<<<<<<<<<<< * cdef cppVisionBuf * buf = self.server.get_buffer(tp) * */ /* Python wrapper */ -static PyObject *__pyx_pw_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_5send(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_5send(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_7send(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_7send(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { enum __pyx_t_6cereal_9visionipc_13visionipc_pyx_VisionStreamType __pyx_v_tp; __Pyx_memviewslice __pyx_v_data = { 0, 0, { 0 }, { 0 }, { 0 } }; uint32_t __pyx_v_frame_id; @@ -3194,7 +3364,7 @@ static PyObject *__pyx_pw_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_5 case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_data)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("send", 0, 2, 5, 1); __PYX_ERR(1, 37, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("send", 0, 2, 5, 1); __PYX_ERR(1, 40, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: @@ -3216,7 +3386,7 @@ static PyObject *__pyx_pw_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_5 } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "send") < 0)) __PYX_ERR(1, 37, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "send") < 0)) __PYX_ERR(1, 40, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -3232,40 +3402,40 @@ static PyObject *__pyx_pw_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_5 default: goto __pyx_L5_argtuple_error; } } - __pyx_v_tp = ((enum __pyx_t_6cereal_9visionipc_13visionipc_pyx_VisionStreamType)__Pyx_PyInt_As_enum____pyx_t_6cereal_9visionipc_13visionipc_pyx_VisionStreamType(values[0])); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 37, __pyx_L3_error) - __pyx_v_data = __Pyx_PyObject_to_MemoryviewSlice_ds_unsigned_char__const__(values[1], 0); if (unlikely(!__pyx_v_data.memview)) __PYX_ERR(1, 37, __pyx_L3_error) + __pyx_v_tp = ((enum __pyx_t_6cereal_9visionipc_13visionipc_pyx_VisionStreamType)__Pyx_PyInt_As_enum____pyx_t_6cereal_9visionipc_13visionipc_pyx_VisionStreamType(values[0])); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 40, __pyx_L3_error) + __pyx_v_data = __Pyx_PyObject_to_MemoryviewSlice_ds_unsigned_char__const__(values[1], 0); if (unlikely(!__pyx_v_data.memview)) __PYX_ERR(1, 40, __pyx_L3_error) if (values[2]) { - __pyx_v_frame_id = __Pyx_PyInt_As_uint32_t(values[2]); if (unlikely((__pyx_v_frame_id == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 37, __pyx_L3_error) + __pyx_v_frame_id = __Pyx_PyInt_As_uint32_t(values[2]); if (unlikely((__pyx_v_frame_id == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 40, __pyx_L3_error) } else { __pyx_v_frame_id = ((uint32_t)0); } if (values[3]) { - __pyx_v_timestamp_sof = __Pyx_PyInt_As_uint64_t(values[3]); if (unlikely((__pyx_v_timestamp_sof == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 37, __pyx_L3_error) + __pyx_v_timestamp_sof = __Pyx_PyInt_As_uint64_t(values[3]); if (unlikely((__pyx_v_timestamp_sof == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 40, __pyx_L3_error) } else { __pyx_v_timestamp_sof = ((uint64_t)0); } if (values[4]) { - __pyx_v_timestamp_eof = __Pyx_PyInt_As_uint64_t(values[4]); if (unlikely((__pyx_v_timestamp_eof == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 37, __pyx_L3_error) + __pyx_v_timestamp_eof = __Pyx_PyInt_As_uint64_t(values[4]); if (unlikely((__pyx_v_timestamp_eof == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 40, __pyx_L3_error) } else { __pyx_v_timestamp_eof = ((uint64_t)0); } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("send", 0, 2, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 37, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("send", 0, 2, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 40, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("cereal.visionipc.visionipc_pyx.VisionIpcServer.send", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_4send(((struct __pyx_obj_6cereal_9visionipc_13visionipc_pyx_VisionIpcServer *)__pyx_v_self), __pyx_v_tp, __pyx_v_data, __pyx_v_frame_id, __pyx_v_timestamp_sof, __pyx_v_timestamp_eof); + __pyx_r = __pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_6send(((struct __pyx_obj_6cereal_9visionipc_13visionipc_pyx_VisionIpcServer *)__pyx_v_self), __pyx_v_tp, __pyx_v_data, __pyx_v_frame_id, __pyx_v_timestamp_sof, __pyx_v_timestamp_eof); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_4send(struct __pyx_obj_6cereal_9visionipc_13visionipc_pyx_VisionIpcServer *__pyx_v_self, enum __pyx_t_6cereal_9visionipc_13visionipc_pyx_VisionStreamType __pyx_v_tp, __Pyx_memviewslice __pyx_v_data, uint32_t __pyx_v_frame_id, uint64_t __pyx_v_timestamp_sof, uint64_t __pyx_v_timestamp_eof) { +static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_6send(struct __pyx_obj_6cereal_9visionipc_13visionipc_pyx_VisionIpcServer *__pyx_v_self, enum __pyx_t_6cereal_9visionipc_13visionipc_pyx_VisionStreamType __pyx_v_tp, __Pyx_memviewslice __pyx_v_data, uint32_t __pyx_v_frame_id, uint64_t __pyx_v_timestamp_sof, uint64_t __pyx_v_timestamp_eof) { VisionBuf *__pyx_v_buf; struct VisionIpcBufExtra __pyx_v_extra; PyObject *__pyx_r = NULL; @@ -3278,7 +3448,7 @@ static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_4 int __pyx_clineno = 0; __Pyx_RefNannySetupContext("send", 0); - /* "cereal/visionipc/visionipc_pyx.pyx":38 + /* "cereal/visionipc/visionipc_pyx.pyx":41 * * def send(self, VisionStreamType tp, const unsigned char[:] data, uint32_t frame_id=0, uint64_t timestamp_sof=0, uint64_t timestamp_eof=0): * cdef cppVisionBuf * buf = self.server.get_buffer(tp) # <<<<<<<<<<<<<< @@ -3287,29 +3457,29 @@ static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_4 */ __pyx_v_buf = __pyx_v_self->server->get_buffer(((enum VisionStreamType)__pyx_v_tp)); - /* "cereal/visionipc/visionipc_pyx.pyx":41 + /* "cereal/visionipc/visionipc_pyx.pyx":44 * * # Populate buffer * assert buf.len == len(data) # <<<<<<<<<<<<<< * memcpy(buf.addr, &data[0], len(data)) - * + * buf.set_frame_id(frame_id) */ #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_data); if (unlikely(!((__pyx_v_buf->len == __pyx_t_1) != 0))) { PyErr_SetNone(PyExc_AssertionError); - __PYX_ERR(1, 41, __pyx_L1_error) + __PYX_ERR(1, 44, __pyx_L1_error) } } #endif - /* "cereal/visionipc/visionipc_pyx.pyx":42 + /* "cereal/visionipc/visionipc_pyx.pyx":45 * # Populate buffer * assert buf.len == len(data) * memcpy(buf.addr, &data[0], len(data)) # <<<<<<<<<<<<<< + * buf.set_frame_id(frame_id) * - * cdef VisionIpcBufExtra extra */ __pyx_t_2 = 0; __pyx_t_3 = -1; @@ -3319,12 +3489,21 @@ static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_4 } else if (unlikely(__pyx_t_2 >= __pyx_v_data.shape[0])) __pyx_t_3 = 0; if (unlikely(__pyx_t_3 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_3); - __PYX_ERR(1, 42, __pyx_L1_error) + __PYX_ERR(1, 45, __pyx_L1_error) } __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_data); (void)(memcpy(__pyx_v_buf->addr, (&(*((unsigned char const *) ( /* dim=0 */ (__pyx_v_data.data + __pyx_t_2 * __pyx_v_data.strides[0]) )))), __pyx_t_1)); - /* "cereal/visionipc/visionipc_pyx.pyx":45 + /* "cereal/visionipc/visionipc_pyx.pyx":46 + * assert buf.len == len(data) + * memcpy(buf.addr, &data[0], len(data)) + * buf.set_frame_id(frame_id) # <<<<<<<<<<<<<< + * + * cdef VisionIpcBufExtra extra + */ + __pyx_v_buf->set_frame_id(__pyx_v_frame_id); + + /* "cereal/visionipc/visionipc_pyx.pyx":49 * * cdef VisionIpcBufExtra extra * extra.frame_id = frame_id # <<<<<<<<<<<<<< @@ -3333,7 +3512,7 @@ static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_4 */ __pyx_v_extra.frame_id = __pyx_v_frame_id; - /* "cereal/visionipc/visionipc_pyx.pyx":46 + /* "cereal/visionipc/visionipc_pyx.pyx":50 * cdef VisionIpcBufExtra extra * extra.frame_id = frame_id * extra.timestamp_sof = timestamp_sof # <<<<<<<<<<<<<< @@ -3342,7 +3521,7 @@ static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_4 */ __pyx_v_extra.timestamp_sof = __pyx_v_timestamp_sof; - /* "cereal/visionipc/visionipc_pyx.pyx":47 + /* "cereal/visionipc/visionipc_pyx.pyx":51 * extra.frame_id = frame_id * extra.timestamp_sof = timestamp_sof * extra.timestamp_eof = timestamp_eof # <<<<<<<<<<<<<< @@ -3351,7 +3530,7 @@ static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_4 */ __pyx_v_extra.timestamp_eof = __pyx_v_timestamp_eof; - /* "cereal/visionipc/visionipc_pyx.pyx":49 + /* "cereal/visionipc/visionipc_pyx.pyx":53 * extra.timestamp_eof = timestamp_eof * * self.server.send(buf, &extra, False) # <<<<<<<<<<<<<< @@ -3360,8 +3539,8 @@ static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_4 */ __pyx_v_self->server->send(__pyx_v_buf, (&__pyx_v_extra), 0); - /* "cereal/visionipc/visionipc_pyx.pyx":37 - * self.server.create_buffers(tp, num_buffers, rgb, width, height) + /* "cereal/visionipc/visionipc_pyx.pyx":40 + * self.server.create_buffers_with_sizes(tp, num_buffers, rgb, width, height, size, stride, uv_offset) * * def send(self, VisionStreamType tp, const unsigned char[:] data, uint32_t frame_id=0, uint64_t timestamp_sof=0, uint64_t timestamp_eof=0): # <<<<<<<<<<<<<< * cdef cppVisionBuf * buf = self.server.get_buffer(tp) @@ -3381,7 +3560,7 @@ static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_4 return __pyx_r; } -/* "cereal/visionipc/visionipc_pyx.pyx":51 +/* "cereal/visionipc/visionipc_pyx.pyx":55 * self.server.send(buf, &extra, False) * * def start_listener(self): # <<<<<<<<<<<<<< @@ -3390,24 +3569,24 @@ static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_4 */ /* Python wrapper */ -static PyObject *__pyx_pw_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_7start_listener(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_7start_listener(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_9start_listener(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_9start_listener(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("start_listener (wrapper)", 0); - __pyx_r = __pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_6start_listener(((struct __pyx_obj_6cereal_9visionipc_13visionipc_pyx_VisionIpcServer *)__pyx_v_self)); + __pyx_r = __pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_8start_listener(((struct __pyx_obj_6cereal_9visionipc_13visionipc_pyx_VisionIpcServer *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_6start_listener(struct __pyx_obj_6cereal_9visionipc_13visionipc_pyx_VisionIpcServer *__pyx_v_self) { +static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_8start_listener(struct __pyx_obj_6cereal_9visionipc_13visionipc_pyx_VisionIpcServer *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("start_listener", 0); - /* "cereal/visionipc/visionipc_pyx.pyx":52 + /* "cereal/visionipc/visionipc_pyx.pyx":56 * * def start_listener(self): * self.server.start_listener() # <<<<<<<<<<<<<< @@ -3416,7 +3595,7 @@ static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_6 */ __pyx_v_self->server->start_listener(); - /* "cereal/visionipc/visionipc_pyx.pyx":51 + /* "cereal/visionipc/visionipc_pyx.pyx":55 * self.server.send(buf, &extra, False) * * def start_listener(self): # <<<<<<<<<<<<<< @@ -3431,7 +3610,7 @@ static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_6 return __pyx_r; } -/* "cereal/visionipc/visionipc_pyx.pyx":54 +/* "cereal/visionipc/visionipc_pyx.pyx":58 * self.server.start_listener() * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -3440,21 +3619,21 @@ static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_6 */ /* Python wrapper */ -static void __pyx_pw_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_9__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pw_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_9__dealloc__(PyObject *__pyx_v_self) { +static void __pyx_pw_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_11__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pw_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_11__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_8__dealloc__(((struct __pyx_obj_6cereal_9visionipc_13visionipc_pyx_VisionIpcServer *)__pyx_v_self)); + __pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_10__dealloc__(((struct __pyx_obj_6cereal_9visionipc_13visionipc_pyx_VisionIpcServer *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); } -static void __pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_8__dealloc__(struct __pyx_obj_6cereal_9visionipc_13visionipc_pyx_VisionIpcServer *__pyx_v_self) { +static void __pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_10__dealloc__(struct __pyx_obj_6cereal_9visionipc_13visionipc_pyx_VisionIpcServer *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "cereal/visionipc/visionipc_pyx.pyx":55 + /* "cereal/visionipc/visionipc_pyx.pyx":59 * * def __dealloc__(self): * del self.server # <<<<<<<<<<<<<< @@ -3463,7 +3642,7 @@ static void __pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_8__dea */ delete __pyx_v_self->server; - /* "cereal/visionipc/visionipc_pyx.pyx":54 + /* "cereal/visionipc/visionipc_pyx.pyx":58 * self.server.start_listener() * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -3482,19 +3661,19 @@ static void __pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_8__dea */ /* Python wrapper */ -static PyObject *__pyx_pw_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_11__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_11__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_13__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_13__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_10__reduce_cython__(((struct __pyx_obj_6cereal_9visionipc_13visionipc_pyx_VisionIpcServer *)__pyx_v_self)); + __pyx_r = __pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_12__reduce_cython__(((struct __pyx_obj_6cereal_9visionipc_13visionipc_pyx_VisionIpcServer *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_10__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6cereal_9visionipc_13visionipc_pyx_VisionIpcServer *__pyx_v_self) { +static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_12__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6cereal_9visionipc_13visionipc_pyx_VisionIpcServer *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -3539,19 +3718,19 @@ static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_1 */ /* Python wrapper */ -static PyObject *__pyx_pw_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_13__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ -static PyObject *__pyx_pw_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_13__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { +static PyObject *__pyx_pw_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_15__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ +static PyObject *__pyx_pw_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_15__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_12__setstate_cython__(((struct __pyx_obj_6cereal_9visionipc_13visionipc_pyx_VisionIpcServer *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); + __pyx_r = __pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_14__setstate_cython__(((struct __pyx_obj_6cereal_9visionipc_13visionipc_pyx_VisionIpcServer *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_12__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6cereal_9visionipc_13visionipc_pyx_VisionIpcServer *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { +static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_14__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6cereal_9visionipc_13visionipc_pyx_VisionIpcServer *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -3588,7 +3767,7 @@ static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_1 return __pyx_r; } -/* "cereal/visionipc/visionipc_pyx.pyx":62 +/* "cereal/visionipc/visionipc_pyx.pyx":66 * cdef cppVisionIpcClient * client * * def __cinit__(self, string name, VisionStreamType stream, bool conflate): # <<<<<<<<<<<<<< @@ -3633,17 +3812,17 @@ static int __pyx_pw_6cereal_9visionipc_13visionipc_pyx_15VisionIpcClient_1__cini case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_stream)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, 1); __PYX_ERR(1, 62, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, 1); __PYX_ERR(1, 66, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_conflate)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, 2); __PYX_ERR(1, 62, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, 2); __PYX_ERR(1, 66, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(1, 62, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(1, 66, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -3652,13 +3831,13 @@ static int __pyx_pw_6cereal_9visionipc_13visionipc_pyx_15VisionIpcClient_1__cini values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); } - __pyx_v_name = __pyx_convert_string_from_py_std__in_string(values[0]); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 62, __pyx_L3_error) - __pyx_v_stream = ((enum __pyx_t_6cereal_9visionipc_13visionipc_pyx_VisionStreamType)__Pyx_PyInt_As_enum____pyx_t_6cereal_9visionipc_13visionipc_pyx_VisionStreamType(values[1])); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 62, __pyx_L3_error) - __pyx_v_conflate = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_conflate == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(1, 62, __pyx_L3_error) + __pyx_v_name = __pyx_convert_string_from_py_std__in_string(values[0]); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 66, __pyx_L3_error) + __pyx_v_stream = ((enum __pyx_t_6cereal_9visionipc_13visionipc_pyx_VisionStreamType)__Pyx_PyInt_As_enum____pyx_t_6cereal_9visionipc_13visionipc_pyx_VisionStreamType(values[1])); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 66, __pyx_L3_error) + __pyx_v_conflate = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_conflate == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(1, 66, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 62, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 66, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("cereal.visionipc.visionipc_pyx.VisionIpcClient.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -3676,7 +3855,7 @@ static int __pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcClient___cinit __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__", 0); - /* "cereal/visionipc/visionipc_pyx.pyx":63 + /* "cereal/visionipc/visionipc_pyx.pyx":67 * * def __cinit__(self, string name, VisionStreamType stream, bool conflate): * self.client = new cppVisionIpcClient(name, stream, conflate, NULL, NULL) # <<<<<<<<<<<<<< @@ -3685,7 +3864,7 @@ static int __pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcClient___cinit */ __pyx_v_self->client = new VisionIpcClient(__pyx_v_name, ((enum VisionStreamType)__pyx_v_stream), __pyx_v_conflate, NULL, NULL); - /* "cereal/visionipc/visionipc_pyx.pyx":64 + /* "cereal/visionipc/visionipc_pyx.pyx":68 * def __cinit__(self, string name, VisionStreamType stream, bool conflate): * self.client = new cppVisionIpcClient(name, stream, conflate, NULL, NULL) * self.buf = NULL # <<<<<<<<<<<<<< @@ -3694,7 +3873,7 @@ static int __pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcClient___cinit */ __pyx_v_self->buf = NULL; - /* "cereal/visionipc/visionipc_pyx.pyx":62 + /* "cereal/visionipc/visionipc_pyx.pyx":66 * cdef cppVisionIpcClient * client * * def __cinit__(self, string name, VisionStreamType stream, bool conflate): # <<<<<<<<<<<<<< @@ -3708,7 +3887,7 @@ static int __pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcClient___cinit return __pyx_r; } -/* "cereal/visionipc/visionipc_pyx.pyx":66 +/* "cereal/visionipc/visionipc_pyx.pyx":70 * self.buf = NULL * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -3731,7 +3910,7 @@ static void __pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcClient_2__dea __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "cereal/visionipc/visionipc_pyx.pyx":67 + /* "cereal/visionipc/visionipc_pyx.pyx":71 * * def __dealloc__(self): * del self.client # <<<<<<<<<<<<<< @@ -3740,7 +3919,7 @@ static void __pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcClient_2__dea */ delete __pyx_v_self->client; - /* "cereal/visionipc/visionipc_pyx.pyx":66 + /* "cereal/visionipc/visionipc_pyx.pyx":70 * self.buf = NULL * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -3752,7 +3931,7 @@ static void __pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcClient_2__dea __Pyx_RefNannyFinishContext(); } -/* "cereal/visionipc/visionipc_pyx.pyx":70 +/* "cereal/visionipc/visionipc_pyx.pyx":74 * * @property * def width(self): # <<<<<<<<<<<<<< @@ -3783,7 +3962,7 @@ static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcClient_5 int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "cereal/visionipc/visionipc_pyx.pyx":71 + /* "cereal/visionipc/visionipc_pyx.pyx":75 * @property * def width(self): * return None if not self.buf else self.buf.width # <<<<<<<<<<<<<< @@ -3795,7 +3974,7 @@ static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcClient_5 __Pyx_INCREF(Py_None); __pyx_t_1 = Py_None; } else { - __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_self->buf->width); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 71, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_self->buf->width); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 75, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = __pyx_t_2; __pyx_t_2 = 0; @@ -3804,7 +3983,7 @@ static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcClient_5 __pyx_t_1 = 0; goto __pyx_L0; - /* "cereal/visionipc/visionipc_pyx.pyx":70 + /* "cereal/visionipc/visionipc_pyx.pyx":74 * * @property * def width(self): # <<<<<<<<<<<<<< @@ -3824,7 +4003,7 @@ static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcClient_5 return __pyx_r; } -/* "cereal/visionipc/visionipc_pyx.pyx":74 +/* "cereal/visionipc/visionipc_pyx.pyx":78 * * @property * def height(self): # <<<<<<<<<<<<<< @@ -3855,7 +4034,7 @@ static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcClient_6 int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "cereal/visionipc/visionipc_pyx.pyx":75 + /* "cereal/visionipc/visionipc_pyx.pyx":79 * @property * def height(self): * return None if not self.buf else self.buf.height # <<<<<<<<<<<<<< @@ -3867,7 +4046,7 @@ static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcClient_6 __Pyx_INCREF(Py_None); __pyx_t_1 = Py_None; } else { - __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_self->buf->height); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 75, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_self->buf->height); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 79, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = __pyx_t_2; __pyx_t_2 = 0; @@ -3876,7 +4055,7 @@ static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcClient_6 __pyx_t_1 = 0; goto __pyx_L0; - /* "cereal/visionipc/visionipc_pyx.pyx":74 + /* "cereal/visionipc/visionipc_pyx.pyx":78 * * @property * def height(self): # <<<<<<<<<<<<<< @@ -3896,7 +4075,7 @@ static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcClient_6 return __pyx_r; } -/* "cereal/visionipc/visionipc_pyx.pyx":78 +/* "cereal/visionipc/visionipc_pyx.pyx":82 * * @property * def stride(self): # <<<<<<<<<<<<<< @@ -3927,19 +4106,19 @@ static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcClient_6 int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "cereal/visionipc/visionipc_pyx.pyx":79 + /* "cereal/visionipc/visionipc_pyx.pyx":83 * @property * def stride(self): * return None if not self.buf else self.buf.stride # <<<<<<<<<<<<<< * - * def recv(self, int timeout_ms=100): + * @property */ __Pyx_XDECREF(__pyx_r); if (((!(__pyx_v_self->buf != 0)) != 0)) { __Pyx_INCREF(Py_None); __pyx_t_1 = Py_None; } else { - __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_self->buf->stride); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 79, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_self->buf->stride); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 83, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = __pyx_t_2; __pyx_t_2 = 0; @@ -3948,7 +4127,7 @@ static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcClient_6 __pyx_t_1 = 0; goto __pyx_L0; - /* "cereal/visionipc/visionipc_pyx.pyx":78 + /* "cereal/visionipc/visionipc_pyx.pyx":82 * * @property * def stride(self): # <<<<<<<<<<<<<< @@ -3968,8 +4147,80 @@ static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcClient_6 return __pyx_r; } -/* "cereal/visionipc/visionipc_pyx.pyx":81 - * return None if not self.buf else self.buf.stride +/* "cereal/visionipc/visionipc_pyx.pyx":86 + * + * @property + * def uv_offset(self): # <<<<<<<<<<<<<< + * return None if not self.buf else self.buf.uv_offset + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6cereal_9visionipc_13visionipc_pyx_15VisionIpcClient_9uv_offset_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6cereal_9visionipc_13visionipc_pyx_15VisionIpcClient_9uv_offset_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcClient_9uv_offset___get__(((struct __pyx_obj_6cereal_9visionipc_13visionipc_pyx_VisionIpcClient *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcClient_9uv_offset___get__(struct __pyx_obj_6cereal_9visionipc_13visionipc_pyx_VisionIpcClient *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "cereal/visionipc/visionipc_pyx.pyx":87 + * @property + * def uv_offset(self): + * return None if not self.buf else self.buf.uv_offset # <<<<<<<<<<<<<< + * + * def recv(self, int timeout_ms=100): + */ + __Pyx_XDECREF(__pyx_r); + if (((!(__pyx_v_self->buf != 0)) != 0)) { + __Pyx_INCREF(Py_None); + __pyx_t_1 = Py_None; + } else { + __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_self->buf->uv_offset); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 87, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __pyx_t_2; + __pyx_t_2 = 0; + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "cereal/visionipc/visionipc_pyx.pyx":86 + * + * @property + * def uv_offset(self): # <<<<<<<<<<<<<< + * return None if not self.buf else self.buf.uv_offset + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("cereal.visionipc.visionipc_pyx.VisionIpcClient.uv_offset.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cereal/visionipc/visionipc_pyx.pyx":89 + * return None if not self.buf else self.buf.uv_offset * * def recv(self, int timeout_ms=100): # <<<<<<<<<<<<<< * self.buf = self.client.recv(NULL, timeout_ms) @@ -4007,7 +4258,7 @@ static PyObject *__pyx_pw_6cereal_9visionipc_13visionipc_pyx_15VisionIpcClient_5 } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "recv") < 0)) __PYX_ERR(1, 81, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "recv") < 0)) __PYX_ERR(1, 89, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -4018,14 +4269,14 @@ static PyObject *__pyx_pw_6cereal_9visionipc_13visionipc_pyx_15VisionIpcClient_5 } } if (values[0]) { - __pyx_v_timeout_ms = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_timeout_ms == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 81, __pyx_L3_error) + __pyx_v_timeout_ms = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_timeout_ms == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 89, __pyx_L3_error) } else { __pyx_v_timeout_ms = ((int)0x64); } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("recv", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 81, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("recv", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 89, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("cereal.visionipc.visionipc_pyx.VisionIpcClient.recv", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -4057,7 +4308,7 @@ static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcClient_4 int __pyx_clineno = 0; __Pyx_RefNannySetupContext("recv", 0); - /* "cereal/visionipc/visionipc_pyx.pyx":82 + /* "cereal/visionipc/visionipc_pyx.pyx":90 * * def recv(self, int timeout_ms=100): * self.buf = self.client.recv(NULL, timeout_ms) # <<<<<<<<<<<<<< @@ -4066,7 +4317,7 @@ static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcClient_4 */ __pyx_v_self->buf = __pyx_v_self->client->recv(NULL, __pyx_v_timeout_ms); - /* "cereal/visionipc/visionipc_pyx.pyx":83 + /* "cereal/visionipc/visionipc_pyx.pyx":91 * def recv(self, int timeout_ms=100): * self.buf = self.client.recv(NULL, timeout_ms) * if not self.buf: # <<<<<<<<<<<<<< @@ -4076,7 +4327,7 @@ static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcClient_4 __pyx_t_1 = ((!(__pyx_v_self->buf != 0)) != 0); if (__pyx_t_1) { - /* "cereal/visionipc/visionipc_pyx.pyx":84 + /* "cereal/visionipc/visionipc_pyx.pyx":92 * self.buf = self.client.recv(NULL, timeout_ms) * if not self.buf: * return None # <<<<<<<<<<<<<< @@ -4087,7 +4338,7 @@ static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcClient_4 __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; - /* "cereal/visionipc/visionipc_pyx.pyx":83 + /* "cereal/visionipc/visionipc_pyx.pyx":91 * def recv(self, int timeout_ms=100): * self.buf = self.client.recv(NULL, timeout_ms) * if not self.buf: # <<<<<<<<<<<<<< @@ -4096,56 +4347,56 @@ static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcClient_4 */ } - /* "cereal/visionipc/visionipc_pyx.pyx":85 + /* "cereal/visionipc/visionipc_pyx.pyx":93 * if not self.buf: * return None * cdef cnp.ndarray dat = np.empty(self.buf.len, dtype=np.uint8) # <<<<<<<<<<<<<< * cdef char[:] dat_view = dat * memcpy(&dat_view[0], self.buf.addr, self.buf.len) */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 85, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 93, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_empty); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 85, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_empty); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 93, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_self->buf->len); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 85, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_self->buf->len); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 93, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 85, __pyx_L1_error) + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 93, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 85, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 93, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 85, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 93, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_uint8); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 85, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_uint8); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 93, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_6) < 0) __PYX_ERR(1, 85, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_6) < 0) __PYX_ERR(1, 93, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 85, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 93, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 85, __pyx_L1_error) + if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 93, __pyx_L1_error) __pyx_v_dat = ((PyArrayObject *)__pyx_t_6); __pyx_t_6 = 0; - /* "cereal/visionipc/visionipc_pyx.pyx":86 + /* "cereal/visionipc/visionipc_pyx.pyx":94 * return None * cdef cnp.ndarray dat = np.empty(self.buf.len, dtype=np.uint8) * cdef char[:] dat_view = dat # <<<<<<<<<<<<<< * memcpy(&dat_view[0], self.buf.addr, self.buf.len) * return dat */ - __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_char(((PyObject *)__pyx_v_dat), PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(1, 86, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_char(((PyObject *)__pyx_v_dat), PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(1, 94, __pyx_L1_error) __pyx_v_dat_view = __pyx_t_7; __pyx_t_7.memview = NULL; __pyx_t_7.data = NULL; - /* "cereal/visionipc/visionipc_pyx.pyx":87 + /* "cereal/visionipc/visionipc_pyx.pyx":95 * cdef cnp.ndarray dat = np.empty(self.buf.len, dtype=np.uint8) * cdef char[:] dat_view = dat * memcpy(&dat_view[0], self.buf.addr, self.buf.len) # <<<<<<<<<<<<<< @@ -4160,11 +4411,11 @@ static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcClient_4 } else if (unlikely(__pyx_t_8 >= __pyx_v_dat_view.shape[0])) __pyx_t_9 = 0; if (unlikely(__pyx_t_9 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_9); - __PYX_ERR(1, 87, __pyx_L1_error) + __PYX_ERR(1, 95, __pyx_L1_error) } (void)(memcpy((&(*((char *) ( /* dim=0 */ (__pyx_v_dat_view.data + __pyx_t_8 * __pyx_v_dat_view.strides[0]) )))), __pyx_v_self->buf->addr, __pyx_v_self->buf->len)); - /* "cereal/visionipc/visionipc_pyx.pyx":88 + /* "cereal/visionipc/visionipc_pyx.pyx":96 * cdef char[:] dat_view = dat * memcpy(&dat_view[0], self.buf.addr, self.buf.len) * return dat # <<<<<<<<<<<<<< @@ -4176,8 +4427,8 @@ static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcClient_4 __pyx_r = ((PyObject *)__pyx_v_dat); goto __pyx_L0; - /* "cereal/visionipc/visionipc_pyx.pyx":81 - * return None if not self.buf else self.buf.stride + /* "cereal/visionipc/visionipc_pyx.pyx":89 + * return None if not self.buf else self.buf.uv_offset * * def recv(self, int timeout_ms=100): # <<<<<<<<<<<<<< * self.buf = self.client.recv(NULL, timeout_ms) @@ -4202,7 +4453,7 @@ static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcClient_4 return __pyx_r; } -/* "cereal/visionipc/visionipc_pyx.pyx":90 +/* "cereal/visionipc/visionipc_pyx.pyx":98 * return dat * * def connect(self, bool blocking): # <<<<<<<<<<<<<< @@ -4221,7 +4472,7 @@ static PyObject *__pyx_pw_6cereal_9visionipc_13visionipc_pyx_15VisionIpcClient_7 __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("connect (wrapper)", 0); assert(__pyx_arg_blocking); { - __pyx_v_blocking = __Pyx_PyObject_IsTrue(__pyx_arg_blocking); if (unlikely((__pyx_v_blocking == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(1, 90, __pyx_L3_error) + __pyx_v_blocking = __Pyx_PyObject_IsTrue(__pyx_arg_blocking); if (unlikely((__pyx_v_blocking == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(1, 98, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -4245,7 +4496,7 @@ static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcClient_6 int __pyx_clineno = 0; __Pyx_RefNannySetupContext("connect", 0); - /* "cereal/visionipc/visionipc_pyx.pyx":91 + /* "cereal/visionipc/visionipc_pyx.pyx":99 * * def connect(self, bool blocking): * return self.client.connect(blocking) # <<<<<<<<<<<<<< @@ -4253,13 +4504,13 @@ static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcClient_6 * def is_connected(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->client->connect(__pyx_v_blocking)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 91, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->client->connect(__pyx_v_blocking)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 99, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "cereal/visionipc/visionipc_pyx.pyx":90 + /* "cereal/visionipc/visionipc_pyx.pyx":98 * return dat * * def connect(self, bool blocking): # <<<<<<<<<<<<<< @@ -4278,7 +4529,7 @@ static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcClient_6 return __pyx_r; } -/* "cereal/visionipc/visionipc_pyx.pyx":93 +/* "cereal/visionipc/visionipc_pyx.pyx":101 * return self.client.connect(blocking) * * def is_connected(self): # <<<<<<<<<<<<<< @@ -4307,19 +4558,19 @@ static PyObject *__pyx_pf_6cereal_9visionipc_13visionipc_pyx_15VisionIpcClient_8 int __pyx_clineno = 0; __Pyx_RefNannySetupContext("is_connected", 0); - /* "cereal/visionipc/visionipc_pyx.pyx":94 + /* "cereal/visionipc/visionipc_pyx.pyx":102 * * def is_connected(self): * return self.client.is_connected() # <<<<<<<<<<<<<< */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->client->is_connected()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 94, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->client->is_connected()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 102, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "cereal/visionipc/visionipc_pyx.pyx":93 + /* "cereal/visionipc/visionipc_pyx.pyx":101 * return self.client.connect(blocking) * * def is_connected(self): # <<<<<<<<<<<<<< @@ -20130,7 +20381,7 @@ static void __pyx_tp_dealloc_6cereal_9visionipc_13visionipc_pyx_VisionIpcServer( PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1); - __pyx_pw_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_9__dealloc__(o); + __pyx_pw_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_11__dealloc__(o); __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); PyErr_Restore(etype, eval, etb); } @@ -20139,10 +20390,11 @@ static void __pyx_tp_dealloc_6cereal_9visionipc_13visionipc_pyx_VisionIpcServer( static PyMethodDef __pyx_methods_6cereal_9visionipc_13visionipc_pyx_VisionIpcServer[] = { {"create_buffers", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_3create_buffers, METH_VARARGS|METH_KEYWORDS, 0}, - {"send", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_5send, METH_VARARGS|METH_KEYWORDS, 0}, - {"start_listener", (PyCFunction)__pyx_pw_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_7start_listener, METH_NOARGS, 0}, - {"__reduce_cython__", (PyCFunction)__pyx_pw_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_11__reduce_cython__, METH_NOARGS, 0}, - {"__setstate_cython__", (PyCFunction)__pyx_pw_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_13__setstate_cython__, METH_O, 0}, + {"create_buffers_with_sizes", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_5create_buffers_with_sizes, METH_VARARGS|METH_KEYWORDS, 0}, + {"send", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_7send, METH_VARARGS|METH_KEYWORDS, 0}, + {"start_listener", (PyCFunction)__pyx_pw_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_9start_listener, METH_NOARGS, 0}, + {"__reduce_cython__", (PyCFunction)__pyx_pw_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_13__reduce_cython__, METH_NOARGS, 0}, + {"__setstate_cython__", (PyCFunction)__pyx_pw_6cereal_9visionipc_13visionipc_pyx_15VisionIpcServer_15__setstate_cython__, METH_O, 0}, {0, 0, 0, 0} }; @@ -20262,6 +20514,10 @@ static PyObject *__pyx_getprop_6cereal_9visionipc_13visionipc_pyx_15VisionIpcCli return __pyx_pw_6cereal_9visionipc_13visionipc_pyx_15VisionIpcClient_6stride_1__get__(o); } +static PyObject *__pyx_getprop_6cereal_9visionipc_13visionipc_pyx_15VisionIpcClient_uv_offset(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_6cereal_9visionipc_13visionipc_pyx_15VisionIpcClient_9uv_offset_1__get__(o); +} + static PyMethodDef __pyx_methods_6cereal_9visionipc_13visionipc_pyx_VisionIpcClient[] = { {"recv", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cereal_9visionipc_13visionipc_pyx_15VisionIpcClient_5recv, METH_VARARGS|METH_KEYWORDS, 0}, {"connect", (PyCFunction)__pyx_pw_6cereal_9visionipc_13visionipc_pyx_15VisionIpcClient_7connect, METH_O, 0}, @@ -20275,6 +20531,7 @@ static struct PyGetSetDef __pyx_getsets_6cereal_9visionipc_13visionipc_pyx_Visio {(char *)"width", __pyx_getprop_6cereal_9visionipc_13visionipc_pyx_15VisionIpcClient_width, 0, (char *)0, 0}, {(char *)"height", __pyx_getprop_6cereal_9visionipc_13visionipc_pyx_15VisionIpcClient_height, 0, (char *)0, 0}, {(char *)"stride", __pyx_getprop_6cereal_9visionipc_13visionipc_pyx_15VisionIpcClient_stride, 0, (char *)0, 0}, + {(char *)"uv_offset", __pyx_getprop_6cereal_9visionipc_13visionipc_pyx_15VisionIpcClient_uv_offset, 0, (char *)0, 0}, {0, 0, 0, 0, 0} }; @@ -21288,8 +21545,8 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_s_Unable_to_convert_item_to_object, __pyx_k_Unable_to_convert_item_to_object, sizeof(__pyx_k_Unable_to_convert_item_to_object), 0, 0, 1, 0}, {&__pyx_kp_s_Unknown_enum_value_s, __pyx_k_Unknown_enum_value_s, sizeof(__pyx_k_Unknown_enum_value_s), 0, 0, 1, 0}, {&__pyx_n_s_VISION_STREAM_DRIVER, __pyx_k_VISION_STREAM_DRIVER, sizeof(__pyx_k_VISION_STREAM_DRIVER), 0, 0, 1, 1}, + {&__pyx_n_s_VISION_STREAM_MAP, __pyx_k_VISION_STREAM_MAP, sizeof(__pyx_k_VISION_STREAM_MAP), 0, 0, 1, 1}, {&__pyx_n_s_VISION_STREAM_RGB_DRIVER, __pyx_k_VISION_STREAM_RGB_DRIVER, sizeof(__pyx_k_VISION_STREAM_RGB_DRIVER), 0, 0, 1, 1}, - {&__pyx_n_s_VISION_STREAM_RGB_MAP, __pyx_k_VISION_STREAM_RGB_MAP, sizeof(__pyx_k_VISION_STREAM_RGB_MAP), 0, 0, 1, 1}, {&__pyx_n_s_VISION_STREAM_RGB_ROAD, __pyx_k_VISION_STREAM_RGB_ROAD, sizeof(__pyx_k_VISION_STREAM_RGB_ROAD), 0, 0, 1, 1}, {&__pyx_n_s_VISION_STREAM_RGB_WIDE_ROAD, __pyx_k_VISION_STREAM_RGB_WIDE_ROAD, sizeof(__pyx_k_VISION_STREAM_RGB_WIDE_ROAD), 0, 0, 1, 1}, {&__pyx_n_s_VISION_STREAM_ROAD, __pyx_k_VISION_STREAM_ROAD, sizeof(__pyx_k_VISION_STREAM_ROAD), 0, 0, 1, 1}, @@ -21385,6 +21642,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_stop, __pyx_k_stop, sizeof(__pyx_k_stop), 0, 0, 1, 1}, {&__pyx_n_s_str, __pyx_k_str, sizeof(__pyx_k_str), 0, 0, 1, 1}, {&__pyx_n_s_stream, __pyx_k_stream, sizeof(__pyx_k_stream), 0, 0, 1, 1}, + {&__pyx_n_s_stride, __pyx_k_stride, sizeof(__pyx_k_stride), 0, 0, 1, 1}, {&__pyx_kp_s_strided_and_direct, __pyx_k_strided_and_direct, sizeof(__pyx_k_strided_and_direct), 0, 0, 1, 0}, {&__pyx_kp_s_strided_and_direct_or_indirect, __pyx_k_strided_and_direct_or_indirect, sizeof(__pyx_k_strided_and_direct_or_indirect), 0, 0, 1, 0}, {&__pyx_kp_s_strided_and_indirect, __pyx_k_strided_and_indirect, sizeof(__pyx_k_strided_and_indirect), 0, 0, 1, 0}, @@ -21401,6 +21659,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_s_unable_to_allocate_shape_and_str, __pyx_k_unable_to_allocate_shape_and_str, sizeof(__pyx_k_unable_to_allocate_shape_and_str), 0, 0, 1, 0}, {&__pyx_n_s_unpack, __pyx_k_unpack, sizeof(__pyx_k_unpack), 0, 0, 1, 1}, {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1}, + {&__pyx_n_s_uv_offset, __pyx_k_uv_offset, sizeof(__pyx_k_uv_offset), 0, 0, 1, 1}, {&__pyx_n_s_v, __pyx_k_v, sizeof(__pyx_k_v), 0, 0, 1, 1}, {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1}, {&__pyx_n_s_values, __pyx_k_values, sizeof(__pyx_k_values), 0, 0, 1, 1}, @@ -21867,15 +22126,15 @@ static int __Pyx_modinit_type_init_code(void) { if (PyObject_SetAttr(__pyx_m, __pyx_n_s_VisionIpcServer, (PyObject *)&__pyx_type_6cereal_9visionipc_13visionipc_pyx_VisionIpcServer) < 0) __PYX_ERR(1, 28, __pyx_L1_error) if (__Pyx_setup_reduce((PyObject*)&__pyx_type_6cereal_9visionipc_13visionipc_pyx_VisionIpcServer) < 0) __PYX_ERR(1, 28, __pyx_L1_error) __pyx_ptype_6cereal_9visionipc_13visionipc_pyx_VisionIpcServer = &__pyx_type_6cereal_9visionipc_13visionipc_pyx_VisionIpcServer; - if (PyType_Ready(&__pyx_type_6cereal_9visionipc_13visionipc_pyx_VisionIpcClient) < 0) __PYX_ERR(1, 58, __pyx_L1_error) + if (PyType_Ready(&__pyx_type_6cereal_9visionipc_13visionipc_pyx_VisionIpcClient) < 0) __PYX_ERR(1, 62, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 __pyx_type_6cereal_9visionipc_13visionipc_pyx_VisionIpcClient.tp_print = 0; #endif if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6cereal_9visionipc_13visionipc_pyx_VisionIpcClient.tp_dictoffset && __pyx_type_6cereal_9visionipc_13visionipc_pyx_VisionIpcClient.tp_getattro == PyObject_GenericGetAttr)) { __pyx_type_6cereal_9visionipc_13visionipc_pyx_VisionIpcClient.tp_getattro = __Pyx_PyObject_GenericGetAttr; } - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_VisionIpcClient, (PyObject *)&__pyx_type_6cereal_9visionipc_13visionipc_pyx_VisionIpcClient) < 0) __PYX_ERR(1, 58, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject*)&__pyx_type_6cereal_9visionipc_13visionipc_pyx_VisionIpcClient) < 0) __PYX_ERR(1, 58, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_VisionIpcClient, (PyObject *)&__pyx_type_6cereal_9visionipc_13visionipc_pyx_VisionIpcClient) < 0) __PYX_ERR(1, 62, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject*)&__pyx_type_6cereal_9visionipc_13visionipc_pyx_VisionIpcClient) < 0) __PYX_ERR(1, 62, __pyx_L1_error) __pyx_ptype_6cereal_9visionipc_13visionipc_pyx_VisionIpcClient = &__pyx_type_6cereal_9visionipc_13visionipc_pyx_VisionIpcClient; __Pyx_EnumMeta.tp_base = (&PyType_Type); if (PyType_Ready(&__Pyx_EnumMeta) < 0) __PYX_ERR(0, 15, __pyx_L1_error) @@ -22702,7 +22961,7 @@ if (!__Pyx_RefNanny) { * ('VISION_STREAM_ROAD', VISION_STREAM_ROAD), * ('VISION_STREAM_DRIVER', VISION_STREAM_DRIVER), # <<<<<<<<<<<<<< * ('VISION_STREAM_WIDE_ROAD', VISION_STREAM_WIDE_ROAD), - * ('VISION_STREAM_RGB_MAP', VISION_STREAM_RGB_MAP), + * ('VISION_STREAM_MAP', VISION_STREAM_MAP), */ __pyx_t_1 = __Pyx_PyInt_From_enum____pyx_t_6cereal_9visionipc_13visionipc_pyx_VisionStreamType(__pyx_e_6cereal_9visionipc_13visionipc_pyx_VISION_STREAM_DRIVER); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); @@ -22719,7 +22978,7 @@ if (!__Pyx_RefNanny) { * ('VISION_STREAM_ROAD', VISION_STREAM_ROAD), * ('VISION_STREAM_DRIVER', VISION_STREAM_DRIVER), * ('VISION_STREAM_WIDE_ROAD', VISION_STREAM_WIDE_ROAD), # <<<<<<<<<<<<<< - * ('VISION_STREAM_RGB_MAP', VISION_STREAM_RGB_MAP), + * ('VISION_STREAM_MAP', VISION_STREAM_MAP), * ])) */ __pyx_t_1 = __Pyx_PyInt_From_enum____pyx_t_6cereal_9visionipc_13visionipc_pyx_VisionStreamType(__pyx_e_6cereal_9visionipc_13visionipc_pyx_VISION_STREAM_WIDE_ROAD); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 59, __pyx_L1_error) @@ -22736,17 +22995,17 @@ if (!__Pyx_RefNanny) { /* "EnumType":60 * ('VISION_STREAM_DRIVER', VISION_STREAM_DRIVER), * ('VISION_STREAM_WIDE_ROAD', VISION_STREAM_WIDE_ROAD), - * ('VISION_STREAM_RGB_MAP', VISION_STREAM_RGB_MAP), # <<<<<<<<<<<<<< + * ('VISION_STREAM_MAP', VISION_STREAM_MAP), # <<<<<<<<<<<<<< * ])) * __Pyx_globals['VISION_STREAM_RGB_ROAD'] = VisionStreamType.VISION_STREAM_RGB_ROAD */ - __pyx_t_1 = __Pyx_PyInt_From_enum____pyx_t_6cereal_9visionipc_13visionipc_pyx_VisionStreamType(__pyx_e_6cereal_9visionipc_13visionipc_pyx_VISION_STREAM_RGB_MAP); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 60, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_enum____pyx_t_6cereal_9visionipc_13visionipc_pyx_VisionStreamType(__pyx_e_6cereal_9visionipc_13visionipc_pyx_VISION_STREAM_MAP); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); - __Pyx_INCREF(__pyx_n_s_VISION_STREAM_RGB_MAP); - __Pyx_GIVEREF(__pyx_n_s_VISION_STREAM_RGB_MAP); - PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_n_s_VISION_STREAM_RGB_MAP); + __Pyx_INCREF(__pyx_n_s_VISION_STREAM_MAP); + __Pyx_GIVEREF(__pyx_n_s_VISION_STREAM_MAP); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_n_s_VISION_STREAM_MAP); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_1); __pyx_t_1 = 0; @@ -22799,7 +23058,7 @@ if (!__Pyx_RefNanny) { __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; /* "EnumType":62 - * ('VISION_STREAM_RGB_MAP', VISION_STREAM_RGB_MAP), + * ('VISION_STREAM_MAP', VISION_STREAM_MAP), * ])) * __Pyx_globals['VISION_STREAM_RGB_ROAD'] = VisionStreamType.VISION_STREAM_RGB_ROAD # <<<<<<<<<<<<<< * __Pyx_globals['VISION_STREAM_RGB_DRIVER'] = VisionStreamType.VISION_STREAM_RGB_DRIVER @@ -22879,7 +23138,7 @@ if (!__Pyx_RefNanny) { * __Pyx_globals['VISION_STREAM_ROAD'] = VisionStreamType.VISION_STREAM_ROAD * __Pyx_globals['VISION_STREAM_DRIVER'] = VisionStreamType.VISION_STREAM_DRIVER # <<<<<<<<<<<<<< * __Pyx_globals['VISION_STREAM_WIDE_ROAD'] = VisionStreamType.VISION_STREAM_WIDE_ROAD - * __Pyx_globals['VISION_STREAM_RGB_MAP'] = VisionStreamType.VISION_STREAM_RGB_MAP + * __Pyx_globals['VISION_STREAM_MAP'] = VisionStreamType.VISION_STREAM_MAP */ __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_VisionStreamType); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 66, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); @@ -22897,7 +23156,7 @@ if (!__Pyx_RefNanny) { * __Pyx_globals['VISION_STREAM_ROAD'] = VisionStreamType.VISION_STREAM_ROAD * __Pyx_globals['VISION_STREAM_DRIVER'] = VisionStreamType.VISION_STREAM_DRIVER * __Pyx_globals['VISION_STREAM_WIDE_ROAD'] = VisionStreamType.VISION_STREAM_WIDE_ROAD # <<<<<<<<<<<<<< - * __Pyx_globals['VISION_STREAM_RGB_MAP'] = VisionStreamType.VISION_STREAM_RGB_MAP + * __Pyx_globals['VISION_STREAM_MAP'] = VisionStreamType.VISION_STREAM_MAP * else: */ __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_VisionStreamType); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 67, __pyx_L1_error) @@ -22915,20 +23174,20 @@ if (!__Pyx_RefNanny) { /* "EnumType":68 * __Pyx_globals['VISION_STREAM_DRIVER'] = VisionStreamType.VISION_STREAM_DRIVER * __Pyx_globals['VISION_STREAM_WIDE_ROAD'] = VisionStreamType.VISION_STREAM_WIDE_ROAD - * __Pyx_globals['VISION_STREAM_RGB_MAP'] = VisionStreamType.VISION_STREAM_RGB_MAP # <<<<<<<<<<<<<< + * __Pyx_globals['VISION_STREAM_MAP'] = VisionStreamType.VISION_STREAM_MAP # <<<<<<<<<<<<<< * else: * class VisionStreamType(__Pyx_EnumBase): */ __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_VisionStreamType); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 68, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_VISION_STREAM_RGB_MAP); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 68, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_VISION_STREAM_MAP); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 68, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; if (unlikely(__Pyx_globals == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 68, __pyx_L1_error) } - if (unlikely(PyDict_SetItem(__Pyx_globals, __pyx_n_s_VISION_STREAM_RGB_MAP, __pyx_t_1) < 0)) __PYX_ERR(0, 68, __pyx_L1_error) + if (unlikely(PyDict_SetItem(__Pyx_globals, __pyx_n_s_VISION_STREAM_MAP, __pyx_t_1) < 0)) __PYX_ERR(0, 68, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "EnumType":51 @@ -22942,7 +23201,7 @@ if (!__Pyx_RefNanny) { } /* "EnumType":70 - * __Pyx_globals['VISION_STREAM_RGB_MAP'] = VisionStreamType.VISION_STREAM_RGB_MAP + * __Pyx_globals['VISION_STREAM_MAP'] = VisionStreamType.VISION_STREAM_MAP * else: * class VisionStreamType(__Pyx_EnumBase): # <<<<<<<<<<<<<< * pass @@ -23091,7 +23350,7 @@ if (!__Pyx_RefNanny) { * __Pyx_globals['VISION_STREAM_ROAD'] = VisionStreamType(VISION_STREAM_ROAD, 'VISION_STREAM_ROAD') * __Pyx_globals['VISION_STREAM_DRIVER'] = VisionStreamType(VISION_STREAM_DRIVER, 'VISION_STREAM_DRIVER') # <<<<<<<<<<<<<< * __Pyx_globals['VISION_STREAM_WIDE_ROAD'] = VisionStreamType(VISION_STREAM_WIDE_ROAD, 'VISION_STREAM_WIDE_ROAD') - * __Pyx_globals['VISION_STREAM_RGB_MAP'] = VisionStreamType(VISION_STREAM_RGB_MAP, 'VISION_STREAM_RGB_MAP') + * __Pyx_globals['VISION_STREAM_MAP'] = VisionStreamType(VISION_STREAM_MAP, 'VISION_STREAM_MAP') */ __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_VisionStreamType); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 76, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); @@ -23120,7 +23379,7 @@ if (!__Pyx_RefNanny) { * __Pyx_globals['VISION_STREAM_ROAD'] = VisionStreamType(VISION_STREAM_ROAD, 'VISION_STREAM_ROAD') * __Pyx_globals['VISION_STREAM_DRIVER'] = VisionStreamType(VISION_STREAM_DRIVER, 'VISION_STREAM_DRIVER') * __Pyx_globals['VISION_STREAM_WIDE_ROAD'] = VisionStreamType(VISION_STREAM_WIDE_ROAD, 'VISION_STREAM_WIDE_ROAD') # <<<<<<<<<<<<<< - * __Pyx_globals['VISION_STREAM_RGB_MAP'] = VisionStreamType(VISION_STREAM_RGB_MAP, 'VISION_STREAM_RGB_MAP') + * __Pyx_globals['VISION_STREAM_MAP'] = VisionStreamType(VISION_STREAM_MAP, 'VISION_STREAM_MAP') * */ __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_VisionStreamType); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 77, __pyx_L1_error) @@ -23149,20 +23408,20 @@ if (!__Pyx_RefNanny) { /* "EnumType":78 * __Pyx_globals['VISION_STREAM_DRIVER'] = VisionStreamType(VISION_STREAM_DRIVER, 'VISION_STREAM_DRIVER') * __Pyx_globals['VISION_STREAM_WIDE_ROAD'] = VisionStreamType(VISION_STREAM_WIDE_ROAD, 'VISION_STREAM_WIDE_ROAD') - * __Pyx_globals['VISION_STREAM_RGB_MAP'] = VisionStreamType(VISION_STREAM_RGB_MAP, 'VISION_STREAM_RGB_MAP') # <<<<<<<<<<<<<< + * __Pyx_globals['VISION_STREAM_MAP'] = VisionStreamType(VISION_STREAM_MAP, 'VISION_STREAM_MAP') # <<<<<<<<<<<<<< * */ __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_VisionStreamType); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 78, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = __Pyx_PyInt_From_enum____pyx_t_6cereal_9visionipc_13visionipc_pyx_VisionStreamType(__pyx_e_6cereal_9visionipc_13visionipc_pyx_VISION_STREAM_RGB_MAP); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 78, __pyx_L1_error) + __pyx_t_10 = __Pyx_PyInt_From_enum____pyx_t_6cereal_9visionipc_13visionipc_pyx_VisionStreamType(__pyx_e_6cereal_9visionipc_13visionipc_pyx_VISION_STREAM_MAP); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 78, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 78, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_10); - __Pyx_INCREF(__pyx_n_s_VISION_STREAM_RGB_MAP); - __Pyx_GIVEREF(__pyx_n_s_VISION_STREAM_RGB_MAP); - PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_n_s_VISION_STREAM_RGB_MAP); + __Pyx_INCREF(__pyx_n_s_VISION_STREAM_MAP); + __Pyx_GIVEREF(__pyx_n_s_VISION_STREAM_MAP); + PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_n_s_VISION_STREAM_MAP); __pyx_t_10 = 0; __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 78, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); @@ -23172,7 +23431,7 @@ if (!__Pyx_RefNanny) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 78, __pyx_L1_error) } - if (unlikely(PyDict_SetItem(__Pyx_globals, __pyx_n_s_VISION_STREAM_RGB_MAP, __pyx_t_10) < 0)) __PYX_ERR(0, 78, __pyx_L1_error) + if (unlikely(PyDict_SetItem(__Pyx_globals, __pyx_n_s_VISION_STREAM_MAP, __pyx_t_10) < 0)) __PYX_ERR(0, 78, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; } __pyx_L4:; diff --git a/cereal/visionipc/visionipc_pyx.so b/cereal/visionipc/visionipc_pyx.so index 9cd0c31f5..e8785c0da 100755 Binary files a/cereal/visionipc/visionipc_pyx.so and b/cereal/visionipc/visionipc_pyx.so differ diff --git a/cereal/visionipc/visionipc_server.h b/cereal/visionipc/visionipc_server.h index 01409f78d..4c23ff6f0 100644 --- a/cereal/visionipc/visionipc_server.h +++ b/cereal/visionipc/visionipc_server.h @@ -5,9 +5,9 @@ #include #include -#include "messaging/messaging.h" -#include "visionipc/visionipc.h" -#include "visionipc/visionbuf.h" +#include "cereal/messaging/messaging.h" +#include "cereal/visionipc/visionipc.h" +#include "cereal/visionipc/visionbuf.h" std::string get_endpoint_name(std::string name, VisionStreamType type); @@ -37,6 +37,7 @@ class VisionIpcServer { VisionBuf * get_buffer(VisionStreamType type); void create_buffers(VisionStreamType type, size_t num_buffers, bool rgb, size_t width, size_t height); + void create_buffers_with_sizes(VisionStreamType type, size_t num_buffers, bool rgb, size_t width, size_t height, size_t size, size_t stride, size_t uv_offset); void send(VisionBuf * buf, VisionIpcBufExtra * extra, bool sync=true); void start_listener(); }; diff --git a/common/clock.cpp b/common/clock.cpp index 887714eb4..c2a5b2412 100644 --- a/common/clock.cpp +++ b/common/clock.cpp @@ -1,4 +1,4 @@ -/* Generated by Cython 0.29.24 */ +/* Generated by Cython 0.29.26 */ /* BEGIN: Cython Metadata { @@ -23,8 +23,8 @@ END: Cython Metadata */ #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) #error Cython requires Python 2.6+ or Python 3.3+. #else -#define CYTHON_ABI "0_29_24" -#define CYTHON_HEX_VERSION 0x001D18F0 +#define CYTHON_ABI "0_29_26" +#define CYTHON_HEX_VERSION 0x001D1AF0 #define CYTHON_FUTURE_DIVISION 1 #include #ifndef offsetof @@ -171,7 +171,7 @@ END: Cython Metadata */ #ifndef CYTHON_USE_UNICODE_INTERNALS #define CYTHON_USE_UNICODE_INTERNALS 1 #endif - #if PY_VERSION_HEX < 0x030300F0 + #if PY_VERSION_HEX < 0x030300F0 || PY_VERSION_HEX >= 0x030B00A2 #undef CYTHON_USE_UNICODE_WRITER #define CYTHON_USE_UNICODE_WRITER 0 #elif !defined(CYTHON_USE_UNICODE_WRITER) @@ -190,7 +190,7 @@ END: Cython Metadata */ #define CYTHON_FAST_THREAD_STATE 1 #endif #ifndef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 1 + #define CYTHON_FAST_PYCALL (PY_VERSION_HEX < 0x030B00A1) #endif #ifndef CYTHON_PEP489_MULTI_PHASE_INIT #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000) @@ -209,7 +209,9 @@ END: Cython Metadata */ #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) #endif #if CYTHON_USE_PYLONG_INTERNALS - #include "longintrepr.h" + #if PY_MAJOR_VERSION < 3 + #include "longintrepr.h" + #endif #undef SHIFT #undef BASE #undef MASK @@ -340,9 +342,68 @@ class __Pyx_FakeReference { #define __Pyx_DefaultClassType PyClass_Type #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" -#if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2 - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) + #define __Pyx_DefaultClassType PyType_Type +#if PY_VERSION_HEX >= 0x030B00A1 + static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int k, int l, int s, int f, + PyObject *code, PyObject *c, PyObject* n, PyObject *v, + PyObject *fv, PyObject *cell, PyObject* fn, + PyObject *name, int fline, PyObject *lnos) { + PyObject *kwds=NULL, *argcount=NULL, *posonlyargcount=NULL, *kwonlyargcount=NULL; + PyObject *nlocals=NULL, *stacksize=NULL, *flags=NULL, *replace=NULL, *call_result=NULL, *empty=NULL; + const char *fn_cstr=NULL; + const char *name_cstr=NULL; + PyCodeObject* co=NULL; + PyObject *type, *value, *traceback; + PyErr_Fetch(&type, &value, &traceback); + if (!(kwds=PyDict_New())) goto end; + if (!(argcount=PyLong_FromLong(a))) goto end; + if (PyDict_SetItemString(kwds, "co_argcount", argcount) != 0) goto end; + if (!(posonlyargcount=PyLong_FromLong(0))) goto end; + if (PyDict_SetItemString(kwds, "co_posonlyargcount", posonlyargcount) != 0) goto end; + if (!(kwonlyargcount=PyLong_FromLong(k))) goto end; + if (PyDict_SetItemString(kwds, "co_kwonlyargcount", kwonlyargcount) != 0) goto end; + if (!(nlocals=PyLong_FromLong(l))) goto end; + if (PyDict_SetItemString(kwds, "co_nlocals", nlocals) != 0) goto end; + if (!(stacksize=PyLong_FromLong(s))) goto end; + if (PyDict_SetItemString(kwds, "co_stacksize", stacksize) != 0) goto end; + if (!(flags=PyLong_FromLong(f))) goto end; + if (PyDict_SetItemString(kwds, "co_flags", flags) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_code", code) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_consts", c) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_names", n) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_varnames", v) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_freevars", fv) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_cellvars", cell) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_linetable", lnos) != 0) goto end; + if (!(fn_cstr=PyUnicode_AsUTF8AndSize(fn, NULL))) goto end; + if (!(name_cstr=PyUnicode_AsUTF8AndSize(name, NULL))) goto end; + if (!(co = PyCode_NewEmpty(fn_cstr, name_cstr, fline))) goto end; + if (!(replace = PyObject_GetAttrString((PyObject*)co, "replace"))) goto cleanup_code_too; + if (!(empty = PyTuple_New(0))) goto cleanup_code_too; // unfortunately __pyx_empty_tuple isn't available here + if (!(call_result = PyObject_Call(replace, empty, kwds))) goto cleanup_code_too; + Py_XDECREF((PyObject*)co); + co = (PyCodeObject*)call_result; + call_result = NULL; + if (0) { + cleanup_code_too: + Py_XDECREF((PyObject*)co); + co = NULL; + } + end: + Py_XDECREF(kwds); + Py_XDECREF(argcount); + Py_XDECREF(posonlyargcount); + Py_XDECREF(kwonlyargcount); + Py_XDECREF(nlocals); + Py_XDECREF(stacksize); + Py_XDECREF(replace); + Py_XDECREF(call_result); + Py_XDECREF(empty); + if (type) { + PyErr_Restore(type, value, traceback); + } + return co; + } #else #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) @@ -580,10 +641,10 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #if PY_VERSION_HEX < 0x030200A4 typedef long Py_hash_t; #define __Pyx_PyInt_FromHash_t PyInt_FromLong - #define __Pyx_PyInt_AsHash_t PyInt_AsLong + #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsHash_t #else #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t - #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t + #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t #endif #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func)) @@ -742,6 +803,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj)) static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*); #if CYTHON_ASSUME_SAFE_MACROS #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) #else @@ -1802,7 +1864,7 @@ static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int } if (!use_cline) { c_line = 0; - PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); + (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); } else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) { c_line = 0; @@ -1899,30 +1961,31 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( const char *funcname, int c_line, int py_line, const char *filename) { - PyCodeObject *py_code = 0; - PyObject *py_srcfile = 0; - PyObject *py_funcname = 0; + PyCodeObject *py_code = NULL; + PyObject *py_funcname = NULL; #if PY_MAJOR_VERSION < 3 + PyObject *py_srcfile = NULL; py_srcfile = PyString_FromString(filename); - #else - py_srcfile = PyUnicode_FromString(filename); - #endif if (!py_srcfile) goto bad; + #endif if (c_line) { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + if (!py_funcname) goto bad; #else py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + if (!py_funcname) goto bad; + funcname = PyUnicode_AsUTF8(py_funcname); + if (!funcname) goto bad; #endif } else { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromString(funcname); - #else - py_funcname = PyUnicode_FromString(funcname); + if (!py_funcname) goto bad; #endif } - if (!py_funcname) goto bad; + #if PY_MAJOR_VERSION < 3 py_code = __Pyx_PyCode_New( 0, 0, @@ -1941,11 +2004,16 @@ static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( __pyx_empty_bytes /*PyObject *lnotab*/ ); Py_DECREF(py_srcfile); - Py_DECREF(py_funcname); + #else + py_code = PyCode_NewEmpty(filename, funcname, py_line); + #endif + Py_XDECREF(py_funcname); // XDECREF since it's only set on Py3 if cline return py_code; bad: - Py_XDECREF(py_srcfile); Py_XDECREF(py_funcname); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(py_srcfile); + #endif return NULL; } static void __Pyx_AddTraceback(const char *funcname, int c_line, @@ -2793,6 +2861,23 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_DECREF(x); return ival; } +static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) { + if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) { + return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o); +#if PY_MAJOR_VERSION < 3 + } else if (likely(PyInt_CheckExact(o))) { + return PyInt_AS_LONG(o); +#endif + } else { + Py_ssize_t ival; + PyObject *x; + x = PyNumber_Index(o); + if (!x) return -1; + ival = PyInt_AsLong(x); + Py_DECREF(x); + return ival; + } +} static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) { return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False); } diff --git a/common/clock.so b/common/clock.so index 849db7ad2..93fbdf0cb 100755 Binary files a/common/clock.so and b/common/clock.so differ diff --git a/common/dp_conf.py b/common/dp_conf.py index e77097105..8f97c1bcd 100644 --- a/common/dp_conf.py +++ b/common/dp_conf.py @@ -24,7 +24,7 @@ confs = [ {'name': 'dp_jetson', 'default': False, 'type': 'Bool', 'conf_type': ['param']}, # nav service - {'name': 'dp_nav', 'default': True, 'type': 'Bool', 'conf_type': ['param']}, + {'name': 'dp_nav', 'default': True if TICI else False, 'type': 'Bool', 'conf_type': ['param']}, {'name': 'dp_otisserv', 'default': False, 'type': 'Bool', 'conf_type': ['param']}, {'name': 'dp_nav_mapbox_token_pk', 'default': '', 'type': 'Text', 'conf_type': ['param']}, {'name': 'dp_nav_mapbox_token_sk', 'default': '', 'type': 'Text', 'conf_type': ['param']}, @@ -56,22 +56,24 @@ confs = [ {'name': 'dp_lateral_lanelines', 'default': False, 'type': 'Bool', 'conf_type': ['param', 'struct']}, {'name': 'dp_lateral_camera_offset', 'default': 4 if TICI else -6, 'type': 'Int8', 'min': -100, 'max': 100, 'depends': [{'name': 'dp_lateral_lanelines', 'vals': [True]}], 'conf_type': ['param', 'struct']}, {'name': 'dp_lateral_path_offset', 'default': 4 if TICI else 0, 'type': 'Int8', 'min': -100, 'max': 100, 'depends': [{'name': 'dp_lateral_lanelines', 'vals': [True]}], 'conf_type': ['param', 'struct']}, + {'name': 'dp_lateral_road_edge_detected', 'default': False, 'type': 'Bool', 'conf_type': ['param', 'struct']}, #ui {'name': 'dp_ip_addr', 'default': '', 'type': 'Text', 'conf_type': ['struct']}, {'name': 'dp_quiet_drive', 'default': False, 'type': 'Bool', 'conf_type': ['param']}, {'name': 'dp_ui_top', 'default': False, 'type': 'Bool', 'conf_type': ['param', 'struct']}, {'name': 'dp_ui_side', 'default': False, 'type': 'Bool', 'conf_type': ['param', 'struct']}, - {'name': 'dp_ui_volume', 'default': -5, 'type': 'Int8', 'min': -5, 'max': 100, 'conf_type': ['param', 'struct']}, + #{'name': 'dp_ui_volume', 'default': -5, 'type': 'Int8', 'min': -5, 'max': 100, 'conf_type': ['param', 'struct']}, {'name': 'dp_ui_brightness', 'default': 0, 'type': 'UInt8', 'min': 0, 'max': 100, 'conf_type': ['param', 'struct']}, {'name': 'dp_ui_display_mode', 'default': 0, 'type': 'UInt8', 'min': 0, 'max': 1, 'conf_type': ['param', 'struct']}, {'name': 'dp_ui_speed', 'default': True, 'type': 'Bool', 'conf_type': ['param', 'struct']}, - {'name': 'dp_ui_event', 'default': True, 'type': 'Bool', 'conf_type': ['param', 'struct']}, + # {'name': 'dp_ui_event', 'default': True, 'type': 'Bool', 'conf_type': ['param', 'struct']}, {'name': 'dp_ui_face', 'default': True, 'type': 'Bool', 'conf_type': ['param', 'struct']}, {'name': 'dp_ui_lead_info', 'default': True, 'type': 'Bool', 'conf_type': ['param', 'struct']}, {'name': 'dp_ui_laneline', 'default': True, 'type': 'Bool', 'conf_type': ['param', 'struct']}, {'name': 'dp_ui_chevron', 'default': True, 'type': 'Bool', 'conf_type': ['param', 'struct']}, {'name': 'dp_ui_dm_cam', 'default': True, 'type': 'Bool', 'conf_type': ['param', 'struct']}, + {'name': 'dp_ui_rainbow', 'default': False, 'type': 'Bool', 'conf_type': ['param', 'struct']}, #toyota {'name': 'dp_toyota_sng', 'default': False, 'type': 'Bool', 'conf_type': ['param', 'struct']}, @@ -104,7 +106,7 @@ confs = [ # # {'name': 'dp_gpxd', 'default': False, 'type': 'Bool', 'conf_type': ['param']}, {'name': 'dp_hotspot_on_boot', 'default': False, 'type': 'Bool', 'conf_type': ['param']}, {'name': 'dp_honda_eps_mod', 'default': False, 'type': 'Bool', 'conf_type': ['param']}, - {'name': 'dp_dm', 'default': False, 'type': 'Bool', 'conf_type': ['param']}, + {'name': 'dp_dm', 'default': True if not TICI else False, 'type': 'Bool', 'conf_type': ['param']}, {'name': 'dp_speed_check', 'default': True, 'type': 'Bool', 'conf_type': ['param', 'struct']}, {'name': 'dp_temp_check', 'default': True, 'type': 'Bool', 'conf_type': ['param']}, # {'name': 'dp_vag_resume_fix', 'default': False, 'type': 'Bool', 'conf_type': ['param']}, @@ -117,6 +119,12 @@ confs = [ {'name': 'dp_following_profile', 'default': 0, 'type': 'UInt8', 'min': 0, 'max': 2, 'depends': [{'name': 'dp_following_profile_ctrl', 'vals': [True]}], 'conf_type': ['param', 'struct']}, {'name': 'dp_lateral_tune', 'default': 0, 'type': 'UInt8', 'conf_type': ['param']}, {'name': 'dp_lateral_torque_live_tune', 'default': False, 'type': 'Bool', 'conf_type': ['param']}, + {'name': 'dp_lateral_alt', 'default': False, 'type': 'Bool', 'conf_type': ['param', 'struct']}, + {'name': 'dp_lateral_alt_speed', 'default': 80, 'type': 'UInt8', 'min': 10, 'max': 130, 'depends': [{'name': 'dp_lateral_alt', 'vals': [True]}], 'conf_type': ['param', 'struct']}, + {'name': 'dp_lateral_alt_ctrl', 'default': 0, 'type': 'UInt8', 'min': 0, 'max': 3, 'depends': [{'name': 'dp_lateral_alt', 'vals': [True]}], 'conf_type': ['param', 'struct']}, + {'name': 'dp_lateral_alt_lanelines', 'default': False, 'type': 'Bool', 'depends': [{'name': 'dp_lateral_alt', 'vals': [True]}], 'conf_type': ['param', 'struct']}, + {'name': 'dp_lateral_alt_camera_offset', 'default': 4 if TICI else -6, 'type': 'Int8', 'min': -100, 'max': 100, 'depends': [{'name': 'dp_lateral_alt', 'vals': [True]}, {'name': 'dp_lateral_alt_lanelines', 'vals': [True]}], 'conf_type': ['param', 'struct']}, + {'name': 'dp_lateral_alt_path_offset', 'default': 4 if TICI else 0, 'type': 'Int8', 'min': -100, 'max': 100, 'depends': [{'name': 'dp_lateral_alt', 'vals': [True]}, {'name': 'dp_lateral_alt_lanelines', 'vals': [True]}], 'conf_type': ['param', 'struct']}, # {'name': 'dp_accel_profile_ctrl', 'default': False, 'type': 'Bool', 'conf_type': ['param', 'struct']}, # {'name': 'dp_accel_profile', 'default': 0, 'type': 'UInt8', 'min': 0, 'max': 2, 'depends': [{'name': 'dp_accel_profile_ctrl', 'vals': [True]}], 'conf_type': ['param', 'struct']}, # # safety @@ -138,14 +146,15 @@ confs = [ {'name': 'dp_toyota_rav4_tss2_tune', 'default': False, 'type': 'Bool', 'conf_type': ['param']}, {'name': 'dp_toyota_prius_bad_angle_tune', 'default': False, 'type': 'Bool', 'conf_type': ['param']}, {'name': 'dp_e2e_conditional', 'default': False, 'type': 'Bool', 'conf_type': ['param', 'struct']}, - {'name': 'dp_e2e_conditional_at_speed', 'default': 60, 'type': 'UInt8', 'min': 30, 'max': 80, 'depends': [{'name': 'dp_e2e_conditional', 'vals': [True]}], 'conf_type': ['param', 'struct']}, - {'name': 'dp_e2e_conditional_at_speed_lead', 'default': 40, 'type': 'UInt8', 'min': 0, 'max': 80, 'depends': [{'name': 'dp_e2e_conditional', 'vals': [True]}], 'conf_type': ['param', 'struct']}, + #{'name': 'dp_e2e_conditional_at_speed', 'default': 60, 'type': 'UInt8', 'min': 30, 'max': 80, 'depends': [{'name': 'dp_e2e_conditional', 'vals': [True]}], 'conf_type': ['param', 'struct']}, + #{'name': 'dp_e2e_conditional_at_speed_lead', 'default': 40, 'type': 'UInt8', 'min': 0, 'max': 80, 'depends': [{'name': 'dp_e2e_conditional', 'vals': [True]}], 'conf_type': ['param', 'struct']}, {'name': 'dp_e2e_conditional_adapt_fp', 'default': False, 'type': 'Bool', 'depends': [{'name': 'dp_e2e_conditional', 'vals': [True]}], 'conf_type': ['param', 'struct']}, {'name': 'dp_e2e_conditional_adapt_ap', 'default': False, 'type': 'Bool', 'depends': [{'name': 'dp_e2e_conditional', 'vals': [True]}], 'conf_type': ['param', 'struct']}, {'name': 'dp_e2e_conditional_voacc', 'default': False, 'type': 'Bool', 'depends': [{'name': 'dp_e2e_conditional', 'vals': [True]}], 'conf_type': ['param', 'struct']}, # {'name': 'dp_toyota_no_min_acc_limit', 'default': False, 'type': 'Bool', 'conf_type': ['param']}, # {'name': 'dp_toyota_ldw', 'default': True, 'type': 'Bool', 'conf_type': ['param', 'struct']}, {'name': 'dp_toyota_zss', 'default': False, 'type': 'Bool', 'conf_type': ['param']}, + {'name': 'dp_toyota_change5speed', 'default': False, 'type': 'Bool', 'conf_type': ['param']}, # {'name': 'dp_toyota_fp_btn_link', 'default': False, 'type': 'Bool', 'conf_type': ['param']}, # {'name': 'dp_toyota_ap_btn_link', 'default': False, 'type': 'Bool', 'conf_type': ['param']}, # {'name': 'dp_toyota_disable_relay', 'default': False, 'type': 'Bool', 'conf_type': ['param']}, diff --git a/common/kalman/simple_kalman_impl.cpp b/common/kalman/simple_kalman_impl.cpp index 5d5b9ee54..faa41d50f 100644 --- a/common/kalman/simple_kalman_impl.cpp +++ b/common/kalman/simple_kalman_impl.cpp @@ -1,4 +1,4 @@ -/* Generated by Cython 0.29.24 */ +/* Generated by Cython 0.29.26 */ /* BEGIN: Cython Metadata { @@ -22,8 +22,8 @@ END: Cython Metadata */ #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) #error Cython requires Python 2.6+ or Python 3.3+. #else -#define CYTHON_ABI "0_29_24" -#define CYTHON_HEX_VERSION 0x001D18F0 +#define CYTHON_ABI "0_29_26" +#define CYTHON_HEX_VERSION 0x001D1AF0 #define CYTHON_FUTURE_DIVISION 1 #include #ifndef offsetof @@ -170,7 +170,7 @@ END: Cython Metadata */ #ifndef CYTHON_USE_UNICODE_INTERNALS #define CYTHON_USE_UNICODE_INTERNALS 1 #endif - #if PY_VERSION_HEX < 0x030300F0 + #if PY_VERSION_HEX < 0x030300F0 || PY_VERSION_HEX >= 0x030B00A2 #undef CYTHON_USE_UNICODE_WRITER #define CYTHON_USE_UNICODE_WRITER 0 #elif !defined(CYTHON_USE_UNICODE_WRITER) @@ -189,7 +189,7 @@ END: Cython Metadata */ #define CYTHON_FAST_THREAD_STATE 1 #endif #ifndef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 1 + #define CYTHON_FAST_PYCALL (PY_VERSION_HEX < 0x030B00A1) #endif #ifndef CYTHON_PEP489_MULTI_PHASE_INIT #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000) @@ -208,7 +208,9 @@ END: Cython Metadata */ #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) #endif #if CYTHON_USE_PYLONG_INTERNALS - #include "longintrepr.h" + #if PY_MAJOR_VERSION < 3 + #include "longintrepr.h" + #endif #undef SHIFT #undef BASE #undef MASK @@ -339,9 +341,68 @@ class __Pyx_FakeReference { #define __Pyx_DefaultClassType PyClass_Type #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" -#if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2 - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) + #define __Pyx_DefaultClassType PyType_Type +#if PY_VERSION_HEX >= 0x030B00A1 + static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int k, int l, int s, int f, + PyObject *code, PyObject *c, PyObject* n, PyObject *v, + PyObject *fv, PyObject *cell, PyObject* fn, + PyObject *name, int fline, PyObject *lnos) { + PyObject *kwds=NULL, *argcount=NULL, *posonlyargcount=NULL, *kwonlyargcount=NULL; + PyObject *nlocals=NULL, *stacksize=NULL, *flags=NULL, *replace=NULL, *call_result=NULL, *empty=NULL; + const char *fn_cstr=NULL; + const char *name_cstr=NULL; + PyCodeObject* co=NULL; + PyObject *type, *value, *traceback; + PyErr_Fetch(&type, &value, &traceback); + if (!(kwds=PyDict_New())) goto end; + if (!(argcount=PyLong_FromLong(a))) goto end; + if (PyDict_SetItemString(kwds, "co_argcount", argcount) != 0) goto end; + if (!(posonlyargcount=PyLong_FromLong(0))) goto end; + if (PyDict_SetItemString(kwds, "co_posonlyargcount", posonlyargcount) != 0) goto end; + if (!(kwonlyargcount=PyLong_FromLong(k))) goto end; + if (PyDict_SetItemString(kwds, "co_kwonlyargcount", kwonlyargcount) != 0) goto end; + if (!(nlocals=PyLong_FromLong(l))) goto end; + if (PyDict_SetItemString(kwds, "co_nlocals", nlocals) != 0) goto end; + if (!(stacksize=PyLong_FromLong(s))) goto end; + if (PyDict_SetItemString(kwds, "co_stacksize", stacksize) != 0) goto end; + if (!(flags=PyLong_FromLong(f))) goto end; + if (PyDict_SetItemString(kwds, "co_flags", flags) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_code", code) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_consts", c) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_names", n) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_varnames", v) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_freevars", fv) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_cellvars", cell) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_linetable", lnos) != 0) goto end; + if (!(fn_cstr=PyUnicode_AsUTF8AndSize(fn, NULL))) goto end; + if (!(name_cstr=PyUnicode_AsUTF8AndSize(name, NULL))) goto end; + if (!(co = PyCode_NewEmpty(fn_cstr, name_cstr, fline))) goto end; + if (!(replace = PyObject_GetAttrString((PyObject*)co, "replace"))) goto cleanup_code_too; + if (!(empty = PyTuple_New(0))) goto cleanup_code_too; // unfortunately __pyx_empty_tuple isn't available here + if (!(call_result = PyObject_Call(replace, empty, kwds))) goto cleanup_code_too; + Py_XDECREF((PyObject*)co); + co = (PyCodeObject*)call_result; + call_result = NULL; + if (0) { + cleanup_code_too: + Py_XDECREF((PyObject*)co); + co = NULL; + } + end: + Py_XDECREF(kwds); + Py_XDECREF(argcount); + Py_XDECREF(posonlyargcount); + Py_XDECREF(kwonlyargcount); + Py_XDECREF(nlocals); + Py_XDECREF(stacksize); + Py_XDECREF(replace); + Py_XDECREF(call_result); + Py_XDECREF(empty); + if (type) { + PyErr_Restore(type, value, traceback); + } + return co; + } #else #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) @@ -579,10 +640,10 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #if PY_VERSION_HEX < 0x030200A4 typedef long Py_hash_t; #define __Pyx_PyInt_FromHash_t PyInt_FromLong - #define __Pyx_PyInt_AsHash_t PyInt_AsLong + #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsHash_t #else #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t - #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t + #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t #endif #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func)) @@ -738,6 +799,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj)) static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*); #if CYTHON_ASSUME_SAFE_MACROS #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) #else @@ -1116,6 +1178,7 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, #ifndef Py_MEMBER_SIZE #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member) #endif +#if CYTHON_FAST_PYCALL static size_t __pyx_pyframe_localsplus_offset = 0; #include "frameobject.h" #define __Pxy_PyFrame_Initialize_Offsets()\ @@ -1123,6 +1186,7 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus))) #define __Pyx_PyFrame_GetLocalsplus(frame)\ (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset)) +#endif // CYTHON_FAST_PYCALL #endif /* PyObjectCall.proto */ @@ -4329,6 +4393,9 @@ static PyTypeObject __pyx_type_6common_6kalman_18simple_kalman_impl_KF1D = { #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 0, /*tp_print*/ #endif + #if CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM+0 >= 0x06000000 + 0, /*tp_pypy_flags*/ + #endif }; static PyMethodDef __pyx_methods[] = { @@ -5873,7 +5940,7 @@ static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int } if (!use_cline) { c_line = 0; - PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); + (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); } else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) { c_line = 0; @@ -5970,30 +6037,31 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( const char *funcname, int c_line, int py_line, const char *filename) { - PyCodeObject *py_code = 0; - PyObject *py_srcfile = 0; - PyObject *py_funcname = 0; + PyCodeObject *py_code = NULL; + PyObject *py_funcname = NULL; #if PY_MAJOR_VERSION < 3 + PyObject *py_srcfile = NULL; py_srcfile = PyString_FromString(filename); - #else - py_srcfile = PyUnicode_FromString(filename); - #endif if (!py_srcfile) goto bad; + #endif if (c_line) { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + if (!py_funcname) goto bad; #else py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + if (!py_funcname) goto bad; + funcname = PyUnicode_AsUTF8(py_funcname); + if (!funcname) goto bad; #endif } else { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromString(funcname); - #else - py_funcname = PyUnicode_FromString(funcname); + if (!py_funcname) goto bad; #endif } - if (!py_funcname) goto bad; + #if PY_MAJOR_VERSION < 3 py_code = __Pyx_PyCode_New( 0, 0, @@ -6012,11 +6080,16 @@ static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( __pyx_empty_bytes /*PyObject *lnotab*/ ); Py_DECREF(py_srcfile); - Py_DECREF(py_funcname); + #else + py_code = PyCode_NewEmpty(filename, funcname, py_line); + #endif + Py_XDECREF(py_funcname); // XDECREF since it's only set on Py3 if cline return py_code; bad: - Py_XDECREF(py_srcfile); Py_XDECREF(py_funcname); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(py_srcfile); + #endif return NULL; } static void __Pyx_AddTraceback(const char *funcname, int c_line, @@ -6864,6 +6937,23 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_DECREF(x); return ival; } +static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) { + if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) { + return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o); +#if PY_MAJOR_VERSION < 3 + } else if (likely(PyInt_CheckExact(o))) { + return PyInt_AS_LONG(o); +#endif + } else { + Py_ssize_t ival; + PyObject *x; + x = PyNumber_Index(o); + if (!x) return -1; + ival = PyInt_AsLong(x); + Py_DECREF(x); + return ival; + } +} static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) { return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False); } diff --git a/common/kalman/simple_kalman_impl.so b/common/kalman/simple_kalman_impl.so index a6e48593a..4fb04cb93 100755 Binary files a/common/kalman/simple_kalman_impl.so and b/common/kalman/simple_kalman_impl.so differ diff --git a/common/params_pyx.so b/common/params_pyx.so index 5d625b2e6..e1432b80f 100755 Binary files a/common/params_pyx.so and b/common/params_pyx.so differ diff --git a/common/transformations/transformations.cpp b/common/transformations/transformations.cpp index f08fb62f8..4080d4a8b 100644 --- a/common/transformations/transformations.cpp +++ b/common/transformations/transformations.cpp @@ -1,4 +1,4 @@ -/* Generated by Cython 0.29.24 */ +/* Generated by Cython 0.29.26 */ /* BEGIN: Cython Metadata { @@ -32,8 +32,8 @@ END: Cython Metadata */ #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) #error Cython requires Python 2.6+ or Python 3.3+. #else -#define CYTHON_ABI "0_29_24" -#define CYTHON_HEX_VERSION 0x001D18F0 +#define CYTHON_ABI "0_29_26" +#define CYTHON_HEX_VERSION 0x001D1AF0 #define CYTHON_FUTURE_DIVISION 1 #include #ifndef offsetof @@ -180,7 +180,7 @@ END: Cython Metadata */ #ifndef CYTHON_USE_UNICODE_INTERNALS #define CYTHON_USE_UNICODE_INTERNALS 1 #endif - #if PY_VERSION_HEX < 0x030300F0 + #if PY_VERSION_HEX < 0x030300F0 || PY_VERSION_HEX >= 0x030B00A2 #undef CYTHON_USE_UNICODE_WRITER #define CYTHON_USE_UNICODE_WRITER 0 #elif !defined(CYTHON_USE_UNICODE_WRITER) @@ -199,7 +199,7 @@ END: Cython Metadata */ #define CYTHON_FAST_THREAD_STATE 1 #endif #ifndef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 1 + #define CYTHON_FAST_PYCALL (PY_VERSION_HEX < 0x030B00A1) #endif #ifndef CYTHON_PEP489_MULTI_PHASE_INIT #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000) @@ -218,7 +218,9 @@ END: Cython Metadata */ #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) #endif #if CYTHON_USE_PYLONG_INTERNALS - #include "longintrepr.h" + #if PY_MAJOR_VERSION < 3 + #include "longintrepr.h" + #endif #undef SHIFT #undef BASE #undef MASK @@ -349,9 +351,68 @@ class __Pyx_FakeReference { #define __Pyx_DefaultClassType PyClass_Type #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" -#if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2 - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) + #define __Pyx_DefaultClassType PyType_Type +#if PY_VERSION_HEX >= 0x030B00A1 + static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int k, int l, int s, int f, + PyObject *code, PyObject *c, PyObject* n, PyObject *v, + PyObject *fv, PyObject *cell, PyObject* fn, + PyObject *name, int fline, PyObject *lnos) { + PyObject *kwds=NULL, *argcount=NULL, *posonlyargcount=NULL, *kwonlyargcount=NULL; + PyObject *nlocals=NULL, *stacksize=NULL, *flags=NULL, *replace=NULL, *call_result=NULL, *empty=NULL; + const char *fn_cstr=NULL; + const char *name_cstr=NULL; + PyCodeObject* co=NULL; + PyObject *type, *value, *traceback; + PyErr_Fetch(&type, &value, &traceback); + if (!(kwds=PyDict_New())) goto end; + if (!(argcount=PyLong_FromLong(a))) goto end; + if (PyDict_SetItemString(kwds, "co_argcount", argcount) != 0) goto end; + if (!(posonlyargcount=PyLong_FromLong(0))) goto end; + if (PyDict_SetItemString(kwds, "co_posonlyargcount", posonlyargcount) != 0) goto end; + if (!(kwonlyargcount=PyLong_FromLong(k))) goto end; + if (PyDict_SetItemString(kwds, "co_kwonlyargcount", kwonlyargcount) != 0) goto end; + if (!(nlocals=PyLong_FromLong(l))) goto end; + if (PyDict_SetItemString(kwds, "co_nlocals", nlocals) != 0) goto end; + if (!(stacksize=PyLong_FromLong(s))) goto end; + if (PyDict_SetItemString(kwds, "co_stacksize", stacksize) != 0) goto end; + if (!(flags=PyLong_FromLong(f))) goto end; + if (PyDict_SetItemString(kwds, "co_flags", flags) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_code", code) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_consts", c) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_names", n) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_varnames", v) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_freevars", fv) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_cellvars", cell) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_linetable", lnos) != 0) goto end; + if (!(fn_cstr=PyUnicode_AsUTF8AndSize(fn, NULL))) goto end; + if (!(name_cstr=PyUnicode_AsUTF8AndSize(name, NULL))) goto end; + if (!(co = PyCode_NewEmpty(fn_cstr, name_cstr, fline))) goto end; + if (!(replace = PyObject_GetAttrString((PyObject*)co, "replace"))) goto cleanup_code_too; + if (!(empty = PyTuple_New(0))) goto cleanup_code_too; // unfortunately __pyx_empty_tuple isn't available here + if (!(call_result = PyObject_Call(replace, empty, kwds))) goto cleanup_code_too; + Py_XDECREF((PyObject*)co); + co = (PyCodeObject*)call_result; + call_result = NULL; + if (0) { + cleanup_code_too: + Py_XDECREF((PyObject*)co); + co = NULL; + } + end: + Py_XDECREF(kwds); + Py_XDECREF(argcount); + Py_XDECREF(posonlyargcount); + Py_XDECREF(kwonlyargcount); + Py_XDECREF(nlocals); + Py_XDECREF(stacksize); + Py_XDECREF(replace); + Py_XDECREF(call_result); + Py_XDECREF(empty); + if (type) { + PyErr_Restore(type, value, traceback); + } + return co; + } #else #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) @@ -589,10 +650,10 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #if PY_VERSION_HEX < 0x030200A4 typedef long Py_hash_t; #define __Pyx_PyInt_FromHash_t PyInt_FromLong - #define __Pyx_PyInt_AsHash_t PyInt_AsLong + #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsHash_t #else #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t - #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t + #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t #endif #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func)) @@ -762,6 +823,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj)) static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*); #if CYTHON_ASSUME_SAFE_MACROS #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) #else @@ -1345,6 +1407,7 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, #ifndef Py_MEMBER_SIZE #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member) #endif +#if CYTHON_FAST_PYCALL static size_t __pyx_pyframe_localsplus_offset = 0; #include "frameobject.h" #define __Pxy_PyFrame_Initialize_Offsets()\ @@ -1352,6 +1415,7 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus))) #define __Pyx_PyFrame_GetLocalsplus(frame)\ (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset)) +#endif // CYTHON_FAST_PYCALL #endif /* PyObjectCall.proto */ @@ -6278,6 +6342,9 @@ static PyTypeObject __pyx_type_6common_15transformations_15transformations_Local #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 0, /*tp_print*/ #endif + #if CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM+0 >= 0x06000000 + 0, /*tp_pypy_flags*/ + #endif }; static PyMethodDef __pyx_methods[] = { @@ -9042,7 +9109,7 @@ static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int } if (!use_cline) { c_line = 0; - PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); + (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); } else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) { c_line = 0; @@ -9139,30 +9206,31 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( const char *funcname, int c_line, int py_line, const char *filename) { - PyCodeObject *py_code = 0; - PyObject *py_srcfile = 0; - PyObject *py_funcname = 0; + PyCodeObject *py_code = NULL; + PyObject *py_funcname = NULL; #if PY_MAJOR_VERSION < 3 + PyObject *py_srcfile = NULL; py_srcfile = PyString_FromString(filename); - #else - py_srcfile = PyUnicode_FromString(filename); - #endif if (!py_srcfile) goto bad; + #endif if (c_line) { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + if (!py_funcname) goto bad; #else py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + if (!py_funcname) goto bad; + funcname = PyUnicode_AsUTF8(py_funcname); + if (!funcname) goto bad; #endif } else { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromString(funcname); - #else - py_funcname = PyUnicode_FromString(funcname); + if (!py_funcname) goto bad; #endif } - if (!py_funcname) goto bad; + #if PY_MAJOR_VERSION < 3 py_code = __Pyx_PyCode_New( 0, 0, @@ -9181,11 +9249,16 @@ static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( __pyx_empty_bytes /*PyObject *lnotab*/ ); Py_DECREF(py_srcfile); - Py_DECREF(py_funcname); + #else + py_code = PyCode_NewEmpty(filename, funcname, py_line); + #endif + Py_XDECREF(py_funcname); // XDECREF since it's only set on Py3 if cline return py_code; bad: - Py_XDECREF(py_srcfile); Py_XDECREF(py_funcname); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(py_srcfile); + #endif return NULL; } static void __Pyx_AddTraceback(const char *funcname, int c_line, @@ -10361,6 +10434,23 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_DECREF(x); return ival; } +static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) { + if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) { + return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o); +#if PY_MAJOR_VERSION < 3 + } else if (likely(PyInt_CheckExact(o))) { + return PyInt_AS_LONG(o); +#endif + } else { + Py_ssize_t ival; + PyObject *x; + x = PyNumber_Index(o); + if (!x) return -1; + ival = PyInt_AsLong(x); + Py_DECREF(x); + return ival; + } +} static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) { return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False); } diff --git a/common/transformations/transformations.so b/common/transformations/transformations.so index f168bb89b..dd810f7f0 100755 Binary files a/common/transformations/transformations.so and b/common/transformations/transformations.so differ diff --git a/common/version.h b/common/version.h index d323fe454..502c19664 100644 --- a/common/version.h +++ b/common/version.h @@ -1 +1 @@ -#define COMMA_VERSION "2023.02.08" +#define COMMA_VERSION "2023.03.27" diff --git a/docs/CARS.md b/docs/CARS.md index 5c7fe57a8..070d068ca 100644 --- a/docs/CARS.md +++ b/docs/CARS.md @@ -4,237 +4,255 @@ A supported vehicle is one that just works when you install a comma three. All supported cars provide a better experience than any stock system. -# 220 Supported Cars +# 238 Supported Cars -|Make|Model|Supported Package|ACC|No ACC accel below|No ALC below|Steering Torque|Resume from stop|Harness| -|---|---|---|:---:|:---:|:---:|:---:|:---:|:---:| -|Acura|ILX 2016-19|AcuraWatch Plus|openpilot|25 mph|25 mph|[![star](assets/icon-star-empty.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Honda Nidec| -|Acura|RDX 2016-18|AcuraWatch Plus|openpilot|25 mph|12 mph|[![star](assets/icon-star-empty.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Honda Nidec| -|Acura|RDX 2019-22|All|openpilot available[1](#footnotes)|0 mph|3 mph|[![star](assets/icon-star-empty.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Honda Bosch A| -|Audi|A3 2014-19|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533| -|Audi|A3 Sportback e-tron 2017-18|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533| -|Audi|Q2 2018|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533| -|Audi|Q3 2019-23|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533| -|Audi|RS3 2018|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533| -|Audi|S3 2015-17|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533| -|Cadillac|Escalade ESV 2016[3](#footnotes)|Adaptive Cruise Control (ACC) & LKAS|openpilot|0 mph|6 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|OBD-II| -|Chevrolet|Bolt EUV 2022-23|Premier or Premier Redline Trim without Super Cruise Package|openpilot available[1](#footnotes)|3 mph|6 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|GM| -|Chevrolet|Bolt EV 2022-23|2LT Trim with Adaptive Cruise Control Package|openpilot available[1](#footnotes)|3 mph|6 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|GM| -|Chevrolet|Silverado 1500 2020-21|Safety Package II|openpilot available[1](#footnotes)|3 mph|6 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|GM| -|Chevrolet|Volt 2017-18[3](#footnotes)|Adaptive Cruise Control (ACC)|openpilot|0 mph|6 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|OBD-II| -|Chrysler|Pacifica 2017-18|Adaptive Cruise Control (ACC)|Stock|0 mph|9 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|FCA| -|Chrysler|Pacifica 2019-20|Adaptive Cruise Control (ACC)|Stock|0 mph|39 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|FCA| -|Chrysler|Pacifica 2021|All|Stock|0 mph|39 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|FCA| -|Chrysler|Pacifica Hybrid 2017-18|Adaptive Cruise Control (ACC)|Stock|0 mph|9 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|FCA| -|Chrysler|Pacifica Hybrid 2019-22|Adaptive Cruise Control (ACC)|Stock|0 mph|39 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|FCA| -|comma|body|All|openpilot|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|None| -|Genesis|G70 2018-19|All|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai F| -|Genesis|G70 2020|All|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai F| -|Genesis|G80 2017-19|All|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai H| -|Genesis|G90 2017-18|All|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai C| -|Genesis|GV60 2023[5](#footnotes)|All|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai K| -|Genesis|GV70 2022-23[5](#footnotes)|All|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai L| -|GMC|Acadia 2018[3](#footnotes)|Adaptive Cruise Control (ACC)|openpilot|0 mph|6 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|OBD-II| -|GMC|Sierra 1500 2020-21|Driver Alert Package II|openpilot available[1](#footnotes)|3 mph|6 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|GM| -|Honda|Accord 2018-22|All|openpilot available[1](#footnotes)|0 mph|3 mph|[![star](assets/icon-star-empty.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Honda Bosch A| -|Honda|Accord Hybrid 2018-22|All|openpilot available[1](#footnotes)|0 mph|3 mph|[![star](assets/icon-star-empty.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Honda Bosch A| -|Honda|Civic 2016-18|Honda Sensing|openpilot|0 mph|12 mph|[![star](assets/icon-star-empty.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Honda Nidec| -|Honda|Civic 2019-21|All|openpilot available[1](#footnotes)|0 mph|2 mph[4](#footnotes)|[![star](assets/icon-star-empty.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Honda Bosch A| -|Honda|Civic 2022|All|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Honda Bosch B| -|Honda|Civic Hatchback 2017-21|Honda Sensing|openpilot available[1](#footnotes)|0 mph|12 mph|[![star](assets/icon-star-empty.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Honda Bosch A| -|Honda|Civic Hatchback 2022|All|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Honda Bosch B| -|Honda|CR-V 2015-16|Touring Trim|openpilot|25 mph|12 mph|[![star](assets/icon-star-empty.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Honda Nidec| -|Honda|CR-V 2017-22|Honda Sensing|openpilot available[1](#footnotes)|0 mph|12 mph|[![star](assets/icon-star-empty.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Honda Bosch A| -|Honda|CR-V Hybrid 2017-19|Honda Sensing|openpilot available[1](#footnotes)|0 mph|12 mph|[![star](assets/icon-star-empty.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Honda Bosch A| -|Honda|e 2020|All|openpilot available[1](#footnotes)|0 mph|3 mph|[![star](assets/icon-star-empty.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Honda Bosch A| -|Honda|Fit 2018-20|Honda Sensing|openpilot|25 mph|12 mph|[![star](assets/icon-star-empty.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Honda Nidec| -|Honda|Freed 2020|Honda Sensing|openpilot|25 mph|12 mph|[![star](assets/icon-star-empty.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Honda Nidec| -|Honda|HR-V 2019-22|Honda Sensing|openpilot|25 mph|12 mph|[![star](assets/icon-star-empty.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Honda Nidec| -|Honda|Insight 2019-22|All|openpilot available[1](#footnotes)|0 mph|3 mph|[![star](assets/icon-star-empty.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Honda Bosch A| -|Honda|Inspire 2018|All|openpilot available[1](#footnotes)|0 mph|3 mph|[![star](assets/icon-star-empty.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Honda Bosch A| -|Honda|Odyssey 2018-20|Honda Sensing|openpilot|25 mph|0 mph|[![star](assets/icon-star-empty.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Honda Nidec| -|Honda|Passport 2019-21|All|openpilot|25 mph|12 mph|[![star](assets/icon-star-empty.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Honda Nidec| -|Honda|Pilot 2016-22|Honda Sensing|openpilot|25 mph|12 mph|[![star](assets/icon-star-empty.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Honda Nidec| -|Honda|Ridgeline 2017-22|Honda Sensing|openpilot|25 mph|12 mph|[![star](assets/icon-star-empty.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Honda Nidec| -|Hyundai|Elantra 2017-19|Smart Cruise Control (SCC)|Stock|19 mph|32 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai B| -|Hyundai|Elantra 2021-22|Smart Cruise Control (SCC)|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai K| -|Hyundai|Elantra GT 2017-19|Smart Cruise Control (SCC)|Stock|0 mph|32 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai E| -|Hyundai|Elantra Hybrid 2021-23|Smart Cruise Control (SCC)|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai K| -|Hyundai|Genesis 2015-16|Smart Cruise Control (SCC)|Stock|19 mph|37 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai J| -|Hyundai|i30 2017-19|Smart Cruise Control (SCC)|Stock|0 mph|32 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai E| -|Hyundai|Ioniq 5 (with HDA II) 2022-23[5](#footnotes)|Highway Driving Assist II|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai Q| -|Hyundai|Ioniq 5 (without HDA II) 2022-23[5](#footnotes)|Highway Driving Assist|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai K| -|Hyundai|Ioniq Electric 2019|Smart Cruise Control (SCC)|Stock|0 mph|32 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai C| -|Hyundai|Ioniq Electric 2020|All|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai H| -|Hyundai|Ioniq Hybrid 2017-19|Smart Cruise Control (SCC)|Stock|0 mph|32 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai C| -|Hyundai|Ioniq Hybrid 2020-22|Smart Cruise Control (SCC)|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai H| -|Hyundai|Ioniq Plug-in Hybrid 2019|Smart Cruise Control (SCC)|openpilot available[1](#footnotes)|0 mph|32 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai C| -|Hyundai|Ioniq Plug-in Hybrid 2020-21|All|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai H| -|Hyundai|Kona 2020|Smart Cruise Control (SCC)|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai B| -|Hyundai|Kona Electric 2018-21|Smart Cruise Control (SCC)|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai G| -|Hyundai|Kona Electric 2022|Smart Cruise Control (SCC)|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai O| -|Hyundai|Kona Hybrid 2020|Smart Cruise Control (SCC)|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai I| -|Hyundai|Palisade 2020-22|All|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai H| -|Hyundai|Santa Cruz 2021-22[5](#footnotes)|Smart Cruise Control (SCC)|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai N| -|Hyundai|Santa Fe 2019-20|All|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai D| -|Hyundai|Santa Fe 2021-22|All|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai L| -|Hyundai|Santa Fe Hybrid 2022|All|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai L| -|Hyundai|Santa Fe Plug-in Hybrid 2022|All|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai L| -|Hyundai|Sonata 2018-19|Smart Cruise Control (SCC)|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai E| -|Hyundai|Sonata 2020-22|All|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai A| -|Hyundai|Sonata Hybrid 2020-22|All|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai A| -|Hyundai|Tucson 2021|Smart Cruise Control (SCC)|openpilot available[1](#footnotes)|19 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai L| -|Hyundai|Tucson 2022[5](#footnotes)|Smart Cruise Control (SCC)|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai N| -|Hyundai|Tucson 2023[5](#footnotes)|All|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai N| -|Hyundai|Tucson Diesel 2019|Smart Cruise Control (SCC)|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai L| -|Hyundai|Tucson Hybrid 2022[5](#footnotes)|All|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai N| -|Hyundai|Veloster 2019-20|Smart Cruise Control (SCC)|Stock|5 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai E| -|Jeep|Grand Cherokee 2016-18|Adaptive Cruise Control (ACC)|Stock|0 mph|9 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|FCA| -|Jeep|Grand Cherokee 2019-21|Adaptive Cruise Control (ACC)|Stock|0 mph|39 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|FCA| -|Kia|Ceed 2019|Smart Cruise Control (SCC)|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai E| -|Kia|EV6 (with HDA II) 2022[5](#footnotes)|Highway Driving Assist II|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai P| -|Kia|EV6 (without HDA II) 2022[5](#footnotes)|Highway Driving Assist|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai L| -|Kia|Forte 2019-21|Smart Cruise Control (SCC)|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai G| -|Kia|K5 2021-22|Smart Cruise Control (SCC)|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai A| -|Kia|Niro EV 2019|All|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai H| -|Kia|Niro EV 2020|All|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai F| -|Kia|Niro EV 2021|All|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai C| -|Kia|Niro EV 2022|All|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai H| -|Kia|Niro Hybrid 2021|Smart Cruise Control (SCC)|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai F| -|Kia|Niro Hybrid 2022|Smart Cruise Control (SCC)|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai H| -|Kia|Niro Plug-in Hybrid 2018-19|All|openpilot available[1](#footnotes)|10 mph|32 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai C| -|Kia|Optima 2017|Advanced Smart Cruise Control|Stock|0 mph|32 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai B| -|Kia|Optima 2019-20|Smart Cruise Control (SCC)|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai G| -|Kia|Seltos 2021|Smart Cruise Control (SCC)|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai A| -|Kia|Sorento 2018|Advanced Smart Cruise Control|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai C| -|Kia|Sorento 2019|Smart Cruise Control (SCC)|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai E| -|Kia|Sorento Plug-in Hybrid 2022-23[5](#footnotes)|Smart Cruise Control (SCC)|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai A| -|Kia|Sportage 2023[5](#footnotes)|Smart Cruise Control (SCC)|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai N| -|Kia|Sportage Hybrid 2023[5](#footnotes)|Smart Cruise Control (SCC)|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai N| -|Kia|Stinger 2018-20|Smart Cruise Control (SCC)|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai C| -|Kia|Stinger 2022|All|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai K| -|Kia|Telluride 2020-22|All|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai H| -|Lexus|CT Hybrid 2017-18|Lexus Safety System+|openpilot available[2](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Toyota| -|Lexus|ES 2019-22|All|openpilot|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota| -|Lexus|ES Hybrid 2017-18|Lexus Safety System+|openpilot available[2](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota| -|Lexus|ES Hybrid 2019-22|All|openpilot|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota| -|Lexus|IS 2017-19|All|Stock|19 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Toyota| -|Lexus|NX 2018-19|All|openpilot available[2](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Toyota| -|Lexus|NX 2020-21|All|openpilot|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota| -|Lexus|NX Hybrid 2018-19|All|openpilot available[2](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Toyota| -|Lexus|NX Hybrid 2020-21|All|openpilot|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota| -|Lexus|RC 2017-20|All|Stock|19 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Toyota| -|Lexus|RX 2016|Lexus Safety System+|openpilot available[2](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Toyota| -|Lexus|RX 2017-19|All|openpilot available[2](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Toyota| -|Lexus|RX 2020-22|All|openpilot|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota| -|Lexus|RX Hybrid 2016|Lexus Safety System+|openpilot available[2](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Toyota| -|Lexus|RX Hybrid 2017-19|All|openpilot available[2](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Toyota| -|Lexus|RX Hybrid 2020-21|All|openpilot|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota| -|Lexus|UX Hybrid 2019-22|All|openpilot|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota| -|Mazda|CX-5 2022-23|All|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Mazda| -|Mazda|CX-9 2021-23|All|Stock|0 mph|28 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Mazda| -|Nissan|Altima 2019-20|ProPILOT Assist|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Nissan B| -|Nissan|Leaf 2018-22|ProPILOT Assist|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Nissan A| -|Nissan|Rogue 2018-20|ProPILOT Assist|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Nissan A| -|Nissan|X-Trail 2017|ProPILOT Assist|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Nissan A| -|Ram|1500 2019-22|Adaptive Cruise Control (ACC)|Stock|0 mph|32 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Ram| -|SEAT|Ateca 2018|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533| -|SEAT|Leon 2014-20|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533| -|Subaru|Ascent 2019-21|All|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Subaru A| -|Subaru|Crosstrek 2018-19|EyeSight Driver Assistance|Stock|0 mph|0 mph|[![star](assets/icon-star-empty.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Subaru A| -|Subaru|Crosstrek 2020-23|EyeSight Driver Assistance|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Subaru A| -|Subaru|Forester 2019-21|All|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Subaru A| -|Subaru|Impreza 2017-19|EyeSight Driver Assistance|Stock|0 mph|0 mph|[![star](assets/icon-star-empty.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Subaru A| -|Subaru|Impreza 2020-22|EyeSight Driver Assistance|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Subaru A| -|Subaru|Legacy 2020-22|All|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Subaru B| -|Subaru|Outback 2020-22|All|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Subaru B| -|Subaru|XV 2018-19|EyeSight Driver Assistance|Stock|0 mph|0 mph|[![star](assets/icon-star-empty.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Subaru A| -|Subaru|XV 2020-21|EyeSight Driver Assistance|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Subaru A| -|Škoda|Kamiq 2021[7](#footnotes)|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533[10](#footnotes)| -|Škoda|Karoq 2019-21|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533| -|Škoda|Kodiaq 2018-19|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533| -|Škoda|Octavia 2015, 2018-19|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533| -|Škoda|Octavia RS 2016|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533| -|Škoda|Scala 2020|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533[10](#footnotes)| -|Škoda|Superb 2015-22|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533| -|Toyota|Alphard 2019-20|All|openpilot|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota| -|Toyota|Alphard Hybrid 2021|All|openpilot|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota| -|Toyota|Avalon 2016|Toyota Safety Sense P|openpilot available[2](#footnotes)|19 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Toyota| -|Toyota|Avalon 2017-18|All|openpilot available[2](#footnotes)|19 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Toyota| -|Toyota|Avalon 2019-21|All|openpilot available[2](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Toyota| -|Toyota|Avalon 2022|All|openpilot|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota| -|Toyota|Avalon Hybrid 2019-21|All|openpilot available[2](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Toyota| -|Toyota|Avalon Hybrid 2022|All|openpilot|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota| -|Toyota|C-HR 2017-21|All|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Toyota| -|Toyota|C-HR Hybrid 2017-19|All|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Toyota| -|Toyota|Camry 2018-20|All|Stock|0 mph[6](#footnotes)|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Toyota| -|Toyota|Camry 2021-22|All|openpilot|0 mph[6](#footnotes)|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota| -|Toyota|Camry Hybrid 2018-20|All|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Toyota| -|Toyota|Camry Hybrid 2021-23|All|openpilot|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota| -|Toyota|Corolla 2017-19|All|openpilot available[2](#footnotes)|19 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Toyota| -|Toyota|Corolla 2020-22|All|openpilot|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota| -|Toyota|Corolla Cross (Non-US only) 2020-23|All|openpilot|17 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota| -|Toyota|Corolla Cross Hybrid (Non-US only) 2020-22|All|openpilot|17 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota| -|Toyota|Corolla Hatchback 2019-22|All|openpilot|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota| -|Toyota|Corolla Hybrid 2020-22|All|openpilot|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota| -|Toyota|Highlander 2017-19|All|openpilot available[2](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota| -|Toyota|Highlander 2020-22|All|openpilot|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota| -|Toyota|Highlander Hybrid 2017-19|All|openpilot available[2](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota| -|Toyota|Highlander Hybrid 2020-22|All|openpilot|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota| -|Toyota|Mirai 2021|All|openpilot|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota| -|Toyota|Prius 2016|Toyota Safety Sense P|openpilot available[2](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Toyota| -|Toyota|Prius 2017-20|All|openpilot available[2](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Toyota| -|Toyota|Prius 2021-22|All|openpilot|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota| -|Toyota|Prius Prime 2017-20|All|openpilot available[2](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Toyota| -|Toyota|Prius Prime 2021-22|All|openpilot|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota| -|Toyota|Prius v 2017|Toyota Safety Sense P|openpilot available[2](#footnotes)|19 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota| -|Toyota|RAV4 2016|Toyota Safety Sense P|openpilot available[2](#footnotes)|19 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Toyota| -|Toyota|RAV4 2017-18|All|openpilot available[2](#footnotes)|19 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Toyota| -|Toyota|RAV4 2019-21|All|openpilot|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota| -|Toyota|RAV4 2022|All|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Toyota| -|Toyota|RAV4 Hybrid 2016|Toyota Safety Sense P|openpilot available[2](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota| -|Toyota|RAV4 Hybrid 2017-18|All|openpilot available[2](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota| -|Toyota|RAV4 Hybrid 2019-21|All|openpilot|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota| -|Toyota|RAV4 Hybrid 2022|All|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Toyota| -|Toyota|Sienna 2018-20|All|openpilot available[2](#footnotes)|19 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota| -|Volkswagen|Arteon 2018-22|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533| -|Volkswagen|Arteon eHybrid 2020-22|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533| -|Volkswagen|Arteon R 2020-22|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533| -|Volkswagen|Atlas 2018-23|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533| -|Volkswagen|Atlas Cross Sport 2021-22|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533| -|Volkswagen|California 2021|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|31 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533| -|Volkswagen|Caravelle 2020|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|31 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533| -|Volkswagen|CC 2018-22|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533| -|Volkswagen|e-Golf 2014-20|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533| -|Volkswagen|Golf 2015-20|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533| -|Volkswagen|Golf Alltrack 2015-19|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533| -|Volkswagen|Golf GTD 2015-20|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533| -|Volkswagen|Golf GTE 2015-20|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533| -|Volkswagen|Golf GTI 2015-21|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533| -|Volkswagen|Golf R 2015-19|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533| -|Volkswagen|Golf SportsVan 2015-20|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533| -|Volkswagen|Jetta 2018-22|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533| -|Volkswagen|Jetta GLI 2021-22|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533| -|Volkswagen|Passat 2015-22[8](#footnotes)|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533| -|Volkswagen|Passat Alltrack 2015-22|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533| -|Volkswagen|Passat GTE 2015-22|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533| -|Volkswagen|Polo 2020-22|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533[10](#footnotes)| -|Volkswagen|Polo GTI 2020-22|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533[10](#footnotes)| -|Volkswagen|T-Cross 2021|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533[10](#footnotes)| -|Volkswagen|T-Roc 2021|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533[10](#footnotes)| -|Volkswagen|Taos 2022|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533| -|Volkswagen|Teramont 2018-22|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533| -|Volkswagen|Teramont Cross Sport 2021-22|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533| -|Volkswagen|Teramont X 2021-22|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533| -|Volkswagen|Tiguan 2019-22|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533| -|Volkswagen|Touran 2017|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533| +|Make|Model|Supported Package|ACC|No ACC accel below|No ALC below|Steering Torque|Resume from stop|Harness|Video| +|---|---|---|:---:|:---:|:---:|:---:|:---:|:---:|:---:| +|Acura|ILX 2016-19|AcuraWatch Plus|openpilot|25 mph|25 mph|[![star](assets/icon-star-empty.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Honda Nidec|| +|Acura|RDX 2016-18|AcuraWatch Plus|openpilot|25 mph|12 mph|[![star](assets/icon-star-empty.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Honda Nidec|| +|Acura|RDX 2019-22|All|openpilot available[1](#footnotes)|0 mph|3 mph|[![star](assets/icon-star-empty.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Honda Bosch A|| +|Audi|A3 2014-19|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533|| +|Audi|A3 Sportback e-tron 2017-18|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533|| +|Audi|Q2 2018|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533|| +|Audi|Q3 2019-23|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533|| +|Audi|RS3 2018|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533|| +|Audi|S3 2015-17|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533|| +|Cadillac|Escalade 2017[3](#footnotes)|Driver Assist Package|openpilot|0 mph|7 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|OBD-II|| +|Cadillac|Escalade ESV 2016[3](#footnotes)|Adaptive Cruise Control (ACC) & LKAS|openpilot|0 mph|7 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|OBD-II|| +|Chevrolet|Bolt EUV 2022-23|Premier or Premier Redline Trim without Super Cruise Package|openpilot available[1](#footnotes)|3 mph|6 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|GM|| +|Chevrolet|Bolt EV 2022-23|2LT Trim with Adaptive Cruise Control Package|openpilot available[1](#footnotes)|3 mph|6 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|GM|| +|Chevrolet|Silverado 1500 2020-21|Safety Package II|openpilot available[1](#footnotes)|3 mph|6 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|GM|| +|Chevrolet|Volt 2017-18[3](#footnotes)|Adaptive Cruise Control (ACC)|openpilot|0 mph|7 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|OBD-II|| +|Chrysler|Pacifica 2017-18|Adaptive Cruise Control (ACC)|Stock|0 mph|9 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|FCA|| +|Chrysler|Pacifica 2019-20|Adaptive Cruise Control (ACC)|Stock|0 mph|39 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|FCA|| +|Chrysler|Pacifica 2021|All|Stock|0 mph|39 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|FCA|| +|Chrysler|Pacifica Hybrid 2017-18|Adaptive Cruise Control (ACC)|Stock|0 mph|9 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|FCA|| +|Chrysler|Pacifica Hybrid 2019-22|Adaptive Cruise Control (ACC)|Stock|0 mph|39 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|FCA|| +|comma|body|All|openpilot|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|None|| +|Genesis|G70 2018-19|All|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai F|| +|Genesis|G70 2020|All|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai F|| +|Genesis|G80 2017|All|Stock|19 mph|37 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai J|| +|Genesis|G80 2018-19|All|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai H|| +|Genesis|G90 2017-18|All|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai C|| +|Genesis|GV60 (Advanced Trim) 2023[5](#footnotes)|All|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai A|| +|Genesis|GV60 (Performance Trim) 2023[5](#footnotes)|All|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai K|| +|Genesis|GV70 2022-23[5](#footnotes)|All|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai L|| +|GMC|Acadia 2018[3](#footnotes)|Adaptive Cruise Control (ACC)|openpilot|0 mph|7 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|OBD-II|| +|GMC|Sierra 1500 2020-21|Driver Alert Package II|openpilot available[1](#footnotes)|3 mph|6 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|GM|| +|Honda|Accord 2018-22|All|openpilot available[1](#footnotes)|0 mph|3 mph|[![star](assets/icon-star-empty.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Honda Bosch A|| +|Honda|Accord Hybrid 2018-22|All|openpilot available[1](#footnotes)|0 mph|3 mph|[![star](assets/icon-star-empty.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Honda Bosch A|| +|Honda|Civic 2016-18|Honda Sensing|openpilot|0 mph|12 mph|[![star](assets/icon-star-empty.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Honda Nidec|| +|Honda|Civic 2019-21|All|openpilot available[1](#footnotes)|0 mph|2 mph[4](#footnotes)|[![star](assets/icon-star-empty.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Honda Bosch A|| +|Honda|Civic 2022|All|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Honda Bosch B|| +|Honda|Civic Hatchback 2017-21|Honda Sensing|openpilot available[1](#footnotes)|0 mph|12 mph|[![star](assets/icon-star-empty.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Honda Bosch A|| +|Honda|Civic Hatchback 2022|All|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Honda Bosch B|| +|Honda|CR-V 2015-16|Touring Trim|openpilot|25 mph|12 mph|[![star](assets/icon-star-empty.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Honda Nidec|| +|Honda|CR-V 2017-22|Honda Sensing|openpilot available[1](#footnotes)|0 mph|12 mph|[![star](assets/icon-star-empty.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Honda Bosch A|| +|Honda|CR-V Hybrid 2017-19|Honda Sensing|openpilot available[1](#footnotes)|0 mph|12 mph|[![star](assets/icon-star-empty.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Honda Bosch A|| +|Honda|e 2020|All|openpilot available[1](#footnotes)|0 mph|3 mph|[![star](assets/icon-star-empty.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Honda Bosch A|| +|Honda|Fit 2018-20|Honda Sensing|openpilot|25 mph|12 mph|[![star](assets/icon-star-empty.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Honda Nidec|| +|Honda|Freed 2020|Honda Sensing|openpilot|25 mph|12 mph|[![star](assets/icon-star-empty.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Honda Nidec|| +|Honda|HR-V 2019-22|Honda Sensing|openpilot|25 mph|12 mph|[![star](assets/icon-star-empty.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Honda Nidec|| +|Honda|Insight 2019-22|All|openpilot available[1](#footnotes)|0 mph|3 mph|[![star](assets/icon-star-empty.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Honda Bosch A|| +|Honda|Inspire 2018|All|openpilot available[1](#footnotes)|0 mph|3 mph|[![star](assets/icon-star-empty.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Honda Bosch A|| +|Honda|Odyssey 2018-20|Honda Sensing|openpilot|25 mph|0 mph|[![star](assets/icon-star-empty.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Honda Nidec|| +|Honda|Passport 2019-21|All|openpilot|25 mph|12 mph|[![star](assets/icon-star-empty.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Honda Nidec|| +|Honda|Pilot 2016-22|Honda Sensing|openpilot|25 mph|12 mph|[![star](assets/icon-star-empty.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Honda Nidec|| +|Honda|Ridgeline 2017-22|Honda Sensing|openpilot|25 mph|12 mph|[![star](assets/icon-star-empty.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Honda Nidec|| +|Hyundai|Elantra 2017-19|Smart Cruise Control (SCC)|Stock|19 mph|32 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai B|| +|Hyundai|Elantra 2021-23|Smart Cruise Control (SCC)|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai K|| +|Hyundai|Elantra GT 2017-19|Smart Cruise Control (SCC)|Stock|0 mph|32 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai E|| +|Hyundai|Elantra Hybrid 2021-23|Smart Cruise Control (SCC)|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai K|| +|Hyundai|Genesis 2015-16|Smart Cruise Control (SCC)|Stock|19 mph|37 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai J|| +|Hyundai|i30 2017-19|Smart Cruise Control (SCC)|Stock|0 mph|32 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai E|| +|Hyundai|Ioniq 5 (Southeast Asia only) 2022-23[5](#footnotes)|All|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai Q|| +|Hyundai|Ioniq 5 (with HDA II) 2022-23[5](#footnotes)|Highway Driving Assist II|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai Q|| +|Hyundai|Ioniq 5 (without HDA II) 2022-23[5](#footnotes)|Highway Driving Assist|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai K|| +|Hyundai|Ioniq Electric 2019|Smart Cruise Control (SCC)|Stock|0 mph|32 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai C|| +|Hyundai|Ioniq Electric 2020|All|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai H|| +|Hyundai|Ioniq Hybrid 2017-19|Smart Cruise Control (SCC)|Stock|0 mph|32 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai C|| +|Hyundai|Ioniq Hybrid 2020-22|Smart Cruise Control (SCC)|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai H|| +|Hyundai|Ioniq Plug-in Hybrid 2019|Smart Cruise Control (SCC)|openpilot available[1](#footnotes)|0 mph|32 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai C|| +|Hyundai|Ioniq Plug-in Hybrid 2020-21|All|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai H|| +|Hyundai|Kona 2020|Smart Cruise Control (SCC)|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai B|| +|Hyundai|Kona Electric 2018-21|Smart Cruise Control (SCC)|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai G|| +|Hyundai|Kona Electric 2022|Smart Cruise Control (SCC)|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai O|| +|Hyundai|Kona Hybrid 2020|Smart Cruise Control (SCC)|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai I|| +|Hyundai|Palisade 2020-22|All|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai H|| +|Hyundai|Santa Cruz 2022-23[5](#footnotes)|Smart Cruise Control (SCC)|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai N|| +|Hyundai|Santa Fe 2019-20|All|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai D|| +|Hyundai|Santa Fe 2021-22|All|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai L|| +|Hyundai|Santa Fe Hybrid 2022|All|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai L|| +|Hyundai|Santa Fe Plug-in Hybrid 2022|All|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai L|| +|Hyundai|Sonata 2018-19|Smart Cruise Control (SCC)|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai E|| +|Hyundai|Sonata 2020-23|All|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai A|| +|Hyundai|Sonata Hybrid 2020-22|All|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai A|| +|Hyundai|Tucson 2021|Smart Cruise Control (SCC)|openpilot available[1](#footnotes)|19 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai L|| +|Hyundai|Tucson 2022[5](#footnotes)|Smart Cruise Control (SCC)|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai N|| +|Hyundai|Tucson 2023[5](#footnotes)|All|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai N|| +|Hyundai|Tucson Diesel 2019|Smart Cruise Control (SCC)|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai L|| +|Hyundai|Tucson Hybrid 2022[5](#footnotes)|All|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai N|| +|Hyundai|Veloster 2019-20|Smart Cruise Control (SCC)|Stock|5 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai E|| +|Jeep|Grand Cherokee 2016-18|Adaptive Cruise Control (ACC)|Stock|0 mph|9 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|FCA|| +|Jeep|Grand Cherokee 2019-21|Adaptive Cruise Control (ACC)|Stock|0 mph|39 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|FCA|| +|Kia|Ceed 2019|Smart Cruise Control (SCC)|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai E|| +|Kia|EV6 (Southeast Asia only) 2022-23[5](#footnotes)|All|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai P|| +|Kia|EV6 (with HDA II) 2022[5](#footnotes)|Highway Driving Assist II|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai P|| +|Kia|EV6 (without HDA II) 2022[5](#footnotes)|Highway Driving Assist|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai L|| +|Kia|Forte 2019-21|Smart Cruise Control (SCC)|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai G|| +|Kia|K5 2021-22|Smart Cruise Control (SCC)|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai A|| +|Kia|K5 Hybrid 2020|Smart Cruise Control (SCC)|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai A|| +|Kia|Niro EV 2019|All|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai H|| +|Kia|Niro EV 2020|All|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai F|| +|Kia|Niro EV 2021|All|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai C|| +|Kia|Niro EV 2022|All|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai H|| +|Kia|Niro Hybrid 2021|Smart Cruise Control (SCC)|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai F|| +|Kia|Niro Hybrid 2022|Smart Cruise Control (SCC)|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai H|| +|Kia|Niro Hybrid 2023[5](#footnotes)|Smart Cruise Control (SCC)|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai A|| +|Kia|Niro Plug-in Hybrid 2018-19|All|openpilot available[1](#footnotes)|10 mph|32 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai C|| +|Kia|Niro Plug-in Hybrid 2020|All|openpilot available[1](#footnotes)|0 mph|32 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai D|| +|Kia|Optima 2017|Advanced Smart Cruise Control|Stock|0 mph|32 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai B|| +|Kia|Optima 2019-20|Smart Cruise Control (SCC)|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai G|| +|Kia|Seltos 2021|Smart Cruise Control (SCC)|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai A|| +|Kia|Sorento 2018|Advanced Smart Cruise Control|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai C|| +|Kia|Sorento 2019|Smart Cruise Control (SCC)|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai E|| +|Kia|Sorento 2022-23[5](#footnotes)|Smart Cruise Control (SCC)|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai K|| +|Kia|Sorento Plug-in Hybrid 2022-23[5](#footnotes)|Smart Cruise Control (SCC)|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai A|| +|Kia|Sportage 2023[5](#footnotes)|Smart Cruise Control (SCC)|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai N|| +|Kia|Sportage Hybrid 2023[5](#footnotes)|Smart Cruise Control (SCC)|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai N|| +|Kia|Stinger 2018-20|Smart Cruise Control (SCC)|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai C|| +|Kia|Stinger 2022|All|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai K|| +|Kia|Telluride 2020-22|All|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai H|| +|Lexus|CT Hybrid 2017-18|Lexus Safety System+|openpilot available[2](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Toyota|| +|Lexus|ES 2019-22|All|openpilot|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota|| +|Lexus|ES Hybrid 2017-18|Lexus Safety System+|openpilot available[2](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota|| +|Lexus|ES Hybrid 2019-23|All|openpilot|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota|| +|Lexus|IS 2017-19|All|Stock|19 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Toyota|| +|Lexus|NX 2018-19|All|openpilot available[2](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Toyota|| +|Lexus|NX 2020-21|All|openpilot|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota|| +|Lexus|NX Hybrid 2018-19|All|openpilot available[2](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Toyota|| +|Lexus|NX Hybrid 2020-21|All|openpilot|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota|| +|Lexus|RC 2017-20|All|Stock|19 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Toyota|| +|Lexus|RX 2016|Lexus Safety System+|openpilot available[2](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Toyota|| +|Lexus|RX 2017-19|All|openpilot available[2](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Toyota|| +|Lexus|RX 2020-22|All|openpilot|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota|| +|Lexus|RX Hybrid 2016|Lexus Safety System+|openpilot available[2](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Toyota|| +|Lexus|RX Hybrid 2017-19|All|openpilot available[2](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Toyota|| +|Lexus|RX Hybrid 2020-21|All|openpilot|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota|| +|Lexus|UX Hybrid 2019-22|All|openpilot|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota|| +|MAN|eTGE 2020-23|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|31 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533|| +|MAN|TGE 2017-23|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|31 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533|| +|Mazda|CX-5 2022-23|All|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Mazda|| +|Mazda|CX-9 2021-23|All|Stock|0 mph|28 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Mazda|| +|Nissan|Altima 2019-20|ProPILOT Assist|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Nissan B|| +|Nissan|Leaf 2018-22|ProPILOT Assist|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Nissan A|| +|Nissan|Rogue 2018-20|ProPILOT Assist|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Nissan A|| +|Nissan|X-Trail 2017|ProPILOT Assist|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Nissan A|| +|Ram|1500 2019-22|Adaptive Cruise Control (ACC)|Stock|0 mph|32 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Ram|| +|SEAT|Ateca 2018|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533|| +|SEAT|Leon 2014-20|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533|| +|Subaru|Ascent 2019-21|All|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Subaru A|| +|Subaru|Crosstrek 2018-19|EyeSight Driver Assistance|Stock|0 mph|0 mph|[![star](assets/icon-star-empty.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Subaru A|| +|Subaru|Crosstrek 2020-23|EyeSight Driver Assistance|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Subaru A|| +|Subaru|Forester 2019-21|All|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Subaru A|| +|Subaru|Impreza 2017-19|EyeSight Driver Assistance|Stock|0 mph|0 mph|[![star](assets/icon-star-empty.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Subaru A|| +|Subaru|Impreza 2020-22|EyeSight Driver Assistance|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Subaru A|| +|Subaru|Legacy 2020-22|All|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Subaru B|| +|Subaru|Outback 2020-22|All|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Subaru B|| +|Subaru|XV 2018-19|EyeSight Driver Assistance|Stock|0 mph|0 mph|[![star](assets/icon-star-empty.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Subaru A|| +|Subaru|XV 2020-21|EyeSight Driver Assistance|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Subaru A|| +|Škoda|Fabia 2022-23|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533[10](#footnotes)|| +|Škoda|Kamiq 2021[7](#footnotes)|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533[10](#footnotes)|| +|Škoda|Karoq 2019-21|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533|| +|Škoda|Kodiaq 2017-23|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533|| +|Škoda|Octavia 2015, 2018-19|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533|| +|Škoda|Octavia RS 2016|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533|| +|Škoda|Scala 2020|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533[10](#footnotes)|| +|Škoda|Superb 2015-22|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533|| +|Toyota|Alphard 2019-20|All|openpilot|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota|| +|Toyota|Alphard Hybrid 2021|All|openpilot|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota|| +|Toyota|Avalon 2016|Toyota Safety Sense P|openpilot available[2](#footnotes)|19 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Toyota|| +|Toyota|Avalon 2017-18|All|openpilot available[2](#footnotes)|19 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Toyota|| +|Toyota|Avalon 2019-21|All|openpilot available[2](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Toyota|| +|Toyota|Avalon 2022|All|openpilot|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota|| +|Toyota|Avalon Hybrid 2019-21|All|openpilot available[2](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Toyota|| +|Toyota|Avalon Hybrid 2022|All|openpilot|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota|| +|Toyota|C-HR 2017-20|All|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Toyota|| +|Toyota|C-HR 2021|All|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Toyota|| +|Toyota|C-HR Hybrid 2017-20|All|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Toyota|| +|Toyota|C-HR Hybrid 2021-22|All|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Toyota|| +|Toyota|Camry 2018-20|All|Stock|0 mph[6](#footnotes)|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Toyota|| +|Toyota|Camry 2021-23|All|openpilot|0 mph[6](#footnotes)|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota|| +|Toyota|Camry Hybrid 2018-20|All|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Toyota|| +|Toyota|Camry Hybrid 2021-23|All|openpilot|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota|| +|Toyota|Corolla 2017-19|All|openpilot available[2](#footnotes)|19 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Toyota|| +|Toyota|Corolla 2020-22|All|openpilot|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota|| +|Toyota|Corolla Cross (Non-US only) 2020-23|All|openpilot|17 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota|| +|Toyota|Corolla Cross Hybrid (Non-US only) 2020-22|All|openpilot|17 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota|| +|Toyota|Corolla Hatchback 2019-22|All|openpilot|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota|| +|Toyota|Corolla Hybrid 2020-22|All|openpilot|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota|| +|Toyota|Corolla Hybrid (Non-US only) 2020-23|All|openpilot|17 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota|| +|Toyota|Highlander 2017-19|All|openpilot available[2](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota|| +|Toyota|Highlander 2020-23|All|openpilot|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota|| +|Toyota|Highlander Hybrid 2017-19|All|openpilot available[2](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota|| +|Toyota|Highlander Hybrid 2020-23|All|openpilot|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota|| +|Toyota|Mirai 2021|All|openpilot|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota|| +|Toyota|Prius 2016|Toyota Safety Sense P|openpilot available[2](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Toyota|| +|Toyota|Prius 2017-20|All|openpilot available[2](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Toyota|| +|Toyota|Prius 2021-22|All|openpilot|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota|| +|Toyota|Prius Prime 2017-20|All|openpilot available[2](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Toyota|| +|Toyota|Prius Prime 2021-22|All|openpilot|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota|| +|Toyota|Prius v 2017|Toyota Safety Sense P|openpilot available[2](#footnotes)|19 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota|| +|Toyota|RAV4 2016|Toyota Safety Sense P|openpilot available[2](#footnotes)|19 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Toyota|| +|Toyota|RAV4 2017-18|All|openpilot available[2](#footnotes)|19 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Toyota|| +|Toyota|RAV4 2019-21|All|openpilot|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota|| +|Toyota|RAV4 2022|All|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Toyota|| +|Toyota|RAV4 Hybrid 2016|Toyota Safety Sense P|openpilot available[2](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota|| +|Toyota|RAV4 Hybrid 2017-18|All|openpilot available[2](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota|| +|Toyota|RAV4 Hybrid 2019-21|All|openpilot|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota|| +|Toyota|RAV4 Hybrid 2022|All|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Toyota|| +|Toyota|Sienna 2018-20|All|openpilot available[2](#footnotes)|19 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota|| +|Volkswagen|Arteon 2018-22|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533|| +|Volkswagen|Arteon eHybrid 2020-22|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533|| +|Volkswagen|Arteon R 2020-22|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533|| +|Volkswagen|Atlas 2018-23|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533|| +|Volkswagen|Atlas Cross Sport 2021-22|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533|| +|Volkswagen|California 2021|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|31 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533|| +|Volkswagen|Caravelle 2020|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|31 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533|| +|Volkswagen|CC 2018-22|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533|| +|Volkswagen|Crafter 2017-23|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|31 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533|| +|Volkswagen|e-Crafter 2018-23|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|31 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533|| +|Volkswagen|e-Golf 2014-20|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533|| +|Volkswagen|Golf 2015-20|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533|| +|Volkswagen|Golf Alltrack 2015-19|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533|| +|Volkswagen|Golf GTD 2015-20|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533|| +|Volkswagen|Golf GTE 2015-20|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533|| +|Volkswagen|Golf GTI 2015-21|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533|| +|Volkswagen|Golf R 2015-19|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533|| +|Volkswagen|Golf SportsVan 2015-20|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533|| +|Volkswagen|Grand California 2019-23|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|31 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533|| +|Volkswagen|Jetta 2018-22|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533|| +|Volkswagen|Jetta GLI 2021-22|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533|| +|Volkswagen|Passat 2015-22[8](#footnotes)|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533|| +|Volkswagen|Passat Alltrack 2015-22|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533|| +|Volkswagen|Passat GTE 2015-22|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533|| +|Volkswagen|Polo 2020-22|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533[10](#footnotes)|| +|Volkswagen|Polo GTI 2020-22|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533[10](#footnotes)|| +|Volkswagen|T-Cross 2021|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533[10](#footnotes)|| +|Volkswagen|T-Roc 2021|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533[10](#footnotes)|| +|Volkswagen|Taos 2022|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533|| +|Volkswagen|Teramont 2018-22|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533|| +|Volkswagen|Teramont Cross Sport 2021-22|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533|| +|Volkswagen|Teramont X 2021-22|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533|| +|Volkswagen|Tiguan 2018-23|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533|| +|Volkswagen|Touran 2017|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[1,9](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|J533|| 1Experimental openpilot longitudinal control is available behind a toggle; the toggle is only available in non-release branches such as `devel` or `master-ci`.
2By default, this car will use the stock Adaptive Cruise Control (ACC) for longitudinal control. If the Driver Support Unit (DSU) is disconnected, openpilot ACC will replace stock ACC. NOTE: disconnecting the DSU disables Automatic Emergency Braking (AEB).
-3Requires a community built ASCM harness. NOTE: disconnecting the ASCM disables Automatic Emergency Braking (AEB).
+3Requires a community built ASCM harness. NOTE: disconnecting the ASCM disables Automatic Emergency Braking (AEB).
42019 Honda Civic 1.6L Diesel Sedan does not have ALC below 12mph.
-5Requires a red panda, additional harness box, additional OBD-C cable, USB-A to USB-A cable, and a USB-A to USB-C OTG dongle.
+5Requires a red panda for this CAN FD car. All the hardware needed is sold in the CAN FD kit.
6openpilot operates above 28mph for Camry 4CYL L, 4CYL LE and 4CYL SE which don't have Full-Speed Range Dynamic Radar Cruise Control.
7Not including the China market Kamiq, which is based on the (currently) unsupported PQ34 platform.
8Refers only to the MQB-based European B8 Passat, not the NMS Passat in the USA/China/Mideast markets.
diff --git a/laika/astro_dog.py b/laika/astro_dog.py index ea32e350d..348c3959a 100644 --- a/laika/astro_dog.py +++ b/laika/astro_dog.py @@ -48,13 +48,13 @@ class AstroDog: self.valid_ephem_types = valid_ephem_types self.orbit_fetched_times = TimeRangeHolder() - self.nav_fetched_times = TimeRangeHolder() + self.navs_fetched_times = TimeRangeHolder() self.dcbs_fetched_times = TimeRangeHolder() self.dgps_delays = [] self.ionex_maps: List[IonexMap] = [] self.orbits: DefaultDict[str, List[PolyEphemeris]] = defaultdict(list) - self.nav: DefaultDict[str, List[Union[GPSEphemeris, GLONASSEphemeris]]] = defaultdict(list) + self.navs: DefaultDict[str, List[Union[GPSEphemeris, GLONASSEphemeris]]] = defaultdict(list) self.dcbs: DefaultDict[str, List[DCB]] = defaultdict(list) self.cached_ionex: Optional[IonexMap] = None @@ -73,8 +73,8 @@ class AstroDog: return ionex def get_nav(self, prn, time): - skip_download = time in self.nav_fetched_times - nav = self._get_latest_valid_data(self.nav[prn], self.cached_nav[prn], self.get_nav_data, time, skip_download) + skip_download = time in self.navs_fetched_times + nav = self._get_latest_valid_data(self.navs[prn], self.cached_nav[prn], self.get_nav_data, time, skip_download) if nav is not None: self.cached_nav[prn] = nav return nav @@ -97,9 +97,9 @@ class AstroDog: return result def get_navs(self, time): - if time not in self.nav_fetched_times and self.auto_update: + if time not in self.navs_fetched_times: self.get_nav_data(time) - return AstroDog._select_valid_temporal_items(self.nav, time, self.cached_nav) + return AstroDog._select_valid_temporal_items(self.navs, time, self.cached_nav) def get_orbit(self, prn: str, time: GPSTime): skip_download = time in self.orbit_fetched_times @@ -133,7 +133,7 @@ class AstroDog: self._add_ephems(new_ephems, self.orbits, self.orbit_fetched_times) def add_navs(self, new_ephems: Dict[str, List[Ephemeris]]): - self._add_ephems(new_ephems, self.nav, self.nav_fetched_times) + self._add_ephems(new_ephems, self.navs, self.navs_fetched_times) def _add_ephems(self, new_ephems: Dict[str, List[Ephemeris]], ephems_dict, fetched_times): for k, v in new_ephems.items(): @@ -172,7 +172,7 @@ class AstroDog: if sum([len(v) for v in fetched_ephems.values()]) == 0: begin_day = GPSTime(time.week, SECS_IN_DAY * (time.tow // SECS_IN_DAY)) end_day = GPSTime(time.week, SECS_IN_DAY * (1 + (time.tow // SECS_IN_DAY))) - self.nav_fetched_times.add(begin_day, end_day) + self.navs_fetched_times.add(begin_day, end_day) def download_parse_orbit(self, gps_time: GPSTime, skip_before_epoch=None) -> Dict[str, List[PolyEphemeris]]: # Download multiple days to be able to polyfit at the start-end of the day @@ -265,7 +265,6 @@ class AstroDog: eph = self.get_orbit(prn, time) if not eph and self.pull_nav: eph = self.get_nav(prn, time) - if eph: return eph.get_sat_info(time) return None diff --git a/laika/dgps.py b/laika/dgps.py index 54c13d8cf..53111d90d 100644 --- a/laika/dgps.py +++ b/laika/dgps.py @@ -5,6 +5,7 @@ from datetime import datetime from .gps_time import GPSTime from .constants import SECS_IN_YEAR from . import raw_gnss as raw +from . import opt from .rinex_file import RINEXFile from .downloader import download_cors_coords from .helpers import get_constellation @@ -107,8 +108,9 @@ def parse_dgps(station_id, station_obs_file_path, dog, max_distance=100000, requ station_delays[signal] = {} for i, proc_measurement in enumerate(proc_measurements): times.append(proc_measurement[0].recv_time) - Fx_pos = raw.pr_residual(proc_measurement, signal=signal) - residual = -np.array(Fx_pos(list(station_pos) + [0, 0])) + Fx_pos = opt.pr_residual(proc_measurement, signal=signal) + residual, _ = Fx_pos(list(station_pos) + [0,0]) + residual = -np.array(residual) for j, m in enumerate(proc_measurement): prn = m.prn if prn not in station_delays[signal]: diff --git a/laika/downloader.py b/laika/downloader.py index 1658e7f7d..bd456af20 100644 --- a/laika/downloader.py +++ b/laika/downloader.py @@ -7,18 +7,18 @@ import urllib.error import pycurl import re import time -import tempfile import socket from datetime import datetime, timedelta from urllib.parse import urlparse from io import BytesIO +from ftplib import FTP_TLS from atomicwrites import atomic_write from laika.ephemeris import EphemerisType from .constants import SECS_IN_HR, SECS_IN_DAY, SECS_IN_WEEK -from .gps_time import GPSTime +from .gps_time import GPSTime, tow_to_datetime from .helpers import ConstellationId dir_path = os.path.dirname(os.path.realpath(__file__)) @@ -177,24 +177,6 @@ def http_download_files(url_base, folder_path, cacheDir, filenames): def https_download_file(url): - if 'nasa.gov/' not in url: - netrc_path = None - f = None - elif os.path.isfile(dir_path + '/.netrc'): - netrc_path = dir_path + '/.netrc' - f = None - else: - try: - username = os.environ['NASA_USERNAME'] - password = os.environ['NASA_PASSWORD'] - f = tempfile.NamedTemporaryFile() - netrc = f"machine urs.earthdata.nasa.gov login {username} password {password}" - f.write(netrc.encode()) - f.flush() - netrc_path = f.name - except KeyError: - raise DownloadFailed('Could not find .netrc file and no NASA_USERNAME and NASA_PASSWORD in environment for urs.earthdata.nasa.gov authentication') - crl = pycurl.Curl() crl.setopt(crl.CAINFO, certifi.where()) crl.setopt(crl.URL, url) @@ -202,17 +184,12 @@ def https_download_file(url): crl.setopt(crl.SSL_CIPHER_LIST, 'DEFAULT@SECLEVEL=1') crl.setopt(crl.COOKIEJAR, '/tmp/cddis_cookies') crl.setopt(pycurl.CONNECTTIMEOUT, 10) - if netrc_path is not None: - crl.setopt(crl.NETRC_FILE, netrc_path) - crl.setopt(crl.NETRC, 2) - + buf = BytesIO() crl.setopt(crl.WRITEDATA, buf) crl.perform() response = crl.getinfo(pycurl.RESPONSE_CODE) crl.close() - if f is not None: - f.close() if response != 200: raise DownloadFailed('HTTPS error ' + str(response)) @@ -228,6 +205,17 @@ def ftp_download_file(url): except urllib.error.URLError as e: raise DownloadFailed(e) +def ftps_download_file(url): + parsed = urlparse(url) + try: + buf = BytesIO() + with FTP_TLS(parsed.hostname) as ftps: + ftps.login(user='anonymous') + ftps.prot_p() + ftps.retrbinary('RETR ' + parsed.path, buf.write) + return buf.getvalue() + except ftplib.all_errors as e: + raise DownloadFailed(e) @retryable def download_files(url_base, folder_path, cacheDir, filenames): @@ -242,11 +230,13 @@ def download_files(url_base, folder_path, cacheDir, filenames): def download_file(url_base, folder_path, filename_zipped): url = url_base + folder_path + filename_zipped print('Downloading ' + url) - if url.startswith('https'): + if url.startswith('https://'): return https_download_file(url) - if url.startswith('ftp'): + elif url.startswith('ftp://'): return ftp_download_file(url) - raise NotImplementedError('Did find ftp or https preamble') + elif url.startswith('sftp://'): + return ftps_download_file(url) + raise NotImplementedError('Did not find supported url scheme') def download_and_cache_file_return_first_success(url_bases, folder_and_file_names, cache_dir, compression='', overwrite=False, raise_error=False): @@ -308,26 +298,51 @@ def download_nav(time: GPSTime, cache_dir, constellation: ConstellationId): if GPSTime.from_datetime(datetime.utcnow()) - time > SECS_IN_DAY: url_bases = ( 'https://github.com/commaai/gnss-data/raw/master/gnss/data/daily/', - 'https://cddis.nasa.gov/archive/gnss/data/daily/', + 'sftp://gdc.cddis.eosdis.nasa.gov/gnss/data/daily/', ) filename = t.strftime(f"brdc%j0.%y{c}") folder_path = t.strftime(f'%Y/%j/%y{c}/') compression = '.gz' if folder_path >= '2020/335/' else '.Z' return download_and_cache_file(url_bases, folder_path, cache_dir+'daily_nav/', filename, compression) - elif constellation == ConstellationId.GPS: - url_base = 'https://cddis.nasa.gov/archive/gnss/data/hourly/' - filename = t.strftime(f"hour%j0.%y{c}") - folder_path = t.strftime('%Y/%j/') - compression = '.gz' if folder_path >= '2020/336/' else '.Z' - return download_and_cache_file(url_base, folder_path, cache_dir+'hourly_nav/', filename, compression) + else: + url_bases = ( + 'https://github.com/commaai/gnss-data-hourly/raw/master/', + 'sftp://gdc.cddis.eosdis.nasa.gov/gnss/data/hourly/', + ) + times = [t, (t - timedelta(hours=1))] + folder_and_filenames = [(t.strftime('%Y/%j/'), t.strftime(f"hour%j0.%y{c}")) for t in times] + compression = '.gz' if folder_and_filenames[0][0] >= '2020/336/' else '.Z' + # always overwrite as this file is appended + return download_and_cache_file_return_first_success(url_bases, + folder_and_filenames, cache_dir+'hourly_nav/', compression, overwrite=True) except DownloadFailed: pass +def download_orbits_gps_cod0(time, cache_dir, ephem_types): + url_bases = ( + 'https://github.com/commaai/gnss-data/raw/master/gnss/products/', + 'sftp://gdc.cddis.eosdis.nasa.gov/gnss/products/', + ) + + if EphemerisType.ULTRA_RAPID_ORBIT not in ephem_types: + # TODO: raise error here + return None + + tm = tow_to_datetime(time.tow, time.week).timetuple() + doy = str(tm.tm_yday).zfill(3) + filename = f"COD0OPSULT_{tm.tm_year}{doy}0000_02D_05M_ORB.SP3" + # TODO: add hour management + + folder_path = "%i/" % time.week + folder_file_names = [(folder_path, filename)] + return download_and_cache_file_return_first_success(url_bases, folder_file_names, cache_dir+'cddis_products/', compression='.gz') + + def download_orbits_gps(time, cache_dir, ephem_types): url_bases = ( 'https://github.com/commaai/gnss-data/raw/master/gnss/products/', - 'https://cddis.nasa.gov/archive/gnss/products/', + 'sftp://gdc.cddis.eosdis.nasa.gov/gnss/products/', 'ftp://igs.ign.fr/pub/igs/products/', ) folder_path = "%i/" % time.week @@ -344,7 +359,12 @@ def download_orbits_gps(time, cache_dir, ephem_types): f"igu{time_str}_06.sp3", f"igu{time_str}_00.sp3"]) folder_file_names = [(folder_path, filename) for filename in filenames] - return download_and_cache_file_return_first_success(url_bases, folder_file_names, cache_dir+'cddis_products/', compression='.Z') + ret = download_and_cache_file_return_first_success(url_bases, folder_file_names, cache_dir+'cddis_products/', compression='.Z') + if ret is not None: + return ret + + # fallback to COD0 Ultra Rapid Orbits + return download_orbits_gps_cod0(time, cache_dir, ephem_types) def download_prediction_orbits_russia_src(gps_time, cache_dir): @@ -406,7 +426,7 @@ def download_ionex(time, cache_dir): t = time.as_datetime() url_bases = ( 'https://github.com/commaai/gnss-data/raw/master/gnss/products/ionex/', - 'https://cddis.nasa.gov/archive/gnss/products/ionex/', + 'sftp://gdc.cddis.eosdis.nasa.gov/gnss/products/ionex/', 'ftp://igs.ensg.ign.fr/pub/igs/products/ionosphere/', 'ftp://gssc.esa.int/gnss/products/ionex/', ) @@ -422,7 +442,7 @@ def download_dcb(time, cache_dir): folder_paths = [] url_bases = ( 'https://github.com/commaai/gnss-data/raw/master/gnss/products/bias/', - 'https://cddis.nasa.gov/archive/gnss/products/bias/', + 'sftp://gdc.cddis.eosdis.nasa.gov/gnss/products/bias/', 'ftp://igs.ign.fr/pub/igs/products/mgex/dcb/', ) # seem to be a lot of data missing, so try many days diff --git a/laika/ephemeris.py b/laika/ephemeris.py index 12f9700f1..059fc931c 100644 --- a/laika/ephemeris.py +++ b/laika/ephemeris.py @@ -7,7 +7,7 @@ from typing import Dict, List, Optional import numpy as np import numpy.polynomial.polynomial as poly -from datetime import datetime +from datetime import datetime, timedelta from math import sin, cos, sqrt, fabs, atan2 from .gps_time import GPSTime, utc_to_gpst @@ -24,7 +24,7 @@ def read4(f, rinex_ver): return float(line[4:23]), float(line[23:42]), float(line[42:61]), float(line[61:80]) -def convert_ublox_ephem(ublox_ephem, current_time: Optional[datetime] = None): +def convert_ublox_gps_ephem(ublox_ephem, current_time: Optional[datetime] = None): # Week time of ephemeris gps msg has a roll-over period of 10 bits (19.6 years) # The latest roll-over was on 2019-04-07 week = ublox_ephem.gpsWeek @@ -38,6 +38,12 @@ def convert_ublox_ephem(ublox_ephem, current_time: Optional[datetime] = None): roll_overs = GPSTime.from_datetime(current_time).week // 1024 week += (roll_overs - (week // 1024)) * 1024 + # GPS week refers to current week, the ephemeris can be valid for the next + # if toe equals 0, this can be verified by the TOW count if it is within the + # last 2 hours of the week (gps ephemeris valid for 4hours) + if ublox_ephem.toe == 0 and ublox_ephem.towCount*6 >= (SECS_IN_WEEK - 2*SECS_IN_HR): + week += 1 + ephem = {} ephem['sv_id'] = ublox_ephem.svId ephem['toe'] = GPSTime(week, ublox_ephem.toe) @@ -65,10 +71,48 @@ def convert_ublox_ephem(ublox_ephem, current_time: Optional[datetime] = None): ephem['omegadot'] = ublox_ephem.omegaDot ephem['omega0'] = ublox_ephem.omega0 + ephem['healthy'] = ublox_ephem.svHealth == 0.0 + epoch = ephem['toe'] return GPSEphemeris(ephem, epoch) +def convert_ublox_glonass_ephem(ublox_ephem, current_time: Optional[datetime] = None): + ephem = {} + ephem['prn'] = 'R%02i' % ublox_ephem.svId + + etime = datetime.strptime(f"{ublox_ephem.year}-{ublox_ephem.dayInYear}", "%Y-%j") + # glonass time: UTC + 3h + time_in_day = timedelta(hours=ublox_ephem.hour, minutes=ublox_ephem.minute, seconds=ublox_ephem.second) + ephem['toc'] = GPSTime.from_datetime(etime + time_in_day - timedelta(hours=3)) + ephem['toe'] = GPSTime.from_datetime(etime + timedelta(minutes=(ublox_ephem.tb*15 - 180))) + + ephem['x'] = ublox_ephem.x # km + ephem['x_vel'] = ublox_ephem.xVel # km/s + ephem['x_acc'] = ublox_ephem.xAccel # km/s*s + + ephem['y'] = ublox_ephem.y # km + ephem['y_vel'] = ublox_ephem.yVel # km/s + ephem['y_acc'] = ublox_ephem.yAccel # km/s*s + + ephem['z'] = ublox_ephem.z # km + ephem['z_vel'] = ublox_ephem.zVel # km/s + ephem['z_acc'] = ublox_ephem.zAccel # km/s*s + + ephem['healthy'] = ublox_ephem.svHealth == 0.0 + ephem['age'] = ublox_ephem.age # age of information [days] + + # tauN compared to ephemeris from gdc.cddis.eosdis.nasa.gov is times -1 + ephem['min_tauN'] = ublox_ephem.tauN * (-1) # time correction relative to GLONASS tc + ephem['GammaN'] = ublox_ephem.gammaN + + # TODO: channel is in string 7, which is not parsed + ephem['freq_num'] = "1" + + # NOTE: ublox_ephem.tk is in a different format than rinex tk + return GLONASSEphemeris(ephem, ephem['toe']) + + class EphemerisType(IntEnum): # Matches the enum in log.capnp NAV = 0 @@ -87,7 +131,7 @@ class EphemerisType(IntEnum): return EphemerisType.FINAL_ORBIT if "/rapid" in file_name or "/igr" in file_name: return EphemerisType.RAPID_ORBIT - if "/ultra" in file_name or "/igu" in file_name: + if "/ultra" in file_name or "/igu" in file_name or "COD0OPSULT" in file_name: return EphemerisType.ULTRA_RAPID_ORBIT raise RuntimeError(f"Ephemeris type not found in filename: {file_name}") @@ -158,8 +202,8 @@ class EphemerisSerializer(json.JSONEncoder): class GLONASSEphemeris(Ephemeris): - def __init__(self, data, epoch, healthy=True, file_name=None): - super().__init__(data['prn'], data, epoch, EphemerisType.NAV, healthy, max_time_diff=25*SECS_IN_MIN, file_name=file_name) + def __init__(self, data, epoch, file_name=None): + super().__init__(data['prn'], data, epoch, EphemerisType.NAV, data['healthy'], max_time_diff=25*SECS_IN_MIN, file_name=file_name) self.channel = data['freq_num'] self.to_json() @@ -168,9 +212,7 @@ class GLONASSEphemeris(Ephemeris): # http://gauss.gge.unb.ca/GLONASS.ICD.pdf eph = self.data - # TODO should handle leap seconds better - toc_gps_time = utc_to_gpst(eph['toc']) - tdiff = time - toc_gps_time + tdiff = time - utc_to_gpst(eph['toe']) # Clock correction (except for general relativity which is applied later) clock_err = eph['min_tauN'] + tdiff * (eph['GammaN']) @@ -227,8 +269,9 @@ class GLONASSEphemeris(Ephemeris): class PolyEphemeris(Ephemeris): def __init__(self, prn: str, data, epoch: GPSTime, ephem_type: EphemerisType, - file_epoch: GPSTime=None, file_name: str=None, healthy=True, tgd=0): - super().__init__(prn, data, epoch, ephem_type, healthy, max_time_diff=SECS_IN_HR, file_epoch=file_epoch, file_name=file_name) + file_epoch: GPSTime=None, file_name: str=None, healthy=True, tgd=0, + max_time_diff: int=SECS_IN_HR): + super().__init__(prn, data, epoch, ephem_type, healthy, max_time_diff=max_time_diff, file_epoch=file_epoch, file_name=file_name) self.tgd = tgd self.to_json() @@ -247,8 +290,8 @@ class PolyEphemeris(Ephemeris): class GPSEphemeris(Ephemeris): - def __init__(self, data, epoch, healthy=True, file_name=None): - super().__init__('G%02i' % data['sv_id'], data, epoch, EphemerisType.NAV, healthy, max_time_diff=2*SECS_IN_HR, file_name=file_name) + def __init__(self, data, epoch, file_name=None): + super().__init__('G%02i' % data['sv_id'], data, epoch, EphemerisType.NAV, data['healthy'], max_time_diff=2*SECS_IN_HR, file_name=file_name) self.max_time_diff_tgd = SECS_IN_DAY self.to_json() @@ -403,7 +446,7 @@ def read_prn_data(data, prn, deg=16, deg_t=1): measurements = np_data_prn[i:i + deg + 1, 1:5] times = (measurements[:, 0] - epoch).astype(float) - if (np.diff(times) != 900).any(): + if not (np.diff(times) != 900).any() and not (np.diff(times) != 300).any(): continue poly_data = {} @@ -516,7 +559,7 @@ def parse_rinex_nav_msg_glonass(file_name): line = line.replace('D', 'E') # Handle bizarro float format e = {'epoch': epoch, 'prn': prn} - e['toc'] = epoch + e['toe'] = epoch e['min_tauN'] = float(line[23:42]) e['GammaN'] = float(line[42:61]) e['tk'] = float(line[61:80]) @@ -526,7 +569,6 @@ def parse_rinex_nav_msg_glonass(file_name): e['z'], e['z_vel'], e['z_acc'], e['age'] = read4(f, rinex_ver) e['healthy'] = (e['health'] == 0.0) - ephems[prn].append(GLONASSEphemeris(e, epoch, file_name=file_name)) f.close() return ephems @@ -553,4 +595,4 @@ def parse_qcom_ephem(qcom_poly, current_week): poly_data['clock'] = [1e-3*data.other[3], 1e-3*data.other[2], 1e-3*data.other[1], 1e-3*data.other[0]] poly_data['deg'] = 3 poly_data['deg_t'] = 3 - return PolyEphemeris(prn, poly_data, epoch, ephem_type=EphemerisType.QCOM_POLY) + return PolyEphemeris(prn, poly_data, epoch, ephem_type=EphemerisType.QCOM_POLY, max_time_diff=180) diff --git a/laika/gps_time.py b/laika/gps_time.py index 3f0b1f91c..b9492f52d 100644 --- a/laika/gps_time.py +++ b/laika/gps_time.py @@ -62,8 +62,7 @@ def get_leap_seconds(time): return 15 elif time <= GPSTime.from_datetime(datetime.datetime(2015, 7, 1)): return 16 - # TODO is this correct? - elif time <= GPSTime.from_datetime(datetime.datetime(2017, 7, 1)): + elif time <= GPSTime.from_datetime(datetime.datetime(2017, 1, 1)): return 17 else: return 18 diff --git a/laika/opt.py b/laika/opt.py new file mode 100644 index 000000000..1a76f353c --- /dev/null +++ b/laika/opt.py @@ -0,0 +1,191 @@ +import sympy +import numpy as np +from typing import List + +from .constants import EARTH_ROTATION_RATE, SPEED_OF_LIGHT +from .helpers import ConstellationId +from .raw_gnss import GNSSMeasurement + + +def gauss_newton(fun, b, xtol=1e-8, max_n=25): + for _ in range(max_n): + # Compute function and jacobian on current estimate + r, J = fun(b) + + # Update estimate + delta = np.linalg.pinv(J) @ r + b -= delta + + # Check step size for stopping condition + if np.linalg.norm(delta) < xtol: + break + return b + + +def calc_pos_fix(measurements, posfix_functions=None, x0=None, no_weight=False, signal='C1C', min_measurements=6): + ''' + Calculates gps fix using gauss newton method + To solve the problem a minimal of 4 measurements are required. + If Glonass is included 5 are required to solve for the additional free variable. + returns: + 0 -> list with positions + 1 -> pseudorange errs + ''' + if x0 is None: + x0 = [0, 0, 0, 0, 0] + + if len(measurements) < min_measurements: + return [],[] + + Fx_pos = pr_residual(measurements, posfix_functions, signal=signal, no_weight=no_weight, no_nans=True) + x = gauss_newton(Fx_pos, x0) + residual, _ = Fx_pos(x, no_weight=True) + return x.tolist(), residual.tolist() + + +def calc_vel_fix(measurements, est_pos, velfix_function=None, v0=None, no_weight=False, signal='D1C', min_measurements=6): + ''' + Calculates gps velocity fix using gauss newton method + returns: + 0 -> list with velocities + 1 -> pseudorange_rate errs + ''' + if v0 is None: + v0 = [0, 0, 0, 0] + + if len(measurements) < min_measurements: + return [], [] + + Fx_vel = prr_residual(measurements, est_pos, velfix_function, signal=signal, no_weight=no_weight, no_nans=True) + v = gauss_newton(Fx_vel, v0) + residual, _ = Fx_vel(v, no_weight=True) + return v.tolist(), residual.tolist() + + +def get_posfix_sympy_fun(constellation): + # Unknowns + x, y, z = sympy.Symbol('x'), sympy.Symbol('y'), sympy.Symbol('z') + bc = sympy.Symbol('bc') + bg = sympy.Symbol('bg') + zero_theta = sympy.Symbol('zero_theta') + var = [x, y, z, bc, bg] + + # Knowns + pr = sympy.Symbol('pr') + sat_x, sat_y, sat_z = sympy.Symbol('sat_x'), sympy.Symbol('sat_y'), sympy.Symbol('sat_z') + weight = sympy.Symbol('weight') + + theta = (EARTH_ROTATION_RATE * (pr - bc) / SPEED_OF_LIGHT)*zero_theta + val = sympy.sqrt( + (sat_x * sympy.cos(theta) + sat_y * sympy.sin(theta) - x) ** 2 + + (sat_y * sympy.cos(theta) - sat_x * sympy.sin(theta) - y) ** 2 + + (sat_z - z) ** 2 + ) + + if constellation == ConstellationId.GLONASS: + res = weight * (val - (pr - bc - bg)) + elif constellation == ConstellationId.GPS: + res = weight * (val - (pr - bc)) + else: + raise NotImplementedError(f"Constellation {constellation} not supported") + + res = [res] + [sympy.diff(res, v) for v in var] + + return sympy.lambdify([x, y, z, bc, bg, pr, zero_theta, sat_x, sat_y, sat_z, weight], res, modules=["numpy"]) + + +def get_velfix_sympy_func(): + # implementing this without sympy.Matrix gives a 2x speedup at generation + + # knowns, receiver position, satellite position, satellite velocity + ep_x, ep_y, ep_z = sympy.Symbol('ep_x'), sympy.Symbol('ep_y'), sympy.Symbol('ep_z') + est_pos = np.array([ep_x, ep_y, ep_z]) + sp_x, sp_y, sp_z = sympy.Symbol('sp_x'), sympy.Symbol('sp_y'), sympy.Symbol('sp_z') + sat_pos = np.array([sp_x, sp_y, sp_z]) + sv_x, sv_y, sv_z = sympy.Symbol('sv_x'), sympy.Symbol('sv_y'), sympy.Symbol('sv_z') + sat_vel = np.array([sv_x, sv_y, sv_z]) + observables = sympy.Symbol('observables') + weight = sympy.Symbol('weight') + + # unknown, receiver velocity + v_x, v_y, v_z = sympy.Symbol('v_x'), sympy.Symbol('v_y'), sympy.Symbol('v_z') + vel = np.array([v_x, v_y, v_z]) + vel_o = sympy.Symbol('vel_o') + + loss = sat_pos - est_pos + loss /= sympy.sqrt(loss.dot(loss)) + + nv = loss.dot(sat_vel - vel) + ov = (observables - vel_o) + res = (nv - ov)*weight + + res = [res] + [sympy.diff(res, v) for v in [v_x, v_y, v_z, vel_o]] + + return sympy.lambdify([ + ep_x, ep_y, ep_z, sp_x, sp_y, sp_z, + sv_x, sv_y, sv_z, observables, weight, + v_x, v_y, v_z, vel_o + ], + res, modules=["numpy"]) + + +def pr_residual(measurements: List[GNSSMeasurement], posfix_functions=None, signal='C1C', no_weight=False, no_nans=False): + + if posfix_functions is None: + posfix_functions = {constellation: get_posfix_sympy_fun(constellation) for constellation in (ConstellationId.GPS, ConstellationId.GLONASS)} + + def Fx_pos(inp, no_weight=no_weight): + vals, gradients = [], [] + + for meas in measurements: + if signal in meas.observables_final and np.isfinite(meas.observables_final[signal]): + pr = meas.observables_final[signal] + sat_pos = meas.sat_pos_final + zero_theta = 0 + elif signal in meas.observables and np.isfinite(meas.observables[signal]) and meas.processed: + pr = meas.observables[signal] + pr += meas.sat_clock_err * SPEED_OF_LIGHT + sat_pos = meas.sat_pos + zero_theta = 1 + else: + if not no_nans: + vals.append(np.nan) + gradients.append(np.nan) + continue + + w = 1.0 if no_weight or meas.observables_std[signal] == 0 else (1 / meas.observables_std[signal]) + val, *gradient = posfix_functions[meas.constellation_id](*inp, pr, zero_theta, *sat_pos, w) + vals.append(val) + gradients.append(gradient) + return np.asarray(vals), np.asarray(gradients) + return Fx_pos + + +def prr_residual(measurements: List[GNSSMeasurement], est_pos, velfix_function=None, signal='D1C', no_weight=False, no_nans=False): + + if velfix_function is None: + velfix_function = get_velfix_sympy_func() + + def Fx_vel(vel, no_weight=no_weight): + vals, gradients = [], [] + + for meas in measurements: + if signal not in meas.observables or not np.isfinite(meas.observables[signal]): + if not no_nans: + vals.append(np.nan) + gradients.append(np.nan) + continue + + sat_pos = meas.sat_pos_final if meas.corrected else meas.sat_pos + weight = 1.0 if no_weight or meas.observables_std[signal] == 0 else (1 / meas.observables_std[signal]) + + val, *gradient = velfix_function(est_pos[0], est_pos[1], est_pos[2], + sat_pos[0], sat_pos[1], sat_pos[2], + meas.sat_vel[0], meas.sat_vel[1], meas.sat_vel[2], + meas.observables[signal], weight, + vel[0], vel[1], vel[2], vel[3]) + vals.append(val) + gradients.append(gradient) + + return np.asarray(vals), np.asarray(gradients) + return Fx_vel diff --git a/laika/raw_gnss.py b/laika/raw_gnss.py index 39eabda45..b1f60ab9b 100644 --- a/laika/raw_gnss.py +++ b/laika/raw_gnss.py @@ -92,11 +92,11 @@ class GNSSMeasurement: self.processed = True return True - def correct(self, est_pos, dog, allow_incomplete_delay=False): + def correct(self, est_pos, dog): for obs in self.observables: if obs[0] == 'C': # or obs[0] == 'L': delay = dog.get_delay(self.prn, self.recv_time, est_pos, signal=obs) - if delay is not None and (allow_incomplete_delay or delay != 0): + if delay is not None: self.observables_final[obs] = (self.observables[obs] + self.sat_clock_err*constants.SPEED_OF_LIGHT - delay) @@ -147,10 +147,10 @@ def process_measurements(measurements: List[GNSSMeasurement], dog) -> List[GNSSM return proc_measurements -def correct_measurements(measurements: List[GNSSMeasurement], est_pos, dog, allow_incomplete_delay=False) -> List[GNSSMeasurement]: +def correct_measurements(measurements: List[GNSSMeasurement], est_pos, dog) -> List[GNSSMeasurement]: corrected_measurements = [] for meas in measurements: - if meas.correct(est_pos, dog, allow_incomplete_delay): + if meas.correct(est_pos, dog): corrected_measurements.append(meas) return corrected_measurements @@ -292,108 +292,6 @@ def read_rinex_obs(obsdata) -> List[List[GNSSMeasurement]]: return measurements -def calc_pos_fix(measurements, x0=[0, 0, 0, 0, 0], no_weight=False, signal='C1C', min_measurements=6): - ''' - Calculates gps fix with WLS optimizer - - returns: - 0 -> list with positions - 1 -> pseudorange errs - ''' - import scipy.optimize as opt # Only use scipy here - - n = len(measurements) - if n < min_measurements: - return [] - - Fx_pos = pr_residual(measurements, signal=signal, no_weight=no_weight, no_nans=True) - opt_pos = opt.least_squares(Fx_pos, x0).x - return opt_pos, Fx_pos(opt_pos, no_weight=True) - - -def calc_vel_fix(measurements, est_pos, v0=[0, 0, 0, 0], no_weight=False, signal='D1C'): - ''' - Calculates gps velocity fix with WLS optimizer - - returns: - 0 -> list with velocities - 1 -> pseudorange_rate errs - ''' - import scipy.optimize as opt # Only use scipy here - - n = len(measurements) - if n < 6: - return [] - - Fx_vel = prr_residual(measurements, est_pos, signal=signal, no_weight=no_weight, no_nans=True) - opt_vel = opt.least_squares(Fx_vel, v0).x - return opt_vel, Fx_vel(opt_vel, no_weight=True) - - -def pr_residual(measurements: List[GNSSMeasurement], signal='C1C', no_weight=False, no_nans=False): - # solve for pos - def Fx_pos(xxx_todo_changeme, no_weight=no_weight): - (x, y, z, bc, bg) = xxx_todo_changeme - rows = [] - - for meas in measurements: - if signal in meas.observables_final and np.isfinite(meas.observables_final[signal]): - pr = meas.observables_final[signal] - sat_pos = meas.sat_pos_final - theta = 0 - elif signal in meas.observables and np.isfinite(meas.observables[signal]) and meas.processed: - pr = meas.observables[signal] - pr += meas.sat_clock_err * constants.SPEED_OF_LIGHT - sat_pos = meas.sat_pos - theta = constants.EARTH_ROTATION_RATE * (pr - bc) / constants.SPEED_OF_LIGHT - else: - if not no_nans: - rows.append(np.nan) - continue - if no_weight: - weight = 1 - else: - weight = (1 / meas.observables_std[signal]) - - val = np.sqrt( - (sat_pos[0] * np.cos(theta) + sat_pos[1] * np.sin(theta) - x) ** 2 + - (sat_pos[1] * np.cos(theta) - sat_pos[0] * np.sin(theta) - y) ** 2 + - (sat_pos[2] - z) ** 2 - ) - if meas.constellation_id == ConstellationId.GLONASS: - rows.append(weight * (val - (pr - bc - bg))) - elif meas.constellation_id == ConstellationId.GPS: - rows.append(weight * (val - (pr - bc))) - return rows - return Fx_pos - - -def prr_residual(measurements, est_pos, signal='D1C', no_weight=False, no_nans=False): - # solve for vel - def Fx_vel(vel, no_weight=no_weight): - rows = [] - for meas in measurements: - if signal not in meas.observables or not np.isfinite(meas.observables[signal]): - if not no_nans: - rows.append(np.nan) - continue - if meas.corrected: - sat_pos = meas.sat_pos_final - else: - sat_pos = meas.sat_pos - if no_weight: - weight = 1 - else: - weight = (1 / meas.observables[signal]) - los_vector = (sat_pos - est_pos[0:3] - ) / np.linalg.norm(sat_pos - est_pos[0:3]) - rows.append( - weight * ((meas.sat_vel - vel[0:3]).dot(los_vector) - - (meas.observables[signal] - vel[3]))) - return rows - return Fx_vel - - def get_Q(recv_pos, sat_positions): local = LocalCoord.from_ecef(recv_pos) sat_positions_rel = local.ecef2ned(sat_positions) diff --git a/laika/trop.py b/laika/trop.py index 8315e91bb..ff224663f 100644 --- a/laika/trop.py +++ b/laika/trop.py @@ -16,7 +16,7 @@ def saast(pos, el, humi=0.75, temp0=15.0): :return: tropospheric delay (m) """ pos_rad = ecef2geodetic(pos, radians=True) - if pos_rad[2] < -100.0 or 1E4 < pos_rad[2] or el <= 0: + if pos_rad[2] < -1E3 or 1E4 < pos_rad[2] or el <= 0: return 0.0 # /* standard atmosphere */ diff --git a/opendbc/Dockerfile b/opendbc/Dockerfile index c992802dc..e075f4fcd 100644 --- a/opendbc/Dockerfile +++ b/opendbc/Dockerfile @@ -46,7 +46,9 @@ ENV PYTHONPATH=/project WORKDIR /project # TODO: Add tag to cereal -RUN git clone https://github.com/commaai/cereal.git /project/cereal && cd /project/cereal && git checkout d46f37c314bb92306207db44693b2f58c31f66b9 +RUN git clone https://github.com/commaai/cereal.git /project/cereal && \ + cd /project/cereal && \ + git checkout 959ff79963b80829be9902d146c31fda44dbbd20 COPY SConstruct . COPY ./site_scons /project/site_scons diff --git a/opendbc/can/common.h b/opendbc/can/common.h index bcd04f65d..ba9ce0234 100644 --- a/opendbc/can/common.h +++ b/opendbc/can/common.h @@ -1,10 +1,11 @@ #pragma once -#include #include +#include +#include #include +#include -#include "common_dbc.h" #include #include @@ -12,6 +13,8 @@ #include "cereal/gen/cpp/log.capnp.h" #endif +#include "opendbc/can/common_dbc.h" + #define INFO printf #define WARN printf #define DEBUG(...) diff --git a/opendbc/can/common.pxd b/opendbc/can/common.pxd index 1d34a2606..c863b65a7 100644 --- a/opendbc/can/common.pxd +++ b/opendbc/can/common.pxd @@ -61,6 +61,7 @@ cdef extern from "common_dbc.h": cdef struct SignalValue: uint32_t address + uint64_t ts_nanos string name double value vector[double] all_values diff --git a/opendbc/can/common_dbc.h b/opendbc/can/common_dbc.h index de95336d8..21399ad0a 100644 --- a/opendbc/can/common_dbc.h +++ b/opendbc/can/common_dbc.h @@ -24,6 +24,7 @@ struct MessageParseOptions { struct SignalValue { uint32_t address; + uint64_t ts_nanos; std::string name; double value; // latest value std::vector all_values; // all values from this cycle diff --git a/opendbc/can/libdbc.so b/opendbc/can/libdbc.so index cb4af2388..f235d741a 100755 Binary files a/opendbc/can/libdbc.so and b/opendbc/can/libdbc.so differ diff --git a/opendbc/can/packer.py b/opendbc/can/packer.py index fc22cce00..024cf3045 100644 --- a/opendbc/can/packer.py +++ b/opendbc/can/packer.py @@ -1,3 +1,2 @@ -# pylint: skip-file -from opendbc.can.packer_pyx import CANPacker +from opendbc.can.packer_pyx import CANPacker # pylint: disable=no-name-in-module, import-error assert CANPacker diff --git a/opendbc/can/packer_pyx.so b/opendbc/can/packer_pyx.so index d28c841fe..529cc820b 100755 Binary files a/opendbc/can/packer_pyx.so and b/opendbc/can/packer_pyx.so differ diff --git a/opendbc/can/parser_pyx.cpp b/opendbc/can/parser_pyx.cpp index 751dc0f2e..c98616dfb 100644 --- a/opendbc/can/parser_pyx.cpp +++ b/opendbc/can/parser_pyx.cpp @@ -980,11 +980,12 @@ struct __pyx_obj_7opendbc_3can_10parser_pyx_CANParser { std::vector can_values; PyObject *vl; PyObject *vl_all; + PyObject *ts_nanos; std::string dbc_name; }; -/* "opendbc/can/parser_pyx.pyx":145 +/* "opendbc/can/parser_pyx.pyx":150 * * * cdef class CANDefine(): # <<<<<<<<<<<<<< @@ -999,7 +1000,7 @@ struct __pyx_obj_7opendbc_3can_10parser_pyx_CANDefine { }; -/* "opendbc/can/parser_pyx.pyx":31 +/* "opendbc/can/parser_pyx.pyx":32 * string dbc_name * * def __init__(self, dbc_name, signals, checks=None, bus=0, enforce_checks=True): # <<<<<<<<<<<<<< @@ -1014,7 +1015,7 @@ struct __pyx_obj_7opendbc_3can_10parser_pyx___pyx_scope_struct____init__ { }; -/* "opendbc/can/parser_pyx.pyx":83 +/* "opendbc/can/parser_pyx.pyx":87 * unchecked = signal_addrs - checked_addrs * if len(unchecked): * err_msg = ', '.join(f"{self.address_to_msg_name[addr].decode()} ({hex(addr)})" for addr in unchecked) # <<<<<<<<<<<<<< @@ -1028,7 +1029,7 @@ struct __pyx_obj_7opendbc_3can_10parser_pyx___pyx_scope_struct_1_genexpr { }; -/* "opendbc/can/parser_pyx.pyx":93 +/* "opendbc/can/parser_pyx.pyx":97 * signal_options_v.push_back(spo) * * message_options = dict((address, 0) for _, address in signals) # <<<<<<<<<<<<<< @@ -1621,6 +1622,9 @@ static CYTHON_INLINE uint32_t __Pyx_PyInt_As_uint32_t(PyObject *); /* CIntFromPy.proto */ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint64_t(uint64_t value); + /* CIntFromPy.proto */ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); @@ -1919,6 +1923,7 @@ static PyObject *__pyx_pf_7opendbc_3can_10parser_pyx_9CANParser_9can_valid___get static PyObject *__pyx_pf_7opendbc_3can_10parser_pyx_9CANParser_11bus_timeout___get__(struct __pyx_obj_7opendbc_3can_10parser_pyx_CANParser *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_7opendbc_3can_10parser_pyx_9CANParser_2vl___get__(struct __pyx_obj_7opendbc_3can_10parser_pyx_CANParser *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_7opendbc_3can_10parser_pyx_9CANParser_6vl_all___get__(struct __pyx_obj_7opendbc_3can_10parser_pyx_CANParser *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7opendbc_3can_10parser_pyx_9CANParser_8ts_nanos___get__(struct __pyx_obj_7opendbc_3can_10parser_pyx_CANParser *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_7opendbc_3can_10parser_pyx_9CANParser_8dbc_name___get__(struct __pyx_obj_7opendbc_3can_10parser_pyx_CANParser *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_7opendbc_3can_10parser_pyx_9CANParser_6__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7opendbc_3can_10parser_pyx_CANParser *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_7opendbc_3can_10parser_pyx_9CANParser_8__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7opendbc_3can_10parser_pyx_CANParser *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ @@ -1948,7 +1953,7 @@ static PyObject *__pyx_tuple__9; static PyObject *__pyx_tuple__10; /* Late includes */ -/* "opendbc/can/parser_pyx.pyx":31 +/* "opendbc/can/parser_pyx.pyx":32 * string dbc_name * * def __init__(self, dbc_name, signals, checks=None, bus=0, enforce_checks=True): # <<<<<<<<<<<<<< @@ -2002,7 +2007,7 @@ static int __pyx_pw_7opendbc_3can_10parser_pyx_9CANParser_1__init__(PyObject *__ case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_signals)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 5, 1); __PYX_ERR(0, 31, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 5, 1); __PYX_ERR(0, 32, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: @@ -2024,7 +2029,7 @@ static int __pyx_pw_7opendbc_3can_10parser_pyx_9CANParser_1__init__(PyObject *__ } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 31, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 32, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -2048,7 +2053,7 @@ static int __pyx_pw_7opendbc_3can_10parser_pyx_9CANParser_1__init__(PyObject *__ } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 31, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 32, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("opendbc.can.parser_pyx.CANParser.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -2062,7 +2067,7 @@ static int __pyx_pw_7opendbc_3can_10parser_pyx_9CANParser_1__init__(PyObject *__ } static PyObject *__pyx_gb_7opendbc_3can_10parser_pyx_9CANParser_8__init___2generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ -/* "opendbc/can/parser_pyx.pyx":83 +/* "opendbc/can/parser_pyx.pyx":87 * unchecked = signal_addrs - checked_addrs * if len(unchecked): * err_msg = ', '.join(f"{self.address_to_msg_name[addr].decode()} ({hex(addr)})" for addr in unchecked) # <<<<<<<<<<<<<< @@ -2082,7 +2087,7 @@ static PyObject *__pyx_pf_7opendbc_3can_10parser_pyx_9CANParser_8__init___genexp if (unlikely(!__pyx_cur_scope)) { __pyx_cur_scope = ((struct __pyx_obj_7opendbc_3can_10parser_pyx___pyx_scope_struct_1_genexpr *)Py_None); __Pyx_INCREF(Py_None); - __PYX_ERR(0, 83, __pyx_L1_error) + __PYX_ERR(0, 87, __pyx_L1_error) } else { __Pyx_GOTREF(__pyx_cur_scope); } @@ -2090,7 +2095,7 @@ static PyObject *__pyx_pf_7opendbc_3can_10parser_pyx_9CANParser_8__init___genexp __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope)); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope); { - __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_7opendbc_3can_10parser_pyx_9CANParser_8__init___2generator, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_init___locals_genexpr, __pyx_n_s_opendbc_can_parser_pyx); if (unlikely(!gen)) __PYX_ERR(0, 83, __pyx_L1_error) + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_7opendbc_3can_10parser_pyx_9CANParser_8__init___2generator, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_init___locals_genexpr, __pyx_n_s_opendbc_can_parser_pyx); if (unlikely(!gen)) __PYX_ERR(0, 87, __pyx_L1_error) __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -2131,34 +2136,34 @@ static PyObject *__pyx_gb_7opendbc_3can_10parser_pyx_9CANParser_8__init___2gener return NULL; } __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 83, __pyx_L1_error) - __pyx_r = PyList_New(0); if (unlikely(!__pyx_r)) __PYX_ERR(0, 83, __pyx_L1_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 87, __pyx_L1_error) + __pyx_r = PyList_New(0); if (unlikely(!__pyx_r)) __PYX_ERR(0, 87, __pyx_L1_error) __Pyx_GOTREF(__pyx_r); - if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_unchecked)) { __Pyx_RaiseClosureNameError("unchecked"); __PYX_ERR(0, 83, __pyx_L1_error) } + if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_unchecked)) { __Pyx_RaiseClosureNameError("unchecked"); __PYX_ERR(0, 87, __pyx_L1_error) } if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_unchecked)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_unchecked)) { __pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_unchecked; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; __pyx_t_3 = NULL; } else { - __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_unchecked); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 83, __pyx_L1_error) + __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_unchecked); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 87, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 83, __pyx_L1_error) + __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 87, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_3)) { if (likely(PyList_CheckExact(__pyx_t_1))) { if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 83, __pyx_L1_error) + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 87, __pyx_L1_error) #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 83, __pyx_L1_error) + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 87, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #endif } else { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 83, __pyx_L1_error) + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 87, __pyx_L1_error) #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 83, __pyx_L1_error) + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 87, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #endif } @@ -2168,7 +2173,7 @@ static PyObject *__pyx_gb_7opendbc_3can_10parser_pyx_9CANParser_8__init___2gener PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 83, __pyx_L1_error) + else __PYX_ERR(0, 87, __pyx_L1_error) } break; } @@ -2178,13 +2183,13 @@ static PyObject *__pyx_gb_7opendbc_3can_10parser_pyx_9CANParser_8__init___2gener __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_addr, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 83, __pyx_L1_error) + __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 87, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = 0; __pyx_t_6 = 127; - if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 83, __pyx_L1_error) } - __pyx_t_7 = __Pyx_PyInt_As_uint32_t(__pyx_cur_scope->__pyx_v_addr); if (unlikely((__pyx_t_7 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 83, __pyx_L1_error) - __pyx_t_8 = __Pyx_decode_cpp_string((__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self->address_to_msg_name[__pyx_t_7]), 0, PY_SSIZE_T_MAX, NULL, NULL, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 83, __pyx_L1_error) + if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 87, __pyx_L1_error) } + __pyx_t_7 = __Pyx_PyInt_As_uint32_t(__pyx_cur_scope->__pyx_v_addr); if (unlikely((__pyx_t_7 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 87, __pyx_L1_error) + __pyx_t_8 = __Pyx_decode_cpp_string((__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self->address_to_msg_name[__pyx_t_7]), 0, PY_SSIZE_T_MAX, NULL, NULL, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 87, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_6 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) > __pyx_t_6) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) : __pyx_t_6; __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8); @@ -2195,9 +2200,9 @@ static PyObject *__pyx_gb_7opendbc_3can_10parser_pyx_9CANParser_8__init___2gener __pyx_t_5 += 2; __Pyx_GIVEREF(__pyx_kp_u_); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_kp_u_); - __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_builtin_hex, __pyx_cur_scope->__pyx_v_addr); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 83, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_builtin_hex, __pyx_cur_scope->__pyx_v_addr); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 87, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = __Pyx_PyObject_FormatSimple(__pyx_t_8, __pyx_empty_unicode); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 83, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_FormatSimple(__pyx_t_8, __pyx_empty_unicode); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 87, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_6 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_9) > __pyx_t_6) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_9) : __pyx_t_6; @@ -2209,10 +2214,10 @@ static PyObject *__pyx_gb_7opendbc_3can_10parser_pyx_9CANParser_8__init___2gener __pyx_t_5 += 1; __Pyx_GIVEREF(__pyx_kp_u__2); PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_kp_u__2); - __pyx_t_9 = __Pyx_PyUnicode_Join(__pyx_t_4, 4, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 83, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyUnicode_Join(__pyx_t_4, 4, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 87, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(__Pyx_ListComp_Append(__pyx_r, (PyObject*)__pyx_t_9))) __PYX_ERR(0, 83, __pyx_L1_error) + if (unlikely(__Pyx_ListComp_Append(__pyx_r, (PyObject*)__pyx_t_9))) __PYX_ERR(0, 87, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -2239,7 +2244,7 @@ static PyObject *__pyx_gb_7opendbc_3can_10parser_pyx_9CANParser_8__init___2gener } static PyObject *__pyx_gb_7opendbc_3can_10parser_pyx_9CANParser_8__init___5generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ -/* "opendbc/can/parser_pyx.pyx":93 +/* "opendbc/can/parser_pyx.pyx":97 * signal_options_v.push_back(spo) * * message_options = dict((address, 0) for _, address in signals) # <<<<<<<<<<<<<< @@ -2259,7 +2264,7 @@ static PyObject *__pyx_pf_7opendbc_3can_10parser_pyx_9CANParser_8__init___3genex if (unlikely(!__pyx_cur_scope)) { __pyx_cur_scope = ((struct __pyx_obj_7opendbc_3can_10parser_pyx___pyx_scope_struct_2_genexpr *)Py_None); __Pyx_INCREF(Py_None); - __PYX_ERR(0, 93, __pyx_L1_error) + __PYX_ERR(0, 97, __pyx_L1_error) } else { __Pyx_GOTREF(__pyx_cur_scope); } @@ -2267,7 +2272,7 @@ static PyObject *__pyx_pf_7opendbc_3can_10parser_pyx_9CANParser_8__init___3genex __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope)); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope); { - __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_7opendbc_3can_10parser_pyx_9CANParser_8__init___5generator1, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_init___locals_genexpr, __pyx_n_s_opendbc_can_parser_pyx); if (unlikely(!gen)) __PYX_ERR(0, 93, __pyx_L1_error) + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_7opendbc_3can_10parser_pyx_9CANParser_8__init___5generator1, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_init___locals_genexpr, __pyx_n_s_opendbc_can_parser_pyx); if (unlikely(!gen)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -2307,34 +2312,34 @@ static PyObject *__pyx_gb_7opendbc_3can_10parser_pyx_9CANParser_8__init___5gener return NULL; } __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 93, __pyx_L1_error) - __pyx_r = PyDict_New(); if (unlikely(!__pyx_r)) __PYX_ERR(0, 93, __pyx_L1_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 97, __pyx_L1_error) + __pyx_r = PyDict_New(); if (unlikely(!__pyx_r)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_GOTREF(__pyx_r); - if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_signals)) { __Pyx_RaiseClosureNameError("signals"); __PYX_ERR(0, 93, __pyx_L1_error) } + if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_signals)) { __Pyx_RaiseClosureNameError("signals"); __PYX_ERR(0, 97, __pyx_L1_error) } if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_signals)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_signals)) { __pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_signals; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; __pyx_t_3 = NULL; } else { - __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_signals); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 93, __pyx_L1_error) + __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_signals); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 93, __pyx_L1_error) + __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 97, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_3)) { if (likely(PyList_CheckExact(__pyx_t_1))) { if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 93, __pyx_L1_error) + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 97, __pyx_L1_error) #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 93, __pyx_L1_error) + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #endif } else { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 93, __pyx_L1_error) + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 97, __pyx_L1_error) #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 93, __pyx_L1_error) + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #endif } @@ -2344,7 +2349,7 @@ static PyObject *__pyx_gb_7opendbc_3can_10parser_pyx_9CANParser_8__init___5gener PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 93, __pyx_L1_error) + else __PYX_ERR(0, 97, __pyx_L1_error) } break; } @@ -2356,7 +2361,7 @@ static PyObject *__pyx_gb_7opendbc_3can_10parser_pyx_9CANParser_8__init___5gener if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 93, __pyx_L1_error) + __PYX_ERR(0, 97, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -2369,15 +2374,15 @@ static PyObject *__pyx_gb_7opendbc_3can_10parser_pyx_9CANParser_8__init___5gener __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(__pyx_t_6); #else - __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 93, __pyx_L1_error) + __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 93, __pyx_L1_error) + __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); #endif __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else { Py_ssize_t index = -1; - __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 93, __pyx_L1_error) + __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext; @@ -2385,7 +2390,7 @@ static PyObject *__pyx_gb_7opendbc_3can_10parser_pyx_9CANParser_8__init___5gener __Pyx_GOTREF(__pyx_t_5); index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L6_unpacking_failed; __Pyx_GOTREF(__pyx_t_6); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 93, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 97, __pyx_L1_error) __pyx_t_8 = NULL; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; goto __pyx_L7_unpacking_done; @@ -2393,7 +2398,7 @@ static PyObject *__pyx_gb_7opendbc_3can_10parser_pyx_9CANParser_8__init___5gener __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_8 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 93, __pyx_L1_error) + __PYX_ERR(0, 97, __pyx_L1_error) __pyx_L7_unpacking_done:; } __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v__); @@ -2404,7 +2409,7 @@ static PyObject *__pyx_gb_7opendbc_3can_10parser_pyx_9CANParser_8__init___5gener __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_address, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(PyDict_SetItem(__pyx_r, (PyObject*)__pyx_cur_scope->__pyx_v_address, (PyObject*)__pyx_int_0))) __PYX_ERR(0, 93, __pyx_L1_error) + if (unlikely(PyDict_SetItem(__pyx_r, (PyObject*)__pyx_cur_scope->__pyx_v_address, (PyObject*)__pyx_int_0))) __PYX_ERR(0, 97, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); @@ -2430,7 +2435,7 @@ static PyObject *__pyx_gb_7opendbc_3can_10parser_pyx_9CANParser_8__init___5gener return __pyx_r; } -/* "opendbc/can/parser_pyx.pyx":31 +/* "opendbc/can/parser_pyx.pyx":32 * string dbc_name * * def __init__(self, dbc_name, signals, checks=None, bus=0, enforce_checks=True): # <<<<<<<<<<<<<< @@ -2492,7 +2497,7 @@ static int __pyx_pf_7opendbc_3can_10parser_pyx_9CANParser___init__(struct __pyx_ if (unlikely(!__pyx_cur_scope)) { __pyx_cur_scope = ((struct __pyx_obj_7opendbc_3can_10parser_pyx___pyx_scope_struct____init__ *)Py_None); __Pyx_INCREF(Py_None); - __PYX_ERR(0, 31, __pyx_L1_error) + __PYX_ERR(0, 32, __pyx_L1_error) } else { __Pyx_GOTREF(__pyx_cur_scope); } @@ -2505,7 +2510,7 @@ static int __pyx_pf_7opendbc_3can_10parser_pyx_9CANParser___init__(struct __pyx_ __Pyx_INCREF(__pyx_v_checks); __Pyx_INCREF(__pyx_v_enforce_checks); - /* "opendbc/can/parser_pyx.pyx":32 + /* "opendbc/can/parser_pyx.pyx":33 * * def __init__(self, dbc_name, signals, checks=None, bus=0, enforce_checks=True): * if checks is None: # <<<<<<<<<<<<<< @@ -2516,19 +2521,19 @@ static int __pyx_pf_7opendbc_3can_10parser_pyx_9CANParser___init__(struct __pyx_ __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "opendbc/can/parser_pyx.pyx":33 + /* "opendbc/can/parser_pyx.pyx":34 * def __init__(self, dbc_name, signals, checks=None, bus=0, enforce_checks=True): * if checks is None: * checks = [] # <<<<<<<<<<<<<< * * self.dbc_name = dbc_name */ - __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 33, __pyx_L1_error) + __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 34, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF_SET(__pyx_v_checks, __pyx_t_3); __pyx_t_3 = 0; - /* "opendbc/can/parser_pyx.pyx":32 + /* "opendbc/can/parser_pyx.pyx":33 * * def __init__(self, dbc_name, signals, checks=None, bus=0, enforce_checks=True): * if checks is None: # <<<<<<<<<<<<<< @@ -2537,27 +2542,27 @@ static int __pyx_pf_7opendbc_3can_10parser_pyx_9CANParser___init__(struct __pyx_ */ } - /* "opendbc/can/parser_pyx.pyx":35 + /* "opendbc/can/parser_pyx.pyx":36 * checks = [] * * self.dbc_name = dbc_name # <<<<<<<<<<<<<< * self.dbc = dbc_lookup(dbc_name) * if not self.dbc: */ - __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_v_dbc_name); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 35, __pyx_L1_error) + __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_v_dbc_name); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 36, __pyx_L1_error) __pyx_cur_scope->__pyx_v_self->dbc_name = __pyx_t_4; - /* "opendbc/can/parser_pyx.pyx":36 + /* "opendbc/can/parser_pyx.pyx":37 * * self.dbc_name = dbc_name * self.dbc = dbc_lookup(dbc_name) # <<<<<<<<<<<<<< * if not self.dbc: * raise RuntimeError(f"Can't find DBC: {dbc_name}") */ - __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_v_dbc_name); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 36, __pyx_L1_error) + __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_v_dbc_name); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 37, __pyx_L1_error) __pyx_cur_scope->__pyx_v_self->dbc = dbc_lookup(__pyx_t_4); - /* "opendbc/can/parser_pyx.pyx":37 + /* "opendbc/can/parser_pyx.pyx":38 * self.dbc_name = dbc_name * self.dbc = dbc_lookup(dbc_name) * if not self.dbc: # <<<<<<<<<<<<<< @@ -2567,26 +2572,26 @@ static int __pyx_pf_7opendbc_3can_10parser_pyx_9CANParser___init__(struct __pyx_ __pyx_t_2 = ((!(__pyx_cur_scope->__pyx_v_self->dbc != 0)) != 0); if (unlikely(__pyx_t_2)) { - /* "opendbc/can/parser_pyx.pyx":38 + /* "opendbc/can/parser_pyx.pyx":39 * self.dbc = dbc_lookup(dbc_name) * if not self.dbc: * raise RuntimeError(f"Can't find DBC: {dbc_name}") # <<<<<<<<<<<<<< * * # dp - disable checks */ - __pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_v_dbc_name, __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 38, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_v_dbc_name, __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 39, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Can_t_find_DBC, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 38, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Can_t_find_DBC, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 39, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 38, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 39, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(0, 38, __pyx_L1_error) + __PYX_ERR(0, 39, __pyx_L1_error) - /* "opendbc/can/parser_pyx.pyx":37 + /* "opendbc/can/parser_pyx.pyx":38 * self.dbc_name = dbc_name * self.dbc = dbc_lookup(dbc_name) * if not self.dbc: # <<<<<<<<<<<<<< @@ -2595,19 +2600,19 @@ static int __pyx_pf_7opendbc_3can_10parser_pyx_9CANParser___init__(struct __pyx_ */ } - /* "opendbc/can/parser_pyx.pyx":41 + /* "opendbc/can/parser_pyx.pyx":42 * * # dp - disable checks * checks = [] # <<<<<<<<<<<<<< * enforce_checks = False * */ - __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 41, __pyx_L1_error) + __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 42, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF_SET(__pyx_v_checks, __pyx_t_3); __pyx_t_3 = 0; - /* "opendbc/can/parser_pyx.pyx":42 + /* "opendbc/can/parser_pyx.pyx":43 * # dp - disable checks * checks = [] * enforce_checks = False # <<<<<<<<<<<<<< @@ -2617,14 +2622,14 @@ static int __pyx_pf_7opendbc_3can_10parser_pyx_9CANParser___init__(struct __pyx_ __Pyx_INCREF(Py_False); __Pyx_DECREF_SET(__pyx_v_enforce_checks, Py_False); - /* "opendbc/can/parser_pyx.pyx":44 + /* "opendbc/can/parser_pyx.pyx":45 * enforce_checks = False * * self.vl = {} # <<<<<<<<<<<<<< * self.vl_all = {} - * msg_name_to_address = {} + * self.ts_nanos = {} */ - __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 44, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 45, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->vl); @@ -2632,14 +2637,14 @@ static int __pyx_pf_7opendbc_3can_10parser_pyx_9CANParser___init__(struct __pyx_ __pyx_cur_scope->__pyx_v_self->vl = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; - /* "opendbc/can/parser_pyx.pyx":45 + /* "opendbc/can/parser_pyx.pyx":46 * * self.vl = {} * self.vl_all = {} # <<<<<<<<<<<<<< + * self.ts_nanos = {} * msg_name_to_address = {} - * */ - __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 45, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 46, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->vl_all); @@ -2647,19 +2652,34 @@ static int __pyx_pf_7opendbc_3can_10parser_pyx_9CANParser___init__(struct __pyx_ __pyx_cur_scope->__pyx_v_self->vl_all = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; - /* "opendbc/can/parser_pyx.pyx":46 + /* "opendbc/can/parser_pyx.pyx":47 * self.vl = {} * self.vl_all = {} + * self.ts_nanos = {} # <<<<<<<<<<<<<< + * msg_name_to_address = {} + * + */ + __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 47, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->ts_nanos); + __Pyx_DECREF(__pyx_cur_scope->__pyx_v_self->ts_nanos); + __pyx_cur_scope->__pyx_v_self->ts_nanos = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + + /* "opendbc/can/parser_pyx.pyx":48 + * self.vl_all = {} + * self.ts_nanos = {} * msg_name_to_address = {} # <<<<<<<<<<<<<< * * for i in range(self.dbc[0].msgs.size()): */ - __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 46, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 48, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_v_msg_name_to_address = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; - /* "opendbc/can/parser_pyx.pyx":48 + /* "opendbc/can/parser_pyx.pyx":50 * msg_name_to_address = {} * * for i in range(self.dbc[0].msgs.size()): # <<<<<<<<<<<<<< @@ -2671,7 +2691,7 @@ static int __pyx_pf_7opendbc_3can_10parser_pyx_9CANParser___init__(struct __pyx_ for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { __pyx_v_i = __pyx_t_8; - /* "opendbc/can/parser_pyx.pyx":49 + /* "opendbc/can/parser_pyx.pyx":51 * * for i in range(self.dbc[0].msgs.size()): * msg = self.dbc[0].msgs[i] # <<<<<<<<<<<<<< @@ -2680,60 +2700,60 @@ static int __pyx_pf_7opendbc_3can_10parser_pyx_9CANParser___init__(struct __pyx_ */ __pyx_v_msg = ((__pyx_cur_scope->__pyx_v_self->dbc[0]).msgs[__pyx_v_i]); - /* "opendbc/can/parser_pyx.pyx":50 + /* "opendbc/can/parser_pyx.pyx":52 * for i in range(self.dbc[0].msgs.size()): * msg = self.dbc[0].msgs[i] * name = msg.name.decode('utf8') # <<<<<<<<<<<<<< * * msg_name_to_address[name] = msg.address */ - __pyx_t_3 = __Pyx_decode_cpp_string(__pyx_v_msg.name, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 50, __pyx_L1_error) + __pyx_t_3 = __Pyx_decode_cpp_string(__pyx_v_msg.name, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 52, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_3); __pyx_t_3 = 0; - /* "opendbc/can/parser_pyx.pyx":52 + /* "opendbc/can/parser_pyx.pyx":54 * name = msg.name.decode('utf8') * * msg_name_to_address[name] = msg.address # <<<<<<<<<<<<<< * self.address_to_msg_name[msg.address] = name * self.vl[msg.address] = {} */ - __pyx_t_3 = __Pyx_PyInt_From_uint32_t(__pyx_v_msg.address); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 52, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_uint32_t(__pyx_v_msg.address); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 54, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (unlikely(PyDict_SetItem(__pyx_v_msg_name_to_address, __pyx_v_name, __pyx_t_3) < 0)) __PYX_ERR(0, 52, __pyx_L1_error) + if (unlikely(PyDict_SetItem(__pyx_v_msg_name_to_address, __pyx_v_name, __pyx_t_3) < 0)) __PYX_ERR(0, 54, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "opendbc/can/parser_pyx.pyx":53 + /* "opendbc/can/parser_pyx.pyx":55 * * msg_name_to_address[name] = msg.address * self.address_to_msg_name[msg.address] = name # <<<<<<<<<<<<<< * self.vl[msg.address] = {} * self.vl[name] = self.vl[msg.address] */ - __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_v_name); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 53, __pyx_L1_error) + __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_v_name); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 55, __pyx_L1_error) (__pyx_cur_scope->__pyx_v_self->address_to_msg_name[__pyx_v_msg.address]) = __pyx_t_4; - /* "opendbc/can/parser_pyx.pyx":54 + /* "opendbc/can/parser_pyx.pyx":56 * msg_name_to_address[name] = msg.address * self.address_to_msg_name[msg.address] = name * self.vl[msg.address] = {} # <<<<<<<<<<<<<< * self.vl[name] = self.vl[msg.address] * self.vl_all[msg.address] = defaultdict(list) */ - __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 54, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (unlikely(__pyx_cur_scope->__pyx_v_self->vl == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 54, __pyx_L1_error) + __PYX_ERR(0, 56, __pyx_L1_error) } - __pyx_t_5 = __Pyx_PyInt_From_uint32_t(__pyx_v_msg.address); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 54, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyInt_From_uint32_t(__pyx_v_msg.address); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - if (unlikely(PyDict_SetItem(__pyx_cur_scope->__pyx_v_self->vl, __pyx_t_5, __pyx_t_3) < 0)) __PYX_ERR(0, 54, __pyx_L1_error) + if (unlikely(PyDict_SetItem(__pyx_cur_scope->__pyx_v_self->vl, __pyx_t_5, __pyx_t_3) < 0)) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "opendbc/can/parser_pyx.pyx":55 + /* "opendbc/can/parser_pyx.pyx":57 * self.address_to_msg_name[msg.address] = name * self.vl[msg.address] = {} * self.vl[name] = self.vl[msg.address] # <<<<<<<<<<<<<< @@ -2742,28 +2762,28 @@ static int __pyx_pf_7opendbc_3can_10parser_pyx_9CANParser___init__(struct __pyx_ */ if (unlikely(__pyx_cur_scope->__pyx_v_self->vl == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 55, __pyx_L1_error) + __PYX_ERR(0, 57, __pyx_L1_error) } - __pyx_t_3 = __Pyx_PyInt_From_uint32_t(__pyx_v_msg.address); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 55, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_uint32_t(__pyx_v_msg.address); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 57, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyDict_GetItem(__pyx_cur_scope->__pyx_v_self->vl, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 55, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyDict_GetItem(__pyx_cur_scope->__pyx_v_self->vl, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 57, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(__pyx_cur_scope->__pyx_v_self->vl == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 55, __pyx_L1_error) + __PYX_ERR(0, 57, __pyx_L1_error) } - if (unlikely(PyDict_SetItem(__pyx_cur_scope->__pyx_v_self->vl, __pyx_v_name, __pyx_t_5) < 0)) __PYX_ERR(0, 55, __pyx_L1_error) + if (unlikely(PyDict_SetItem(__pyx_cur_scope->__pyx_v_self->vl, __pyx_v_name, __pyx_t_5) < 0)) __PYX_ERR(0, 57, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "opendbc/can/parser_pyx.pyx":56 + /* "opendbc/can/parser_pyx.pyx":58 * self.vl[msg.address] = {} * self.vl[name] = self.vl[msg.address] * self.vl_all[msg.address] = defaultdict(list) # <<<<<<<<<<<<<< * self.vl_all[name] = self.vl_all[msg.address] - * + * self.ts_nanos[msg.address] = {} */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_defaultdict); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_defaultdict); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_9 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { @@ -2777,121 +2797,163 @@ static int __pyx_pf_7opendbc_3can_10parser_pyx_9CANParser___init__(struct __pyx_ } __pyx_t_5 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_9, ((PyObject *)(&PyList_Type))) : __Pyx_PyObject_CallOneArg(__pyx_t_3, ((PyObject *)(&PyList_Type))); __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 56, __pyx_L1_error) + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(__pyx_cur_scope->__pyx_v_self->vl_all == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 56, __pyx_L1_error) + __PYX_ERR(0, 58, __pyx_L1_error) } - __pyx_t_3 = __Pyx_PyInt_From_uint32_t(__pyx_v_msg.address); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 56, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_uint32_t(__pyx_v_msg.address); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (unlikely(PyDict_SetItem(__pyx_cur_scope->__pyx_v_self->vl_all, __pyx_t_3, __pyx_t_5) < 0)) __PYX_ERR(0, 56, __pyx_L1_error) + if (unlikely(PyDict_SetItem(__pyx_cur_scope->__pyx_v_self->vl_all, __pyx_t_3, __pyx_t_5) < 0)) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "opendbc/can/parser_pyx.pyx":57 + /* "opendbc/can/parser_pyx.pyx":59 * self.vl[name] = self.vl[msg.address] * self.vl_all[msg.address] = defaultdict(list) * self.vl_all[name] = self.vl_all[msg.address] # <<<<<<<<<<<<<< - * - * # Convert message names into addresses + * self.ts_nanos[msg.address] = {} + * self.ts_nanos[name] = self.ts_nanos[msg.address] */ if (unlikely(__pyx_cur_scope->__pyx_v_self->vl_all == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 57, __pyx_L1_error) + __PYX_ERR(0, 59, __pyx_L1_error) } - __pyx_t_5 = __Pyx_PyInt_From_uint32_t(__pyx_v_msg.address); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 57, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyInt_From_uint32_t(__pyx_v_msg.address); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 59, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_cur_scope->__pyx_v_self->vl_all, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 57, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_cur_scope->__pyx_v_self->vl_all, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 59, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(__pyx_cur_scope->__pyx_v_self->vl_all == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 57, __pyx_L1_error) + __PYX_ERR(0, 59, __pyx_L1_error) } - if (unlikely(PyDict_SetItem(__pyx_cur_scope->__pyx_v_self->vl_all, __pyx_v_name, __pyx_t_3) < 0)) __PYX_ERR(0, 57, __pyx_L1_error) + if (unlikely(PyDict_SetItem(__pyx_cur_scope->__pyx_v_self->vl_all, __pyx_v_name, __pyx_t_3) < 0)) __PYX_ERR(0, 59, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "opendbc/can/parser_pyx.pyx":60 + * self.vl_all[msg.address] = defaultdict(list) + * self.vl_all[name] = self.vl_all[msg.address] + * self.ts_nanos[msg.address] = {} # <<<<<<<<<<<<<< + * self.ts_nanos[name] = self.ts_nanos[msg.address] + * + */ + __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 60, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (unlikely(__pyx_cur_scope->__pyx_v_self->ts_nanos == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 60, __pyx_L1_error) + } + __pyx_t_5 = __Pyx_PyInt_From_uint32_t(__pyx_v_msg.address); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 60, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (unlikely(PyDict_SetItem(__pyx_cur_scope->__pyx_v_self->ts_nanos, __pyx_t_5, __pyx_t_3) < 0)) __PYX_ERR(0, 60, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "opendbc/can/parser_pyx.pyx":61 + * self.vl_all[name] = self.vl_all[msg.address] + * self.ts_nanos[msg.address] = {} + * self.ts_nanos[name] = self.ts_nanos[msg.address] # <<<<<<<<<<<<<< + * + * # Convert message names into addresses + */ + if (unlikely(__pyx_cur_scope->__pyx_v_self->ts_nanos == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 61, __pyx_L1_error) + } + __pyx_t_3 = __Pyx_PyInt_From_uint32_t(__pyx_v_msg.address); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 61, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyDict_GetItem(__pyx_cur_scope->__pyx_v_self->ts_nanos, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 61, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(__pyx_cur_scope->__pyx_v_self->ts_nanos == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 61, __pyx_L1_error) + } + if (unlikely(PyDict_SetItem(__pyx_cur_scope->__pyx_v_self->ts_nanos, __pyx_v_name, __pyx_t_5) < 0)) __PYX_ERR(0, 61, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } - /* "opendbc/can/parser_pyx.pyx":60 + /* "opendbc/can/parser_pyx.pyx":64 * * # Convert message names into addresses * for i in range(len(signals)): # <<<<<<<<<<<<<< * s = signals[i] * if not isinstance(s[1], numbers.Number): */ - __pyx_t_3 = __pyx_cur_scope->__pyx_v_signals; - __Pyx_INCREF(__pyx_t_3); - __pyx_t_10 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 60, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __pyx_cur_scope->__pyx_v_signals; + __Pyx_INCREF(__pyx_t_5); + __pyx_t_10 = PyObject_Length(__pyx_t_5); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 64, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_11 = __pyx_t_10; for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_11; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; - /* "opendbc/can/parser_pyx.pyx":61 + /* "opendbc/can/parser_pyx.pyx":65 * # Convert message names into addresses * for i in range(len(signals)): * s = signals[i] # <<<<<<<<<<<<<< * if not isinstance(s[1], numbers.Number): * if name not in msg_name_to_address: */ - __pyx_t_3 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_signals, __pyx_v_i, std::vector ::size_type, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 61, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_XDECREF_SET(__pyx_v_s, __pyx_t_3); - __pyx_t_3 = 0; + __pyx_t_5 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_signals, __pyx_v_i, std::vector ::size_type, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 65, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_XDECREF_SET(__pyx_v_s, __pyx_t_5); + __pyx_t_5 = 0; - /* "opendbc/can/parser_pyx.pyx":62 + /* "opendbc/can/parser_pyx.pyx":66 * for i in range(len(signals)): * s = signals[i] * if not isinstance(s[1], numbers.Number): # <<<<<<<<<<<<<< * if name not in msg_name_to_address: * print(msg_name_to_address) */ - __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_s, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 62, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_numbers); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 62, __pyx_L1_error) + __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_s, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 66, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_Number); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 62, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_numbers); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 66, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_Number); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 66, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_2 = PyObject_IsInstance(__pyx_t_3, __pyx_t_9); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 62, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = PyObject_IsInstance(__pyx_t_5, __pyx_t_9); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 66, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_1 = ((!(__pyx_t_2 != 0)) != 0); if (__pyx_t_1) { - /* "opendbc/can/parser_pyx.pyx":63 + /* "opendbc/can/parser_pyx.pyx":67 * s = signals[i] * if not isinstance(s[1], numbers.Number): * if name not in msg_name_to_address: # <<<<<<<<<<<<<< * print(msg_name_to_address) * raise RuntimeError(f"could not find message {repr(name)} in DBC {self.dbc_name}") */ - if (unlikely(!__pyx_v_name)) { __Pyx_RaiseUnboundLocalError("name"); __PYX_ERR(0, 63, __pyx_L1_error) } - __pyx_t_1 = (__Pyx_PyDict_ContainsTF(__pyx_v_name, __pyx_v_msg_name_to_address, Py_NE)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 63, __pyx_L1_error) + if (unlikely(!__pyx_v_name)) { __Pyx_RaiseUnboundLocalError("name"); __PYX_ERR(0, 67, __pyx_L1_error) } + __pyx_t_1 = (__Pyx_PyDict_ContainsTF(__pyx_v_name, __pyx_v_msg_name_to_address, Py_NE)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 67, __pyx_L1_error) __pyx_t_2 = (__pyx_t_1 != 0); if (unlikely(__pyx_t_2)) { - /* "opendbc/can/parser_pyx.pyx":64 + /* "opendbc/can/parser_pyx.pyx":68 * if not isinstance(s[1], numbers.Number): * if name not in msg_name_to_address: * print(msg_name_to_address) # <<<<<<<<<<<<<< * raise RuntimeError(f"could not find message {repr(name)} in DBC {self.dbc_name}") * s = (s[0], msg_name_to_address[s[1]]) */ - __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_builtin_print, __pyx_v_msg_name_to_address); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 64, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_builtin_print, __pyx_v_msg_name_to_address); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 68, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "opendbc/can/parser_pyx.pyx":65 + /* "opendbc/can/parser_pyx.pyx":69 * if name not in msg_name_to_address: * print(msg_name_to_address) * raise RuntimeError(f"could not find message {repr(name)} in DBC {self.dbc_name}") # <<<<<<<<<<<<<< * s = (s[0], msg_name_to_address[s[1]]) * signals[i] = s */ - __pyx_t_9 = PyTuple_New(4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 65, __pyx_L1_error) + __pyx_t_9 = PyTuple_New(4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_12 = 0; __pyx_t_13 = 127; @@ -2899,42 +2961,42 @@ static int __pyx_pf_7opendbc_3can_10parser_pyx_9CANParser___init__(struct __pyx_ __pyx_t_12 += 23; __Pyx_GIVEREF(__pyx_kp_u_could_not_find_message); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_kp_u_could_not_find_message); - if (unlikely(!__pyx_v_name)) { __Pyx_RaiseUnboundLocalError("name"); __PYX_ERR(0, 65, __pyx_L1_error) } - __pyx_t_3 = PyObject_Repr(__pyx_v_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 65, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_t_3, __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 65, __pyx_L1_error) + if (unlikely(!__pyx_v_name)) { __Pyx_RaiseUnboundLocalError("name"); __PYX_ERR(0, 69, __pyx_L1_error) } + __pyx_t_5 = PyObject_Repr(__pyx_v_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_13 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_13) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_13; - __pyx_t_12 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_5); - __pyx_t_5 = 0; - __Pyx_INCREF(__pyx_kp_u_in_DBC); - __pyx_t_12 += 8; - __Pyx_GIVEREF(__pyx_kp_u_in_DBC); - PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_kp_u_in_DBC); - __pyx_t_5 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_cur_scope->__pyx_v_self->dbc_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 65, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_t_5, __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 65, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_t_5, __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_13 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) > __pyx_t_13) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) : __pyx_t_13; __pyx_t_12 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_9, 3, __pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_9, 4, __pyx_t_12, __pyx_t_13); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 65, __pyx_L1_error) + __Pyx_INCREF(__pyx_kp_u_in_DBC); + __pyx_t_12 += 8; + __Pyx_GIVEREF(__pyx_kp_u_in_DBC); + PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_kp_u_in_DBC); + __pyx_t_3 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_cur_scope->__pyx_v_self->dbc_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 65, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); + __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_t_3, __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 69, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_13 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_13) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_13; + __pyx_t_12 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_9, 3, __pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_9, 4, __pyx_t_12, __pyx_t_13); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 69, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 69, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_Raise(__pyx_t_9, 0, 0, 0); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __PYX_ERR(0, 65, __pyx_L1_error) + __PYX_ERR(0, 69, __pyx_L1_error) - /* "opendbc/can/parser_pyx.pyx":63 + /* "opendbc/can/parser_pyx.pyx":67 * s = signals[i] * if not isinstance(s[1], numbers.Number): * if name not in msg_name_to_address: # <<<<<<<<<<<<<< @@ -2943,41 +3005,41 @@ static int __pyx_pf_7opendbc_3can_10parser_pyx_9CANParser___init__(struct __pyx_ */ } - /* "opendbc/can/parser_pyx.pyx":66 + /* "opendbc/can/parser_pyx.pyx":70 * print(msg_name_to_address) * raise RuntimeError(f"could not find message {repr(name)} in DBC {self.dbc_name}") * s = (s[0], msg_name_to_address[s[1]]) # <<<<<<<<<<<<<< * signals[i] = s * */ - __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_s, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 66, __pyx_L1_error) + __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_s, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_s, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 66, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyDict_GetItem(__pyx_v_msg_name_to_address, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 66, __pyx_L1_error) + __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_s, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 66, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_msg_name_to_address, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 70, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_9); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3); __pyx_t_9 = 0; - __pyx_t_5 = 0; - __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_5); + __pyx_t_5 = 0; - /* "opendbc/can/parser_pyx.pyx":67 + /* "opendbc/can/parser_pyx.pyx":71 * raise RuntimeError(f"could not find message {repr(name)} in DBC {self.dbc_name}") * s = (s[0], msg_name_to_address[s[1]]) * signals[i] = s # <<<<<<<<<<<<<< * * for i in range(len(checks)): */ - if (unlikely(__Pyx_SetItemInt(__pyx_cur_scope->__pyx_v_signals, __pyx_v_i, __pyx_v_s, std::vector ::size_type, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1) < 0)) __PYX_ERR(0, 67, __pyx_L1_error) + if (unlikely(__Pyx_SetItemInt(__pyx_cur_scope->__pyx_v_signals, __pyx_v_i, __pyx_v_s, std::vector ::size_type, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1) < 0)) __PYX_ERR(0, 71, __pyx_L1_error) - /* "opendbc/can/parser_pyx.pyx":62 + /* "opendbc/can/parser_pyx.pyx":66 * for i in range(len(signals)): * s = signals[i] * if not isinstance(s[1], numbers.Number): # <<<<<<<<<<<<<< @@ -2987,83 +3049,83 @@ static int __pyx_pf_7opendbc_3can_10parser_pyx_9CANParser___init__(struct __pyx_ } } - /* "opendbc/can/parser_pyx.pyx":69 + /* "opendbc/can/parser_pyx.pyx":73 * signals[i] = s * * for i in range(len(checks)): # <<<<<<<<<<<<<< * c = checks[i] * if not isinstance(c[0], numbers.Number): */ - __pyx_t_10 = PyObject_Length(__pyx_v_checks); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 69, __pyx_L1_error) + __pyx_t_10 = PyObject_Length(__pyx_v_checks); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 73, __pyx_L1_error) __pyx_t_11 = __pyx_t_10; for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_11; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; - /* "opendbc/can/parser_pyx.pyx":70 + /* "opendbc/can/parser_pyx.pyx":74 * * for i in range(len(checks)): * c = checks[i] # <<<<<<<<<<<<<< * if not isinstance(c[0], numbers.Number): * if c[0] not in msg_name_to_address: */ - __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_checks, __pyx_v_i, std::vector ::size_type, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 70, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_XDECREF_SET(__pyx_v_c, __pyx_t_3); - __pyx_t_3 = 0; + __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_checks, __pyx_v_i, std::vector ::size_type, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 74, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_XDECREF_SET(__pyx_v_c, __pyx_t_5); + __pyx_t_5 = 0; - /* "opendbc/can/parser_pyx.pyx":71 + /* "opendbc/can/parser_pyx.pyx":75 * for i in range(len(checks)): * c = checks[i] * if not isinstance(c[0], numbers.Number): # <<<<<<<<<<<<<< * if c[0] not in msg_name_to_address: * print(msg_name_to_address) */ - __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_c, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 71, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_numbers); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 71, __pyx_L1_error) + __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_c, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_Number); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 71, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_numbers); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 75, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_Number); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_2 = PyObject_IsInstance(__pyx_t_3, __pyx_t_9); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 71, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = PyObject_IsInstance(__pyx_t_5, __pyx_t_9); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 75, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_1 = ((!(__pyx_t_2 != 0)) != 0); if (__pyx_t_1) { - /* "opendbc/can/parser_pyx.pyx":72 + /* "opendbc/can/parser_pyx.pyx":76 * c = checks[i] * if not isinstance(c[0], numbers.Number): * if c[0] not in msg_name_to_address: # <<<<<<<<<<<<<< * print(msg_name_to_address) * raise RuntimeError(f"could not find message {repr(name)} in DBC {self.dbc_name}") */ - __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_c, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 72, __pyx_L1_error) + __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_c, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 76, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = (__Pyx_PyDict_ContainsTF(__pyx_t_9, __pyx_v_msg_name_to_address, Py_NE)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 72, __pyx_L1_error) + __pyx_t_1 = (__Pyx_PyDict_ContainsTF(__pyx_t_9, __pyx_v_msg_name_to_address, Py_NE)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 76, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_2 = (__pyx_t_1 != 0); if (unlikely(__pyx_t_2)) { - /* "opendbc/can/parser_pyx.pyx":73 + /* "opendbc/can/parser_pyx.pyx":77 * if not isinstance(c[0], numbers.Number): * if c[0] not in msg_name_to_address: * print(msg_name_to_address) # <<<<<<<<<<<<<< * raise RuntimeError(f"could not find message {repr(name)} in DBC {self.dbc_name}") * c = (msg_name_to_address[c[0]], c[1]) */ - __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_builtin_print, __pyx_v_msg_name_to_address); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 73, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_builtin_print, __pyx_v_msg_name_to_address); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 77, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "opendbc/can/parser_pyx.pyx":74 + /* "opendbc/can/parser_pyx.pyx":78 * if c[0] not in msg_name_to_address: * print(msg_name_to_address) * raise RuntimeError(f"could not find message {repr(name)} in DBC {self.dbc_name}") # <<<<<<<<<<<<<< * c = (msg_name_to_address[c[0]], c[1]) * checks[i] = c */ - __pyx_t_9 = PyTuple_New(4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 74, __pyx_L1_error) + __pyx_t_9 = PyTuple_New(4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 78, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_12 = 0; __pyx_t_13 = 127; @@ -3071,42 +3133,42 @@ static int __pyx_pf_7opendbc_3can_10parser_pyx_9CANParser___init__(struct __pyx_ __pyx_t_12 += 23; __Pyx_GIVEREF(__pyx_kp_u_could_not_find_message); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_kp_u_could_not_find_message); - if (unlikely(!__pyx_v_name)) { __Pyx_RaiseUnboundLocalError("name"); __PYX_ERR(0, 74, __pyx_L1_error) } - __pyx_t_3 = PyObject_Repr(__pyx_v_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 74, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_t_3, __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 74, __pyx_L1_error) + if (unlikely(!__pyx_v_name)) { __Pyx_RaiseUnboundLocalError("name"); __PYX_ERR(0, 78, __pyx_L1_error) } + __pyx_t_5 = PyObject_Repr(__pyx_v_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 78, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_13 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_13) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_13; - __pyx_t_12 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_5); - __pyx_t_5 = 0; - __Pyx_INCREF(__pyx_kp_u_in_DBC); - __pyx_t_12 += 8; - __Pyx_GIVEREF(__pyx_kp_u_in_DBC); - PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_kp_u_in_DBC); - __pyx_t_5 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_cur_scope->__pyx_v_self->dbc_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 74, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_t_5, __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 74, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_t_5, __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 78, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_13 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) > __pyx_t_13) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) : __pyx_t_13; __pyx_t_12 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_9, 3, __pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_9, 4, __pyx_t_12, __pyx_t_13); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 74, __pyx_L1_error) + __Pyx_INCREF(__pyx_kp_u_in_DBC); + __pyx_t_12 += 8; + __Pyx_GIVEREF(__pyx_kp_u_in_DBC); + PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_kp_u_in_DBC); + __pyx_t_3 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_cur_scope->__pyx_v_self->dbc_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 78, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 74, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); + __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_t_3, __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 78, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_13 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_13) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_13; + __pyx_t_12 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_9, 3, __pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_9, 4, __pyx_t_12, __pyx_t_13); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 78, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 78, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_Raise(__pyx_t_9, 0, 0, 0); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __PYX_ERR(0, 74, __pyx_L1_error) + __PYX_ERR(0, 78, __pyx_L1_error) - /* "opendbc/can/parser_pyx.pyx":72 + /* "opendbc/can/parser_pyx.pyx":76 * c = checks[i] * if not isinstance(c[0], numbers.Number): * if c[0] not in msg_name_to_address: # <<<<<<<<<<<<<< @@ -3115,41 +3177,41 @@ static int __pyx_pf_7opendbc_3can_10parser_pyx_9CANParser___init__(struct __pyx_ */ } - /* "opendbc/can/parser_pyx.pyx":75 + /* "opendbc/can/parser_pyx.pyx":79 * print(msg_name_to_address) * raise RuntimeError(f"could not find message {repr(name)} in DBC {self.dbc_name}") * c = (msg_name_to_address[c[0]], c[1]) # <<<<<<<<<<<<<< * checks[i] = c * */ - __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_c, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 75, __pyx_L1_error) + __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_c, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 79, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_msg_name_to_address, __pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 75, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_c, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 75, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 75, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyDict_GetItem(__pyx_v_msg_name_to_address, __pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 79, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_c, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 79, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 79, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_9); - __pyx_t_3 = 0; - __pyx_t_9 = 0; - __Pyx_DECREF_SET(__pyx_v_c, __pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_9); __pyx_t_5 = 0; + __pyx_t_9 = 0; + __Pyx_DECREF_SET(__pyx_v_c, __pyx_t_3); + __pyx_t_3 = 0; - /* "opendbc/can/parser_pyx.pyx":76 + /* "opendbc/can/parser_pyx.pyx":80 * raise RuntimeError(f"could not find message {repr(name)} in DBC {self.dbc_name}") * c = (msg_name_to_address[c[0]], c[1]) * checks[i] = c # <<<<<<<<<<<<<< * * if enforce_checks: */ - if (unlikely(__Pyx_SetItemInt(__pyx_v_checks, __pyx_v_i, __pyx_v_c, std::vector ::size_type, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1) < 0)) __PYX_ERR(0, 76, __pyx_L1_error) + if (unlikely(__Pyx_SetItemInt(__pyx_v_checks, __pyx_v_i, __pyx_v_c, std::vector ::size_type, 0, __Pyx_PyInt_FromSize_t, 0, 0, 1) < 0)) __PYX_ERR(0, 80, __pyx_L1_error) - /* "opendbc/can/parser_pyx.pyx":71 + /* "opendbc/can/parser_pyx.pyx":75 * for i in range(len(checks)): * c = checks[i] * if not isinstance(c[0], numbers.Number): # <<<<<<<<<<<<<< @@ -3159,17 +3221,17 @@ static int __pyx_pf_7opendbc_3can_10parser_pyx_9CANParser___init__(struct __pyx_ } } - /* "opendbc/can/parser_pyx.pyx":78 + /* "opendbc/can/parser_pyx.pyx":82 * checks[i] = c * * if enforce_checks: # <<<<<<<<<<<<<< * checked_addrs = {c[0] for c in checks} * signal_addrs = {s[1] for s in signals} */ - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_enforce_checks); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 78, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_enforce_checks); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 82, __pyx_L1_error) if (__pyx_t_2) { - /* "opendbc/can/parser_pyx.pyx":79 + /* "opendbc/can/parser_pyx.pyx":83 * * if enforce_checks: * checked_addrs = {c[0] for c in checks} # <<<<<<<<<<<<<< @@ -3177,53 +3239,53 @@ static int __pyx_pf_7opendbc_3can_10parser_pyx_9CANParser___init__(struct __pyx_ * unchecked = signal_addrs - checked_addrs */ { /* enter inner scope */ - __pyx_t_5 = PySet_New(NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 79, __pyx_L18_error) - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PySet_New(NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 83, __pyx_L18_error) + __Pyx_GOTREF(__pyx_t_3); if (likely(PyList_CheckExact(__pyx_v_checks)) || PyTuple_CheckExact(__pyx_v_checks)) { __pyx_t_9 = __pyx_v_checks; __Pyx_INCREF(__pyx_t_9); __pyx_t_10 = 0; __pyx_t_14 = NULL; } else { - __pyx_t_10 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_v_checks); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 79, __pyx_L18_error) + __pyx_t_10 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_v_checks); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 83, __pyx_L18_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_14 = Py_TYPE(__pyx_t_9)->tp_iternext; if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 79, __pyx_L18_error) + __pyx_t_14 = Py_TYPE(__pyx_t_9)->tp_iternext; if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 83, __pyx_L18_error) } for (;;) { if (likely(!__pyx_t_14)) { if (likely(PyList_CheckExact(__pyx_t_9))) { if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_9)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_10); __Pyx_INCREF(__pyx_t_3); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 79, __pyx_L18_error) + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_10); __Pyx_INCREF(__pyx_t_5); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 83, __pyx_L18_error) #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_9, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 79, __pyx_L18_error) - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PySequence_ITEM(__pyx_t_9, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 83, __pyx_L18_error) + __Pyx_GOTREF(__pyx_t_5); #endif } else { if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_9)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_10); __Pyx_INCREF(__pyx_t_3); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 79, __pyx_L18_error) + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_10); __Pyx_INCREF(__pyx_t_5); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 83, __pyx_L18_error) #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_9, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 79, __pyx_L18_error) - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PySequence_ITEM(__pyx_t_9, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 83, __pyx_L18_error) + __Pyx_GOTREF(__pyx_t_5); #endif } } else { - __pyx_t_3 = __pyx_t_14(__pyx_t_9); - if (unlikely(!__pyx_t_3)) { + __pyx_t_5 = __pyx_t_14(__pyx_t_9); + if (unlikely(!__pyx_t_5)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 79, __pyx_L18_error) + else __PYX_ERR(0, 83, __pyx_L18_error) } break; } - __Pyx_GOTREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_t_5); } - __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_c, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_GetItemInt(__pyx_7genexpr__pyx_v_c, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 79, __pyx_L18_error) - __Pyx_GOTREF(__pyx_t_3); - if (unlikely(PySet_Add(__pyx_t_5, (PyObject*)__pyx_t_3))) __PYX_ERR(0, 79, __pyx_L18_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_c, __pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_GetItemInt(__pyx_7genexpr__pyx_v_c, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 83, __pyx_L18_error) + __Pyx_GOTREF(__pyx_t_5); + if (unlikely(PySet_Add(__pyx_t_3, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 83, __pyx_L18_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_XDECREF(__pyx_7genexpr__pyx_v_c); __pyx_7genexpr__pyx_v_c = 0; @@ -3233,10 +3295,10 @@ static int __pyx_pf_7opendbc_3can_10parser_pyx_9CANParser___init__(struct __pyx_ goto __pyx_L1_error; __pyx_L21_exit_scope:; } /* exit inner scope */ - __pyx_v_checked_addrs = ((PyObject*)__pyx_t_5); - __pyx_t_5 = 0; + __pyx_v_checked_addrs = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; - /* "opendbc/can/parser_pyx.pyx":80 + /* "opendbc/can/parser_pyx.pyx":84 * if enforce_checks: * checked_addrs = {c[0] for c in checks} * signal_addrs = {s[1] for s in signals} # <<<<<<<<<<<<<< @@ -3244,53 +3306,53 @@ static int __pyx_pf_7opendbc_3can_10parser_pyx_9CANParser___init__(struct __pyx_ * if len(unchecked): */ { /* enter inner scope */ - __pyx_t_5 = PySet_New(NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 80, __pyx_L24_error) - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PySet_New(NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 84, __pyx_L24_error) + __Pyx_GOTREF(__pyx_t_3); if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_v_signals)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_signals)) { __pyx_t_9 = __pyx_cur_scope->__pyx_v_signals; __Pyx_INCREF(__pyx_t_9); __pyx_t_10 = 0; __pyx_t_14 = NULL; } else { - __pyx_t_10 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_signals); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 80, __pyx_L24_error) + __pyx_t_10 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_signals); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 84, __pyx_L24_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_14 = Py_TYPE(__pyx_t_9)->tp_iternext; if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 80, __pyx_L24_error) + __pyx_t_14 = Py_TYPE(__pyx_t_9)->tp_iternext; if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 84, __pyx_L24_error) } for (;;) { if (likely(!__pyx_t_14)) { if (likely(PyList_CheckExact(__pyx_t_9))) { if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_9)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_10); __Pyx_INCREF(__pyx_t_3); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 80, __pyx_L24_error) + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_10); __Pyx_INCREF(__pyx_t_5); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 84, __pyx_L24_error) #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_9, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 80, __pyx_L24_error) - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PySequence_ITEM(__pyx_t_9, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 84, __pyx_L24_error) + __Pyx_GOTREF(__pyx_t_5); #endif } else { if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_9)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_10); __Pyx_INCREF(__pyx_t_3); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 80, __pyx_L24_error) + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_10); __Pyx_INCREF(__pyx_t_5); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 84, __pyx_L24_error) #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_9, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 80, __pyx_L24_error) - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PySequence_ITEM(__pyx_t_9, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 84, __pyx_L24_error) + __Pyx_GOTREF(__pyx_t_5); #endif } } else { - __pyx_t_3 = __pyx_t_14(__pyx_t_9); - if (unlikely(!__pyx_t_3)) { + __pyx_t_5 = __pyx_t_14(__pyx_t_9); + if (unlikely(!__pyx_t_5)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 80, __pyx_L24_error) + else __PYX_ERR(0, 84, __pyx_L24_error) } break; } - __Pyx_GOTREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_t_5); } - __Pyx_XDECREF_SET(__pyx_8genexpr1__pyx_v_s, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_GetItemInt(__pyx_8genexpr1__pyx_v_s, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 80, __pyx_L24_error) - __Pyx_GOTREF(__pyx_t_3); - if (unlikely(PySet_Add(__pyx_t_5, (PyObject*)__pyx_t_3))) __PYX_ERR(0, 80, __pyx_L24_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF_SET(__pyx_8genexpr1__pyx_v_s, __pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_GetItemInt(__pyx_8genexpr1__pyx_v_s, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 84, __pyx_L24_error) + __Pyx_GOTREF(__pyx_t_5); + if (unlikely(PySet_Add(__pyx_t_3, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 84, __pyx_L24_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_s); __pyx_8genexpr1__pyx_v_s = 0; @@ -3300,74 +3362,74 @@ static int __pyx_pf_7opendbc_3can_10parser_pyx_9CANParser___init__(struct __pyx_ goto __pyx_L1_error; __pyx_L27_exit_scope:; } /* exit inner scope */ - __pyx_v_signal_addrs = ((PyObject*)__pyx_t_5); - __pyx_t_5 = 0; + __pyx_v_signal_addrs = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; - /* "opendbc/can/parser_pyx.pyx":81 + /* "opendbc/can/parser_pyx.pyx":85 * checked_addrs = {c[0] for c in checks} * signal_addrs = {s[1] for s in signals} * unchecked = signal_addrs - checked_addrs # <<<<<<<<<<<<<< * if len(unchecked): * err_msg = ', '.join(f"{self.address_to_msg_name[addr].decode()} ({hex(addr)})" for addr in unchecked) */ - __pyx_t_5 = PyNumber_Subtract(__pyx_v_signal_addrs, __pyx_v_checked_addrs); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 81, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_5); - __pyx_cur_scope->__pyx_v_unchecked = __pyx_t_5; - __pyx_t_5 = 0; + __pyx_t_3 = PyNumber_Subtract(__pyx_v_signal_addrs, __pyx_v_checked_addrs); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 85, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_cur_scope->__pyx_v_unchecked = __pyx_t_3; + __pyx_t_3 = 0; - /* "opendbc/can/parser_pyx.pyx":82 + /* "opendbc/can/parser_pyx.pyx":86 * signal_addrs = {s[1] for s in signals} * unchecked = signal_addrs - checked_addrs * if len(unchecked): # <<<<<<<<<<<<<< * err_msg = ', '.join(f"{self.address_to_msg_name[addr].decode()} ({hex(addr)})" for addr in unchecked) * raise RuntimeError(f"Unchecked addrs: {err_msg}") */ - __pyx_t_5 = __pyx_cur_scope->__pyx_v_unchecked; - __Pyx_INCREF(__pyx_t_5); - __pyx_t_10 = PyObject_Length(__pyx_t_5); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 82, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_3 = __pyx_cur_scope->__pyx_v_unchecked; + __Pyx_INCREF(__pyx_t_3); + __pyx_t_10 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_2 = (__pyx_t_10 != 0); if (unlikely(__pyx_t_2)) { - /* "opendbc/can/parser_pyx.pyx":83 + /* "opendbc/can/parser_pyx.pyx":87 * unchecked = signal_addrs - checked_addrs * if len(unchecked): * err_msg = ', '.join(f"{self.address_to_msg_name[addr].decode()} ({hex(addr)})" for addr in unchecked) # <<<<<<<<<<<<<< * raise RuntimeError(f"Unchecked addrs: {err_msg}") * */ - __pyx_t_5 = __pyx_pf_7opendbc_3can_10parser_pyx_9CANParser_8__init___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 83, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_9 = __Pyx_Generator_Next(__pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 83, __pyx_L1_error) + __pyx_t_3 = __pyx_pf_7opendbc_3can_10parser_pyx_9CANParser_8__init___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 87, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_9 = __Pyx_Generator_Next(__pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 87, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyUnicode_Join(__pyx_kp_u__3, __pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 83, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyUnicode_Join(__pyx_kp_u__3, __pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 87, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_v_err_msg = ((PyObject*)__pyx_t_5); - __pyx_t_5 = 0; + __pyx_v_err_msg = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; - /* "opendbc/can/parser_pyx.pyx":84 + /* "opendbc/can/parser_pyx.pyx":88 * if len(unchecked): * err_msg = ', '.join(f"{self.address_to_msg_name[addr].decode()} ({hex(addr)})" for addr in unchecked) * raise RuntimeError(f"Unchecked addrs: {err_msg}") # <<<<<<<<<<<<<< * * cdef vector[SignalParseOptions] signal_options_v */ - __pyx_t_5 = __Pyx_PyUnicode_Unicode(__pyx_v_err_msg); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 84, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_9 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Unchecked_addrs, __pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 84, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyUnicode_Unicode(__pyx_v_err_msg); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 88, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_9 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Unchecked_addrs, __pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 88, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 84, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 88, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_Raise(__pyx_t_5, 0, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __PYX_ERR(0, 84, __pyx_L1_error) + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(0, 88, __pyx_L1_error) - /* "opendbc/can/parser_pyx.pyx":82 + /* "opendbc/can/parser_pyx.pyx":86 * signal_addrs = {s[1] for s in signals} * unchecked = signal_addrs - checked_addrs * if len(unchecked): # <<<<<<<<<<<<<< @@ -3376,7 +3438,7 @@ static int __pyx_pf_7opendbc_3can_10parser_pyx_9CANParser___init__(struct __pyx_ */ } - /* "opendbc/can/parser_pyx.pyx":78 + /* "opendbc/can/parser_pyx.pyx":82 * checks[i] = c * * if enforce_checks: # <<<<<<<<<<<<<< @@ -3385,7 +3447,7 @@ static int __pyx_pf_7opendbc_3can_10parser_pyx_9CANParser___init__(struct __pyx_ */ } - /* "opendbc/can/parser_pyx.pyx":88 + /* "opendbc/can/parser_pyx.pyx":92 * cdef vector[SignalParseOptions] signal_options_v * cdef SignalParseOptions spo * for sig_name, sig_address in signals: # <<<<<<<<<<<<<< @@ -3393,39 +3455,39 @@ static int __pyx_pf_7opendbc_3can_10parser_pyx_9CANParser___init__(struct __pyx_ * spo.name = sig_name */ if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_v_signals)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_signals)) { - __pyx_t_5 = __pyx_cur_scope->__pyx_v_signals; __Pyx_INCREF(__pyx_t_5); __pyx_t_10 = 0; + __pyx_t_3 = __pyx_cur_scope->__pyx_v_signals; __Pyx_INCREF(__pyx_t_3); __pyx_t_10 = 0; __pyx_t_14 = NULL; } else { - __pyx_t_10 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_signals); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 88, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_14 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 88, __pyx_L1_error) + __pyx_t_10 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_signals); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 92, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_14 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 92, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_14)) { - if (likely(PyList_CheckExact(__pyx_t_5))) { - if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_5)) break; + if (likely(PyList_CheckExact(__pyx_t_3))) { + if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_3)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_9 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_10); __Pyx_INCREF(__pyx_t_9); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 88, __pyx_L1_error) + __pyx_t_9 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_10); __Pyx_INCREF(__pyx_t_9); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 92, __pyx_L1_error) #else - __pyx_t_9 = PySequence_ITEM(__pyx_t_5, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 88, __pyx_L1_error) + __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 92, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); #endif } else { - if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_5)) break; + if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_3)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_10); __Pyx_INCREF(__pyx_t_9); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 88, __pyx_L1_error) + __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_10); __Pyx_INCREF(__pyx_t_9); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 92, __pyx_L1_error) #else - __pyx_t_9 = PySequence_ITEM(__pyx_t_5, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 88, __pyx_L1_error) + __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 92, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); #endif } } else { - __pyx_t_9 = __pyx_t_14(__pyx_t_5); + __pyx_t_9 = __pyx_t_14(__pyx_t_3); if (unlikely(!__pyx_t_9)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 88, __pyx_L1_error) + else __PYX_ERR(0, 92, __pyx_L1_error) } break; } @@ -3437,36 +3499,36 @@ static int __pyx_pf_7opendbc_3can_10parser_pyx_9CANParser___init__(struct __pyx_ if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 88, __pyx_L1_error) + __PYX_ERR(0, 92, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_15 = PyTuple_GET_ITEM(sequence, 1); } else { - __pyx_t_3 = PyList_GET_ITEM(sequence, 0); + __pyx_t_5 = PyList_GET_ITEM(sequence, 0); __pyx_t_15 = PyList_GET_ITEM(sequence, 1); } - __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(__pyx_t_15); #else - __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 88, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_15 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 88, __pyx_L1_error) + __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 92, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_15 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 92, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_15); #endif __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } else { Py_ssize_t index = -1; - __pyx_t_16 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 88, __pyx_L1_error) + __pyx_t_16 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 92, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_16); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_17 = Py_TYPE(__pyx_t_16)->tp_iternext; - index = 0; __pyx_t_3 = __pyx_t_17(__pyx_t_16); if (unlikely(!__pyx_t_3)) goto __pyx_L31_unpacking_failed; - __Pyx_GOTREF(__pyx_t_3); + index = 0; __pyx_t_5 = __pyx_t_17(__pyx_t_16); if (unlikely(!__pyx_t_5)) goto __pyx_L31_unpacking_failed; + __Pyx_GOTREF(__pyx_t_5); index = 1; __pyx_t_15 = __pyx_t_17(__pyx_t_16); if (unlikely(!__pyx_t_15)) goto __pyx_L31_unpacking_failed; __Pyx_GOTREF(__pyx_t_15); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_16), 2) < 0) __PYX_ERR(0, 88, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_16), 2) < 0) __PYX_ERR(0, 92, __pyx_L1_error) __pyx_t_17 = NULL; __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; goto __pyx_L32_unpacking_done; @@ -3474,35 +3536,35 @@ static int __pyx_pf_7opendbc_3can_10parser_pyx_9CANParser___init__(struct __pyx_ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; __pyx_t_17 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 88, __pyx_L1_error) + __PYX_ERR(0, 92, __pyx_L1_error) __pyx_L32_unpacking_done:; } - __Pyx_XDECREF_SET(__pyx_v_sig_name, __pyx_t_3); - __pyx_t_3 = 0; + __Pyx_XDECREF_SET(__pyx_v_sig_name, __pyx_t_5); + __pyx_t_5 = 0; __Pyx_XDECREF_SET(__pyx_v_sig_address, __pyx_t_15); __pyx_t_15 = 0; - /* "opendbc/can/parser_pyx.pyx":89 + /* "opendbc/can/parser_pyx.pyx":93 * cdef SignalParseOptions spo * for sig_name, sig_address in signals: * spo.address = sig_address # <<<<<<<<<<<<<< * spo.name = sig_name * signal_options_v.push_back(spo) */ - __pyx_t_18 = __Pyx_PyInt_As_uint32_t(__pyx_v_sig_address); if (unlikely((__pyx_t_18 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 89, __pyx_L1_error) + __pyx_t_18 = __Pyx_PyInt_As_uint32_t(__pyx_v_sig_address); if (unlikely((__pyx_t_18 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 93, __pyx_L1_error) __pyx_v_spo.address = __pyx_t_18; - /* "opendbc/can/parser_pyx.pyx":90 + /* "opendbc/can/parser_pyx.pyx":94 * for sig_name, sig_address in signals: * spo.address = sig_address * spo.name = sig_name # <<<<<<<<<<<<<< * signal_options_v.push_back(spo) * */ - __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_v_sig_name); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 90, __pyx_L1_error) + __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_v_sig_name); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 94, __pyx_L1_error) __pyx_v_spo.name = __pyx_t_4; - /* "opendbc/can/parser_pyx.pyx":91 + /* "opendbc/can/parser_pyx.pyx":95 * spo.address = sig_address * spo.name = sig_name * signal_options_v.push_back(spo) # <<<<<<<<<<<<<< @@ -3513,10 +3575,10 @@ static int __pyx_pf_7opendbc_3can_10parser_pyx_9CANParser___init__(struct __pyx_ __pyx_v_signal_options_v.push_back(__pyx_v_spo); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 91, __pyx_L1_error) + __PYX_ERR(0, 95, __pyx_L1_error) } - /* "opendbc/can/parser_pyx.pyx":88 + /* "opendbc/can/parser_pyx.pyx":92 * cdef vector[SignalParseOptions] signal_options_v * cdef SignalParseOptions spo * for sig_name, sig_address in signals: # <<<<<<<<<<<<<< @@ -3524,38 +3586,38 @@ static int __pyx_pf_7opendbc_3can_10parser_pyx_9CANParser___init__(struct __pyx_ * spo.name = sig_name */ } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "opendbc/can/parser_pyx.pyx":93 + /* "opendbc/can/parser_pyx.pyx":97 * signal_options_v.push_back(spo) * * message_options = dict((address, 0) for _, address in signals) # <<<<<<<<<<<<<< * message_options.update(dict(checks)) * */ - __pyx_t_5 = __pyx_pf_7opendbc_3can_10parser_pyx_9CANParser_8__init___3genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 93, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_9 = __Pyx_Generator_Next(__pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 93, __pyx_L1_error) + __pyx_t_3 = __pyx_pf_7opendbc_3can_10parser_pyx_9CANParser_8__init___3genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 97, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_9 = __Pyx_Generator_Next(__pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_message_options = ((PyObject*)__pyx_t_9); __pyx_t_9 = 0; - /* "opendbc/can/parser_pyx.pyx":94 + /* "opendbc/can/parser_pyx.pyx":98 * * message_options = dict((address, 0) for _, address in signals) * message_options.update(dict(checks)) # <<<<<<<<<<<<<< * * cdef vector[MessageParseOptions] message_options_v */ - __pyx_t_9 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyDict_Type)), __pyx_v_checks); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 94, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyDict_Type)), __pyx_v_checks); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 98, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_5 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyDict_Type_update, __pyx_v_message_options, __pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 94, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyDict_Type_update, __pyx_v_message_options, __pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 98, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "opendbc/can/parser_pyx.pyx":98 + /* "opendbc/can/parser_pyx.pyx":102 * cdef vector[MessageParseOptions] message_options_v * cdef MessageParseOptions mpo * for msg_address, freq in message_options.items(): # <<<<<<<<<<<<<< @@ -3565,17 +3627,17 @@ static int __pyx_pf_7opendbc_3can_10parser_pyx_9CANParser___init__(struct __pyx_ __pyx_t_10 = 0; if (unlikely(__pyx_v_message_options == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items"); - __PYX_ERR(0, 98, __pyx_L1_error) + __PYX_ERR(0, 102, __pyx_L1_error) } - __pyx_t_9 = __Pyx_dict_iterator(__pyx_v_message_options, 1, __pyx_n_s_items, (&__pyx_t_11), (&__pyx_t_19)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 98, __pyx_L1_error) + __pyx_t_9 = __Pyx_dict_iterator(__pyx_v_message_options, 1, __pyx_n_s_items, (&__pyx_t_11), (&__pyx_t_19)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 102, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_5); - __pyx_t_5 = __pyx_t_9; + __Pyx_XDECREF(__pyx_t_3); + __pyx_t_3 = __pyx_t_9; __pyx_t_9 = 0; while (1) { - __pyx_t_20 = __Pyx_dict_iter_next(__pyx_t_5, __pyx_t_11, &__pyx_t_10, &__pyx_t_9, &__pyx_t_15, NULL, __pyx_t_19); + __pyx_t_20 = __Pyx_dict_iter_next(__pyx_t_3, __pyx_t_11, &__pyx_t_10, &__pyx_t_9, &__pyx_t_15, NULL, __pyx_t_19); if (unlikely(__pyx_t_20 == 0)) break; - if (unlikely(__pyx_t_20 == -1)) __PYX_ERR(0, 98, __pyx_L1_error) + if (unlikely(__pyx_t_20 == -1)) __PYX_ERR(0, 102, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_GOTREF(__pyx_t_15); __Pyx_XDECREF_SET(__pyx_v_msg_address, __pyx_t_9); @@ -3583,27 +3645,27 @@ static int __pyx_pf_7opendbc_3can_10parser_pyx_9CANParser___init__(struct __pyx_ __Pyx_XDECREF_SET(__pyx_v_freq, __pyx_t_15); __pyx_t_15 = 0; - /* "opendbc/can/parser_pyx.pyx":99 + /* "opendbc/can/parser_pyx.pyx":103 * cdef MessageParseOptions mpo * for msg_address, freq in message_options.items(): * mpo.address = msg_address # <<<<<<<<<<<<<< * mpo.check_frequency = freq * message_options_v.push_back(mpo) */ - __pyx_t_18 = __Pyx_PyInt_As_uint32_t(__pyx_v_msg_address); if (unlikely((__pyx_t_18 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 99, __pyx_L1_error) + __pyx_t_18 = __Pyx_PyInt_As_uint32_t(__pyx_v_msg_address); if (unlikely((__pyx_t_18 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 103, __pyx_L1_error) __pyx_v_mpo.address = __pyx_t_18; - /* "opendbc/can/parser_pyx.pyx":100 + /* "opendbc/can/parser_pyx.pyx":104 * for msg_address, freq in message_options.items(): * mpo.address = msg_address * mpo.check_frequency = freq # <<<<<<<<<<<<<< * message_options_v.push_back(mpo) * */ - __pyx_t_20 = __Pyx_PyInt_As_int(__pyx_v_freq); if (unlikely((__pyx_t_20 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 100, __pyx_L1_error) + __pyx_t_20 = __Pyx_PyInt_As_int(__pyx_v_freq); if (unlikely((__pyx_t_20 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 104, __pyx_L1_error) __pyx_v_mpo.check_frequency = __pyx_t_20; - /* "opendbc/can/parser_pyx.pyx":101 + /* "opendbc/can/parser_pyx.pyx":105 * mpo.address = msg_address * mpo.check_frequency = freq * message_options_v.push_back(mpo) # <<<<<<<<<<<<<< @@ -3614,23 +3676,23 @@ static int __pyx_pf_7opendbc_3can_10parser_pyx_9CANParser___init__(struct __pyx_ __pyx_v_message_options_v.push_back(__pyx_v_mpo); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 101, __pyx_L1_error) + __PYX_ERR(0, 105, __pyx_L1_error) } } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "opendbc/can/parser_pyx.pyx":103 + /* "opendbc/can/parser_pyx.pyx":107 * message_options_v.push_back(mpo) * * self.can = new cpp_CANParser(bus, dbc_name, message_options_v, signal_options_v) # <<<<<<<<<<<<<< * self.update_vl() * */ - __pyx_t_19 = __Pyx_PyInt_As_int(__pyx_v_bus); if (unlikely((__pyx_t_19 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 103, __pyx_L1_error) - __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_v_dbc_name); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 103, __pyx_L1_error) + __pyx_t_19 = __Pyx_PyInt_As_int(__pyx_v_bus); if (unlikely((__pyx_t_19 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 107, __pyx_L1_error) + __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_v_dbc_name); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 107, __pyx_L1_error) __pyx_cur_scope->__pyx_v_self->can = new CANParser(__pyx_t_19, __pyx_t_4, __pyx_v_message_options_v, __pyx_v_signal_options_v); - /* "opendbc/can/parser_pyx.pyx":104 + /* "opendbc/can/parser_pyx.pyx":108 * * self.can = new cpp_CANParser(bus, dbc_name, message_options_v, signal_options_v) * self.update_vl() # <<<<<<<<<<<<<< @@ -3639,7 +3701,7 @@ static int __pyx_pf_7opendbc_3can_10parser_pyx_9CANParser___init__(struct __pyx_ */ (void)(((struct __pyx_vtabstruct_7opendbc_3can_10parser_pyx_CANParser *)__pyx_cur_scope->__pyx_v_self->__pyx_vtab)->update_vl(__pyx_cur_scope->__pyx_v_self)); - /* "opendbc/can/parser_pyx.pyx":31 + /* "opendbc/can/parser_pyx.pyx":32 * string dbc_name * * def __init__(self, dbc_name, signals, checks=None, bus=0, enforce_checks=True): # <<<<<<<<<<<<<< @@ -3682,7 +3744,7 @@ static int __pyx_pf_7opendbc_3can_10parser_pyx_9CANParser___init__(struct __pyx_ return __pyx_r; } -/* "opendbc/can/parser_pyx.pyx":106 +/* "opendbc/can/parser_pyx.pyx":110 * self.update_vl() * * cdef unordered_set[uint32_t] update_vl(self): # <<<<<<<<<<<<<< @@ -3708,7 +3770,7 @@ static std::unordered_set __pyx_f_7opendbc_3can_10parser_pyx_9CANPars int __pyx_clineno = 0; __Pyx_RefNannySetupContext("update_vl", 0); - /* "opendbc/can/parser_pyx.pyx":109 + /* "opendbc/can/parser_pyx.pyx":113 * cdef unordered_set[uint32_t] updated_addrs * * new_vals = self.can.query_latest() # <<<<<<<<<<<<<< @@ -3717,7 +3779,7 @@ static std::unordered_set __pyx_f_7opendbc_3can_10parser_pyx_9CANPars */ __pyx_v_new_vals = __pyx_v_self->can->query_latest(); - /* "opendbc/can/parser_pyx.pyx":110 + /* "opendbc/can/parser_pyx.pyx":114 * * new_vals = self.can.query_latest() * for cv in new_vals: # <<<<<<<<<<<<<< @@ -3731,14 +3793,14 @@ static std::unordered_set __pyx_f_7opendbc_3can_10parser_pyx_9CANPars ++__pyx_t_1; __pyx_v_cv = __pyx_t_2; - /* "opendbc/can/parser_pyx.pyx":112 + /* "opendbc/can/parser_pyx.pyx":116 * for cv in new_vals: * # Cast char * directly to unicode * cv_name = cv.name # <<<<<<<<<<<<<< * self.vl[cv.address][cv_name] = cv.value * self.vl_all[cv.address][cv_name].extend(cv.all_values) */ - __pyx_t_3 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_cv.name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 112, __pyx_L1_error) + __pyx_t_3 = __pyx_convert_PyUnicode_string_to_py_std__in_string(__pyx_v_cv.name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 116, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); @@ -3746,51 +3808,51 @@ static std::unordered_set __pyx_f_7opendbc_3can_10parser_pyx_9CANPars __Pyx_XDECREF_SET(__pyx_v_cv_name, ((PyObject*)__pyx_t_4)); __pyx_t_4 = 0; - /* "opendbc/can/parser_pyx.pyx":113 + /* "opendbc/can/parser_pyx.pyx":117 * # Cast char * directly to unicode * cv_name = cv.name * self.vl[cv.address][cv_name] = cv.value # <<<<<<<<<<<<<< * self.vl_all[cv.address][cv_name].extend(cv.all_values) - * updated_addrs.insert(cv.address) + * self.ts_nanos[cv.address][cv_name] = cv.ts_nanos */ - __pyx_t_4 = PyFloat_FromDouble(__pyx_v_cv.value); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 113, __pyx_L1_error) + __pyx_t_4 = PyFloat_FromDouble(__pyx_v_cv.value); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 117, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (unlikely(__pyx_v_self->vl == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 113, __pyx_L1_error) + __PYX_ERR(0, 117, __pyx_L1_error) } - __pyx_t_3 = __Pyx_PyInt_From_uint32_t(__pyx_v_cv.address); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 113, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_uint32_t(__pyx_v_cv.address); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 117, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyDict_GetItem(__pyx_v_self->vl, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 113, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyDict_GetItem(__pyx_v_self->vl, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 117, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(PyObject_SetItem(__pyx_t_5, __pyx_v_cv_name, __pyx_t_4) < 0)) __PYX_ERR(0, 113, __pyx_L1_error) + if (unlikely(PyObject_SetItem(__pyx_t_5, __pyx_v_cv_name, __pyx_t_4) < 0)) __PYX_ERR(0, 117, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "opendbc/can/parser_pyx.pyx":114 + /* "opendbc/can/parser_pyx.pyx":118 * cv_name = cv.name * self.vl[cv.address][cv_name] = cv.value * self.vl_all[cv.address][cv_name].extend(cv.all_values) # <<<<<<<<<<<<<< + * self.ts_nanos[cv.address][cv_name] = cv.ts_nanos * updated_addrs.insert(cv.address) - * */ if (unlikely(__pyx_v_self->vl_all == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 114, __pyx_L1_error) + __PYX_ERR(0, 118, __pyx_L1_error) } - __pyx_t_5 = __Pyx_PyInt_From_uint32_t(__pyx_v_cv.address); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 114, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyInt_From_uint32_t(__pyx_v_cv.address); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 118, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_self->vl_all, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 114, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_self->vl_all, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 118, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_t_3, __pyx_v_cv_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 114, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_t_3, __pyx_v_cv_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 118, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_extend); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 114, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_extend); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 118, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __pyx_convert_vector_to_py_double(__pyx_v_cv.all_values); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 114, __pyx_L1_error) + __pyx_t_5 = __pyx_convert_vector_to_py_double(__pyx_v_cv.all_values); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 118, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { @@ -3805,21 +3867,43 @@ static std::unordered_set __pyx_f_7opendbc_3can_10parser_pyx_9CANPars __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 114, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 118, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "opendbc/can/parser_pyx.pyx":115 + /* "opendbc/can/parser_pyx.pyx":119 * self.vl[cv.address][cv_name] = cv.value * self.vl_all[cv.address][cv_name].extend(cv.all_values) + * self.ts_nanos[cv.address][cv_name] = cv.ts_nanos # <<<<<<<<<<<<<< + * updated_addrs.insert(cv.address) + * + */ + __pyx_t_4 = __Pyx_PyInt_From_uint64_t(__pyx_v_cv.ts_nanos); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 119, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (unlikely(__pyx_v_self->ts_nanos == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 119, __pyx_L1_error) + } + __pyx_t_3 = __Pyx_PyInt_From_uint32_t(__pyx_v_cv.address); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 119, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyDict_GetItem(__pyx_v_self->ts_nanos, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 119, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(PyObject_SetItem(__pyx_t_5, __pyx_v_cv_name, __pyx_t_4) < 0)) __PYX_ERR(0, 119, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "opendbc/can/parser_pyx.pyx":120 + * self.vl_all[cv.address][cv_name].extend(cv.all_values) + * self.ts_nanos[cv.address][cv_name] = cv.ts_nanos * updated_addrs.insert(cv.address) # <<<<<<<<<<<<<< * * return updated_addrs */ (void)(__pyx_v_updated_addrs.insert(__pyx_v_cv.address)); - /* "opendbc/can/parser_pyx.pyx":110 + /* "opendbc/can/parser_pyx.pyx":114 * * new_vals = self.can.query_latest() * for cv in new_vals: # <<<<<<<<<<<<<< @@ -3828,7 +3912,7 @@ static std::unordered_set __pyx_f_7opendbc_3can_10parser_pyx_9CANPars */ } - /* "opendbc/can/parser_pyx.pyx":117 + /* "opendbc/can/parser_pyx.pyx":122 * updated_addrs.insert(cv.address) * * return updated_addrs # <<<<<<<<<<<<<< @@ -3838,7 +3922,7 @@ static std::unordered_set __pyx_f_7opendbc_3can_10parser_pyx_9CANPars __pyx_r = __pyx_v_updated_addrs; goto __pyx_L0; - /* "opendbc/can/parser_pyx.pyx":106 + /* "opendbc/can/parser_pyx.pyx":110 * self.update_vl() * * cdef unordered_set[uint32_t] update_vl(self): # <<<<<<<<<<<<<< @@ -3860,7 +3944,7 @@ static std::unordered_set __pyx_f_7opendbc_3can_10parser_pyx_9CANPars return __pyx_r; } -/* "opendbc/can/parser_pyx.pyx":119 +/* "opendbc/can/parser_pyx.pyx":124 * return updated_addrs * * def update_string(self, dat, sendcan=False): # <<<<<<<<<<<<<< @@ -3907,7 +3991,7 @@ static PyObject *__pyx_pw_7opendbc_3can_10parser_pyx_9CANParser_3update_string(P } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "update_string") < 0)) __PYX_ERR(0, 119, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "update_string") < 0)) __PYX_ERR(0, 124, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -3923,7 +4007,7 @@ static PyObject *__pyx_pw_7opendbc_3can_10parser_pyx_9CANParser_3update_string(P } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("update_string", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 119, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("update_string", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 124, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("opendbc.can.parser_pyx.CANParser.update_string", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -3955,7 +4039,7 @@ static PyObject *__pyx_pf_7opendbc_3can_10parser_pyx_9CANParser_2update_string(s int __pyx_clineno = 0; __Pyx_RefNannySetupContext("update_string", 0); - /* "opendbc/can/parser_pyx.pyx":120 + /* "opendbc/can/parser_pyx.pyx":125 * * def update_string(self, dat, sendcan=False): * for v in self.vl_all.values(): # <<<<<<<<<<<<<< @@ -3965,9 +4049,9 @@ static PyObject *__pyx_pf_7opendbc_3can_10parser_pyx_9CANParser_2update_string(s __pyx_t_2 = 0; if (unlikely(__pyx_v_self->vl_all == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "values"); - __PYX_ERR(0, 120, __pyx_L1_error) + __PYX_ERR(0, 125, __pyx_L1_error) } - __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_self->vl_all, 1, __pyx_n_s_values, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 120, __pyx_L1_error) + __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_self->vl_all, 1, __pyx_n_s_values, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 125, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = __pyx_t_5; @@ -3975,19 +4059,19 @@ static PyObject *__pyx_pf_7opendbc_3can_10parser_pyx_9CANParser_2update_string(s while (1) { __pyx_t_6 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_3, &__pyx_t_2, NULL, &__pyx_t_5, NULL, __pyx_t_4); if (unlikely(__pyx_t_6 == 0)) break; - if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(0, 120, __pyx_L1_error) + if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(0, 125, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_5); __pyx_t_5 = 0; - /* "opendbc/can/parser_pyx.pyx":121 + /* "opendbc/can/parser_pyx.pyx":126 * def update_string(self, dat, sendcan=False): * for v in self.vl_all.values(): * v.clear() # <<<<<<<<<<<<<< * * self.can.update_string(dat, sendcan) */ - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_v, __pyx_n_s_clear); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 121, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_v, __pyx_n_s_clear); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 126, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { @@ -4001,25 +4085,25 @@ static PyObject *__pyx_pf_7opendbc_3can_10parser_pyx_9CANParser_2update_string(s } __pyx_t_5 = (__pyx_t_8) ? __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 121, __pyx_L1_error) + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 126, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "opendbc/can/parser_pyx.pyx":123 + /* "opendbc/can/parser_pyx.pyx":128 * v.clear() * * self.can.update_string(dat, sendcan) # <<<<<<<<<<<<<< * return self.update_vl() * */ - __pyx_t_9 = __pyx_convert_string_from_py_std__in_string(__pyx_v_dat); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 123, __pyx_L1_error) - __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_v_sendcan); if (unlikely((__pyx_t_10 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 123, __pyx_L1_error) + __pyx_t_9 = __pyx_convert_string_from_py_std__in_string(__pyx_v_dat); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 128, __pyx_L1_error) + __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_v_sendcan); if (unlikely((__pyx_t_10 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 128, __pyx_L1_error) __pyx_v_self->can->update_string(__pyx_t_9, __pyx_t_10); - /* "opendbc/can/parser_pyx.pyx":124 + /* "opendbc/can/parser_pyx.pyx":129 * * self.can.update_string(dat, sendcan) * return self.update_vl() # <<<<<<<<<<<<<< @@ -4027,13 +4111,13 @@ static PyObject *__pyx_pf_7opendbc_3can_10parser_pyx_9CANParser_2update_string(s * def update_strings(self, strings, sendcan=False): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_convert_unordered_set_to_py_uint32_t(((struct __pyx_vtabstruct_7opendbc_3can_10parser_pyx_CANParser *)__pyx_v_self->__pyx_vtab)->update_vl(__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 124, __pyx_L1_error) + __pyx_t_1 = __pyx_convert_unordered_set_to_py_uint32_t(((struct __pyx_vtabstruct_7opendbc_3can_10parser_pyx_CANParser *)__pyx_v_self->__pyx_vtab)->update_vl(__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 129, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "opendbc/can/parser_pyx.pyx":119 + /* "opendbc/can/parser_pyx.pyx":124 * return updated_addrs * * def update_string(self, dat, sendcan=False): # <<<<<<<<<<<<<< @@ -4056,7 +4140,7 @@ static PyObject *__pyx_pf_7opendbc_3can_10parser_pyx_9CANParser_2update_string(s return __pyx_r; } -/* "opendbc/can/parser_pyx.pyx":126 +/* "opendbc/can/parser_pyx.pyx":131 * return self.update_vl() * * def update_strings(self, strings, sendcan=False): # <<<<<<<<<<<<<< @@ -4103,7 +4187,7 @@ static PyObject *__pyx_pw_7opendbc_3can_10parser_pyx_9CANParser_5update_strings( } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "update_strings") < 0)) __PYX_ERR(0, 126, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "update_strings") < 0)) __PYX_ERR(0, 131, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -4119,7 +4203,7 @@ static PyObject *__pyx_pw_7opendbc_3can_10parser_pyx_9CANParser_5update_strings( } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("update_strings", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 126, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("update_strings", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 131, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("opendbc.can.parser_pyx.CANParser.update_strings", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -4154,7 +4238,7 @@ static PyObject *__pyx_pf_7opendbc_3can_10parser_pyx_9CANParser_4update_strings( int __pyx_clineno = 0; __Pyx_RefNannySetupContext("update_strings", 0); - /* "opendbc/can/parser_pyx.pyx":127 + /* "opendbc/can/parser_pyx.pyx":132 * * def update_strings(self, strings, sendcan=False): * for v in self.vl_all.values(): # <<<<<<<<<<<<<< @@ -4164,9 +4248,9 @@ static PyObject *__pyx_pf_7opendbc_3can_10parser_pyx_9CANParser_4update_strings( __pyx_t_2 = 0; if (unlikely(__pyx_v_self->vl_all == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "values"); - __PYX_ERR(0, 127, __pyx_L1_error) + __PYX_ERR(0, 132, __pyx_L1_error) } - __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_self->vl_all, 1, __pyx_n_s_values, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 127, __pyx_L1_error) + __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_self->vl_all, 1, __pyx_n_s_values, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 132, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = __pyx_t_5; @@ -4174,19 +4258,19 @@ static PyObject *__pyx_pf_7opendbc_3can_10parser_pyx_9CANParser_4update_strings( while (1) { __pyx_t_6 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_3, &__pyx_t_2, NULL, &__pyx_t_5, NULL, __pyx_t_4); if (unlikely(__pyx_t_6 == 0)) break; - if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(0, 127, __pyx_L1_error) + if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(0, 132, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_5); __pyx_t_5 = 0; - /* "opendbc/can/parser_pyx.pyx":128 + /* "opendbc/can/parser_pyx.pyx":133 * def update_strings(self, strings, sendcan=False): * for v in self.vl_all.values(): * v.clear() # <<<<<<<<<<<<<< * * updated_addrs = set() */ - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_v, __pyx_n_s_clear); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 128, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_v, __pyx_n_s_clear); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 133, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { @@ -4200,26 +4284,26 @@ static PyObject *__pyx_pf_7opendbc_3can_10parser_pyx_9CANParser_4update_strings( } __pyx_t_5 = (__pyx_t_8) ? __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 128, __pyx_L1_error) + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 133, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "opendbc/can/parser_pyx.pyx":130 + /* "opendbc/can/parser_pyx.pyx":135 * v.clear() * * updated_addrs = set() # <<<<<<<<<<<<<< * for s in strings: * self.can.update_string(s, sendcan) */ - __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 130, __pyx_L1_error) + __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 135, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_updated_addrs = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "opendbc/can/parser_pyx.pyx":131 + /* "opendbc/can/parser_pyx.pyx":136 * * updated_addrs = set() * for s in strings: # <<<<<<<<<<<<<< @@ -4230,26 +4314,26 @@ static PyObject *__pyx_pf_7opendbc_3can_10parser_pyx_9CANParser_4update_strings( __pyx_t_1 = __pyx_v_strings; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0; __pyx_t_9 = NULL; } else { - __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_strings); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 131, __pyx_L1_error) + __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_strings); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 136, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_9 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 131, __pyx_L1_error) + __pyx_t_9 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 136, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_9)) { if (likely(PyList_CheckExact(__pyx_t_1))) { if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 131, __pyx_L1_error) + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 136, __pyx_L1_error) #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 131, __pyx_L1_error) + __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 136, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); #endif } else { if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 131, __pyx_L1_error) + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 136, __pyx_L1_error) #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 131, __pyx_L1_error) + __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 136, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); #endif } @@ -4259,7 +4343,7 @@ static PyObject *__pyx_pf_7opendbc_3can_10parser_pyx_9CANParser_4update_strings( PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 131, __pyx_L1_error) + else __PYX_ERR(0, 136, __pyx_L1_error) } break; } @@ -4268,32 +4352,32 @@ static PyObject *__pyx_pf_7opendbc_3can_10parser_pyx_9CANParser_4update_strings( __Pyx_XDECREF_SET(__pyx_v_s, __pyx_t_5); __pyx_t_5 = 0; - /* "opendbc/can/parser_pyx.pyx":132 + /* "opendbc/can/parser_pyx.pyx":137 * updated_addrs = set() * for s in strings: * self.can.update_string(s, sendcan) # <<<<<<<<<<<<<< * updated_addrs.update(self.update_vl()) * return updated_addrs */ - __pyx_t_10 = __pyx_convert_string_from_py_std__in_string(__pyx_v_s); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 132, __pyx_L1_error) - __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_v_sendcan); if (unlikely((__pyx_t_11 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 132, __pyx_L1_error) + __pyx_t_10 = __pyx_convert_string_from_py_std__in_string(__pyx_v_s); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 137, __pyx_L1_error) + __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_v_sendcan); if (unlikely((__pyx_t_11 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 137, __pyx_L1_error) __pyx_v_self->can->update_string(__pyx_t_10, __pyx_t_11); - /* "opendbc/can/parser_pyx.pyx":133 + /* "opendbc/can/parser_pyx.pyx":138 * for s in strings: * self.can.update_string(s, sendcan) * updated_addrs.update(self.update_vl()) # <<<<<<<<<<<<<< * return updated_addrs * */ - __pyx_t_5 = __pyx_convert_unordered_set_to_py_uint32_t(((struct __pyx_vtabstruct_7opendbc_3can_10parser_pyx_CANParser *)__pyx_v_self->__pyx_vtab)->update_vl(__pyx_v_self)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 133, __pyx_L1_error) + __pyx_t_5 = __pyx_convert_unordered_set_to_py_uint32_t(((struct __pyx_vtabstruct_7opendbc_3can_10parser_pyx_CANParser *)__pyx_v_self->__pyx_vtab)->update_vl(__pyx_v_self)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 138, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PySet_Type_update, __pyx_v_updated_addrs, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 133, __pyx_L1_error) + __pyx_t_7 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PySet_Type_update, __pyx_v_updated_addrs, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 138, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "opendbc/can/parser_pyx.pyx":131 + /* "opendbc/can/parser_pyx.pyx":136 * * updated_addrs = set() * for s in strings: # <<<<<<<<<<<<<< @@ -4303,7 +4387,7 @@ static PyObject *__pyx_pf_7opendbc_3can_10parser_pyx_9CANParser_4update_strings( } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "opendbc/can/parser_pyx.pyx":134 + /* "opendbc/can/parser_pyx.pyx":139 * self.can.update_string(s, sendcan) * updated_addrs.update(self.update_vl()) * return updated_addrs # <<<<<<<<<<<<<< @@ -4315,7 +4399,7 @@ static PyObject *__pyx_pf_7opendbc_3can_10parser_pyx_9CANParser_4update_strings( __pyx_r = __pyx_v_updated_addrs; goto __pyx_L0; - /* "opendbc/can/parser_pyx.pyx":126 + /* "opendbc/can/parser_pyx.pyx":131 * return self.update_vl() * * def update_strings(self, strings, sendcan=False): # <<<<<<<<<<<<<< @@ -4340,7 +4424,7 @@ static PyObject *__pyx_pf_7opendbc_3can_10parser_pyx_9CANParser_4update_strings( return __pyx_r; } -/* "opendbc/can/parser_pyx.pyx":137 +/* "opendbc/can/parser_pyx.pyx":142 * * @property * def can_valid(self): # <<<<<<<<<<<<<< @@ -4370,7 +4454,7 @@ static PyObject *__pyx_pf_7opendbc_3can_10parser_pyx_9CANParser_9can_valid___get int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "opendbc/can/parser_pyx.pyx":138 + /* "opendbc/can/parser_pyx.pyx":143 * @property * def can_valid(self): * return self.can.can_valid # <<<<<<<<<<<<<< @@ -4378,13 +4462,13 @@ static PyObject *__pyx_pf_7opendbc_3can_10parser_pyx_9CANParser_9can_valid___get * @property */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->can->can_valid); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 138, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->can->can_valid); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 143, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "opendbc/can/parser_pyx.pyx":137 + /* "opendbc/can/parser_pyx.pyx":142 * * @property * def can_valid(self): # <<<<<<<<<<<<<< @@ -4403,7 +4487,7 @@ static PyObject *__pyx_pf_7opendbc_3can_10parser_pyx_9CANParser_9can_valid___get return __pyx_r; } -/* "opendbc/can/parser_pyx.pyx":141 +/* "opendbc/can/parser_pyx.pyx":146 * * @property * def bus_timeout(self): # <<<<<<<<<<<<<< @@ -4433,7 +4517,7 @@ static PyObject *__pyx_pf_7opendbc_3can_10parser_pyx_9CANParser_11bus_timeout___ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "opendbc/can/parser_pyx.pyx":142 + /* "opendbc/can/parser_pyx.pyx":147 * @property * def bus_timeout(self): * return self.can.bus_timeout # <<<<<<<<<<<<<< @@ -4441,13 +4525,13 @@ static PyObject *__pyx_pf_7opendbc_3can_10parser_pyx_9CANParser_11bus_timeout___ * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->can->bus_timeout); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 142, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->can->bus_timeout); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 147, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "opendbc/can/parser_pyx.pyx":141 + /* "opendbc/can/parser_pyx.pyx":146 * * @property * def bus_timeout(self): # <<<<<<<<<<<<<< @@ -4471,7 +4555,7 @@ static PyObject *__pyx_pf_7opendbc_3can_10parser_pyx_9CANParser_11bus_timeout___ * cdef readonly: * dict vl # <<<<<<<<<<<<<< * dict vl_all - * string dbc_name + * dict ts_nanos */ /* Python wrapper */ @@ -4507,8 +4591,8 @@ static PyObject *__pyx_pf_7opendbc_3can_10parser_pyx_9CANParser_2vl___get__(stru * cdef readonly: * dict vl * dict vl_all # <<<<<<<<<<<<<< + * dict ts_nanos * string dbc_name - * */ /* Python wrapper */ @@ -4543,6 +4627,43 @@ static PyObject *__pyx_pf_7opendbc_3can_10parser_pyx_9CANParser_6vl_all___get__( /* "opendbc/can/parser_pyx.pyx":29 * dict vl * dict vl_all + * dict ts_nanos # <<<<<<<<<<<<<< + * string dbc_name + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_7opendbc_3can_10parser_pyx_9CANParser_8ts_nanos_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_7opendbc_3can_10parser_pyx_9CANParser_8ts_nanos_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_7opendbc_3can_10parser_pyx_9CANParser_8ts_nanos___get__(((struct __pyx_obj_7opendbc_3can_10parser_pyx_CANParser *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7opendbc_3can_10parser_pyx_9CANParser_8ts_nanos___get__(struct __pyx_obj_7opendbc_3can_10parser_pyx_CANParser *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->ts_nanos); + __pyx_r = __pyx_v_self->ts_nanos; + goto __pyx_L0; + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "opendbc/can/parser_pyx.pyx":30 + * dict vl_all + * dict ts_nanos * string dbc_name # <<<<<<<<<<<<<< * * def __init__(self, dbc_name, signals, checks=None, bus=0, enforce_checks=True): @@ -4570,7 +4691,7 @@ static PyObject *__pyx_pf_7opendbc_3can_10parser_pyx_9CANParser_8dbc_name___get_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_self->dbc_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __pyx_L1_error) + __pyx_t_1 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_self->dbc_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 30, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -4700,7 +4821,7 @@ static PyObject *__pyx_pf_7opendbc_3can_10parser_pyx_9CANParser_8__setstate_cyth return __pyx_r; } -/* "opendbc/can/parser_pyx.pyx":153 +/* "opendbc/can/parser_pyx.pyx":158 * string dbc_name * * def __init__(self, dbc_name): # <<<<<<<<<<<<<< @@ -4737,7 +4858,7 @@ static int __pyx_pw_7opendbc_3can_10parser_pyx_9CANDefine_1__init__(PyObject *__ else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 153, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 158, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { goto __pyx_L5_argtuple_error; @@ -4748,7 +4869,7 @@ static int __pyx_pw_7opendbc_3can_10parser_pyx_9CANDefine_1__init__(PyObject *__ } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 153, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 158, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("opendbc.can.parser_pyx.CANDefine.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -4763,7 +4884,7 @@ static int __pyx_pw_7opendbc_3can_10parser_pyx_9CANDefine_1__init__(PyObject *__ static int __pyx_pf_7opendbc_3can_10parser_pyx_9CANDefine___init__(struct __pyx_obj_7opendbc_3can_10parser_pyx_CANDefine *__pyx_v_self, PyObject *__pyx_v_dbc_name) { PyObject *__pyx_v_address_to_msg_name = NULL; - std::vector ::size_type __pyx_v_i; + std::vector ::size_type __pyx_v_i; struct Msg __pyx_v_msg; PyObject *__pyx_v_name = NULL; uint32_t __pyx_v_address; @@ -4785,7 +4906,7 @@ static int __pyx_pf_7opendbc_3can_10parser_pyx_9CANDefine___init__(struct __pyx_ PyObject *__pyx_t_6 = NULL; std::vector ::size_type __pyx_t_7; std::vector ::size_type __pyx_t_8; - std::vector ::size_type __pyx_t_9; + std::vector ::size_type __pyx_t_9; uint32_t __pyx_t_10; PyObject *__pyx_t_11 = NULL; std::vector ::size_type __pyx_t_12; @@ -4796,27 +4917,27 @@ static int __pyx_pf_7opendbc_3can_10parser_pyx_9CANDefine___init__(struct __pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__init__", 0); - /* "opendbc/can/parser_pyx.pyx":154 + /* "opendbc/can/parser_pyx.pyx":159 * * def __init__(self, dbc_name): * self.dbc_name = dbc_name # <<<<<<<<<<<<<< * self.dbc = dbc_lookup(dbc_name) * if not self.dbc: */ - __pyx_t_1 = __pyx_convert_string_from_py_std__in_string(__pyx_v_dbc_name); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 154, __pyx_L1_error) + __pyx_t_1 = __pyx_convert_string_from_py_std__in_string(__pyx_v_dbc_name); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 159, __pyx_L1_error) __pyx_v_self->dbc_name = __pyx_t_1; - /* "opendbc/can/parser_pyx.pyx":155 + /* "opendbc/can/parser_pyx.pyx":160 * def __init__(self, dbc_name): * self.dbc_name = dbc_name * self.dbc = dbc_lookup(dbc_name) # <<<<<<<<<<<<<< * if not self.dbc: * raise RuntimeError(f"Can't find DBC: '{dbc_name}'") */ - __pyx_t_1 = __pyx_convert_string_from_py_std__in_string(__pyx_v_dbc_name); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 155, __pyx_L1_error) + __pyx_t_1 = __pyx_convert_string_from_py_std__in_string(__pyx_v_dbc_name); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 160, __pyx_L1_error) __pyx_v_self->dbc = dbc_lookup(__pyx_t_1); - /* "opendbc/can/parser_pyx.pyx":156 + /* "opendbc/can/parser_pyx.pyx":161 * self.dbc_name = dbc_name * self.dbc = dbc_lookup(dbc_name) * if not self.dbc: # <<<<<<<<<<<<<< @@ -4826,14 +4947,14 @@ static int __pyx_pf_7opendbc_3can_10parser_pyx_9CANDefine___init__(struct __pyx_ __pyx_t_2 = ((!(__pyx_v_self->dbc != 0)) != 0); if (unlikely(__pyx_t_2)) { - /* "opendbc/can/parser_pyx.pyx":157 + /* "opendbc/can/parser_pyx.pyx":162 * self.dbc = dbc_lookup(dbc_name) * if not self.dbc: * raise RuntimeError(f"Can't find DBC: '{dbc_name}'") # <<<<<<<<<<<<<< * * address_to_msg_name = {} */ - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 157, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 162, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 0; __pyx_t_5 = 127; @@ -4841,7 +4962,7 @@ static int __pyx_pf_7opendbc_3can_10parser_pyx_9CANDefine___init__(struct __pyx_ __pyx_t_4 += 17; __Pyx_GIVEREF(__pyx_kp_u_Can_t_find_DBC_2); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_Can_t_find_DBC_2); - __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_v_dbc_name, __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 157, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_v_dbc_name, __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 162, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_5; __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6); @@ -4852,17 +4973,17 @@ static int __pyx_pf_7opendbc_3can_10parser_pyx_9CANDefine___init__(struct __pyx_ __pyx_t_4 += 1; __Pyx_GIVEREF(__pyx_kp_u__6); PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u__6); - __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_3, 3, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 157, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_3, 3, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 162, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 157, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 162, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(0, 157, __pyx_L1_error) + __PYX_ERR(0, 162, __pyx_L1_error) - /* "opendbc/can/parser_pyx.pyx":156 + /* "opendbc/can/parser_pyx.pyx":161 * self.dbc_name = dbc_name * self.dbc = dbc_lookup(dbc_name) * if not self.dbc: # <<<<<<<<<<<<<< @@ -4871,19 +4992,19 @@ static int __pyx_pf_7opendbc_3can_10parser_pyx_9CANDefine___init__(struct __pyx_ */ } - /* "opendbc/can/parser_pyx.pyx":159 + /* "opendbc/can/parser_pyx.pyx":164 * raise RuntimeError(f"Can't find DBC: '{dbc_name}'") * * address_to_msg_name = {} # <<<<<<<<<<<<<< * * for i in range(self.dbc[0].msgs.size()): */ - __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 159, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 164, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_v_address_to_msg_name = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; - /* "opendbc/can/parser_pyx.pyx":161 + /* "opendbc/can/parser_pyx.pyx":166 * address_to_msg_name = {} * * for i in range(self.dbc[0].msgs.size()): # <<<<<<<<<<<<<< @@ -4895,7 +5016,7 @@ static int __pyx_pf_7opendbc_3can_10parser_pyx_9CANDefine___init__(struct __pyx_ for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { __pyx_v_i = __pyx_t_9; - /* "opendbc/can/parser_pyx.pyx":162 + /* "opendbc/can/parser_pyx.pyx":167 * * for i in range(self.dbc[0].msgs.size()): * msg = self.dbc[0].msgs[i] # <<<<<<<<<<<<<< @@ -4904,19 +5025,19 @@ static int __pyx_pf_7opendbc_3can_10parser_pyx_9CANDefine___init__(struct __pyx_ */ __pyx_v_msg = ((__pyx_v_self->dbc[0]).msgs[__pyx_v_i]); - /* "opendbc/can/parser_pyx.pyx":163 + /* "opendbc/can/parser_pyx.pyx":168 * for i in range(self.dbc[0].msgs.size()): * msg = self.dbc[0].msgs[i] * name = msg.name.decode('utf8') # <<<<<<<<<<<<<< * address = msg.address * address_to_msg_name[address] = name */ - __pyx_t_3 = __Pyx_decode_cpp_string(__pyx_v_msg.name, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 163, __pyx_L1_error) + __pyx_t_3 = __Pyx_decode_cpp_string(__pyx_v_msg.name, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 168, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_3); __pyx_t_3 = 0; - /* "opendbc/can/parser_pyx.pyx":164 + /* "opendbc/can/parser_pyx.pyx":169 * msg = self.dbc[0].msgs[i] * name = msg.name.decode('utf8') * address = msg.address # <<<<<<<<<<<<<< @@ -4926,27 +5047,27 @@ static int __pyx_pf_7opendbc_3can_10parser_pyx_9CANDefine___init__(struct __pyx_ __pyx_t_10 = __pyx_v_msg.address; __pyx_v_address = __pyx_t_10; - /* "opendbc/can/parser_pyx.pyx":165 + /* "opendbc/can/parser_pyx.pyx":170 * name = msg.name.decode('utf8') * address = msg.address * address_to_msg_name[address] = name # <<<<<<<<<<<<<< * * dv = defaultdict(dict) */ - __pyx_t_3 = __Pyx_PyInt_From_uint32_t(__pyx_v_address); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 165, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_uint32_t(__pyx_v_address); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 170, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (unlikely(PyDict_SetItem(__pyx_v_address_to_msg_name, __pyx_t_3, __pyx_v_name) < 0)) __PYX_ERR(0, 165, __pyx_L1_error) + if (unlikely(PyDict_SetItem(__pyx_v_address_to_msg_name, __pyx_t_3, __pyx_v_name) < 0)) __PYX_ERR(0, 170, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } - /* "opendbc/can/parser_pyx.pyx":167 + /* "opendbc/can/parser_pyx.pyx":172 * address_to_msg_name[address] = name * * dv = defaultdict(dict) # <<<<<<<<<<<<<< * * for i in range(self.dbc[0].vals.size()): */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_defaultdict); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 167, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_defaultdict); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 172, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_11 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { @@ -4960,25 +5081,25 @@ static int __pyx_pf_7opendbc_3can_10parser_pyx_9CANDefine___init__(struct __pyx_ } __pyx_t_3 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_11, ((PyObject *)(&PyDict_Type))) : __Pyx_PyObject_CallOneArg(__pyx_t_6, ((PyObject *)(&PyDict_Type))); __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 167, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 172, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_v_dv = __pyx_t_3; __pyx_t_3 = 0; - /* "opendbc/can/parser_pyx.pyx":169 + /* "opendbc/can/parser_pyx.pyx":174 * dv = defaultdict(dict) * * for i in range(self.dbc[0].vals.size()): # <<<<<<<<<<<<<< * val = self.dbc[0].vals[i] * */ - __pyx_t_12 = (__pyx_v_self->dbc[0]).vals.size(); - __pyx_t_13 = __pyx_t_12; - for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_13; __pyx_t_7+=1) { - __pyx_v_i = __pyx_t_7; + __pyx_t_9 = (__pyx_v_self->dbc[0]).vals.size(); + __pyx_t_12 = __pyx_t_9; + for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) { + __pyx_v_i = __pyx_t_13; - /* "opendbc/can/parser_pyx.pyx":170 + /* "opendbc/can/parser_pyx.pyx":175 * * for i in range(self.dbc[0].vals.size()): * val = self.dbc[0].vals[i] # <<<<<<<<<<<<<< @@ -4987,31 +5108,31 @@ static int __pyx_pf_7opendbc_3can_10parser_pyx_9CANDefine___init__(struct __pyx_ */ __pyx_v_val = ((__pyx_v_self->dbc[0]).vals[__pyx_v_i]); - /* "opendbc/can/parser_pyx.pyx":172 + /* "opendbc/can/parser_pyx.pyx":177 * val = self.dbc[0].vals[i] * * sgname = val.name.decode('utf8') # <<<<<<<<<<<<<< * def_val = val.def_val.decode('utf8') * address = val.address */ - __pyx_t_3 = __Pyx_decode_cpp_string(__pyx_v_val.name, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 172, __pyx_L1_error) + __pyx_t_3 = __Pyx_decode_cpp_string(__pyx_v_val.name, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 177, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_XDECREF_SET(__pyx_v_sgname, __pyx_t_3); __pyx_t_3 = 0; - /* "opendbc/can/parser_pyx.pyx":173 + /* "opendbc/can/parser_pyx.pyx":178 * * sgname = val.name.decode('utf8') * def_val = val.def_val.decode('utf8') # <<<<<<<<<<<<<< * address = val.address * msgname = address_to_msg_name[address] */ - __pyx_t_3 = __Pyx_decode_cpp_string(__pyx_v_val.def_val, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 173, __pyx_L1_error) + __pyx_t_3 = __Pyx_decode_cpp_string(__pyx_v_val.def_val, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 178, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_XDECREF_SET(__pyx_v_def_val, __pyx_t_3); __pyx_t_3 = 0; - /* "opendbc/can/parser_pyx.pyx":174 + /* "opendbc/can/parser_pyx.pyx":179 * sgname = val.name.decode('utf8') * def_val = val.def_val.decode('utf8') * address = val.address # <<<<<<<<<<<<<< @@ -5021,29 +5142,29 @@ static int __pyx_pf_7opendbc_3can_10parser_pyx_9CANDefine___init__(struct __pyx_ __pyx_t_10 = __pyx_v_val.address; __pyx_v_address = __pyx_t_10; - /* "opendbc/can/parser_pyx.pyx":175 + /* "opendbc/can/parser_pyx.pyx":180 * def_val = val.def_val.decode('utf8') * address = val.address * msgname = address_to_msg_name[address] # <<<<<<<<<<<<<< * * # separate definition/value pairs */ - __pyx_t_3 = __Pyx_PyInt_From_uint32_t(__pyx_v_address); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 175, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_uint32_t(__pyx_v_address); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 180, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = __Pyx_PyDict_GetItem(__pyx_v_address_to_msg_name, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 175, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyDict_GetItem(__pyx_v_address_to_msg_name, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 180, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF_SET(__pyx_v_msgname, __pyx_t_6); __pyx_t_6 = 0; - /* "opendbc/can/parser_pyx.pyx":178 + /* "opendbc/can/parser_pyx.pyx":183 * * # separate definition/value pairs * def_val = def_val.split() # <<<<<<<<<<<<<< * values = [int(v) for v in def_val[::2]] * defs = def_val[1::2] */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_def_val, __pyx_n_s_split); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 178, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_def_val, __pyx_n_s_split); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 183, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_11 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { @@ -5057,13 +5178,13 @@ static int __pyx_pf_7opendbc_3can_10parser_pyx_9CANDefine___init__(struct __pyx_ } __pyx_t_6 = (__pyx_t_11) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_11) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 178, __pyx_L1_error) + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 183, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF_SET(__pyx_v_def_val, __pyx_t_6); __pyx_t_6 = 0; - /* "opendbc/can/parser_pyx.pyx":179 + /* "opendbc/can/parser_pyx.pyx":184 * # separate definition/value pairs * def_val = def_val.split() * values = [int(v) for v in def_val[::2]] # <<<<<<<<<<<<<< @@ -5071,17 +5192,17 @@ static int __pyx_pf_7opendbc_3can_10parser_pyx_9CANDefine___init__(struct __pyx_ * */ { /* enter inner scope */ - __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 179, __pyx_L10_error) + __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 184, __pyx_L10_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_def_val, __pyx_slice__7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 179, __pyx_L10_error) + __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_def_val, __pyx_slice__7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 184, __pyx_L10_error) __Pyx_GOTREF(__pyx_t_3); if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) { __pyx_t_11 = __pyx_t_3; __Pyx_INCREF(__pyx_t_11); __pyx_t_4 = 0; __pyx_t_14 = NULL; } else { - __pyx_t_4 = -1; __pyx_t_11 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 179, __pyx_L10_error) + __pyx_t_4 = -1; __pyx_t_11 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 184, __pyx_L10_error) __Pyx_GOTREF(__pyx_t_11); - __pyx_t_14 = Py_TYPE(__pyx_t_11)->tp_iternext; if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 179, __pyx_L10_error) + __pyx_t_14 = Py_TYPE(__pyx_t_11)->tp_iternext; if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 184, __pyx_L10_error) } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; for (;;) { @@ -5089,17 +5210,17 @@ static int __pyx_pf_7opendbc_3can_10parser_pyx_9CANDefine___init__(struct __pyx_ if (likely(PyList_CheckExact(__pyx_t_11))) { if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_11)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_11, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 179, __pyx_L10_error) + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_11, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 184, __pyx_L10_error) #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_11, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 179, __pyx_L10_error) + __pyx_t_3 = PySequence_ITEM(__pyx_t_11, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 184, __pyx_L10_error) __Pyx_GOTREF(__pyx_t_3); #endif } else { if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_11)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_11, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 179, __pyx_L10_error) + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_11, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 184, __pyx_L10_error) #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_11, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 179, __pyx_L10_error) + __pyx_t_3 = PySequence_ITEM(__pyx_t_11, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 184, __pyx_L10_error) __Pyx_GOTREF(__pyx_t_3); #endif } @@ -5109,7 +5230,7 @@ static int __pyx_pf_7opendbc_3can_10parser_pyx_9CANDefine___init__(struct __pyx_ PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 179, __pyx_L10_error) + else __PYX_ERR(0, 184, __pyx_L10_error) } break; } @@ -5117,9 +5238,9 @@ static int __pyx_pf_7opendbc_3can_10parser_pyx_9CANDefine___init__(struct __pyx_ } __Pyx_XDECREF_SET(__pyx_8genexpr4__pyx_v_v, __pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyNumber_Int(__pyx_8genexpr4__pyx_v_v); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 179, __pyx_L10_error) + __pyx_t_3 = __Pyx_PyNumber_Int(__pyx_8genexpr4__pyx_v_v); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 184, __pyx_L10_error) __Pyx_GOTREF(__pyx_t_3); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_6, (PyObject*)__pyx_t_3))) __PYX_ERR(0, 179, __pyx_L10_error) + if (unlikely(__Pyx_ListComp_Append(__pyx_t_6, (PyObject*)__pyx_t_3))) __PYX_ERR(0, 184, __pyx_L10_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; @@ -5133,26 +5254,26 @@ static int __pyx_pf_7opendbc_3can_10parser_pyx_9CANDefine___init__(struct __pyx_ __Pyx_XDECREF_SET(__pyx_v_values, ((PyObject*)__pyx_t_6)); __pyx_t_6 = 0; - /* "opendbc/can/parser_pyx.pyx":180 + /* "opendbc/can/parser_pyx.pyx":185 * def_val = def_val.split() * values = [int(v) for v in def_val[::2]] * defs = def_val[1::2] # <<<<<<<<<<<<<< * * # two ways to lookup: address or msg name */ - __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_v_def_val, __pyx_slice__8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 180, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_v_def_val, __pyx_slice__8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 185, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_XDECREF_SET(__pyx_v_defs, __pyx_t_6); __pyx_t_6 = 0; - /* "opendbc/can/parser_pyx.pyx":183 + /* "opendbc/can/parser_pyx.pyx":188 * * # two ways to lookup: address or msg name * dv[address][sgname] = dict(zip(values, defs)) # <<<<<<<<<<<<<< * dv[msgname][sgname] = dv[address][sgname] * */ - __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 183, __pyx_L1_error) + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 188, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_INCREF(__pyx_v_values); __Pyx_GIVEREF(__pyx_v_values); @@ -5160,43 +5281,43 @@ static int __pyx_pf_7opendbc_3can_10parser_pyx_9CANDefine___init__(struct __pyx_ __Pyx_INCREF(__pyx_v_defs); __Pyx_GIVEREF(__pyx_v_defs); PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_defs); - __pyx_t_11 = __Pyx_PyObject_Call(__pyx_builtin_zip, __pyx_t_6, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 183, __pyx_L1_error) + __pyx_t_11 = __Pyx_PyObject_Call(__pyx_builtin_zip, __pyx_t_6, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 188, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyDict_Type)), __pyx_t_11); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 183, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyDict_Type)), __pyx_t_11); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 188, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_11 = __Pyx_GetItemInt(__pyx_v_dv, __pyx_v_address, uint32_t, 0, __Pyx_PyInt_From_uint32_t, 0, 0, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 183, __pyx_L1_error) + __pyx_t_11 = __Pyx_GetItemInt(__pyx_v_dv, __pyx_v_address, uint32_t, 0, __Pyx_PyInt_From_uint32_t, 0, 0, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 188, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); - if (unlikely(PyObject_SetItem(__pyx_t_11, __pyx_v_sgname, __pyx_t_6) < 0)) __PYX_ERR(0, 183, __pyx_L1_error) + if (unlikely(PyObject_SetItem(__pyx_t_11, __pyx_v_sgname, __pyx_t_6) < 0)) __PYX_ERR(0, 188, __pyx_L1_error) __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "opendbc/can/parser_pyx.pyx":184 + /* "opendbc/can/parser_pyx.pyx":189 * # two ways to lookup: address or msg name * dv[address][sgname] = dict(zip(values, defs)) * dv[msgname][sgname] = dv[address][sgname] # <<<<<<<<<<<<<< * * self.dv = dict(dv) */ - __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_dv, __pyx_v_address, uint32_t, 0, __Pyx_PyInt_From_uint32_t, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 184, __pyx_L1_error) + __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_dv, __pyx_v_address, uint32_t, 0, __Pyx_PyInt_From_uint32_t, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 189, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_t_6, __pyx_v_sgname); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 184, __pyx_L1_error) + __pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_t_6, __pyx_v_sgname); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 189, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_v_dv, __pyx_v_msgname); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 184, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_v_dv, __pyx_v_msgname); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 189, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - if (unlikely(PyObject_SetItem(__pyx_t_6, __pyx_v_sgname, __pyx_t_11) < 0)) __PYX_ERR(0, 184, __pyx_L1_error) + if (unlikely(PyObject_SetItem(__pyx_t_6, __pyx_v_sgname, __pyx_t_11) < 0)) __PYX_ERR(0, 189, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; } - /* "opendbc/can/parser_pyx.pyx":186 + /* "opendbc/can/parser_pyx.pyx":191 * dv[msgname][sgname] = dv[address][sgname] * * self.dv = dict(dv) # <<<<<<<<<<<<<< */ - __pyx_t_11 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyDict_Type)), __pyx_v_dv); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 186, __pyx_L1_error) + __pyx_t_11 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyDict_Type)), __pyx_v_dv); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 191, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_GIVEREF(__pyx_t_11); __Pyx_GOTREF(__pyx_v_self->dv); @@ -5204,7 +5325,7 @@ static int __pyx_pf_7opendbc_3can_10parser_pyx_9CANDefine___init__(struct __pyx_ __pyx_v_self->dv = ((PyObject*)__pyx_t_11); __pyx_t_11 = 0; - /* "opendbc/can/parser_pyx.pyx":153 + /* "opendbc/can/parser_pyx.pyx":158 * string dbc_name * * def __init__(self, dbc_name): # <<<<<<<<<<<<<< @@ -5235,7 +5356,7 @@ static int __pyx_pf_7opendbc_3can_10parser_pyx_9CANDefine___init__(struct __pyx_ return __pyx_r; } -/* "opendbc/can/parser_pyx.pyx":150 +/* "opendbc/can/parser_pyx.pyx":155 * * cdef public: * dict dv # <<<<<<<<<<<<<< @@ -5293,7 +5414,7 @@ static int __pyx_pf_7opendbc_3can_10parser_pyx_9CANDefine_2dv_2__set__(struct __ const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__set__", 0); - if (!(likely(PyDict_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_value)->tp_name), 0))) __PYX_ERR(0, 150, __pyx_L1_error) + if (!(likely(PyDict_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_value)->tp_name), 0))) __PYX_ERR(0, 155, __pyx_L1_error) __pyx_t_1 = __pyx_v_value; __Pyx_INCREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); @@ -5343,7 +5464,7 @@ static int __pyx_pf_7opendbc_3can_10parser_pyx_9CANDefine_2dv_4__del__(struct __ return __pyx_r; } -/* "opendbc/can/parser_pyx.pyx":151 +/* "opendbc/can/parser_pyx.pyx":156 * cdef public: * dict dv * string dbc_name # <<<<<<<<<<<<<< @@ -5373,7 +5494,7 @@ static PyObject *__pyx_pf_7opendbc_3can_10parser_pyx_9CANDefine_8dbc_name___get_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_self->dbc_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 151, __pyx_L1_error) + __pyx_t_1 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_self->dbc_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 156, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -5411,7 +5532,7 @@ static int __pyx_pf_7opendbc_3can_10parser_pyx_9CANDefine_8dbc_name_2__set__(str const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__set__", 0); - __pyx_t_1 = __pyx_convert_string_from_py_std__in_string(__pyx_v_value); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 151, __pyx_L1_error) + __pyx_t_1 = __pyx_convert_string_from_py_std__in_string(__pyx_v_value); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 156, __pyx_L1_error) __pyx_v_self->dbc_name = __pyx_t_1; /* function exit code */ @@ -6040,6 +6161,7 @@ static PyObject *__pyx_tp_new_7opendbc_3can_10parser_pyx_CANParser(PyTypeObject new((void*)&(p->dbc_name)) std::string(); p->vl = ((PyObject*)Py_None); Py_INCREF(Py_None); p->vl_all = ((PyObject*)Py_None); Py_INCREF(Py_None); + p->ts_nanos = ((PyObject*)Py_None); Py_INCREF(Py_None); return o; } @@ -6056,6 +6178,7 @@ static void __pyx_tp_dealloc_7opendbc_3can_10parser_pyx_CANParser(PyObject *o) { __Pyx_call_destructor(p->dbc_name); Py_CLEAR(p->vl); Py_CLEAR(p->vl_all); + Py_CLEAR(p->ts_nanos); (*Py_TYPE(o)->tp_free)(o); } @@ -6068,6 +6191,9 @@ static int __pyx_tp_traverse_7opendbc_3can_10parser_pyx_CANParser(PyObject *o, v if (p->vl_all) { e = (*v)(p->vl_all, a); if (e) return e; } + if (p->ts_nanos) { + e = (*v)(p->ts_nanos, a); if (e) return e; + } return 0; } @@ -6080,6 +6206,9 @@ static int __pyx_tp_clear_7opendbc_3can_10parser_pyx_CANParser(PyObject *o) { tmp = ((PyObject*)p->vl_all); p->vl_all = ((PyObject*)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); + tmp = ((PyObject*)p->ts_nanos); + p->ts_nanos = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); return 0; } @@ -6099,6 +6228,10 @@ static PyObject *__pyx_getprop_7opendbc_3can_10parser_pyx_9CANParser_vl_all(PyOb return __pyx_pw_7opendbc_3can_10parser_pyx_9CANParser_6vl_all_1__get__(o); } +static PyObject *__pyx_getprop_7opendbc_3can_10parser_pyx_9CANParser_ts_nanos(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_7opendbc_3can_10parser_pyx_9CANParser_8ts_nanos_1__get__(o); +} + static PyObject *__pyx_getprop_7opendbc_3can_10parser_pyx_9CANParser_dbc_name(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_7opendbc_3can_10parser_pyx_9CANParser_8dbc_name_1__get__(o); } @@ -6116,6 +6249,7 @@ static struct PyGetSetDef __pyx_getsets_7opendbc_3can_10parser_pyx_CANParser[] = {(char *)"bus_timeout", __pyx_getprop_7opendbc_3can_10parser_pyx_9CANParser_bus_timeout, 0, (char *)0, 0}, {(char *)"vl", __pyx_getprop_7opendbc_3can_10parser_pyx_9CANParser_vl, 0, (char *)0, 0}, {(char *)"vl_all", __pyx_getprop_7opendbc_3can_10parser_pyx_9CANParser_vl_all, 0, (char *)0, 0}, + {(char *)"ts_nanos", __pyx_getprop_7opendbc_3can_10parser_pyx_9CANParser_ts_nanos, 0, (char *)0, 0}, {(char *)"dbc_name", __pyx_getprop_7opendbc_3can_10parser_pyx_9CANParser_dbc_name, 0, (char *)0, 0}, {0, 0, 0, 0, 0} }; @@ -6818,12 +6952,12 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {0, 0, 0, 0, 0, 0, 0} }; static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(0, 38, __pyx_L1_error) - __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 48, __pyx_L1_error) - __pyx_builtin_print = __Pyx_GetBuiltinName(__pyx_n_s_print); if (!__pyx_builtin_print) __PYX_ERR(0, 64, __pyx_L1_error) - __pyx_builtin_hex = __Pyx_GetBuiltinName(__pyx_n_s_hex); if (!__pyx_builtin_hex) __PYX_ERR(0, 83, __pyx_L1_error) + __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(0, 39, __pyx_L1_error) + __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 50, __pyx_L1_error) + __pyx_builtin_print = __Pyx_GetBuiltinName(__pyx_n_s_print); if (!__pyx_builtin_print) __PYX_ERR(0, 68, __pyx_L1_error) + __pyx_builtin_hex = __Pyx_GetBuiltinName(__pyx_n_s_hex); if (!__pyx_builtin_hex) __PYX_ERR(0, 87, __pyx_L1_error) __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(1, 2, __pyx_L1_error) - __pyx_builtin_zip = __Pyx_GetBuiltinName(__pyx_n_s_zip); if (!__pyx_builtin_zip) __PYX_ERR(0, 183, __pyx_L1_error) + __pyx_builtin_zip = __Pyx_GetBuiltinName(__pyx_n_s_zip); if (!__pyx_builtin_zip) __PYX_ERR(0, 188, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; @@ -6852,25 +6986,25 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_tuple__5); __Pyx_GIVEREF(__pyx_tuple__5); - /* "opendbc/can/parser_pyx.pyx":179 + /* "opendbc/can/parser_pyx.pyx":184 * # separate definition/value pairs * def_val = def_val.split() * values = [int(v) for v in def_val[::2]] # <<<<<<<<<<<<<< * defs = def_val[1::2] * */ - __pyx_slice__7 = PySlice_New(Py_None, Py_None, __pyx_int_2); if (unlikely(!__pyx_slice__7)) __PYX_ERR(0, 179, __pyx_L1_error) + __pyx_slice__7 = PySlice_New(Py_None, Py_None, __pyx_int_2); if (unlikely(!__pyx_slice__7)) __PYX_ERR(0, 184, __pyx_L1_error) __Pyx_GOTREF(__pyx_slice__7); __Pyx_GIVEREF(__pyx_slice__7); - /* "opendbc/can/parser_pyx.pyx":180 + /* "opendbc/can/parser_pyx.pyx":185 * def_val = def_val.split() * values = [int(v) for v in def_val[::2]] * defs = def_val[1::2] # <<<<<<<<<<<<<< * * # two ways to lookup: address or msg name */ - __pyx_slice__8 = PySlice_New(__pyx_int_1, Py_None, __pyx_int_2); if (unlikely(!__pyx_slice__8)) __PYX_ERR(0, 180, __pyx_L1_error) + __pyx_slice__8 = PySlice_New(__pyx_int_1, Py_None, __pyx_int_2); if (unlikely(!__pyx_slice__8)) __PYX_ERR(0, 185, __pyx_L1_error) __Pyx_GOTREF(__pyx_slice__8); __Pyx_GIVEREF(__pyx_slice__8); @@ -6963,17 +7097,17 @@ static int __Pyx_modinit_type_init_code(void) { if (PyObject_SetAttr(__pyx_m, __pyx_n_s_CANParser, (PyObject *)&__pyx_type_7opendbc_3can_10parser_pyx_CANParser) < 0) __PYX_ERR(0, 19, __pyx_L1_error) if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7opendbc_3can_10parser_pyx_CANParser) < 0) __PYX_ERR(0, 19, __pyx_L1_error) __pyx_ptype_7opendbc_3can_10parser_pyx_CANParser = &__pyx_type_7opendbc_3can_10parser_pyx_CANParser; - if (PyType_Ready(&__pyx_type_7opendbc_3can_10parser_pyx_CANDefine) < 0) __PYX_ERR(0, 145, __pyx_L1_error) + if (PyType_Ready(&__pyx_type_7opendbc_3can_10parser_pyx_CANDefine) < 0) __PYX_ERR(0, 150, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 __pyx_type_7opendbc_3can_10parser_pyx_CANDefine.tp_print = 0; #endif if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7opendbc_3can_10parser_pyx_CANDefine.tp_dictoffset && __pyx_type_7opendbc_3can_10parser_pyx_CANDefine.tp_getattro == PyObject_GenericGetAttr)) { __pyx_type_7opendbc_3can_10parser_pyx_CANDefine.tp_getattro = __Pyx_PyObject_GenericGetAttr; } - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_CANDefine, (PyObject *)&__pyx_type_7opendbc_3can_10parser_pyx_CANDefine) < 0) __PYX_ERR(0, 145, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7opendbc_3can_10parser_pyx_CANDefine) < 0) __PYX_ERR(0, 145, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_CANDefine, (PyObject *)&__pyx_type_7opendbc_3can_10parser_pyx_CANDefine) < 0) __PYX_ERR(0, 150, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7opendbc_3can_10parser_pyx_CANDefine) < 0) __PYX_ERR(0, 150, __pyx_L1_error) __pyx_ptype_7opendbc_3can_10parser_pyx_CANDefine = &__pyx_type_7opendbc_3can_10parser_pyx_CANDefine; - if (PyType_Ready(&__pyx_type_7opendbc_3can_10parser_pyx___pyx_scope_struct____init__) < 0) __PYX_ERR(0, 31, __pyx_L1_error) + if (PyType_Ready(&__pyx_type_7opendbc_3can_10parser_pyx___pyx_scope_struct____init__) < 0) __PYX_ERR(0, 32, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 __pyx_type_7opendbc_3can_10parser_pyx___pyx_scope_struct____init__.tp_print = 0; #endif @@ -6981,7 +7115,7 @@ static int __Pyx_modinit_type_init_code(void) { __pyx_type_7opendbc_3can_10parser_pyx___pyx_scope_struct____init__.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; } __pyx_ptype_7opendbc_3can_10parser_pyx___pyx_scope_struct____init__ = &__pyx_type_7opendbc_3can_10parser_pyx___pyx_scope_struct____init__; - if (PyType_Ready(&__pyx_type_7opendbc_3can_10parser_pyx___pyx_scope_struct_1_genexpr) < 0) __PYX_ERR(0, 83, __pyx_L1_error) + if (PyType_Ready(&__pyx_type_7opendbc_3can_10parser_pyx___pyx_scope_struct_1_genexpr) < 0) __PYX_ERR(0, 87, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 __pyx_type_7opendbc_3can_10parser_pyx___pyx_scope_struct_1_genexpr.tp_print = 0; #endif @@ -6989,7 +7123,7 @@ static int __Pyx_modinit_type_init_code(void) { __pyx_type_7opendbc_3can_10parser_pyx___pyx_scope_struct_1_genexpr.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; } __pyx_ptype_7opendbc_3can_10parser_pyx___pyx_scope_struct_1_genexpr = &__pyx_type_7opendbc_3can_10parser_pyx___pyx_scope_struct_1_genexpr; - if (PyType_Ready(&__pyx_type_7opendbc_3can_10parser_pyx___pyx_scope_struct_2_genexpr) < 0) __PYX_ERR(0, 93, __pyx_L1_error) + if (PyType_Ready(&__pyx_type_7opendbc_3can_10parser_pyx___pyx_scope_struct_2_genexpr) < 0) __PYX_ERR(0, 97, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 __pyx_type_7opendbc_3can_10parser_pyx___pyx_scope_struct_2_genexpr.tp_print = 0; #endif @@ -9961,6 +10095,44 @@ raise_neg_overflow: return (int) -1; } +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint64_t(uint64_t value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const uint64_t neg_one = (uint64_t) -1, const_zero = (uint64_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(uint64_t) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(uint64_t) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(uint64_t) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(uint64_t) <= sizeof(long)) { + return PyInt_FromLong((long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(uint64_t) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); +#endif + } + } + { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&value; + return _PyLong_FromByteArray(bytes, sizeof(uint64_t), + little, !is_unsigned); + } +} + /* CIntFromPy */ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC diff --git a/opendbc/can/parser_pyx.so b/opendbc/can/parser_pyx.so index 9fd0fe548..7f750d9a9 100755 Binary files a/opendbc/can/parser_pyx.so and b/opendbc/can/parser_pyx.so differ diff --git a/opendbc/chrysler_pacifica_2017_hybrid_generated.dbc b/opendbc/chrysler_pacifica_2017_hybrid_generated.dbc index a93ae1d34..3036bc728 100644 --- a/opendbc/chrysler_pacifica_2017_hybrid_generated.dbc +++ b/opendbc/chrysler_pacifica_2017_hybrid_generated.dbc @@ -81,6 +81,7 @@ BO_ 544 EPS_2: 8 XXX SG_ TORQUE_OVERLAY_STATUS : 6|4@0+ (1,0) [0|15] "" XXX SG_ EPS_TORQUE_MOTOR_RAW : 19|12@0+ (1,-2048) [-2048|2047] "" XXX SG_ EPS_TORQUE_MOTOR : 34|11@0+ (1,-1024) [-1024|1023] "" XXX + SG_ LKAS_TEMPORARY_FAULT : 38|1@0+ (1,0) [0|1] "" XXX SG_ AUTO_PARK_HAS_CONTROL_2 : 51|1@0+ (1,0) [0|1] "" XXX SG_ COUNTER : 55|4@0+ (1,0) [0|15] "" XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX diff --git a/opendbc/chrysler_ram_dt_generated.dbc b/opendbc/chrysler_ram_dt_generated.dbc index 0736a52c9..2eb5aecf3 100644 --- a/opendbc/chrysler_ram_dt_generated.dbc +++ b/opendbc/chrysler_ram_dt_generated.dbc @@ -83,6 +83,7 @@ BO_ 49 EPS_2: 8 XXX SG_ TORQUE_OVERLAY_STATUS : 6|4@0+ (1,0) [0|15] "" XXX SG_ EPS_TORQUE_MOTOR_RAW : 19|12@0+ (1,-2048) [-2048|2047] "" XXX SG_ EPS_TORQUE_MOTOR : 34|11@0+ (1,-1024) [-1024|1023] "" XXX + SG_ LKAS_TEMPORARY_FAULT : 38|1@0+ (1,0) [0|1] "" XXX SG_ AUTO_PARK_HAS_CONTROL_2 : 51|1@0+ (1,0) [0|1] "" XXX SG_ COUNTER : 55|4@0+ (1,0) [0|15] "" XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX diff --git a/opendbc/chrysler_ram_hd_generated.dbc b/opendbc/chrysler_ram_hd_generated.dbc index 248121388..82cf0d365 100644 --- a/opendbc/chrysler_ram_hd_generated.dbc +++ b/opendbc/chrysler_ram_hd_generated.dbc @@ -83,6 +83,7 @@ BO_ 544 EPS_2: 8 XXX SG_ TORQUE_OVERLAY_STATUS : 6|4@0+ (1,0) [0|15] "" XXX SG_ EPS_TORQUE_MOTOR_RAW : 19|12@0+ (1,-2048) [-2048|2047] "" XXX SG_ EPS_TORQUE_MOTOR : 34|11@0+ (1,-1024) [-1024|1023] "" XXX + SG_ LKAS_TEMPORARY_FAULT : 38|1@0+ (1,0) [0|1] "" XXX SG_ AUTO_PARK_HAS_CONTROL_2 : 51|1@0+ (1,0) [0|1] "" XXX SG_ COUNTER : 55|4@0+ (1,0) [0|15] "" XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX diff --git a/opendbc/ford_lincoln_base_pt.dbc b/opendbc/ford_lincoln_base_pt.dbc index 1f2560179..ebe7a4321 100644 --- a/opendbc/ford_lincoln_base_pt.dbc +++ b/opendbc/ford_lincoln_base_pt.dbc @@ -153,7 +153,7 @@ VAL_TABLE_ ChrgCordLck_D_Stat 7 "Faulty" 6 "LockFail" 5 "UnlockFail" 4 "LockInPr VAL_TABLE_ LkaActvStats_D2_Req 7 "NotUsed" 6 "LkaIncrIntervRight" 5 "LkaSupprRight" 4 "LkaStandIntervRight" 3 "LkaSupprLeft" 2 "LkaStandIntervLeft" 1 "LkaIncrIntervLeft" 0 "LkaNoInterv"; VAL_TABLE_ OffOnNoDataFaulty 3 "Faulty" 2 "No_Data_Exists" 1 "On" 0 "Off"; VAL_TABLE_ NoMessage_Msg1_3 3 "Message3" 2 "Message2" 1 "Message1" 0 "NoMessage"; -VAL_TABLE_ TrnRng_D_RqGsm 15 "Fault" 14 "UnknownPosition" 13 "Undefined_2" 12 "Undefined_1" 11 "_6" 10 "_5" 9 "_4" 8 "_3" 7 "_2" 6 "_1" 5 "Low" 4 "Sport_DriveSport" 3 "Drive" 2 "Neutral" 1 "Reverse" 0 "Park"; +VAL_TABLE_ TrnRng_D_RqGsm 15 "Fault" 14 "UnknownPosition" 13 "Undefined_2" 12 "Undefined_1" 11 "_6" 10 "_5" 9 "_4" 8 "_3" 7 "_2" 6 "_1" 5 "Low" 4 "Sport" 3 "Drive" 2 "Neutral" 1 "Reverse" 0 "Park"; VAL_TABLE_ PrkBrkActv_D_RqGsmGear 3 "NotUsed" 2 "RequestParkBrakeEngage" 1 "NoRequest" 0 "Null"; VAL_TABLE_ TrnPrkSys_D_Actl 15 "Faulty" 14 "NotUsed_5" 13 "NotUsed_4" 12 "NotUsed_3" 11 "NotUsed_2" 10 "NotUsed_1" 9 "FrequencyError" 8 "OutOfRangeHigh" 7 "OutOfRangeLow" 6 "Override" 5 "OutOfPark" 4 "TransitionCloseToOutOfPark" 3 "AtNoSpring" 2 "TransitionCloseToPark" 1 "Park" 0 "NotKnown"; VAL_TABLE_ OKLowUnknownInvalid 3 "Invalid" 2 "Unknown" 1 "Low" 0 "OK"; diff --git a/opendbc/generator/chrysler/_stellantis_common.dbc b/opendbc/generator/chrysler/_stellantis_common.dbc index 0de6e9ff0..fbf0f9166 100644 --- a/opendbc/generator/chrysler/_stellantis_common.dbc +++ b/opendbc/generator/chrysler/_stellantis_common.dbc @@ -77,6 +77,7 @@ BO_ 544 EPS_2: 8 XXX SG_ TORQUE_OVERLAY_STATUS : 6|4@0+ (1,0) [0|15] "" XXX SG_ EPS_TORQUE_MOTOR_RAW : 19|12@0+ (1,-2048) [-2048|2047] "" XXX SG_ EPS_TORQUE_MOTOR : 34|11@0+ (1,-1024) [-1024|1023] "" XXX + SG_ LKAS_TEMPORARY_FAULT : 38|1@0+ (1,0) [0|1] "" XXX SG_ AUTO_PARK_HAS_CONTROL_2 : 51|1@0+ (1,0) [0|1] "" XXX SG_ COUNTER : 55|4@0+ (1,0) [0|15] "" XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX diff --git a/opendbc/generator/generator.py b/opendbc/generator/generator.py index 50a41609e..9d5b37b5d 100755 --- a/opendbc/generator/generator.py +++ b/opendbc/generator/generator.py @@ -10,12 +10,12 @@ include_pattern = re.compile(r'CM_ "IMPORT (.*?)";\n') generated_suffix = '_generated.dbc' -def read_dbc(src_dir, filename): +def read_dbc(src_dir: str, filename: str) -> str: with open(os.path.join(src_dir, filename)) as file_in: return file_in.read() -def create_dbc(src_dir, filename, output_path): +def create_dbc(src_dir: str, filename: str, output_path: str): dbc_file_in = read_dbc(src_dir, filename) includes = include_pattern.findall(dbc_file_in) @@ -39,7 +39,7 @@ def create_dbc(src_dir, filename, output_path): dbc_file_out.write(core_dbc) -def create_all(output_path): +def create_all(output_path: str): # clear out old DBCs for f in glob.glob(f"{output_path}/*{generated_suffix}"): os.remove(f) diff --git a/opendbc/generator/gm/gm_global_a_powertrain.dbc b/opendbc/generator/gm/gm_global_a_powertrain.dbc index cad6a73da..22acc2f8c 100644 --- a/opendbc/generator/gm/gm_global_a_powertrain.dbc +++ b/opendbc/generator/gm/gm_global_a_powertrain.dbc @@ -174,6 +174,13 @@ BO_ 532 BRAKE_RELATED: 6 XXX BO_ 560 EPBStatus: 8 EPB SG_ EPBClosed : 12|1@0+ (1,0) [0|1] "" NEO +BO_ 562 EBCMFrictionBrakeStatus: 8 XXX + SG_ FrictionBrakeUnavailable : 46|1@0+ (1,0) [0|1] "" XXX + +BO_ 608 SPEED_RELATED: 8 XXX + SG_ RollingCounter : 5|2@0+ (1,0) [0|0] "" XXX + SG_ ClusterSpeed : 31|8@0+ (1,0) [0|0] "" XXX + BO_ 711 BECMBatteryVoltageCurrent: 6 K17_EBCM SG_ HVBatteryVoltage : 31|12@0+ (0.125,0) [0|511.875] "V" NEO SG_ HVBatteryCurrent : 12|13@0- (0.15,0) [-614.4|614.25] "A" NEO @@ -287,9 +294,11 @@ CM_ SG_ 190 GasPedalAndAcc "ACC baseline is 62"; CM_ SG_ 352 Ignition "Non-zero when ignition is on"; CM_ SG_ 451 GasPedalAndAcc2 "ACC baseline is 62"; CM_ SG_ 481 ACCAlwaysOne "Usually 1 if the car is equipped with ACC"; +CM_ SG_ 562 FrictionBrakeUnavailable "1 when ACC brake control is unavailable. Stays high if brake command messages are blocked for a period of time"; CM_ SG_ 497 Ignition "Describes ignition + preconditioning mode, noisy"; CM_ SG_ 501 PRNDL2 "When ManualMode is Active, Value is 13=L1 12=L2 11=L3 ... 4=L10"; CM_ SG_ 532 UserBrakePressure "can be lower than other brake position signals when the brakes are pre-filled from ACC braking and the user presses on the brakes. user-only pressure?"; +CM_ SG_ 608 ClusterSpeed "Cluster speed signal seems to match dash on newer cars, but is a lower rate and can be noisier."; CM_ SG_ 761 UserBrakePressure2 "Similar to BRAKE_RELATED->UserBrakePressure"; CM_ SG_ 1001 VehicleSpeed "Spinouts show here on 2wd. Speed derived from right front wheel (drive tire)"; BA_DEF_ "UseGMParameterIDs" INT 0 0; diff --git a/opendbc/generator/honda/honda_civic_ex_2022_can.dbc b/opendbc/generator/honda/honda_civic_ex_2022_can.dbc index 5c7ef6a21..47c46460e 100644 --- a/opendbc/generator/honda/honda_civic_ex_2022_can.dbc +++ b/opendbc/generator/honda/honda_civic_ex_2022_can.dbc @@ -21,7 +21,7 @@ BO_ 432 STANDSTILL: 7 VSA BO_ 456 ACC_CONTROL: 8 XXX SG_ ACCEL_COMMAND : 7|12@0- (0.01,0) [0|0] "m/s^2" XXX - SG_ CONTROL_OFF : 8|1@0+ (1,0) [0|1] "" XXX + SG_ IDLESTOP_ALLOW : 8|1@0+ (1,0) [0|1] "" XXX SG_ STANDSTILL : 9|1@0+ (1,0) [0|1] "" XXX SG_ CONTROL_ON : 10|1@0+ (1,0) [0|1] "" XXX SG_ BOH : 23|1@0+ (1,0) [0|1] "" XXX @@ -70,7 +70,7 @@ BO_ 254913108 LKAS_HUD_2: 8 ADAS SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX -CM_ BO_ 456 "not sure which bit enables cruise"; +CM_ SG_ 456 IDLESTOP_ALLOW "allows car to turn off engine at a standstill"; CM_ SG_ 456 STANDSTILL "set to 1 when camera requests -4.0 m/s^2"; VAL_ 401 GEAR_SHIFTER 32 "L" 16 "S" 8 "D" 4 "N" 2 "R" 1 "P"; diff --git a/opendbc/generator/toyota/_toyota_2017.dbc b/opendbc/generator/toyota/_toyota_2017.dbc index 1b788b56e..bf999afa1 100644 --- a/opendbc/generator/toyota/_toyota_2017.dbc +++ b/opendbc/generator/toyota/_toyota_2017.dbc @@ -61,7 +61,7 @@ BO_ 180 SPEED: 8 XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX BO_ 295 GEAR_PACKET_HYBRID: 8 XXX - SG_ CAR_MOVEMENT : 39|8@0- (1,0) [0|255] "" XXX + SG_ CAR_MOVEMENT : 25|10@0- (1,0) [0|255] "" XXX SG_ COUNTER : 55|8@0+ (1,0) [0|255] "" XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX SG_ GEAR : 47|4@0+ (1,0) [0|15] "" XXX @@ -335,8 +335,7 @@ BO_ 1552 BODY_CONTROL_STATE_2: 8 XXX BO_ 1553 UI_SETTING: 8 XXX SG_ UNITS : 26|2@0+ (1,0) [0|3] "" XXX - SG_ ODOMETER : 43|20@0+ (1,0) [0|1048575] "" XXX - + SG_ ODOMETER : 39|32@0+ (1,0) [0|1048575] "" XXX BO_ 1556 BLINKERS_STATE: 8 XXX SG_ TURN_SIGNALS : 29|2@0+ (1,0) [0|3] "" XXX SG_ HAZARD_LIGHT : 27|1@0+ (1,0) [0|1] "" XXX diff --git a/opendbc/gm_global_a_powertrain_generated.dbc b/opendbc/gm_global_a_powertrain_generated.dbc index a6591d51c..916a0a254 100644 --- a/opendbc/gm_global_a_powertrain_generated.dbc +++ b/opendbc/gm_global_a_powertrain_generated.dbc @@ -194,6 +194,13 @@ BO_ 532 BRAKE_RELATED: 6 XXX BO_ 560 EPBStatus: 8 EPB SG_ EPBClosed : 12|1@0+ (1,0) [0|1] "" NEO +BO_ 562 EBCMFrictionBrakeStatus: 8 XXX + SG_ FrictionBrakeUnavailable : 46|1@0+ (1,0) [0|1] "" XXX + +BO_ 608 SPEED_RELATED: 8 XXX + SG_ RollingCounter : 5|2@0+ (1,0) [0|0] "" XXX + SG_ ClusterSpeed : 31|8@0+ (1,0) [0|0] "" XXX + BO_ 711 BECMBatteryVoltageCurrent: 6 K17_EBCM SG_ HVBatteryVoltage : 31|12@0+ (0.125,0) [0|511.875] "V" NEO SG_ HVBatteryCurrent : 12|13@0- (0.15,0) [-614.4|614.25] "A" NEO @@ -307,9 +314,11 @@ CM_ SG_ 190 GasPedalAndAcc "ACC baseline is 62"; CM_ SG_ 352 Ignition "Non-zero when ignition is on"; CM_ SG_ 451 GasPedalAndAcc2 "ACC baseline is 62"; CM_ SG_ 481 ACCAlwaysOne "Usually 1 if the car is equipped with ACC"; +CM_ SG_ 562 FrictionBrakeUnavailable "1 when ACC brake control is unavailable. Stays high if brake command messages are blocked for a period of time"; CM_ SG_ 497 Ignition "Describes ignition + preconditioning mode, noisy"; CM_ SG_ 501 PRNDL2 "When ManualMode is Active, Value is 13=L1 12=L2 11=L3 ... 4=L10"; CM_ SG_ 532 UserBrakePressure "can be lower than other brake position signals when the brakes are pre-filled from ACC braking and the user presses on the brakes. user-only pressure?"; +CM_ SG_ 608 ClusterSpeed "Cluster speed signal seems to match dash on newer cars, but is a lower rate and can be noisier."; CM_ SG_ 761 UserBrakePressure2 "Similar to BRAKE_RELATED->UserBrakePressure"; CM_ SG_ 1001 VehicleSpeed "Spinouts show here on 2wd. Speed derived from right front wheel (drive tire)"; BA_DEF_ "UseGMParameterIDs" INT 0 0; diff --git a/opendbc/honda_civic_ex_2022_can_generated.dbc b/opendbc/honda_civic_ex_2022_can_generated.dbc index 2b06a4a49..b72f9aa6b 100644 --- a/opendbc/honda_civic_ex_2022_can_generated.dbc +++ b/opendbc/honda_civic_ex_2022_can_generated.dbc @@ -447,7 +447,7 @@ BO_ 432 STANDSTILL: 7 VSA BO_ 456 ACC_CONTROL: 8 XXX SG_ ACCEL_COMMAND : 7|12@0- (0.01,0) [0|0] "m/s^2" XXX - SG_ CONTROL_OFF : 8|1@0+ (1,0) [0|1] "" XXX + SG_ IDLESTOP_ALLOW : 8|1@0+ (1,0) [0|1] "" XXX SG_ STANDSTILL : 9|1@0+ (1,0) [0|1] "" XXX SG_ CONTROL_ON : 10|1@0+ (1,0) [0|1] "" XXX SG_ BOH : 23|1@0+ (1,0) [0|1] "" XXX @@ -496,7 +496,7 @@ BO_ 254913108 LKAS_HUD_2: 8 ADAS SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX -CM_ BO_ 456 "not sure which bit enables cruise"; +CM_ SG_ 456 IDLESTOP_ALLOW "allows car to turn off engine at a standstill"; CM_ SG_ 456 STANDSTILL "set to 1 when camera requests -4.0 m/s^2"; VAL_ 401 GEAR_SHIFTER 32 "L" 16 "S" 8 "D" 4 "N" 2 "R" 1 "P"; diff --git a/opendbc/honda_odyssey_hybrid_2022_china_can_generated.dbc b/opendbc/honda_odyssey_hybrid_2022_china_can_generated.dbc new file mode 100644 index 000000000..0e57e80b0 --- /dev/null +++ b/opendbc/honda_odyssey_hybrid_2022_china_can_generated.dbc @@ -0,0 +1,382 @@ +CM_ "AUTOGENERATED FILE, DO NOT EDIT"; + + +CM_ "Imported file _comma.dbc starts here"; +BO_ 512 GAS_COMMAND: 6 EON + SG_ GAS_COMMAND : 7|16@0+ (0.253984064,-83.3) [0|1] "" INTERCEPTOR + SG_ GAS_COMMAND2 : 23|16@0+ (0.126992032,-83.3) [0|1] "" INTERCEPTOR + SG_ ENABLE : 39|1@0+ (1,0) [0|1] "" INTERCEPTOR + SG_ COUNTER_PEDAL : 35|4@0+ (1,0) [0|15] "" INTERCEPTOR + SG_ CHECKSUM_PEDAL : 47|8@0+ (1,0) [0|255] "" INTERCEPTOR + +BO_ 513 GAS_SENSOR: 6 INTERCEPTOR + SG_ INTERCEPTOR_GAS : 7|16@0+ (1,0) [0|1] "" EON + SG_ INTERCEPTOR_GAS2 : 23|16@0+ (1,0) [0|1] "" EON + SG_ STATE : 39|4@0+ (1,0) [0|15] "" EON + SG_ COUNTER_PEDAL : 35|4@0+ (1,0) [0|15] "" EON + SG_ CHECKSUM_PEDAL : 47|8@0+ (1,0) [0|255] "" EON + +VAL_ 513 STATE 5 "FAULT_TIMEOUT" 4 "FAULT_STARTUP" 3 "FAULT_SCE" 2 "FAULT_SEND" 1 "FAULT_BAD_CHECKSUM" 0 "NO_FAULT" ; + + +CM_ "Imported file _honda_common.dbc starts here"; +BO_ 304 GAS_PEDAL_2: 8 PCM + SG_ ENGINE_TORQUE_ESTIMATE : 7|16@0- (1,0) [-1000|1000] "Nm" EON + SG_ ENGINE_TORQUE_REQUEST : 23|16@0- (1,0) [-1000|1000] "Nm" EON + SG_ CAR_GAS : 39|8@0+ (1,0) [0|255] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON + +BO_ 316 GAS_PEDAL: 8 PCM + SG_ CAR_GAS : 39|8@0+ (1,0) [0|255] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON + +BO_ 344 ENGINE_DATA: 8 PCM + SG_ XMISSION_SPEED : 7|16@0+ (0.01,0) [0|250] "kph" EON + SG_ ENGINE_RPM : 23|16@0+ (1,0) [0|15000] "rpm" EON + SG_ XMISSION_SPEED2 : 39|16@0+ (0.01,0) [0|250] "kph" EON + SG_ ODOMETER : 55|8@0+ (10,0) [0|2550] "m" XXX + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON + +BO_ 380 POWERTRAIN_DATA: 8 PCM + SG_ PEDAL_GAS : 7|8@0+ (1,0) [0|255] "" EON + SG_ ENGINE_RPM : 23|16@0+ (1,0) [0|15000] "rpm" EON + SG_ GAS_PRESSED : 39|1@0+ (1,0) [0|1] "" EON + SG_ ACC_STATUS : 38|1@0+ (1,0) [0|1] "" EON + SG_ BOH_17C : 37|5@0+ (1,0) [0|1] "" EON + SG_ BRAKE_SWITCH : 32|1@0+ (1,0) [0|1] "" EON + SG_ BOH2_17C : 47|10@0+ (1,0) [0|1] "" EON + SG_ BRAKE_PRESSED : 53|1@0+ (1,0) [0|1] "" EON + SG_ BOH3_17C : 52|5@0+ (1,0) [0|1] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON + +BO_ 420 VSA_STATUS: 8 VSA + SG_ USER_BRAKE : 7|16@0+ (0.015625,-1.609375) [0|1000] "" EON + SG_ COMPUTER_BRAKING : 23|1@0+ (1,0) [0|1] "" EON + SG_ ESP_DISABLED : 28|1@0+ (1,0) [0|1] "" EON + SG_ BRAKE_HOLD_RELATED : 52|1@0+ (1,0) [0|1] "" XXX + SG_ BRAKE_HOLD_ACTIVE : 46|1@0+ (1,0) [0|1] "" EON + SG_ BRAKE_HOLD_ENABLED : 45|1@0+ (1,0) [0|1] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON + +BO_ 427 STEER_MOTOR_TORQUE: 3 EPS + SG_ CONFIG_VALID : 7|1@0+ (1,0) [0|1] "" EON + SG_ MOTOR_TORQUE : 1|10@0+ (1,0) [0|256] "" EON + SG_ OUTPUT_DISABLED : 22|1@0+ (1,0) [0|1] "" EON + SG_ COUNTER : 21|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 19|4@0+ (1,0) [0|15] "" EON + +BO_ 464 WHEEL_SPEEDS: 8 VSA + SG_ WHEEL_SPEED_FL : 7|15@0+ (0.01,0) [0|250] "kph" EON + SG_ WHEEL_SPEED_FR : 8|15@0+ (0.01,0) [0|250] "kph" EON + SG_ WHEEL_SPEED_RL : 25|15@0+ (0.01,0) [0|250] "kph" EON + SG_ WHEEL_SPEED_RR : 42|15@0+ (0.01,0) [0|250] "kph" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON + +BO_ 490 VEHICLE_DYNAMICS: 8 VSA + SG_ LAT_ACCEL : 7|16@0- (0.0015,0) [-20|20] "m/s2" EON + SG_ LONG_ACCEL : 23|16@0- (0.0015,0) [-20|20] "m/s2" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON + +BO_ 773 SEATBELT_STATUS: 7 BDY + SG_ SEATBELT_DRIVER_LAMP : 7|1@0+ (1,0) [0|1] "" EON + SG_ SEATBELT_PASS_UNLATCHED : 10|1@0+ (1,0) [0|1] "" EON + SG_ SEATBELT_PASS_LATCHED : 11|1@0+ (1,0) [0|1] "" EON + SG_ SEATBELT_DRIVER_UNLATCHED : 12|1@0+ (1,0) [0|1] "" EON + SG_ SEATBELT_DRIVER_LATCHED : 13|1@0+ (1,0) [0|1] "" EON + SG_ PASS_AIRBAG_OFF : 14|1@0+ (1,0) [0|1] "" EON + SG_ PASS_AIRBAG_ON : 15|1@0+ (1,0) [0|1] "" EON + SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 51|4@0+ (1,0) [0|3] "" EON + +BO_ 777 CAR_SPEED: 8 PCM + SG_ ROUGH_CAR_SPEED : 23|8@0+ (1,0) [0|255] "mph" XXX + SG_ CAR_SPEED : 7|16@0+ (0.01,0) [0|65535] "kph" XXX + SG_ ROUGH_CAR_SPEED_3 : 39|16@0+ (0.01,0) [0|65535] "kph" XXX + SG_ ROUGH_CAR_SPEED_2 : 31|8@0+ (1,0) [0|255] "mph" XXX + SG_ LOCK_STATUS : 55|2@0+ (1,0) [0|255] "" XXX + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX + SG_ IMPERIAL_UNIT : 63|1@0+ (1,0) [0|1] "" XXX + +BO_ 780 ACC_HUD: 8 ADAS + SG_ PCM_SPEED : 7|16@0+ (0.01,0) [0|250] "kph" BDY + SG_ PCM_GAS : 23|8@0+ (1,0) [0|127] "" BDY + SG_ CRUISE_SPEED : 31|8@0+ (1,0) [0|255] "kph" BDY + SG_ DTC_MODE : 39|1@0+ (1,0) [0|1] "" BDY + SG_ BOH : 38|1@0+ (1,0) [0|1] "" BDY + SG_ ACC_PROBLEM : 37|1@0+ (1,0) [0|1] "" BDY + SG_ FCM_OFF : 35|1@0+ (1,0) [0|1] "" BDY + SG_ FCM_OFF_2 : 36|1@0+ (1,0) [0|1] "" BDY + SG_ FCM_PROBLEM : 34|1@0+ (1,0) [0|1] "" BDY + SG_ RADAR_OBSTRUCTED : 33|1@0+ (1,0) [0|1] "" BDY + SG_ ENABLE_MINI_CAR : 32|1@0+ (1,0) [0|1] "" BDY + SG_ HUD_DISTANCE : 47|2@0+ (1,0) [0|3] "" BDY + SG_ HUD_LEAD : 45|2@0+ (1,0) [0|3] "" BDY + SG_ BOH_3 : 43|1@0+ (1,0) [0|3] "" BDY + SG_ BOH_4 : 42|1@0+ (1,0) [0|3] "" BDY + SG_ BOH_5 : 41|1@0+ (1,0) [0|3] "" BDY + SG_ CRUISE_CONTROL_LABEL : 40|1@0+ (1,0) [0|3] "" BDY + SG_ SET_ME_X01_2 : 55|1@0+ (1,0) [0|1] "" BDY + SG_ IMPERIAL_UNIT : 54|1@0+ (1,0) [0|1] "" BDY + SG_ ACC_ON : 52|1@0+ (1,0) [0|1] "" BDY + SG_ CHIME : 51|3@0+ (1,0) [0|1] "" BDY + SG_ SET_ME_X01 : 48|1@0+ (1,0) [0|1] "" BDY + SG_ ICONS : 63|2@0+ (1,0) [0|1] "" BDY + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" BDY + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" BDY + +BO_ 804 CRUISE: 8 PCM + SG_ HUD_SPEED_KPH : 7|8@0+ (1,0) [0|255] "kph" EON + SG_ HUD_SPEED_MPH : 15|8@0+ (1,0) [0|255] "mph" EON + SG_ TRIP_FUEL_CONSUMED : 23|16@0+ (1,0) [0|255] "" EON + SG_ CRUISE_SPEED_PCM : 39|8@0+ (1,0) [0|255] "" EON + SG_ BOH2 : 47|8@0- (1,0) [0|255] "" EON + SG_ BOH3 : 55|8@0+ (1,0) [0|255] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON + +BO_ 884 STALK_STATUS: 8 XXX + SG_ DASHBOARD_ALERT : 39|8@0+ (1,0) [0|255] "" EON + SG_ AUTO_HEADLIGHTS : 46|1@0+ (1,0) [0|1] "" EON + SG_ HIGH_BEAM_HOLD : 47|1@0+ (1,0) [0|1] "" EON + SG_ HIGH_BEAM_FLASH : 45|1@0+ (1,0) [0|1] "" EON + SG_ HEADLIGHTS_ON : 54|1@0+ (1,0) [0|1] "" EON + SG_ WIPER_SWITCH : 53|2@0+ (1,0) [0|3] "" XXX + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON + +BO_ 891 STALK_STATUS_2: 8 XXX + SG_ WIPERS : 17|2@0+ (1,0) [0|3] "" EON + SG_ LOW_BEAMS : 35|1@0+ (1,0) [0|1] "" XXX + SG_ HIGH_BEAMS : 34|1@0+ (1,0) [0|1] "" XXX + SG_ PARK_LIGHTS : 36|1@0+ (1,0) [0|1] "" XXX + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON + +BO_ 1029 DOORS_STATUS: 8 BDY + SG_ DOOR_OPEN_FL : 37|1@0+ (1,0) [0|1] "" EON + SG_ DOOR_OPEN_FR : 38|1@0+ (1,0) [0|1] "" EON + SG_ DOOR_OPEN_RL : 39|1@0+ (1,0) [0|1] "" EON + SG_ DOOR_OPEN_RR : 40|1@0+ (1,0) [0|1] "" EON + SG_ TRUNK_OPEN : 41|1@0+ (1,0) [0|1] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON + +CM_ SG_ 304 "Seems to be platform-agnostic"; +CM_ SG_ 316 "Should exist on Nidec"; +CM_ SG_ 420 BRAKE_HOLD_RELATED "On when Brake Hold engaged"; +CM_ SG_ 490 LONG_ACCEL "wheel speed derivative, noisy and zero snapping"; +CM_ SG_ 773 PASS_AIRBAG_ON "Might just be indicator light"; +CM_ SG_ 773 PASS_AIRBAG_OFF "Might just be indicator light"; +CM_ SG_ 780 CRUISE_SPEED "255 = no speed"; +CM_ SG_ 780 PCM_SPEED "Used by Nidec"; +CM_ SG_ 780 PCM_GAS "Used by Nidec"; +CM_ SG_ 804 CRUISE_SPEED_PCM "255 = no speed"; + +VAL_ 780 CRUISE_SPEED 255 "no_speed" 252 "stopped"; +VAL_ 780 HUD_LEAD 3 "acc_off" 2 "solid_car" 1 "dashed_car" 0 "no_car"; +VAL_ 884 DASHBOARD_ALERT 0 "none" 51 "acc_problem" 55 "cmbs_problem" 75 "key_not_detected" 79 "fasten_seatbelt" 111 "lkas_problem" 131 "brake_system_problem" 132 "brake_hold_problem" 139 "tbd" 161 "door_open"; +VAL_ 891 WIPERS 4 "High" 2 "Low" 0 "Off"; + + +CM_ "Imported file _nidec_common.dbc starts here"; +BO_ 145 KINEMATICS: 8 XXX + SG_ LAT_ACCEL : 7|10@0+ (0.02,-512) [-20|20] "m/s2" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON + +BO_ 148 KINEMATICS_ALT: 8 XXX + SG_ LAT_ACCEL : 7|10@0+ (0.02,-512) [-20|20] "m/s2" EON + SG_ LONG_ACCEL : 24|9@0- (-0.02,0) [-20|20] "m/s2" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + +BO_ 432 STANDSTILL: 7 VSA + SG_ CONTROLLED_STANDSTILL : 0|1@0+ (1,0) [0|1] "" EON + SG_ WHEELS_MOVING : 12|1@0+ (1,0) [0|1] "" EON + SG_ BRAKE_ERROR_1 : 11|1@0+ (1,0) [0|1] "" EON + SG_ BRAKE_ERROR_2 : 9|1@0+ (1,0) [0|1] "" EON + SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 51|4@0+ (1,0) [0|3] "" EON + +BO_ 487 BRAKE_PRESSURE: 4 VSA + SG_ BRAKE_PRESSURE1 : 7|10@0+ (0.015625,-103) [0|1000] "" EON + SG_ BRAKE_PRESSURE2 : 9|10@0+ (0.015625,-103) [0|1000] "" EON + SG_ CHECKSUM : 27|4@0+ (1,0) [0|15] "" EON + SG_ COUNTER : 29|2@0+ (1,0) [0|3] "" EON + +BO_ 506 BRAKE_COMMAND: 8 ADAS + SG_ ZEROS_BOH : 7|12@0+ (1,0) [0|3] "" XXX + SG_ BRAKE_PUMP_REQUEST : 11|1@0+ (1,0) [0|1] "" EBCM + SG_ ZEROS_BOH2 : 10|3@0+ (1,0) [0|7] "" XXX + SG_ CRUISE_BOH2 : 23|3@0+ (1,0) [0|1] "" EBCM + SG_ CRUISE_OVERRIDE : 20|1@0+ (1,0) [0|1] "" EBCM + SG_ CRUISE_BOH3 : 19|1@0+ (1,0) [0|1] "" EBCM + SG_ CRUISE_FAULT_CMD : 18|1@0+ (1,0) [0|1] "" EBCM + SG_ CRUISE_CANCEL_CMD : 17|1@0+ (1,0) [0|1] "" EBCM + SG_ COMPUTER_BRAKE_REQUEST : 16|1@0+ (1,0) [0|1] "" EBCM + SG_ SET_ME_1 : 31|1@0+ (1,0) [0|1] "" EBCM + SG_ AEB_REQ_1 : 29|1@0+ (1,0) [0|1] "" XXX + SG_ AEB_REQ_2 : 26|3@0+ (1,0) [0|7] "" XXX + SG_ BRAKE_LIGHTS : 39|1@0+ (1,0) [0|1] "" EBCM + SG_ CRUISE_STATES : 38|7@0+ (1,0) [0|1] "" EBCM + SG_ CHIME : 47|3@0+ (1,0) [0|7] "" EBCM + SG_ ZEROS_BOH6 : 44|1@0+ (1,0) [0|1] "" EBCM + SG_ FCW : 43|2@0+ (1,0) [0|3] "" EBCM + SG_ AEB_STATUS : 41|2@0+ (1,0) [0|3] "" XXX + SG_ COMPUTER_BRAKE : 55|10@0+ (1,0) [0|1] "" EBCM + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EBCM + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EBCM + +BO_ 597 ROUGH_WHEEL_SPEED: 8 VSA + SG_ WHEEL_SPEED_FL : 7|8@0+ (1,0) [0|255] "mph" EON + SG_ WHEEL_SPEED_FR : 15|8@0+ (1,0) [0|255] "mph" EON + SG_ WHEEL_SPEED_RL : 23|8@0+ (1,0) [0|255] "mph" EON + SG_ WHEEL_SPEED_RR : 31|8@0+ (1,0) [0|255] "mph" EON + SG_ SET_TO_X55 : 39|8@0+ (1,0) [0|255] "" EON + SG_ SET_TO_X55_2 : 47|8@0+ (1,0) [0|255] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON + +BO_ 829 LKAS_HUD: 5 ADAS + SG_ CAM_TEMP_HIGH : 7|1@0+ (1,0) [0|255] "" BDY + SG_ SET_ME_X41 : 6|7@0+ (1,0) [0|127] "" BDY + SG_ BOH : 6|7@0+ (1,0) [0|127] "" BDY + SG_ DASHED_LANES : 14|1@0+ (1,0) [0|1] "" BDY + SG_ DTC : 13|1@0+ (1,0) [0|1] "" BDY + SG_ LKAS_PROBLEM : 12|1@0+ (1,0) [0|1] "" BDY + SG_ LKAS_OFF : 11|1@0+ (1,0) [0|1] "" BDY + SG_ SOLID_LANES : 10|1@0+ (1,0) [0|1] "" BDY + SG_ LDW_RIGHT : 9|1@0+ (1,0) [0|1] "" BDY + SG_ STEERING_REQUIRED : 8|1@0+ (1,0) [0|1] "" BDY + SG_ BOH : 23|2@0+ (1,0) [0|4] "" BDY + SG_ LDW_PROBLEM : 21|1@0+ (1,0) [0|1] "" BDY + SG_ BEEP : 17|2@0+ (1,0) [0|1] "" BDY + SG_ LDW_ON : 28|1@0+ (1,0) [0|1] "" BDY + SG_ LDW_OFF : 27|1@0+ (1,0) [0|1] "" BDY + SG_ CLEAN_WINDSHIELD : 26|1@0+ (1,0) [0|1] "" BDY + SG_ SET_ME_X48 : 31|8@0+ (1,0) [0|255] "" BDY + SG_ COUNTER : 37|2@0+ (1,0) [0|3] "" BDY + SG_ CHECKSUM : 35|4@0+ (1,0) [0|15] "" BDY + +BO_ 892 CRUISE_PARAMS: 8 PCM + SG_ CRUISE_SPEED_OFFSET : 31|8@0- (0.1,0) [-128|127] "kph" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + +CM_ SG_ 506 AEB_REQ_1 "set for duration of suspected AEB event"; +CM_ SG_ 506 COMPUTER_BRAKE_ALT "Used by dual-can Nidec"; +CM_ SG_ 506 BRAKE_PUMP_REQUEST_ALT "Used by dual-can Nidec"; +CM_ SG_ 829 BEEP "beeps are pleasant, chimes are for warnngs etc..."; + +VAL_ 506 FCW 3 "fcw" 2 "fcw" 1 "fcw" 0 "no_fcw"; +VAL_ 506 CHIME 4 "double_chime" 3 "single_chime" 2 "continuous_chime" 1 "repeating_chime" 0 "no_chime"; +VAL_ 506 AEB_STATUS 3 "aeb_prepare" 2 "aeb_ready" 1 "aeb_braking" 0 "no_aeb"; +VAL_ 829 BEEP 3 "single_beep" 2 "triple_beep" 1 "repeated_beep" 0 "no_beep"; + +CM_ "Imported file _steering_sensors_b.dbc starts here"; +BO_ 342 STEERING_SENSORS: 6 EPS + SG_ STEER_ANGLE : 7|16@0- (-0.1,0) [-500|500] "deg" EON + SG_ STEER_ANGLE_RATE : 23|16@0- (-1,0) [-3000|3000] "deg/s" EON + SG_ COUNTER : 45|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 43|4@0+ (1,0) [0|15] "" EON + +CM_ "honda_odyssey_hybrid_2022_china_can.dbc starts here"; + +BO_ 388 BRAKE_ERROR: 8 XXX + SG_ BRAKE_ERROR_1 : 32|1@0+ (1,0) [0|1] "" EON + SG_ BRAKE_ERROR_2 : 34|1@0+ (1,0) [0|1] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON + +BO_ 399 STEER_STATUS: 7 EPS + SG_ STEER_TORQUE_SENSOR : 7|16@0- (-1,0) [-2985|2985] "tbd" EON + SG_ STEER_ANGLE_RATE : 23|16@0- (-0.1,0) [-31000|31000] "deg/s" EON + SG_ STEER_STATUS : 43|4@0+ (1,0) [0|15] "" EON + SG_ STEER_CONTROL_ACTIVE : 35|1@0+ (1,0) [0|1] "" EON + SG_ STEER_CONFIG_INDEX : 43|4@0+ (1,0) [0|15] "" EON + SG_ CHECKSUM : 51|4@0+ (1,0) [0|15] "" EON + SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON + +BO_ 404 STEERING_CONTROL: 4 EON + SG_ SET_ME_X00 : 22|7@0+ (1,0) [0|127] "" EPS + SG_ STEER_TORQUE_REQUEST : 23|1@0+ (1,0) [0|1] "" EPS + SG_ COUNTER : 29|2@0+ (1,0) [0|15] "" EPS + SG_ CHECKSUM : 27|4@0+ (1,0) [0|3] "" EPS + SG_ STEER_TORQUE : 7|16@0- (-1,0) [-32767|32767] "" EPS + +BO_ 419 GEARBOX: 8 PCM + SG_ GEAR : 7|8@0+ (1,0) [0|256] "" EON + SG_ GEAR_SHIFTER : 35|4@0+ (1,0) [0|15] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON + +BO_ 422 SCM_BUTTONS: 8 SCM + SG_ CRUISE_BUTTONS : 7|3@0+ (1,0) [0|7] "" EON + SG_ LIGHTS_SETTING : 1|2@0+ (1,0) [0|3] "" EON + SG_ MAIN_ON : 47|1@0+ (1,0) [0|1] "" EON + SG_ CRUISE_SETTING : 43|2@0+ (1,0) [0|3] "" EON + SG_ DRIVERS_DOOR_OPEN : 63|1@0+ (1,0) [0|1] "" XXX + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON + +BO_ 450 EPB_STATUS: 8 XXX + SG_ EPB_BRAKE_AND_PULL : 6|1@0+ (1,0) [0|1] "" XXX + SG_ EPB_ACTIVE : 3|1@0+ (1,0) [0|1] "" XXX + SG_ EPB_STATE : 29|2@0+ (1,0) [0|1] "" XXX + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX + +BO_ 545 ECON_STATUS: 6 XXX + SG_ ECON_ON_2 : 37|2@0+ (1,0) [0|3] "" EON + SG_ ECON_ON : 23|1@0+ (1,0) [0|1] "" EON + SG_ CHECKSUM : 43|4@0+ (1,0) [0|3] "" EON + SG_ COUNTER : 45|2@0+ (1,0) [0|3] "" EON + +BO_ 660 SCM_FEEDBACK: 8 SCM + SG_ RIGHT_BLINKER : 6|1@0+ (1,0) [0|1] "" EON + SG_ LEFT_BLINKER : 5|1@0+ (1,0) [0|1] "" EON + SG_ WIPERS_SPEED : 4|2@0+ (1,0) [0|3] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON + +BO_ 862 HIGHBEAM_CONTROL: 8 ADAS + SG_ ZEROS_BOH : 7|50@0+ (1,0) [0|127] "" BDY + SG_ ZEROS_BOH_2 : 48|4@1+ (1,0) [0|15] "" XXX + SG_ HIGHBEAMS_ON : 52|1@0+ (1,0) [0|1] "" XXX + SG_ AUTO_HIGHBEAMS_ACTIVE : 53|1@0+ (1,0) [0|1] "" XXX + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX + +BO_ 927 RADAR_HUD: 8 ADAS + SG_ ZEROS_BOH : 7|17@0+ (1,0) [0|127] "" BDY + SG_ APPLY_BRAKES_FOR_CANC : 23|1@0+ (1,0) [0|15] "" BDY + SG_ ZEROS_BOH2 : 31|8@0+ (1,0) [0|127] "" BDY + SG_ RESUME_INSTRUCTION : 21|1@0+ (1,0) [0|15] "" BDY + SG_ ACC_ALERTS : 20|5@0+ (1,0) [0|15] "" BDY + SG_ LEAD_SPEED : 39|9@0+ (1,0) [0|127] "" BDY + SG_ LEAD_STATE : 46|3@0+ (1,0) [0|127] "" BDY + SG_ LEAD_DISTANCE : 43|5@0+ (1,0) [0|31] "" BDY + SG_ ZEROS_BOH3 : 54|7@0+ (1,0) [0|127] "" BDY + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" BDY + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" BDY + +BO_ 1302 ODOMETER: 8 XXX + SG_ ODOMETER : 7|24@0+ (1,0) [0|16777215] "km" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON + +CM_ SG_ 419 GEAR "10 = reverse, 1 = transition"; + +VAL_ 399 STEER_STATUS 5 "fault" 4 "no_torque_alert_2" 2 "no_torque_alert_1" 0 "normal" ; +VAL_ 419 GEAR_SHIFTER 10 "S" 4 "D" 3 "N" 2 "R" 1 "P" ; +VAL_ 422 CRUISE_BUTTONS 7 "tbd" 6 "tbd" 5 "tbd" 4 "accel_res" 3 "decel_set" 2 "cancel" 1 "main" 0 "none" ; +VAL_ 422 LIGHTS_SETTING 3 "high_beam" 2 "low_beam" 1 "position" 0 "no_lights" ; +VAL_ 422 CRUISE_SETTING 3 "distance_adj" 2 "tbd" 1 "lkas_button" 0 "none" ; +VAL_ 927 ACC_ALERTS 29 "esp_active_acc_canceled" 10 "b_pedal_applied" 9 "speed_too_low" 8 "speed_too_high" 7 "p_brake_applied" 6 "gear_no_d" 5 "seatbelt" 4 "too_steep_downhill" 3 "too_steep_uphill" 2 "too_close" 1 "no_vehicle_ahead" ; diff --git a/opendbc/hyundai_canfd.dbc b/opendbc/hyundai_canfd.dbc index d58a6c0bf..f88afe298 100644 --- a/opendbc/hyundai_canfd.dbc +++ b/opendbc/hyundai_canfd.dbc @@ -86,6 +86,11 @@ BO_ 101 BRAKE: 32 XXX SG_ BRAKE_POSITION : 40|16@1- (1,0) [0|65535] "" XXX SG_ BRAKE_PRESSED : 57|1@1+ (1,0) [0|3] "" XXX +BO_ 112 GEAR_ALT_2: 32 XXX + SG_ CHECKSUM : 0|16@1+ (1,0) [0|65535] "" XXX + SG_ COUNTER : 16|8@1+ (1,0) [0|255] "" XXX + SG_ GEAR : 60|3@1+ (1,0) [0|7] "" XXX + BO_ 160 WHEEL_SPEEDS: 24 XXX SG_ CHECKSUM : 0|16@1+ (1,0) [0|65535] "" XXX SG_ COUNTER : 16|8@1+ (1,0) [0|255] "" XXX @@ -212,7 +217,6 @@ BO_ 416 SCC_CONTROL: 32 ADRV SG_ CHECKSUM : 0|16@1+ (1,0) [0|65535] "" XXX SG_ NEW_SIGNAL_1 : 64|2@1+ (1,0) [0|3] "" XXX SG_ NEW_SIGNAL_8 : 170|4@1+ (1,0) [0|15] "" XXX - SG_ NEW_SIGNAL_10 : 156|5@0+ (1,0) [0|3] "" XXX SG_ ZEROS : 215|48@0+ (1,0) [0|281474976710655] "" XXX SG_ ZEROS_3 : 191|7@0+ (1,0) [0|127] "" XXX SG_ ZEROS_4 : 183|4@0+ (1,0) [0|63] "" XXX @@ -237,7 +241,6 @@ BO_ 416 SCC_CONTROL: 32 ADRV SG_ aReqRaw : 140|11@1+ (0.01,-10.23) [-10.23|10.24] "m/s^2" XXX SG_ aReqValue : 128|11@1+ (0.01,-10.23) [-10.23|10.24] "m/s^2" XXX SG_ ZEROS_7 : 63|8@0+ (1,0) [0|255] "" XXX - SG_ NEW_SIGNAL_4 : 158|2@0+ (1,0) [0|3] "" XXX SG_ ACCMode : 68|3@1+ (1,0) [0|7] "" XXX SG_ NEW_SIGNAL_12 : 35|9@1+ (0.1,0) [0|255] "" XXX SG_ JerkLowerLimit : 166|7@0+ (0.1,0) [0|12.7] "m/s^3" XXX @@ -245,6 +248,7 @@ BO_ 416 SCC_CONTROL: 32 ADRV SG_ NEW_SIGNAL_15 : 192|11@1+ (0.1,0) [0|204.7] "m" XXX SG_ VSetDis : 103|8@0+ (1,0) [0|255] "km/h or mph" XXX SG_ MainMode_ACC : 66|1@1+ (1,0) [0|1] "" XXX + SG_ JerkUpperLimit : 158|7@0+ (0.1,0) [0|0] "" XXX BO_ 426 CRUISE_BUTTONS_ALT: 16 XXX SG_ CHECKSUM : 0|16@1+ (1,0) [0|65535] "" XXX @@ -529,7 +533,7 @@ BO_ 485 BLINDSPOTS_FRONT_CORNER_1: 16 XXX SG_ NEW_SIGNAL_3 : 88|1@0+ (1,0) [0|1] "" XXX SG_ NEW_SIGNAL_4 : 80|1@0+ (1,0) [0|1] "" XXX SG_ NEW_SIGNAL_5 : 31|2@0+ (1,0) [0|3] "" XXX - SG_ NEW_SIGNAL_6 : 24|1@0+ (1,0) [0|1] "" XXX + SG_ REVERSING : 24|1@0+ (1,0) [0|1] "" XXX SG_ NEW_SIGNAL_7 : 32|2@1+ (1,0) [0|3] "" XXX SG_ NEW_SIGNAL_8 : 47|8@0+ (1,0) [0|255] "" XXX SG_ NEW_SIGNAL_9 : 55|8@0+ (1,0) [0|255] "" XXX @@ -563,6 +567,7 @@ CM_ SG_ 1043 COUNTER_ALT "only increments on change"; VAL_ 53 GEAR 0 "P" 5 "D" 6 "N" 7 "R" ; VAL_ 64 GEAR 0 "P" 5 "D" 6 "N" 7 "R" ; VAL_ 69 GEAR 0 "P" 5 "D" 6 "N" 7 "R" ; +VAL_ 112 GEAR 0 "P" 5 "D" 6 "N" 7 "R" ; VAL_ 80 LKA_ICON 0 "hidden" 1 "grey" 2 "green" 3 "flashing green" ; VAL_ 80 LKA_MODE 1 "warning only" 2 "assist" 6 "off" ; VAL_ 234 LKA_FAULT 0 "ok" 1 "lka fault" ; diff --git a/opendbc/mazda_2017.dbc b/opendbc/mazda_2017.dbc index fbd11162a..2615b5044 100644 --- a/opendbc/mazda_2017.dbc +++ b/opendbc/mazda_2017.dbc @@ -167,6 +167,21 @@ BO_ 581 CAM_IDK3: 8 XXX SG_ S8 : 48|8@1+ (1,0) [0|255] "" XXX SG_ S9 : 56|8@1+ (1,0) [0|255] "" XXX +BO_ 585 CAM_LKAS2: 8 XXX + SG_ LKAS_REQUEST : 3|12@0+ (1,-2048) [0|2048] "" XXX + SG_ CHKSUM : 19|12@0+ (1,-2048) [0|2048] "" XXX + SG_ KEY : 39|32@0+ (1,0) [3294744159|3294744161] "" XXX + +BO_ 586 TI_FEEDBACK: 8 XXX + SG_ TI_TORQUE_SENSOR : 7|8@0+ (1,-127) [-85|85] "" XXX + SG_ CHKSUM : 15|8@0+ (1,-127) [-127|128] "" XXX + SG_ VERSION_NUMBER : 23|8@0+ (1,0) [0|255] "" XXX + SG_ STATE : 31|8@0+ (1,0) [0|3] "" XXX + SG_ VIOL : 39|8@0+ (1,0) [0|255] "" XXX + SG_ ERROR : 47|8@0+ (1,0) [0|255] "" XXX + SG_ RAMP_DOWN : 55|8@0+ (1,0) [0|1] "" XXX + SG_ SPARE : 63|8@0+ (1,0) [0|255] "" XXX + BO_ 863 CAM_TRAFFIC_SIGNS: 8 XXX SG_ NEW_SIGNAL_3 : 55|1@0+ (1,0) [0|127] "" XXX SG_ FORWARD_COLLISION : 40|8@1+ (1,0) [0|7] "" XXX @@ -352,12 +367,10 @@ BO_ 130 STEER: 8 XXX SG_ CHKSUM_MAYBE : 39|8@0+ (1,0) [0|255] "" XXX BO_ 120 BRAKE: 8 XXX - SG_ NEW_SIGNAL_1 : 7|8@0+ (1,0) [0|255] "" XXX - SG_ NEW_SIGNAL_2 : 15|8@0+ (1,0) [0|255] "" XXX - SG_ NEW_SIGNAL_3 : 23|8@0+ (1,0) [0|255] "" XXX - SG_ NEW_SIGNAL_4 : 31|8@0+ (1,0) [0|255] "" XXX SG_ CTR : 55|8@0+ (1,0) [0|255] "" XXX SG_ BRAKE_PRESSURE : 39|8@0+ (1,0) [0|255] "" XXX + SG_ VEHICLE_ACC_X : 5|13@0+ (0.01,-40) [-40|40] "m/s^2" XXX + SG_ VEHICLE_ACC_Y : 8|13@0+ (0.001,-4.096) [-4.096|4.096] "m/s^2" XXX BO_ 304 GEAR_RELATED: 8 XXX SG_ NEW_SIGNAL_1 : 55|8@0+ (1,0) [0|255] "" XXX @@ -556,8 +569,6 @@ BO_ 535 CURVE_CTRS: 8 XXX BO_ 540 CRZ_CTRL: 8 XXX SG_ NEW_SIGNAL_6 : 10|1@0+ (1,0) [0|1] "" XXX - SG_ NEW_SIGNAL_9 : 31|1@0+ (1,0) [0|255] "" XXX - SG_ ACC_GAS_MAYBE2 : 29|1@0+ (1,0) [0|1] "" XXX SG_ HANDS_OFF_STEERING : 48|1@0+ (1,0) [0|1] "" XXX SG_ HANDS_ON_STEER_WARN : 59|4@0+ (1,0) [0|255] "" XXX SG_ CRZ_ACTIVE : 3|1@0+ (1,0) [0|1] "" XXX @@ -565,13 +576,13 @@ BO_ 540 CRZ_CTRL: 8 XXX SG_ DISTANCE_SETTING : 20|3@0+ (1,0) [0|7] "" XXX SG_ MSG_1_INV : 1|1@0+ (1,0) [0|1] "" XXX SG_ MSG_1_COPY : 9|1@0+ (1,0) [0|1] "" XXX - SG_ ACC_GAS_MAYBE : 23|1@0+ (1,0) [0|31] "" XXX SG_ ACC_ACTIVE_2 : 52|1@0+ (1,0) [0|1] "" XXX - SG_ NEW_SIGNAL_10 : 30|1@0+ (1,0) [0|1] "" XXX SG_ MSG_1 : 0|1@0+ (1,0) [0|3] "" XXX SG_ 5_SEC_DISABLE_TIMER : 45|3@0+ (1,0) [0|7] "" XXX SG_ NEW_SIGNAL_3 : 13|1@0+ (1,0) [0|3] "" XXX SG_ MSG_1_INV_COPY : 8|1@0+ (1,0) [0|7] "" XXX + SG_ RADAR_HAS_LEAD : 23|1@0+ (1,0) [0|1] "" XXX + SG_ RADAR_LEAD_RELATIVE_DISTANCE : 31|3@0+ (1,0) [0|5] "" XXX BO_ 539 CRZ_INFO: 8 XXX SG_ CTR1 : 55|8@0+ (1,0) [0|255] "" XXX @@ -765,6 +776,8 @@ CM_ SG_ 1157 LANEE_DEPARTURE_ALERT "1 off, 2 on"; CM_ SG_ 1157 WARNING "1 Rare, 0 often"; CM_ SG_ 1088 LANE_LINES "0 LKAS disabled, 1 no lines, 2 two lines, 3 left line, 4 right line"; CM_ SG_ 1045 ABS_MALFUNCTION "off: 0, solid: 1, slow blink: 2, fast blink: 3"; +CM_ SG_ 120 VEHICLE_ACC_X "Vehicle acceleration of X-axis wrt. NED frame."; +CM_ SG_ 120 VEHICLE_ACC_Y "Vehicle acceleration of Y-axis wrt. NED frame."; CM_ SG_ 157 CAN_OFF "Disengage Cruise if enabled, if already disabled TURN it OFF "; CM_ SG_ 552 MORE_GEAR ""; CM_ SG_ 552 GEAR "0 Shifting, 1 P, 2 R, 3 N, 4 D"; @@ -773,3 +786,5 @@ CM_ SG_ 540 HANDS_ON_STEER_WARN "0 no warning, b warning"; CM_ SG_ 540 DISTANCE_SETTING "Radar distance 0: disabled, 1: 4 bars, 2: 3 bars, 3: 2 bars, 4: 1 bar"; CM_ SG_ 1143 REAR_CT_ALERT "Rear Cross Traffic Alert"; VAL_ 552 GEAR 1 "P" 2 "R" 3 "N" 4 "D" ; +VAL_ 540 RADAR_HAS_LEAD 0 "NO LEAD" 1 "HAS LEAD" ; +VAL_ 540 RADAR_LEAD_RELATIVE_DISTANCE 0 "NO LEAD" 1 "FARTHEST" 2 "4" 3 "3" 4 "2" 5 "NEAREST" ; diff --git a/opendbc/requirements.txt b/opendbc/requirements.txt index 5a42421cc..3c0ce4591 100644 --- a/opendbc/requirements.txt +++ b/opendbc/requirements.txt @@ -3,6 +3,6 @@ flake8==3.7.9 Jinja2==3.0.3 numpy==1.21.0 pycapnp==1.0.0 -pylint==2.4.3 +pylint==2.15.4 pyyaml==5.4 scons diff --git a/opendbc/toyota_new_mc_pt_generated.dbc b/opendbc/toyota_new_mc_pt_generated.dbc index 6b728cd8c..0e114678d 100644 --- a/opendbc/toyota_new_mc_pt_generated.dbc +++ b/opendbc/toyota_new_mc_pt_generated.dbc @@ -41,6 +41,11 @@ BO_ 767 SDSU: 8 XXX CM_ "BO_ SDSU: The sDSU is a modified DSU for use in TSS1 Toyotas. Learn more: https://github.com/wocsor/panda/tree/smart_dsu"; CM_ SG_ 767 FD_BUTTON "The follow distance button signal as forwarded by the sdsu"; +BO_ 1880 DEBUG: 8 XXX + SG_ BLINDSPOTSIDE : 7|8@0+ (1,0) [0|255] "" XXX + SG_ BLINDSPOT : 38|1@0+ (1,0) [0|15] "" XXX + SG_ BLINDSPOTD1 : 47|8@0+ (1,0) [0|255] "" XXX + SG_ BLINDSPOTD2 : 55|8@0+ (1,0) [0|255] "" XXX CM_ "Imported file _toyota_2017.dbc starts here"; VERSION "" @@ -106,7 +111,7 @@ BO_ 180 SPEED: 8 XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX BO_ 295 GEAR_PACKET_HYBRID: 8 XXX - SG_ CAR_MOVEMENT : 39|8@0- (1,0) [0|255] "" XXX + SG_ CAR_MOVEMENT : 25|10@0- (1,0) [0|255] "" XXX SG_ COUNTER : 55|8@0+ (1,0) [0|255] "" XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX SG_ GEAR : 47|4@0+ (1,0) [0|15] "" XXX @@ -380,8 +385,7 @@ BO_ 1552 BODY_CONTROL_STATE_2: 8 XXX BO_ 1553 UI_SETTING: 8 XXX SG_ UNITS : 26|2@0+ (1,0) [0|3] "" XXX - SG_ ODOMETER : 43|20@0+ (1,0) [0|1048575] "" XXX - + SG_ ODOMETER : 39|32@0+ (1,0) [0|1048575] "" XXX BO_ 1556 BLINKERS_STATE: 8 XXX SG_ TURN_SIGNALS : 29|2@0+ (1,0) [0|3] "" XXX SG_ HAZARD_LIGHT : 27|1@0+ (1,0) [0|1] "" XXX diff --git a/opendbc/toyota_nodsu_pt_generated.dbc b/opendbc/toyota_nodsu_pt_generated.dbc index 6912a31f0..153deb082 100644 --- a/opendbc/toyota_nodsu_pt_generated.dbc +++ b/opendbc/toyota_nodsu_pt_generated.dbc @@ -41,6 +41,12 @@ BO_ 767 SDSU: 8 XXX CM_ "BO_ SDSU: The sDSU is a modified DSU for use in TSS1 Toyotas. Learn more: https://github.com/wocsor/panda/tree/smart_dsu"; CM_ SG_ 767 FD_BUTTON "The follow distance button signal as forwarded by the sdsu"; +BO_ 1880 DEBUG: 8 XXX + SG_ BLINDSPOTSIDE : 7|8@0+ (1,0) [0|255] "" XXX + SG_ BLINDSPOT : 38|1@0+ (1,0) [0|15] "" XXX + SG_ BLINDSPOTD1 : 47|8@0+ (1,0) [0|255] "" XXX + SG_ BLINDSPOTD2 : 55|8@0+ (1,0) [0|255] "" XXX + CM_ "Imported file _toyota_2017.dbc starts here"; VERSION "" @@ -106,7 +112,7 @@ BO_ 180 SPEED: 8 XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX BO_ 295 GEAR_PACKET_HYBRID: 8 XXX - SG_ CAR_MOVEMENT : 39|8@0- (1,0) [0|255] "" XXX + SG_ CAR_MOVEMENT : 25|10@0- (1,0) [0|255] "" XXX SG_ COUNTER : 55|8@0+ (1,0) [0|255] "" XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX SG_ GEAR : 47|4@0+ (1,0) [0|15] "" XXX @@ -381,8 +387,7 @@ BO_ 1552 BODY_CONTROL_STATE_2: 8 XXX BO_ 1553 UI_SETTING: 8 XXX SG_ UNITS : 26|2@0+ (1,0) [0|3] "" XXX - SG_ ODOMETER : 43|20@0+ (1,0) [0|1048575] "" XXX - + SG_ ODOMETER : 39|32@0+ (1,0) [0|1048575] "" XXX BO_ 1556 BLINKERS_STATE: 8 XXX SG_ TURN_SIGNALS : 29|2@0+ (1,0) [0|3] "" XXX SG_ HAZARD_LIGHT : 27|1@0+ (1,0) [0|1] "" XXX diff --git a/opendbc/toyota_tnga_k_pt_generated.dbc b/opendbc/toyota_tnga_k_pt_generated.dbc index a14ae3909..d615d787f 100644 --- a/opendbc/toyota_tnga_k_pt_generated.dbc +++ b/opendbc/toyota_tnga_k_pt_generated.dbc @@ -41,6 +41,11 @@ BO_ 767 SDSU: 8 XXX CM_ "BO_ SDSU: The sDSU is a modified DSU for use in TSS1 Toyotas. Learn more: https://github.com/wocsor/panda/tree/smart_dsu"; CM_ SG_ 767 FD_BUTTON "The follow distance button signal as forwarded by the sdsu"; +BO_ 1880 DEBUG: 8 XXX + SG_ BLINDSPOTSIDE : 7|8@0+ (1,0) [0|255] "" XXX + SG_ BLINDSPOT : 38|1@0+ (1,0) [0|15] "" XXX + SG_ BLINDSPOTD1 : 47|8@0+ (1,0) [0|255] "" XXX + SG_ BLINDSPOTD2 : 55|8@0+ (1,0) [0|255] "" XXX CM_ "Imported file _toyota_2017.dbc starts here"; VERSION "" @@ -106,7 +111,7 @@ BO_ 180 SPEED: 8 XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX BO_ 295 GEAR_PACKET_HYBRID: 8 XXX - SG_ CAR_MOVEMENT : 39|8@0- (1,0) [0|255] "" XXX + SG_ CAR_MOVEMENT : 25|10@0- (1,0) [0|255] "" XXX SG_ COUNTER : 55|8@0+ (1,0) [0|255] "" XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX SG_ GEAR : 47|4@0+ (1,0) [0|15] "" XXX @@ -380,8 +385,7 @@ BO_ 1552 BODY_CONTROL_STATE_2: 8 XXX BO_ 1553 UI_SETTING: 8 XXX SG_ UNITS : 26|2@0+ (1,0) [0|3] "" XXX - SG_ ODOMETER : 43|20@0+ (1,0) [0|1048575] "" XXX - + SG_ ODOMETER : 39|32@0+ (1,0) [0|1048575] "" XXX BO_ 1556 BLINKERS_STATE: 8 XXX SG_ TURN_SIGNALS : 29|2@0+ (1,0) [0|3] "" XXX SG_ HAZARD_LIGHT : 27|1@0+ (1,0) [0|1] "" XXX diff --git a/panda/__init__.py b/panda/__init__.py index 12ca88ef1..8b43e9938 100644 --- a/panda/__init__.py +++ b/panda/__init__.py @@ -1,10 +1,5 @@ -from .python import (Panda, PandaDFU, # noqa: F401 - BASEDIR, pack_can_buffer, unpack_can_buffer, - DEFAULT_FW_FN, DEFAULT_H7_FW_FN, MCU_TYPE_H7, MCU_TYPE_F4, DLC_TO_LEN, LEN_TO_DLC, - ALTERNATIVE_EXPERIENCE, USBPACKET_MAX_SIZE) - +from .python.constants import McuType, BASEDIR # noqa: F401 from .python.serial import PandaSerial # noqa: F401 - -from .python.config import (BOOTSTUB_ADDRESS, BLOCK_SIZE_FX, APP_ADDRESS_FX, # noqa: F401 - BLOCK_SIZE_H7, APP_ADDRESS_H7, DEVICE_SERIAL_NUMBER_ADDR_H7, # noqa: F401 - DEVICE_SERIAL_NUMBER_ADDR_FX) +from .python import (Panda, PandaDFU, # noqa: F401 + pack_can_buffer, unpack_can_buffer, calculate_checksum, + DLC_TO_LEN, LEN_TO_DLC, ALTERNATIVE_EXPERIENCE, USBPACKET_MAX_SIZE, CANPACKET_HEAD_SIZE) diff --git a/panda/board/obj/bootstub.panda.bin b/panda/board/obj/bootstub.panda.bin index 0a06c88cd..9738fadf7 100755 Binary files a/panda/board/obj/bootstub.panda.bin and b/panda/board/obj/bootstub.panda.bin differ diff --git a/panda/board/obj/panda.bin.signed b/panda/board/obj/panda.bin.signed index cf26f8b6e..96c32d9b3 100644 Binary files a/panda/board/obj/panda.bin.signed and b/panda/board/obj/panda.bin.signed differ diff --git a/panda/examples/query_fw_versions.py b/panda/examples/query_fw_versions.py index 2d4509745..82a204185 100755 --- a/panda/examples/query_fw_versions.py +++ b/panda/examples/query_fw_versions.py @@ -4,14 +4,15 @@ from tqdm import tqdm from panda import Panda from panda.python.uds import UdsClient, MessageTimeoutError, NegativeResponseError, SESSION_TYPE, DATA_IDENTIFIER_TYPE - if __name__ == "__main__": parser = argparse.ArgumentParser() - parser.add_argument('--rxoffset', default="") - parser.add_argument('--nonstandard', action='store_true') - parser.add_argument('--debug', action='store_true') - parser.add_argument('--addr') - parser.add_argument('--bus') + parser.add_argument("--rxoffset", default="") + parser.add_argument("--nonstandard", action="store_true") + parser.add_argument("--no-obd", action="store_true", help="Bus 1 will not be multiplexed to the OBD-II port") + parser.add_argument("--debug", action="store_true") + parser.add_argument("--addr") + parser.add_argument("--bus") + parser.add_argument('-s', '--serial', help="Serial number of panda to use") args = parser.parse_args() if args.addr: @@ -25,15 +26,25 @@ if __name__ == "__main__": for std_id in DATA_IDENTIFIER_TYPE: uds_data_ids[std_id.value] = std_id.name if args.nonstandard: - for uds_id in range(0xf100,0xf180): + for uds_id in range(0xf100, 0xf180): uds_data_ids[uds_id] = "IDENTIFICATION_OPTION_VEHICLE_MANUFACTURER_SPECIFIC_DATA_IDENTIFIER" - for uds_id in range(0xf1a0,0xf1f0): + for uds_id in range(0xf1a0, 0xf1f0): uds_data_ids[uds_id] = "IDENTIFICATION_OPTION_VEHICLE_MANUFACTURER_SPECIFIC" - for uds_id in range(0xf1f0,0xf200): + for uds_id in range(0xf1f0, 0xf200): uds_data_ids[uds_id] = "IDENTIFICATION_OPTION_SYSTEM_SUPPLIER_SPECIFIC" - panda = Panda() - panda.set_safety_mode(Panda.SAFETY_ELM327) + panda_serials = Panda.list() + if args.serial is None and len(panda_serials) > 1: + print("\nMultiple pandas found, choose one:") + for serial in panda_serials: + with Panda(serial) as panda: + print(f" {serial}: internal={panda.is_internal()}") + print() + parser.print_help() + exit() + + panda = Panda(serial=args.serial) + panda.set_safety_mode(Panda.SAFETY_ELM327, 1 if args.no_obd else 0) print("querying addresses ...") with tqdm(addrs) as t: for addr in t: diff --git a/panda/python/__init__.py b/panda/python/__init__.py index 22543b908..08acc17ce 100644 --- a/panda/python/__init__.py +++ b/panda/python/__init__.py @@ -5,18 +5,20 @@ import time import usb1 import struct import hashlib +import binascii import datetime -import traceback import warnings import logging from functools import wraps from typing import Optional from itertools import accumulate -from .config import DEFAULT_FW_FN, DEFAULT_H7_FW_FN, SECTOR_SIZES_FX, SECTOR_SIZES_H7 -from .dfu import PandaDFU, MCU_TYPE_F2, MCU_TYPE_F4, MCU_TYPE_H7 +from .base import BaseHandle +from .constants import McuType +from .dfu import PandaDFU from .isotp import isotp_send, isotp_recv -from .spi import SpiHandle +from .spi import PandaSpiHandle, PandaSpiException +from .usb import PandaUsbHandle __version__ = '0.0.10' @@ -24,55 +26,48 @@ __version__ = '0.0.10' LOGLEVEL = os.environ.get('LOGLEVEL', 'INFO').upper() logging.basicConfig(level=LOGLEVEL, format='%(message)s') - -BASEDIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), "../") - -DEBUG = os.getenv("PANDADEBUG") is not None - -CAN_TRANSACTION_MAGIC = struct.pack("= 0x800 else 0 data_len_code = LEN_TO_DLC[len(dat)] - header = bytearray(5) + header = bytearray(CANPACKET_HEAD_SIZE) word_4b = address << 3 | extended << 2 header[0] = (data_len_code << 4) | (bus << 1) header[1] = word_4b & 0xFF header[2] = (word_4b >> 8) & 0xFF header[3] = (word_4b >> 16) & 0xFF header[4] = (word_4b >> 24) & 0xFF + header[5] = calculate_checksum(header[:5] + dat) snds[-1] += header + dat if len(snds[-1]) > 256: # Limit chunks to 256 bytes - snds.append(CAN_TRANSACTION_MAGIC) + snds.append(b'') return snds def unpack_can_buffer(dat): ret = [] - if len(dat) < len(CAN_TRANSACTION_MAGIC): - return ret - - if dat[:len(CAN_TRANSACTION_MAGIC)] != CAN_TRANSACTION_MAGIC: - logging.error("CAN: recv didn't start with magic") - return ret - - dat = dat[len(CAN_TRANSACTION_MAGIC):] while len(dat) >= CANPACKET_HEAD_SIZE: data_len = DLC_TO_LEN[(dat[0]>>4)] header = dat[:CANPACKET_HEAD_SIZE] - dat = dat[CANPACKET_HEAD_SIZE:] bus = (header[0] >> 1) & 0x7 address = (header[4] << 24 | header[3] << 16 | header[2] << 8 | header[1]) >> 3 @@ -84,17 +79,18 @@ def unpack_can_buffer(dat): # rejected bus += 192 - data = dat[:data_len] - dat = dat[data_len:] + # we need more from the next transfer + if data_len > len(dat) - CANPACKET_HEAD_SIZE: + break - #logging.debug(" R 0x%x: 0x%s", address, data.hex()) + assert calculate_checksum(dat[:(CANPACKET_HEAD_SIZE+data_len)]) == 0, "CAN packet checksum incorrect" + + data = dat[CANPACKET_HEAD_SIZE:(CANPACKET_HEAD_SIZE+data_len)] + dat = dat[(CANPACKET_HEAD_SIZE+data_len):] ret.append((address, 0, data, bus)) - if len(dat) > 0: - logging.error("CAN: malformed packet. leftover data") - - return ret + return (ret, dat) def ensure_health_packet_version(fn): @wraps(fn) @@ -162,8 +158,6 @@ class Panda: SAFETY_FAW = 26 SAFETY_BODY = 27 SAFETY_HYUNDAI_CANFD = 28 - SAFETY_VOLVO_C1 = 29 - SAFETY_VOLVO_EUCD = 30 SERIAL_DEBUG = 0 SERIAL_ESP = 1 @@ -188,11 +182,14 @@ class Panda: HW_TYPE_RED_PANDA_V2 = b'\x08' HW_TYPE_TRES = b'\x09' - CAN_PACKET_VERSION = 3 + CAN_PACKET_VERSION = 4 HEALTH_PACKET_VERSION = 11 - CAN_HEALTH_PACKET_VERSION = 3 - HEALTH_STRUCT = struct.Struct("> 8, ]) + this_bcd = device.getbcdDevice() + if this_bcd is not None and this_bcd != 0x2300: + bcd = bytearray([this_bcd >> 8, ]) break - except Exception as e: - print("exception", e) - traceback.print_exc() - if not wait or self._handle is not None: + except Exception: + logging.exception("USB connect error") + if not wait or handle is not None: break context = usb1.USBContext() # New context needed so new devices show up + usb_handle = None + if handle is not None: + usb_handle = PandaUsbHandle(handle) + + return usb_handle, usb_serial, bootstub, bcd + + @staticmethod + def list(): + ret = Panda.usb_list() + ret += Panda.spi_list() + return list(set(ret)) + + @staticmethod + def usb_list(): + context = usb1.USBContext() + ret = [] + try: + for device in context.getDeviceList(skip_on_error=True): + if device.getVendorID() == 0xbbaa and device.getProductID() in (0xddcc, 0xddee): + try: + serial = device.getSerialNumber() + if len(serial) == 24: + ret.append(serial) + else: + warnings.warn(f"found device with panda descriptors but invalid serial: {serial}", RuntimeWarning) + except Exception: + continue + except Exception: + pass + return ret + + @staticmethod + def spi_list(): + _, serial, _, _ = Panda.spi_connect(None) + if serial is not None: + return [serial, ] + return [] + def reset(self, enter_bootstub=False, enter_bootloader=False, reconnect=True): try: if enter_bootloader: @@ -323,7 +405,7 @@ class Panda: self.reconnect() def reconnect(self): - if self._handle is not None: + if self._handle_open: self.close() time.sleep(1.0) @@ -335,7 +417,7 @@ class Panda: success = True break except Exception: - print("reconnecting is taking %d seconds..." % (i + 1)) + logging.debug("reconnecting is taking %d seconds...", i + 1) try: dfu = PandaDFU(PandaDFU.st_serial_to_dfu_serial(self._serial, self._mcu_type)) dfu.recover() @@ -345,39 +427,41 @@ class Panda: if not success: raise Exception("reconnect failed") - + @staticmethod + def flasher_present(handle: BaseHandle) -> bool: + fr = handle.controlRead(Panda.REQUEST_IN, 0xb0, 0, 0, 0xc) + return fr[4:8] == b"\xde\xad\xd0\x0d" @staticmethod def flash_static(handle, code, mcu_type): assert mcu_type is not None, "must set valid mcu_type to flash" # confirm flasher is present - fr = handle.controlRead(Panda.REQUEST_IN, 0xb0, 0, 0, 0xc) - assert fr[4:8] == b"\xde\xad\xd0\x0d" + assert Panda.flasher_present(handle) # determine sectors to erase - apps_sectors_cumsum = accumulate(SECTOR_SIZES_H7[1:] if mcu_type == MCU_TYPE_H7 else SECTOR_SIZES_FX[1:]) + apps_sectors_cumsum = accumulate(mcu_type.config.sector_sizes[1:]) last_sector = next((i + 1 for i, v in enumerate(apps_sectors_cumsum) if v > len(code)), -1) assert last_sector >= 1, "Binary too small? No sector to erase." assert last_sector < 7, "Binary too large! Risk of overwriting provisioning chunk." # unlock flash - print("flash: unlocking") + logging.warning("flash: unlocking") handle.controlWrite(Panda.REQUEST_IN, 0xb1, 0, 0, b'') # erase sectors - print(f"flash: erasing sectors 1 - {last_sector}") + logging.warning(f"flash: erasing sectors 1 - {last_sector}") for i in range(1, last_sector + 1): handle.controlWrite(Panda.REQUEST_IN, 0xb2, i, 0, b'') # flash over EP2 STEP = 0x10 - print("flash: flashing") + logging.warning("flash: flashing") for i in range(0, len(code), STEP): handle.bulkWrite(2, code[i:i + STEP]) # reset - print("flash: resetting") + logging.warning("flash: resetting") try: handle.controlWrite(Panda.REQUEST_IN, 0xd8, 0, 0, b'') except Exception: @@ -385,9 +469,9 @@ class Panda: def flash(self, fn=None, code=None, reconnect=True): if not fn: - fn = DEFAULT_H7_FW_FN if self._mcu_type == MCU_TYPE_H7 else DEFAULT_FW_FN + fn = self._mcu_type.config.app_path assert os.path.isfile(fn) - print("flash: main version is " + self.get_version()) + logging.debug("flash: main version is %s", self.get_version()) if not self.bootstub: self.reset(enter_bootstub=True) assert(self.bootstub) @@ -397,7 +481,7 @@ class Panda: code = f.read() # get version - print("flash: bootstub version is " + self.get_version()) + logging.debug("flash: bootstub version is %s", self.get_version()) # do flash Panda.flash_static(self._handle, code, mcu_type=self._mcu_type) @@ -428,30 +512,16 @@ class Panda: def wait_for_dfu(dfu_serial: str, timeout: Optional[int] = None) -> bool: t_start = time.monotonic() while dfu_serial not in PandaDFU.list(): - print("waiting for DFU...") + logging.debug("waiting for DFU...") time.sleep(0.1) if timeout is not None and (time.monotonic() - t_start) > timeout: return False return True - @staticmethod - def list(): - context = usb1.USBContext() - ret = [] - try: - for device in context.getDeviceList(skip_on_error=True): - if device.getVendorID() == 0xbbaa and device.getProductID() in (0xddcc, 0xddee): - try: - serial = device.getSerialNumber() - if len(serial) == 24: - ret.append(serial) - else: - warnings.warn(f"found device with panda descriptors but invalid serial: {serial}", RuntimeWarning) - except Exception: - continue - except Exception: - pass - return ret + def up_to_date(self) -> bool: + current = self.get_signature() + expected = Panda.get_signature_from_firmware(self.get_mcu_type().config.app_path) + return (current == expected) def call_control_api(self, msg): self._handle.controlWrite(Panda.REQUEST_OUT, msg, 0, 0, b'') @@ -487,6 +557,7 @@ class Panda: "fan_power": a[21], "safety_rx_checks_invalid": a[22], "usb_power_mode": a[23], + "torque_interceptor_detected": a[24], } @ensure_can_health_packet_version @@ -520,11 +591,12 @@ class Panda: "total_tx_cnt": a[13], "total_rx_cnt": a[14], "total_fwd_cnt": a[15], - "can_speed": a[16], - "can_data_speed": a[17], - "canfd_enabled": a[18], - "brs_enabled": a[19], - "canfd_non_iso": a[20], + "total_tx_checksum_error_cnt": a[16], + "can_speed": a[17], + "can_data_speed": a[18], + "canfd_enabled": a[19], + "brs_enabled": a[20], + "canfd_non_iso": a[21], } # ******************* control ******************* @@ -532,8 +604,8 @@ class Panda: def enter_bootloader(self): try: self._handle.controlWrite(Panda.REQUEST_OUT, 0xd1, 0, 0, b'') - except Exception as e: - print(e) + except Exception: + logging.exception("exception while entering bootloader") def get_version(self): return self._handle.controlRead(Panda.REQUEST_IN, 0xd6, 0, 0, 0x40).decode('utf8') @@ -544,7 +616,7 @@ class Panda: f.seek(-128, 2) # Seek from end of file return f.read(128) - def get_signature(self): + def get_signature(self) -> bytes: part_1 = self._handle.controlRead(Panda.REQUEST_IN, 0xd3, 0, 0, 0x40) part_2 = self._handle.controlRead(Panda.REQUEST_IN, 0xd4, 0, 0, 0x40) return bytes(part_1 + part_2) @@ -552,10 +624,9 @@ class Panda: def get_type(self): ret = self._handle.controlRead(Panda.REQUEST_IN, 0xc1, 0, 0, 0x40) - # bootstub doesn't implement this call, so fallback to bcdDevice - invalid_type = self.bootstub and (ret is None or len(ret) != 1) - if invalid_type and self._bcd_device is not None: - ret = self._bcd_device + # old bootstubs don't implement this endpoint, see comment in Panda.device + if self._bcd_hw_type is not None and (ret is None or len(ret) != 1): + ret = self._bcd_hw_type return ret @@ -568,15 +639,20 @@ class Panda: else: return (0, 0, 0) - def get_mcu_type(self): + def get_mcu_type(self) -> McuType: hw_type = self.get_type() if hw_type in Panda.F2_DEVICES: - return MCU_TYPE_F2 + return McuType.F2 elif hw_type in Panda.F4_DEVICES: - return MCU_TYPE_F4 + return McuType.F4 elif hw_type in Panda.H7_DEVICES: - return MCU_TYPE_H7 - return None + return McuType.H7 + else: + # have to assume F4, see comment in Panda.connect + if self._assume_f4_mcu: + return McuType.F4 + + raise ValueError(f"unknown HW type: {hw_type}") def has_obd(self): return self.get_type() in Panda.HAS_OBD @@ -585,14 +661,28 @@ class Panda: return self.get_type() in Panda.INTERNAL_DEVICES def get_serial(self): + """ + Returns the comma-issued dongle ID from our provisioning + """ dat = self._handle.controlRead(Panda.REQUEST_IN, 0xd0, 0, 0, 0x20) hashsig, calc_hash = dat[0x1c:], hashlib.sha1(dat[0:0x1c]).digest()[0:4] assert(hashsig == calc_hash) return [dat[0:0x10].decode("utf8"), dat[0x10:0x10 + 10].decode("utf8")] def get_usb_serial(self): + """ + Returns the serial number reported from the USB descriptor; + matches the MCU UID + """ return self._serial + def get_uid(self): + """ + Returns the UID from the MCU + """ + dat = self._handle.controlRead(Panda.REQUEST_IN, 0xc3, 0, 0, 12) + return binascii.hexlify(dat).decode() + def get_secret(self): return self._handle.controlRead(Panda.REQUEST_IN, 0xd0, 1, 0, 0x10) @@ -659,6 +749,9 @@ class Panda: # Timeout is in ms. If set to 0, the timeout is infinite. CAN_SEND_TIMEOUT_MS = 10 + def can_reset_communications(self): + self._handle.controlWrite(Panda.REQUEST_OUT, 0xc0, 0, 0, b'') + @ensure_can_packet_version def can_send_many(self, arr, timeout=CAN_SEND_TIMEOUT_MS): snds = pack_can_buffer(arr) @@ -670,10 +763,10 @@ class Panda: tx = tx[bs:] if len(tx) == 0: break - print("CAN: PARTIAL SEND MANY, RETRYING") + logging.error("CAN: PARTIAL SEND MANY, RETRYING") break except (usb1.USBErrorIO, usb1.USBErrorOverflow): - print("CAN: BAD SEND MANY, RETRYING") + logging.error("CAN: BAD SEND MANY, RETRYING") def can_send(self, addr, dat, bus, timeout=CAN_SEND_TIMEOUT_MS): self.can_send_many([[addr, None, dat, bus]], timeout=timeout) @@ -686,9 +779,10 @@ class Panda: dat = self._handle.bulkRead(1, 16384) # Max receive batch size + 2 extra reserve frames break except (usb1.USBErrorIO, usb1.USBErrorOverflow): - print("CAN: BAD RECV, RETRYING") + logging.error("CAN: BAD RECV, RETRYING") time.sleep(0.1) - return unpack_can_buffer(dat) + msgs, self.can_rx_overflow_buffer = unpack_can_buffer(self.can_rx_overflow_buffer + dat) + return msgs def can_clear(self, bus): """Clears all messages from the specified internal CAN ringbuffer as @@ -722,8 +816,10 @@ class Panda: def serial_write(self, port_number, ln): ret = 0 + if type(ln) == str: + ln = bytes(ln, 'utf-8') for i in range(0, len(ln), 0x20): - ret += self._handle.bulkWrite(2, struct.pack("B", port_number) + bytes(ln[i:i + 0x20], 'utf-8')) + ret += self._handle.bulkWrite(2, struct.pack("B", port_number) + ln[i:i + 0x20]) return ret def serial_clear(self, port_number): @@ -741,19 +837,15 @@ class Panda: # pulse low for wakeup def kline_wakeup(self, k=True, l=True): assert k or l, "must specify k-line, l-line, or both" - if DEBUG: - print("kline wakeup...") + logging.debug("kline wakeup...") self._handle.controlWrite(Panda.REQUEST_OUT, 0xf0, 2 if k and l else int(l), 0, b'') - if DEBUG: - print("kline wakeup done") + logging.debug("kline wakeup done") def kline_5baud(self, addr, k=True, l=True): assert k or l, "must specify k-line, l-line, or both" - if DEBUG: - print("kline 5 baud...") + logging.debug("kline 5 baud...") self._handle.controlWrite(Panda.REQUEST_OUT, 0xf4, 2 if k and l else int(l), addr, b'') - if DEBUG: - print("kline 5 baud done") + logging.debug("kline 5 baud done") def kline_drain(self, bus=2): # drain buffer @@ -762,8 +854,7 @@ class Panda: ret = self._handle.controlRead(Panda.REQUEST_IN, 0xe0, bus, 0, 0x40) if len(ret) == 0: break - elif DEBUG: - print(f"kline drain: 0x{ret.hex()}") + logging.debug(f"kline drain: 0x{ret.hex()}") bret += ret return bytes(bret) @@ -771,8 +862,8 @@ class Panda: echo = bytearray() while len(echo) != cnt: ret = self._handle.controlRead(Panda.REQUEST_OUT, 0xe0, bus, 0, cnt - len(echo)) - if DEBUG and len(ret) > 0: - print(f"kline recv: 0x{ret.hex()}") + if len(ret) > 0: + logging.debug(f"kline recv: 0x{ret.hex()}") echo += ret return bytes(echo) @@ -782,14 +873,13 @@ class Panda: x += bytes([sum(x) % 0x100]) for i in range(0, len(x), 0xf): ts = x[i:i + 0xf] - if DEBUG: - print(f"kline send: 0x{ts.hex()}") + logging.debug(f"kline send: 0x{ts.hex()}") self._handle.bulkWrite(2, bytes([bus]) + ts) echo = self.kline_ll_recv(len(ts), bus=bus) if echo != ts: - print(f"**** ECHO ERROR {i} ****") - print(f"0x{echo.hex()}") - print(f"0x{ts.hex()}") + logging.error(f"**** ECHO ERROR {i} ****") + logging.error(f"0x{echo.hex()}") + logging.error(f"0x{ts.hex()}") assert echo == ts def kline_recv(self, bus=2, header_len=4): @@ -822,6 +912,11 @@ class Panda: a = struct.unpack("HBBBBBB", dat) return datetime.datetime(a[0], a[1], a[2], a[4], a[5], a[6]) + # ****************** Timer ***************** + def get_microsecond_timer(self): + dat = self._handle.controlRead(Panda.REQUEST_IN, 0xa8, 0, 0, 4) + return struct.unpack("I", dat)[0] + # ******************* IR ******************* def set_ir_power(self, percentage): self._handle.controlWrite(Panda.REQUEST_OUT, 0xb0, int(percentage), 0, b'') @@ -839,10 +934,10 @@ class Panda: def set_phone_power(self, enabled): self._handle.controlWrite(Panda.REQUEST_OUT, 0xb3, int(enabled), 0, b'') - # ************** Clock Source ************** - def set_clock_source_mode(self, mode): - self._handle.controlWrite(Panda.REQUEST_OUT, 0xf5, int(mode), 0, b'') - # ****************** Siren ***************** def set_siren(self, enabled): self._handle.controlWrite(Panda.REQUEST_OUT, 0xf6, int(enabled), 0, b'') + + # ****************** Debug ***************** + def set_green_led(self, enabled): + self._handle.controlWrite(Panda.REQUEST_OUT, 0xf7, int(enabled), 0, b'') diff --git a/panda/python/base.py b/panda/python/base.py new file mode 100644 index 000000000..5bfa56489 --- /dev/null +++ b/panda/python/base.py @@ -0,0 +1,67 @@ +from abc import ABC, abstractmethod +from typing import List + +from .constants import McuType + +TIMEOUT = int(15 * 1e3) # default timeout, in milliseconds + +class BaseHandle(ABC): + """ + A handle to talk to a panda. + Borrows heavily from the libusb1 handle API. + """ + + @abstractmethod + def close(self) -> None: + ... + + @abstractmethod + def controlWrite(self, request_type: int, request: int, value: int, index: int, data, timeout: int = TIMEOUT) -> int: + ... + + @abstractmethod + def controlRead(self, request_type: int, request: int, value: int, index: int, length: int, timeout: int = TIMEOUT) -> bytes: + ... + + @abstractmethod + def bulkWrite(self, endpoint: int, data: List[int], timeout: int = TIMEOUT) -> int: + ... + + @abstractmethod + def bulkRead(self, endpoint: int, length: int, timeout: int = TIMEOUT) -> bytes: + ... + + +class BaseSTBootloaderHandle(ABC): + """ + A handle to talk to a panda while it's in the STM32 bootloader. + """ + + @abstractmethod + def get_mcu_type(self) -> McuType: + ... + + @abstractmethod + def close(self) -> None: + ... + + @abstractmethod + def clear_status(self) -> None: + ... + + @abstractmethod + def program(self, address: int, dat: bytes) -> None: + ... + + @abstractmethod + def erase_app(self) -> None: + ... + + @abstractmethod + def erase_bootstub(self) -> None: + ... + + @abstractmethod + def jump(self, address: int) -> None: + ... + diff --git a/panda/python/ccp.py b/panda/python/ccp.py index a8c00169f..918312002 100644 --- a/panda/python/ccp.py +++ b/panda/python/ccp.py @@ -100,9 +100,9 @@ class CcpClient(): msgs = self._panda.can_recv() or [] if len(msgs) >= 256: print("CAN RX buffer overflow!!!", file=sys.stderr) - for rx_addr, _, rx_data, rx_bus in msgs: + for rx_addr, _, rx_data_bytearray, rx_bus in msgs: if rx_bus == self.can_bus and rx_addr == self.rx_addr: - rx_data = bytes(rx_data) # convert bytearray to bytes + rx_data = bytes(rx_data_bytearray) if self.debug: print(f"CAN-RX: {hex(rx_addr)} - 0x{bytes.hex(rx_data)}") assert len(rx_data) == 8, f"message length not 8: {len(rx_data)}" @@ -183,7 +183,7 @@ class CcpClient(): resp = self._recv_dto(0.025) # mta_addr_ext = resp[0] mta_addr = struct.unpack(f"{self.byte_order.value}I", resp[1:5])[0] - return mta_addr + return mta_addr # type: ignore def download_6_bytes(self, data: bytes) -> int: if len(data) != 6: @@ -192,7 +192,7 @@ class CcpClient(): resp = self._recv_dto(0.025) # mta_addr_ext = resp[0] mta_addr = struct.unpack(f"{self.byte_order.value}I", resp[1:5])[0] - return mta_addr + return mta_addr # type: ignore def upload(self, size: int) -> bytes: if size > 5: @@ -296,7 +296,7 @@ class CcpClient(): resp = self._recv_dto(0.1) # mta_addr_ext = resp[0] mta_addr = struct.unpack(f"{self.byte_order.value}I", resp[1:5])[0] - return mta_addr + return mta_addr # type: ignore def program_6_bytes(self, data: bytes) -> int: if len(data) != 6: @@ -305,7 +305,7 @@ class CcpClient(): resp = self._recv_dto(0.1) # mta_addr_ext = resp[0] mta_addr = struct.unpack(f"{self.byte_order.value}I", resp[1:5])[0] - return mta_addr + return mta_addr # type: ignore def move_memory_block(self, size: int) -> None: self._send_cro(COMMAND_CODE.MOVE, struct.pack(f"{self.byte_order.value}I", size)) diff --git a/panda/python/constants.py b/panda/python/constants.py new file mode 100644 index 000000000..c55fd2c9b --- /dev/null +++ b/panda/python/constants.py @@ -0,0 +1,57 @@ +import os +import enum +from typing import List, NamedTuple + +BASEDIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), "../") + + +class McuConfig(NamedTuple): + mcu: str + mcu_idcode: int + uid_address: int + block_size: int + sector_sizes: List[int] + serial_number_address: int + app_address: int + app_path: str + bootstub_address: int + bootstub_path: str + +Fx = ( + 0x1FFF7A10, + 0x800, + [0x4000 for _ in range(4)] + [0x10000] + [0x20000 for _ in range(11)], + 0x1FFF79C0, + 0x8004000, + os.path.join(BASEDIR, "board", "obj", "panda.bin.signed"), + 0x8000000, + os.path.join(BASEDIR, "board", "obj", "bootstub.panda.bin"), +) +F2Config = McuConfig("STM32F2", 0x411, *Fx) +F4Config = McuConfig("STM32F4", 0x463, *Fx) + +H7Config = McuConfig( + "STM32H7", + 0x483, + 0x1FF1E800, + 0x400, + # there is an 8th sector, but we use that for the provisioning chunk, so don't program over that! + [0x20000 for _ in range(7)], + 0x080FFFC0, + 0x8020000, + os.path.join(BASEDIR, "board", "obj", "panda_h7.bin.signed"), + 0x8000000, + os.path.join(BASEDIR, "board", "obj", "bootstub.panda_h7.bin"), +) + +@enum.unique +class McuType(enum.Enum): + F2 = F2Config + F4 = F4Config + H7 = H7Config + + @property + def config(self): + return self.value + +MCU_TYPE_BY_IDCODE = {m.config.mcu_idcode: m for m in McuType} diff --git a/panda/python/dfu.py b/panda/python/dfu.py index 317780ca8..15e018c5b 100644 --- a/panda/python/dfu.py +++ b/panda/python/dfu.py @@ -1,22 +1,31 @@ import usb1 import struct import binascii -from .config import BOOTSTUB_ADDRESS, APP_ADDRESS_H7, APP_ADDRESS_FX, BLOCK_SIZE_H7, BLOCK_SIZE_FX, DEFAULT_H7_BOOTSTUB_FN, DEFAULT_BOOTSTUB_FN +from typing import List, Optional + +from .base import BaseSTBootloaderHandle +from .spi import STBootloaderSPIHandle, PandaSpiException +from .usb import STBootloaderUSBHandle +from .constants import McuType -MCU_TYPE_F2 = 0 -MCU_TYPE_F4 = 1 -MCU_TYPE_H7 = 2 +class PandaDFU: + def __init__(self, dfu_serial: Optional[str]): + # try USB, then SPI + handle: Optional[BaseSTBootloaderHandle] + handle = PandaDFU.usb_connect(dfu_serial) + if handle is None: + handle = PandaDFU.spi_connect(dfu_serial) -# *** DFU mode *** -DFU_DNLOAD = 1 -DFU_UPLOAD = 2 -DFU_GETSTATUS = 3 -DFU_CLRSTATUS = 4 -DFU_ABORT = 6 + if handle is None: + raise Exception(f"failed to open DFU device {dfu_serial}") -class PandaDFU(object): - def __init__(self, dfu_serial): + self._handle: BaseSTBootloaderHandle = handle + self._mcu_type: McuType = self._handle.get_mcu_type() + + @staticmethod + def usb_connect(dfu_serial: Optional[str]) -> Optional[STBootloaderUSBHandle]: + handle = None context = usb1.USBContext() for device in context.getDeviceList(skip_on_error=True): if device.getVendorID() == 0x0483 and device.getProductID() == 0xdf11: @@ -24,14 +33,37 @@ class PandaDFU(object): this_dfu_serial = device.open().getASCIIStringDescriptor(3) except Exception: continue + if this_dfu_serial == dfu_serial or dfu_serial is None: - self._mcu_type = self.get_mcu_type(device) - self._handle = device.open() - return - raise Exception("failed to open " + dfu_serial if dfu_serial is not None else "DFU device") + handle = STBootloaderUSBHandle(device, device.open()) + break + + return handle @staticmethod - def list(): + def spi_connect(dfu_serial: Optional[str]) -> Optional[STBootloaderSPIHandle]: + handle = None + this_dfu_serial = None + + try: + handle = STBootloaderSPIHandle() + this_dfu_serial = PandaDFU.st_serial_to_dfu_serial(handle.get_uid(), handle.get_mcu_type()) + except PandaSpiException: + handle = None + + if dfu_serial is not None and dfu_serial != this_dfu_serial: + handle = None + + return handle + + @staticmethod + def list() -> List[str]: + ret = PandaDFU.usb_list() + ret += PandaDFU.spi_list() + return list(set(ret)) + + @staticmethod + def usb_list() -> List[str]: context = usb1.USBContext() dfu_serials = [] try: @@ -46,80 +78,41 @@ class PandaDFU(object): return dfu_serials @staticmethod - def st_serial_to_dfu_serial(st, mcu_type=MCU_TYPE_F4): + def spi_list() -> List[str]: + try: + h = PandaDFU.spi_connect(None) + if h is not None: + dfu_serial = PandaDFU.st_serial_to_dfu_serial(h.get_uid(), h.get_mcu_type()) + return [dfu_serial, ] + except PandaSpiException: + pass + return [] + + @staticmethod + def st_serial_to_dfu_serial(st: str, mcu_type: McuType = McuType.F4): if st is None or st == "none": return None uid_base = struct.unpack("H" * 6, bytes.fromhex(st)) - if mcu_type == MCU_TYPE_H7: + if mcu_type == McuType.H7: return binascii.hexlify(struct.pack("!HHH", uid_base[1] + uid_base[5], uid_base[0] + uid_base[4], uid_base[3])).upper().decode("utf-8") else: return binascii.hexlify(struct.pack("!HHH", uid_base[1] + uid_base[5], uid_base[0] + uid_base[4] + 0xA, uid_base[3])).upper().decode("utf-8") - # TODO: Find a way to detect F4 vs F2 - def get_mcu_type(self, dev): - return MCU_TYPE_H7 if dev.getbcdDevice() == 512 else MCU_TYPE_F4 + def get_mcu_type(self) -> McuType: + return self._mcu_type - def status(self): - while 1: - dat = self._handle.controlRead(0x21, DFU_GETSTATUS, 0, 0, 6) - if dat[1] == 0: - break - - def clear_status(self): - # Clear status - stat = self._handle.controlRead(0x21, DFU_GETSTATUS, 0, 0, 6) - if stat[4] == 0xa: - self._handle.controlRead(0x21, DFU_CLRSTATUS, 0, 0, 0) - elif stat[4] == 0x9: - self._handle.controlWrite(0x21, DFU_ABORT, 0, 0, b"") - self.status() - stat = str(self._handle.controlRead(0x21, DFU_GETSTATUS, 0, 0, 6)) - - def erase(self, address): - self._handle.controlWrite(0x21, DFU_DNLOAD, 0, 0, b"\x41" + struct.pack("I", address)) - self.status() - - def program(self, address, dat, block_size=None): - if block_size is None: - block_size = len(dat) - - # Set Address Pointer - self._handle.controlWrite(0x21, DFU_DNLOAD, 0, 0, b"\x21" + struct.pack("I", address)) - self.status() - - # Program - dat += b"\xFF" * ((block_size - len(dat)) % block_size) - for i in range(0, len(dat) // block_size): - ldat = dat[i * block_size:(i + 1) * block_size] - print("programming %d with length %d" % (i, len(ldat))) - self._handle.controlWrite(0x21, DFU_DNLOAD, 2 + i, 0, ldat) - self.status() + def reset(self): + self._handle.jump(self._mcu_type.config.bootstub_address) def program_bootstub(self, code_bootstub): - self.clear_status() - self.erase(BOOTSTUB_ADDRESS) - if self._mcu_type == MCU_TYPE_H7: - self.erase(APP_ADDRESS_H7) - self.program(BOOTSTUB_ADDRESS, code_bootstub, BLOCK_SIZE_H7) - else: - self.erase(APP_ADDRESS_FX) - self.program(BOOTSTUB_ADDRESS, code_bootstub, BLOCK_SIZE_FX) + self._handle.clear_status() + self._handle.erase_bootstub() + self._handle.erase_app() + self._handle.program(self._mcu_type.config.bootstub_address, code_bootstub) self.reset() def recover(self): - fn = DEFAULT_H7_BOOTSTUB_FN if self._mcu_type == MCU_TYPE_H7 else DEFAULT_BOOTSTUB_FN - - with open(fn, "rb") as f: + with open(self._mcu_type.config.bootstub_path, "rb") as f: code = f.read() - self.program_bootstub(code) - def reset(self): - # **** Reset **** - self._handle.controlWrite(0x21, DFU_DNLOAD, 0, 0, b"\x21" + struct.pack("I", BOOTSTUB_ADDRESS)) - self.status() - try: - self._handle.controlWrite(0x21, DFU_DNLOAD, 2, 0, b"") - _ = str(self._handle.controlRead(0x21, DFU_GETSTATUS, 0, 0, 6)) - except Exception: - pass diff --git a/panda/python/spi.py b/panda/python/spi.py index 6a6569fed..0ff15c3bc 100644 --- a/panda/python/spi.py +++ b/panda/python/spi.py @@ -1,9 +1,22 @@ +import binascii +import os +import fcntl import math +import time import struct -import spidev import logging +import threading +from contextlib import contextmanager from functools import reduce -from typing import List +from typing import List, Optional + +from .base import BaseHandle, BaseSTBootloaderHandle, TIMEOUT +from .constants import McuType, MCU_TYPE_BY_IDCODE + +try: + import spidev +except ImportError: + spidev = None # Constants SYNC = 0x5A @@ -12,17 +25,69 @@ DACK = 0x85 NACK = 0x1F CHECKSUM_START = 0xAB -MAX_RETRY_COUNT = 5 +MIN_ACK_TIMEOUT_MS = 100 +MAX_XFER_RETRY_COUNT = 5 USB_MAX_SIZE = 0x40 -# This mimics the handle given by libusb1 for easy interoperability -class SpiHandle: - def __init__(self): - self.spi = spidev.SpiDev() # pylint: disable=c-extension-no-member - self.spi.open(0, 0) +DEV_PATH = "/dev/spidev0.0" - self.spi.max_speed_hz = 30000000 + +class PandaSpiException(Exception): + pass + +class PandaSpiUnavailable(PandaSpiException): + pass + +class PandaSpiNackResponse(PandaSpiException): + pass + +class PandaSpiMissingAck(PandaSpiException): + pass + +class PandaSpiBadChecksum(PandaSpiException): + pass + +class PandaSpiTransferFailed(PandaSpiException): + pass + + +SPI_LOCK = threading.Lock() + +class SpiDevice: + """ + Provides locked, thread-safe access to a panda's SPI interface. + """ + def __init__(self, speed=30000000): + if not os.path.exists(DEV_PATH): + raise PandaSpiUnavailable(f"SPI device not found: {DEV_PATH}") + if spidev is None: + raise PandaSpiUnavailable("spidev is not installed") + + self._spidev = spidev.SpiDev() # pylint: disable=c-extension-no-member + self._spidev.open(0, 0) + self._spidev.max_speed_hz = speed + + @contextmanager + def acquire(self): + try: + SPI_LOCK.acquire() + fcntl.flock(self._spidev, fcntl.LOCK_EX) + yield self._spidev + finally: + fcntl.flock(self._spidev, fcntl.LOCK_UN) + SPI_LOCK.release() + + def close(self): + self._spidev.close() + + +class PandaSpiHandle(BaseHandle): + """ + A class that mimics a libusb1 handle for panda SPI communications. + """ + def __init__(self): + self.dev = SpiDevice() # helpers def _calc_checksum(self, data: List[int]) -> int: @@ -31,75 +96,218 @@ class SpiHandle: cksum ^= b return cksum - def _transfer(self, endpoint: int, data, max_rx_len: int = 1000) -> bytes: + def _wait_for_ack(self, spi, ack_val: int, timeout: int) -> None: + timeout_s = max(MIN_ACK_TIMEOUT_MS, timeout) * 1e-3 + + start = time.monotonic() + while (timeout == 0) or ((time.monotonic() - start) < timeout_s): + dat = spi.xfer2(b"\x12")[0] + if dat == NACK: + raise PandaSpiNackResponse + elif dat == ack_val: + return + + raise PandaSpiMissingAck + + def _transfer(self, spi, endpoint: int, data, timeout: int, max_rx_len: int = 1000) -> bytes: logging.debug("starting transfer: endpoint=%d, max_rx_len=%d", endpoint, max_rx_len) logging.debug("==============================================") - for n in range(MAX_RETRY_COUNT): + exc = PandaSpiException() + for n in range(MAX_XFER_RETRY_COUNT): logging.debug("\ntry #%d", n+1) try: logging.debug("- send header") packet = struct.pack(" max_rx_len: + raise PandaSpiException("response length greater than max") logging.debug("- receiving response") - dat = bytes(self.spi.xfer2(b"\x00" * (response_len + 1))) + dat = bytes(spi.xfer2(b"\x00" * (response_len + 1))) if self._calc_checksum([DACK, *response_len_bytes, *dat]) != 0: - raise Exception("SPI got bad checksum") + raise PandaSpiBadChecksum return dat[:-1] - except Exception: - logging.exception("SPI transfer failed, %d retries left", n) - raise Exception(f"SPI transaction failed {MAX_RETRY_COUNT} times") + except PandaSpiException as e: + exc = e + logging.debug("SPI transfer failed, %d retries left", n, exc_info=True) + raise exc # libusb1 functions def close(self): - self.spi.close() + self.dev.close() - def controlWrite(self, request_type: int, request: int, value: int, index: int, data, timeout: int = 0): - return self._transfer(0, struct.pack(" int: - for x in range(math.ceil(len(data) / USB_MAX_SIZE)): - self._transfer(endpoint, data[USB_MAX_SIZE*x:USB_MAX_SIZE*(x+1)]) - return len(data) + def bulkWrite(self, endpoint: int, data: List[int], timeout: int = TIMEOUT) -> int: + with self.dev.acquire() as spi: + for x in range(math.ceil(len(data) / USB_MAX_SIZE)): + self._transfer(spi, endpoint, data[USB_MAX_SIZE*x:USB_MAX_SIZE*(x+1)], timeout) + return len(data) - def bulkRead(self, endpoint: int, length: int, timeout: int = 0) -> bytes: + def bulkRead(self, endpoint: int, length: int, timeout: int = TIMEOUT) -> bytes: ret: List[int] = [] - for _ in range(math.ceil(length / USB_MAX_SIZE)): - d = self._transfer(endpoint, [], max_rx_len=USB_MAX_SIZE) - ret += d - if len(d) < USB_MAX_SIZE: - break + with self.dev.acquire() as spi: + for _ in range(math.ceil(length / USB_MAX_SIZE)): + d = self._transfer(spi, endpoint, [], timeout, max_rx_len=USB_MAX_SIZE) + ret += d + if len(d) < USB_MAX_SIZE: + break return bytes(ret) + + +class STBootloaderSPIHandle(BaseSTBootloaderHandle): + """ + Implementation of the STM32 SPI bootloader protocol described in: + https://www.st.com/resource/en/application_note/an4286-spi-protocol-used-in-the-stm32-bootloader-stmicroelectronics.pdf + """ + + SYNC = 0x5A + ACK = 0x79 + NACK = 0x1F + + def __init__(self): + self.dev = SpiDevice(speed=1000000) + + # say hello + try: + with self.dev.acquire() as spi: + spi.xfer([self.SYNC, ]) + try: + self._get_ack(spi) + except PandaSpiNackResponse: + # NACK ok here, will only ACK the first time + pass + + self._mcu_type = MCU_TYPE_BY_IDCODE[self.get_chip_id()] + except PandaSpiException: + raise PandaSpiException("failed to connect to panda") # pylint: disable=W0707 + + def _get_ack(self, spi, timeout=1.0): + data = 0x00 + start_time = time.monotonic() + while data not in (self.ACK, self.NACK) and (time.monotonic() - start_time < timeout): + data = spi.xfer([0x00, ])[0] + time.sleep(0.001) + spi.xfer([self.ACK, ]) + + if data == self.NACK: + raise PandaSpiNackResponse + elif data != self.ACK: + raise PandaSpiMissingAck + + def _cmd(self, cmd: int, data: Optional[List[bytes]] = None, read_bytes: int = 0, predata=None) -> bytes: + ret = b"" + with self.dev.acquire() as spi: + # sync + command + spi.xfer([self.SYNC, ]) + spi.xfer([cmd, cmd ^ 0xFF]) + self._get_ack(spi) + + # "predata" - for commands that send the first data without a checksum + if predata is not None: + spi.xfer(predata) + self._get_ack(spi) + + # send data + if data is not None: + for d in data: + if predata is not None: + spi.xfer(d + self._checksum(predata + d)) + else: + spi.xfer(d + self._checksum(d)) + self._get_ack(spi, timeout=20) + + # receive + if read_bytes > 0: + ret = spi.xfer([0x00, ]*(read_bytes + 1))[1:] + if data is None or len(data) == 0: + self._get_ack(spi) + + return bytes(ret) + + def _checksum(self, data: bytes) -> bytes: + if len(data) == 1: + ret = data[0] ^ 0xFF + else: + ret = reduce(lambda a, b: a ^ b, data) + return bytes([ret, ]) + + # *** Bootloader commands *** + + def read(self, address: int, length: int): + data = [struct.pack('>I', address), struct.pack('B', length - 1)] + return self._cmd(0x11, data=data, read_bytes=length) + + def get_chip_id(self) -> int: + r = self._cmd(0x02, read_bytes=3) + assert r[0] == 1 # response length - 1 + return ((r[1] << 8) + r[2]) + + def go_cmd(self, address: int) -> None: + self._cmd(0x21, data=[struct.pack('>I', address), ]) + + # *** helpers *** + + def get_uid(self): + dat = self.read(McuType.H7.config.uid_address, 12) + return binascii.hexlify(dat).decode() + + def erase_sector(self, sector: int): + p = struct.pack('>H', 0) # number of sectors to erase + d = struct.pack('>H', sector) + self._cmd(0x44, data=[d, ], predata=p) + + # *** PandaDFU API *** + + def erase_app(self): + self.erase_sector(1) + + def erase_bootstub(self): + self.erase_sector(0) + + def get_mcu_type(self): + return self._mcu_type + + def clear_status(self): + pass + + def close(self): + self.dev.close() + + def program(self, address, dat): + bs = 256 # max block size for writing to flash over SPI + dat += b"\xFF" * ((bs - len(dat)) % bs) + for i in range(0, len(dat) // bs): + block = dat[i * bs:(i + 1) * bs] + self._cmd(0x31, data=[ + struct.pack('>I', address + i*bs), + bytes([len(block) - 1]) + block, + ]) + + def jump(self, address): + self.go_cmd(self._mcu_type.config.bootstub_address) diff --git a/panda/python/usb.py b/panda/python/usb.py new file mode 100644 index 000000000..2e236a999 --- /dev/null +++ b/panda/python/usb.py @@ -0,0 +1,95 @@ +import struct +from typing import List + +from .base import BaseHandle, BaseSTBootloaderHandle, TIMEOUT +from .constants import McuType + +class PandaUsbHandle(BaseHandle): + def __init__(self, libusb_handle): + self._libusb_handle = libusb_handle + + def close(self): + self._libusb_handle.close() + + def controlWrite(self, request_type: int, request: int, value: int, index: int, data, timeout: int = TIMEOUT): + return self._libusb_handle.controlWrite(request_type, request, value, index, data, timeout) + + def controlRead(self, request_type: int, request: int, value: int, index: int, length: int, timeout: int = TIMEOUT): + return self._libusb_handle.controlRead(request_type, request, value, index, length, timeout) + + def bulkWrite(self, endpoint: int, data: List[int], timeout: int = TIMEOUT) -> int: + return self._libusb_handle.bulkWrite(endpoint, data, timeout) # type: ignore + + def bulkRead(self, endpoint: int, length: int, timeout: int = TIMEOUT) -> bytes: + return self._libusb_handle.bulkRead(endpoint, length, timeout) # type: ignore + + + +class STBootloaderUSBHandle(BaseSTBootloaderHandle): + DFU_DNLOAD = 1 + DFU_UPLOAD = 2 + DFU_GETSTATUS = 3 + DFU_CLRSTATUS = 4 + DFU_ABORT = 6 + + def __init__(self, libusb_device, libusb_handle): + self._libusb_handle = libusb_handle + + # TODO: Find a way to detect F4 vs F2 + # TODO: also check F4 BCD, don't assume in else + self._mcu_type = McuType.H7 if libusb_device.getbcdDevice() == 512 else McuType.F4 + + def _status(self) -> None: + while 1: + dat = self._libusb_handle.controlRead(0x21, self.DFU_GETSTATUS, 0, 0, 6) + if dat[1] == 0: + break + + def _erase_page_address(self, address: int) -> None: + self._libusb_handle.controlWrite(0x21, self.DFU_DNLOAD, 0, 0, b"\x41" + struct.pack("I", address)) + self._status() + + def get_mcu_type(self): + return self._mcu_type + + def erase_app(self): + self._erase_page_address(self._mcu_type.config.app_address) + + def erase_bootstub(self): + self._erase_page_address(self._mcu_type.config.bootstub_address) + + def clear_status(self): + # Clear status + stat = self._libusb_handle.controlRead(0x21, self.DFU_GETSTATUS, 0, 0, 6) + if stat[4] == 0xa: + self._libusb_handle.controlRead(0x21, self.DFU_CLRSTATUS, 0, 0, 0) + elif stat[4] == 0x9: + self._libusb_handle.controlWrite(0x21, self.DFU_ABORT, 0, 0, b"") + self._status() + stat = str(self._libusb_handle.controlRead(0x21, self.DFU_GETSTATUS, 0, 0, 6)) + + def close(self): + self._libusb_handle.close() + + def program(self, address, dat): + # Set Address Pointer + self._libusb_handle.controlWrite(0x21, self.DFU_DNLOAD, 0, 0, b"\x21" + struct.pack("I", address)) + self._status() + + # Program + bs = self._mcu_type.config.block_size + dat += b"\xFF" * ((bs - len(dat)) % bs) + for i in range(0, len(dat) // bs): + ldat = dat[i * bs:(i + 1) * bs] + print("programming %d with length %d" % (i, len(ldat))) + self._libusb_handle.controlWrite(0x21, self.DFU_DNLOAD, 2 + i, 0, ldat) + self._status() + + def jump(self, address): + self._libusb_handle.controlWrite(0x21, self.DFU_DNLOAD, 0, 0, b"\x21" + struct.pack("I", address)) + self._status() + try: + self._libusb_handle.controlWrite(0x21, self.DFU_DNLOAD, 2, 0, b"") + _ = str(self._libusb_handle.controlRead(0x21, self.DFU_GETSTATUS, 0, 0, 6)) + except Exception: + pass diff --git a/rednose/helpers/ekf_sym_pyx.so b/rednose/helpers/ekf_sym_pyx.so index c40372e0d..9bc0cbfb9 100755 Binary files a/rednose/helpers/ekf_sym_pyx.so and b/rednose/helpers/ekf_sym_pyx.so differ diff --git a/selfdrive/assets/assets.qrc b/selfdrive/assets/assets.qrc index 39be41aa6..79a1a1e27 100644 --- a/selfdrive/assets/assets.qrc +++ b/selfdrive/assets/assets.qrc @@ -1,5 +1,6 @@ + ../../third_party/bootstrap/bootstrap-icons.svg img_continue_triangle.svg img_circled_check.svg img_circled_slash.svg diff --git a/selfdrive/assets/img_driver_face_static.png b/selfdrive/assets/img_driver_face_static.png new file mode 100644 index 000000000..d8bc5f137 Binary files /dev/null and b/selfdrive/assets/img_driver_face_static.png differ diff --git a/selfdrive/assets/locales/ja-JP/LC_MESSAGES/events.mo b/selfdrive/assets/locales/ja-JP/LC_MESSAGES/events.mo index 9739fc1bc..117720252 100644 Binary files a/selfdrive/assets/locales/ja-JP/LC_MESSAGES/events.mo and b/selfdrive/assets/locales/ja-JP/LC_MESSAGES/events.mo differ diff --git a/selfdrive/assets/locales/ko-KR/LC_MESSAGES/events.mo b/selfdrive/assets/locales/ko-KR/LC_MESSAGES/events.mo index 5c3c68201..4ade26d3f 100644 Binary files a/selfdrive/assets/locales/ko-KR/LC_MESSAGES/events.mo and b/selfdrive/assets/locales/ko-KR/LC_MESSAGES/events.mo differ diff --git a/selfdrive/assets/locales/zh-CN/LC_MESSAGES/events.mo b/selfdrive/assets/locales/zh-CN/LC_MESSAGES/events.mo index de1324a88..27f3cf194 100644 Binary files a/selfdrive/assets/locales/zh-CN/LC_MESSAGES/events.mo and b/selfdrive/assets/locales/zh-CN/LC_MESSAGES/events.mo differ diff --git a/selfdrive/assets/locales/zh-TW/LC_MESSAGES/events.mo b/selfdrive/assets/locales/zh-TW/LC_MESSAGES/events.mo index 30d5e33b8..8233932c2 100644 Binary files a/selfdrive/assets/locales/zh-TW/LC_MESSAGES/events.mo and b/selfdrive/assets/locales/zh-TW/LC_MESSAGES/events.mo differ diff --git a/selfdrive/athena/athenad.py b/selfdrive/athena/athenad.py index b3a5443f8..2874206ac 100755 --- a/selfdrive/athena/athenad.py +++ b/selfdrive/athena/athenad.py @@ -36,7 +36,7 @@ from common.file_helpers import CallbackReader from common.params import Params from common.realtime import sec_since_boot, set_core_affinity from system.hardware import HARDWARE, PC, AGNOS -from selfdrive.loggerd.config import ROOT +from system.loggerd.config import ROOT from selfdrive.loggerd.xattr_cache import getxattr, setxattr from selfdrive.statsd import STATS_DIR from system.swaglog import SWAGLOG_DIR, cloudlog @@ -577,8 +577,7 @@ def get_logs_to_send_sorted() -> List[str]: def log_handler(end_event: threading.Event) -> None: - # dont upload any logs for now - if True: + if PC: return log_files = [] diff --git a/selfdrive/boardd/boardd b/selfdrive/boardd/boardd index 423a1e02d..8f11aad28 100755 Binary files a/selfdrive/boardd/boardd and b/selfdrive/boardd/boardd differ diff --git a/selfdrive/boardd/boardd_api_impl.cpp b/selfdrive/boardd/boardd_api_impl.cpp index a17d8b490..814e8a01d 100644 --- a/selfdrive/boardd/boardd_api_impl.cpp +++ b/selfdrive/boardd/boardd_api_impl.cpp @@ -1,4 +1,4 @@ -/* Generated by Cython 0.29.24 */ +/* Generated by Cython 0.29.26 */ /* BEGIN: Cython Metadata { @@ -23,8 +23,8 @@ END: Cython Metadata */ #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) #error Cython requires Python 2.6+ or Python 3.3+. #else -#define CYTHON_ABI "0_29_24" -#define CYTHON_HEX_VERSION 0x001D18F0 +#define CYTHON_ABI "0_29_26" +#define CYTHON_HEX_VERSION 0x001D1AF0 #define CYTHON_FUTURE_DIVISION 1 #include #ifndef offsetof @@ -171,7 +171,7 @@ END: Cython Metadata */ #ifndef CYTHON_USE_UNICODE_INTERNALS #define CYTHON_USE_UNICODE_INTERNALS 1 #endif - #if PY_VERSION_HEX < 0x030300F0 + #if PY_VERSION_HEX < 0x030300F0 || PY_VERSION_HEX >= 0x030B00A2 #undef CYTHON_USE_UNICODE_WRITER #define CYTHON_USE_UNICODE_WRITER 0 #elif !defined(CYTHON_USE_UNICODE_WRITER) @@ -190,7 +190,7 @@ END: Cython Metadata */ #define CYTHON_FAST_THREAD_STATE 1 #endif #ifndef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 1 + #define CYTHON_FAST_PYCALL (PY_VERSION_HEX < 0x030B00A1) #endif #ifndef CYTHON_PEP489_MULTI_PHASE_INIT #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000) @@ -209,7 +209,9 @@ END: Cython Metadata */ #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) #endif #if CYTHON_USE_PYLONG_INTERNALS - #include "longintrepr.h" + #if PY_MAJOR_VERSION < 3 + #include "longintrepr.h" + #endif #undef SHIFT #undef BASE #undef MASK @@ -340,9 +342,68 @@ class __Pyx_FakeReference { #define __Pyx_DefaultClassType PyClass_Type #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" -#if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2 - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) + #define __Pyx_DefaultClassType PyType_Type +#if PY_VERSION_HEX >= 0x030B00A1 + static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int k, int l, int s, int f, + PyObject *code, PyObject *c, PyObject* n, PyObject *v, + PyObject *fv, PyObject *cell, PyObject* fn, + PyObject *name, int fline, PyObject *lnos) { + PyObject *kwds=NULL, *argcount=NULL, *posonlyargcount=NULL, *kwonlyargcount=NULL; + PyObject *nlocals=NULL, *stacksize=NULL, *flags=NULL, *replace=NULL, *call_result=NULL, *empty=NULL; + const char *fn_cstr=NULL; + const char *name_cstr=NULL; + PyCodeObject* co=NULL; + PyObject *type, *value, *traceback; + PyErr_Fetch(&type, &value, &traceback); + if (!(kwds=PyDict_New())) goto end; + if (!(argcount=PyLong_FromLong(a))) goto end; + if (PyDict_SetItemString(kwds, "co_argcount", argcount) != 0) goto end; + if (!(posonlyargcount=PyLong_FromLong(0))) goto end; + if (PyDict_SetItemString(kwds, "co_posonlyargcount", posonlyargcount) != 0) goto end; + if (!(kwonlyargcount=PyLong_FromLong(k))) goto end; + if (PyDict_SetItemString(kwds, "co_kwonlyargcount", kwonlyargcount) != 0) goto end; + if (!(nlocals=PyLong_FromLong(l))) goto end; + if (PyDict_SetItemString(kwds, "co_nlocals", nlocals) != 0) goto end; + if (!(stacksize=PyLong_FromLong(s))) goto end; + if (PyDict_SetItemString(kwds, "co_stacksize", stacksize) != 0) goto end; + if (!(flags=PyLong_FromLong(f))) goto end; + if (PyDict_SetItemString(kwds, "co_flags", flags) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_code", code) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_consts", c) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_names", n) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_varnames", v) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_freevars", fv) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_cellvars", cell) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_linetable", lnos) != 0) goto end; + if (!(fn_cstr=PyUnicode_AsUTF8AndSize(fn, NULL))) goto end; + if (!(name_cstr=PyUnicode_AsUTF8AndSize(name, NULL))) goto end; + if (!(co = PyCode_NewEmpty(fn_cstr, name_cstr, fline))) goto end; + if (!(replace = PyObject_GetAttrString((PyObject*)co, "replace"))) goto cleanup_code_too; + if (!(empty = PyTuple_New(0))) goto cleanup_code_too; // unfortunately __pyx_empty_tuple isn't available here + if (!(call_result = PyObject_Call(replace, empty, kwds))) goto cleanup_code_too; + Py_XDECREF((PyObject*)co); + co = (PyCodeObject*)call_result; + call_result = NULL; + if (0) { + cleanup_code_too: + Py_XDECREF((PyObject*)co); + co = NULL; + } + end: + Py_XDECREF(kwds); + Py_XDECREF(argcount); + Py_XDECREF(posonlyargcount); + Py_XDECREF(kwonlyargcount); + Py_XDECREF(nlocals); + Py_XDECREF(stacksize); + Py_XDECREF(replace); + Py_XDECREF(call_result); + Py_XDECREF(empty); + if (type) { + PyErr_Restore(type, value, traceback); + } + return co; + } #else #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) @@ -580,10 +641,10 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #if PY_VERSION_HEX < 0x030200A4 typedef long Py_hash_t; #define __Pyx_PyInt_FromHash_t PyInt_FromLong - #define __Pyx_PyInt_AsHash_t PyInt_AsLong + #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsHash_t #else #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t - #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t + #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t #endif #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func)) @@ -746,6 +807,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj)) static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*); #if CYTHON_ASSUME_SAFE_MACROS #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) #else @@ -2568,7 +2630,7 @@ static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int } if (!use_cline) { c_line = 0; - PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); + (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); } else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) { c_line = 0; @@ -2665,30 +2727,31 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( const char *funcname, int c_line, int py_line, const char *filename) { - PyCodeObject *py_code = 0; - PyObject *py_srcfile = 0; - PyObject *py_funcname = 0; + PyCodeObject *py_code = NULL; + PyObject *py_funcname = NULL; #if PY_MAJOR_VERSION < 3 + PyObject *py_srcfile = NULL; py_srcfile = PyString_FromString(filename); - #else - py_srcfile = PyUnicode_FromString(filename); - #endif if (!py_srcfile) goto bad; + #endif if (c_line) { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + if (!py_funcname) goto bad; #else py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + if (!py_funcname) goto bad; + funcname = PyUnicode_AsUTF8(py_funcname); + if (!funcname) goto bad; #endif } else { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromString(funcname); - #else - py_funcname = PyUnicode_FromString(funcname); + if (!py_funcname) goto bad; #endif } - if (!py_funcname) goto bad; + #if PY_MAJOR_VERSION < 3 py_code = __Pyx_PyCode_New( 0, 0, @@ -2707,11 +2770,16 @@ static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( __pyx_empty_bytes /*PyObject *lnotab*/ ); Py_DECREF(py_srcfile); - Py_DECREF(py_funcname); + #else + py_code = PyCode_NewEmpty(filename, funcname, py_line); + #endif + Py_XDECREF(py_funcname); // XDECREF since it's only set on Py3 if cline return py_code; bad: - Py_XDECREF(py_srcfile); Py_XDECREF(py_funcname); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(py_srcfile); + #endif return NULL; } static void __Pyx_AddTraceback(const char *funcname, int c_line, @@ -3559,6 +3627,23 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_DECREF(x); return ival; } +static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) { + if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) { + return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o); +#if PY_MAJOR_VERSION < 3 + } else if (likely(PyInt_CheckExact(o))) { + return PyInt_AS_LONG(o); +#endif + } else { + Py_ssize_t ival; + PyObject *x; + x = PyNumber_Index(o); + if (!x) return -1; + ival = PyInt_AsLong(x); + Py_DECREF(x); + return ival; + } +} static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) { return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False); } diff --git a/selfdrive/boardd/boardd_api_impl.so b/selfdrive/boardd/boardd_api_impl.so index f0be8f150..7f755d120 100755 Binary files a/selfdrive/boardd/boardd_api_impl.so and b/selfdrive/boardd/boardd_api_impl.so differ diff --git a/selfdrive/boardd/panda.h b/selfdrive/boardd/panda.h index 0f3d3b1e2..2797d41bd 100644 --- a/selfdrive/boardd/panda.h +++ b/selfdrive/boardd/panda.h @@ -30,6 +30,7 @@ struct __attribute__((packed)) can_header { uint8_t returned : 1; uint8_t extended : 1; uint32_t addr : 29; + uint8_t checksum : 8; }; struct can_frame { @@ -47,13 +48,13 @@ private: public: Panda(std::string serial="", uint32_t bus_offset=0); - std::string hw_serial; cereal::PandaState::PandaType hw_type = cereal::PandaState::PandaType::UNKNOWN; bool has_rtc = false; const uint32_t bus_offset; bool connected(); bool comms_healthy(); + std::string hw_serial(); // Static functions static std::vector list(); @@ -81,6 +82,7 @@ public: void set_canfd_non_iso(uint16_t bus, bool non_iso); void can_send(capnp::List::Reader can_data_list); bool can_receive(std::vector& out_vec); + void can_reset_communications(); // dp void set_pigeon_baud(int baud); bool has_gps = true; @@ -91,8 +93,12 @@ public: protected: // for unit tests + uint8_t receive_buffer[RECV_SIZE + sizeof(can_header) + 64]; + uint32_t receive_buffer_size = 0; + Panda(uint32_t bus_offset) : bus_offset(bus_offset) {} void pack_can_buffer(const capnp::List::Reader &can_data_list, std::function write_func); - bool unpack_can_buffer(uint8_t *data, int size, std::vector &out_vec); + bool unpack_can_buffer(uint8_t *data, uint32_t &size, std::vector &out_vec); + uint8_t calculate_checksum(uint8_t *data, uint32_t len); }; diff --git a/selfdrive/boardd/panda_comms.h b/selfdrive/boardd/panda_comms.h index bd262dfa0..506b96b37 100644 --- a/selfdrive/boardd/panda_comms.h +++ b/selfdrive/boardd/panda_comms.h @@ -5,7 +5,9 @@ #include #include +#ifndef __APPLE__ #include +#endif #include @@ -21,6 +23,7 @@ public: virtual ~PandaCommsHandle() {}; virtual void cleanup() = 0; + std::string hw_serial; std::atomic connected = true; std::atomic comms_healthy = true; static std::vector list(); @@ -30,9 +33,6 @@ public: virtual int control_read(uint8_t request, uint16_t param1, uint16_t param2, unsigned char *data, uint16_t length, unsigned int timeout=TIMEOUT) = 0; virtual int bulk_write(unsigned char endpoint, unsigned char* data, int length, unsigned int timeout=TIMEOUT) = 0; virtual int bulk_read(unsigned char endpoint, unsigned char* data, int length, unsigned int timeout=TIMEOUT) = 0; - -protected: - std::recursive_mutex hw_lock; }; class PandaUsbHandle : public PandaCommsHandle { @@ -50,9 +50,11 @@ public: private: libusb_context *ctx = NULL; libusb_device_handle *dev_handle = NULL; + std::recursive_mutex hw_lock; void handle_usb_issue(int err, const char func[]); }; +#ifndef __APPLE__ class PandaSpiHandle : public PandaCommsHandle { public: PandaSpiHandle(std::string serial); @@ -69,9 +71,11 @@ private: int spi_fd = -1; uint8_t tx_buf[SPI_BUF_SIZE]; uint8_t rx_buf[SPI_BUF_SIZE]; + inline static std::recursive_mutex hw_lock; int wait_for_ack(spi_ioc_transfer &transfer, uint8_t ack); int bulk_transfer(uint8_t endpoint, uint8_t *tx_data, uint16_t tx_len, uint8_t *rx_data, uint16_t rx_len); int spi_transfer(uint8_t endpoint, uint8_t *tx_data, uint16_t tx_len, uint8_t *rx_data, uint16_t max_rx_len); int spi_transfer_retry(uint8_t endpoint, uint8_t *tx_data, uint16_t tx_len, uint8_t *rx_data, uint16_t max_rx_len); }; +#endif diff --git a/selfdrive/boardd/pandad.py b/selfdrive/boardd/pandad.py index 971756002..f292b921c 100755 --- a/selfdrive/boardd/pandad.py +++ b/selfdrive/boardd/pandad.py @@ -7,7 +7,7 @@ import subprocess from typing import List, NoReturn from functools import cmp_to_key -from panda import DEFAULT_FW_FN, DEFAULT_H7_FW_FN, MCU_TYPE_H7, Panda, PandaDFU +from panda import Panda, PandaDFU from common.basedir import BASEDIR from common.params import Params from system.hardware import HARDWARE @@ -15,10 +15,8 @@ from system.swaglog import cloudlog def get_expected_signature(panda: Panda) -> bytes: - fn = DEFAULT_H7_FW_FN if (panda.get_mcu_type() == MCU_TYPE_H7) else DEFAULT_FW_FN - try: - return Panda.get_signature_from_firmware(fn) + return Panda.get_signature_from_firmware(panda.get_mcu_type().config.app_path) except Exception: cloudlog.exception("Error computing expected signature") return b"" @@ -86,9 +84,9 @@ def main() -> NoReturn: params.remove("PandaSignatures") # Flash all Pandas in DFU mode - for p in PandaDFU.list(): - cloudlog.info(f"Panda in DFU mode found, flashing recovery {p}") - PandaDFU(p).recover() + for serial in PandaDFU.list(): + cloudlog.info(f"Panda in DFU mode found, flashing recovery {serial}") + PandaDFU(serial).recover() time.sleep(1) panda_serials = Panda.list() diff --git a/selfdrive/car/__init__.py b/selfdrive/car/__init__.py index c056f7ca3..58cde8581 100644 --- a/selfdrive/car/__init__.py +++ b/selfdrive/car/__init__.py @@ -73,7 +73,7 @@ def dbc_dict(pt_dbc, radar_dbc, chassis_dbc=None, body_dbc=None) -> Dict[str, st return {'pt': pt_dbc, 'radar': radar_dbc, 'chassis': chassis_dbc, 'body': body_dbc} -def apply_std_steer_torque_limits(apply_torque, apply_torque_last, driver_torque, LIMITS): +def apply_driver_steer_torque_limits(apply_torque, apply_torque_last, driver_torque, LIMITS): # limits due to driver torque driver_max_torque = LIMITS.STEER_MAX + (LIMITS.STEER_DRIVER_ALLOWANCE + driver_torque * LIMITS.STEER_DRIVER_FACTOR) * LIMITS.STEER_DRIVER_MULTIPLIER @@ -93,29 +93,37 @@ def apply_std_steer_torque_limits(apply_torque, apply_torque_last, driver_torque return int(round(float(apply_torque))) -def apply_toyota_steer_torque_limits(apply_torque, apply_torque_last, motor_torque, LIMITS): - # limits due to comparison of commanded torque VS motor reported torque - max_lim = min(max(motor_torque + LIMITS.STEER_ERROR_MAX, LIMITS.STEER_ERROR_MAX), LIMITS.STEER_MAX) - min_lim = max(min(motor_torque - LIMITS.STEER_ERROR_MAX, -LIMITS.STEER_ERROR_MAX), -LIMITS.STEER_MAX) +def apply_dist_to_meas_limits(val, val_last, val_meas, + STEER_DELTA_UP, STEER_DELTA_DOWN, + STEER_ERROR_MAX, STEER_MAX): + # limits due to comparison of commanded val VS measured val (torque/angle/curvature) + max_lim = min(max(val_meas + STEER_ERROR_MAX, STEER_ERROR_MAX), STEER_MAX) + min_lim = max(min(val_meas - STEER_ERROR_MAX, -STEER_ERROR_MAX), -STEER_MAX) - apply_torque = clip(apply_torque, min_lim, max_lim) + val = clip(val, min_lim, max_lim) - # slow rate if steer torque increases in magnitude - if apply_torque_last > 0: - apply_torque = clip(apply_torque, - max(apply_torque_last - LIMITS.STEER_DELTA_DOWN, -LIMITS.STEER_DELTA_UP), - apply_torque_last + LIMITS.STEER_DELTA_UP) + # slow rate if val increases in magnitude + if val_last > 0: + val = clip(val, + max(val_last - STEER_DELTA_DOWN, -STEER_DELTA_UP), + val_last + STEER_DELTA_UP) else: - apply_torque = clip(apply_torque, - apply_torque_last - LIMITS.STEER_DELTA_UP, - min(apply_torque_last + LIMITS.STEER_DELTA_DOWN, LIMITS.STEER_DELTA_UP)) + val = clip(val, + val_last - STEER_DELTA_UP, + min(val_last + STEER_DELTA_DOWN, STEER_DELTA_UP)) - return int(round(float(apply_torque))) + return float(val) + + +def apply_meas_steer_torque_limits(apply_torque, apply_torque_last, motor_torque, LIMITS): + return int(round(apply_dist_to_meas_limits(apply_torque, apply_torque_last, motor_torque, + LIMITS.STEER_DELTA_UP, LIMITS.STEER_DELTA_DOWN, + LIMITS.STEER_ERROR_MAX, LIMITS.STEER_MAX))) def apply_std_steer_angle_limits(apply_angle, apply_angle_last, v_ego, LIMITS): # pick angle rate limits based on wind up/down - steer_up = apply_angle_last * apply_angle > 0. and abs(apply_angle) > abs(apply_angle_last) + steer_up = apply_angle_last * apply_angle >= 0. and abs(apply_angle) > abs(apply_angle_last) rate_limits = LIMITS.ANGLE_RATE_LIMIT_UP if steer_up else LIMITS.ANGLE_RATE_LIMIT_DOWN angle_rate_lim = interp(v_ego, rate_limits.speed_bp, rate_limits.angle_v) diff --git a/selfdrive/car/body/carcontroller.py b/selfdrive/car/body/carcontroller.py index 00673a7e2..bcaf6f6f9 100644 --- a/selfdrive/car/body/carcontroller.py +++ b/selfdrive/car/body/carcontroller.py @@ -35,7 +35,7 @@ class CarController: torque -= deadband return torque - def update(self, CC, CS): + def update(self, CC, CS, now_nanos): torque_l = 0 torque_r = 0 diff --git a/selfdrive/car/body/interface.py b/selfdrive/car/body/interface.py index bc5b36e2e..850a3538a 100644 --- a/selfdrive/car/body/interface.py +++ b/selfdrive/car/body/interface.py @@ -24,7 +24,7 @@ class CarInterface(CarInterfaceBase): ret.wheelSpeedFactor = SPEED_FROM_RPM ret.centerToFront = ret.wheelbase * 0.44 - ret.radarOffCan = True + ret.radarUnavailable = True ret.openpilotLongitudinalControl = True ret.steerControlType = car.CarParams.SteerControlType.angle @@ -43,5 +43,5 @@ class CarInterface(CarInterfaceBase): return ret - def apply(self, c): - return self.CC.update(c, self.CS) + def apply(self, c, now_nanos): + return self.CC.update(c, self.CS, now_nanos) diff --git a/selfdrive/car/body/values.py b/selfdrive/car/body/values.py index 548039bc7..4fef96637 100644 --- a/selfdrive/car/body/values.py +++ b/selfdrive/car/body/values.py @@ -17,6 +17,9 @@ class CarControllerParams: LKAS_MAX_TORQUE = 1 # A value of 1 is easy to overpower STEER_THRESHOLD = 1.0 + def __init__(self, CP): + pass + class CAR: BODY = "COMMA BODY" diff --git a/selfdrive/car/car_helpers.py b/selfdrive/car/car_helpers.py index a0e152162..8dd9adea4 100644 --- a/selfdrive/car/car_helpers.py +++ b/selfdrive/car/car_helpers.py @@ -8,7 +8,7 @@ from common.basedir import BASEDIR from selfdrive.car.interfaces import get_interface_attr from selfdrive.car.fingerprints import eliminate_incompatible_cars, all_legacy_fingerprint_cars from selfdrive.car.vin import get_vin, is_valid_vin, VIN_UNKNOWN -from selfdrive.car.fw_versions import get_fw_versions_ordered, match_fw_to_car, get_present_ecus +from selfdrive.car.fw_versions import disable_obd_multiplexing, get_fw_versions_ordered, match_fw_to_car, get_present_ecus from system.swaglog import cloudlog import cereal.messaging as messaging from selfdrive.car import gen_empty_fingerprint @@ -109,7 +109,7 @@ def fingerprint(logcan, sendcan, num_pandas): else: cloudlog.warning("Getting VIN & FW versions") vin_rx_addr, vin = get_vin(logcan, sendcan, bus) - ecu_rx_addrs = get_present_ecus(logcan, sendcan) + ecu_rx_addrs = get_present_ecus(logcan, sendcan, num_pandas=num_pandas) car_fw = get_fw_versions_ordered(logcan, sendcan, ecu_rx_addrs, num_pandas=num_pandas) cached = False @@ -123,7 +123,10 @@ def fingerprint(logcan, sendcan, num_pandas): cloudlog.event("Malformed VIN", vin=vin, error=True) vin = VIN_UNKNOWN cloudlog.warning("VIN %s", vin) - Params().put("CarVin", vin) + + params = Params() + params.put("CarVin", vin) + disable_obd_multiplexing(params) finger = gen_empty_fingerprint() candidate_cars = {i: all_legacy_fingerprint_cars() for i in [0, 1]} # attempt fingerprint on both bus 0 and 1 @@ -218,7 +221,7 @@ def crash_log2(fingerprints, fw): time.sleep(600) -def get_car(logcan, sendcan, num_pandas=1): +def get_car(logcan, sendcan, experimental_long_allowed, num_pandas=1): candidate, fingerprints, vin, car_fw, source, exact_match = fingerprint(logcan, sendcan, num_pandas) if candidate is None: @@ -231,11 +234,9 @@ def get_car(logcan, sendcan, num_pandas=1): x = threading.Thread(target=crash_log, args=(candidate,)) x.start() - experimental_long = Params().get_bool("ExperimentalLongitudinalEnabled") - try: CarInterface, CarController, CarState = interfaces[candidate] - CP = CarInterface.get_params(candidate, fingerprints, car_fw, experimental_long) + CP = CarInterface.get_params(candidate, fingerprints, car_fw, experimental_long_allowed) CP.carVin = vin CP.carFw = car_fw CP.fingerprintSource = source diff --git a/selfdrive/car/chrysler/carcontroller.py b/selfdrive/car/chrysler/carcontroller.py index 31cd01b65..b418179e0 100644 --- a/selfdrive/car/chrysler/carcontroller.py +++ b/selfdrive/car/chrysler/carcontroller.py @@ -1,6 +1,6 @@ from opendbc.can.packer import CANPacker from common.realtime import DT_CTRL -from selfdrive.car import apply_toyota_steer_torque_limits +from selfdrive.car import apply_meas_steer_torque_limits from selfdrive.car.chrysler.chryslercan import create_lkas_hud, create_lkas_command, create_cruise_buttons from selfdrive.car.chrysler.values import RAM_CARS, CarControllerParams, ChryslerFlags @@ -19,7 +19,7 @@ class CarController: self.packer = CANPacker(dbc_name) self.params = CarControllerParams(CP) - def update(self, CC, CS): + def update(self, CC, CS, now_nanos): can_sends = [] lkas_active = CC.latActive and self.lkas_control_bit_prev @@ -45,7 +45,7 @@ class CarController: self.hud_count += 1 # steering - if self.frame % 2 == 0: + if self.frame % self.params.STEER_STEP == 0: # TODO: can we make this more sane? why is it different for all the cars? lkas_control_bit = self.lkas_control_bit_prev @@ -67,7 +67,7 @@ class CarController: # steer torque new_steer = int(round(CC.actuators.steer * self.params.STEER_MAX)) - apply_steer = apply_toyota_steer_torque_limits(new_steer, self.apply_steer_last, CS.out.steeringTorqueEps, self.params) + apply_steer = apply_meas_steer_torque_limits(new_steer, self.apply_steer_last, CS.out.steeringTorqueEps, self.params) if not lkas_active or not lkas_control_bit: apply_steer = 0 self.apply_steer_last = apply_steer diff --git a/selfdrive/car/chrysler/carstate.py b/selfdrive/car/chrysler/carstate.py index 0f0d30782..fdc5aa338 100644 --- a/selfdrive/car/chrysler/carstate.py +++ b/selfdrive/car/chrysler/carstate.py @@ -81,8 +81,9 @@ class CarState(CarStateBase): if self.CP.carFingerprint in RAM_CARS: self.auto_high_beam = cp_cam.vl["DAS_6"]['AUTO_HIGH_BEAM_ON'] # Auto High Beam isn't Located in this message on chrysler or jeep currently located in 729 message - ret.steerFaultTemporary = cp.vl["EPS_3"]["DASM_FAULT"] == 1 + ret.steerFaultTemporary = cp.vl["EPS_3"]["DASM_FAULT"] == 1 else: + ret.steerFaultTemporary = cp.vl["EPS_2"]["LKAS_TEMPORARY_FAULT"] == 1 ret.steerFaultPermanent = cp.vl["EPS_2"]["LKAS_STATE"] == 4 # blindspot sensors @@ -135,6 +136,7 @@ class CarState(CarStateBase): ("COUNTER", "EPS_2",), ("COLUMN_TORQUE", "EPS_2"), ("EPS_TORQUE_MOTOR", "EPS_2"), + ("LKAS_TEMPORARY_FAULT", "EPS_2"), ("LKAS_STATE", "EPS_2"), ("COUNTER", "CRUISE_BUTTONS"), ] diff --git a/selfdrive/car/chrysler/interface.py b/selfdrive/car/chrysler/interface.py index 6e32fb7c9..cd987d974 100755 --- a/selfdrive/car/chrysler/interface.py +++ b/selfdrive/car/chrysler/interface.py @@ -2,7 +2,7 @@ from cereal import car from panda import Panda from selfdrive.car import STD_CARGO_KG, get_safety_config -from selfdrive.car.chrysler.values import CAR, DBC, RAM_HD, RAM_DT, RAM_CARS, ChryslerFlags +from selfdrive.car.chrysler.values import CAR, RAM_HD, RAM_DT, RAM_CARS, ChryslerFlags from selfdrive.car.interfaces import CarInterfaceBase @@ -12,7 +12,8 @@ class CarInterface(CarInterfaceBase): ret.carName = "chrysler" ret.dashcamOnly = candidate in RAM_HD - ret.radarOffCan = DBC[candidate]['radar'] is None + # radar parsing needs some work, see https://github.com/commaai/openpilot/issues/26842 + ret.radarUnavailable = True # DBC[candidate]['radar'] is None ret.steerActuatorDelay = 0.1 ret.steerLimitTimer = 0.4 @@ -24,6 +25,7 @@ class CarInterface(CarInterfaceBase): ret.safetyConfigs[0].safetyParam |= Panda.FLAG_CHRYSLER_RAM_DT ret.minSteerSpeed = 3.8 # m/s + CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning) if candidate not in RAM_CARS: # Newer FW versions standard on the following platforms, or flashed by a dealer onto older platforms have a higher minimum steering speed. new_eps_platform = candidate in (CAR.PACIFICA_2019_HYBRID, CAR.PACIFICA_2020, CAR.JEEP_CHEROKEE_2019) @@ -36,6 +38,8 @@ class CarInterface(CarInterfaceBase): ret.mass = 2242. + STD_CARGO_KG ret.wheelbase = 3.089 ret.steerRatio = 16.2 # Pacifica Hybrid 2017 + + ret.lateralTuning.init('pid') ret.lateralTuning.pid.kpBP, ret.lateralTuning.pid.kiBP = [[9., 20.], [9., 20.]] ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.15, 0.30], [0.03, 0.05]] ret.lateralTuning.pid.kf = 0.00006 @@ -46,6 +50,8 @@ class CarInterface(CarInterfaceBase): ret.wheelbase = 2.71 ret.steerRatio = 16.7 ret.steerActuatorDelay = 0.2 + + ret.lateralTuning.init('pid') ret.lateralTuning.pid.kpBP, ret.lateralTuning.pid.kiBP = [[9., 20.], [9., 20.]] ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.15, 0.30], [0.03, 0.05]] ret.lateralTuning.pid.kf = 0.00006 @@ -56,11 +62,10 @@ class CarInterface(CarInterfaceBase): ret.wheelbase = 3.88 ret.steerRatio = 16.3 ret.mass = 2493. + STD_CARGO_KG - CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning) ret.minSteerSpeed = 14.5 - for fw in car_fw: - if fw.ecu == 'eps' and fw.fwVersion.startswith((b"68312176", b"68273275")): - ret.minSteerSpeed = 0. + # Older EPS FW allow steer to zero + if any(fw.ecu == 'eps' and fw.fwVersion[:4] <= b"6831" for fw in car_fw): + ret.minSteerSpeed = 0. elif candidate == CAR.RAM_HD: ret.steerActuatorDelay = 0.2 @@ -73,7 +78,8 @@ class CarInterface(CarInterfaceBase): else: raise ValueError(f"Unsupported car: {candidate}") - CarInterfaceBase.configure_dp_tune(candidate, ret.lateralTuning) + CarInterfaceBase.dp_lat_tune_collection(candidate, ret.latTuneCollection) + CarInterfaceBase.configure_dp_tune(ret.lateralTuning, ret.latTuneCollection) if ret.flags & ChryslerFlags.HIGHER_MIN_STEERING_SPEED: # TODO: allow these cars to steer down to 13 m/s if already engaged. @@ -102,5 +108,5 @@ class CarInterface(CarInterfaceBase): return ret - def apply(self, c): - return self.CC.update(c, self.CS) + def apply(self, c, now_nanos): + return self.CC.update(c, self.CS, now_nanos) diff --git a/selfdrive/car/chrysler/radar_interface.py b/selfdrive/car/chrysler/radar_interface.py index 348e3c363..0ab8c10b4 100755 --- a/selfdrive/car/chrysler/radar_interface.py +++ b/selfdrive/car/chrysler/radar_interface.py @@ -45,12 +45,13 @@ def _address_to_track(address): class RadarInterface(RadarInterfaceBase): def __init__(self, CP): super().__init__(CP) + self.CP = CP self.rcp = _create_radar_can_parser(CP.carFingerprint) self.updated_messages = set() self.trigger_msg = LAST_MSG def update(self, can_strings): - if self.rcp is None: + if self.rcp is None or self.CP.radarUnavailable: return super().update(None) vls = self.rcp.update_strings(can_strings) diff --git a/selfdrive/car/chrysler/values.py b/selfdrive/car/chrysler/values.py index 02261a0b6..2af5246b8 100644 --- a/selfdrive/car/chrysler/values.py +++ b/selfdrive/car/chrysler/values.py @@ -35,6 +35,7 @@ class CAR: class CarControllerParams: def __init__(self, CP): + self.STEER_STEP = 2 # 50 Hz self.STEER_ERROR_MAX = 80 if CP.carFingerprint in RAM_HD: self.STEER_DELTA_UP = 14 @@ -55,6 +56,7 @@ RAM_DT = {CAR.RAM_1500, } RAM_HD = {CAR.RAM_HD, } RAM_CARS = RAM_DT | RAM_HD + @dataclass class ChryslerCarInfo(CarInfo): package: str = "Adaptive Cruise Control (ACC)" @@ -91,7 +93,7 @@ CAR_INFO: Dict[str, Optional[Union[ChryslerCarInfo, List[ChryslerCarInfo]]]] = { FINGERPRINTS = { CAR.PACIFICA_2017_HYBRID: [{ - 168: 8, 257: 5, 258: 8, 264: 8, 268: 8, 270: 8, 274: 2, 280: 8, 284: 8, 288: 7, 290: 6, 291: 8, 292: 8, 294: 8, 300: 8, 308: 8, 320: 8, 324: 8, 331: 8, 332: 8, 344: 8, 368: 8, 376: 3, 384: 8, 388: 4, 448: 6, 456: 4, 464: 8, 469: 8, 480: 8, 500: 8, 501: 8, 512: 8, 514: 8, 515: 7, 516: 7, 517: 7, 518: 7, 520: 8, 528: 8, 532: 8, 542: 8, 544: 8, 557: 8, 559: 8, 560: 4, 564: 4, 571: 3, 584: 8, 608: 8, 624: 8, 625: 8, 632: 8, 639: 8, 653: 8, 654: 8, 655: 8, 658: 6, 660: 8, 669: 3, 671: 8, 672: 8, 678: 8, 680: 8, 701: 8, 704: 8, 705: 8, 706: 8, 709: 8, 710: 8, 719: 8, 720: 6, 729: 5, 736: 8, 737: 8, 746: 5, 760: 8, 764: 8, 766: 8, 770: 8, 773: 8, 779: 8, 782: 8, 784: 8, 788:3, 792: 8, 799: 8, 800: 8, 804: 8, 808: 8, 816: 8, 817: 8, 820: 8, 825: 2, 826: 8, 832: 8, 838: 2, 848: 8, 853: 8, 856: 4, 860: 6, 863: 8, 878: 8, 882: 8, 897: 8, 908: 8, 924: 3, 926: 3, 929: 8, 937: 8, 938: 8, 939: 8, 940: 8, 941: 8, 942: 8, 943: 8, 947: 8, 948: 8, 956: 8, 958: 8, 959: 8, 969: 4, 974: 5, 979: 8, 980: 8, 981: 8, 982: 8, 983: 8, 984: 8, 992: 8, 993: 7, 995: 8, 996: 8, 1000: 8, 1001: 8, 1002: 8, 1003: 8, 1008: 8, 1009: 8, 1010: 8, 1011: 8, 1012: 8, 1013: 8, 1014: 8, 1015: 8, 1024: 8, 1025: 8, 1026: 8, 1031: 8, 1033: 8, 1050: 8, 1059: 8, 1082: 8, 1083: 8, 1098: 8, 1100: 8, 1216: 8, 1218: 8, 1220: 8, 1225: 8, 1235: 8, 1242: 8, 1246: 8, 1250: 8, 1284: 8, 1537: 8, 1538: 8, 1562: 8, 1568: 8, 1856: 8, 1858: 8, 1860: 8, 1865: 8, 1875: 8, 1882: 8, 1886: 8, 1890: 8, 1892: 8, 2016: 8, 2024: 8 + 168: 8, 257: 5, 258: 8, 264: 8, 268: 8, 270: 8, 274: 2, 280: 8, 284: 8, 288: 7, 290: 6, 291: 8, 292: 8, 294: 8, 300: 8, 308: 8, 320: 8, 324: 8, 331: 8, 332: 8, 344: 8, 368: 8, 376: 3, 384: 8, 388: 4, 448: 6, 456: 4, 464: 8, 469: 8, 480: 8, 500: 8, 501: 8, 512: 8, 514: 8, 515: 7, 516: 7, 517: 7, 518: 7, 520: 8, 528: 8, 532: 8, 542: 8, 544: 8, 557: 8, 559: 8, 560: 4, 564: 4, 571: 3, 584: 8, 608: 8, 624: 8, 625: 8, 632: 8, 639: 8, 653: 8, 654: 8, 655: 8, 658: 6, 660: 8, 669: 3, 671: 8, 672: 8, 678: 8, 680: 8, 701: 8, 704: 8, 705: 8, 706: 8, 709: 8, 710: 8, 719: 8, 720: 6, 729: 5, 736: 8, 737: 8, 746: 5, 760: 8, 764: 8, 766: 8, 770: 8, 773: 8, 779: 8, 782: 8, 784: 8, 788: 3, 792: 8, 799: 8, 800: 8, 804: 8, 808: 8, 816: 8, 817: 8, 820: 8, 825: 2, 826: 8, 832: 8, 838: 2, 840: 8, 848: 8, 853: 8, 856: 4, 860: 6, 863: 8, 878: 8, 882: 8, 897: 8, 908: 8, 924: 3, 926: 3, 929: 8, 937: 8, 938: 8, 939: 8, 940: 8, 941: 8, 942: 8, 943: 8, 947: 8, 948: 8, 956: 8, 958: 8, 959: 8, 969: 4, 974: 5, 979: 8, 980: 8, 981: 8, 982: 8, 983: 8, 984: 8, 992: 8, 993: 7, 995: 8, 996: 8, 1000: 8, 1001: 8, 1002: 8, 1003: 8, 1008: 8, 1009: 8, 1010: 8, 1011: 8, 1012: 8, 1013: 8, 1014: 8, 1015: 8, 1024: 8, 1025: 8, 1026: 8, 1031: 8, 1033: 8, 1050: 8, 1059: 8, 1082: 8, 1083: 8, 1098: 8, 1100: 8, 1216: 8, 1218: 8, 1220: 8, 1225: 8, 1235: 8, 1242: 8, 1246: 8, 1250: 8, 1284: 8, 1537: 8, 1538: 8, 1562: 8, 1568: 8, 1856: 8, 1858: 8, 1860: 8, 1865: 8, 1875: 8, 1882: 8, 1886: 8, 1890: 8, 1892: 8, 2016: 8, 2024: 8 }], CAR.PACIFICA_2018: [{ 55: 8, 257: 5, 258: 8, 264: 8, 268: 8, 274: 2, 280: 8, 284: 8, 288: 7, 290: 6, 292: 8, 294: 8, 300: 8, 308: 8, 320: 8, 324: 8, 331: 8, 332: 8, 344: 8, 368: 8, 376: 3, 384: 8, 388: 4, 416: 7, 448: 6, 456: 4, 464: 8, 469: 8, 480: 8, 500: 8, 501: 8, 512: 8, 514: 8, 516: 7, 517: 7, 520: 8, 524: 8, 526: 6, 528: 8, 532: 8, 542: 8, 544: 8, 557: 8, 559: 8, 560: 4, 564: 8, 571: 3, 579: 8, 584: 8, 608: 8, 624: 8, 625: 8, 632: 8, 639: 8, 656: 4, 658: 6, 660: 8, 669: 3, 671: 8, 672: 8, 678: 8, 680: 8, 705: 8, 706: 8, 709: 8, 710: 8, 719: 8, 720: 6, 729: 5, 736: 8, 746: 5, 752: 2, 760: 8, 764: 8, 766: 8, 770: 8, 773: 8, 779: 8, 784: 8, 792: 8, 799: 8, 800: 8, 804: 8, 808: 8, 816: 8, 817: 8, 820: 8, 825: 2, 826: 8, 832: 8, 838: 2, 848: 8, 853: 8, 856: 4, 860: 6, 863: 8, 882: 8, 897: 8, 924: 8, 926: 3, 937: 8, 947: 8, 948: 8, 969: 4, 974: 5, 979: 8, 980: 8, 981: 8, 982: 8, 983: 8, 984: 8, 992: 8, 993: 7, 995: 8, 996: 8, 1000: 8, 1001: 8, 1002: 8, 1003: 8, 1008: 8, 1009: 8, 1010: 8, 1011: 8, 1012: 8, 1013: 8, 1014: 8, 1015: 8, 1024: 8, 1025: 8, 1026: 8, 1031: 8, 1033: 8, 1050: 8, 1059: 8, 1098: 8, 1100: 8, 1537: 8, 1538: 8, 1562: 8 @@ -133,7 +135,7 @@ FINGERPRINTS = { }], CAR.JEEP_CHEROKEE_2019: [{ # Jeep Grand Cherokee 2019, including most 2020 models - 55: 8, 168: 8, 179: 8, 181: 8, 256: 4, 257: 5, 258: 8, 264: 8, 268: 8, 272: 6, 273: 6, 274: 2, 280: 8, 284: 8, 288: 7, 290: 6, 292: 8, 300: 8, 308: 8, 320: 8, 324: 8, 331: 8, 332: 8, 341: 8, 344: 8, 352: 8, 362: 8, 368: 8, 376: 3, 384: 8, 388: 4, 416: 7, 448: 6, 456: 4, 464: 8, 500: 8, 501: 8, 512: 8, 514: 8, 520: 8, 530: 8, 532: 8, 544: 8, 557: 8, 559: 8, 560: 8, 564: 8, 571: 3, 579: 8, 584: 8, 608: 8, 618: 8, 624: 8, 625: 8, 632: 8, 639: 8, 640: 1, 656: 4, 658: 6, 660: 8, 671: 8, 672: 8, 676: 8, 678: 8, 680: 8, 683: 8, 684: 8, 703: 8, 705: 8, 706: 8, 709: 8, 710: 8, 719: 8, 720: 6, 729: 5, 736: 8, 737: 8, 738: 8, 746: 5, 752: 2, 754: 8, 760: 8, 761: 8, 764: 8, 766: 8, 773: 8, 776: 8, 779: 8, 782: 8, 783: 8, 784: 8, 785: 8, 792: 8, 799: 8, 800: 8, 804: 8, 806: 2, 808: 8, 810: 8, 816: 8, 817: 8, 820: 8, 825: 2, 826: 8, 831: 6, 832: 8, 838: 2, 840: 8, 844: 5, 847: 1, 848: 8, 853: 8, 856: 4, 860: 6, 863: 8, 882: 8, 897: 8, 906: 8, 924: 8, 937: 8, 938: 8, 939: 8, 940: 8, 941: 8, 942: 8, 943: 8, 947: 8, 948: 8, 960: 4, 968: 8, 969: 4, 970: 8, 973: 8, 974: 5, 976: 8, 977: 4, 979: 8, 980: 8, 981: 8, 982: 8, 983: 8, 984: 8, 992: 8, 993: 7, 995: 8, 996: 8, 1000: 8, 1001: 8, 1002: 8, 1003: 8, 1008: 8, 1009: 8, 1010: 8, 1011: 8, 1012: 8, 1013: 8, 1014: 8, 1015: 8, 1024: 8, 1025: 8, 1026: 8, 1031: 8, 1033: 8, 1050: 8, 1059: 8, 1062: 8, 1098: 8, 1100: 8, 1216: 8, 1218: 8, 1220: 8, 1223: 8, 1225: 8, 1227: 8, 1235: 8, 1242: 8, 1250: 8, 1251: 8, 1252: 8, 1254: 8, 1264: 8, 1284: 8, 1536: 8, 1537: 8, 1543: 8, 1545: 8, 1562: 8, 1568: 8, 1570: 8, 1572: 8, 1593: 8, 1856: 8, 1858: 8, 1860: 8, 1863: 8, 1865: 8, 1867: 8, 1875: 8, 1882: 8, 1890: 8, 1891: 8, 1892: 8, 1894: 8, 1896: 8, 1904: 8, 2015: 8, 2016: 8, 2017: 8, 2024: 8, 2025: 8 + 55: 8, 168: 8, 179: 8, 181: 8, 256: 4, 257: 5, 258: 8, 264: 8, 268: 8, 272: 6, 273: 6, 274: 2, 280: 8, 284: 8, 288: 7, 290: 6, 292: 8, 300: 8, 308: 8, 320: 8, 324: 8, 331: 8, 332: 8, 341: 8, 344: 8, 352: 8, 362: 8, 368: 8, 376: 3, 384: 8, 388: 4, 416: 7, 448: 6, 456: 4, 464: 8, 500: 8, 501: 8, 512: 8, 514: 8, 520: 8, 530: 8, 532: 8, 544: 8, 557: 8, 559: 8, 560: 8, 564: 8, 571: 3, 579: 8, 584: 8, 608: 8, 618: 8, 624: 8, 625: 8, 632: 8, 639: 8, 640: 1, 656: 4, 658: 6, 660: 8, 671: 8, 672: 8, 676: 8, 678: 8, 680: 8, 683: 8, 684: 8, 703: 8, 705: 8, 706: 8, 709: 8, 710: 8, 719: 8, 720: 6, 729: 5, 736: 8, 737: 8, 738: 8, 746: 5, 752: 2, 754: 8, 760: 8, 761: 8, 764: 8, 766: 8, 773: 8, 776: 8, 779: 8, 782: 8, 783: 8, 784: 8, 785: 8, 792: 8, 799: 8, 800: 8, 804: 8, 806: 2, 808: 8, 810: 8, 816: 8, 817: 8, 820: 8, 825: 2, 826: 8, 831: 6, 832: 8, 838: 2, 840: 8, 844: 5, 847: 1, 848: 8, 853: 8, 856: 4, 860: 6, 863: 8, 874: 2, 882: 8, 897: 8, 906: 8, 924: 8, 937: 8, 938: 8, 939: 8, 940: 8, 941: 8, 942: 8, 943: 8, 947: 8, 948: 8, 960: 4, 968: 8, 969: 4, 970: 8, 973: 8, 974: 5, 976: 8, 977: 4, 979: 8, 980: 8, 981: 8, 982: 8, 983: 8, 984: 8, 992: 8, 993: 7, 995: 8, 996: 8, 1000: 8, 1001: 8, 1002: 8, 1003: 8, 1008: 8, 1009: 8, 1010: 8, 1011: 8, 1012: 8, 1013: 8, 1014: 8, 1015: 8, 1024: 8, 1025: 8, 1026: 8, 1031: 8, 1033: 8, 1050: 8, 1059: 8, 1062: 8, 1098: 8, 1100: 8, 1216: 8, 1218: 8, 1220: 8, 1223: 8, 1225: 8, 1227: 8, 1235: 8, 1242: 8, 1250: 8, 1251: 8, 1252: 8, 1254: 8, 1264: 8, 1284: 8, 1536: 8, 1537: 8, 1538: 8, 1543: 8, 1545: 8, 1562: 8, 1568: 8, 1570: 8, 1572: 8, 1593: 8, 1856: 8, 1858: 8, 1860: 8, 1863: 8, 1865: 8, 1867: 8, 1875: 8, 1882: 8, 1890: 8, 1891: 8, 1892: 8, 1894: 8, 1896: 8, 1904: 8, 2015: 8, 2016: 8, 2017: 8, 2024: 8, 2025: 8 }], } diff --git a/selfdrive/car/docs_definitions.py b/selfdrive/car/docs_definitions.py index 03e9e721b..c0fb4420d 100644 --- a/selfdrive/car/docs_definitions.py +++ b/selfdrive/car/docs_definitions.py @@ -21,6 +21,7 @@ class Column(Enum): STEERING_TORQUE = "Steering Torque" AUTO_RESUME = "Resume from stop" HARNESS = "Harness" + VIDEO = "Video" class Star(Enum): @@ -125,20 +126,11 @@ class CarInfo: harness: Enum = Harness.none def init(self, CP: car.CarParams, all_footnotes: Dict[Enum, int]): - # TODO: set all the min steer speeds in carParams and remove this - if self.min_steer_speed is not None: - assert CP.minSteerSpeed == 0, f"{CP.carFingerprint}: Minimum steer speed set in both CarInfo and CarParams" - else: - self.min_steer_speed = CP.minSteerSpeed - - # TODO: set all the min enable speeds in carParams correctly and remove this - if self.min_enable_speed is None: - self.min_enable_speed = CP.minEnableSpeed - self.car_name = CP.carName self.car_fingerprint = CP.carFingerprint self.make, self.model, self.years = split_name(self.name) + # longitudinal column op_long = "Stock" if CP.openpilotLongitudinalControl and not CP.enableDsu: op_long = "openpilot" @@ -149,6 +141,23 @@ class CarInfo: else: self.footnotes.append(CommonFootnote.EXP_LONG_AVAIL) + # min steer & enable speed columns + # TODO: set all the min steer speeds in carParams and remove this + if self.min_steer_speed is not None: + assert CP.minSteerSpeed == 0, f"{CP.carFingerprint}: Minimum steer speed set in both CarInfo and CarParams" + else: + self.min_steer_speed = CP.minSteerSpeed + + # TODO: set all the min enable speeds in carParams correctly and remove this + if self.min_enable_speed is None: + self.min_enable_speed = CP.minEnableSpeed + + # harness column + harness_col = self.harness.value + if self.harness is not Harness.none: + model_years = self.model + (' ' + self.years if self.years else '') + harness_col = f'{harness_col}' + self.row = { Column.MAKE: self.make, Column.MODEL: self.model, @@ -158,7 +167,8 @@ class CarInfo: Column.FSR_STEERING: f"{max(self.min_steer_speed * CV.MS_TO_MPH, 0):.0f} mph", Column.STEERING_TORQUE: Star.EMPTY, Column.AUTO_RESUME: Star.FULL if CP.autoResumeSng else Star.EMPTY, - Column.HARNESS: self.harness.value, + Column.HARNESS: harness_col, + Column.VIDEO: self.video_link if self.video_link is not None else "", # replaced with an image and link from template in get_column } # Set steering torque star from max lateral acceleration @@ -194,6 +204,13 @@ class CarInfo: if self.row[Column.STEERING_TORQUE] != Star.FULL: sentence_builder += " This car may not be able to take tight turns on its own." + # experimental mode + exp_link = "Experimental mode" + if CP.openpilotLongitudinalControl or CP.experimentalLongitudinalAvailable: + sentence_builder += f" Traffic light and stop sign handling is also available in {exp_link}." + else: + sentence_builder += f" {exp_link}, with traffic light and stop sign handling, is not currently available for this car, but may be added in a future software update." + return sentence_builder.format(car_model=f"{self.make} {self.model}", alc=alc, acc=acc) else: @@ -202,12 +219,14 @@ class CarInfo: else: raise Exception(f"This notCar does not have a detail sentence: {CP.carFingerprint}") - def get_column(self, column: Column, star_icon: str, footnote_tag: str) -> str: + def get_column(self, column: Column, star_icon: str, video_icon: str, footnote_tag: str) -> str: item: Union[str, Star] = self.row[column] if isinstance(item, Star): item = star_icon.format(item.value) elif column == Column.MODEL and len(self.years): item += f" {self.years}" + elif column == Column.VIDEO and len(item) > 0: + item = video_icon.format(item) footnotes = get_footnotes(self.footnotes, column) if len(footnotes): diff --git a/selfdrive/car/ecu_addrs.py b/selfdrive/car/ecu_addrs.py index 9f6ace2b5..e5d550fac 100755 --- a/selfdrive/car/ecu_addrs.py +++ b/selfdrive/car/ecu_addrs.py @@ -87,5 +87,5 @@ if __name__ == "__main__": for addr, subaddr, bus in ecu_addrs: msg = f" 0x{hex(addr)}" if subaddr is not None: - msg += f" (sub-address: 0x{hex(subaddr)})" + msg += f" (sub-address: {hex(subaddr)})" print(msg) diff --git a/selfdrive/car/ford/carcontroller.py b/selfdrive/car/ford/carcontroller.py index f18014601..99072ae97 100644 --- a/selfdrive/car/ford/carcontroller.py +++ b/selfdrive/car/ford/carcontroller.py @@ -1,28 +1,14 @@ -import math from cereal import car -from common.numpy_fast import clip, interp +from common.numpy_fast import clip from opendbc.can.packer import CANPacker -from selfdrive.car.ford import fordcan -from selfdrive.car.ford.values import CANBUS, CarControllerParams +from selfdrive.car import apply_std_steer_angle_limits +from selfdrive.car.ford.fordcan import create_acc_command, create_acc_ui_msg, create_button_msg, create_lat_ctl_msg, \ + create_lat_ctl2_msg, create_lka_msg, create_lkas_ui_msg +from selfdrive.car.ford.values import CANBUS, CANFD_CARS, CarControllerParams VisualAlert = car.CarControl.HUDControl.VisualAlert -def apply_ford_steer_angle_limits(apply_angle, apply_angle_last, vEgo): - # rate limit - steer_up = apply_angle_last * apply_angle > 0. and abs(apply_angle) > abs(apply_angle_last) - rate_limit = CarControllerParams.RATE_LIMIT_UP if steer_up else CarControllerParams.RATE_LIMIT_DOWN - max_angle_diff = interp(vEgo, rate_limit.speed_points, rate_limit.max_angle_diff_points) - apply_angle = clip(apply_angle, (apply_angle_last - max_angle_diff), (apply_angle_last + max_angle_diff)) - - # absolute limit (LatCtlPath_An_Actl) - apply_path_angle = math.radians(apply_angle) / CarControllerParams.LKAS_STEER_RATIO - apply_path_angle = clip(apply_path_angle, -0.5, 0.5235) - apply_angle = math.degrees(apply_path_angle) * CarControllerParams.LKAS_STEER_RATIO - - return apply_angle - - class CarController: def __init__(self, dbc_name, CP, VM): self.CP = CP @@ -30,12 +16,12 @@ class CarController: self.packer = CANPacker(dbc_name) self.frame = 0 - self.apply_angle_last = 0 + self.apply_curvature_last = 0 self.main_on_last = False self.lkas_enabled_last = False self.steer_alert_last = False - def update(self, CC, CS): + def update(self, CC, CS, now_nanos): can_sends = [] actuators = CC.actuators @@ -46,66 +32,69 @@ class CarController: ### acc buttons ### if CC.cruiseControl.cancel: - can_sends.append(fordcan.create_button_command(self.packer, CS.buttons_stock_values, cancel=True)) - can_sends.append(fordcan.create_button_command(self.packer, CS.buttons_stock_values, cancel=True, bus=CANBUS.main)) + can_sends.append(create_button_msg(self.packer, CS.buttons_stock_values, cancel=True)) + can_sends.append(create_button_msg(self.packer, CS.buttons_stock_values, cancel=True, bus=CANBUS.main)) elif CC.cruiseControl.resume and (self.frame % CarControllerParams.BUTTONS_STEP) == 0: - can_sends.append(fordcan.create_button_command(self.packer, CS.buttons_stock_values, resume=True)) - can_sends.append(fordcan.create_button_command(self.packer, CS.buttons_stock_values, resume=True, bus=CANBUS.main)) + can_sends.append(create_button_msg(self.packer, CS.buttons_stock_values, resume=True)) + can_sends.append(create_button_msg(self.packer, CS.buttons_stock_values, resume=True, bus=CANBUS.main)) # if stock lane centering isn't off, send a button press to toggle it off # the stock system checks for steering pressed, and eventually disengages cruise control elif CS.acc_tja_status_stock_values["Tja_D_Stat"] != 0 and (self.frame % CarControllerParams.ACC_UI_STEP) == 0: - can_sends.append(fordcan.create_button_command(self.packer, CS.buttons_stock_values, tja_toggle=True)) - + can_sends.append(create_button_msg(self.packer, CS.buttons_stock_values, tja_toggle=True)) ### lateral control ### - if CC.latActive: - lca_rq = 1 - apply_angle = apply_ford_steer_angle_limits(actuators.steeringAngleDeg, self.apply_angle_last, CS.out.vEgo) - else: - lca_rq = 0 - apply_angle = 0. - # send steering commands at 20Hz - if (self.frame % CarControllerParams.LKAS_STEER_STEP) == 0: - # use LatCtlPath_An_Actl to actuate steering - path_angle = math.radians(apply_angle) / CarControllerParams.LKAS_STEER_RATIO - - # set slower ramp type when small steering angle change - # 0=Slow, 1=Medium, 2=Fast, 3=Immediately - steer_change = abs(CS.out.steeringAngleDeg - actuators.steeringAngleDeg) - if steer_change < 2.0: - ramp_type = 0 - elif steer_change < 4.0: - ramp_type = 1 - elif steer_change < 6.0: - ramp_type = 2 + if (self.frame % CarControllerParams.STEER_STEP) == 0: + if CC.latActive: + # apply limits to curvature and clip to signal range + apply_curvature = apply_std_steer_angle_limits(actuators.curvature, self.apply_curvature_last, CS.out.vEgo, CarControllerParams) + apply_curvature = clip(apply_curvature, -CarControllerParams.CURVATURE_MAX, CarControllerParams.CURVATURE_MAX) else: - ramp_type = 3 - precision = 1 # 0=Comfortable, 1=Precise (the stock system always uses comfortable) + apply_curvature = 0. - self.apply_angle_last = apply_angle - can_sends.append(fordcan.create_lka_command(self.packer, 0, 0)) - can_sends.append(fordcan.create_tja_command(self.packer, lca_rq, ramp_type, precision, - 0, path_angle, 0, 0)) + self.apply_curvature_last = apply_curvature + can_sends.append(create_lka_msg(self.packer)) + if self.CP.carFingerprint in CANFD_CARS: + # TODO: extended mode + mode = 1 if CC.latActive else 0 + counter = self.frame // CarControllerParams.STEER_STEP + can_sends.append(create_lat_ctl2_msg(self.packer, mode, 0., 0., -apply_curvature, 0., counter)) + else: + can_sends.append(create_lat_ctl_msg(self.packer, CC.latActive, 0., 0., -apply_curvature, 0.)) + + ### longitudinal control ### + # send acc command at 50Hz + if self.CP.openpilotLongitudinalControl and (self.frame % CarControllerParams.ACC_CONTROL_STEP) == 0: + accel = clip(actuators.accel, CarControllerParams.ACCEL_MIN, CarControllerParams.ACCEL_MAX) + + precharge_brake = accel < -0.1 + if accel > -0.5: + gas = accel + decel = False + else: + gas = -5.0 + decel = True + + can_sends.append(create_acc_command(self.packer, CC.longActive, gas, accel, precharge_brake, decel)) ### ui ### send_ui = (self.main_on_last != main_on) or (self.lkas_enabled_last != CC.latActive) or (self.steer_alert_last != steer_alert) # send lkas ui command at 1Hz or if ui state changes if (self.frame % CarControllerParams.LKAS_UI_STEP) == 0 or send_ui: - can_sends.append(fordcan.create_lkas_ui_command(self.packer, main_on, CC.latActive, steer_alert, hud_control, CS.lkas_status_stock_values)) + can_sends.append(create_lkas_ui_msg(self.packer, main_on, CC.latActive, steer_alert, hud_control, CS.lkas_status_stock_values)) # send acc ui command at 20Hz or if ui state changes if (self.frame % CarControllerParams.ACC_UI_STEP) == 0 or send_ui: - can_sends.append(fordcan.create_acc_ui_command(self.packer, main_on, CC.latActive, hud_control, CS.acc_tja_status_stock_values)) + can_sends.append(create_acc_ui_msg(self.packer, main_on, CC.latActive, hud_control, CS.acc_tja_status_stock_values)) self.main_on_last = main_on self.lkas_enabled_last = CC.latActive self.steer_alert_last = steer_alert new_actuators = actuators.copy() - new_actuators.steeringAngleDeg = self.apply_angle_last + new_actuators.curvature = self.apply_curvature_last self.frame += 1 return new_actuators, can_sends diff --git a/selfdrive/car/ford/carstate.py b/selfdrive/car/ford/carstate.py index 2276b1208..21af1062f 100644 --- a/selfdrive/car/ford/carstate.py +++ b/selfdrive/car/ford/carstate.py @@ -14,7 +14,7 @@ class CarState(CarStateBase): super().__init__(CP) can_define = CANDefine(DBC[CP.carFingerprint]["pt"]) if CP.transmissionType == TransmissionType.automatic: - self.shifter_values = can_define.dv["Gear_Shift_by_Wire_FD1"]["TrnGear_D_RqDrv"] + self.shifter_values = can_define.dv["Gear_Shift_by_Wire_FD1"]["TrnRng_D_RqGsm"] def update(self, cp, cp_cam): ret = car.CarState.new_message() @@ -37,7 +37,7 @@ class CarState(CarStateBase): # steering wheel ret.steeringAngleDeg = cp.vl["SteeringPinion_Data"]["StePinComp_An_Est"] ret.steeringTorque = cp.vl["EPAS_INFO"]["SteeringColumnTorque"] - ret.steeringPressed = abs(ret.steeringTorque) > CarControllerParams.STEER_DRIVER_ALLOWANCE + ret.steeringPressed = self.update_steering_pressed(abs(ret.steeringTorque) > CarControllerParams.STEER_DRIVER_ALLOWANCE, 5) ret.steerFaultTemporary = cp.vl["EPAS_INFO"]["EPAS_Failure"] == 1 ret.steerFaultPermanent = cp.vl["EPAS_INFO"]["EPAS_Failure"] in (2, 3) # ret.espDisabled = False # TODO: find traction control signal @@ -51,7 +51,7 @@ class CarState(CarStateBase): # gear if self.CP.transmissionType == TransmissionType.automatic: - gear = self.shifter_values.get(cp.vl["Gear_Shift_by_Wire_FD1"]["TrnGear_D_RqDrv"], None) + gear = self.shifter_values.get(cp.vl["Gear_Shift_by_Wire_FD1"]["TrnRng_D_RqGsm"]) ret.gearShifter = self.parse_gear_shifter(gear) elif self.CP.transmissionType == TransmissionType.manual: ret.clutchPressed = cp.vl["Engine_Clutch_Data"]["CluPdlPos_Pc_Meas"] > 0 @@ -118,7 +118,7 @@ class CarState(CarStateBase): ("DrStatRl_B_Actl", "BodyInfo_3_FD1"), # BCM Door open, rear left ("DrStatRr_B_Actl", "BodyInfo_3_FD1"), # BCM Door open, rear right ("FirstRowBuckleDriver", "RCMStatusMessage2_FD1"), # RCM Seatbelt status, driver - ("HeadLghtHiFlash_D_Stat", "Steering_Data_FD1"), # SCCM Passthru the remaining buttons + ("HeadLghtHiFlash_D_Stat", "Steering_Data_FD1"), # SCCM Passthrough the remaining buttons ("WiprFront_D_Stat", "Steering_Data_FD1"), ("LghtAmb_D_Sns", "Steering_Data_FD1"), ("AccButtnGapDecPress", "Steering_Data_FD1"), @@ -171,7 +171,7 @@ class CarState(CarStateBase): if CP.transmissionType == TransmissionType.automatic: signals += [ - ("TrnGear_D_RqDrv", "Gear_Shift_by_Wire_FD1"), # GWM transmission gear position + ("TrnRng_D_RqGsm", "Gear_Shift_by_Wire_FD1"), # GWM transmission gear position ] checks += [ ("Gear_Shift_by_Wire_FD1", 10), diff --git a/selfdrive/car/ford/fordcan.py b/selfdrive/car/ford/fordcan.py index 373ce096c..594d50f59 100644 --- a/selfdrive/car/ford/fordcan.py +++ b/selfdrive/car/ford/fordcan.py @@ -4,64 +4,120 @@ from selfdrive.car.ford.values import CANBUS HUDControl = car.CarControl.HUDControl -def create_lka_command(packer, angle_deg: float, curvature: float): +def calculate_lat_ctl2_checksum(mode: int, counter: int, dat: bytearray): + checksum = mode + counter + checksum += dat[2] + ((dat[3] & 0xE0) >> 5) # curvature + checksum += dat[6] + ((dat[7] & 0xE0) >> 5) # curvature rate + checksum += (dat[3] & 0x1F) + ((dat[4] & 0xFC) >> 2) # path angle + checksum += (dat[4] & 0x3) + dat[5] # path offset + return 0xFF - (checksum & 0xFF) + + +def create_lka_msg(packer): """ - Creates a CAN message for the Ford LKAS Command. + Creates an empty CAN message for the Ford LKA Command. This command can apply "Lane Keeping Aid" manoeuvres, which are subject to the PSCM lockout. Frequency is 20Hz. """ - values = { - "LkaDrvOvrrd_D_Rq": 0, # driver override level? [0|3] - "LkaActvStats_D2_Req": 0, # action [0|7] - "LaRefAng_No_Req": angle_deg, # angle [-102.4|102.3] degrees - "LaRampType_B_Req": 0, # Ramp speed: 0=Smooth, 1=Quick - "LaCurvature_No_Calc": curvature, # curvature [-0.01024|0.01023] 1/meter - "LdwActvStats_D_Req": 0, # LDW status [0|7] - "LdwActvIntns_D_Req": 0, # LDW intensity [0|3], shake alert strength - } - return packer.make_can_msg("Lane_Assist_Data1", CANBUS.main, values) + return packer.make_can_msg("Lane_Assist_Data1", CANBUS.main, {}) -def create_tja_command(packer, lca_rq: int, ramp_type: int, precision: int, path_offset: float, path_angle: float, curvature_rate: float, curvature: float): +def create_lat_ctl_msg(packer, lat_active: bool, path_offset: float, path_angle: float, curvature: float, + curvature_rate: float): """ Creates a CAN message for the Ford TJA/LCA Command. - This command can apply "Lane Centering" manoeuvres: continuous lane centering for traffic jam - assist and highway driving. It is not subject to the PSCM lockout. + This command can apply "Lane Centering" manoeuvres: continuous lane centering for traffic jam assist and highway + driving. It is not subject to the PSCM lockout. - Ford lane centering command uses a third order polynomial to describe the road centerline. The - polynomial is defined by the following coefficients: - c0: lateral offset between the vehicle and the centerline - c1: heading angle between the vehicle and the centerline - c2: curvature of the centerline + Ford lane centering command uses a third order polynomial to describe the road centerline. The polynomial is defined + by the following coefficients: + c0: lateral offset between the vehicle and the centerline (positive is right) + c1: heading angle between the vehicle and the centerline (positive is right) + c2: curvature of the centerline (positive is left) c3: rate of change of curvature of the centerline - As the PSCM combines this information with other sensor data, such as the vehicle's yaw rate and - speed, the steering angle cannot be easily controlled. + As the PSCM combines this information with other sensor data, such as the vehicle's yaw rate and speed, the steering + angle cannot be easily controlled. - The PSCM should be configured to accept TJA/LCA commands before these commands will be processed. - This can be done using tools such as Forscan. + The PSCM should be configured to accept TJA/LCA commands before these commands will be processed. This can be done + using tools such as Forscan. Frequency is 20Hz. """ values = { - "LatCtlRng_L_Max": 0, # Unknown [0|126] meter - "HandsOffCnfm_B_Rq": 0, # Unknown: 0=Inactive, 1=Active [0|1] - "LatCtl_D_Rq": lca_rq, # Mode: 0=None, 1=ContinuousPathFollowing, 2=InterventionLeft, 3=InterventionRight, 4-7=NotUsed [0|7] - "LatCtlRampType_D_Rq": ramp_type, # Ramp speed: 0=Slow, 1=Medium, 2=Fast, 3=Immediate [0|3] - "LatCtlPrecision_D_Rq": precision, # Precision: 0=Comfortable, 1=Precise, 2/3=NotUsed [0|3] - "LatCtlPathOffst_L_Actl": path_offset, # Path offset [-5.12|5.11] meter - "LatCtlPath_An_Actl": path_angle, # Path angle [-0.5|0.5235] radians - "LatCtlCurv_NoRate_Actl": curvature_rate, # Curvature rate [-0.001024|0.00102375] 1/meter^2 - "LatCtlCurv_No_Actl": curvature, # Curvature [-0.02|0.02094] 1/meter + "LatCtlRng_L_Max": 0, # Unknown [0|126] meter + "HandsOffCnfm_B_Rq": 0, # Unknown: 0=Inactive, 1=Active [0|1] + "LatCtl_D_Rq": 1 if lat_active else 0, # Mode: 0=None, 1=ContinuousPathFollowing, 2=InterventionLeft, + # 3=InterventionRight, 4-7=NotUsed [0|7] + "LatCtlRampType_D_Rq": 0, # Ramp speed: 0=Slow, 1=Medium, 2=Fast, 3=Immediate [0|3] + # Makes no difference with curvature control + "LatCtlPrecision_D_Rq": 1, # Precision: 0=Comfortable, 1=Precise, 2/3=NotUsed [0|3] + # The stock system always uses comfortable + "LatCtlPathOffst_L_Actl": path_offset, # Path offset [-5.12|5.11] meter + "LatCtlPath_An_Actl": path_angle, # Path angle [-0.5|0.5235] radians + "LatCtlCurv_NoRate_Actl": curvature_rate, # Curvature rate [-0.001024|0.00102375] 1/meter^2 + "LatCtlCurv_No_Actl": curvature, # Curvature [-0.02|0.02094] 1/meter } return packer.make_can_msg("LateralMotionControl", CANBUS.main, values) -def create_lkas_ui_command(packer, main_on: bool, enabled: bool, steer_alert: bool, hud_control, stock_values: dict): +def create_lat_ctl2_msg(packer, mode: int, path_offset: float, path_angle: float, curvature: float, + curvature_rate: float, counter: int): + """ + Create a CAN message for the new Ford Lane Centering command. + + This message is used on the CAN FD platform and replaces the old LateralMotionControl message. It is similar but has + additional signals for a counter and checksum. + + Frequency is 20Hz. + """ + + values = { + "LatCtl_D2_Rq": mode, # Mode: 0=None, 1=PathFollowingLimitedMode, 2=PathFollowingExtendedMode, + # 3=SafeRampOut, 4-7=NotUsed [0|7] + "LatCtlRampType_D_Rq": 0, # 0=Slow, 1=Medium, 2=Fast, 3=Immediate [0|3] + "LatCtlPrecision_D_Rq": 1, # 0=Comfortable, 1=Precise, 2/3=NotUsed [0|3] + "LatCtlPathOffst_L_Actl": path_offset, # [-5.12|5.11] meter + "LatCtlPath_An_Actl": path_angle, # [-0.5|0.5235] radians + "LatCtlCurv_No_Actl": curvature, # [-0.02|0.02094] 1/meter + "LatCtlCrv_NoRate2_Actl": curvature_rate, # [-0.001024|0.001023] 1/meter^2 + "HandsOffCnfm_B_Rq": 0, # 0=Inactive, 1=Active [0|1] + "LatCtlPath_No_Cnt": counter, # [0|15] + "LatCtlPath_No_Cs": 0, # [0|255] + } + + # calculate checksum + dat = packer.make_can_msg("LateralMotionControl2", CANBUS.main, values)[2] + values["LatCtlPath_No_Cs"] = calculate_lat_ctl2_checksum(mode, counter, dat) + + return packer.make_can_msg("LateralMotionControl2", CANBUS.main, values) + + +def create_acc_command(packer, long_active: bool, gas: float, accel: float, precharge_brake: bool, decel: bool): + """ + Creates a CAN message for the Ford ACC Command. + + This command can be used to enable ACC, to set the ACC gas/brake/decel values + and to disable ACC. + + Frequency is 50Hz. + """ + + values = { + "AccBrkTot_A_Rq": accel, # Brake total accel request: [-20|11.9449] m/s^2 + "Cmbb_B_Enbl": 1 if long_active else 0, # Enabled: 0=No, 1=Yes + "AccPrpl_A_Rq": gas, # Acceleration request: [-5|5.23] m/s^2 + "AccBrkPrchg_B_Rq": 1 if precharge_brake else 0, # Pre-charge brake request: 0=No, 1=Yes + "AccBrkDecel_B_Rq": 1 if decel else 0, # Deceleration request: 0=Inactive, 1=Active + } + return packer.make_can_msg("ACCDATA", CANBUS.main, values) + + +def create_lkas_ui_msg(packer, main_on: bool, enabled: bool, steer_alert: bool, hud_control, stock_values: dict): """ Creates a CAN message for the Ford IPC IPMA/LKAS status. @@ -107,16 +163,15 @@ def create_lkas_ui_command(packer, main_on: bool, enabled: bool, steer_alert: bo values = { **stock_values, - "LaActvStats_D_Dsply": lines, # LKAS status (lines) [0|31] - "LaHandsOff_D_Dsply": hands_on_wheel_dsply, # 0=HandsOn, 1=Level1 (w/o chime), 2=Level2 (w/ chime), 3=Suppressed + "LaActvStats_D_Dsply": lines, # LKAS status (lines) [0|31] + "LaHandsOff_D_Dsply": hands_on_wheel_dsply, # 0=HandsOn, 1=Level1 (w/o chime), 2=Level2 (w/ chime), 3=Suppressed } return packer.make_can_msg("IPMA_Data", CANBUS.main, values) -def create_acc_ui_command(packer, main_on: bool, enabled: bool, hud_control, stock_values: dict): +def create_acc_ui_msg(packer, main_on: bool, enabled: bool, hud_control, stock_values: dict): """ - Creates a CAN message for the Ford IPC adaptive cruise, forward collision warning and traffic jam - assist status. + Creates a CAN message for the Ford IPC adaptive cruise, forward collision warning and traffic jam assist status. Stock functionality is maintained by passing through unmodified signals. @@ -148,7 +203,8 @@ def create_acc_ui_command(packer, main_on: bool, enabled: bool, hud_control, sto return packer.make_can_msg("ACCDATA_3", CANBUS.main, values) -def create_button_command(packer, stock_values: dict, cancel = False, resume = False, tja_toggle = False, bus: int = CANBUS.camera): +def create_button_msg(packer, stock_values: dict, cancel=False, resume=False, tja_toggle=False, + bus: int = CANBUS.camera): """ Creates a CAN message for the Ford SCCM buttons/switches. diff --git a/selfdrive/car/ford/interface.py b/selfdrive/car/ford/interface.py index d26fa09e0..34f60fd37 100644 --- a/selfdrive/car/ford/interface.py +++ b/selfdrive/car/ford/interface.py @@ -2,43 +2,57 @@ from cereal import car from common.conversions import Conversions as CV from selfdrive.car import STD_CARGO_KG, get_safety_config -from selfdrive.car.ford.values import CAR, Ecu, TransmissionType, GearShifter +from selfdrive.car.ford.values import CAR, Ecu from selfdrive.car.interfaces import CarInterfaceBase -CarParams = car.CarParams +TransmissionType = car.CarParams.TransmissionType +GearShifter = car.CarState.GearShifter class CarInterface(CarInterfaceBase): @staticmethod def _get_params(ret, candidate, fingerprint, car_fw, experimental_long): ret.carName = "ford" - ret.dashcamOnly = True - ret.safetyConfigs = [get_safety_config(CarParams.SafetyModel.ford)] + ret.safetyConfigs = [get_safety_config(car.CarParams.SafetyModel.ford)] - # Angle-based steering - ret.steerControlType = CarParams.SteerControlType.angle - ret.steerActuatorDelay = 0.4 + # These cars are dashcam only until the port is finished + ret.dashcamOnly = True + + ret.radarUnavailable = True + ret.steerControlType = car.CarParams.SteerControlType.angle + ret.steerActuatorDelay = 0.2 ret.steerLimitTimer = 1.0 - if candidate == CAR.ESCAPE_MK4: + if candidate == CAR.BRONCO_SPORT_MK1: + ret.wheelbase = 2.67 + ret.steerRatio = 17.7 + ret.mass = 1625 + STD_CARGO_KG + + elif candidate == CAR.ESCAPE_MK4: ret.wheelbase = 2.71 - ret.steerRatio = 14.3 # Copied from Focus + ret.steerRatio = 16.7 ret.mass = 1750 + STD_CARGO_KG elif candidate == CAR.EXPLORER_MK6: ret.wheelbase = 3.025 - ret.steerRatio = 16.8 # learned + ret.steerRatio = 16.8 ret.mass = 2050 + STD_CARGO_KG elif candidate == CAR.FOCUS_MK4: ret.wheelbase = 2.7 - ret.steerRatio = 13.8 # learned + ret.steerRatio = 15.0 ret.mass = 1350 + STD_CARGO_KG + elif candidate == CAR.MAVERICK_MK1: + ret.wheelbase = 3.076 + ret.steerRatio = 17.0 + ret.mass = 1650 + STD_CARGO_KG + else: raise ValueError(f"Unsupported car: {candidate}") - CarInterfaceBase.configure_dp_tune(candidate, ret.lateralTuning) + CarInterfaceBase.dp_lat_tune_collection(candidate, ret.latTuneCollection) + CarInterfaceBase.configure_dp_tune(ret.lateralTuning, ret.latTuneCollection) # Auto Transmission: 0x732 ECU or Gear_Shift_by_Wire_FD1 found_ecus = [fw.ecu for fw in car_fw] @@ -67,5 +81,5 @@ class CarInterface(CarInterfaceBase): return ret - def apply(self, c): - return self.CC.update(c, self.CS) + def apply(self, c, now_nanos): + return self.CC.update(c, self.CS, now_nanos) diff --git a/selfdrive/car/ford/radar_interface.py b/selfdrive/car/ford/radar_interface.py index c94270300..ee4efb311 100644 --- a/selfdrive/car/ford/radar_interface.py +++ b/selfdrive/car/ford/radar_interface.py @@ -47,7 +47,7 @@ class RadarInterface(RadarInterfaceBase): self.updated_messages = set() self.track_id = 0 self.radar = DBC[CP.carFingerprint]['radar'] - if self.radar is None: + if self.radar is None or CP.radarUnavailable: self.rcp = None elif self.radar == RADAR.DELPHI_ESR: self.rcp = _create_delphi_esr_radar_can_parser() diff --git a/selfdrive/car/ford/values.py b/selfdrive/car/ford/values.py index 5114f8d06..50c7d9398 100644 --- a/selfdrive/car/ford/values.py +++ b/selfdrive/car/ford/values.py @@ -1,23 +1,21 @@ -from collections import defaultdict, namedtuple +from collections import defaultdict from dataclasses import dataclass from enum import Enum -from typing import Dict, List, Union +from typing import Dict, List, Set, Union from cereal import car -from selfdrive.car import dbc_dict +from selfdrive.car import AngleRateLimit, dbc_dict from selfdrive.car.docs_definitions import CarInfo, Harness from selfdrive.car.fw_query_definitions import FwQueryConfig, Request, StdQueries Ecu = car.CarParams.Ecu -TransmissionType = car.CarParams.TransmissionType -GearShifter = car.CarState.GearShifter - -AngleRateLimit = namedtuple('AngleRateLimit', ['speed_points', 'max_angle_diff_points']) class CarControllerParams: # Messages: Lane_Assist_Data1, LateralMotionControl - LKAS_STEER_STEP = 5 + STEER_STEP = 5 + # Message: ACCDATA + ACC_CONTROL_STEP = 2 # Message: IPMA_Data LKAS_UI_STEP = 100 # Message: ACCDATA_3 @@ -25,12 +23,20 @@ class CarControllerParams: # Message: Steering_Data_FD1, but send twice as fast BUTTONS_STEP = 10 / 2 - LKAS_STEER_RATIO = 2.75 # Approximate ratio between LatCtlPath_An_Actl and steering angle in radians - # TODO: remove this once we understand how the EPS calculates the steering angle better - STEER_DRIVER_ALLOWANCE = 0.8 # Driver intervention threshold in Nm + CURVATURE_MAX = 0.02 # Max curvature for steering command, m^-1 + STEER_DRIVER_ALLOWANCE = 1.0 # Driver intervention threshold, Nm - RATE_LIMIT_UP = AngleRateLimit(speed_points=[0., 5., 15.], max_angle_diff_points=[5., .8, .15]) - RATE_LIMIT_DOWN = AngleRateLimit(speed_points=[0., 5., 15.], max_angle_diff_points=[5., 3.5, 0.4]) + # Curvature rate limits + # TODO: unify field names used by curvature and angle control cars + # ~2 m/s^3 up, ~-3 m/s^3 down + ANGLE_RATE_LIMIT_UP = AngleRateLimit(speed_bp=[5, 15, 25], angle_v=[0.004, 0.00044, 0.00016]) + ANGLE_RATE_LIMIT_DOWN = AngleRateLimit(speed_bp=[5, 15, 25], angle_v=[0.006, 0.00066, 0.00024]) + + ACCEL_MAX = 2.0 # m/s^s max acceleration + ACCEL_MIN = -3.5 # m/s^s max deceleration + + def __init__(self, CP): + pass class CANBUS: @@ -40,9 +46,14 @@ class CANBUS: class CAR: + BRONCO_SPORT_MK1 = "FORD BRONCO SPORT 1ST GEN" ESCAPE_MK4 = "FORD ESCAPE 4TH GEN" EXPLORER_MK6 = "FORD EXPLORER 6TH GEN" FOCUS_MK4 = "FORD FOCUS 4TH GEN" + MAVERICK_MK1 = "FORD MAVERICK 1ST GEN" + + +CANFD_CARS: Set[str] = set() class RADAR: @@ -60,12 +71,20 @@ class FordCarInfo(CarInfo): CAR_INFO: Dict[str, Union[CarInfo, List[CarInfo]]] = { + CAR.BRONCO_SPORT_MK1: FordCarInfo("Ford Bronco Sport 2021-22"), CAR.ESCAPE_MK4: [ - FordCarInfo("Ford Escape 2020-21"), + FordCarInfo("Ford Escape 2020-22"), + FordCarInfo("Ford Escape Plug-in Hybrid 2020-22"), FordCarInfo("Ford Kuga 2020-21", "Driver Assistance Pack"), + FordCarInfo("Ford Kuga Plug-in Hybrid 2020-22", "Driver Assistance Pack"), + ], + CAR.EXPLORER_MK6: [ + FordCarInfo("Ford Explorer 2020-22"), + FordCarInfo("Lincoln Aviator 2021", "Co-Pilot360 Plus"), + FordCarInfo("Lincoln Aviator Plug-in Hybrid 2021", "Co-Pilot360 Plus"), ], - CAR.EXPLORER_MK6: FordCarInfo("Ford Explorer 2020-22"), CAR.FOCUS_MK4: FordCarInfo("Ford Focus EU 2019", "Driver Assistance Pack"), + CAR.MAVERICK_MK1: FordCarInfo("Ford Maverick 2022", "Co-Pilot360 Assist"), } FW_QUERY_CONFIG = FwQueryConfig( @@ -85,10 +104,35 @@ FW_QUERY_CONFIG = FwQueryConfig( ) FW_VERSIONS = { + CAR.BRONCO_SPORT_MK1: { + (Ecu.eps, 0x730, None): [ + b'LX6C-14D003-AH\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', + b'LX6C-14D003-AK\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', + ], + (Ecu.abs, 0x760, None): [ + b'LX6C-2D053-RD\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', + b'LX6C-2D053-RE\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', + ], + (Ecu.fwdRadar, 0x764, None): [ + b'LB5T-14D049-AB\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', + ], + (Ecu.fwdCamera, 0x706, None): [ + b'M1PT-14F397-AC\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', + ], + (Ecu.engine, 0x7E0, None): [ + b'M1PA-14C204-GF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', + b'N1PA-14C204-AC\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', + ], + (Ecu.shiftByWire, 0x732, None): [ + b'LX6P-14G395-AD\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', + b'PZ1P-14G395-AB\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', + ], + }, CAR.ESCAPE_MK4: { (Ecu.eps, 0x730, None): [ b'LX6C-14D003-AF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', b'LX6C-14D003-AH\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', + b'LX6C-14D003-AL\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', ], (Ecu.abs, 0x760, None): [ b'LX6C-2D053-NS\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', @@ -106,10 +150,12 @@ FW_VERSIONS = { b'LX6A-14C204-BJV\x00\x00\x00\x00\x00\x00\x00\x00\x00', b'LX6A-14C204-ESG\x00\x00\x00\x00\x00\x00\x00\x00\x00', b'MX6A-14C204-BEF\x00\x00\x00\x00\x00\x00\x00\x00\x00', + b'NX6A-14C204-BLE\x00\x00\x00\x00\x00\x00\x00\x00\x00', ], (Ecu.shiftByWire, 0x732, None): [ b'LX6P-14G395-AB\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', b'LX6P-14G395-AD\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', + b'PZ1P-14G395-AC\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', ], }, CAR.EXPLORER_MK6: { @@ -119,6 +165,7 @@ FW_VERSIONS = { b'M1MC-14D003-AB\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', ], (Ecu.abs, 0x760, None): [ + b'L1MC-2D053-BA\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', b'L1MC-2D053-BB\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', b'L1MC-2D053-BF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', b'L1MC-2D053-KB\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', @@ -129,13 +176,17 @@ FW_VERSIONS = { (Ecu.fwdCamera, 0x706, None): [ b'LB5T-14F397-AE\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', b'LB5T-14F397-AF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', + b'LC5T-14F397-AH\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', ], (Ecu.engine, 0x7E0, None): [ + b'LB5A-14C204-BUJ\x00\x00\x00\x00\x00\x00\x00\x00\x00', b'LB5A-14C204-EAC\x00\x00\x00\x00\x00\x00\x00\x00\x00', b'MB5A-14C204-MD\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', + b'MB5A-14C204-RC\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', b'NB5A-14C204-HB\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', ], (Ecu.shiftByWire, 0x732, None): [ + b'L1MP-14C561-AB\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', b'L1MP-14G395-AD\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', b'L1MP-14G395-AE\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', b'L1MP-14G395-JB\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', @@ -160,4 +211,26 @@ FW_VERSIONS = { (Ecu.shiftByWire, 0x732, None): [ ], }, + CAR.MAVERICK_MK1: { + (Ecu.eps, 0x730, None): [ + b'NZ6C-14D003-AL\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', + ], + (Ecu.abs, 0x760, None): [ + b'NZ6C-2D053-AG\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', + ], + (Ecu.fwdRadar, 0x764, None): [ + b'NZ6T-14D049-AA\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', + ], + (Ecu.fwdCamera, 0x706, None): [ + b'NZ6T-14F397-AC\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', + ], + (Ecu.engine, 0x7E0, None): [ + b'NZ6A-14C204-AAA\x00\x00\x00\x00\x00\x00\x00\x00\x00', + b'NZ6A-14C204-PA\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', + b'NZ6A-14C204-ZA\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', + ], + (Ecu.shiftByWire, 0x732, None): [ + b'NZ6P-14G395-AD\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', + ], + }, } diff --git a/selfdrive/car/fw_query_definitions.py b/selfdrive/car/fw_query_definitions.py index c7e4d4eb3..dd3b19f6d 100755 --- a/selfdrive/car/fw_query_definitions.py +++ b/selfdrive/car/fw_query_definitions.py @@ -57,11 +57,16 @@ class Request: whitelist_ecus: List[int] = field(default_factory=list) rx_offset: int = 0x8 bus: int = 1 + # FW responses from these queries will not be used for fingerprinting + logging: bool = False + # These requests are done once OBD multiplexing is disabled, after all others + non_obd: bool = False @dataclass class FwQueryConfig: requests: List[Request] + # TODO: make this automatic and remove hardcoded lists, or do fingerprinting with ecus # Overrides and removes from essential ecus for specific models and ecus (exact matching) non_essential_ecus: Dict[capnp.lib.capnp._EnumModule, List[str]] = field(default_factory=dict) # Ecus added for data collection, not to be fingerprinted on diff --git a/selfdrive/car/fw_versions.py b/selfdrive/car/fw_versions.py index f4d92ab96..8092ac0b7 100755 --- a/selfdrive/car/fw_versions.py +++ b/selfdrive/car/fw_versions.py @@ -5,6 +5,7 @@ from tqdm import tqdm import panda.python.uds as uds from cereal import car +from common.params import Params from selfdrive.car.ecu_addrs import get_ecu_addrs from selfdrive.car.interfaces import get_interface_attr from selfdrive.car.fingerprints import FW_VERSIONS @@ -29,10 +30,9 @@ def chunks(l, n=128): def build_fw_dict(fw_versions, filter_brand=None): fw_versions_dict = defaultdict(set) for fw in fw_versions: - if filter_brand is None or fw.brand == filter_brand: - addr = fw.address + if (filter_brand is None or fw.brand == filter_brand) and not fw.logging: sub_addr = fw.subAddress if fw.subAddress != 0 else None - fw_versions_dict[(addr, sub_addr)].add(fw.fwVersion) + fw_versions_dict[(fw.address, sub_addr)].add(fw.fwVersion) return dict(fw_versions_dict) @@ -90,7 +90,7 @@ def match_fw_to_car_fuzzy(fw_versions_dict, log=True, exclude=None): return set() -def match_fw_to_car_exact(fw_versions_dict): +def match_fw_to_car_exact(fw_versions_dict) -> Set[str]: """Do an exact FW match. Returns all cars that match the given FW versions for a list of "essential" ECUs. If an ECU is not considered essential the FW version can be missing to get a fingerprint, but if it's present it @@ -146,12 +146,16 @@ def match_fw_to_car(fw_versions, allow_exact=True, allow_fuzzy=True): return True, set() -def get_present_ecus(logcan, sendcan): +def get_present_ecus(logcan, sendcan, num_pandas=1) -> Set[Tuple[int, Optional[int], int]]: queries = list() parallel_queries = list() responses = set() for brand, r in REQUESTS: + # Skip query if no panda available + if r.bus > num_pandas * 4 - 1: + continue + for brand_versions in VERSIONS[brand].values(): for ecu_type, addr, sub_addr in brand_versions: # Only query ecus in whitelist if whitelist is not empty @@ -171,7 +175,7 @@ def get_present_ecus(logcan, sendcan): queries.insert(0, parallel_queries) - ecu_responses: Set[Tuple[int, Optional[int], int]] = set() + ecu_responses = set() for query in queries: ecu_responses.update(get_ecu_addrs(logcan, sendcan, set(query), responses, timeout=0.1)) return ecu_responses @@ -194,11 +198,21 @@ def get_brand_ecu_matches(ecu_rx_addrs): return brand_matches +def disable_obd_multiplexing(params): + if not params.get_bool("ObdMultiplexingDisabled"): + params.put_bool("FirmwareObdQueryDone", True) + + cloudlog.warning("Waiting for OBD multiplexing to be disabled") + params.get_bool("ObdMultiplexingDisabled", block=True) + cloudlog.warning("OBD multiplexing disabled") + + def get_fw_versions_ordered(logcan, sendcan, ecu_rx_addrs, timeout=0.1, num_pandas=1, debug=False, progress=False): """Queries for FW versions ordering brands by likelihood, breaks when exact match is found""" all_car_fw = [] brand_matches = get_brand_ecu_matches(ecu_rx_addrs) + matched_brand: Optional[str] = None 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, num_pandas=num_pandas, debug=debug, progress=progress) @@ -206,12 +220,20 @@ def get_fw_versions_ordered(logcan, sendcan, ecu_rx_addrs, timeout=0.1, num_pand # Try to match using FW returned from this brand only matches = match_fw_to_car_exact(build_fw_dict(car_fw)) if len(matches) == 1: + matched_brand = brand break + disable_obd_multiplexing(Params()) + + # Do non-OBD queries for matched brand, or all if no match is found + for brand in FW_QUERY_CONFIGS.keys(): + if brand == matched_brand or matched_brand is None: + all_car_fw.extend(get_fw_versions(logcan, sendcan, query_brand=brand, timeout=timeout, num_pandas=num_pandas, obd_multiplexed=False, debug=debug, progress=progress)) + return all_car_fw -def get_fw_versions(logcan, sendcan, query_brand=None, extra=None, timeout=0.1, num_pandas=1, debug=False, progress=False): +def get_fw_versions(logcan, sendcan, query_brand=None, extra=None, timeout=0.1, num_pandas=1, obd_multiplexed=True, debug=False, progress=False): versions = VERSIONS.copy() # Each brand can define extra ECUs to query for data collection @@ -228,15 +250,19 @@ def get_fw_versions(logcan, sendcan, query_brand=None, extra=None, timeout=0.1, # ECUs using a subaddress need be queried one by one, the rest can be done in parallel addrs = [] parallel_addrs = [] + logging_addrs = [] ecu_types = {} for brand, brand_versions in versions.items(): - for c in brand_versions.values(): - for ecu_type, addr, sub_addr in c.keys(): + for candidate, ecu in brand_versions.items(): + for ecu_type, addr, sub_addr in ecu.keys(): a = (brand, addr, sub_addr) if a not in ecu_types: ecu_types[a] = ecu_type + if a not in logging_addrs and candidate == "debug": + logging_addrs.append(a) + if sub_addr is None: if a not in parallel_addrs: parallel_addrs.append(a) @@ -255,6 +281,9 @@ def get_fw_versions(logcan, sendcan, query_brand=None, extra=None, timeout=0.1, # Skip query if no panda available if r.bus > num_pandas * 4 - 1: continue + # Or if request is not designated for current multiplexing mode + elif r.non_obd == obd_multiplexed: + continue try: addrs = [(a, s) for (b, a, s) in addr_chunk if b in (brand, 'any') and @@ -265,13 +294,15 @@ def get_fw_versions(logcan, sendcan, query_brand=None, extra=None, timeout=0.1, for (tx_addr, sub_addr), version in query.get_data(timeout).items(): f = car.CarParams.CarFw.new_message() - f.ecu = ecu_types.get((brand, tx_addr, sub_addr), Ecu.unknown) + ecu_key = (brand, tx_addr, sub_addr) + f.ecu = ecu_types.get(ecu_key, Ecu.unknown) f.fwVersion = version f.address = tx_addr f.responseAddress = uds.get_rx_addr_for_tx_addr(tx_addr, r.rx_offset) f.request = r.request f.brand = brand f.bus = r.bus + f.logging = r.logging or ecu_key in logging_addrs if sub_addr is not None: f.subAddress = sub_addr diff --git a/selfdrive/car/gm/carcontroller.py b/selfdrive/car/gm/carcontroller.py index d380abf8e..2a996c0ff 100644 --- a/selfdrive/car/gm/carcontroller.py +++ b/selfdrive/car/gm/carcontroller.py @@ -3,7 +3,7 @@ from common.conversions import Conversions as CV from common.numpy_fast import interp from common.realtime import DT_CTRL from opendbc.can.packer import CANPacker -from selfdrive.car import apply_std_steer_torque_limits +from selfdrive.car import apply_driver_steer_torque_limits from selfdrive.car.gm import gmcan from selfdrive.car.gm.values import DBC, CanBus, CarControllerParams, CruiseButtons @@ -13,6 +13,8 @@ LongCtrlState = car.CarControl.Actuators.LongControlState # Camera cancels up to 0.1s after brake is pressed, ECM allows 0.5s CAMERA_CANCEL_DELAY_FRAMES = 10 +# Enforce a minimum interval between steering messages to avoid a fault +MIN_STEER_MSG_INTERVAL_MS = 15 class CarController: @@ -28,7 +30,6 @@ class CarController: self.cancel_counter = 0 self.lka_steering_cmd_counter = 0 - self.sent_lka_steering_cmd = False self.lka_icon_status_last = (False, False) self.params = CarControllerParams(self.CP) @@ -37,7 +38,7 @@ class CarController: self.packer_obj = CANPacker(DBC[self.CP.carFingerprint]['radar']) self.packer_ch = CANPacker(DBC[self.CP.carFingerprint]['chassis']) - def update(self, CC, CS): + def update(self, CC, CS, now_nanos): actuators = CC.actuators hud_control = CC.hudControl hud_alert = hud_control.visualAlert @@ -49,25 +50,30 @@ class CarController: can_sends = [] # Steering (Active: 50Hz, inactive: 10Hz) - # Attempt to sync with camera on startup at 50Hz, first few msgs are blocked - init_lka_counter = not self.sent_lka_steering_cmd and self.CP.networkLocation == NetworkLocation.fwdCamera - steer_step = self.params.INACTIVE_STEER_STEP - if CC.latActive or init_lka_counter: - steer_step = self.params.ACTIVE_STEER_STEP + steer_step = self.params.STEER_STEP if CC.latActive else self.params.INACTIVE_STEER_STEP - # Avoid GM EPS faults when transmitting messages too close together: skip this transmit if we just received the - # next Panda loopback confirmation in the current CS frame. - if CS.loopback_lka_steering_cmd_updated: - self.lka_steering_cmd_counter += 1 - self.sent_lka_steering_cmd = True - elif (self.frame - self.last_steer_frame) >= steer_step: + if self.CP.networkLocation == NetworkLocation.fwdCamera: + # Also send at 50Hz: + # - on startup, first few msgs are blocked + # - until we're in sync with camera so counters align when relay closes, preventing a fault. + # openpilot can subtly drift, so this is activated throughout a drive to stay synced + out_of_sync = self.lka_steering_cmd_counter % 4 != (CS.cam_lka_steering_cmd_counter + 1) % 4 + if CS.loopback_lka_steering_cmd_ts_nanos == 0 or out_of_sync: + steer_step = self.params.STEER_STEP + + self.lka_steering_cmd_counter += 1 if CS.loopback_lka_steering_cmd_updated else 0 + + # Avoid GM EPS faults when transmitting messages too close together: skip this transmit if we + # received the ASCMLKASteeringCmd loopback confirmation too recently + last_lka_steer_msg_ms = (now_nanos - CS.loopback_lka_steering_cmd_ts_nanos) * 1e-6 + if (self.frame - self.last_steer_frame) >= steer_step and last_lka_steer_msg_ms > MIN_STEER_MSG_INTERVAL_MS: # Initialize ASCMLKASteeringCmd counter using the camera until we get a msg on the bus - if init_lka_counter: - self.lka_steering_cmd_counter = CS.camera_lka_steering_cmd_counter + 1 + if CS.loopback_lka_steering_cmd_ts_nanos == 0: + self.lka_steering_cmd_counter = CS.pt_lka_steering_cmd_counter + 1 if CC.latActive: new_steer = int(round(actuators.steer * self.params.STEER_MAX)) - apply_steer = apply_std_steer_torque_limits(new_steer, self.apply_steer_last, CS.out.steeringTorque, self.params) + apply_steer = apply_driver_steer_torque_limits(new_steer, self.apply_steer_last, CS.out.steeringTorque, self.params) else: apply_steer = 0 @@ -109,7 +115,7 @@ class CarController: # Radar needs to know current speed and yaw rate (50hz), # and that ADAS is alive (10hz) - if not self.CP.radarOffCan: + if not self.CP.radarUnavailable: tt = self.frame * DT_CTRL time_and_headlights_step = 10 if self.frame % time_and_headlights_step == 0: diff --git a/selfdrive/car/gm/carstate.py b/selfdrive/car/gm/carstate.py index de0fd2eed..2f9c95287 100644 --- a/selfdrive/car/gm/carstate.py +++ b/selfdrive/car/gm/carstate.py @@ -17,8 +17,13 @@ class CarState(CarStateBase): super().__init__(CP) can_define = CANDefine(DBC[CP.carFingerprint]["pt"]) self.shifter_values = can_define.dv["ECMPRDNL2"]["PRNDL2"] + self.cluster_speed_hyst_gap = CV.KPH_TO_MS / 2. + self.cluster_min_speed = CV.KPH_TO_MS / 2. + self.loopback_lka_steering_cmd_updated = False - self.camera_lka_steering_cmd_counter = 0 + self.loopback_lka_steering_cmd_ts_nanos = 0 + self.pt_lka_steering_cmd_counter = 0 + self.cam_lka_steering_cmd_counter = 0 self.buttons_counter = 0 def update(self, pt_cp, cam_cp, loopback_cp): @@ -32,8 +37,11 @@ class CarState(CarStateBase): # Variables used for avoiding LKAS faults self.loopback_lka_steering_cmd_updated = len(loopback_cp.vl_all["ASCMLKASteeringCmd"]["RollingCounter"]) > 0 + if self.loopback_lka_steering_cmd_updated: + self.loopback_lka_steering_cmd_ts_nanos = loopback_cp.ts_nanos["ASCMLKASteeringCmd"]["RollingCounter"] if self.CP.networkLocation == NetworkLocation.fwdCamera: - self.camera_lka_steering_cmd_counter = cam_cp.vl["ASCMLKASteeringCmd"]["RollingCounter"] + self.pt_lka_steering_cmd_counter = pt_cp.vl["ASCMLKASteeringCmd"]["RollingCounter"] + self.cam_lka_steering_cmd_counter = cam_cp.vl["ASCMLKASteeringCmd"]["RollingCounter"] ret.wheelSpeeds = self.get_wheel_speeds( pt_cp.vl["EBCMWheelSpdFront"]["FLWheelSpd"], @@ -93,7 +101,8 @@ class CarState(CarStateBase): ret.parkingBrake = pt_cp.vl["VehicleIgnitionAlt"]["ParkBrake"] == 1 ret.cruiseState.available = pt_cp.vl["ECMEngineStatus"]["CruiseMainOn"] != 0 ret.espDisabled = pt_cp.vl["ESPStatus"]["TractionControlOn"] != 1 - ret.accFaulted = pt_cp.vl["AcceleratorPedal2"]["CruiseState"] == AccState.FAULTED + ret.accFaulted = (pt_cp.vl["AcceleratorPedal2"]["CruiseState"] == AccState.FAULTED or + pt_cp.vl["EBCMFrictionBrakeStatus"]["FrictionBrakeUnavailable"] == 1) ret.cruiseState.enabled = pt_cp.vl["AcceleratorPedal2"]["CruiseState"] != AccState.OFF ret.cruiseState.standstill = pt_cp.vl["AcceleratorPedal2"]["CruiseState"] == AccState.STANDSTILL @@ -148,6 +157,7 @@ class CarState(CarStateBase): ("RLWheelSpd", "EBCMWheelSpdRear"), ("RRWheelSpd", "EBCMWheelSpdRear"), ("MovingBackward", "EBCMWheelSpdRear"), + ("FrictionBrakeUnavailable", "EBCMFrictionBrakeStatus"), ("PRNDL2", "ECMPRDNL2"), ("ManualMode", "ECMPRDNL2"), ("LKADriverAppldTrq", "PSCMStatus"), @@ -173,6 +183,7 @@ class CarState(CarStateBase): ("VehicleIgnitionAlt", 10), ("EBCMWheelSpdFront", 20), ("EBCMWheelSpdRear", 20), + ("EBCMFrictionBrakeStatus", 20), ("AcceleratorPedal2", 33), ("ASCMSteeringButton", 33), ("ECMEngineStatus", 100), @@ -180,6 +191,15 @@ class CarState(CarStateBase): ("ECMAcceleratorPos", 80), ] + # Used to read back last counter sent to PT by camera + if CP.networkLocation == NetworkLocation.fwdCamera: + signals += [ + ("RollingCounter", "ASCMLKASteeringCmd"), + ] + checks += [ + ("ASCMLKASteeringCmd", 0), + ] + if CP.transmissionType == TransmissionType.direct: signals.append(("RegenPaddle", "EBCMRegenPaddle")) checks.append(("EBCMRegenPaddle", 50)) diff --git a/selfdrive/car/gm/interface.py b/selfdrive/car/gm/interface.py index 36ffafc92..cb72464ea 100755 --- a/selfdrive/car/gm/interface.py +++ b/selfdrive/car/gm/interface.py @@ -5,7 +5,8 @@ from panda import Panda from common.conversions import Conversions as CV from selfdrive.car import STD_CARGO_KG, create_button_event, scale_tire_stiffness, get_safety_config -from selfdrive.car.gm.values import CAR, CruiseButtons, CarControllerParams, EV_CAR, CAMERA_ACC_CAR +from selfdrive.car.gm.radar_interface import RADAR_HEADER_MSG +from selfdrive.car.gm.values import CAR, CruiseButtons, CarControllerParams, EV_CAR, CAMERA_ACC_CAR, CanBus from selfdrive.car.interfaces import CarInterfaceBase ButtonType = car.CarState.ButtonEvent.Type @@ -48,6 +49,7 @@ class CarInterface(CarInterfaceBase): ret.carName = "gm" ret.safetyConfigs = [get_safety_config(car.CarParams.SafetyModel.gm)] ret.autoResumeSng = False + use_off_car_defaults = len(fingerprint[0]) == 0 # Pick sensible carParams during offline doc generation/CI jobs if candidate in EV_CAR: ret.transmissionType = TransmissionType.direct @@ -63,47 +65,49 @@ class CarInterface(CarInterfaceBase): if candidate in CAMERA_ACC_CAR: ret.experimentalLongitudinalAvailable = True ret.networkLocation = NetworkLocation.fwdCamera - ret.radarOffCan = True # no radar + ret.radarUnavailable = True # no radar ret.pcmCruise = True ret.safetyConfigs[0].safetyParam |= Panda.FLAG_GM_HW_CAM ret.minEnableSpeed = 5 * CV.KPH_TO_MS + ret.minSteerSpeed = 10 * CV.KPH_TO_MS + + # Tuning for experimental long + ret.longitudinalTuning.kpV = [2.0, 1.5] + ret.longitudinalTuning.kiV = [0.72] + ret.stopAccel = -2.0 + ret.stoppingDecelRate = 2.0 # reach brake quickly after enabling + ret.vEgoStopping = 0.25 + ret.vEgoStarting = 0.25 + ret.longitudinalActuatorDelayUpperBound = 0.5 if experimental_long: ret.pcmCruise = False ret.openpilotLongitudinalControl = True ret.safetyConfigs[0].safetyParam |= Panda.FLAG_GM_HW_CAM_LONG - # Tuning - ret.longitudinalTuning.kpV = [2.0, 1.5] - ret.longitudinalTuning.kiV = [0.72] - ret.stopAccel = -2.0 - ret.stoppingDecelRate = 2.0 # reach brake quickly after enabling - ret.vEgoStopping = 0.25 - ret.vEgoStarting = 0.25 - ret.longitudinalActuatorDelayUpperBound = 0.5 - else: # ASCM, OBD-II harness ret.openpilotLongitudinalControl = True ret.networkLocation = NetworkLocation.gateway - ret.radarOffCan = False + ret.radarUnavailable = RADAR_HEADER_MSG not in fingerprint[CanBus.OBSTACLE] and not use_off_car_defaults ret.pcmCruise = False # stock non-adaptive cruise control is kept off # supports stop and go, but initial engage must (conservatively) be above 18mph ret.minEnableSpeed = 18 * CV.MPH_TO_MS + ret.minSteerSpeed = 7 * CV.MPH_TO_MS # Tuning ret.longitudinalTuning.kpV = [2.4, 1.5] ret.longitudinalTuning.kiV = [0.36] - CarInterfaceBase.configure_dp_tune(candidate, ret.lateralTuning) + CarInterfaceBase.dp_lat_tune_collection(candidate, ret.latTuneCollection) + CarInterfaceBase.configure_dp_tune(ret.lateralTuning, ret.latTuneCollection) # These cars have been put into dashcam only due to both a lack of users and test coverage. # These cars likely still work fine. Once a user confirms each car works and a test route is # added to selfdrive/car/tests/routes.py, we can remove it from this list. - ret.dashcamOnly = candidate in {CAR.CADILLAC_ATS, CAR.HOLDEN_ASTRA, CAR.MALIBU, CAR.BUICK_REGAL, CAR.EQUINOX} + ret.dashcamOnly = candidate in {CAR.CADILLAC_ATS, CAR.HOLDEN_ASTRA, CAR.MALIBU, CAR.BUICK_REGAL, CAR.EQUINOX} or \ + (ret.networkLocation == NetworkLocation.gateway and ret.radarUnavailable) # Start with a baseline tuning for all GM vehicles. Override tuning as needed in each model section below. - # Some GMs need some tolerance above 10 kph to avoid a fault - ret.minSteerSpeed = 10.1 * CV.KPH_TO_MS ret.lateralTuning.pid.kiBP, ret.lateralTuning.pid.kpBP = [[0.], [0.]] ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.2], [0.00]] ret.lateralTuning.pid.kf = 0.00004 # full torque for 20 deg at 80mph means 0.00007818594 @@ -161,6 +165,15 @@ class CarInterface(CarInterfaceBase): ret.steerRatio = 15.3 ret.centerToFront = ret.wheelbase * 0.5 + elif candidate == CAR.ESCALADE: + ret.minEnableSpeed = -1. # engage speed is decided by pcm + ret.mass = 5653. * CV.LB_TO_KG + STD_CARGO_KG # (5552+5815)/2 + ret.wheelbase = 2.95 # 116 inches in meters + ret.steerRatio = 17.3 + ret.centerToFront = ret.wheelbase * 0.5 + ret.longitudinalActuatorDelayUpperBound = 0.5 # large delay to initially start braking + CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning) + elif candidate == CAR.ESCALADE_ESV: ret.minEnableSpeed = -1. # engage speed is decided by pcm ret.mass = 2739. + STD_CARGO_KG @@ -176,7 +189,7 @@ class CarInterface(CarInterfaceBase): ret.mass = 1669. + STD_CARGO_KG ret.wheelbase = 2.63779 ret.steerRatio = 16.8 - ret.centerToFront = 2.15 # measured + ret.centerToFront = ret.wheelbase * 0.4 tire_stiffness_factor = 1.0 ret.steerActuatorDelay = 0.2 CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning) @@ -196,6 +209,18 @@ class CarInterface(CarInterfaceBase): ret.centerToFront = ret.wheelbase * 0.4 CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning) + elif candidate == CAR.TRAILBLAZER: + ret.mass = 1365. + STD_CARGO_KG + ret.wheelbase = 2.64 + ret.steerRatio = 16.5 + ret.centerToFront = ret.wheelbase * 0.38 # FIXME: Need to tune more. + tire_stiffness_factor = 1.0 + ret.steerActuatorDelay = 0.18 + ret.minSteerSpeed = -1. + ret.minEnableSpeed = -1. # engage speed is decided by pcm + ret.autoResumeSng = True + CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning) + # TODO: start from empirically derived lateral slip stiffness for the civic and scale by # mass and CG position, so all cars will have approximately similar dyn behaviors ret.tireStiffnessFront, ret.tireStiffnessRear = scale_tire_stiffness(ret.mass, ret.wheelbase, ret.centerToFront, @@ -238,5 +263,5 @@ class CarInterface(CarInterfaceBase): return ret - def apply(self, c): - return self.CC.update(c, self.CS) + def apply(self, c, now_nanos): + return self.CC.update(c, self.CS, now_nanos) diff --git a/selfdrive/car/gm/radar_interface.py b/selfdrive/car/gm/radar_interface.py index 6904e6f89..b86a85f91 100755 --- a/selfdrive/car/gm/radar_interface.py +++ b/selfdrive/car/gm/radar_interface.py @@ -3,7 +3,7 @@ import math from cereal import car from common.conversions import Conversions as CV from opendbc.can.parser import CANParser -from selfdrive.car.gm.values import DBC, CAR, CanBus +from selfdrive.car.gm.values import DBC, CanBus from selfdrive.car.interfaces import RadarInterfaceBase RADAR_HEADER_MSG = 1120 @@ -16,9 +16,6 @@ LAST_RADAR_MSG = RADAR_HEADER_MSG + NUM_SLOTS def create_radar_can_parser(car_fingerprint): - if car_fingerprint not in (CAR.VOLT, CAR.MALIBU, CAR.HOLDEN_ASTRA, CAR.ACADIA, CAR.CADILLAC_ATS, CAR.ESCALADE_ESV): - return None - # C1A-ARS3-A by Continental radar_targets = list(range(SLOT_1_MSG, SLOT_1_MSG + NUM_SLOTS)) signals = list(zip(['FLRRNumValidTargets', @@ -34,11 +31,12 @@ def create_radar_can_parser(car_fingerprint): return CANParser(DBC[car_fingerprint]['radar'], signals, checks, CanBus.OBSTACLE) + class RadarInterface(RadarInterfaceBase): def __init__(self, CP): super().__init__(CP) - self.rcp = create_radar_can_parser(CP.carFingerprint) + self.rcp = None if CP.radarUnavailable else create_radar_can_parser(CP.carFingerprint) self.trigger_msg = LAST_RADAR_MSG self.updated_messages = set() diff --git a/selfdrive/car/gm/values.py b/selfdrive/car/gm/values.py index 84fa36a99..954f41d25 100644 --- a/selfdrive/car/gm/values.py +++ b/selfdrive/car/gm/values.py @@ -11,10 +11,10 @@ Ecu = car.CarParams.Ecu class CarControllerParams: STEER_MAX = 300 # GM limit is 3Nm. Used by carcontroller to generate LKA output - ACTIVE_STEER_STEP = 2 # Active control frames per command (50hz) + STEER_STEP = 3 # Active control frames per command (~33hz) INACTIVE_STEER_STEP = 10 # Inactive control frames per command (10hz) - STEER_DELTA_UP = 7 # Delta rates require review due to observed EPS weakness - STEER_DELTA_DOWN = 17 + STEER_DELTA_UP = 10 # Delta rates require review due to observed EPS weakness + STEER_DELTA_DOWN = 25 STEER_DRIVER_ALLOWANCE = 50 STEER_DRIVER_MULTIPLIER = 4 STEER_DRIVER_FACTOR = 100 @@ -67,15 +67,17 @@ class CAR: MALIBU = "CHEVROLET MALIBU PREMIER 2017" ACADIA = "GMC ACADIA DENALI 2018" BUICK_REGAL = "BUICK REGAL ESSENCE 2018" + ESCALADE = "CADILLAC ESCALADE 2017" ESCALADE_ESV = "CADILLAC ESCALADE ESV 2016" BOLT_EUV = "CHEVROLET BOLT EUV 2022" SILVERADO = "CHEVROLET SILVERADO 1500 2020" EQUINOX = "CHEVROLET EQUINOX 2019" + TRAILBLAZER = "CHEVROLET TRAILBLAZER 2022" class Footnote(Enum): OBD_II = CarFootnote( - 'Requires a community built ASCM harness. ' + + 'Requires a community built ASCM harness. ' + 'NOTE: disconnecting the ASCM disables Automatic Emergency Braking (AEB).', Column.MODEL) @@ -99,6 +101,7 @@ CAR_INFO: Dict[str, Union[GMCarInfo, List[GMCarInfo]]] = { CAR.MALIBU: GMCarInfo("Chevrolet Malibu Premier 2017"), CAR.ACADIA: GMCarInfo("GMC Acadia 2018", video_link="https://www.youtube.com/watch?v=0ZN6DdsBUZo"), CAR.BUICK_REGAL: GMCarInfo("Buick Regal Essence 2018"), + CAR.ESCALADE: GMCarInfo("Cadillac Escalade 2017", "Driver Assist Package"), CAR.ESCALADE_ESV: GMCarInfo("Cadillac Escalade ESV 2016", "Adaptive Cruise Control (ACC) & LKAS"), CAR.BOLT_EUV: [ GMCarInfo("Chevrolet Bolt EUV 2022-23", "Premier or Premier Redline Trim without Super Cruise Package", "https://youtu.be/xvwzGMUA210"), @@ -109,6 +112,9 @@ CAR_INFO: Dict[str, Union[GMCarInfo, List[GMCarInfo]]] = { GMCarInfo("GMC Sierra 1500 2020-21", "Driver Alert Package II", "https://youtu.be/5HbNoBLzRwE"), ], CAR.EQUINOX: GMCarInfo("Chevrolet Equinox 2019-22"), + CAR.TRAILBLAZER: [ + GMCarInfo("Chevrolet Trailblazer 2022", "RS Trim with Adaptive Cruise Control Package"), + ], } @@ -149,6 +155,10 @@ FINGERPRINTS = { # Volt Premier w/ ACC 2018 { 170: 8, 171: 8, 189: 7, 190: 6, 193: 8, 197: 8, 199: 4, 201: 8, 209: 7, 211: 2, 241: 6, 288: 5, 298: 8, 304: 1, 308: 4, 309: 8, 311: 8, 313: 8, 320: 3, 328: 1, 352: 5, 381: 6, 384: 4, 386: 8, 388: 8, 389: 2, 390: 7, 417: 7, 419: 1, 426: 7, 451: 8, 452: 8, 453: 6, 454: 8, 456: 8, 479: 3, 481: 7, 485: 8, 489: 8, 493: 8, 495: 4, 497: 8, 499: 3, 500: 6, 501: 8, 508: 8, 528: 4, 532: 6, 546: 7, 550: 8, 554: 3, 558: 8, 560: 8, 562: 8, 563: 5, 564: 5, 565: 5, 566: 5, 567: 3, 568: 1, 573: 1, 577: 8, 578: 8, 608: 8, 609: 6, 610: 6, 611: 6, 612: 8, 613: 8, 647: 3, 707: 8, 711: 6, 715: 8, 717: 5, 761: 7, 810: 8, 840: 5, 842: 5, 844: 8, 866: 4, 869: 4, 880: 6, 961: 8, 967: 4, 969: 8, 977: 8, 979: 7, 988: 6, 989: 8, 995: 7, 1001: 8, 1005: 6, 1009: 8, 1017: 8, 1019: 2, 1020: 8, 1033: 7, 1034: 7, 1105: 6, 1187: 4, 1217: 8, 1221: 5, 1223: 3, 1225: 7, 1227: 4, 1233: 8, 1249: 8, 1257: 6, 1265: 8, 1267: 1, 1273: 3, 1275: 3, 1280: 4, 1296: 4, 1300: 8, 1322: 6, 1323: 4, 1328: 4, 1417: 8, 1516: 8, 1601: 8, 1618: 8, 1905: 7, 1906: 7, 1907: 7, 1910: 7, 1912: 7, 1922: 7, 1927: 7, 1930: 7, 2016: 8, 2018: 8, 2020: 8, 2024: 8, 2028: 8 + }, + # Volt Premier 2018 w/ flashed firmware, no radar + { + 170: 8, 171: 8, 189: 7, 190: 6, 192: 5, 193: 8, 197: 8, 199: 4, 201: 6, 209: 7, 211: 2, 241: 6, 288: 5, 289: 1, 290: 1, 298: 2, 304: 1, 308: 4, 309: 8, 311: 8, 313: 8, 320: 3, 328: 1, 352: 5, 368: 8, 381: 2, 384: 8, 386: 5, 388: 8, 389: 2, 390: 7, 417: 7, 419: 1, 426: 7, 451: 8, 452: 8, 453: 6, 454: 8, 456: 8, 458: 8, 479: 3, 481: 7, 485: 8, 489: 5, 493: 8, 495: 4, 497: 8, 499: 3, 500: 6, 501: 3, 508: 8, 512: 3, 528: 4, 530: 8, 532: 6, 537: 5, 539: 8, 542: 7, 546: 7, 550: 8, 554: 3, 558: 8, 560: 6, 562: 4, 563: 5, 564: 5, 565: 5, 566: 5, 567: 3, 568: 1, 573: 1, 608: 8, 609: 6, 610: 6, 611: 6, 612: 8, 613: 8, 647: 3, 707: 8, 711: 6, 761: 7, 810: 8, 821: 4, 823: 7, 832: 8, 840: 5, 842: 5, 844: 8, 853: 8, 866: 4, 961: 8, 967: 4, 969: 8, 977: 8, 979: 7, 988: 6, 989: 8, 995: 7, 1001: 5, 1003: 5, 1005: 6, 1009: 8, 1017: 8, 1019: 2, 1020: 8, 1033: 7, 1034: 7, 1105: 6, 1187: 4, 1217: 8, 1221: 5, 1223: 3, 1225: 7, 1227: 4, 1233: 8, 1249: 8, 1257: 6, 1265: 8, 1267: 1, 1273: 3, 1275: 3, 1280: 4, 1300: 8, 1322: 6, 1323: 4, 1328: 4, 1417: 8, 1905: 7, 1906: 7, 1907: 7, 1910: 7, 1912: 7, 1922: 7, 1927: 7 }], CAR.BUICK_REGAL : [ # Regal TourX Essence w/ ACC 2018 @@ -174,6 +184,10 @@ FINGERPRINTS = { { 190: 6, 193: 8, 197: 8, 199: 4, 201: 8, 208: 8, 209: 7, 211: 2, 241: 6, 249: 8, 288: 5, 289: 8, 298: 8, 304: 1, 309: 8, 313: 8, 320: 3, 322: 7, 328: 1, 338: 6, 340: 6, 352: 5, 381: 8, 384: 4, 386: 8, 388: 8, 393: 8, 398: 8, 413: 8, 417: 7, 419: 1, 422: 4, 426: 7, 431: 8, 442: 8, 451: 8, 452: 8, 453: 6, 454: 8, 455: 7, 462: 4, 463: 3, 479: 3, 481: 7, 485: 8, 489: 8, 497: 8, 499: 3, 500: 6, 501: 8, 508: 8, 510: 8, 532: 6, 554: 3, 560: 8, 562: 8, 563: 5, 564: 5, 567: 5, 573: 1, 577: 8, 608: 8, 609: 6, 610: 6, 611: 6, 612: 8, 613: 8, 647: 6, 707: 8, 715: 8, 717: 5, 753: 5, 761: 7, 840: 5, 842: 5, 844: 8, 866: 4, 869: 4, 880: 6, 961: 8, 969: 8, 977: 8, 979: 8, 985: 5, 1001: 8, 1005: 6, 1009: 8, 1017: 8, 1020: 8, 1033: 7, 1034: 7, 1105: 6, 1217: 8, 1221: 5, 1225: 8, 1233: 8, 1249: 8, 1257: 6, 1265: 8, 1267: 1, 1280: 4, 1296: 4, 1300: 8, 1322: 6, 1328: 4, 1417: 8, 1601: 8, 1906: 7, 1907: 7, 1912: 7, 1914: 7, 1919: 7, 1920: 7, 1930: 7, 2016: 8, 2024: 8 }], + CAR.ESCALADE: [ + { + 170: 8, 190: 6, 193: 8, 197: 8, 199: 4, 201: 8, 208: 8, 209: 7, 211: 2, 241: 6, 249: 8, 288: 5, 298: 8, 304: 1, 309: 8, 311: 8, 313: 8, 320: 3, 322: 7, 328: 1, 352: 5, 381: 6, 384: 4, 386: 8, 388: 8, 393: 7, 398: 8, 407: 4, 413: 8, 417: 7, 419: 1, 422: 4, 426: 7, 431: 8, 442: 8, 451: 8, 452: 8, 453: 6, 454: 8, 455: 7, 460: 5, 462: 4, 463: 3, 479: 3, 481: 7, 485: 8, 487: 8, 489: 8, 497: 8, 499: 3, 500: 6, 501: 8, 508: 8, 510: 8, 532: 6, 534: 2, 554: 3, 560: 8, 562: 8, 563: 5, 564: 5, 573: 1, 608: 8, 609: 6, 610: 6, 611: 6, 612: 8, 613: 8, 647: 6, 707: 8, 715: 8, 717: 5, 719: 5, 761: 7, 801: 8, 804: 3, 810: 8, 840: 5, 842: 5, 844: 8, 866: 4, 869: 4, 880: 6, 961: 8, 967: 4, 969: 8, 977: 8, 979: 8, 985: 5, 1001: 8, 1005: 6, 1009: 8, 1017: 8, 1019: 2, 1020: 8, 1033: 7, 1034: 7, 1105: 6, 1217: 8, 1221: 5, 1223: 2, 1225: 7, 1233: 8, 1249: 8, 1257: 6, 1265: 8, 1267: 1, 1280: 4, 1296: 4, 1300: 8, 1322: 6, 1323: 4, 1328: 4, 1417: 8, 1609: 8, 1613: 8, 1649: 8, 1792: 8, 1798: 8, 1824: 8, 1825: 8, 1840: 8, 1842: 8, 1858: 8, 1860: 8, 1863: 8, 1872: 8, 1875: 8, 1882: 8, 1888: 8, 1889: 8, 1892: 8, 1906: 7, 1907: 7, 1912: 7, 1914: 7, 1917: 7, 1918: 7, 1919: 7, 1920: 7, 1930: 7, 1937: 8, 1953: 8, 1968: 8, 2001: 8, 2017: 8, 2018: 8, 2020: 8, 2026: 8 + }], CAR.ESCALADE_ESV: [ { 309: 1, 848: 8, 849: 8, 850: 8, 851: 8, 852: 8, 853: 8, 854: 3, 1056: 6, 1057: 8, 1058: 8, 1059: 8, 1060: 8, 1061: 8, 1062: 8, 1063: 8, 1064: 8, 1065: 8, 1066: 8, 1067: 8, 1068: 8, 1120: 8, 1121: 8, 1122: 8, 1123: 8, 1124: 8, 1125: 8, 1126: 8, 1127: 8, 1128: 8, 1129: 8, 1130: 8, 1131: 8, 1132: 8, 1133: 8, 1134: 8, 1135: 8, 1136: 8, 1137: 8, 1138: 8, 1139: 8, 1140: 8, 1141: 8, 1142: 8, 1143: 8, 1146: 8, 1147: 8, 1148: 8, 1149: 8, 1150: 8, 1151: 8, 1216: 8, 1217: 8, 1218: 8, 1219: 8, 1220: 8, 1221: 8, 1222: 8, 1223: 8, 1224: 8, 1225: 8, 1226: 8, 1232: 8, 1233: 8, 1234: 8, 1235: 8, 1236: 8, 1237: 8, 1238: 8, 1239: 8, 1240: 8, 1241: 8, 1242: 8, 1787: 8, 1788: 8 @@ -190,6 +204,9 @@ FINGERPRINTS = { { 190: 6, 193: 8, 197: 8, 201: 8, 209: 7, 211: 2, 241: 6, 249: 8, 257: 8, 288: 5, 289: 8, 298: 8, 304: 1, 309: 8, 311: 8, 313: 8, 320: 3, 328: 1, 352: 5, 381: 8, 384: 4, 386: 8, 388: 8, 413: 8, 451: 8, 452: 8, 453: 6, 455: 7, 463: 3, 479: 3, 481: 7, 485: 8, 489: 8, 497: 8, 500: 6, 501: 8, 510: 8, 528: 5, 532: 6, 560: 8, 562: 8, 563: 5, 565: 5, 608: 8, 609: 6, 610: 6, 611: 6, 612: 8, 613: 8, 707: 8, 715: 8, 717: 5, 753: 5, 761: 7, 789: 5, 800: 6, 810: 8, 840: 5, 842: 5, 844: 8, 869: 4, 880: 6, 977: 8, 1001: 8, 1011: 6, 1017: 8, 1020: 8, 1033: 7, 1034: 7, 1217: 8, 1221: 5, 1233: 8, 1249: 8, 1259: 8, 1261: 7, 1263: 4, 1265: 8, 1267: 1, 1271: 8, 1280: 4, 1296: 4, 1300: 8, 1930: 7 }], + CAR.TRAILBLAZER: [{ + 190: 6, 193: 8, 197: 8, 201: 8, 209: 7, 211: 2, 241: 6, 249: 8, 288: 5, 289: 8, 298: 8, 304: 3, 309: 8, 311: 8, 313: 8, 320: 4, 328: 1, 352: 5, 381: 8, 384: 4, 386: 8, 388: 8, 413: 8, 451: 8, 452: 8, 453: 6, 455: 7, 479: 3, 481: 7, 485: 8, 489: 8, 497: 8, 500: 6, 501: 8, 532: 6, 560: 8, 562: 8, 563: 5, 565: 5, 707: 8, 715: 8, 717: 5, 761: 7, 789: 5, 800: 6, 810: 8, 840: 5, 842: 5, 844: 8, 869: 4, 880: 6, 977: 8, 1001: 8, 1011: 6, 1017: 8, 1020: 8, 1217: 8, 1221: 5, 1233: 8, 1249: 8, 1259: 8, 1261: 7, 1263: 4, 1265: 8, 1267: 1, 1271: 8, 1280: 4, 1296: 4, 1300: 8, 1930: 7 + }], } DBC: Dict[str, Dict[str, str]] = defaultdict(lambda: dbc_dict('gm_global_a_powertrain_generated', 'gm_global_a_object', chassis_dbc='gm_global_a_chassis')) @@ -197,6 +214,6 @@ DBC: Dict[str, Dict[str, str]] = defaultdict(lambda: dbc_dict('gm_global_a_power EV_CAR = {CAR.VOLT, CAR.BOLT_EUV} # We're integrated at the camera with VOACC on these cars (instead of ASCM w/ OBD-II harness) -CAMERA_ACC_CAR = {CAR.BOLT_EUV, CAR.SILVERADO, CAR.EQUINOX} +CAMERA_ACC_CAR = {CAR.BOLT_EUV, CAR.SILVERADO, CAR.EQUINOX, CAR.TRAILBLAZER} STEER_THRESHOLD = 1.0 diff --git a/selfdrive/car/honda/carcontroller.py b/selfdrive/car/honda/carcontroller.py index 9ea38b01a..8e659e988 100644 --- a/selfdrive/car/honda/carcontroller.py +++ b/selfdrive/car/honda/carcontroller.py @@ -7,7 +7,7 @@ from common.realtime import DT_CTRL from opendbc.can.packer import CANPacker from selfdrive.car import create_gas_interceptor_command from selfdrive.car.honda import hondacan -from selfdrive.car.honda.values import CruiseButtons, VISUAL_HUD, HONDA_BOSCH, HONDA_BOSCH_RADARLESS, HONDA_NIDEC_ALT_PCM_ACCEL, CarControllerParams +from selfdrive.car.honda.values import CruiseButtons, VISUAL_HUD, HONDA_BOSCH, HONDA_BOSCH_RADARLESS, HONDA_NIDEC_ALT_PCM_ACCEL, CarControllerParams, CAR from selfdrive.controls.lib.drive_helpers import rate_limit VisualAlert = car.CarControl.HUDControl.VisualAlert @@ -124,7 +124,7 @@ class CarController: self.brake = 0.0 self.last_steer = 0.0 - def update(self, CC, CS, dragonconf): + def update(self, CC, CS, now_nanos, dragonconf): actuators = CC.actuators hud_control = CC.hudControl hud_v_cruise = hud_control.setSpeed * CV.MS_TO_KPH if hud_control.speedVisible else 255 @@ -223,6 +223,8 @@ class CarController: apply_brake = clip(self.brake_last - wind_brake, 0.0, 1.0) apply_brake = int(clip(apply_brake * self.params.NIDEC_BRAKE_MAX, 0, self.params.NIDEC_BRAKE_MAX - 1)) pump_on, self.last_pump_ts = brake_pump_hysteresis(apply_brake, self.apply_brake_last, self.last_pump_ts, ts) + if self.CP.carFingerprint == CAR.ODYSSEY_HYBRID: + pump_on = True pcm_override = True can_sends.append(hondacan.create_brake_command(self.packer, apply_brake, pump_on, diff --git a/selfdrive/car/honda/carstate.py b/selfdrive/car/honda/carstate.py index f07ad6afc..c33d0863f 100644 --- a/selfdrive/car/honda/carstate.py +++ b/selfdrive/car/honda/carstate.py @@ -59,7 +59,7 @@ def get_can_signals(CP, gearbox_msg, main_on_sig_msg): ("STEER_MOTOR_TORQUE", 0), # TODO: not on every car ] - if CP.carFingerprint == CAR.ODYSSEY_CHN: + if CP.carFingerprint in (CAR.ODYSSEY_CHN, CAR.ODYSSEY_HYBRID): checks += [ ("SCM_FEEDBACK", 25), ("SCM_BUTTONS", 50), @@ -79,7 +79,7 @@ def get_can_signals(CP, gearbox_msg, main_on_sig_msg): signals.append(("BRAKE_PRESSED", "BRAKE_MODULE")) checks.append(("BRAKE_MODULE", 50)) - if CP.carFingerprint in (HONDA_BOSCH | {CAR.CIVIC, CAR.ODYSSEY, CAR.ODYSSEY_CHN}): + if CP.carFingerprint in (HONDA_BOSCH | {CAR.CIVIC, CAR.ODYSSEY, CAR.ODYSSEY_CHN, CAR.ODYSSEY_HYBRID}): signals.append(("EPB_STATE", "EPB_STATUS")) checks.append(("EPB_STATUS", 50)) @@ -102,7 +102,7 @@ def get_can_signals(CP, gearbox_msg, main_on_sig_msg): signals += [("CRUISE_SPEED_PCM", "CRUISE"), ("CRUISE_SPEED_OFFSET", "CRUISE_PARAMS")] - if CP.carFingerprint == CAR.ODYSSEY_CHN: + if CP.carFingerprint in (CAR.ODYSSEY_CHN, CAR.ODYSSEY_HYBRID): checks.append(("CRUISE_PARAMS", 10)) else: checks.append(("CRUISE_PARAMS", 50)) @@ -125,11 +125,18 @@ def get_can_signals(CP, gearbox_msg, main_on_sig_msg): checks.append(("GAS_SENSOR", 50)) if CP.openpilotLongitudinalControl: - signals += [ - ("BRAKE_ERROR_1", "STANDSTILL"), - ("BRAKE_ERROR_2", "STANDSTILL") - ] - checks.append(("STANDSTILL", 50)) + if CP.carFingerprint in (CAR.ODYSSEY_HYBRID,): + signals += [ + ("BRAKE_ERROR_1", "BRAKE_ERROR"), + ("BRAKE_ERROR_2", "BRAKE_ERROR") + ] + checks.append(("BRAKE_ERROR", 100)) + else: + signals += [ + ("BRAKE_ERROR_1", "STANDSTILL"), + ("BRAKE_ERROR_2", "STANDSTILL") + ] + checks.append(("STANDSTILL", 50)) return signals, checks @@ -197,7 +204,10 @@ class CarState(CarStateBase): ret.steerFaultTemporary = steer_status not in ("NORMAL", "LOW_SPEED_LOCKOUT", "NO_TORQUE_ALERT_2") if self.CP.openpilotLongitudinalControl: - self.brake_error = cp.vl["STANDSTILL"]["BRAKE_ERROR_1"] or cp.vl["STANDSTILL"]["BRAKE_ERROR_2"] + if self.CP.carFingerprint in (CAR.ODYSSEY_HYBRID,): + self.brake_error = cp.vl["BRAKE_ERROR"]["BRAKE_ERROR_1"] or cp.vl["BRAKE_ERROR"]["BRAKE_ERROR_2"] + else: + self.brake_error = cp.vl["STANDSTILL"]["BRAKE_ERROR_1"] or cp.vl["STANDSTILL"]["BRAKE_ERROR_2"] ret.espDisabled = cp.vl["VSA_STATUS"]["ESP_DISABLED"] != 0 ret.wheelSpeeds = self.get_wheel_speeds( @@ -228,7 +238,7 @@ class CarState(CarStateBase): self.engineRPM = cp.vl["POWERTRAIN_DATA"]['ENGINE_RPM'] # TODO: set for all cars - if self.CP.carFingerprint in (HONDA_BOSCH | {CAR.CIVIC, CAR.ODYSSEY, CAR.ODYSSEY_CHN}): + if self.CP.carFingerprint in (HONDA_BOSCH | {CAR.CIVIC, CAR.ODYSSEY, CAR.ODYSSEY_CHN, CAR.ODYSSEY_HYBRID}): ret.parkingBrake = cp.vl["EPB_STATUS"]["EPB_STATE"] != 0 gear = int(cp.vl[self.gearbox_msg]["GEAR_SHIFTER"]) @@ -281,18 +291,14 @@ class CarState(CarStateBase): ret.cruiseState.available = bool(cp.vl[self.main_on_sig_msg]["MAIN_ON"]) # Gets rid of Pedal Grinding noise when brake is pressed at slow speeds for some models - if self.CP.carFingerprint in (CAR.PILOT, CAR.PASSPORT, CAR.RIDGELINE): + if self.CP.carFingerprint in (CAR.PILOT, CAR.RIDGELINE): if ret.brake > 0.1: ret.brakePressed = True - if self.CP.carFingerprint in (CAR.CIVIC, CAR.ODYSSEY, CAR.ODYSSEY_CHN, CAR.CRV_5G, CAR.ACCORD, CAR.ACCORDH, CAR.CIVIC_BOSCH, - CAR.CIVIC_BOSCH_DIESEL, CAR.CRV_HYBRID, CAR.INSIGHT, CAR.ACURA_RDX_3G, CAR.HONDA_E): - ret.brakeLightsDEPRECATED = bool(ret.brakePressed or cp.vl["ACC_CONTROL"]['BRAKE_LIGHTS'] != 0 or ret.brake > 0.4 or ret.parkingBrake) if not self.CP.openpilotLongitudinalControl else \ - bool(ret.brakePressed or ret.brake > 0.4 or ret.parkingBrake) - elif self.CP.carFingerprint in HONDA_BOSCH and self.CP.carFingerprint not in (CAR.CIVIC, CAR.ODYSSEY, CAR.ODYSSEY_CHN, CAR.CRV_5G, CAR.ACCORD, CAR.ACCORDH, CAR.CIVIC_BOSCH, - CAR.CIVIC_BOSCH_DIESEL, CAR.CRV_HYBRID, CAR.INSIGHT, CAR.ACURA_RDX_3G, CAR.HONDA_E) and self.CP.carFingerprint not in HONDA_BOSCH_RADARLESS: - ret.brakeLightsDEPRECATED = bool(ret.brakePressed or cp.vl["ACC_CONTROL"]['BRAKE_LIGHTS'] != 0 or ret.brake > 0.4) if not self.CP.openpilotLongitudinalControl else \ - bool(ret.brakePressed or ret.brake > 0.4) + if self.CP.carFingerprint in HONDA_BOSCH and self.CP.carFingerprint not in HONDA_BOSCH_RADARLESS: + ret.brakeLightsDEPRECATED = bool(ret.brakePressed or ret.brake > 0.4 or ret.parkingBrake) + if not self.CP.openpilotLongitudinalControl: + ret.brakeLightsDEPRECATED = ret.brakeLightsDEPRECATED or cp.vl["ACC_CONTROL"]['BRAKE_LIGHTS'] != 0 else: ret.brakeLightsDEPRECATED = bool(ret.brakePressed) @@ -318,7 +324,6 @@ class CarState(CarStateBase): ret.leftBlindspot = cp_body.vl["BSM_STATUS_LEFT"]["BSM_ALERT"] == 1 ret.rightBlindspot = cp_body.vl["BSM_STATUS_RIGHT"]["BSM_ALERT"] == 1 - ret.cruiseActualEnabled = ret.cruiseState.enabled return ret def get_can_parser(self, CP): diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py index 686119815..17681444a 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -111,7 +111,7 @@ def create_ui_commands(packer, CP, enabled, pcm_speed, hud, is_metric, acc_hud, if CP.openpilotLongitudinalControl: acc_hud_values = { 'CRUISE_SPEED': hud.v_cruise, - 'ENABLE_MINI_CAR': 1, + 'ENABLE_MINI_CAR': 1 if enabled else 0, 'HUD_DISTANCE': 0, # max distance setting on display 'IMPERIAL_UNIT': int(not is_metric), 'HUD_LEAD': 2 if enabled and hud.lead_visible else 1 if enabled else 0, diff --git a/selfdrive/car/honda/interface.py b/selfdrive/car/honda/interface.py index ebb13b390..8d2c1af46 100755 --- a/selfdrive/car/honda/interface.py +++ b/selfdrive/car/honda/interface.py @@ -22,6 +22,8 @@ class CarInterface(CarInterfaceBase): def get_pid_accel_limits(CP, current_speed, cruise_speed): if CP.carFingerprint in HONDA_BOSCH: return CarControllerParams.BOSCH_ACCEL_MIN, CarControllerParams.BOSCH_ACCEL_MAX + elif CP.enableGasInterceptor: + return CarControllerParams.NIDEC_ACCEL_MIN, CarControllerParams.NIDEC_ACCEL_MAX else: # NIDECs don't allow acceleration near cruise_speed, # so limit limits of pid to prevent windup @@ -35,7 +37,7 @@ class CarInterface(CarInterfaceBase): if candidate in HONDA_BOSCH: ret.safetyConfigs = [get_safety_config(car.CarParams.SafetyModel.hondaBosch)] - ret.radarOffCan = True + ret.radarUnavailable = True if candidate not in HONDA_BOSCH_RADARLESS: # Disable the radar and let openpilot control longitudinal @@ -228,23 +230,23 @@ class CarInterface(CarInterfaceBase): ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.2], [0.06]] tire_stiffness_factor = 0.677 - elif candidate in (CAR.ODYSSEY, CAR.ODYSSEY_CHN): + elif candidate in (CAR.ODYSSEY, CAR.ODYSSEY_CHN, CAR.ODYSSEY_HYBRID): ret.mass = 1900. + STD_CARGO_KG ret.wheelbase = 3.00 ret.centerToFront = ret.wheelbase * 0.41 ret.steerRatio = 14.35 # as spec tire_stiffness_factor = 0.82 ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.28], [0.08]] - if candidate == CAR.ODYSSEY_CHN: + if candidate in (CAR.ODYSSEY_CHN, CAR.ODYSSEY_HYBRID): ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 32767], [0, 32767]] # TODO: determine if there is a dead zone at the top end else: ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 4096], [0, 4096]] # TODO: determine if there is a dead zone at the top end - elif candidate in (CAR.PILOT, CAR.PASSPORT): - ret.mass = 4204. * CV.LB_TO_KG + STD_CARGO_KG # average weight - ret.wheelbase = 2.82 + elif candidate == CAR.PILOT: + ret.mass = 4278. * CV.LB_TO_KG + STD_CARGO_KG # average weight + ret.wheelbase = 2.86 ret.centerToFront = ret.wheelbase * 0.428 - ret.steerRatio = 17.25 # as spec + ret.steerRatio = 16.0 # as spec ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 4096], [0, 4096]] # TODO: determine if there is a dead zone at the top end tire_stiffness_factor = 0.444 ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.38], [0.11]] @@ -296,7 +298,7 @@ class CarInterface(CarInterfaceBase): # min speed to enable ACC. if car can do stop and go, then set enabling speed # to a negative value, so it won't matter. Otherwise, add 0.5 mph margin to not # conflict with PCM acc - stop_and_go = candidate in (HONDA_BOSCH | {CAR.CIVIC}) or ret.enableGasInterceptor + stop_and_go = candidate in (HONDA_BOSCH | {CAR.CIVIC, CAR.ODYSSEY_HYBRID}) or ret.enableGasInterceptor ret.minEnableSpeed = -1. if stop_and_go else 25.5 * CV.MPH_TO_MS # TODO: start from empirically derived lateral slip stiffness for the civic and scale by @@ -324,8 +326,9 @@ class CarInterface(CarInterfaceBase): ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0x0, 0xB5, 0x161, 0x2D6, 0x4C0, 0x70D, 0xC42, 0x1058, 0x2C00], [0x0, 0x160, 0x1F0, 0x2E0, 0x378, 0x4A0, 0x5F0, 0x804, 0xF00]] ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.21], [0.07]] #still needs to finish tuning for the new car ret.lateralTuning.pid.kf = 0.00004 - else: - CarInterfaceBase.configure_dp_tune(candidate, ret.lateralTuning) + + CarInterfaceBase.dp_lat_tune_collection(candidate, ret.latTuneCollection) + CarInterfaceBase.configure_dp_tune(ret.lateralTuning, ret.latTuneCollection) return ret @staticmethod @@ -379,5 +382,5 @@ class CarInterface(CarInterfaceBase): # pass in a car.CarControl # to be called @ 100hz - def apply(self, c): - return self.CC.update(c, self.CS, self.dragonconf) + def apply(self, c, now_nanos): + return self.CC.update(c, self.CS, now_nanos, self.dragonconf) diff --git a/selfdrive/car/honda/radar_interface.py b/selfdrive/car/honda/radar_interface.py index 629ab01d4..660be4c44 100755 --- a/selfdrive/car/honda/radar_interface.py +++ b/selfdrive/car/honda/radar_interface.py @@ -21,7 +21,7 @@ class RadarInterface(RadarInterfaceBase): self.track_id = 0 self.radar_fault = False self.radar_wrong_config = False - self.radar_off_can = CP.radarOffCan + self.radar_off_can = CP.radarUnavailable self.radar_ts = CP.radarTimeStep self.delay = int(round(0.1 / CP.radarTimeStep)) # 0.1s delay of radar diff --git a/selfdrive/car/honda/values.py b/selfdrive/car/honda/values.py index 86eb5fa66..a4f4f62aa 100644 --- a/selfdrive/car/honda/values.py +++ b/selfdrive/car/honda/values.py @@ -4,9 +4,10 @@ from typing import Dict, List, Optional, Union from cereal import car from common.conversions import Conversions as CV +from panda.python import uds from selfdrive.car import dbc_dict from selfdrive.car.docs_definitions import CarFootnote, CarInfo, Column, Harness -from selfdrive.car.fw_query_definitions import FwQueryConfig, Request, StdQueries +from selfdrive.car.fw_query_definitions import FwQueryConfig, Request, StdQueries, p16 Ecu = car.CarParams.Ecu VisualAlert = car.CarControl.HUDControl.VisualAlert @@ -88,10 +89,10 @@ class CAR: HRV = "HONDA HRV 2019" ODYSSEY = "HONDA ODYSSEY 2018" ODYSSEY_CHN = "HONDA ODYSSEY CHN 2019" + ODYSSEY_HYBRID = "HONDA ODYSSEY HYBRID CHN 2022" ACURA_RDX = "ACURA RDX 2018" ACURA_RDX_3G = "ACURA RDX 2020" PILOT = "HONDA PILOT 2017" - PASSPORT = "HONDA PASSPORT 2021" RIDGELINE = "HONDA RIDGELINE 2017" INSIGHT = "HONDA INSIGHT 2019" HONDA_E = "HONDA E 2020" @@ -140,26 +141,64 @@ CAR_INFO: Dict[str, Optional[Union[HondaCarInfo, List[HondaCarInfo]]]] = { CAR.HRV: HondaCarInfo("Honda HR-V 2019-22", min_steer_speed=12. * CV.MPH_TO_MS), CAR.ODYSSEY: HondaCarInfo("Honda Odyssey 2018-20"), CAR.ODYSSEY_CHN: None, # Chinese version of Odyssey + CAR.ODYSSEY_HYBRID: HondaCarInfo("Honda Odyssey hybrid china 2022", min_steer_speed=0. * CV.MPH_TO_MS), CAR.ACURA_RDX: HondaCarInfo("Acura RDX 2016-18", "AcuraWatch Plus", min_steer_speed=12. * CV.MPH_TO_MS), CAR.ACURA_RDX_3G: HondaCarInfo("Acura RDX 2019-22", "All", min_steer_speed=3. * CV.MPH_TO_MS), - CAR.PILOT: HondaCarInfo("Honda Pilot 2016-22", min_steer_speed=12. * CV.MPH_TO_MS), - CAR.PASSPORT: HondaCarInfo("Honda Passport 2019-21", "All", min_steer_speed=12. * CV.MPH_TO_MS), + CAR.PILOT: [ + HondaCarInfo("Honda Pilot 2016-22", min_steer_speed=12. * CV.MPH_TO_MS), + HondaCarInfo("Honda Passport 2019-21", "All", min_steer_speed=12. * CV.MPH_TO_MS), + ], CAR.RIDGELINE: HondaCarInfo("Honda Ridgeline 2017-22", min_steer_speed=12. * CV.MPH_TO_MS), CAR.INSIGHT: HondaCarInfo("Honda Insight 2019-22", "All", min_steer_speed=3. * CV.MPH_TO_MS), CAR.HONDA_E: HondaCarInfo("Honda e 2020", "All", min_steer_speed=3. * CV.MPH_TO_MS), } +HONDA_VERSION_REQUEST = bytes([uds.SERVICE_TYPE.READ_DATA_BY_IDENTIFIER]) + \ + p16(0xF112) +HONDA_VERSION_RESPONSE = bytes([uds.SERVICE_TYPE.READ_DATA_BY_IDENTIFIER + 0x40]) + \ + p16(0xF112) + FW_QUERY_CONFIG = FwQueryConfig( requests=[ + # Currently used to fingerprint Request( [StdQueries.UDS_VERSION_REQUEST], [StdQueries.UDS_VERSION_RESPONSE], + bus=1, ), + + # Data collection requests: + # Log extra identifiers for current ECUs + Request( + [HONDA_VERSION_REQUEST], + [HONDA_VERSION_RESPONSE], + bus=1, + logging=True, + ), + # Nidec PT bus + Request( + [StdQueries.UDS_VERSION_REQUEST], + [StdQueries.UDS_VERSION_RESPONSE], + bus=0, + logging=True, + ), + # Bosch PT bus + Request( + [StdQueries.UDS_VERSION_REQUEST], + [StdQueries.UDS_VERSION_RESPONSE], + bus=1, + logging=True, + non_obd=True, + ), + ], + extra_ecus=[ + # The only other ECU on PT bus accessible by camera on radarless Civic + (Ecu.unknown, 0x18DAB3F1, None), ], ) FW_VERSIONS = { - CAR.ODYSSEY_CHN: {(Ecu.vsa, 0xfff, None): [b'\x00']}, + CAR.ODYSSEY_HYBRID: {(Ecu.vsa, 0xfff, None): [b'\x00']}, CAR.ACCORD: { (Ecu.programmedFuelInjection, 0x18da10f1, None): [ b'37805-6A0-8720\x00\x00', @@ -332,10 +371,12 @@ FW_VERSIONS = { b'57114-TWA-A050\x00\x00', b'57114-TWA-A530\x00\x00', b'57114-TWA-B520\x00\x00', + b'57114-TWB-H030\x00\x00', ], (Ecu.srs, 0x18da53f1, None): [ b'77959-TWA-A440\x00\x00', b'77959-TWA-L420\x00\x00', + b'77959-TWB-H220\x00\x00', ], (Ecu.combinationMeter, 0x18da60f1, None): [ b'78109-TWA-A010\x00\x00', @@ -349,6 +390,7 @@ FW_VERSIONS = { b'78109-TWA-A230\x00\x00', b'78109-TWA-L010\x00\x00', b'78109-TWA-L210\x00\x00', + b'78109-TWA-H210\x00\x00', ], (Ecu.shiftByWire, 0x18da0bf1, None): [ b'54008-TWA-A910\x00\x00', @@ -360,16 +402,19 @@ FW_VERSIONS = { (Ecu.fwdCamera, 0x18dab5f1, None): [ b'36161-TWA-A070\x00\x00', b'36161-TWA-A330\x00\x00', + b'36161-TWB-H040\x00\x00', ], (Ecu.fwdRadar, 0x18dab0f1, None): [ b'36802-TWA-A070\x00\x00', b'36802-TWA-A080\x00\x00', b'36802-TWA-A330\x00\x00', + b'36802-TWB-H060\x00\x00', ], (Ecu.eps, 0x18da30f1, None): [ b'39990-TVA-A160\x00\x00', b'39990-TVA-A150\x00\x00', b'39990-TVA-A340\x00\x00', + b'39990-TWB-H120\x00\x00', ], }, CAR.CIVIC: { @@ -1068,6 +1113,8 @@ FW_VERSIONS = { b'28101-5EZ-A060\x00\x00', b'28101-5EZ-A100\x00\x00', b'28101-5EZ-A210\x00\x00', + b'28101-5EZ-A600\x00\x00', + b'28101-5EZ-A430\x00\x00', ], (Ecu.programmedFuelInjection, 0x18da10f1, None): [ b'37805-RLV-4060\x00\x00', @@ -1079,6 +1126,9 @@ FW_VERSIONS = { b'37805-RLV-C520\x00\x00', b'37805-RLV-C530\x00\x00', b'37805-RLV-C910\x00\x00', + b'37805-RLV-B220\x00\x00', + b'37805-RLV-B210\x00\x00', + b'37805-RLV-L160\x00\x00', ], (Ecu.gateway, 0x18daeff1, None): [ b'38897-TG7-A030\x00\x00', @@ -1111,6 +1161,7 @@ FW_VERSIONS = { b'36161-TGS-A130\x00\x00', b'36161-TGT-A030\x00\x00', b'36161-TGT-A130\x00\x00', + b'36161-TGS-A030\x00\x00', ], (Ecu.srs, 0x18da53f1, None): [ b'77959-TG7-A020\x00\x00', @@ -1148,6 +1199,9 @@ FW_VERSIONS = { b'78109-TGS-AP20\x00\x00', b'78109-TGT-AJ20\x00\x00', b'78109-TGT-AK30\x00\x00', + b'78109-TGS-AT20\x00\x00', + b'78109-TGS-AX20\x00\x00', + b'78109-TGS-AJ20\x00\x00', ], (Ecu.vsa, 0x18da28f1, None): [ b'57114-TG7-A130\x00\x00', @@ -1164,38 +1218,6 @@ FW_VERSIONS = { b'57114-TGT-A530\x00\x00', ], }, - CAR.PASSPORT: { - (Ecu.programmedFuelInjection, 0x18da10f1, None): [ - b'37805-RLV-B220\x00\x00', - b'37805-RLV-B210\x00\x00', - ], - (Ecu.eps, 0x18da30f1, None): [ - b'39990-TGS-A230\x00\x00', - ], - (Ecu.fwdRadar, 0x18dab0f1, None): [ - b'36161-TGS-A030\x00\x00', - b'36161-TGS-A130\x00\x00', - ], - (Ecu.gateway, 0x18daeff1, None): [ - b'38897-TG7-A040\x00\x00', - ], - (Ecu.srs, 0x18da53f1, None): [ - b'77959-TGS-A010\x00\x00', - ], - (Ecu.shiftByWire, 0x18da0bf1, None): [ - b'54008-TG7-A530\x00\x00', - ], - (Ecu.transmission, 0x18da1ef1, None): [ - b'28101-5EZ-A600\x00\x00', - ], - (Ecu.combinationMeter, 0x18da60f1, None): [ - b'78109-TGS-AT20\x00\x00', - b'78109-TGS-AX20\x00\x00', - ], - (Ecu.vsa, 0x18da28f1, None): [ - b'57114-TGS-A530\x00\x00', - ], - }, CAR.ACURA_RDX: { (Ecu.vsa, 0x18da28f1, None): [ b'57114-TX5-A220\x00\x00', @@ -1437,6 +1459,7 @@ FW_VERSIONS = { (Ecu.eps, 0x18DA30F1, None): [ b'39990-T39-A130\x00\x00', b'39990-T43-J020\x00\x00', + b'39990-T24-T120\x00\x00', ], (Ecu.gateway, 0x18DAEFF1, None): [ b'38897-T20-A020\x00\x00', @@ -1444,11 +1467,13 @@ FW_VERSIONS = { b'38897-T21-A010\x00\x00', b'38897-T20-A210\x00\x00', b'38897-T20-A310\x00\x00', + b'38897-T24-Z120\x00\x00', ], (Ecu.srs, 0x18DA53F1, None): [ b'77959-T20-A970\x00\x00', b'77959-T47-A940\x00\x00', b'77959-T47-A950\x00\x00', + b'77959-T20-M820\x00\x00', ], (Ecu.combinationMeter, 0x18DA60F1, None): [ b'78108-T21-A220\x00\x00', @@ -1456,16 +1481,26 @@ FW_VERSIONS = { b'78108-T23-A110\x00\x00', b'78108-T21-A230\x00\x00', b'78108-T22-A020\x00\x00', + b'78108-T21-MB10\x00\x00', + ], + (Ecu.fwdRadar, 0x18dab0f1, None): [ + b'36161-T20-A070\x00\x00', + b'36161-T20-A080\x00\x00', + b'36161-T20-A060\x00\x00', + b'36161-T47-A070\x00\x00', + b'36161-T24-T070\x00\x00', ], (Ecu.vsa, 0x18DA28F1, None): [ b'57114-T20-AB40\x00\x00', b'57114-T43-JB30\x00\x00', + b'57114-T24-TB30\x00\x00', ], (Ecu.transmission, 0x18da1ef1, None): [ b'28101-65D-A020\x00\x00', b'28101-65D-A120\x00\x00', b'28101-65H-A020\x00\x00', b'28101-65H-A120\x00\x00', + b'28101-65J-N010\x00\x00', ], (Ecu.programmedFuelInjection, 0x18da10f1, None): [ b'37805-64L-A540\x00\x00', @@ -1473,6 +1508,7 @@ FW_VERSIONS = { b'37805-64S-A720\x00\x00', b'37805-64A-A540\x00\x00', b'37805-64A-A620\x00\x00', + b'37805-64D-P510\x00\x00', ], }, } @@ -1495,8 +1531,8 @@ DBC = { CAR.HRV: dbc_dict('honda_fit_ex_2018_can_generated', 'acura_ilx_2016_nidec'), CAR.ODYSSEY: dbc_dict('honda_odyssey_exl_2018_generated', 'acura_ilx_2016_nidec'), CAR.ODYSSEY_CHN: dbc_dict('honda_odyssey_extreme_edition_2018_china_can_generated', 'acura_ilx_2016_nidec'), + CAR.ODYSSEY_HYBRID: dbc_dict('honda_odyssey_hybrid_2022_china_can_generated', 'acura_ilx_2016_nidec'), CAR.PILOT: dbc_dict('acura_ilx_2016_can_generated', 'acura_ilx_2016_nidec'), - CAR.PASSPORT: dbc_dict('acura_ilx_2016_can_generated', 'acura_ilx_2016_nidec'), CAR.RIDGELINE: dbc_dict('acura_ilx_2016_can_generated', 'acura_ilx_2016_nidec'), CAR.INSIGHT: dbc_dict('honda_insight_ex_2019_can_generated', None), CAR.HONDA_E: dbc_dict('acura_rdx_2020_can_generated', None), @@ -1511,7 +1547,7 @@ STEER_THRESHOLD = { HONDA_NIDEC_ALT_PCM_ACCEL = {CAR.ODYSSEY} HONDA_NIDEC_ALT_SCM_MESSAGES = {CAR.ACURA_ILX, CAR.ACURA_RDX, CAR.CRV, CAR.CRV_EU, CAR.FIT, CAR.FREED, CAR.HRV, CAR.ODYSSEY_CHN, - CAR.PILOT, CAR.PASSPORT, CAR.RIDGELINE} + CAR.ODYSSEY_HYBRID, CAR.PILOT, CAR.RIDGELINE} HONDA_BOSCH = {CAR.ACCORD, CAR.ACCORDH, CAR.CIVIC_BOSCH, CAR.CIVIC_BOSCH_DIESEL, CAR.CRV_5G, CAR.CRV_HYBRID, CAR.INSIGHT, CAR.ACURA_RDX_3G, CAR.HONDA_E, CAR.CIVIC_2022} HONDA_BOSCH_ALT_BRAKE_SIGNAL = {CAR.ACCORD, CAR.CRV_5G, CAR.ACURA_RDX_3G} diff --git a/selfdrive/car/hyundai/carcontroller.py b/selfdrive/car/hyundai/carcontroller.py index 822b1ef8e..51d111545 100644 --- a/selfdrive/car/hyundai/carcontroller.py +++ b/selfdrive/car/hyundai/carcontroller.py @@ -3,7 +3,7 @@ from common.conversions import Conversions as CV from common.numpy_fast import clip from common.realtime import DT_CTRL from opendbc.can.packer import CANPacker -from selfdrive.car import apply_std_steer_torque_limits +from selfdrive.car import apply_driver_steer_torque_limits from selfdrive.car.hyundai import hyundaicanfd, hyundaican from selfdrive.car.hyundai.values import HyundaiFlags, Buttons, CarControllerParams, CANFD_CAR, CAR @@ -54,14 +54,13 @@ class CarController: self.car_fingerprint = CP.carFingerprint self.last_button_frame = 0 - def update(self, CC, CS): + def update(self, CC, CS, now_nanos): actuators = CC.actuators hud_control = CC.hudControl # steering torque - steer = actuators.steer - new_steer = int(round(steer * self.params.STEER_MAX)) - apply_steer = apply_std_steer_torque_limits(new_steer, self.apply_steer_last, CS.out.steeringTorque, self.params) + new_steer = int(round(actuators.steer * self.params.STEER_MAX)) + apply_steer = apply_driver_steer_torque_limits(new_steer, self.apply_steer_last, CS.out.steeringTorque, self.params) if not CC.latActive: apply_steer = 0 @@ -170,7 +169,8 @@ class CarController: if (self.frame - self.last_button_frame) * DT_CTRL > 0.1: # send 25 messages at a time to increases the likelihood of resume being accepted can_sends.extend([hyundaican.create_clu11(self.packer, self.frame, CS.clu11, Buttons.RES_ACCEL, self.CP.carFingerprint)] * 25) - self.last_button_frame = self.frame + if (self.frame - self.last_button_frame) * DT_CTRL >= 0.15: + self.last_button_frame = self.frame if self.frame % 2 == 0 and self.CP.openpilotLongitudinalControl: # TODO: unclear if this is needed @@ -179,10 +179,7 @@ class CarController: hud_control.leadVisible, set_speed_in_units, stopping, CC.cruiseControl.override)) # 20 Hz LFA MFA message - if self.frame % 5 == 0 and self.car_fingerprint in (CAR.SONATA, CAR.PALISADE, CAR.IONIQ, CAR.KIA_NIRO_EV, CAR.KIA_NIRO_HEV_2021, - CAR.IONIQ_EV_2020, CAR.IONIQ_PHEV, CAR.KIA_CEED, CAR.KIA_SELTOS, CAR.KONA_EV, CAR.KONA_EV_2022, - CAR.ELANTRA_2021, CAR.ELANTRA_HEV_2021, CAR.SONATA_HYBRID, CAR.KONA_HEV, CAR.SANTA_FE_2022, - CAR.KIA_K5_2021, CAR.IONIQ_HEV_2022, CAR.SANTA_FE_HEV_2022, CAR.GENESIS_G70_2020, CAR.SANTA_FE_PHEV_2022, CAR.KIA_STINGER_2022): + if self.frame % 5 == 0 and self.CP.flags & HyundaiFlags.SEND_LFA.value: can_sends.append(hyundaican.create_lfahda_mfc(self.packer, CC.enabled)) # 5 Hz ACC options diff --git a/selfdrive/car/hyundai/carstate.py b/selfdrive/car/hyundai/carstate.py index 0ac31a925..209871785 100644 --- a/selfdrive/car/hyundai/carstate.py +++ b/selfdrive/car/hyundai/carstate.py @@ -6,6 +6,7 @@ from cereal import car from common.conversions import Conversions as CV from opendbc.can.parser import CANParser from opendbc.can.can_define import CANDefine +from selfdrive.car.hyundai.hyundaicanfd import get_e_can_bus from selfdrive.car.hyundai.values import HyundaiFlags, CAR, DBC, FEATURES, CAMERA_SCC_CAR, CANFD_CAR, EV_CAR, HYBRID_CAR, Buttons, CarControllerParams from selfdrive.car.interfaces import CarStateBase @@ -21,7 +22,9 @@ class CarState(CarStateBase): self.cruise_buttons = deque([Buttons.NONE] * PREV_BUTTON_SAMPLES, maxlen=PREV_BUTTON_SAMPLES) self.main_buttons = deque([Buttons.NONE] * PREV_BUTTON_SAMPLES, maxlen=PREV_BUTTON_SAMPLES) - self.gear_msg_canfd = "GEAR_ALT" if CP.flags & HyundaiFlags.CANFD_ALT_GEARS else "GEAR_SHIFTER" + self.gear_msg_canfd = "GEAR_ALT_2" if CP.flags & HyundaiFlags.CANFD_ALT_GEARS_2 else \ + "GEAR_ALT" if CP.flags & HyundaiFlags.CANFD_ALT_GEARS else \ + "GEAR_SHIFTER" if CP.carFingerprint in CANFD_CAR: self.shifter_values = can_define.dv[self.gear_msg_canfd]["GEAR"] elif self.CP.carFingerprint in FEATURES["use_cluster_gears"]: @@ -88,7 +91,7 @@ class CarState(CarStateBase): ret.steeringTorqueEps = cp.vl["MDPS12"]["CR_Mdps_OutTq"] #dp ret.engineRPM = cp.vl["TCU_DCT13"]['Cluster_Engine_RPM'] - ret.steeringPressed = abs(ret.steeringTorque) > self.params.STEER_THRESHOLD + ret.steeringPressed = self.update_steering_pressed(abs(ret.steeringTorque) > self.params.STEER_THRESHOLD, 5) ret.steerFaultTemporary = cp.vl["MDPS12"]["CF_Mdps_ToiUnavail"] != 0 or cp.vl["MDPS12"]["CF_Mdps_ToiFlt"] != 0 # cruise state @@ -112,7 +115,6 @@ class CarState(CarStateBase): #dp ret.brakeLightsDEPRECATED = bool(cp.vl["TCS13"]["BrakeLight"] or ret.brakePressed or ret.brakeHoldActive or ret.parkingBrake) - if self.CP.carFingerprint in (HYBRID_CAR | EV_CAR): if self.CP.carFingerprint in HYBRID_CAR: ret.gas = cp.vl["E_EMS11"]["CR_Vcu_AccPedDep_Pos"] / 254. @@ -137,8 +139,8 @@ class CarState(CarStateBase): ret.gearShifter = self.parse_gear_shifter(self.shifter_values.get(gear)) if not self.CP.openpilotLongitudinalControl: - aeb_src = "FCA11" if self.CP.carFingerprint in FEATURES["use_fca"] else "SCC12" - aeb_sig = "FCA_CmdAct" if self.CP.carFingerprint in FEATURES["use_fca"] else "AEB_CmdAct" + aeb_src = "FCA11" if self.CP.flags & HyundaiFlags.USE_FCA.value else "SCC12" + aeb_sig = "FCA_CmdAct" if self.CP.flags & HyundaiFlags.USE_FCA.value else "AEB_CmdAct" aeb_warning = cp_cruise.vl[aeb_src]["CF_VSM_Warn"] != 0 aeb_braking = cp_cruise.vl[aeb_src]["CF_VSM_DecCmdAct"] != 0 or cp_cruise.vl[aeb_src][aeb_sig] != 0 ret.stockFcw = aeb_warning and not aeb_braking @@ -161,6 +163,9 @@ class CarState(CarStateBase): def update_canfd(self, cp, cp_cam): ret = car.CarState.new_message() + self.is_metric = cp.vl["CRUISE_BUTTONS_ALT"]["DISTANCE_UNIT"] != 1 + speed_factor = CV.KPH_TO_MS if self.is_metric else CV.MPH_TO_MS + if self.CP.carFingerprint in (EV_CAR | HYBRID_CAR): if self.CP.carFingerprint in EV_CAR: ret.gas = cp.vl["ACCELERATOR"]["ACCELERATOR_PEDAL"] / 255. @@ -202,14 +207,18 @@ class CarState(CarStateBase): ret.leftBlindspot = cp.vl["BLINDSPOTS_REAR_CORNERS"]["FL_INDICATOR"] != 0 ret.rightBlindspot = cp.vl["BLINDSPOTS_REAR_CORNERS"]["FR_INDICATOR"] != 0 - ret.cruiseState.available = True - self.is_metric = cp.vl["CRUISE_BUTTONS_ALT"]["DISTANCE_UNIT"] != 1 - if not self.CP.openpilotLongitudinalControl: - speed_factor = CV.KPH_TO_MS if self.is_metric else CV.MPH_TO_MS + # cruise state + # CAN FD cars enable on main button press, set available if no TCS faults preventing engagement + ret.cruiseState.available = cp.vl["TCS"]["ACCEnable"] == 0 + if self.CP.openpilotLongitudinalControl: + # These are not used for engage/disengage since openpilot keeps track of state using the buttons + ret.cruiseState.enabled = cp.vl["TCS"]["ACC_REQ"] == 1 + ret.cruiseState.standstill = False + else: cp_cruise_info = cp_cam if self.CP.flags & HyundaiFlags.CANFD_CAMERA_SCC else cp - ret.cruiseState.speed = cp_cruise_info.vl["SCC_CONTROL"]["VSetDis"] * speed_factor - ret.cruiseState.standstill = cp_cruise_info.vl["SCC_CONTROL"]["CRUISE_STANDSTILL"] == 1 ret.cruiseState.enabled = cp_cruise_info.vl["SCC_CONTROL"]["ACCMode"] in (1, 2) + ret.cruiseState.standstill = cp_cruise_info.vl["SCC_CONTROL"]["CRUISE_STANDSTILL"] == 1 + ret.cruiseState.speed = cp_cruise_info.vl["SCC_CONTROL"]["VSetDis"] * speed_factor self.cruise_info = copy.copy(cp_cruise_info.vl["SCC_CONTROL"]) cruise_btn_msg = "CRUISE_BUTTONS_ALT" if self.CP.flags & HyundaiFlags.CANFD_ALT_BUTTONS else "CRUISE_BUTTONS" @@ -222,7 +231,6 @@ class CarState(CarStateBase): if self.CP.flags & HyundaiFlags.CANFD_HDA2: self.cam_0x2a4 = copy.copy(cp_cam.vl["CAM_0x2a4"]) - ret.cruiseActualEnabled = ret.cruiseState.enabled return ret @staticmethod @@ -317,7 +325,7 @@ class CarState(CarStateBase): ("SCC12", 50), ] - if CP.carFingerprint in FEATURES["use_fca"]: + if CP.flags & HyundaiFlags.USE_FCA.value: signals += [ ("FCA_CmdAct", "FCA11"), ("CF_VSM_Warn", "FCA11"), @@ -408,7 +416,7 @@ class CarState(CarStateBase): ("SCC12", 50), ] - if CP.carFingerprint in FEATURES["use_fca"]: + if CP.flags & HyundaiFlags.USE_FCA.value: signals += [ ("FCA_CmdAct", "FCA11"), ("CF_VSM_Warn", "FCA11"), @@ -428,7 +436,9 @@ class CarState(CarStateBase): def get_can_parser_canfd(CP): cruise_btn_msg = "CRUISE_BUTTONS_ALT" if CP.flags & HyundaiFlags.CANFD_ALT_BUTTONS else "CRUISE_BUTTONS" - gear_msg = "GEAR_ALT" if CP.flags & HyundaiFlags.CANFD_ALT_GEARS else "GEAR_SHIFTER" + gear_msg = "GEAR_ALT_2" if CP.flags & HyundaiFlags.CANFD_ALT_GEARS_2 else \ + "GEAR_ALT" if CP.flags & HyundaiFlags.CANFD_ALT_GEARS else \ + "GEAR_SHIFTER" signals = [ ("WHEEL_SPEED_1", "WHEEL_SPEEDS"), ("WHEEL_SPEED_2", "WHEEL_SPEEDS"), @@ -445,6 +455,7 @@ class CarState(CarStateBase): ("DriverBraking", "TCS"), ("ACCEnable", "TCS"), + ("ACC_REQ", "TCS"), ("COUNTER", cruise_btn_msg), ("CRUISE_BUTTONS", cruise_btn_msg), @@ -513,8 +524,7 @@ class CarState(CarStateBase): ("ACCELERATOR_BRAKE_ALT", 100), ] - bus = 5 if CP.flags & HyundaiFlags.CANFD_HDA2 else 4 - return CANParser(DBC[CP.carFingerprint]["pt"], signals, checks, bus) + return CANParser(DBC[CP.carFingerprint]["pt"], signals, checks, get_e_can_bus(CP)) @staticmethod def get_cam_can_parser_canfd(CP): diff --git a/selfdrive/car/hyundai/hyundaican.py b/selfdrive/car/hyundai/hyundaican.py index c2ffffbf2..858f3d087 100644 --- a/selfdrive/car/hyundai/hyundaican.py +++ b/selfdrive/car/hyundai/hyundaican.py @@ -21,7 +21,7 @@ def create_lkas11(packer, frame, car_fingerprint, apply_steer, steer_req, CAR.IONIQ_EV_2020, CAR.IONIQ_PHEV, CAR.KIA_SELTOS, CAR.ELANTRA_2021, CAR.GENESIS_G70_2020, CAR.ELANTRA_HEV_2021, CAR.SONATA_HYBRID, CAR.KONA_EV, CAR.KONA_HEV, CAR.KONA_EV_2022, CAR.SANTA_FE_2022, CAR.KIA_K5_2021, CAR.IONIQ_HEV_2022, CAR.SANTA_FE_HEV_2022, - CAR.SANTA_FE_PHEV_2022, CAR.KIA_STINGER_2022): + CAR.SANTA_FE_PHEV_2022, CAR.KIA_STINGER_2022, CAR.KIA_K5_HEV_2020): values["CF_Lkas_LdwsActivemode"] = int(left_lane) + (int(right_lane) << 1) values["CF_Lkas_LdwsOpt_USM"] = 2 diff --git a/selfdrive/car/hyundai/hyundaicanfd.py b/selfdrive/car/hyundai/hyundaicanfd.py index c492e6a5f..af7239571 100644 --- a/selfdrive/car/hyundai/hyundaicanfd.py +++ b/selfdrive/car/hyundai/hyundaicanfd.py @@ -72,8 +72,6 @@ def create_acc_control(packer, CP, enabled, accel_last, accel, stopping, gas_ove else: a_raw = accel a_val = clip(accel, accel_last - jn, accel_last + jn) - if stopping: - a_raw = 0 values = { "ACCMode": 0 if not enabled else (2 if gas_override else 1), @@ -83,6 +81,7 @@ def create_acc_control(packer, CP, enabled, accel_last, accel, stopping, gas_ove "aReqRaw": a_raw, "VSetDis": set_speed, "JerkLowerLimit": jerk if enabled else 1, + "JerkUpperLimit": 3.0, "ACC_ObjDist": 1, "ObjValid": 0, @@ -90,7 +89,6 @@ def create_acc_control(packer, CP, enabled, accel_last, accel, stopping, gas_ove "SET_ME_2": 0x4, "SET_ME_3": 0x3, "SET_ME_TMP_64": 0x64, - "NEW_SIGNAL_10": 4, "DISTANCE_SETTING": 4, } diff --git a/selfdrive/car/hyundai/interface.py b/selfdrive/car/hyundai/interface.py index 86ad7f735..97ad0ff80 100644 --- a/selfdrive/car/hyundai/interface.py +++ b/selfdrive/car/hyundai/interface.py @@ -2,6 +2,7 @@ from cereal import car from panda import Panda from common.conversions import Conversions as CV +from selfdrive.car.hyundai.hyundaicanfd import get_e_can_bus from selfdrive.car.hyundai.values import HyundaiFlags, CAR, DBC, CANFD_CAR, CAMERA_SCC_CAR, CANFD_RADAR_SCC_CAR, EV_CAR, HYBRID_CAR, LEGACY_SAFETY_MODE_CAR, Buttons from selfdrive.car.hyundai.radar_interface import RADAR_START_ADDR from selfdrive.car import STD_CARGO_KG, create_button_event, scale_tire_stiffness, get_safety_config @@ -21,7 +22,7 @@ class CarInterface(CarInterfaceBase): @staticmethod def _get_params(ret, candidate, fingerprint, car_fw, experimental_long): ret.carName = "hyundai" - ret.radarOffCan = RADAR_START_ADDR not in fingerprint[1] or DBC[ret.carFingerprint]["radar"] is None + ret.radarUnavailable = RADAR_START_ADDR not in fingerprint[1] or DBC[ret.carFingerprint]["radar"] is None # These cars have been put into dashcam only due to both a lack of users and test coverage. # These cars likely still work fine. Once a user confirms each car works and a test route is @@ -36,11 +37,22 @@ class CarInterface(CarInterfaceBase): # non-HDA2 if 0x1cf not in fingerprint[4]: ret.flags |= HyundaiFlags.CANFD_ALT_BUTTONS.value - # ICE cars do not have 0x130; GEARS message on 0x40 instead + # ICE cars do not have 0x130; GEARS message on 0x40 or 0x70 instead if 0x130 not in fingerprint[4]: - ret.flags |= HyundaiFlags.CANFD_ALT_GEARS.value + if 0x40 not in fingerprint[4]: + ret.flags |= HyundaiFlags.CANFD_ALT_GEARS_2.value + else: + ret.flags |= HyundaiFlags.CANFD_ALT_GEARS.value if candidate not in CANFD_RADAR_SCC_CAR: ret.flags |= HyundaiFlags.CANFD_CAMERA_SCC.value + else: + # Send LFA message on cars with HDA + if 0x485 in fingerprint[2]: + ret.flags |= HyundaiFlags.SEND_LFA.value + + # These cars use the FCA11 message for the AEB and FCW signals, all others use SCC12 + if 0x38d in fingerprint[0] or 0x38d in fingerprint[2]: + ret.flags |= HyundaiFlags.USE_FCA.value ret.steerActuatorDelay = 0.1 # Default delay ret.steerLimitTimer = 0.4 @@ -93,18 +105,13 @@ class CarInterface(CarInterfaceBase): ret.wheelbase = 2.6 ret.steerRatio = 13.42 # Spec tire_stiffness_factor = 0.385 - elif candidate in (CAR.IONIQ, CAR.IONIQ_EV_LTD, CAR.IONIQ_EV_2020, CAR.IONIQ_PHEV, CAR.IONIQ_HEV_2022): + elif candidate in (CAR.IONIQ, CAR.IONIQ_EV_LTD, CAR.IONIQ_PHEV_2019, CAR.IONIQ_HEV_2022, CAR.IONIQ_EV_2020, CAR.IONIQ_PHEV): ret.mass = 1490. + STD_CARGO_KG # weight per hyundai site https://www.hyundaiusa.com/ioniq-electric/specifications.aspx ret.wheelbase = 2.7 ret.steerRatio = 13.73 # Spec tire_stiffness_factor = 0.385 - if candidate not in (CAR.IONIQ_EV_2020, CAR.IONIQ_PHEV, CAR.IONIQ_HEV_2022): + if candidate in (CAR.IONIQ, CAR.IONIQ_EV_LTD, CAR.IONIQ_PHEV_2019): ret.minSteerSpeed = 32 * CV.MPH_TO_MS - elif candidate == CAR.IONIQ_PHEV_2019: - ret.mass = 1550. + STD_CARGO_KG # weight per hyundai site https://www.hyundaiusa.com/us/en/vehicles/2019-ioniq-plug-in-hybrid/compare-specs - ret.wheelbase = 2.7 - ret.steerRatio = 13.73 - ret.minSteerSpeed = 32 * CV.MPH_TO_MS elif candidate == CAR.VELOSTER: ret.mass = 3558. * CV.LB_TO_KG ret.wheelbase = 2.80 @@ -130,8 +137,8 @@ class CarInterface(CarInterfaceBase): ret.mass = 1985. + STD_CARGO_KG ret.wheelbase = 2.78 ret.steerRatio = 14.4 * 1.1 # 10% higher at the center seems reasonable - elif candidate in (CAR.KIA_NIRO_EV, CAR.KIA_NIRO_PHEV, CAR.KIA_NIRO_HEV_2021): - ret.mass = 1737. + STD_CARGO_KG + elif candidate in (CAR.KIA_NIRO_EV, CAR.KIA_NIRO_PHEV, CAR.KIA_NIRO_HEV_2021, CAR.KIA_NIRO_HEV_2ND_GEN): + ret.mass = 3452. * CV.LB_TO_KG + STD_CARGO_KG # average of all the cars ret.wheelbase = 2.7 ret.steerRatio = 13.9 if CAR.KIA_NIRO_HEV_2021 else 13.73 # Spec tire_stiffness_factor = 0.385 @@ -167,7 +174,7 @@ class CarInterface(CarInterfaceBase): ret.wheelbase = 2.65 ret.steerRatio = 13.75 tire_stiffness_factor = 0.5 - elif candidate == CAR.KIA_K5_2021: + elif candidate in (CAR.KIA_K5_2021, CAR.KIA_K5_HEV_2020): ret.mass = 3228. * CV.LB_TO_KG ret.wheelbase = 2.85 ret.steerRatio = 13.27 # 2021 Kia K5 Steering Ratio (all trims) @@ -186,10 +193,13 @@ class CarInterface(CarInterfaceBase): ret.mass = 1767. + STD_CARGO_KG # SX Prestige trim support only ret.wheelbase = 2.756 ret.steerRatio = 13.6 - elif candidate == CAR.KIA_SORENTO_PHEV_4TH_GEN: - ret.mass = 4095.8 * CV.LB_TO_KG + STD_CARGO_KG # weight from EX and above trims, average of FWD and AWD versions (EX, X-Line EX AWD, SX, SX Pestige, X-Line SX Prestige AWD) + elif candidate in (CAR.KIA_SORENTO_4TH_GEN, CAR.KIA_SORENTO_PHEV_4TH_GEN): ret.wheelbase = 2.81 - ret.steerRatio = 13.27 # steering ratio according to Kia News https://www.kiamedia.com/us/en/models/sorento-phev/2022/specifications + ret.steerRatio = 13.5 # average of the platforms + if candidate == CAR.KIA_SORENTO_4TH_GEN: + ret.mass = 3957 * CV.LB_TO_KG + STD_CARGO_KG + else: + ret.mass = 4537 * CV.LB_TO_KG + STD_CARGO_KG # Genesis elif candidate == CAR.GENESIS_GV60_EV_1ST_GEN: @@ -227,7 +237,6 @@ class CarInterface(CarInterfaceBase): ret.longitudinalTuning.kpV = [0.5] ret.longitudinalTuning.kiV = [0.0] ret.experimentalLongitudinalAvailable = candidate not in (LEGACY_SAFETY_MODE_CAR | CAMERA_SCC_CAR) - ret.openpilotLongitudinalControl = experimental_long and ret.experimentalLongitudinalAvailable params = Params() if int(params.get("dp_atl").decode('utf-8')) == 1: @@ -237,19 +246,19 @@ class CarInterface(CarInterfaceBase): ret.stoppingControl = True ret.startingState = True ret.vEgoStarting = 0.1 - ret.startAccel = 2.0 + ret.startAccel = 1.0 ret.longitudinalActuatorDelayLowerBound = 0.5 ret.longitudinalActuatorDelayUpperBound = 0.5 # *** feature detection *** if candidate in CANFD_CAR: - bus = 5 if ret.flags & HyundaiFlags.CANFD_HDA2 else 4 - ret.enableBsm = 0x1e5 in fingerprint[bus] + ret.enableBsm = 0x1e5 in fingerprint[get_e_can_bus(ret)] else: ret.enableBsm = 0x58b in fingerprint[0] # *** panda safety config *** - CarInterfaceBase.configure_dp_tune(candidate, ret.lateralTuning) + CarInterfaceBase.dp_lat_tune_collection(candidate, ret.latTuneCollection) + CarInterfaceBase.configure_dp_tune(ret.lateralTuning, ret.latTuneCollection) # panda safety config if candidate in CANFD_CAR: @@ -333,5 +342,5 @@ class CarInterface(CarInterfaceBase): return ret - def apply(self, c): - return self.CC.update(c, self.CS) + def apply(self, c, now_nanos): + return self.CC.update(c, self.CS, now_nanos) diff --git a/selfdrive/car/hyundai/radar_interface.py b/selfdrive/car/hyundai/radar_interface.py index 0d22611fb..4ecca542b 100644 --- a/selfdrive/car/hyundai/radar_interface.py +++ b/selfdrive/car/hyundai/radar_interface.py @@ -37,7 +37,7 @@ class RadarInterface(RadarInterfaceBase): self.trigger_msg = RADAR_START_ADDR + RADAR_MSG_COUNT - 1 self.track_id = 0 - self.radar_off_can = CP.radarOffCan + self.radar_off_can = CP.radarUnavailable self.rcp = get_radar_can_parser(CP) def update(self, can_strings): diff --git a/selfdrive/car/hyundai/values.py b/selfdrive/car/hyundai/values.py index cdcaf629a..cf0143543 100644 --- a/selfdrive/car/hyundai/values.py +++ b/selfdrive/car/hyundai/values.py @@ -23,6 +23,7 @@ class CarControllerParams: self.STEER_DRIVER_MULTIPLIER = 2 self.STEER_DRIVER_FACTOR = 1 self.STEER_THRESHOLD = 150 + self.STEER_STEP = 1 # 100 Hz if CP.carFingerprint in CANFD_CAR: self.STEER_MAX = 270 @@ -34,7 +35,7 @@ class CarControllerParams: # To determine the limit for your car, find the maximum value that the stock LKAS will request. # If the max stock LKAS request is <384, add your car to this list. - elif CP.carFingerprint in (CAR.GENESIS_G80, CAR.GENESIS_G90, CAR.ELANTRA, CAR.HYUNDAI_GENESIS, CAR.IONIQ, + elif CP.carFingerprint in (CAR.GENESIS_G80, CAR.GENESIS_G90, CAR.ELANTRA, CAR.IONIQ, CAR.IONIQ_EV_LTD, CAR.SANTA_FE_PHEV_2022, CAR.SONATA_LF, CAR.KIA_FORTE, CAR.KIA_NIRO_PHEV, CAR.KIA_OPTIMA_H, CAR.KIA_SORENTO): self.STEER_MAX = 255 @@ -57,8 +58,10 @@ class HyundaiFlags(IntFlag): CANFD_CAMERA_SCC = 8 ALT_LIMITS = 16 - ENABLE_BLINKERS = 32 + CANFD_ALT_GEARS_2 = 64 + SEND_LFA = 128 + USE_FCA = 256 class CAR: @@ -95,15 +98,18 @@ class CAR: # Kia KIA_FORTE = "KIA FORTE E 2018 & GT 2021" KIA_K5_2021 = "KIA K5 2021" + KIA_K5_HEV_2020 = "KIA K5 HYBRID 2020" KIA_NIRO_EV = "KIA NIRO EV 2020" KIA_NIRO_PHEV = "KIA NIRO HYBRID 2019" KIA_NIRO_HEV_2021 = "KIA NIRO HYBRID 2021" + KIA_NIRO_HEV_2ND_GEN = "KIA NIRO HYBRID 2ND GEN" KIA_OPTIMA_G4 = "KIA OPTIMA 4TH GEN" KIA_OPTIMA_G4_FL = "KIA OPTIMA 4TH GEN FACELIFT" KIA_OPTIMA_H = "KIA OPTIMA HYBRID 2017 & SPORTS 2019" KIA_SELTOS = "KIA SELTOS 2021" KIA_SPORTAGE_5TH_GEN = "KIA SPORTAGE 5TH GEN" KIA_SORENTO = "KIA SORENTO GT LINE 2018" + KIA_SORENTO_4TH_GEN = "KIA SORENTO 4TH GEN" KIA_SORENTO_PHEV_4TH_GEN = "KIA SORENTO PLUG-IN HYBRID 4TH GEN" KIA_SPORTAGE_HYBRID_5TH_GEN = "KIA SPORTAGE HYBRID 5TH GEN" KIA_STINGER = "KIA STINGER GT2 2018" @@ -121,9 +127,10 @@ class CAR: class Footnote(Enum): + # footnotes which mention "red panda" will be replaced with the CAN FD panda kit on the shop page CANFD = CarFootnote( - "Requires a red panda, additional harness box, " + - "additional OBD-C cable, USB-A to USB-A cable, and a USB-A to USB-C OTG dongle.", + "Requires a red panda for this CAN FD car. " + + "All the hardware needed is sold in the CAN FD kit.", Column.MODEL, shop_footnote=True) @@ -142,9 +149,12 @@ CAR_INFO: Dict[str, Optional[Union[HyundaiCarInfo, List[HyundaiCarInfo]]]] = { HyundaiCarInfo("Hyundai Elantra GT 2017-19", harness=Harness.hyundai_e), HyundaiCarInfo("Hyundai i30 2017-19", harness=Harness.hyundai_e), ], - CAR.ELANTRA_2021: HyundaiCarInfo("Hyundai Elantra 2021-22", video_link="https://youtu.be/_EdYQtV52-c", harness=Harness.hyundai_k), + CAR.ELANTRA_2021: HyundaiCarInfo("Hyundai Elantra 2021-23", video_link="https://youtu.be/_EdYQtV52-c", harness=Harness.hyundai_k), CAR.ELANTRA_HEV_2021: HyundaiCarInfo("Hyundai Elantra Hybrid 2021-23", video_link="https://youtu.be/_EdYQtV52-c", harness=Harness.hyundai_k), - CAR.HYUNDAI_GENESIS: HyundaiCarInfo("Hyundai Genesis 2015-16", min_enable_speed=19 * CV.MPH_TO_MS, harness=Harness.hyundai_j), # TODO: check 2015 packages + CAR.HYUNDAI_GENESIS: [ + HyundaiCarInfo("Hyundai Genesis 2015-16", min_enable_speed=19 * CV.MPH_TO_MS, harness=Harness.hyundai_j), # TODO: check 2015 packages + HyundaiCarInfo("Genesis G80 2017", "All", min_enable_speed=19 * CV.MPH_TO_MS, harness=Harness.hyundai_j), + ], CAR.IONIQ: HyundaiCarInfo("Hyundai Ioniq Hybrid 2017-19", harness=Harness.hyundai_c), CAR.IONIQ_HEV_2022: HyundaiCarInfo("Hyundai Ioniq Hybrid 2020-22", harness=Harness.hyundai_h), # TODO: confirm 2020-21 harness CAR.IONIQ_EV_LTD: HyundaiCarInfo("Hyundai Ioniq Electric 2019", harness=Harness.hyundai_c), @@ -159,7 +169,7 @@ CAR_INFO: Dict[str, Optional[Union[HyundaiCarInfo, List[HyundaiCarInfo]]]] = { CAR.SANTA_FE_2022: HyundaiCarInfo("Hyundai Santa Fe 2021-22", "All", "https://youtu.be/VnHzSTygTS4", harness=Harness.hyundai_l), CAR.SANTA_FE_HEV_2022: HyundaiCarInfo("Hyundai Santa Fe Hybrid 2022", "All", harness=Harness.hyundai_l), CAR.SANTA_FE_PHEV_2022: HyundaiCarInfo("Hyundai Santa Fe Plug-in Hybrid 2022", "All", harness=Harness.hyundai_l), - CAR.SONATA: HyundaiCarInfo("Hyundai Sonata 2020-22", "All", "https://www.youtube.com/watch?v=ix63r9kE3Fw", harness=Harness.hyundai_a), + CAR.SONATA: HyundaiCarInfo("Hyundai Sonata 2020-23", "All", "https://www.youtube.com/watch?v=ix63r9kE3Fw", harness=Harness.hyundai_a), CAR.SONATA_LF: HyundaiCarInfo("Hyundai Sonata 2018-19", harness=Harness.hyundai_e), CAR.TUCSON: [ HyundaiCarInfo("Hyundai Tucson 2021", min_enable_speed=19 * CV.MPH_TO_MS, harness=Harness.hyundai_l), @@ -172,6 +182,7 @@ CAR_INFO: Dict[str, Optional[Union[HyundaiCarInfo, List[HyundaiCarInfo]]]] = { CAR.VELOSTER: HyundaiCarInfo("Hyundai Veloster 2019-20", min_enable_speed=5. * CV.MPH_TO_MS, harness=Harness.hyundai_e), CAR.SONATA_HYBRID: HyundaiCarInfo("Hyundai Sonata Hybrid 2020-22", "All", harness=Harness.hyundai_a), CAR.IONIQ_5: [ + HyundaiCarInfo("Hyundai Ioniq 5 (Southeast Asia only) 2022-23", "All", harness=Harness.hyundai_q), HyundaiCarInfo("Hyundai Ioniq 5 (without HDA II) 2022-23", "Highway Driving Assist", harness=Harness.hyundai_k), HyundaiCarInfo("Hyundai Ioniq 5 (with HDA II) 2022-23", "Highway Driving Assist II", harness=Harness.hyundai_q), ], @@ -180,22 +191,27 @@ CAR_INFO: Dict[str, Optional[Union[HyundaiCarInfo, List[HyundaiCarInfo]]]] = { HyundaiCarInfo("Hyundai Tucson 2023", "All", harness=Harness.hyundai_n), ], CAR.TUCSON_HYBRID_4TH_GEN: HyundaiCarInfo("Hyundai Tucson Hybrid 2022", "All", harness=Harness.hyundai_n), - CAR.SANTA_CRUZ_1ST_GEN: HyundaiCarInfo("Hyundai Santa Cruz 2021-22", harness=Harness.hyundai_n), + CAR.SANTA_CRUZ_1ST_GEN: HyundaiCarInfo("Hyundai Santa Cruz 2022-23", harness=Harness.hyundai_n), # Kia CAR.KIA_FORTE: HyundaiCarInfo("Kia Forte 2019-21", harness=Harness.hyundai_g), CAR.KIA_K5_2021: HyundaiCarInfo("Kia K5 2021-22", harness=Harness.hyundai_a), + CAR.KIA_K5_HEV_2020: HyundaiCarInfo("Kia K5 Hybrid 2020", harness=Harness.hyundai_a), CAR.KIA_NIRO_EV: [ HyundaiCarInfo("Kia Niro EV 2019", "All", "https://www.youtube.com/watch?v=lT7zcG6ZpGo", harness=Harness.hyundai_h), HyundaiCarInfo("Kia Niro EV 2020", "All", "https://www.youtube.com/watch?v=lT7zcG6ZpGo", harness=Harness.hyundai_f), HyundaiCarInfo("Kia Niro EV 2021", "All", "https://www.youtube.com/watch?v=lT7zcG6ZpGo", harness=Harness.hyundai_c), HyundaiCarInfo("Kia Niro EV 2022", "All", "https://www.youtube.com/watch?v=lT7zcG6ZpGo", harness=Harness.hyundai_h), ], - CAR.KIA_NIRO_PHEV: HyundaiCarInfo("Kia Niro Plug-in Hybrid 2018-19", "All", min_enable_speed=10. * CV.MPH_TO_MS, harness=Harness.hyundai_c), + CAR.KIA_NIRO_PHEV: [ + HyundaiCarInfo("Kia Niro Plug-in Hybrid 2018-19", "All", min_enable_speed=10. * CV.MPH_TO_MS, harness=Harness.hyundai_c), + HyundaiCarInfo("Kia Niro Plug-in Hybrid 2020", "All", harness=Harness.hyundai_d), + ], CAR.KIA_NIRO_HEV_2021: [ HyundaiCarInfo("Kia Niro Hybrid 2021", harness=Harness.hyundai_f), # TODO: could be hyundai_d, verify HyundaiCarInfo("Kia Niro Hybrid 2022", harness=Harness.hyundai_h), ], + CAR.KIA_NIRO_HEV_2ND_GEN: HyundaiCarInfo("Kia Niro Hybrid 2023", harness=Harness.hyundai_a), CAR.KIA_OPTIMA_G4: HyundaiCarInfo("Kia Optima 2017", "Advanced Smart Cruise Control", harness=Harness.hyundai_b), # TODO: may support 2016, 2018 CAR.KIA_OPTIMA_G4_FL: HyundaiCarInfo("Kia Optima 2019-20", harness=Harness.hyundai_g), CAR.KIA_OPTIMA_H: [ @@ -208,22 +224,27 @@ CAR_INFO: Dict[str, Optional[Union[HyundaiCarInfo, List[HyundaiCarInfo]]]] = { HyundaiCarInfo("Kia Sorento 2018", "Advanced Smart Cruise Control", "https://www.youtube.com/watch?v=Fkh3s6WHJz8", harness=Harness.hyundai_c), HyundaiCarInfo("Kia Sorento 2019", video_link="https://www.youtube.com/watch?v=Fkh3s6WHJz8", harness=Harness.hyundai_e), ], - CAR.KIA_SORENTO_PHEV_4TH_GEN: HyundaiCarInfo("Kia Sorento Plug-in Hybrid 2022-23", "Smart Cruise Control (SCC)", harness=Harness.hyundai_a), + CAR.KIA_SORENTO_4TH_GEN: HyundaiCarInfo("Kia Sorento 2022-23", harness=Harness.hyundai_k), + CAR.KIA_SORENTO_PHEV_4TH_GEN: HyundaiCarInfo("Kia Sorento Plug-in Hybrid 2022-23", harness=Harness.hyundai_a), CAR.KIA_SPORTAGE_HYBRID_5TH_GEN: HyundaiCarInfo("Kia Sportage Hybrid 2023", harness=Harness.hyundai_n), CAR.KIA_STINGER: HyundaiCarInfo("Kia Stinger 2018-20", video_link="https://www.youtube.com/watch?v=MJ94qoofYw0", harness=Harness.hyundai_c), CAR.KIA_STINGER_2022: HyundaiCarInfo("Kia Stinger 2022", "All", harness=Harness.hyundai_k), CAR.KIA_CEED: HyundaiCarInfo("Kia Ceed 2019", harness=Harness.hyundai_e), CAR.KIA_EV6: [ + HyundaiCarInfo("Kia EV6 (Southeast Asia only) 2022-23", "All", harness=Harness.hyundai_p), HyundaiCarInfo("Kia EV6 (without HDA II) 2022", "Highway Driving Assist", harness=Harness.hyundai_l), HyundaiCarInfo("Kia EV6 (with HDA II) 2022", "Highway Driving Assist II", harness=Harness.hyundai_p) ], # Genesis - CAR.GENESIS_GV60_EV_1ST_GEN: HyundaiCarInfo("Genesis GV60 2023", "All", harness=Harness.hyundai_k), + CAR.GENESIS_GV60_EV_1ST_GEN: [ + HyundaiCarInfo("Genesis GV60 (Advanced Trim) 2023", "All", harness=Harness.hyundai_a), + HyundaiCarInfo("Genesis GV60 (Performance Trim) 2023", "All", harness=Harness.hyundai_k), + ], CAR.GENESIS_G70: HyundaiCarInfo("Genesis G70 2018-19", "All", harness=Harness.hyundai_f), CAR.GENESIS_G70_2020: HyundaiCarInfo("Genesis G70 2020", "All", harness=Harness.hyundai_f), CAR.GENESIS_GV70_1ST_GEN: HyundaiCarInfo("Genesis GV70 2022-23", "All", harness=Harness.hyundai_l), - CAR.GENESIS_G80: HyundaiCarInfo("Genesis G80 2017-19", "All", harness=Harness.hyundai_h), + CAR.GENESIS_G80: HyundaiCarInfo("Genesis G80 2018-19", "All", harness=Harness.hyundai_h), CAR.GENESIS_G90: HyundaiCarInfo("Genesis G90 2017-18", "All", harness=Harness.hyundai_c), } @@ -355,6 +376,13 @@ FW_QUERY_CONFIG = FwQueryConfig( ) FW_VERSIONS = { + CAR.HYUNDAI_GENESIS: { + (Ecu.fwdCamera, 0x7c4, None): [ + b'\xf1\x00DH LKAS 1.1 -150210', + b'\xf1\x00DH LKAS 1.4 -140110', + b'\xf1\x00DH LKAS 1.5 -140425', + ], + }, CAR.IONIQ: { (Ecu.fwdRadar, 0x7d0, None): [ b'\xf1\x00AEhe SCC H-CUP 1.01 1.01 96400-G2000 ', @@ -392,29 +420,32 @@ FW_VERSIONS = { }, CAR.IONIQ_PHEV: { (Ecu.fwdRadar, 0x7d0, None): [ - b'\xf1\000AEhe SCC FHCUP 1.00 1.02 99110-G2100 ', + b'\xf1\x00AEhe SCC FHCUP 1.00 1.02 99110-G2100 ', b'\xf1\x00AEhe SCC F-CUP 1.00 1.00 99110-G2200 ', b'\xf1\x00AEhe SCC F-CUP 1.00 1.00 99110-G2600 ', + b'\xf1\x00AEhe SCC F-CUP 1.00 1.02 99110-G2100 ', ], (Ecu.eps, 0x7d4, None): [ - b'\xf1\000AE MDPS C 1.00 1.01 56310/G2510 4APHC101', + b'\xf1\x00AE MDPS C 1.00 1.01 56310/G2510 4APHC101', b'\xf1\x00AE MDPS C 1.00 1.01 56310/G2560 4APHC101', b'\xf1\x00AE MDPS C 1.00 1.01 56310G2510\x00 4APHC101', ], (Ecu.fwdCamera, 0x7c4, None): [ - b'\xf1\000AEP MFC AT USA LHD 1.00 1.01 95740-G2600 190819', + b'\xf1\x00AEP MFC AT USA LHD 1.00 1.01 95740-G2600 190819', b'\xf1\x00AEP MFC AT EUR RHD 1.00 1.01 95740-G2600 190819', b'\xf1\x00AEP MFC AT USA LHD 1.00 1.00 95740-G2700 201027', ], (Ecu.engine, 0x7e0, None): [ b'\xf1\x816H6F6051\x00\x00\x00\x00\x00\x00\x00\x00', b'\xf1\x816H6G6051\x00\x00\x00\x00\x00\x00\x00\x00', + b'\xf1\x816H6G5051\x00\x00\x00\x00\x00\x00\x00\x00', ], (Ecu.transmission, 0x7e1, None): [ b'\xf1\x816U3J9051\000\000\xf1\0006U3H1_C2\000\0006U3J9051\000\000PAE0G16NL0\x82zT\xd2', b'\xf1\x816U3J8051\x00\x00\xf1\x006U3H1_C2\x00\x006U3J8051\x00\x00PAETG16UL0\x00\x00\x00\x00', - b'\xf1\x816U3J9051\x00\x00\xf1\x006U3H1_C2\x00\x006U3J9051\x00\x00PAE0G16NL2\xad\xeb\xabt', b'\xf1\x816U3J9051\x00\x00\xf1\x006U3H1_C2\x00\x006U3J9051\x00\x00PAE0G16NL2\x00\x00\x00\x00', + b'\xf1\x006U3H1_C2\x00\x006U3J9051\x00\x00PAE0G16NL0\x00\x00\x00\x00', + b'\xf1\x006U3H1_C2\x00\x006U3J9051\x00\x00PAE0G16NL2\xad\xeb\xabt', ], }, CAR.IONIQ_EV_2020: { @@ -442,16 +473,19 @@ FW_VERSIONS = { b'\xf1\x00AE MDPS C 1.00 1.04 56310/G7501 4AEEC104', b'\xf1\x00AE MDPS C 1.00 1.03 56310/G7300 4AEEC103', b'\xf1\x00AE MDPS C 1.00 1.03 56310G7300\x00 4AEEC103', + b'\xf1\x00AE MDPS C 1.00 1.04 56310/G7301 4AEEC104', ], (Ecu.fwdCamera, 0x7c4, None): [ b'\xf1\x00AEE MFC AT EUR LHD 1.00 1.00 95740-G7200 160418', b'\xf1\x00AEE MFC AT USA LHD 1.00 1.00 95740-G2400 180222', b'\xf1\x00AEE MFC AT EUR LHD 1.00 1.00 95740-G2300 170703', + b'\xf1\x00AEE MFC AT EUR LHD 1.00 1.00 95740-G2400 180222', ], }, CAR.IONIQ_HEV_2022: { (Ecu.fwdRadar, 0x7d0, None): [ b'\xf1\x00AEhe SCC F-CUP 1.00 1.00 99110-G2600 ', + b'\xf1\x00AEhe SCC FHCUP 1.00 1.00 99110-G2600 ', ], (Ecu.eps, 0x7d4, None): [ b'\xf1\x00AE MDPS C 1.00 1.01 56310G2510\x00 4APHC101', @@ -464,6 +498,7 @@ FW_VERSIONS = { ], (Ecu.transmission, 0x7e1, None): [ b'\xf1\x816U3J9051\x00\x00\xf1\x006U3H1_C2\x00\x006U3J9051\x00\x00HAE0G16NL2\x00\x00\x00\x00', + b'\xf1\x006U3H1_C2\x00\x006U3J9051\x00\x00HAE0G16NL2\x96\xda\xd4\xee', ], }, CAR.SONATA: { @@ -477,7 +512,6 @@ FW_VERSIONS = { b'\xf1\x00DN8_ SCC FHCUP 1.00 1.01 99110-L1000 ', b'\xf1\x00DN89110-L0000 \xaa\xaa\xaa\xaa\xaa\xaa\xaa ', b'\xf1\x8799110L0000\xf1\x00DN8_ SCC F-CUP 1.00 1.00 99110-L0000 ', - b'\xf1\x8799110L0000\xf1\x00DN8_ SCC FHCUP 1.00 1.00 99110-L0000 ', ], (Ecu.abs, 0x7d1, None): [ b'\xf1\x00DN ESC \x07 106 \x07\x01 58910-L0100', @@ -490,7 +524,6 @@ FW_VERSIONS = { b'\xf1\x8758910-L0100\xf1\x00DN ESC \x06 104\x19\x08\x01 58910-L0100', b'\xf1\x8758910-L0100\xf1\x00DN ESC \x06 106 \x07\x01 58910-L0100', b'\xf1\x8758910-L0100\xf1\x00DN ESC \x07 104\x19\x08\x01 58910-L0100', - b'\xf1\x8758910-L0300\xf1\x00DN ESC \x03 100 \x08\x01 58910-L0300', b'\xf1\x00DN ESC \x06 106 \x07\x01 58910-L0100', ], (Ecu.engine, 0x7e0, None): [ @@ -509,6 +542,8 @@ FW_VERSIONS = { b'HM6M1_0a0_G20', b'HM6M2_0a0_BD0', b'\xf1\x8739110-2S278\xf1\x82DNDVD5GMCCXXXL5B', + b'\xf1\x8739110-2S041\xf1\x81HM6M1_0a0_M00', + b'\xf1\x81HM6M1_0a0_G20', ], (Ecu.eps, 0x7d4, None): [ b'\xf1\x00DN8 MDPS C 1,00 1,01 56310L0010\x00 4DNAC101', # modified firmware @@ -526,6 +561,7 @@ FW_VERSIONS = { b'\xf1\x8756310L0210\x00\xf1\x00DN8 MDPS C 1.00 1.01 56310L0210\x00 4DNAC101', b'\xf1\x8757700-L0000\xf1\x00DN8 MDPS R 1.00 1.00 57700-L0000 4DNAP100', b'\xf1\x00DN8 MDPS R 1.00 1.00 57700-L0000 4DNAP101', + b'\xf1\x00DN8 MDPS C 1.00 1.01 56310-L0210 4DNAC102', ], (Ecu.fwdCamera, 0x7c4, None): [ b'\xf1\x00DN8 MFC AT KOR LHD 1.00 1.02 99211-L1000 190422', @@ -535,6 +571,7 @@ FW_VERSIONS = { b'\xf1\x00DN8 MFC AT USA LHD 1.00 1.03 99211-L0000 210603', b'\xf1\x00DN8 MFC AT USA LHD 1.00 1.05 99211-L1000 201109', b'\xf1\x00DN8 MFC AT USA LHD 1.00 1.06 99211-L1000 210325', + b'\xf1\x00DN8 MFC AT USA LHD 1.00 1.07 99211-L1000 211223', ], (Ecu.transmission, 0x7e1, None): [ b'\xf1\x00bcsh8p54 U903\x00\x00\x00\x00\x00\x00SDN8T16NB0z{\xd4v', @@ -545,8 +582,10 @@ FW_VERSIONS = { b'\xf1\x00HT6WA250BLHT6WA910A1SDN8G25NB1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', b'\xf1\x00HT6WA250BLHT6WA910A1SDN8G25NB1\x00\x00\x00\x00\x00\x00\x96\xa1\xf1\x92', b'\xf1\x00HT6WA280BLHT6WAD10A1SDN8G25NB2\x00\x00\x00\x00\x00\x00\x08\xc9O:', + b'\xf1\x00HT6WA280BLHT6WAD10A1SDN8G25NB4\x00\x00\x00\x00\x00\x00g!l[', b'\xf1\x00T02601BL T02730A1 VDN8T25XXX730NS5\xf7_\x92\xf5', b'\xf1\x00T02601BL T02832A1 VDN8T25XXX832NS8G\x0e\xfeE', + b'\xf1\x00T02601BL T02900A1 VDN8T25XXX900NSCF\xe4!Y', b'\xf1\x87954A02N060\x00\x00\x00\x00\x00\xf1\x81T02730A1 \xf1\x00T02601BL T02730A1 VDN8T25XXX730NS5\xf7_\x92\xf5', b'\xf1\x87SAKFBA2926554GJ2VefVww\x87xwwwww\x88\x87xww\x87wTo\xfb\xffvUo\xff\x8d\x16\xf1\x81U903\x00\x00\x00\x00\x00\x00\xf1\x00bcsh8p54 U903\x00\x00\x00\x00\x00\x00SDN8T16NB0z{\xd4v', b'\xf1\x87SAKFBA3030524GJ2UVugww\x97yx\x88\x87\x88vw\x87gww\x87wto\xf9\xfffUo\xff\xa2\x0c\xf1\x81U903\x00\x00\x00\x00\x00\x00\xf1\x00bcsh8p54 U903\x00\x00\x00\x00\x00\x00SDN8T16NB0z{\xd4v', @@ -596,6 +635,7 @@ FW_VERSIONS = { b'\xf1\x87SALFBA7460044GJ2gx\x87\x88Vf\x86hx\x88\x87\x88wwwwgw\x86wd?\xfa\xff\x86U_\xff\xaf\x1f\xf1\x81U913\x00\x00\x00\x00\x00\x00\xf1\x00bcsh8p54 U913\x00\x00\x00\x00\x00\x00SDN8T16NB2\n\xdd^\xbc', b'\xf1\x87SAMFBA8105254GJ2wx\x87\x88Vf\x86hx\x88\x87\x88wwwwwwww\x86O\xfa\xff\x99\x88\x7f\xffZG\xf1\x81U913\x00\x00\x00\x00\x00\x00\xf1\x00bcsh8p54 U913\x00\x00\x00\x00\x00\x00SDN8T16NB2\n\xdd^\xbc', b'\xf1\x87SANFB45889451GC7wx\x87\x88gw\x87x\x88\x88x\x88\x87wxw\x87wxw\x87\x8f\xfc\xffeU\x8f\xff+Q\xf1\x81U913\x00\x00\x00\x00\x00\x00\xf1\x00bcsh8p54 U913\x00\x00\x00\x00\x00\x00SDN8T16NB2\n\xdd^\xbc', + b'\xf1\x00T02601BL T02900A1 VDN8T25XXX900NSA\xb9\x13\xf9p', ], }, CAR.SONATA_LF: { @@ -645,14 +685,16 @@ FW_VERSIONS = { }, CAR.SANTA_FE: { (Ecu.fwdRadar, 0x7d0, None): [ + b'\xf1\x00TM__ SCC F-CUP 1.00 1.00 99110-S1210 ', b'\xf1\x00TM__ SCC F-CUP 1.00 1.01 99110-S2000 ', b'\xf1\x00TM__ SCC F-CUP 1.00 1.02 99110-S2000 ', b'\xf1\x00TM__ SCC F-CUP 1.00 1.03 99110-S2000 ', ], (Ecu.abs, 0x7d1, None): [ b'\xf1\x00TM ESC \r 100\x18\x031 58910-S2650', + b'\xf1\x00TM ESC \r 105\x19\x05# 58910-S1500', b'\xf1\x00TM ESC \r 103\x18\x11\x08 58910-S2650', - b'\xf1\x00TM ESC \r 104\x19\a\b 58910-S2650', + b'\xf1\x00TM ESC \r 104\x19\x07\x08 58910-S2650', b'\xf1\x00TM ESC \x02 100\x18\x030 58910-S2600', b'\xf1\x00TM ESC \x02 102\x18\x07\x01 58910-S2600', b'\xf1\x00TM ESC \x02 103\x18\x11\x07 58910-S2600', @@ -669,11 +711,15 @@ FW_VERSIONS = { b'\xf1\x00TM MDPS C 1.00 1.00 56340-S2000 8409', b'\xf1\x00TM MDPS C 1.00 1.00 56340-S2000 8A12', b'\xf1\x00TM MDPS C 1.00 1.01 56340-S2000 9129', + b'\xf1\x00TM MDPS R 1.00 1.02 57700-S1100 4TMDP102' ], (Ecu.fwdCamera, 0x7c4, None): [ + b'\xf1\x00TM MFC AT EUR LHD 1.00 1.01 99211-S1010 181207', b'\xf1\x00TM MFC AT USA LHD 1.00 1.00 99211-S2000 180409', ], (Ecu.transmission, 0x7e1, None): [ + b'\xf1\x00bcsh8p54 U833\x00\x00\x00\x00\x00\x00TTM4V22US3_<]\xf1', + b'\xf1\x006W351_C2\x00\x006W3E1051\x00\x00TTM4T20NS5\x00\x00\x00\x00', b'\xf1\x87LBJSGA7082574HG0\x87www\x98\x88\x88\x88\x99\xaa\xb9\x9afw\x86gx\x99\xa7\x89co\xf8\xffvU_\xffR\xaf\xf1\x816W3C2051\x00\x00\xf1\x006W351_C2\x00\x006W3C2051\x00\x00TTM2T20NS1\x00\xa6\xe0\x91', b'\xf1\x87LBKSGA0458404HG0vfvg\x87www\x89\x99\xa8\x99y\xaa\xa7\x9ax\x88\xa7\x88t_\xf9\xff\x86w\x8f\xff\x15x\xf1\x816W3C2051\x00\x00\xf1\x006W351_C2\x00\x006W3C2051\x00\x00TTM2T20NS1\x00\x00\x00\x00', b'\xf1\x87LDJUEA6010814HG1\x87w\x87x\x86gvw\x88\x88\x98\x88gw\x86wx\x88\x97\x88\x85o\xf8\xff\x86f_\xff\xd37\xf1\x816W3C2051\x00\x00\xf1\x006W351_C2\x00\x006W3C2051\x00\x00TTM4T20NS0\xf8\x19\x92g', @@ -704,7 +750,6 @@ FW_VERSIONS = { (Ecu.fwdRadar, 0x7d0, None): [ b'\xf1\x00TM__ SCC F-CUP 1.00 1.00 99110-S1500 ', b'\xf1\x8799110S1500\xf1\x00TM__ SCC F-CUP 1.00 1.00 99110-S1500 ', - b'\xf1\x8799110S1500\xf1\x00TM__ SCC FHCUP 1.00 1.00 99110-S1500 ', b'\xf1\x00TM__ SCC FHCUP 1.00 1.00 99110-S1500 ', ], (Ecu.abs, 0x7d1, None): [ @@ -738,6 +783,7 @@ FW_VERSIONS = { b'\xf1\x00TMA MFC AT USA LHD 1.00 1.01 99211-S2500 210205', ], (Ecu.transmission, 0x7e1, None): [ + b'\xf1\x00T02601BL T02900A1 VTMPT25XXX900NSA\xf3\xf4Uj', b'\xf1\x87SDMXCA9087684GN1VfvgUUeVwwgwwwwwffffU?\xfb\xff\x97\x88\x7f\xff+\xa4\xf1\x89HT6WAD00A1\xf1\x82STM4G25NH1\x00\x00\x00\x00\x00\x00', b'\xf1\x00T02601BL T02730A1 VTMPT25XXX730NS2\xa6\x06\x88\xf7', b'\xf1\x87SDMXCA8653204GN1EVugEUuWwwwwww\x87wwwwwv/\xfb\xff\xa8\x88\x9f\xff\xa5\x9c\xf1\x89HT6WAD00A1\xf1\x82STM4G25NH1\x00\x00\x00\x00\x00\x00', @@ -752,19 +798,23 @@ FW_VERSIONS = { }, CAR.SANTA_FE_HEV_2022: { (Ecu.fwdRadar, 0x7d0, None): [ - b'\xf1\x8799110CL500\xf1\x00TMhe SCC FHCUP 1.00 1.00 99110-CL500 ', + b'\xf1\x00TMhe SCC FHCUP 1.00 1.00 99110-CL500 ', ], (Ecu.eps, 0x7d4, None): [ b'\xf1\x00TM MDPS C 1.00 1.02 56310-CLAC0 4TSHC102', + b'\xf1\x00TM MDPS R 1.00 1.05 57700-CL000 4TSHP105', ], (Ecu.fwdCamera, 0x7c4, None): [ + b'\xf1\x00TMH MFC AT EUR LHD 1.00 1.06 99211-S1500 220727', b'\xf1\x00TMH MFC AT USA LHD 1.00 1.03 99211-S1500 210224', ], (Ecu.transmission, 0x7e1, None): [ + b'\xf1\x00PSBG2333 E16\x00\x00\x00\x00\x00\x00\x00TTM2H16UA3I\x94\xac\x8f', b'\xf1\x87959102T250\x00\x00\x00\x00\x00\xf1\x81E14\x00\x00\x00\x00\x00\x00\x00\xf1\x00PSBG2333 E14\x00\x00\x00\x00\x00\x00\x00TTM2H16SA2\x80\xd7l\xb2', ], (Ecu.engine, 0x7e0, None): [ b'\xf1\x87391312MTC1', + b'\xf1\x87391312MTE0', ], }, CAR.SANTA_FE_PHEV_2022: { @@ -791,6 +841,7 @@ FW_VERSIONS = { b'\xf1\x00CK__ SCC F_CUP 1.00 1.01 96400-J5100 ', b'\xf1\x00CK__ SCC F_CUP 1.00 1.03 96400-J5100 ', b'\xf1\x00CK__ SCC F_CUP 1.00 1.01 96400-J5000 ', + b'\xf1\x00CK__ SCC F_CUP 1.00 1.02 96400-J5100 ', ], (Ecu.engine, 0x7e0, None): [ b'\xf1\x81606DE051\x00\x00\x00\x00\x00\x00\x00\x00', @@ -798,6 +849,7 @@ FW_VERSIONS = { b'\xf1\x82CKJN3TMSDE0B\x00\x00\x00\x00', b'\xf1\x82CKKN3TMD_H0A\x00\x00\x00\x00', b'\xe0\x19\xff\xe7\xe7g\x01\xa2\x00\x0f\x00\x9e\x00\x06\x00\xff\xff\xff\xff\xff\xff\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\x0f\x0e\x0f\x0f\x0e\r\x00\x00\x7f\x02.\xff\x00\x00~p\x00\x00\x00\x00u\xff\xf9\xff\x00\x00\x00\x00V\t\xd5\x01\xc0\x00\x00\x00\x007\xfb\xfc\x0b\x8d\x00', + b'\xf1\x81640H0051\x00\x00\x00\x00\x00\x00\x00\x00', ], (Ecu.eps, 0x7d4, None): [ b'\xf1\x00CK MDPS R 1.00 1.04 57700-J5200 4C2CL104', @@ -805,6 +857,7 @@ FW_VERSIONS = { b'\xf1\x00CK MDPS R 1.00 1.04 57700-J5420 4C4VL104', b'\xf1\x00CK MDPS R 1.00 1.06 57700-J5420 4C4VL106', b'\xf1\x00CK MDPS R 1.00 1.07 57700-J5220 4C2VL107', + b'\xf1\x00CK MDPS R 1.00 1.06 57700-J5220 4C2VL106', ], (Ecu.fwdCamera, 0x7c4, None): [ b'\xf1\x00CK MFC AT USA LHD 1.00 1.03 95740-J5000 170822', @@ -812,6 +865,7 @@ FW_VERSIONS = { b'\xf1\x00CK MFC AT EUR LHD 1.00 1.03 95740-J5000 170822', ], (Ecu.transmission, 0x7e1, None): [ + b'\xf1\x00bcsh8p54 E25\x00\x00\x00\x00\x00\x00\x00SCK0T33NB2\xb3\xee\xba\xdc', b'\xf1\x87VCJLE17622572DK0vd6D\x99\x98y\x97vwVffUfvfC%CuT&Dx\x87o\xff{\x1c\xf1\x81E21\x00\x00\x00\x00\x00\x00\x00\xf1\x00bcsh8p54 E21\x00\x00\x00\x00\x00\x00\x00SCK0T33NB0\x88\xa2\xe6\xf0', b'\xf1\x87VDHLG17000192DK2xdFffT\xa5VUD$DwT\x86wveVeeD&T\x99\xba\x8f\xff\xcc\x99\xf1\x81E21\x00\x00\x00\x00\x00\x00\x00\xf1\x00bcsh8p54 E21\x00\x00\x00\x00\x00\x00\x00SCK0T33NB0\x88\xa2\xe6\xf0', b'\xf1\x87VDHLG17000192DK2xdFffT\xa5VUD$DwT\x86wveVeeD&T\x99\xba\x8f\xff\xcc\x99\xf1\x89E21\x00\x00\x00\x00\x00\x00\x00\xf1\x82SCK0T33NB0', @@ -1003,6 +1057,25 @@ FW_VERSIONS = { b'\xf1\x81640H0051\x00\x00\x00\x00\x00\x00\x00\x00', ], }, + CAR.GENESIS_G80: { + (Ecu.fwdRadar, 0x7d0, None): [ + b'\xf1\x00DH__ SCC F-CUP 1.00 1.01 96400-B1120 ', + ], + (Ecu.fwdCamera, 0x7c4, None): [ + b'\xf1\x00DH LKAS AT USA LHD 1.01 1.03 95895-B1500 180713', + b'\xf1\x00DH LKAS AT USA LHD 1.01 1.02 95895-B1500 170810', + b'\xf1\x00DH LKAS AT USA LHD 1.01 1.01 95895-B1500 161014', + ], + (Ecu.transmission, 0x7e1, None): [ + b'\xf1\x00bcsh8p54 E21\x00\x00\x00\x00\x00\x00\x00SDH0T33NH4\xd7O\x9e\xc9', + b'\xf1\x00bcsh8p54 E18\x00\x00\x00\x00\x00\x00\x00TDH0G38NH3:-\xa9n', + b'\xf1\x00bcsh8p54 E18\x00\x00\x00\x00\x00\x00\x00SDH0G38NH2j\x9dA\x1c', + b'\xf1\x00bcsh8p54 E18\x00\x00\x00\x00\x00\x00\x00SDH0T33NH3\x97\xe6\xbc\xb8', + ], + (Ecu.engine, 0x7e0, None): [ + b'\xf1\x81640F0051\x00\x00\x00\x00\x00\x00\x00\x00', + ], + }, CAR.GENESIS_G90: { (Ecu.transmission, 0x7e1, None): [b'\xf1\x87VDGMD15866192DD3x\x88x\x89wuFvvfUf\x88vWwgwwwvfVgx\x87o\xff\xbc^\xf1\x81E14\x00\x00\x00\x00\x00\x00\x00\xf1\x00bcshcm49 E14\x00\x00\x00\x00\x00\x00\x00SHI0G50NB1tc5\xb7'], (Ecu.fwdRadar, 0x7d0, None): [b'\xf1\x00HI__ SCC F-CUP 1.00 1.01 96400-D2100 '], @@ -1091,6 +1164,23 @@ FW_VERSIONS = { b'\xf1\x00bcsh8p54 U913\x00\x00\x00\x00\x00\x00TDL4T16NB05\x94t\x18', ], }, + CAR.KIA_K5_HEV_2020: { + (Ecu.fwdRadar, 0x7D0, None): [ + b'\xf1\x00DLhe SCC FHCUP 1.00 1.02 99110-L7000 ', + ], + (Ecu.eps, 0x7D4, None): [ + b'\xf1\x00DL3 MDPS C 1.00 1.02 56310-L7000 4DLHC102', + ], + (Ecu.fwdCamera, 0x7C4, None): [ + b'\xf1\x00DL3HMFC AT KOR LHD 1.00 1.02 99210-L2000 200309', + ], + (Ecu.engine, 0x7E0, None): [ + b'\xf1\x87391162JLA0', + ], + (Ecu.transmission, 0x7E1, None): [ + b'\xf1\x00PSBG2323 E08\x00\x00\x00\x00\x00\x00\x00TDL2H20KA2\xe3\xc6cz', + ], + }, CAR.KONA_EV: { (Ecu.abs, 0x7D1, None): [ b'\xf1\x00OS IEB \r 105\x18\t\x18 58520-K4000', @@ -1177,22 +1267,27 @@ FW_VERSIONS = { (Ecu.engine, 0x7e0, None): [ b'\xf1\x816H6F4051\x00\x00\x00\x00\x00\x00\x00\x00', b'\xf1\x816H6D1051\x00\x00\x00\x00\x00\x00\x00\x00', + b'\xf1\x816H6F6051\x00\x00\x00\x00\x00\x00\x00\x00', ], (Ecu.transmission, 0x7e1, None): [ b"\xf1\x816U3J2051\x00\x00\xf1\x006U3H0_C2\x00\x006U3J2051\x00\x00PDE0G16NS2\xf4'\\\x91", b'\xf1\x816U3J2051\x00\x00\xf1\x006U3H0_C2\x00\x006U3J2051\x00\x00PDE0G16NS2\x00\x00\x00\x00', b'\xf1\x816U3H3051\x00\x00\xf1\x006U3H0_C2\x00\x006U3H3051\x00\x00PDE0G16NS1\x00\x00\x00\x00', b'\xf1\x816U3H3051\x00\x00\xf1\x006U3H0_C2\x00\x006U3H3051\x00\x00PDE0G16NS1\x13\xcd\x88\x92', + b'\xf1\x006U3H1_C2\x00\x006U3J9051\x00\x00PDE0G16NL2&[\xc3\x01', ], (Ecu.eps, 0x7D4, None): [ b'\xf1\x00DE MDPS C 1.00 1.09 56310G5301\x00 4DEHC109', + b'\xf1\x00DE MDPS C 1.00 1.01 56310G5520\x00 4DEPC101', ], (Ecu.fwdCamera, 0x7C4, None): [ b'\xf1\x00DEP MFC AT USA LHD 1.00 1.01 95740-G5010 170424', b'\xf1\x00DEP MFC AT USA LHD 1.00 1.00 95740-G5010 170117', + b'\xf1\x00DEP MFC AT USA LHD 1.00 1.05 99211-G5000 190826', ], (Ecu.fwdRadar, 0x7D0, None): [ b'\xf1\x00DEhe SCC H-CUP 1.01 1.02 96400-G5100 ', + b'\xf1\x00DEhe SCC F-CUP 1.00 1.02 99110-G5100 ', ], }, CAR.KIA_NIRO_HEV_2021: { @@ -1304,25 +1399,26 @@ FW_VERSIONS = { (Ecu.fwdRadar, 0x7d0, None): [ b'\xf1\x00CN7_ SCC F-CUP 1.00 1.01 99110-AA000 ', b'\xf1\x00CN7_ SCC FHCUP 1.00 1.01 99110-AA000 ', + b'\xf1\x00CN7_ SCC FNCUP 1.00 1.01 99110-AA000 ', b'\xf1\x8799110AA000\xf1\x00CN7_ SCC FHCUP 1.00 1.01 99110-AA000 ', b'\xf1\x8799110AA000\xf1\x00CN7_ SCC F-CUP 1.00 1.01 99110-AA000 ', ], (Ecu.eps, 0x7d4, None): [ b'\xf1\x87\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xf1\x00CN7 MDPS C 1.00 1.06 \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 4CNDC106', b'\xf1\x8756310/AA070\xf1\x00CN7 MDPS C 1.00 1.06 56310/AA070 4CNDC106', - b'\xf1\x8756310AA050\x00\xf1\x00CN7 MDPS C 1.00 1.06 56310AA050\x00 4CNDC106', b'\xf1\x8756310AA050\x00\xf1\x00CN7 MDPS C 1.00 1.06 56310AA050\x00 4CNDC106\xf1\xa01.06', + b'\xf1\x00CN7 MDPS C 1.00 1.06 56310AA050\x00 4CNDC106', ], (Ecu.fwdCamera, 0x7c4, None): [ b'\xf1\x00CN7 MFC AT USA LHD 1.00 1.00 99210-AB000 200819', b'\xf1\x00CN7 MFC AT USA LHD 1.00 1.03 99210-AA000 200819', b'\xf1\x00CN7 MFC AT USA LHD 1.00 1.01 99210-AB000 210205', b'\xf1\x00CN7 MFC AT USA LHD 1.00 1.06 99210-AA000 220111', + b'\xf1\x00CN7 MFC AT USA LHD 1.00 1.03 99210-AB000 220426', ], (Ecu.abs, 0x7d1, None): [ b'\xf1\x00CN ESC \t 101 \x10\x03 58910-AB800', b'\xf1\x8758910-AA800\xf1\x00CN ESC \t 104 \x08\x03 58910-AA800', - b'\xf1\x8758910-AB800\xf1\x00CN ESC \t 101 \x10\x03 58910-AB800', b'\xf1\x8758910-AA800\xf1\x00CN ESC \t 105 \x10\x03 58910-AA800', b'\xf1\x8758910-AB800\xf1\x00CN ESC \t 101 \x10\x03 58910-AB800\xf1\xa01.01', ], @@ -1340,6 +1436,7 @@ FW_VERSIONS = { b'\xf1\x81HM6M2_0a0_FF0', b'\xf1\x82CNCVD0AMFCXCSFFB', b'\xf1\x870\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xf1\x81HM6M2_0a0_G80', + b'\xf1\x870\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xf1\x81HM6M2_0a0_HC0', ], }, CAR.ELANTRA_HEV_2021: { @@ -1447,24 +1544,28 @@ FW_VERSIONS = { CAR.KIA_EV6: { (Ecu.fwdRadar, 0x7d0, None): [ b'\xf1\x00CV1_ RDR ----- 1.00 1.01 99110-CV000 ', - b'\xf1\x8799110CV000\xf1\x00CV1_ RDR ----- 1.00 1.01 99110-CV000 ', ], (Ecu.fwdCamera, 0x7c4, None): [ b'\xf1\x00CV1 MFC AT USA LHD 1.00 1.05 99210-CV000 211027', b'\xf1\x00CV1 MFC AT USA LHD 1.00 1.06 99210-CV000 220328', b'\xf1\x00CV1 MFC AT EUR LHD 1.00 1.05 99210-CV000 211027', b'\xf1\x00CV1 MFC AT EUR LHD 1.00 1.06 99210-CV000 220328', + b'\xf1\x00CV1 MFC AT EUR RHD 1.00 1.00 99210-CV100 220630', + b'\xf1\x00CV1 MFC AT USA LHD 1.00 1.00 99210-CV100 220630', ], }, CAR.IONIQ_5: { (Ecu.fwdRadar, 0x7d0, None): [ b'\xf1\x00NE1_ RDR ----- 1.00 1.00 99110-GI000 ', - b'\xf1\x8799110GI000\xf1\x00NE1_ RDR ----- 1.00 1.00 99110-GI000 ', ], (Ecu.fwdCamera, 0x7c4, None): [ b'\xf1\x00NE1 MFC AT USA LHD 1.00 1.02 99211-GI010 211206', b'\xf1\x00NE1 MFC AT EUR LHD 1.00 1.06 99211-GI000 210813', b'\xf1\x00NE1 MFC AT USA LHD 1.00 1.05 99211-GI010 220614', + b'\xf1\x00NE1 MFC AT EUR RHD 1.00 1.01 99211-GI010 211007', + b'\xf1\x00NE1 MFC AT USA LHD 1.00 1.01 99211-GI010 211007', + b'\xf1\x00NE1 MFC AT EUR RHD 1.00 1.02 99211-GI010 211206', + b'\xf1\x00NE1 MFC AT USA LHD 1.00 1.03 99211-GI010 220401', ], }, CAR.TUCSON_4TH_GEN: { @@ -1496,9 +1597,11 @@ FW_VERSIONS = { CAR.SANTA_CRUZ_1ST_GEN: { (Ecu.fwdCamera, 0x7c4, None): [ b'\xf1\x00NX4 FR_CMR AT USA LHD 1.00 1.00 99211-CW000 14M', + b'\xf1\x00NX4 FR_CMR AT USA LHD 1.00 1.00 99211-CW010 14X', ], (Ecu.fwdRadar, 0x7d0, None): [ b'\xf1\x00NX4__ 1.00 1.00 99110-K5000 ', + b'\xf1\x00NX4__ 1.01 1.00 99110-K5000 ', ], }, CAR.KIA_SPORTAGE_5TH_GEN: { @@ -1514,23 +1617,42 @@ FW_VERSIONS = { CAR.GENESIS_GV70_1ST_GEN: { (Ecu.fwdCamera, 0x7c4, None): [ b'\xf1\x00JK1 MFC AT USA LHD 1.00 1.04 99211-AR000 210204', + b'\xf1\x00JK1 MFC AT USA LHD 1.00 1.01 99211-AR200 220125', ], (Ecu.fwdRadar, 0x7d0, None): [ b'\xf1\x00JK1_ SCC FHCUP 1.00 1.02 99110-AR000 ', + b'\xf1\x00JK1_ SCC FHCUP 1.00 1.00 99110-AR200 ', ], }, CAR.GENESIS_GV60_EV_1ST_GEN: { (Ecu.fwdCamera, 0x7c4, None): [ b'\xf1\x00JW1 MFC AT USA LHD 1.00 1.02 99211-CU100 211215', + b'\xf1\x00JW1 MFC AT USA LHD 1.00 1.02 99211-CU000 211215', ], (Ecu.fwdRadar, 0x7d0, None): [ b'\xf1\x00JW1_ RDR ----- 1.00 1.00 99110-CU000 ', ], }, + CAR.KIA_SORENTO_4TH_GEN: { + (Ecu.fwdCamera, 0x7c4, None): [ + b'\xf1\x00MQ4 MFC AT USA LHD 1.00 1.05 99210-R5000 210623', + ], + (Ecu.fwdRadar, 0x7d0, None): [ + b'\xf1\x00MQ4_ SCC FHCUP 1.00 1.06 99110-P2000 ', + ], + }, + CAR.KIA_NIRO_HEV_2ND_GEN: { + (Ecu.fwdCamera, 0x7c4, None): [ + b'\xf1\x00SG2HMFC AT USA LHD 1.01 1.08 99211-AT000 220531', + ], + (Ecu.fwdRadar, 0x7d0, None): [ + b'\xf1\x00SG2_ RDR ----- 1.00 1.01 99110-AT000 ', + ], + }, } CHECKSUM = { - "crc8": [CAR.SANTA_FE, CAR.SONATA, CAR.PALISADE, CAR.KIA_SELTOS, CAR.ELANTRA_2021, CAR.ELANTRA_HEV_2021, CAR.SONATA_HYBRID, CAR.SANTA_FE_2022, CAR.KIA_K5_2021, CAR.SANTA_FE_HEV_2022, CAR.SANTA_FE_PHEV_2022], + "crc8": [CAR.SANTA_FE, CAR.SONATA, CAR.PALISADE, CAR.KIA_SELTOS, CAR.ELANTRA_2021, CAR.ELANTRA_HEV_2021, CAR.SONATA_HYBRID, CAR.SANTA_FE_2022, CAR.KIA_K5_2021, CAR.SANTA_FE_HEV_2022, CAR.SANTA_FE_PHEV_2022, CAR.KIA_K5_HEV_2020], "6B": [CAR.KIA_SORENTO, CAR.HYUNDAI_GENESIS], } @@ -1538,25 +1660,23 @@ FEATURES = { # which message has the gear "use_cluster_gears": {CAR.ELANTRA, CAR.KONA}, "use_tcu_gears": {CAR.KIA_OPTIMA_G4, CAR.KIA_OPTIMA_G4_FL, CAR.SONATA_LF, CAR.VELOSTER, CAR.TUCSON}, - "use_elect_gears": {CAR.KIA_NIRO_EV, CAR.KIA_NIRO_PHEV, CAR.KIA_NIRO_HEV_2021, CAR.KIA_OPTIMA_H, CAR.IONIQ_EV_LTD, CAR.KONA_EV, CAR.IONIQ, CAR.IONIQ_EV_2020, CAR.IONIQ_PHEV, CAR.ELANTRA_HEV_2021, CAR.SONATA_HYBRID, CAR.KONA_HEV, CAR.IONIQ_HEV_2022, CAR.SANTA_FE_HEV_2022, CAR.SANTA_FE_PHEV_2022, CAR.IONIQ_PHEV_2019, CAR.KONA_EV_2022}, - - # these cars use the FCA11 message for the AEB and FCW signals, all others use SCC12 - "use_fca": {CAR.SONATA, CAR.SONATA_HYBRID, CAR.ELANTRA, CAR.ELANTRA_2021, CAR.ELANTRA_HEV_2021, CAR.KIA_STINGER, CAR.IONIQ_EV_2020, CAR.IONIQ_PHEV, CAR.KONA_EV, CAR.KIA_FORTE, CAR.KIA_NIRO_EV, CAR.PALISADE, CAR.GENESIS_G70, CAR.GENESIS_G70_2020, CAR.KONA, CAR.SANTA_FE, CAR.KIA_SELTOS, CAR.KONA_HEV, CAR.SANTA_FE_2022, CAR.KIA_K5_2021, CAR.IONIQ_HEV_2022, CAR.SANTA_FE_HEV_2022, CAR.SANTA_FE_PHEV_2022, CAR.TUCSON, CAR.KONA_EV_2022, CAR.KIA_STINGER_2022}, + "use_elect_gears": {CAR.KIA_NIRO_EV, CAR.KIA_NIRO_PHEV, CAR.KIA_NIRO_HEV_2021, CAR.KIA_OPTIMA_H, CAR.IONIQ_EV_LTD, CAR.KONA_EV, CAR.IONIQ, CAR.IONIQ_EV_2020, CAR.IONIQ_PHEV, CAR.ELANTRA_HEV_2021, CAR.SONATA_HYBRID, CAR.KONA_HEV, CAR.IONIQ_HEV_2022, CAR.SANTA_FE_HEV_2022, CAR.SANTA_FE_PHEV_2022, CAR.IONIQ_PHEV_2019, CAR.KONA_EV_2022, CAR.KIA_K5_HEV_2020}, } -CANFD_CAR = {CAR.KIA_EV6, CAR.IONIQ_5, CAR.TUCSON_4TH_GEN, CAR.TUCSON_HYBRID_4TH_GEN, CAR.KIA_SPORTAGE_HYBRID_5TH_GEN, CAR.SANTA_CRUZ_1ST_GEN, CAR.KIA_SPORTAGE_5TH_GEN, CAR.GENESIS_GV70_1ST_GEN, CAR.KIA_SORENTO_PHEV_4TH_GEN, CAR.GENESIS_GV60_EV_1ST_GEN} +CANFD_CAR = {CAR.KIA_EV6, CAR.IONIQ_5, CAR.TUCSON_4TH_GEN, CAR.TUCSON_HYBRID_4TH_GEN, CAR.KIA_SPORTAGE_HYBRID_5TH_GEN, CAR.SANTA_CRUZ_1ST_GEN, CAR.KIA_SPORTAGE_5TH_GEN, CAR.GENESIS_GV70_1ST_GEN, CAR.KIA_SORENTO_PHEV_4TH_GEN, CAR.GENESIS_GV60_EV_1ST_GEN, CAR.KIA_SORENTO_4TH_GEN, CAR.KIA_NIRO_HEV_2ND_GEN} # The radar does SCC on these cars when HDA I, rather than the camera -CANFD_RADAR_SCC_CAR = {CAR.GENESIS_GV70_1ST_GEN, CAR.KIA_SORENTO_PHEV_4TH_GEN} +CANFD_RADAR_SCC_CAR = {CAR.GENESIS_GV70_1ST_GEN, CAR.KIA_SORENTO_PHEV_4TH_GEN, CAR.KIA_SORENTO_4TH_GEN} # The camera does SCC on these cars, rather than the radar CAMERA_SCC_CAR = {CAR.KONA_EV_2022, } -HYBRID_CAR = {CAR.IONIQ_PHEV, CAR.ELANTRA_HEV_2021, CAR.KIA_NIRO_PHEV, CAR.KIA_NIRO_HEV_2021, CAR.SONATA_HYBRID, CAR.KONA_HEV, CAR.IONIQ, CAR.IONIQ_HEV_2022, CAR.SANTA_FE_HEV_2022, CAR.SANTA_FE_PHEV_2022, CAR.IONIQ_PHEV_2019, CAR.TUCSON_HYBRID_4TH_GEN, CAR.KIA_SPORTAGE_HYBRID_5TH_GEN, CAR.KIA_SORENTO_PHEV_4TH_GEN} # these cars use a different gas signal +HYBRID_CAR = {CAR.IONIQ_PHEV, CAR.ELANTRA_HEV_2021, CAR.KIA_NIRO_PHEV, CAR.KIA_NIRO_HEV_2021, CAR.SONATA_HYBRID, CAR.KONA_HEV, CAR.IONIQ, CAR.IONIQ_HEV_2022, CAR.SANTA_FE_HEV_2022, CAR.SANTA_FE_PHEV_2022, CAR.IONIQ_PHEV_2019, CAR.TUCSON_HYBRID_4TH_GEN, CAR.KIA_SPORTAGE_HYBRID_5TH_GEN, CAR.KIA_SORENTO_PHEV_4TH_GEN, CAR.KIA_K5_HEV_2020, CAR.KIA_NIRO_HEV_2ND_GEN} # these cars use a different gas signal EV_CAR = {CAR.IONIQ_EV_2020, CAR.IONIQ_EV_LTD, CAR.KONA_EV, CAR.KIA_NIRO_EV, CAR.KONA_EV_2022, CAR.KIA_EV6, CAR.IONIQ_5, CAR.GENESIS_GV60_EV_1ST_GEN} # these cars require a special panda safety mode due to missing counters and checksums in the messages -LEGACY_SAFETY_MODE_CAR = {CAR.HYUNDAI_GENESIS, CAR.IONIQ_EV_2020, CAR.IONIQ_EV_LTD, CAR.IONIQ_PHEV, CAR.IONIQ, CAR.KONA_EV, CAR.KIA_SORENTO, CAR.SONATA_LF, CAR.KIA_OPTIMA_G4, CAR.KIA_OPTIMA_G4_FL, CAR.VELOSTER, CAR.KIA_STINGER, CAR.GENESIS_G70, CAR.GENESIS_G80, CAR.KIA_CEED, CAR.ELANTRA, CAR.IONIQ_HEV_2022} +LEGACY_SAFETY_MODE_CAR = {CAR.HYUNDAI_GENESIS, CAR.IONIQ_EV_2020, CAR.IONIQ_EV_LTD, CAR.IONIQ_PHEV, CAR.IONIQ, CAR.KONA_EV, CAR.KIA_SORENTO, CAR.SONATA_LF, CAR.KIA_OPTIMA_G4, CAR.KIA_OPTIMA_G4_FL, CAR.VELOSTER, + CAR.GENESIS_G70, CAR.GENESIS_G80, CAR.KIA_CEED, CAR.ELANTRA, CAR.IONIQ_HEV_2022} # If 0x500 is present on bus 1 it probably has a Mando radar outputting radar points. # If no points are outputted by default it might be possible to turn it on using selfdrive/debug/hyundai_enable_radar_points.py @@ -1577,6 +1697,7 @@ DBC = { CAR.IONIQ_HEV_2022: dbc_dict('hyundai_kia_generic', None), CAR.KIA_FORTE: dbc_dict('hyundai_kia_generic', None), CAR.KIA_K5_2021: dbc_dict('hyundai_kia_generic', None), + CAR.KIA_K5_HEV_2020: dbc_dict('hyundai_kia_generic', 'hyundai_kia_mando_front_radar_generated'), CAR.KIA_NIRO_EV: dbc_dict('hyundai_kia_generic', 'hyundai_kia_mando_front_radar_generated'), CAR.KIA_NIRO_PHEV: dbc_dict('hyundai_kia_generic', 'hyundai_kia_mando_front_radar_generated'), CAR.KIA_NIRO_HEV_2021: dbc_dict('hyundai_kia_generic', None), @@ -1612,4 +1733,6 @@ DBC = { CAR.GENESIS_GV70_1ST_GEN: dbc_dict('hyundai_canfd', None), CAR.KIA_SORENTO_PHEV_4TH_GEN: dbc_dict('hyundai_canfd', None), CAR.GENESIS_GV60_EV_1ST_GEN: dbc_dict('hyundai_canfd', None), + CAR.KIA_SORENTO_4TH_GEN: dbc_dict('hyundai_canfd', None), + CAR.KIA_NIRO_HEV_2ND_GEN: dbc_dict('hyundai_canfd', None), } diff --git a/selfdrive/car/interfaces.py b/selfdrive/car/interfaces.py index 7f0497a1a..cd971abdc 100644 --- a/selfdrive/car/interfaces.py +++ b/selfdrive/car/interfaces.py @@ -94,13 +94,14 @@ class CarInterfaceBase(ABC): return ACCEL_MIN, ACCEL_MAX @classmethod - def get_params(cls, candidate: str, fingerprint: Optional[Dict[int, Dict[int, int]]] = None, car_fw: Optional[List[car.CarParams.CarFw]] = None, experimental_long: bool = False): - if fingerprint is None: - fingerprint = gen_empty_fingerprint() - - if car_fw is None: - car_fw = list() + def get_non_essential_params(cls, candidate: str): + """ + Parameters essential to controlling the car may be incomplete or wrong without FW versions or fingerprints. + """ + return cls.get_params(candidate, gen_empty_fingerprint(), list(), False) + @classmethod + def get_params(cls, candidate: str, fingerprint: Dict[int, Dict[int, int]], car_fw: List[car.CarParams.CarFw], experimental_long: bool): ret = CarInterfaceBase.get_std_params(candidate) ret = cls._get_params(ret, candidate, fingerprint, car_fw, experimental_long) @@ -201,21 +202,45 @@ class CarInterfaceBase(ABC): tune.torque.steeringAngleDeadzoneDeg = steering_angle_deadzone_deg @staticmethod - def configure_dp_tune(candidate, tune, steering_angle_deadzone_deg=0.0, use_steering_angle=True): + def configure_dp_tune(stock, collection): try: dp_lateral_tune = int(Params().get("dp_lateral_tune").decode('utf-8')) except: dp_lateral_tune = 0 - # pid - car specific - if dp_lateral_tune == 1: - configure_pid_tune(candidate, tune) - # lqr - all uses RAV4 one - elif dp_lateral_tune == 2: - configure_lqr_tune(candidate, tune) - # torque - car specific as per lookup table - elif dp_lateral_tune == 3: - CarInterfaceBase.configure_torque_tune(candidate, tune, steering_angle_deadzone_deg, use_steering_angle) + stock_tune = 0 + if stock.which() == 'pid': + stock_tune = 1 + collection.pid = stock.pid + elif stock.which() == 'lqr': + stock_tune = 2 + collection.lqr = stock.lqr + elif stock.which() == 'torque': + stock_tune = 3 + collection.torque = stock.torque + elif stock.which() == 'indi': + stock_tune = 4 + + if dp_lateral_tune > 0 and dp_lateral_tune != stock_tune: + if dp_lateral_tune == 1 and collection.pid is not None: + stock.pid = collection.pid + elif dp_lateral_tune == 2 and collection.lqr is not None: + stock.lqr = collection.lqr + elif dp_lateral_tune == 3 and collection.torque is not None: + stock.torque = collection.torque + + @staticmethod + def dp_lat_tune_collection(candidate, collection, steering_angle_deadzone_deg=0.0, use_steering_angle=True): + for i in range(1, 4): + # pid - car specific + if i == 1: + configure_pid_tune(candidate, collection) + # lqr - all uses RAV4 one + elif i == 2: + configure_lqr_tune(candidate, collection) + # torque - car specific as per lookup table + elif i == 3: + CarInterfaceBase.configure_torque_tune(candidate, collection, steering_angle_deadzone_deg, use_steering_angle) @abstractmethod def _update(self, c: car.CarControl) -> car.CarState: @@ -256,7 +281,7 @@ class CarInterfaceBase(ABC): return reader @abstractmethod - def apply(self, c: car.CarControl) -> Tuple[car.CarControl.Actuators, List[bytes]]: + def apply(self, c: car.CarControl, now_nanos: int) -> Tuple[car.CarControl.Actuators, List[bytes]]: pass def create_common_events(self, cs_out, extra_gears=None, pcm_enable=True, allow_enable=True, @@ -326,6 +351,7 @@ class CarInterfaceBase(ABC): return events + class RadarInterfaceBase(ABC): def __init__(self, CP): self.rcp = None @@ -423,15 +449,15 @@ class CarStateBase(ABC): return GearShifter.unknown d: Dict[str, car.CarState.GearShifter] = { - 'P': GearShifter.park, 'PARK': GearShifter.park, - 'R': GearShifter.reverse, 'REVERSE': GearShifter.reverse, - 'N': GearShifter.neutral, 'NEUTRAL': GearShifter.neutral, - 'E': GearShifter.eco, 'ECO': GearShifter.eco, - 'T': GearShifter.manumatic, 'MANUAL': GearShifter.manumatic, - 'D': GearShifter.drive, 'DRIVE': GearShifter.drive, - 'S': GearShifter.sport, 'SPORT': GearShifter.sport, - 'L': GearShifter.low, 'LOW': GearShifter.low, - 'B': GearShifter.brake, 'BRAKE': GearShifter.brake, + 'P': GearShifter.park, 'PARK': GearShifter.park, + 'R': GearShifter.reverse, 'REVERSE': GearShifter.reverse, + 'N': GearShifter.neutral, 'NEUTRAL': GearShifter.neutral, + 'E': GearShifter.eco, 'ECO': GearShifter.eco, + 'T': GearShifter.manumatic, 'MANUAL': GearShifter.manumatic, + 'D': GearShifter.drive, 'DRIVE': GearShifter.drive, + 'S': GearShifter.sport, 'SPORT': GearShifter.sport, + 'L': GearShifter.low, 'LOW': GearShifter.low, + 'B': GearShifter.brake, 'BRAKE': GearShifter.brake, } return d.get(gear.upper(), GearShifter.unknown) diff --git a/selfdrive/car/mazda/carcontroller.py b/selfdrive/car/mazda/carcontroller.py index 027822cc3..cb401a8ab 100644 --- a/selfdrive/car/mazda/carcontroller.py +++ b/selfdrive/car/mazda/carcontroller.py @@ -1,6 +1,6 @@ from cereal import car from opendbc.can.packer import CANPacker -from selfdrive.car import apply_std_steer_torque_limits +from selfdrive.car import apply_driver_steer_torque_limits from selfdrive.car.mazda import mazdacan from selfdrive.car.mazda.values import CarControllerParams, Buttons @@ -15,7 +15,7 @@ class CarController: self.brake_counter = 0 self.frame = 0 - def update(self, CC, CS): + def update(self, CC, CS, now_nanos): can_sends = [] apply_steer = 0 @@ -23,8 +23,8 @@ class CarController: if CC.latActive: # calculate steer and also set limits due to driver torque new_steer = int(round(CC.actuators.steer * CarControllerParams.STEER_MAX)) - apply_steer = apply_std_steer_torque_limits(new_steer, self.apply_steer_last, - CS.out.steeringTorque, CarControllerParams) + apply_steer = apply_driver_steer_torque_limits(new_steer, self.apply_steer_last, + CS.out.steeringTorque, CarControllerParams) if CC.cruiseControl.cancel: # If brake is pressed, let us wait >70ms before trying to disable crz to avoid diff --git a/selfdrive/car/mazda/interface.py b/selfdrive/car/mazda/interface.py index 4a91f74ba..3ab829444 100755 --- a/selfdrive/car/mazda/interface.py +++ b/selfdrive/car/mazda/interface.py @@ -15,7 +15,7 @@ class CarInterface(CarInterfaceBase): def _get_params(ret, candidate, fingerprint, car_fw, experimental_long): ret.carName = "mazda" ret.safetyConfigs = [get_safety_config(car.CarParams.SafetyModel.mazda)] - ret.radarOffCan = True + ret.radarUnavailable = True ret.dashcamOnly = candidate not in (CAR.CX5_2022, CAR.CX9_2021) and not Params().get_bool('dp_mazda_dashcam_bypass') @@ -45,7 +45,8 @@ class CarInterface(CarInterfaceBase): if candidate not in (CAR.CX5_2022, ): ret.minSteerSpeed = LKAS_LIMITS.DISABLE_SPEED * CV.KPH_TO_MS - CarInterfaceBase.configure_dp_tune(candidate, ret.lateralTuning) + CarInterfaceBase.dp_lat_tune_collection(candidate, ret.latTuneCollection) + CarInterfaceBase.configure_dp_tune(ret.lateralTuning, ret.latTuneCollection) ret.centerToFront = ret.wheelbase * 0.41 @@ -72,5 +73,5 @@ class CarInterface(CarInterfaceBase): return ret - def apply(self, c): - return self.CC.update(c, self.CS) + def apply(self, c, now_nanos): + return self.CC.update(c, self.CS, now_nanos) diff --git a/selfdrive/car/mazda/values.py b/selfdrive/car/mazda/values.py index e6e9b3aee..598b598a1 100644 --- a/selfdrive/car/mazda/values.py +++ b/selfdrive/car/mazda/values.py @@ -20,6 +20,10 @@ class CarControllerParams: STEER_DRIVER_MULTIPLIER = 1 # weight driver torque STEER_DRIVER_FACTOR = 1 # from dbc STEER_ERROR_MAX = 350 # max delta between torque cmd and torque motor + STEER_STEP = 1 # 100 Hz + + def __init__(self, CP): + pass class CAR: diff --git a/selfdrive/car/mock/interface.py b/selfdrive/car/mock/interface.py index 3ac487dbb..13210c86d 100755 --- a/selfdrive/car/mock/interface.py +++ b/selfdrive/car/mock/interface.py @@ -57,7 +57,7 @@ class CarInterface(CarInterfaceBase): return ret - def apply(self, c): + def apply(self, c, now_nanos): # in mock no carcontrols actuators = car.CarControl.Actuators.new_message() return actuators, [] diff --git a/selfdrive/car/nissan/carcontroller.py b/selfdrive/car/nissan/carcontroller.py index ff1381239..45c3dd720 100644 --- a/selfdrive/car/nissan/carcontroller.py +++ b/selfdrive/car/nissan/carcontroller.py @@ -18,7 +18,7 @@ class CarController: self.packer = CANPacker(dbc_name) - def update(self, CC, CS): + def update(self, CC, CS, now_nanos): actuators = CC.actuators hud_control = CC.hudControl pcm_cancel_cmd = CC.cruiseControl.cancel diff --git a/selfdrive/car/nissan/interface.py b/selfdrive/car/nissan/interface.py index 57d8a3892..263bb7a28 100644 --- a/selfdrive/car/nissan/interface.py +++ b/selfdrive/car/nissan/interface.py @@ -19,7 +19,7 @@ class CarInterface(CarInterfaceBase): ret.steerRatio = 17 ret.steerControlType = car.CarParams.SteerControlType.angle - ret.radarOffCan = True + ret.radarUnavailable = True if candidate in (CAR.ROGUE, CAR.XTRAIL): ret.mass = 1610 + STD_CARGO_KG @@ -36,7 +36,8 @@ class CarInterface(CarInterfaceBase): ret.wheelbase = 2.824 ret.centerToFront = ret.wheelbase * 0.44 - CarInterfaceBase.configure_dp_tune(candidate, ret.lateralTuning) + CarInterfaceBase.dp_lat_tune_collection(candidate, ret.latTuneCollection) + CarInterfaceBase.configure_dp_tune(ret.lateralTuning, ret.latTuneCollection) return ret @@ -58,5 +59,5 @@ class CarInterface(CarInterfaceBase): return ret - def apply(self, c): - return self.CC.update(c, self.CS) + def apply(self, c, now_nanos): + return self.CC.update(c, self.CS, now_nanos) diff --git a/selfdrive/car/nissan/values.py b/selfdrive/car/nissan/values.py index a6ee27a4a..e9af828e2 100644 --- a/selfdrive/car/nissan/values.py +++ b/selfdrive/car/nissan/values.py @@ -17,6 +17,9 @@ class CarControllerParams: LKAS_MAX_TORQUE = 1 # A value of 1 is easy to overpower STEER_THRESHOLD = 1.0 + def __init__(self, CP): + pass + class CAR: XTRAIL = "NISSAN X-TRAIL 2017" @@ -36,7 +39,7 @@ class NissanCarInfo(CarInfo): CAR_INFO: Dict[str, Optional[Union[NissanCarInfo, List[NissanCarInfo]]]] = { CAR.XTRAIL: NissanCarInfo("Nissan X-Trail 2017"), - CAR.LEAF: NissanCarInfo("Nissan Leaf 2018-22"), + CAR.LEAF: NissanCarInfo("Nissan Leaf 2018-22", video_link="https://youtu.be/vaMbtAh_0cY"), CAR.LEAF_IC: None, # same platforms CAR.ROGUE: NissanCarInfo("Nissan Rogue 2018-20"), CAR.ALTIMA: NissanCarInfo("Nissan Altima 2019-20", harness=Harness.nissan_b), diff --git a/selfdrive/car/subaru/carcontroller.py b/selfdrive/car/subaru/carcontroller.py index a56e63408..a6dbf4a39 100644 --- a/selfdrive/car/subaru/carcontroller.py +++ b/selfdrive/car/subaru/carcontroller.py @@ -1,5 +1,5 @@ from opendbc.can.packer import CANPacker -from selfdrive.car import apply_std_steer_torque_limits +from selfdrive.car import apply_driver_steer_torque_limits from selfdrive.car.subaru import subarucan from selfdrive.car.subaru.values import DBC, GLOBAL_GEN2, PREGLOBAL_CARS, CarControllerParams @@ -19,7 +19,7 @@ class CarController: self.p = CarControllerParams(CP) self.packer = CANPacker(DBC[CP.carFingerprint]['pt']) - def update(self, CC, CS): + def update(self, CC, CS, now_nanos): actuators = CC.actuators hud_control = CC.hudControl pcm_cancel_cmd = CC.cruiseControl.cancel @@ -34,7 +34,7 @@ class CarController: # limits due to driver torque new_steer = int(round(apply_steer)) - apply_steer = apply_std_steer_torque_limits(new_steer, self.apply_steer_last, CS.out.steeringTorque, self.p) + apply_steer = apply_driver_steer_torque_limits(new_steer, self.apply_steer_last, CS.out.steeringTorque, self.p) if not CC.latActive: apply_steer = 0 diff --git a/selfdrive/car/subaru/carstate.py b/selfdrive/car/subaru/carstate.py index a916ffb63..ba873c48d 100644 --- a/selfdrive/car/subaru/carstate.py +++ b/selfdrive/car/subaru/carstate.py @@ -83,7 +83,6 @@ class CarState(CarStateBase): self.es_distance_msg = copy.copy(cp_es_distance.vl["ES_Distance"]) self.es_dashstatus_msg = copy.copy(cp_cam.vl["ES_DashStatus"]) - ret.cruiseActualEnabled = ret.cruiseState.enabled return ret @staticmethod diff --git a/selfdrive/car/subaru/interface.py b/selfdrive/car/subaru/interface.py index 28aacebb4..f8027a61f 100644 --- a/selfdrive/car/subaru/interface.py +++ b/selfdrive/car/subaru/interface.py @@ -12,7 +12,7 @@ class CarInterface(CarInterfaceBase): @staticmethod def _get_params(ret, candidate, fingerprint, car_fw, experimental_long): ret.carName = "subaru" - ret.radarOffCan = True + ret.radarUnavailable = True ret.dashcamOnly = candidate in PREGLOBAL_CARS ret.autoResumeSng = False @@ -102,7 +102,8 @@ class CarInterface(CarInterfaceBase): else: raise ValueError(f"unknown car: {candidate}") - CarInterfaceBase.configure_dp_tune(candidate, ret.lateralTuning) + CarInterfaceBase.dp_lat_tune_collection(candidate, ret.latTuneCollection) + CarInterfaceBase.configure_dp_tune(ret.lateralTuning, ret.latTuneCollection) Params().put("dp_lateral_steer_rate_cost", "0.7") return ret @@ -113,11 +114,7 @@ class CarInterface(CarInterfaceBase): ret.events = self.create_common_events(ret).to_msg() - events = self.create_common_events(ret) - - ret.events = events.to_msg() - return ret - def apply(self, c): - return self.CC.update(c, self.CS) + def apply(self, c, now_nanos): + return self.CC.update(c, self.CS, now_nanos) diff --git a/selfdrive/car/subaru/values.py b/selfdrive/car/subaru/values.py index 6ac2637fa..5c7d3f5e4 100644 --- a/selfdrive/car/subaru/values.py +++ b/selfdrive/car/subaru/values.py @@ -253,6 +253,7 @@ FW_VERSIONS = { b'\xca!f@\x07', b'\xca!fp\x07', b'\xf3"f@\x07', + b'\xe6!fp\x07', ], (Ecu.transmission, 0x7e1, None): [ b'\xe6\xf5\004\000\000', @@ -262,6 +263,7 @@ FW_VERSIONS = { b'\xf1\x00\xd7\x10@', b'\xe6\xf5D0\x00', b'\xe9\xf6F0\x00', + b'\xe9\xf5B0\x00', ], }, CAR.FORESTER: { diff --git a/selfdrive/car/tesla/carcontroller.py b/selfdrive/car/tesla/carcontroller.py index 6e2869d1c..1f18c3d0e 100644 --- a/selfdrive/car/tesla/carcontroller.py +++ b/selfdrive/car/tesla/carcontroller.py @@ -14,7 +14,7 @@ class CarController: self.pt_packer = CANPacker(DBC[CP.carFingerprint]['pt']) self.tesla_can = TeslaCAN(self.packer, self.pt_packer) - def update(self, CC, CS): + def update(self, CC, CS, now_nanos): actuators = CC.actuators pcm_cancel_cmd = CC.cruiseControl.cancel diff --git a/selfdrive/car/tesla/interface.py b/selfdrive/car/tesla/interface.py index 49e06d892..70d49896c 100755 --- a/selfdrive/car/tesla/interface.py +++ b/selfdrive/car/tesla/interface.py @@ -23,7 +23,6 @@ class CarInterface(CarInterfaceBase): ret.longitudinalTuning.kpV = [0] ret.longitudinalTuning.kiBP = [0] ret.longitudinalTuning.kiV = [0] - ret.stopAccel = 0.0 ret.longitudinalActuatorDelayUpperBound = 0.5 # s ret.radarTimeStep = (1.0 / 8) # 8Hz @@ -59,5 +58,5 @@ class CarInterface(CarInterfaceBase): return ret - def apply(self, c): - return self.CC.update(c, self.CS) + def apply(self, c, now_nanos): + return self.CC.update(c, self.CS, now_nanos) diff --git a/selfdrive/car/tesla/values.py b/selfdrive/car/tesla/values.py index 52f2aedf9..bac025a9c 100644 --- a/selfdrive/car/tesla/values.py +++ b/selfdrive/car/tesla/values.py @@ -108,3 +108,6 @@ class CarControllerParams: JERK_LIMIT_MAX = 8 JERK_LIMIT_MIN = -8 ACCEL_TO_SPEED_MULTIPLIER = 3 + + def __init__(self, CP): + pass diff --git a/selfdrive/car/tests/test_car_interfaces.py b/selfdrive/car/tests/test_car_interfaces.py index 48d85584b..ac8213e4c 100755 --- a/selfdrive/car/tests/test_car_interfaces.py +++ b/selfdrive/car/tests/test_car_interfaces.py @@ -25,16 +25,23 @@ class TestCarInterfaces(unittest.TestCase): car_fw = [] - car_params = CarInterface.get_params(car_name, fingerprints, car_fw) + car_params = CarInterface.get_params(car_name, fingerprints, car_fw, experimental_long=False) car_interface = CarInterface(car_params, CarController, CarState) assert car_params assert car_interface self.assertGreater(car_params.mass, 1) self.assertGreater(car_params.wheelbase, 0) - self.assertGreater(car_params.centerToFront, 0) + # centerToFront is center of gravity to front wheels, assert a reasonable range + self.assertTrue(car_params.wheelbase * 0.3 < car_params.centerToFront < car_params.wheelbase * 0.7) self.assertGreater(car_params.maxLateralAccel, 0) + # Longitudinal sanity checks + self.assertEqual(len(car_params.longitudinalTuning.kpV), len(car_params.longitudinalTuning.kpBP)) + self.assertEqual(len(car_params.longitudinalTuning.kiV), len(car_params.longitudinalTuning.kiBP)) + self.assertEqual(len(car_params.longitudinalTuning.deadzoneV), len(car_params.longitudinalTuning.deadzoneBP)) + + # Lateral sanity checks if car_params.steerControlType != car.CarParams.SteerControlType.angle: tune = car_params.lateralTuning if tune.which() == 'pid': @@ -53,15 +60,15 @@ class TestCarInterfaces(unittest.TestCase): CC = car.CarControl.new_message() for _ in range(10): car_interface.update(CC, []) - car_interface.apply(CC) - car_interface.apply(CC) + car_interface.apply(CC, 0) + car_interface.apply(CC, 0) CC = car.CarControl.new_message() CC.enabled = True for _ in range(10): car_interface.update(CC, []) - car_interface.apply(CC) - car_interface.apply(CC) + car_interface.apply(CC, 0) + car_interface.apply(CC, 0) # Test radar interface RadarInterface = importlib.import_module(f'selfdrive.car.{car_params.carName}.radar_interface').RadarInterface @@ -70,7 +77,7 @@ class TestCarInterfaces(unittest.TestCase): # Run radar interface once radar_interface.update([]) - if not car_params.radarOffCan and radar_interface.rcp is not None and \ + if not car_params.radarUnavailable and radar_interface.rcp is not None and \ hasattr(radar_interface, '_update') and hasattr(radar_interface, 'trigger_msg'): radar_interface._update([radar_interface.trigger_msg]) diff --git a/selfdrive/car/torque_data/override.yaml b/selfdrive/car/torque_data/override.yaml index d7b2ec407..cc1681bce 100644 --- a/selfdrive/car/torque_data/override.yaml +++ b/selfdrive/car/torque_data/override.yaml @@ -12,9 +12,11 @@ TESLA AP1 MODEL S: [.nan, 2.5, .nan] TESLA AP2 MODEL S: [.nan, 2.5, .nan] # Guess +FORD BRONCO SPORT 1ST GEN: [.nan, 1.5, .nan] FORD ESCAPE 4TH GEN: [.nan, 1.5, .nan] FORD EXPLORER 6TH GEN: [.nan, 1.5, .nan] FORD FOCUS 4TH GEN: [.nan, 1.5, .nan] +FORD MAVERICK 1ST GEN: [.nan, 1.5, .nan] ### # No steering wheel @@ -24,7 +26,7 @@ COMMA BODY: [.nan, 1000, .nan] RAM 1500 5TH GEN: [2.0, 2.0, 0.0] RAM HD 5TH GEN: [1.4, 1.4, 0.0] SUBARU OUTBACK 6TH GEN: [2.3, 2.3, 0.11] -CHEVROLET BOLT EV 2022: [2.0, 2.0, 0.05] +CADILLAC ESCALADE 2017: [1.899999976158142, 1.842270016670227, 0.1120000034570694] CHEVROLET BOLT EUV 2022: [2.0, 2.0, 0.05] CHEVROLET SILVERADO 1500 2020: [1.9, 1.9, 0.112] CHEVROLET EQUINOX 2019: [2.0, 2.0, 0.05] @@ -36,6 +38,8 @@ KIA SPORTAGE HYBRID 5TH GEN: [2.5, 2.5, 0.1] GENESIS GV70 1ST GEN: [2.42, 2.42, 0.1] KIA SORENTO PLUG-IN HYBRID 4TH GEN: [2.5, 2.5, 0.1] GENESIS GV60 ELECTRIC 1ST GEN: [2.5, 2.5, 0.1] +KIA SORENTO 4TH GEN: [2.5, 2.5, 0.1] +KIA NIRO HYBRID 2ND GEN: [2.42, 2.5, 0.12] # Dashcam or fallback configured as ideal car mock: [10.0, 10, 0.0] diff --git a/selfdrive/car/torque_data/params.yaml b/selfdrive/car/torque_data/params.yaml index eb1a04cee..6f8cfe0ce 100644 --- a/selfdrive/car/torque_data/params.yaml +++ b/selfdrive/car/torque_data/params.yaml @@ -4,11 +4,11 @@ ACURA RDX 2020: [1.4314459806646749, 0.33874701282109954, 0.18048847083897598] AUDI A3 3RD GEN: [1.5122414863077502, 1.7443517531719404, 0.15194151892450905] AUDI Q3 2ND GEN: [1.4439223359448605, 1.2254955789112076, 0.1413798895978097] CHEVROLET VOLT PREMIER 2017: [1.5961527626411784, 1.8422651988094612, 0.1572393918005158] -CHRYSLER PACIFICA 2018: [1.593387270257916, 1.3366521181047952, 0.13776367250652022] -CHRYSLER PACIFICA 2020: [1.4323553627965695, 1.509076559398423, 0.14328246159386085] -CHRYSLER PACIFICA HYBRID 2017: [1.3032470208409048, 1.06831764583744, 0.13287170990024627] -CHRYSLER PACIFICA HYBRID 2018: [1.6068280248761635, 1.2943025830995154, 0.1358557824293823] -CHRYSLER PACIFICA HYBRID 2019: [1.4624643614072217, 1.1958788168371808, 0.15748488008472716] +CHRYSLER PACIFICA 2018: [2.07140, 1.3366521181047952, 0.13776367250652022] +CHRYSLER PACIFICA 2020: [1.86206, 1.509076559398423, 0.14328246159386085] +CHRYSLER PACIFICA HYBRID 2017: [1.79422, 1.06831764583744, 0.116237] +CHRYSLER PACIFICA HYBRID 2018: [2.08887, 1.2943025830995154, 0.114818] +CHRYSLER PACIFICA HYBRID 2019: [1.90120, 1.1958788168371808, 0.131520] GENESIS G70 2018: [3.8520195946707947, 2.354697063349854, 0.06830285485626221] GMC ACADIA DENALI 2018: [1.3181430320331884, 1.1853735340610179, 0.3450592280031644] HONDA ACCORD 2018: [1.7135052593468778, 0.3461280068322071, 0.21579936052863807] @@ -22,11 +22,10 @@ HONDA FIT 2018: [1.5719981427109775, 0.5712761407108976, 0.110773383324281] HONDA HRV 2019: [2.0661212805710205, 0.7521343418694775, 0.17760375789242094] HONDA INSIGHT 2019: [1.5201671214069354, 0.5660229120683284, 0.25808042580281876] HONDA ODYSSEY 2018: [1.8774809275211801, 0.8394431662987996, 0.2096978613792822] -HONDA PASSPORT 2021: [1.5305538930036766, 0.7956063674638759, 0.19599407381531284] HONDA PILOT 2017: [1.7262026201812795, 0.9470005614967523, 0.21351430733218763] HONDA RIDGELINE 2017: [1.4146525028237624, 0.7356572861629564, 0.23307177552211328] HYUNDAI ELANTRA 2021: [3.169, 2.1259108157250735, 0.0819] -HYUNDAI GENESIS 2015-2016: [1.8466226943929824, 1.5552063647830634, 0.0984484465421171] +HYUNDAI GENESIS 2015-2016: [2.7807965280270794, 2.325, 0.0984484465421171] HYUNDAI IONIQ 5 2022: [3.172929, 2.713050, 0.096019] HYUNDAI IONIQ ELECTRIC LIMITED 2019: [1.7662975472852054, 1.613755614526594, 0.17087579756306276] HYUNDAI IONIQ PHEV 2020: [3.2928700076638537, 2.1193482926455656, 0.12463700961468778] @@ -40,8 +39,8 @@ HYUNDAI SONATA 2019: [2.2200457811703953, 1.2967330275895228, 0.1403992098658639 HYUNDAI SONATA 2020: [2.9638737459977467, 2.1259108157250735, 0.07813665616927593] HYUNDAI SONATA HYBRID 2021: [2.8990264092395734, 2.061410192222139, 0.0899805488717382] HYUNDAI TUCSON HYBRID 4TH GEN: [2.035545, 2.035545, 0.110272] -JEEP GRAND CHEROKEE 2019: [1.7321233388827006, 1.289689569171081, 0.15046331002097185] -JEEP GRAND CHEROKEE V6 2018: [1.8776598027756923, 1.4057367824262523, 0.11725947414922003] +JEEP GRAND CHEROKEE 2019: [2.30972, 1.289689569171081, 0.117048] +JEEP GRAND CHEROKEE V6 2018: [2.27116, 1.4057367824262523, 0.11725947414922003] KIA EV6 2022: [3.2, 2.093457, 0.05] KIA K5 2021: [2.405339728085138, 1.460032270828705, 0.11650989850813716] KIA NIRO EV 2020: [2.9215954981365337, 2.1500583840260044, 0.09236802474810267] diff --git a/selfdrive/car/torque_data/substitute.yaml b/selfdrive/car/torque_data/substitute.yaml index aeb2e6f28..68fe38737 100644 --- a/selfdrive/car/torque_data/substitute.yaml +++ b/selfdrive/car/torque_data/substitute.yaml @@ -9,6 +9,7 @@ TOYOTA ALPHARD 2020: TOYOTA SIENNA 2018 TOYOTA PRIUS v 2017 : TOYOTA PRIUS 2017 TOYOTA RAV4 2022: TOYOTA RAV4 HYBRID 2022 TOYOTA C-HR HYBRID 2018: TOYOTA C-HR 2018 +TOYOTA C-HR HYBRID 2022: TOYOTA C-HR 2021 LEXUS IS 2018: LEXUS NX 2018 LEXUS CT HYBRID 2018 : LEXUS NX 2018 LEXUS ES HYBRID 2018: TOYOTA CAMRY HYBRID 2018 @@ -37,6 +38,7 @@ HYUNDAI ELANTRA HYBRID 2021: HYUNDAI SONATA 2020 HYUNDAI TUCSON 2019: HYUNDAI SANTA FE 2019 HYUNDAI TUCSON 4TH GEN: HYUNDAI TUCSON HYBRID 4TH GEN HYUNDAI SANTA FE 2022: HYUNDAI SANTA FE HYBRID 2022 +KIA K5 HYBRID 2020: KIA K5 2021 KIA STINGER 2022: KIA STINGER GT2 2018 GENESIS G90 2017: GENESIS G70 2018 GENESIS G80 2017: GENESIS G70 2018 @@ -47,18 +49,22 @@ HONDA CR-V EU 2016: HONDA CR-V 2016 HONDA CIVIC SEDAN 1.6 DIESEL 2019: HONDA CIVIC (BOSCH) 2019 HONDA E 2020: HONDA CIVIC (BOSCH) 2019 HONDA ODYSSEY CHN 2019: HONDA ODYSSEY 2018 +HONDA ODYSSEY HYBRID CHN 2022: HONDA ODYSSEY 2018 BUICK REGAL ESSENCE 2018: CHEVROLET VOLT PREMIER 2017 CADILLAC ESCALADE ESV 2016: CHEVROLET VOLT PREMIER 2017 CADILLAC ATS Premium Performance 2018: CHEVROLET VOLT PREMIER 2017 CHEVROLET MALIBU PREMIER 2017: CHEVROLET VOLT PREMIER 2017 +CHEVROLET TRAILBLAZER 2022: CHEVROLET VOLT PREMIER 2017 HOLDEN ASTRA RS-V BK 2017: CHEVROLET VOLT PREMIER 2017 +SKODA FABIA 4TH GEN: VOLKSWAGEN GOLF 7TH GEN SKODA OCTAVIA 3RD GEN: SKODA SUPERB 3RD GEN SKODA SCALA 1ST GEN: SKODA SUPERB 3RD GEN SKODA KODIAQ 1ST GEN: SKODA SUPERB 3RD GEN SKODA KAROQ 1ST GEN: SKODA SUPERB 3RD GEN SKODA KAMIQ 1ST GEN: SKODA SUPERB 3RD GEN +VOLKSWAGEN CRAFTER 2ND GEN: VOLKSWAGEN TIGUAN 2ND GEN VOLKSWAGEN T-ROC 1ST GEN: VOLKSWAGEN TIGUAN 2ND GEN VOLKSWAGEN T-CROSS 1ST GEN: VOLKSWAGEN TIGUAN 2ND GEN VOLKSWAGEN TOURAN 2ND GEN: VOLKSWAGEN TIGUAN 2ND GEN diff --git a/selfdrive/car/toyota/carcontroller.py b/selfdrive/car/toyota/carcontroller.py index 2d82886a8..63733f2fc 100644 --- a/selfdrive/car/toyota/carcontroller.py +++ b/selfdrive/car/toyota/carcontroller.py @@ -1,6 +1,6 @@ from cereal import car from common.numpy_fast import clip, interp -from selfdrive.car import apply_toyota_steer_torque_limits, create_gas_interceptor_command, make_can_msg +from selfdrive.car import apply_meas_steer_torque_limits, create_gas_interceptor_command, make_can_msg from selfdrive.car.toyota.toyotacan import create_steer_command, create_ui_command, \ create_accel_command, create_acc_cancel_command, \ create_fcw_command, create_lta_steer_command @@ -9,6 +9,7 @@ from selfdrive.car.toyota.values import CAR, STATIC_DSU_MSGS, NO_STOP_TIMER_CAR, UNSUPPORTED_DSU_CAR from opendbc.can.packer import CANPacker from common.conversions import Conversions as CV +from common.params import Params VisualAlert = car.CarControl.HUDControl.VisualAlert @@ -48,12 +49,20 @@ class CarController: self.dp_toyota_auto_unlock = False self.last_gear = GearShifter.park self.lock_once = False + self.lat_controller_type = None + self.lat_controller_type_prev = None - def update(self, CC, CS, dragonconf): + def update(self, CC, CS, now_nanos, dragonconf): if dragonconf is not None: self.dp_toyota_sng = dragonconf.dpToyotaSng self.dp_toyota_auto_lock = dragonconf.dpToyotaAutoLock self.dp_toyota_auto_unlock = dragonconf.dpToyotaAutoUnlock + self.lat_controller_type = CC.latController + if self.lat_controller_type != self.lat_controller_type_prev: + self.torque_rate_limits.update(CC.latController) + self.lat_controller_type_prev = self.lat_controller_type + + self.dp_toyota_change5speed = Params().get_bool("dp_toyota_change5speed") actuators = CC.actuators hud_control = CC.hudControl pcm_cancel_cmd = CC.cruiseControl.cancel @@ -79,7 +88,7 @@ class CarController: # steer torque new_steer = int(round(actuators.steer * CarControllerParams.STEER_MAX)) - apply_steer = apply_toyota_steer_torque_limits(new_steer, self.last_steer, CS.out.steeringTorqueEps, self.torque_rate_limits) + apply_steer = apply_meas_steer_torque_limits(new_steer, self.last_steer, CS.out.steeringTorqueEps, self.torque_rate_limits) # Count up to MAX_STEER_RATE_FRAMES, at which point we need to cut torque to avoid a steering fault if lat_active and abs(CS.out.steeringRateDeg) >= MAX_STEER_RATE: @@ -88,7 +97,6 @@ class CarController: self.steer_rate_counter = 0 apply_steer_req = 1 - if not lat_active: apply_steer = 0 apply_steer_req = 0 @@ -116,7 +124,7 @@ class CarController: # dp - door auto lock / unlock logic # thanks to AlexandreSato & cydia2020 - # https://github.com/AlexandreSato/openpilot/blob/personal/doors.py + # https://github.com/AlexandreSato/animalpilot/blob/personal/doors.py if self.dp_toyota_auto_lock or self.dp_toyota_auto_unlock: gear = CS.out.gearShifter if self.last_gear != gear and gear == GearShifter.park: @@ -124,7 +132,7 @@ class CarController: can_sends.append(make_can_msg(0x750, UNLOCK_CMD, 0)) if self.dp_toyota_auto_lock: self.lock_once = False - elif self.dp_toyota_auto_lock and gear == GearShifter.drive and not self.lock_once and CS.out.vEgo >= LOCK_AT_SPEED: + elif self.dp_toyota_auto_lock and not CS.out.doorOpen and gear == GearShifter.drive and not self.lock_once and CS.out.vEgo >= LOCK_AT_SPEED: can_sends.append(make_can_msg(0x750, LOCK_CMD, 0)) self.lock_once = True self.last_gear = gear @@ -152,10 +160,10 @@ class CarController: if pcm_cancel_cmd and self.CP.carFingerprint in UNSUPPORTED_DSU_CAR: can_sends.append(create_acc_cancel_command(self.packer)) elif self.CP.openpilotLongitudinalControl: - can_sends.append(create_accel_command(self.packer, pcm_accel_cmd, pcm_cancel_cmd, self.standstill_req, lead, CS.acc_type, CS.distance)) + can_sends.append(create_accel_command(self.packer, pcm_accel_cmd, pcm_cancel_cmd, self.standstill_req, lead, CS.acc_type, CS.distance, self.dp_toyota_change5speed)) self.accel = pcm_accel_cmd else: - can_sends.append(create_accel_command(self.packer, 0, pcm_cancel_cmd, False, lead, CS.acc_type, CS.distance)) + can_sends.append(create_accel_command(self.packer, 0, pcm_cancel_cmd, False, lead, CS.acc_type, CS.distance, self.dp_toyota_change5speed)) if self.frame % 2 == 0 and self.CP.enableGasInterceptor and self.CP.openpilotLongitudinalControl: # send exactly zero if gas cmd is zero. Interceptor will send the max between read value and gas cmd. @@ -179,7 +187,7 @@ class CarController: # forcing the pcm to disengage causes a bad fault sound so play a good sound instead send_ui = True - if self.frame % 100 == 0 or send_ui: + if self.frame % 20 == 0 or send_ui: can_sends.append(create_ui_command(self.packer, steer_alert, pcm_cancel_cmd, hud_control.leftLaneVisible, hud_control.rightLaneVisible, hud_control.leftLaneDepart, hud_control.rightLaneDepart, CC.latActive, CS.lkas_hud)) diff --git a/selfdrive/car/toyota/carstate.py b/selfdrive/car/toyota/carstate.py index 230c23dca..5322340b9 100644 --- a/selfdrive/car/toyota/carstate.py +++ b/selfdrive/car/toyota/carstate.py @@ -137,7 +137,7 @@ class CarState(CarStateBase): #dp: Thank you Arne (acceleration) if self.dp_toyota_ap_btn_link: - sport_on_sig = 'SPORT_ON_2' if self.CP.carFingerprint in (CAR.RAV4_TSS2, CAR.LEXUS_ES_TSS2) else 'SPORT_ON' + sport_on_sig = 'SPORT_ON_2' if self.CP.carFingerprint in (CAR.RAV4_TSS2, CAR.LEXUS_ES_TSS2, CAR.HIGHLANDER_TSS2) else 'SPORT_ON' # check signal once if not self.dp_sig_check: self.dp_sig_check = True @@ -183,7 +183,7 @@ class CarState(CarStateBase): if self.CP.carFingerprint in (TSS2_CAR - RADAR_ACC_CAR): self.distance = cp_cam.vl["ACC_CONTROL"]['DISTANCE'] - elif self.CP.carFingerprint in [CAR.RAV4H, CAR.HIGHLANDER]: + elif self.CP.carFingerprint in [CAR.PRIUS, CAR.RAV4H, CAR.RAV4, CAR.HIGHLANDER]: self.distance = cp.vl["SDSU"]['FD_BUTTON'] #dp @@ -254,7 +254,6 @@ class CarState(CarStateBase): if self.CP.carFingerprint != CAR.PRIUS_V: self.lkas_hud = copy.copy(cp_cam.vl["LKAS_HUD"]) - ret.cruiseActualEnabled = ret.cruiseState.enabled self._update_traffic_signals(cp_cam) ret.cruiseState.speedLimit = self._calculate_speed_limit() @@ -404,10 +403,10 @@ class CarState(CarStateBase): signals.append(("GAS_PEDAL", "GAS_PEDAL")) checks.append(("GAS_PEDAL", 33)) #arne - if CP.carFingerprint in [CAR.RAV4H, CAR.HIGHLANDER]: + if CP.carFingerprint in [CAR.PRIUS, CAR.RAV4H, CAR.RAV4, CAR.HIGHLANDER]: signals.append(("FD_BUTTON", "SDSU", 0)) #dp acceleration - if CP.carFingerprint in (CAR.RAV4_TSS2, CAR.LEXUS_ES_TSS2): + if CP.carFingerprint in (CAR.RAV4_TSS2, CAR.LEXUS_ES_TSS2, CAR.HIGHLANDER_TSS2): signals.append(("SPORT_ON_2", "GEAR_PACKET")) if CP.carFingerprint in (CAR.ALPHARD_TSS2, CAR.ALPHARDH_TSS2, CAR.AVALON_TSS2, CAR.AVALONH_TSS2, CAR.CAMRY_TSS2, CAR.CAMRYH_TSS2, CAR.CHR_TSS2, CAR.COROLLA_TSS2, CAR.COROLLAH_TSS2, CAR.HIGHLANDER_TSS2, CAR.HIGHLANDERH_TSS2, CAR.PRIUS_TSS2, CAR.RAV4H_TSS2, CAR.MIRAI, CAR.LEXUS_ES_TSS2, CAR.LEXUS_ESH_TSS2, CAR.LEXUS_NX_TSS2, CAR.LEXUS_NXH_TSS2, CAR.LEXUS_RX_TSS2, CAR.LEXUS_RXH_TSS2, CAR.CHRH): diff --git a/selfdrive/car/toyota/interface.py b/selfdrive/car/toyota/interface.py index aab552460..68adb5e6f 100644 --- a/selfdrive/car/toyota/interface.py +++ b/selfdrive/car/toyota/interface.py @@ -88,7 +88,7 @@ class CarInterface(CarInterfaceBase): tire_stiffness_factor = 0.5533 ret.mass = 4481. * CV.LB_TO_KG + STD_CARGO_KG # mean between min and max - elif candidate in (CAR.CHR, CAR.CHRH, CAR.CHR_TSS2): + elif candidate in (CAR.CHR, CAR.CHRH, CAR.CHR_TSS2, CAR.CHRH_TSS2): stop_and_go = True ret.wheelbase = 2.63906 ret.steerRatio = 13.6 @@ -202,7 +202,8 @@ class CarInterface(CarInterfaceBase): tire_stiffness_factor = 0.444 ret.mass = 4305. * CV.LB_TO_KG + STD_CARGO_KG - CarInterfaceBase.configure_dp_tune(candidate, ret.lateralTuning, steering_angle_deadzone_deg) + CarInterfaceBase.dp_lat_tune_collection(candidate, ret.latTuneCollection, steering_angle_deadzone_deg) + CarInterfaceBase.configure_dp_tune(ret.lateralTuning, ret.latTuneCollection) ret.centerToFront = ret.wheelbase * 0.44 @@ -244,22 +245,15 @@ class CarInterface(CarInterfaceBase): tune.deadzoneBP = [0., 9.] tune.deadzoneV = [.0, .15] if candidate in TSS2_CAR or ret.enableGasInterceptor: - tune.kpBP = [0., 5., 20., 30.] tune.kpV = [1.3, 1.0, 0.7, 0.1] - #really smooth (make it toggleable) - #tune.kiBP = [0., 0.07, 5, 8, 11., 18., 20., 24., 33.] - #tune.kiV = [.001, .01, .1, .18, .21, .22, .23, .22, .001] - #okay ish - #tune.kiBP = [0., 11., 17., 20., 24., 30., 33., 40.] - #tune.kiV = [.001, .21, .22, .23, .22, .1, .001, .0001] - tune.kiBP = [0., 5.6, 11.1, 19.4, 30., 33., 40.] - tune.kiV = [.1, .127, .185, .185, .15, .09, .01] + tune.kiBP = [0., 3.1, 13.9, 19.4, 30., 33., 40.] + tune.kiV = [.032, .073, .16, .176, .01, .005, .0005] if candidate in TSS2_CAR: #ret.vEgoStopping = 0.3 # car is near 0.1 to 0.2 when car starts requesting stopping accel - ret.vEgoStarting = 0.6 # needs to be > or == vEgoStopping + ret.vEgoStarting = 0.1 # needs to be > or == vEgoStopping #ret.stopAccel = -0.1 # Toyota requests -0.4 when stopped - ret.stoppingDecelRate = 0.009 # reach stopping target smoothly - seems to take 0.5 seconds to go from 0 to -0.4 + ret.stoppingDecelRate = 0.01 # reach stopping target smoothly - seems to take 0.5 seconds to go from 0 to -0.4 #ret.longitudinalActuatorDelayLowerBound = 0.3 #ret.longitudinalActuatorDelayUpperBound = 0.3 ### stock ### @@ -283,7 +277,7 @@ class CarInterface(CarInterfaceBase): if self.dragonconf.dpToyotaCruiseOverrideSpeed != self.dp_override_speed_last: self.dp_override_speed = self.dragonconf.dpToyotaCruiseOverrideSpeed * CV.KPH_TO_MS self.dp_override_speed_last = self.dragonconf.dpToyotaCruiseOverrideSpeed - if self.CP.openpilotLongitudinalControl and ret.cruiseActualEnabled and ret.cruiseState.speed <= self.dp_override_speed: + if self.CP.openpilotLongitudinalControl and ret.cruiseState.speed <= self.dp_override_speed: if self.dp_cruise_speed == 0.: self.dp_cruise_speed = self.dp_cruise_speed = max(CRUISE_OVERRIDE_SPEED_MIN, ret.vEgo) else: @@ -314,5 +308,5 @@ class CarInterface(CarInterfaceBase): # pass in a car.CarControl # to be called @ 100hz - def apply(self, c): - return self.CC.update(c, self.CS, self.dragonconf) + def apply(self, c, now_nanos): + return self.CC.update(c, self.CS, now_nanos, self.dragonconf) diff --git a/selfdrive/car/toyota/toyotacan.py b/selfdrive/car/toyota/toyotacan.py index 742a6aadc..923baf207 100644 --- a/selfdrive/car/toyota/toyotacan.py +++ b/selfdrive/car/toyota/toyotacan.py @@ -27,7 +27,7 @@ def create_lta_steer_command(packer, steer, steer_req, raw_cnt): return packer.make_can_msg("STEERING_LTA", 0, values) -def create_accel_command(packer, accel, pcm_cancel, standstill_req, lead, acc_type, distance): +def create_accel_command(packer, accel, pcm_cancel, standstill_req, lead, acc_type, distance, dp_toyota_change5speed): # TODO: find the exact canceling bit that does not create a chime values = { "ACCEL_CMD": accel, @@ -37,7 +37,7 @@ def create_accel_command(packer, accel, pcm_cancel, standstill_req, lead, acc_ty "PERMIT_BRAKING": 1, "RELEASE_STANDSTILL": not standstill_req, "CANCEL_REQ": pcm_cancel, - "ALLOW_LONG_PRESS": 1, + "ALLOW_LONG_PRESS": 2 if dp_toyota_change5speed else 1, } return packer.make_can_msg("ACC_CONTROL", 0, values) diff --git a/selfdrive/car/toyota/values.py b/selfdrive/car/toyota/values.py index 92bef2bf2..1296278c8 100644 --- a/selfdrive/car/toyota/values.py +++ b/selfdrive/car/toyota/values.py @@ -18,11 +18,15 @@ class CarControllerParams: ACCEL_MAX = 1.5 # m/s2, lower than allowed 2.0 m/s2 for tuning reasons ACCEL_MIN = -3.5 # m/s2 + STEER_STEP = 1 STEER_MAX = 1500 STEER_ERROR_MAX = 350 # max delta between torque cmd and torque motor def __init__(self, CP): - if CP.lateralTuning.which == 'torque': + self.update(CP.lateralTuning.which) + + def update(self, tune): + if tune == 'torque': self.STEER_DELTA_UP = 15 # 1.0s time to peak torque self.STEER_DELTA_DOWN = 25 # always lower than 45 otherwise the Rav4 faults (Prius seems ok with 50) else: @@ -48,8 +52,9 @@ class CAR: CAMRY_TSS2 = "TOYOTA CAMRY 2021" # TSS 2.5 CAMRYH_TSS2 = "TOYOTA CAMRY HYBRID 2021" CHR = "TOYOTA C-HR 2018" - CHRH = "TOYOTA C-HR HYBRID 2018" CHR_TSS2 = "TOYOTA C-HR 2021" + CHRH = "TOYOTA C-HR HYBRID 2018" + CHRH_TSS2 = "TOYOTA C-HR HYBRID 2022" COROLLA = "TOYOTA COROLLA 2017" COROLLA_TSS2 = "TOYOTA COROLLA TSS2 2019" # LSS2 Lexus UX Hybrid is same as a TSS2 Corolla Hybrid @@ -113,10 +118,12 @@ CAR_INFO: Dict[str, Union[ToyotaCarInfo, List[ToyotaCarInfo]]] = { CAR.AVALONH_TSS2: ToyotaCarInfo("Toyota Avalon Hybrid 2022"), CAR.CAMRY: ToyotaCarInfo("Toyota Camry 2018-20", video_link="https://www.youtube.com/watch?v=fkcjviZY9CM", footnotes=[Footnote.CAMRY]), CAR.CAMRYH: ToyotaCarInfo("Toyota Camry Hybrid 2018-20", video_link="https://www.youtube.com/watch?v=Q2DYY0AWKgk"), - CAR.CAMRY_TSS2: ToyotaCarInfo("Toyota Camry 2021-22", footnotes=[Footnote.CAMRY]), + CAR.CAMRY_TSS2: ToyotaCarInfo("Toyota Camry 2021-23", footnotes=[Footnote.CAMRY]), CAR.CAMRYH_TSS2: ToyotaCarInfo("Toyota Camry Hybrid 2021-23"), - CAR.CHR: ToyotaCarInfo("Toyota C-HR 2017-21"), - CAR.CHRH: ToyotaCarInfo("Toyota C-HR Hybrid 2017-19"), + CAR.CHR: ToyotaCarInfo("Toyota C-HR 2017-20"), + CAR.CHR_TSS2: ToyotaCarInfo("Toyota C-HR 2021"), + CAR.CHRH: ToyotaCarInfo("Toyota C-HR Hybrid 2017-20"), + CAR.CHRH_TSS2: ToyotaCarInfo("Toyota C-HR Hybrid 2021-22"), CAR.COROLLA: ToyotaCarInfo("Toyota Corolla 2017-19"), CAR.COROLLA_TSS2: [ ToyotaCarInfo("Toyota Corolla 2020-22", video_link="https://www.youtube.com/watch?v=_66pXk0CBYA"), @@ -125,13 +132,14 @@ CAR_INFO: Dict[str, Union[ToyotaCarInfo, List[ToyotaCarInfo]]] = { ], CAR.COROLLAH_TSS2: [ ToyotaCarInfo("Toyota Corolla Hybrid 2020-22"), + ToyotaCarInfo("Toyota Corolla Hybrid (Non-US only) 2020-23", min_enable_speed=7.5), 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"), - CAR.HIGHLANDER_TSS2: ToyotaCarInfo("Toyota Highlander 2020-22"), + CAR.HIGHLANDER_TSS2: ToyotaCarInfo("Toyota Highlander 2020-23"), CAR.HIGHLANDERH: ToyotaCarInfo("Toyota Highlander Hybrid 2017-19"), - CAR.HIGHLANDERH_TSS2: ToyotaCarInfo("Toyota Highlander Hybrid 2020-22"), + CAR.HIGHLANDERH_TSS2: ToyotaCarInfo("Toyota Highlander Hybrid 2020-23"), CAR.PRIUS: [ ToyotaCarInfo("Toyota Prius 2016", "Toyota Safety Sense P", "https://www.youtube.com/watch?v=8zopPJI8XQ0"), ToyotaCarInfo("Toyota Prius 2017-20", video_link="https://www.youtube.com/watch?v=8zopPJI8XQ0"), @@ -161,7 +169,7 @@ CAR_INFO: Dict[str, Union[ToyotaCarInfo, List[ToyotaCarInfo]]] = { CAR.LEXUS_CTH: ToyotaCarInfo("Lexus CT Hybrid 2017-18", "Lexus Safety System+"), CAR.LEXUS_ESH: ToyotaCarInfo("Lexus ES Hybrid 2017-18", "Lexus Safety System+"), CAR.LEXUS_ES_TSS2: ToyotaCarInfo("Lexus ES 2019-22"), - CAR.LEXUS_ESH_TSS2: ToyotaCarInfo("Lexus ES Hybrid 2019-22", video_link="https://youtu.be/BZ29osRVJeg?t=12"), + CAR.LEXUS_ESH_TSS2: ToyotaCarInfo("Lexus ES Hybrid 2019-23", video_link="https://youtu.be/BZ29osRVJeg?t=12"), CAR.LEXUS_IS: ToyotaCarInfo("Lexus IS 2017-19"), CAR.LEXUS_NX: ToyotaCarInfo("Lexus NX 2018-19"), CAR.LEXUS_NXH: ToyotaCarInfo("Lexus NX Hybrid 2018-19"), @@ -230,12 +238,11 @@ FW_QUERY_CONFIG = FwQueryConfig( # FIXME: On some models, abs can sometimes be missing Ecu.abs: [CAR.RAV4, CAR.COROLLA, CAR.HIGHLANDER, CAR.SIENNA, CAR.LEXUS_IS], # On some models, the engine can show on two different addresses - Ecu.engine: [CAR.CAMRY, CAR.COROLLA_TSS2, CAR.CHR, CAR.LEXUS_IS], + Ecu.engine: [CAR.CAMRY, CAR.COROLLA_TSS2, CAR.CHR, CAR.CHR_TSS2, CAR.LEXUS_IS, CAR.LEXUS_RC], } ) FW_VERSIONS = { - CAR.CHR_TSS2: {(Ecu.eps, 0xfff, None): [b'\x00']}, CAR.AVALON: { (Ecu.abs, 0x7b0, None): [ b'F152607060\x00\x00\x00\x00\x00\x00', @@ -348,6 +355,7 @@ FW_VERSIONS = { ], (Ecu.fwdRadar, 0x750, 0xf): [ b'\x018821F6201200\x00\x00\x00\x00', + b'\x018821F6201300\x00\x00\x00\x00', ], (Ecu.fwdCamera, 0x750, 0x6d): [ b'\x028646F4104100\x00\x00\x00\x008646G5301200\x00\x00\x00\x00', @@ -632,6 +640,30 @@ FW_VERSIONS = { b'8646FF407000 ', ], }, + CAR.CHR_TSS2: { + (Ecu.abs, 0x7b0, None): [ + b'F152610260\x00\x00\x00\x00\x00\x00', + b'F1526F4270\x00\x00\x00\x00\x00\x00', + ], + (Ecu.eps, 0x7a1, None): [ + b'8965B10091\x00\x00\x00\x00\x00\x00', + b'8965B10110\x00\x00\x00\x00\x00\x00', + ], + (Ecu.engine, 0x700, None): [ + b'\x0189663F459000\x00\x00\x00\x00', + ], + (Ecu.engine, 0x7e0, None): [ + b'\x0331014000\x00\x00\x00\x00\x00\x00\x00\x00A0202000\x00\x00\x00\x00\x00\x00\x00\x00895231203402\x00\x00\x00\x00', + ], + (Ecu.fwdRadar, 0x750, 0xf): [ + b'\x018821FF410200\x00\x00\x00\x00', + b'\x018821FF410300\x00\x00\x00\x00', + ], + (Ecu.fwdCamera, 0x750, 0x6d): [ + b'\x028646FF410200\x00\x00\x00\x008646GF408200\x00\x00\x00\x00', + b'\x028646FF411100\x00\x00\x00\x008646GF409000\x00\x00\x00\x00', + ], + }, CAR.CHRH: { (Ecu.engine, 0x700, None): [ b'\x0289663F405100\x00\x00\x00\x008966A4703000\x00\x00\x00\x00', @@ -683,8 +715,26 @@ FW_VERSIONS = { b'8646FF404000 ', b'8646FF406000 ', b'8646FF407000 ', + b'8646FF407100 ', ], }, + CAR.CHRH_TSS2: { + (Ecu.eps, 0x7a1, None): [ + b'8965B10092\x00\x00\x00\x00\x00\x00', + ], + (Ecu.abs, 0x7b0, None): [ + b'F152610041\x00\x00\x00\x00\x00\x00', + ], + (Ecu.engine, 0x700, None): [ + b'\x0189663F438000\x00\x00\x00\x00', + ], + (Ecu.fwdRadar, 0x750, 15): [ + b'\x018821FF410500\x00\x00\x00\x00', + ], + (Ecu.fwdCamera, 0x750, 109): [ + b'\x028646FF413100\x00\x00\x00\x008646GF411100\x00\x00\x00\x00', + ], + }, CAR.COROLLA: { (Ecu.engine, 0x7e0, None): [ b'\x0230ZC2000\x00\x00\x00\x00\x00\x00\x00\x0050212000\x00\x00\x00\x00\x00\x00\x00\x00', @@ -766,6 +816,7 @@ FW_VERSIONS = { b'\x03312N6100\x00\x00\x00\x00\x00\x00\x00\x00A0202000\x00\x00\x00\x00\x00\x00\x00\x00895231203402\x00\x00\x00\x00', b'\x03312N6200\x00\x00\x00\x00\x00\x00\x00\x00A0202000\x00\x00\x00\x00\x00\x00\x00\x00895231203202\x00\x00\x00\x00', b'\x03312N6200\x00\x00\x00\x00\x00\x00\x00\x00A0202000\x00\x00\x00\x00\x00\x00\x00\x00895231203302\x00\x00\x00\x00', + b'\x03312N6200\x00\x00\x00\x00\x00\x00\x00\x00A0202000\x00\x00\x00\x00\x00\x00\x00\x00895231203402\x00\x00\x00\x00', b'\x02312K4000\x00\x00\x00\x00\x00\x00\x00\x00A0202000\x00\x00\x00\x00\x00\x00\x00\x00', b'\x02312U5000\x00\x00\x00\x00\x00\x00\x00\x00A0202000\x00\x00\x00\x00\x00\x00\x00\x00', ], @@ -832,6 +883,7 @@ FW_VERSIONS = { b'\x01896630ZJ1000\x00\x00\x00\x00', b'\x01896630ZU8000\x00\x00\x00\x00', b'\x01896637621000\x00\x00\x00\x00', + b'\x01896637623000\x00\x00\x00\x00', b'\x01896637624000\x00\x00\x00\x00', b'\x01896637626000\x00\x00\x00\x00', b'\x01896637639000\x00\x00\x00\x00', @@ -840,11 +892,13 @@ FW_VERSIONS = { b'\x02896630A07000\x00\x00\x00\x008966A4703000\x00\x00\x00\x00', b'\x02896630A21000\x00\x00\x00\x008966A4703000\x00\x00\x00\x00', b'\x02896630ZJ5000\x00\x00\x00\x008966A4703000\x00\x00\x00\x00', + b'\x02896630ZK8000\x00\x00\x00\x008966A4703000\x00\x00\x00\x00', b'\x02896630ZN8000\x00\x00\x00\x008966A4703000\x00\x00\x00\x00', b'\x02896630ZQ3000\x00\x00\x00\x008966A4703000\x00\x00\x00\x00', b'\x02896630ZR2000\x00\x00\x00\x008966A4703000\x00\x00\x00\x00', b'\x02896630ZT8000\x00\x00\x00\x008966A4703000\x00\x00\x00\x00', b'\x02896630ZT9000\x00\x00\x00\x008966A4703000\x00\x00\x00\x00', + b'\x02896630ZZ0000\x00\x00\x00\x008966A4703000\x00\x00\x00\x00', b'\x028966312K6000\x00\x00\x00\x008966A4703000\x00\x00\x00\x00', b'\x028966312L0000\x00\x00\x00\x008966A4703000\x00\x00\x00\x00', b'\x028966312Q3000\x00\x00\x00\x008966A4703000\x00\x00\x00\x00', @@ -857,6 +911,7 @@ FW_VERSIONS = { 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'8965B16101\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', @@ -904,6 +959,7 @@ FW_VERSIONS = { 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'\x028646F1601200\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', @@ -981,12 +1037,14 @@ FW_VERSIONS = { b'8965B48241\x00\x00\x00\x00\x00\x00', b'8965B48310\x00\x00\x00\x00\x00\x00', b'8965B48320\x00\x00\x00\x00\x00\x00', + b'8965B48400\x00\x00\x00\x00\x00\x00', ], (Ecu.abs, 0x7b0, None): [ b'\x01F15260E051\x00\x00\x00\x00\x00\x00', b'\x01F15260E061\x00\x00\x00\x00\x00\x00', b'\x01F15260E110\x00\x00\x00\x00\x00\x00', b'\x01F15260E170\x00\x00\x00\x00\x00\x00', + b'\x01F15260E05300\x00\x00\x00\x00', ], (Ecu.engine, 0x700, None): [ b'\x01896630E62100\x00\x00\x00\x00', @@ -1004,6 +1062,8 @@ FW_VERSIONS = { b'\x01896630ED9100\x00\x00\x00\x00', b'\x01896630EE1000\x00\x00\x00\x00', b'\x01896630EE1100\x00\x00\x00\x00', + b'\x01896630EG3000\x00\x00\x00\x00', + b'\x01896630EG5000\x00\x00\x00\x00', ], (Ecu.fwdRadar, 0x750, 0xf): [ b'\x018821F3301400\x00\x00\x00\x00', @@ -1014,17 +1074,20 @@ FW_VERSIONS = { b'\x028646F0E02100\x00\x00\x00\x008646G2601200\x00\x00\x00\x00', b'\x028646F4803000\x00\x00\x00\x008646G5301200\x00\x00\x00\x00', b'\x028646F4803000\x00\x00\x00\x008646G3304000\x00\x00\x00\x00', + b'\x028646F4803200\x00\x00\x00\x008646G3304000\x00\x00\x00\x00', ], }, CAR.HIGHLANDERH_TSS2: { (Ecu.eps, 0x7a1, None): [ b'8965B48241\x00\x00\x00\x00\x00\x00', b'8965B48310\x00\x00\x00\x00\x00\x00', + b'8965B48400\x00\x00\x00\x00\x00\x00', ], (Ecu.abs, 0x7b0, None): [ b'\x01F15264872300\x00\x00\x00\x00', b'\x01F15264872400\x00\x00\x00\x00', b'\x01F15264872500\x00\x00\x00\x00', + b'\x01F15264872600\x00\x00\x00\x00', b'\x01F15264873500\x00\x00\x00\x00', b'\x01F152648C6300\x00\x00\x00\x00', b'\x01F152648J4000\x00\x00\x00\x00', @@ -1038,6 +1101,7 @@ FW_VERSIONS = { b'\x01896630EE4100\x00\x00\x00\x00', b'\x01896630EE5000\x00\x00\x00\x00', b'\x01896630EE6000\x00\x00\x00\x00', + b'\x01896630EF8000\x00\x00\x00\x00', b'\x02896630E66000\x00\x00\x00\x00897CF4801001\x00\x00\x00\x00', b'\x02896630E66100\x00\x00\x00\x00897CF4801001\x00\x00\x00\x00', b'\x01896630EA1000\x00\x00\x00\x00897CF4801001\x00\x00\x00\x00', @@ -1053,6 +1117,7 @@ FW_VERSIONS = { b'\x028646F0E02100\x00\x00\x00\x008646G2601200\x00\x00\x00\x00', b'\x028646F4803000\x00\x00\x00\x008646G5301200\x00\x00\x00\x00', b'\x028646F4803000\x00\x00\x00\x008646G3304000\x00\x00\x00\x00', + b'\x028646F4803200\x00\x00\x00\x008646G3304000\x00\x00\x00\x00', ], }, CAR.LEXUS_IS: { @@ -1577,12 +1642,14 @@ FW_VERSIONS = { b'\x028966333V4000\x00\x00\x00\x00897CF3305001\x00\x00\x00\x00', b'\x02896633T09000\x00\x00\x00\x00897CF3307001\x00\x00\x00\x00', b'\x01896633T38000\x00\x00\x00\x00', + b'\x01896633T58000\x00\x00\x00\x00', ], (Ecu.abs, 0x7b0, None): [ b'F152633423\x00\x00\x00\x00\x00\x00', b'F152633680\x00\x00\x00\x00\x00\x00', b'F152633681\x00\x00\x00\x00\x00\x00', b'F152633F50\x00\x00\x00\x00\x00\x00', + b'F152633F51\x00\x00\x00\x00\x00\x00', ], (Ecu.eps, 0x7a1, None): [ b'8965B33252\x00\x00\x00\x00\x00\x00', @@ -1598,6 +1665,7 @@ FW_VERSIONS = { b'\x018821F6201300\x00\x00\x00\x00', ], (Ecu.fwdCamera, 0x750, 0x6d): [ + b'\x028646F0610000\x00\x00\x00\x008646G3304000\x00\x00\x00\x00', b'\x028646F33030D0\x00\x00\x00\x008646G26011A0\x00\x00\x00\x00', b'\x028646F3303100\x00\x00\x00\x008646G26011A0\x00\x00\x00\x00', b'\x028646F3303200\x00\x00\x00\x008646G26011A0\x00\x00\x00\x00', @@ -1662,6 +1730,7 @@ FW_VERSIONS = { (Ecu.engine, 0x700, None): [ b'\x018966378B2100\x00\x00\x00\x00', b'\x018966378B3000\x00\x00\x00\x00', + b'\x018966378B4100\x00\x00\x00\x00', b'\x018966378G3000\x00\x00\x00\x00', b'\x018966378B2000\x00\x00\x00\x00', ], @@ -1730,22 +1799,29 @@ FW_VERSIONS = { ], }, CAR.LEXUS_RC: { + (Ecu.engine, 0x700, None): [ + b'\x01896632478200\x00\x00\x00\x00', + ], (Ecu.engine, 0x7e0, None): [ b'\x0232484000\x00\x00\x00\x00\x00\x00\x00\x0052422000\x00\x00\x00\x00\x00\x00\x00\x00', ], (Ecu.abs, 0x7b0, None): [ + b'F152624150\x00\x00\x00\x00\x00\x00', b'F152624221\x00\x00\x00\x00\x00\x00', ], (Ecu.dsu, 0x791, None): [ + b'881512407000\x00\x00\x00\x00', b'881512409100\x00\x00\x00\x00', ], (Ecu.eps, 0x7a1, None): [ b'8965B24081\x00\x00\x00\x00\x00\x00', + b'8965B24320\x00\x00\x00\x00\x00\x00', ], (Ecu.fwdRadar, 0x750, 0xf): [ b'8821F4702300\x00\x00\x00\x00', ], (Ecu.fwdCamera, 0x750, 0x6d): [ + b'8646F2401200\x00\x00\x00\x00', b'8646F2402200\x00\x00\x00\x00', ], }, @@ -2004,8 +2080,9 @@ DBC = { CAR.LEXUS_RX_TSS2: dbc_dict('toyota_nodsu_pt_generated', 'toyota_tss2_adas'), CAR.LEXUS_RXH_TSS2: dbc_dict('toyota_nodsu_pt_generated', 'toyota_tss2_adas'), CAR.CHR: dbc_dict('toyota_nodsu_pt_generated', 'toyota_adas'), - CAR.CHRH: dbc_dict('toyota_nodsu_pt_generated', 'toyota_adas'), CAR.CHR_TSS2: dbc_dict('toyota_nodsu_pt_generated', None), + CAR.CHRH: dbc_dict('toyota_nodsu_pt_generated', 'toyota_adas'), + CAR.CHRH_TSS2: dbc_dict('toyota_nodsu_pt_generated', None), CAR.CAMRY: dbc_dict('toyota_nodsu_pt_generated', 'toyota_adas'), CAR.CAMRYH: dbc_dict('toyota_nodsu_pt_generated', 'toyota_adas'), CAR.CAMRY_TSS2: dbc_dict('toyota_nodsu_pt_generated', 'toyota_tss2_adas'), @@ -2047,7 +2124,7 @@ EPS_SCALE = defaultdict(lambda: 73, {CAR.PRIUS: 66, CAR.COROLLA: 88, CAR.LEXUS_I # Toyota/Lexus Safety Sense 2.0 and 2.5 TSS2_CAR = {CAR.RAV4_TSS2, CAR.RAV4_TSS2_2022, CAR.COROLLA_TSS2, CAR.COROLLAH_TSS2, CAR.LEXUS_ES_TSS2, CAR.LEXUS_ESH_TSS2, CAR.RAV4H_TSS2, CAR.RAV4H_TSS2_2022, CAR.LEXUS_RX_TSS2, CAR.LEXUS_RXH_TSS2, CAR.HIGHLANDER_TSS2, CAR.HIGHLANDERH_TSS2, CAR.PRIUS_TSS2, CAR.CAMRY_TSS2, CAR.CAMRYH_TSS2, - CAR.MIRAI, CAR.LEXUS_NX_TSS2, CAR.LEXUS_NXH_TSS2, CAR.ALPHARD_TSS2, CAR.AVALON_TSS2, CAR.AVALONH_TSS2, CAR.ALPHARDH_TSS2, CAR.CHR_TSS2} + CAR.MIRAI, CAR.LEXUS_NX_TSS2, CAR.LEXUS_NXH_TSS2, CAR.ALPHARD_TSS2, CAR.AVALON_TSS2, CAR.AVALONH_TSS2, CAR.ALPHARDH_TSS2, CAR.CHR_TSS2, CAR.CHRH_TSS2} NO_DSU_CAR = TSS2_CAR | {CAR.CHR, CAR.CHRH, CAR.CAMRY, CAR.CAMRYH} @@ -2055,9 +2132,9 @@ NO_DSU_CAR = TSS2_CAR | {CAR.CHR, CAR.CHRH, CAR.CAMRY, CAR.CAMRYH} UNSUPPORTED_DSU_CAR = {CAR.LEXUS_IS, CAR.LEXUS_RC} # these cars have a radar which sends ACC messages instead of the camera -RADAR_ACC_CAR = {CAR.RAV4H_TSS2_2022, CAR.RAV4_TSS2_2022, CAR.CHR_TSS2} +RADAR_ACC_CAR = {CAR.RAV4H_TSS2_2022, CAR.RAV4_TSS2_2022, CAR.CHR_TSS2, CAR.CHRH_TSS2} -EV_HYBRID_CAR = {CAR.AVALONH_2019, CAR.AVALONH_TSS2, CAR.CAMRYH, CAR.CAMRYH_TSS2, CAR.CHRH, CAR.COROLLAH_TSS2, CAR.HIGHLANDERH, CAR.HIGHLANDERH_TSS2, CAR.PRIUS, +EV_HYBRID_CAR = {CAR.AVALONH_2019, CAR.AVALONH_TSS2, CAR.CAMRYH, CAR.CAMRYH_TSS2, CAR.CHRH, CAR.CHRH_TSS2, CAR.COROLLAH_TSS2, CAR.HIGHLANDERH, CAR.HIGHLANDERH_TSS2, CAR.PRIUS, CAR.PRIUS_V, CAR.RAV4H, CAR.RAV4H_TSS2, CAR.RAV4H_TSS2_2022, CAR.LEXUS_CTH, CAR.MIRAI, CAR.LEXUS_ESH, CAR.LEXUS_ESH_TSS2, CAR.LEXUS_NXH, CAR.LEXUS_RXH, CAR.LEXUS_RXH_TSS2, CAR.LEXUS_NXH_TSS2, CAR.PRIUS_TSS2, CAR.ALPHARDH_TSS2} diff --git a/selfdrive/car/volkswagen/carcontroller.py b/selfdrive/car/volkswagen/carcontroller.py index d3fc56793..d6aa4a4d2 100644 --- a/selfdrive/car/volkswagen/carcontroller.py +++ b/selfdrive/car/volkswagen/carcontroller.py @@ -3,7 +3,7 @@ from opendbc.can.packer import CANPacker from common.numpy_fast import clip from common.conversions import Conversions as CV from common.realtime import DT_CTRL -from selfdrive.car import apply_std_steer_torque_limits +from selfdrive.car import apply_driver_steer_torque_limits from selfdrive.car.volkswagen import mqbcan, pqcan from selfdrive.car.volkswagen.values import CANBUS, PQ_CARS, CarControllerParams, STANDING_RESUME_SPAM_CARS @@ -24,14 +24,14 @@ class CarController: self.hcaSameTorqueCount = 0 self.hcaEnabledFrameCount = 0 - def update(self, CC, CS, ext_bus): + def update(self, CC, CS, ext_bus, now_nanos): actuators = CC.actuators hud_control = CC.hudControl can_sends = [] # **** Steering Controls ************************************************ # - if self.frame % self.CCP.HCA_STEP == 0: + if self.frame % self.CCP.STEER_STEP == 0: # Logic to avoid HCA state 4 "refused": # * Don't steer unless HCA is in state 3 "ready" or 5 "active" # * Don't steer at standstill @@ -44,20 +44,20 @@ class CarController: if CC.latActive: new_steer = int(round(actuators.steer * self.CCP.STEER_MAX)) - apply_steer = apply_std_steer_torque_limits(new_steer, self.apply_steer_last, CS.out.steeringTorque, self.CCP) + apply_steer = apply_driver_steer_torque_limits(new_steer, self.apply_steer_last, CS.out.steeringTorque, self.CCP) if apply_steer == 0: hcaEnabled = False self.hcaEnabledFrameCount = 0 else: self.hcaEnabledFrameCount += 1 - if self.hcaEnabledFrameCount >= 118 * (100 / self.CCP.HCA_STEP): # 118s + if self.hcaEnabledFrameCount >= 118 * (100 / self.CCP.STEER_STEP): # 118s hcaEnabled = False self.hcaEnabledFrameCount = 0 else: hcaEnabled = True if self.apply_steer_last == apply_steer: self.hcaSameTorqueCount += 1 - if self.hcaSameTorqueCount > 1.9 * (100 / self.CCP.HCA_STEP): # 1.9s + if self.hcaSameTorqueCount > 1.9 * (100 / self.CCP.STEER_STEP): # 1.9s apply_steer -= (1, -1)[apply_steer < 0] self.hcaSameTorqueCount = 0 else: diff --git a/selfdrive/car/volkswagen/carstate.py b/selfdrive/car/volkswagen/carstate.py index 1c57832e3..26fc53967 100644 --- a/selfdrive/car/volkswagen/carstate.py +++ b/selfdrive/car/volkswagen/carstate.py @@ -44,7 +44,7 @@ class CarState(CarStateBase): ret.vEgoRaw = float(np.mean([ret.wheelSpeeds.fl, ret.wheelSpeeds.fr, ret.wheelSpeeds.rl, ret.wheelSpeeds.rr])) ret.vEgo, ret.aEgo = self.update_speed_kf(ret.vEgoRaw) - ret.standstill = ret.vEgo < 0.1 + ret.standstill = ret.vEgoRaw == 0 # Update steering angle, rate, yaw rate, and driver input torque. VW send # the sign/direction in a separate signal so they must be recombined. @@ -147,7 +147,6 @@ class CarState(CarStateBase): # Digital instrument clusters expect the ACC HUD lead car distance to be scaled differently self.upscale_lead_car_signal = bool(pt_cp.vl["Kombi_03"]["KBI_Variante"]) - ret.cruiseActualEnabled = ret.cruiseState.enabled return ret def update_pq(self, pt_cp, cam_cp, ext_cp, trans_type): @@ -163,7 +162,7 @@ class CarState(CarStateBase): # vEgo obtained from Bremse_1 vehicle speed rather than Bremse_3 wheel speeds because Bremse_3 isn't present on NSF ret.vEgoRaw = pt_cp.vl["Bremse_1"]["Geschwindigkeit_neu__Bremse_1_"] * CV.KPH_TO_MS ret.vEgo, ret.aEgo = self.update_speed_kf(ret.vEgoRaw) - ret.standstill = ret.vEgo < 0.1 + ret.standstill = ret.vEgoRaw == 0 # Update steering angle, rate, yaw rate, and driver input torque. VW send # the sign/direction in a separate signal so they must be recombined. diff --git a/selfdrive/car/volkswagen/interface.py b/selfdrive/car/volkswagen/interface.py index 08ab417c2..068135433 100644 --- a/selfdrive/car/volkswagen/interface.py +++ b/selfdrive/car/volkswagen/interface.py @@ -24,7 +24,7 @@ class CarInterface(CarInterfaceBase): @staticmethod def _get_params(ret, candidate, fingerprint, car_fw, experimental_long): ret.carName = "volkswagen" - ret.radarOffCan = True + ret.radarUnavailable = True use_off_car_defaults = len(fingerprint[0]) == 0 # Pick sensible carParams during offline doc generation/CI jobs @@ -112,6 +112,11 @@ class CarInterface(CarInterfaceBase): ret.mass = 2011 + STD_CARGO_KG ret.wheelbase = 2.98 + elif candidate == CAR.CRAFTER_MK2: + ret.mass = 2100 + STD_CARGO_KG + ret.wheelbase = 3.64 # SWB, LWB is 4.49, TBD how to detect difference + ret.minSteerSpeed = 50 * CV.KPH_TO_MS + elif candidate == CAR.GOLF_MK7: ret.mass = 1397 + STD_CARGO_KG ret.wheelbase = 2.62 @@ -187,6 +192,10 @@ class CarInterface(CarInterfaceBase): ret.mass = 1227 + STD_CARGO_KG ret.wheelbase = 2.64 + elif candidate == CAR.SKODA_FABIA_MK4: + ret.mass = 1266 + STD_CARGO_KG + ret.wheelbase = 2.56 + elif candidate == CAR.SKODA_KAMIQ_MK1: ret.mass = 1265 + STD_CARGO_KG ret.wheelbase = 2.66 @@ -214,7 +223,8 @@ class CarInterface(CarInterfaceBase): else: raise ValueError(f"unsupported car {candidate}") - CarInterfaceBase.configure_dp_tune(candidate, ret.lateralTuning) + CarInterfaceBase.dp_lat_tune_collection(candidate, ret.latTuneCollection) + CarInterfaceBase.configure_dp_tune(ret.lateralTuning, ret.latTuneCollection) ret.autoResumeSng = ret.minEnableSpeed == -1 ret.centerToFront = ret.wheelbase * 0.45 @@ -246,5 +256,5 @@ class CarInterface(CarInterfaceBase): return ret - def apply(self, c): - return self.CC.update(c, self.CS, self.ext_bus) + def apply(self, c, now_nanos): + return self.CC.update(c, self.CS, self.ext_bus, now_nanos) diff --git a/selfdrive/car/volkswagen/values.py b/selfdrive/car/volkswagen/values.py index 1e3eeef54..8e51081e9 100755 --- a/selfdrive/car/volkswagen/values.py +++ b/selfdrive/car/volkswagen/values.py @@ -18,7 +18,7 @@ Button = namedtuple('Button', ['event_type', 'can_addr', 'can_msg', 'values']) class CarControllerParams: - HCA_STEP = 2 # HCA_01/HCA_1 message frequency 50Hz + STEER_STEP = 2 # HCA_01/HCA_1 message frequency 50Hz ACC_CONTROL_STEP = 2 # ACC_06/ACC_07/ACC_System frequency 50Hz ACCEL_MAX = 2.0 # 2.0 m/s max acceleration @@ -111,6 +111,7 @@ class CANBUS: class CAR: ARTEON_MK1 = "VOLKSWAGEN ARTEON 1ST GEN" # Chassis AN, Mk1 VW Arteon and variants ATLAS_MK1 = "VOLKSWAGEN ATLAS 1ST GEN" # Chassis CA, Mk1 VW Atlas and Atlas Cross Sport + CRAFTER_MK2 = "VOLKSWAGEN CRAFTER 2ND GEN" # Chassis SY/SZ, Mk2 VW Crafter, VW Grand California, MAN TGE GOLF_MK7 = "VOLKSWAGEN GOLF 7TH GEN" # Chassis 5G/AU/BA/BE, Mk7 VW Golf and variants JETTA_MK7 = "VOLKSWAGEN JETTA 7TH GEN" # Chassis BU, Mk7 VW Jetta PASSAT_MK8 = "VOLKSWAGEN PASSAT 8TH GEN" # Chassis 3G, Mk8 VW Passat and variants @@ -122,12 +123,13 @@ class CAR: TIGUAN_MK2 = "VOLKSWAGEN TIGUAN 2ND GEN" # Chassis AD/BW, Mk2 VW Tiguan and variants TOURAN_MK2 = "VOLKSWAGEN TOURAN 2ND GEN" # Chassis 1T, Mk2 VW Touran and variants TRANSPORTER_T61 = "VOLKSWAGEN TRANSPORTER T6.1" # Chassis 7H/7L, T6-facelift Transporter/Multivan/Caravelle/California - TROC_MK1 = "VOLKSWAGEN T-ROC 1ST GEN" # Chassis A1, Mk1 VW VW T-Roc and variants + TROC_MK1 = "VOLKSWAGEN T-ROC 1ST GEN" # Chassis A1, Mk1 VW T-Roc and variants AUDI_A3_MK3 = "AUDI A3 3RD GEN" # Chassis 8V/FF, Mk3 Audi A3 and variants AUDI_Q2_MK1 = "AUDI Q2 1ST GEN" # Chassis GA, Mk1 Audi Q2 (RoW) and Q2L (China only) AUDI_Q3_MK2 = "AUDI Q3 2ND GEN" # Chassis 8U/F3/FS, Mk2 Audi Q3 and variants SEAT_ATECA_MK1 = "SEAT ATECA 1ST GEN" # Chassis 5F, Mk1 SEAT Ateca and CUPRA Ateca SEAT_LEON_MK3 = "SEAT LEON 3RD GEN" # Chassis 5F, Mk3 SEAT Leon and variants + SKODA_FABIA_MK4 = "SKODA FABIA 4TH GEN" # Chassis PJ, Mk4 Skoda Fabia SKODA_KAMIQ_MK1 = "SKODA KAMIQ 1ST GEN" # Chassis NW, Mk1 Skoda Kamiq SKODA_KAROQ_MK1 = "SKODA KAROQ 1ST GEN" # Chassis NU, Mk1 Skoda Karoq SKODA_KODIAQ_MK1 = "SKODA KODIAQ 1ST GEN" # Chassis NS, Mk1 Skoda Kodiaq @@ -191,6 +193,13 @@ CAR_INFO: Dict[str, Union[VWCarInfo, List[VWCarInfo]]] = { VWCarInfo("Volkswagen Teramont Cross Sport 2021-22"), VWCarInfo("Volkswagen Teramont X 2021-22"), ], + CAR.CRAFTER_MK2: [ + VWCarInfo("Volkswagen Crafter 2017-23", video_link="https://youtu.be/4100gLeabmo"), + VWCarInfo("Volkswagen e-Crafter 2018-23", video_link="https://youtu.be/4100gLeabmo"), + VWCarInfo("Volkswagen Grand California 2019-23", video_link="https://youtu.be/4100gLeabmo"), + VWCarInfo("MAN TGE 2017-23", video_link="https://youtu.be/4100gLeabmo"), + VWCarInfo("MAN eTGE 2020-23", video_link="https://youtu.be/4100gLeabmo"), + ], CAR.GOLF_MK7: [ VWCarInfo("Volkswagen e-Golf 2014-20"), VWCarInfo("Volkswagen Golf 2015-20"), @@ -221,7 +230,7 @@ CAR_INFO: Dict[str, Union[VWCarInfo, List[VWCarInfo]]] = { ], CAR.TAOS_MK1: VWCarInfo("Volkswagen Taos 2022"), CAR.TCROSS_MK1: VWCarInfo("Volkswagen T-Cross 2021", footnotes=[Footnote.VW_MQB_A0]), - CAR.TIGUAN_MK2: VWCarInfo("Volkswagen Tiguan 2019-22"), + CAR.TIGUAN_MK2: VWCarInfo("Volkswagen Tiguan 2018-23"), CAR.TOURAN_MK2: VWCarInfo("Volkswagen Touran 2017"), CAR.TRANSPORTER_T61: [ VWCarInfo("Volkswagen Caravelle 2020"), @@ -238,9 +247,10 @@ CAR_INFO: Dict[str, Union[VWCarInfo, List[VWCarInfo]]] = { CAR.AUDI_Q3_MK2: VWCarInfo("Audi Q3 2019-23"), CAR.SEAT_ATECA_MK1: VWCarInfo("SEAT Ateca 2018"), CAR.SEAT_LEON_MK3: VWCarInfo("SEAT Leon 2014-20"), + CAR.SKODA_FABIA_MK4: VWCarInfo("Škoda Fabia 2022-23", footnotes=[Footnote.VW_MQB_A0]), CAR.SKODA_KAMIQ_MK1: VWCarInfo("Škoda Kamiq 2021", footnotes=[Footnote.VW_MQB_A0, Footnote.KAMIQ]), CAR.SKODA_KAROQ_MK1: VWCarInfo("Škoda Karoq 2019-21"), - CAR.SKODA_KODIAQ_MK1: VWCarInfo("Škoda Kodiaq 2018-19"), + CAR.SKODA_KODIAQ_MK1: VWCarInfo("Škoda Kodiaq 2017-23"), CAR.SKODA_SCALA_MK1: VWCarInfo("Škoda Scala 2020", footnotes=[Footnote.VW_MQB_A0]), CAR.SKODA_SUPERB_MK3: VWCarInfo("Škoda Superb 2015-22"), CAR.SKODA_OCTAVIA_MK3: [ @@ -359,6 +369,23 @@ FW_VERSIONS = { b'\xf1\x875Q0907572P \xf1\x890682', ], }, + CAR.CRAFTER_MK2: { + (Ecu.engine, 0x7e0, None): [ + b'\xf1\x8704L906056EK\xf1\x896391', + ], + # Only current upstreamed vehicle has a manual transmission + #(Ecu.transmission, 0x7e1, None): [ + #], + (Ecu.srs, 0x715, None): [ + b'\xf1\x873Q0959655BG\xf1\x890703\xf1\x82\x0e16120016130012051G1313052900', + ], + (Ecu.eps, 0x712, None): [ + b'\xf1\x872N0909143E \xf1\x897021\xf1\x82\x05163AZ306A2', + ], + (Ecu.fwdRadar, 0x757, None): [ + b'\xf1\x872Q0907572M \xf1\x890233', + ], + }, CAR.GOLF_MK7: { (Ecu.engine, 0x7e0, None): [ b'\xf1\x8704E906016A \xf1\x897697', @@ -380,6 +407,7 @@ FW_VERSIONS = { b'\xf1\x8704L906056CR\xf1\x895813', b'\xf1\x8704L906056HE\xf1\x893758', b'\xf1\x8704L906056HN\xf1\x896590', + b'\xf1\x8704L906056HT\xf1\x896591', b'\xf1\x870EA906016A \xf1\x898343', b'\xf1\x870EA906016E \xf1\x894219', b'\xf1\x870EA906016F \xf1\x894238', @@ -412,6 +440,7 @@ FW_VERSIONS = { b'\xf1\x870CW300041H \xf1\x891010', b'\xf1\x870CW300042F \xf1\x891604', b'\xf1\x870CW300043B \xf1\x891601', + b'\xf1\x870CW300043E \xf1\x891603', b'\xf1\x870CW300044S \xf1\x894530', b'\xf1\x870CW300044T \xf1\x895245', b'\xf1\x870CW300045 \xf1\x894531', @@ -449,6 +478,7 @@ FW_VERSIONS = { b'\xf1\x875Q0959655AA\xf1\x890388\xf1\x82\x111413001113120053114317121C111C9113', b'\xf1\x875Q0959655BH\xf1\x890336\xf1\x82\x1314160011123300314211012230229333463100', b'\xf1\x875Q0959655BS\xf1\x890403\xf1\x82\x1314160011123300314240012250229333463100', + b'\xf1\x875Q0959655BT\xf1\x890403\xf1\x82\x13141600111233003142404A2251229333463100', b'\xf1\x875Q0959655BT\xf1\x890403\xf1\x82\x13141600111233003142404A2252229333463100', b'\xf1\x875Q0959655BT\xf1\x890403\xf1\x82\x13141600111233003142405A2252229333463100', b'\xf1\x875Q0959655C \xf1\x890361\xf1\x82\x111413001112120004110415121610169112', @@ -572,6 +602,7 @@ FW_VERSIONS = { (Ecu.engine, 0x7e0, None): [ b'\xf1\x8703N906026E \xf1\x892114', b'\xf1\x8704E906023AH\xf1\x893379', + b'\xf1\x8704L906026DP\xf1\x891538', b'\xf1\x8704L906026ET\xf1\x891990', b'\xf1\x8704L906026FP\xf1\x892012', b'\xf1\x8704L906026GA\xf1\x892013', @@ -590,6 +621,7 @@ FW_VERSIONS = { ], (Ecu.srs, 0x715, None): [ b'\xf1\x873Q0959655AE\xf1\x890195\xf1\x82\r56140056130012416612124111', + b'\xf1\x873Q0959655AF\xf1\x890195\xf1\x82\r56140056130012026612120211', b'\xf1\x873Q0959655AN\xf1\x890306\xf1\x82\r58160058140013036914110311', b'\xf1\x873Q0959655BA\xf1\x890195\xf1\x82\r56140056130012516612125111', b'\xf1\x873Q0959655BB\xf1\x890195\xf1\x82\r56140056130012026612120211', @@ -600,6 +632,7 @@ FW_VERSIONS = { (Ecu.eps, 0x712, None): [ b'\xf1\x873Q0909144J \xf1\x895063\xf1\x82\x0566B00611A1', b'\xf1\x873Q0909144J \xf1\x895063\xf1\x82\x0566B00711A1', + b'\xf1\x875Q0909143K \xf1\x892033\xf1\x820514B0060703', b'\xf1\x875Q0909143M \xf1\x892041\xf1\x820522B0060803', b'\xf1\x875Q0909143M \xf1\x892041\xf1\x820522B0080803', b'\xf1\x875Q0909144AB\xf1\x891082\xf1\x82\00521B00606A1', @@ -608,6 +641,7 @@ FW_VERSIONS = { b'\xf1\x875Q0910143C \xf1\x892211\xf1\x82\x0567B0020600', ], (Ecu.fwdRadar, 0x757, None): [ + b'\xf1\x873Q0907572A \xf1\x890126', b'\xf1\x873Q0907572A \xf1\x890130', b'\xf1\x873Q0907572B \xf1\x890192', b'\xf1\x873Q0907572C \xf1\x890195', @@ -704,46 +738,60 @@ FW_VERSIONS = { }, CAR.TIGUAN_MK2: { (Ecu.engine, 0x7e0, None): [ + b'\xf1\x8703N906026D \xf1\x893680', b'\xf1\x8704E906027NB\xf1\x899504', b'\xf1\x8704L906026EJ\xf1\x893661', b'\xf1\x8704L906027G \xf1\x899893', b'\xf1\x875N0906259 \xf1\x890002', + b'\xf1\x875NA906259H \xf1\x890002', b'\xf1\x875NA907115E \xf1\x890005', b'\xf1\x8783A907115B \xf1\x890005', + b'\xf1\x8783A907115F \xf1\x890002', b'\xf1\x8783A907115G \xf1\x890001', + b'\xf1\x8783A907115K \xf1\x890001', ], (Ecu.transmission, 0x7e1, None): [ b'\xf1\x8709G927158DT\xf1\x893698', + b'\xf1\x8709G927158FM\xf1\x893757', b'\xf1\x8709G927158GC\xf1\x893821', b'\xf1\x8709G927158GD\xf1\x893820', + b'\xf1\x8709G927158GM\xf1\x893936', b'\xf1\x870D9300043 \xf1\x895202', b'\xf1\x870DL300011N \xf1\x892001', b'\xf1\x870DL300011N \xf1\x892012', + b'\xf1\x870DL300012P \xf1\x892103', b'\xf1\x870DL300013A \xf1\x893005', b'\xf1\x870DL300013G \xf1\x892119', b'\xf1\x870DL300013G \xf1\x892120', + b'\xf1\x870DL300014C \xf1\x893703', ], (Ecu.srs, 0x715, None): [ b'\xf1\x875Q0959655AR\xf1\x890317\xf1\x82\02331310031333334313132573732379333313100', + b'\xf1\x875Q0959655BJ\xf1\x890336\xf1\x82\x1312110031333300314232583732379333423100', b'\xf1\x875Q0959655BM\xf1\x890403\xf1\x82\02316143231313500314641011750179333423100', b'\xf1\x875Q0959655BT\xf1\x890403\xf1\x82\02312110031333300314240583752379333423100', b'\xf1\x875Q0959655BT\xf1\x890403\xf1\x82\02331310031333336313140013950399333423100', b'\xf1\x875Q0959655BT\xf1\x890403\xf1\x82\x1331310031333334313140013750379333423100', b'\xf1\x875Q0959655BT\xf1\x890403\xf1\x82\x1331310031333334313140573752379333423100', b'\xf1\x875Q0959655CB\xf1\x890421\xf1\x82\x1316143231313500314647021750179333613100', + b'\xf1\x875Q0959655CG\xf1\x890421\xf1\x82\x1331310031333300314240024050409333613100', ], (Ecu.eps, 0x712, None): [ b'\xf1\x875Q0909143M \xf1\x892041\xf1\x820529A6060603', b'\xf1\x875Q0909144AB\xf1\x891082\xf1\x82\x0521A60604A1', b'\xf1\x875Q0910143C \xf1\x892211\xf1\x82\x0567A6000600', + b'\xf1\x875QF909144A \xf1\x895581\xf1\x82\x0571A60834A1', b'\xf1\x875QF909144B \xf1\x895582\xf1\x82\00571A60634A1', + b'\xf1\x875QF909144B \xf1\x895582\xf1\x82\x0571A62A32A1', b'\xf1\x875QM909144B \xf1\x891081\xf1\x82\x0521A60604A1', b'\xf1\x875QM909144C \xf1\x891082\xf1\x82\x0521A60604A1', b'\xf1\x875QM909144C \xf1\x891082\xf1\x82\00521A60804A1', + b'\xf1\x875QM907144D \xf1\x891063\xf1\x82\x002SA6092SOM', ], (Ecu.fwdRadar, 0x757, None): [ b'\xf1\x872Q0907572AA\xf1\x890396', b'\xf1\x872Q0907572J \xf1\x890156', + b'\xf1\x872Q0907572M \xf1\x890233', b'\xf1\x872Q0907572Q \xf1\x890342', b'\xf1\x872Q0907572R \xf1\x890372', b'\xf1\x872Q0907572T \xf1\x890383', @@ -940,28 +988,53 @@ FW_VERSIONS = { b'\xf1\x8704L906021EL\xf1\x897542', b'\xf1\x8704L906026BP\xf1\x891198', b'\xf1\x8704L906026BP\xf1\x897608', + b'\xf1\x8704L906056CR\xf1\x892797', b'\xf1\x8705E906018AS\xf1\x899596', + b'\xf1\x878V0906264H \xf1\x890005', ], (Ecu.transmission, 0x7e1, None): [ + b'\xf1\x870CW300041D \xf1\x891004', + b'\xf1\x870CW300041G \xf1\x891003', b'\xf1\x870CW300050J \xf1\x891908', b'\xf1\x870D9300042M \xf1\x895016', ], (Ecu.srs, 0x715, None): [ b'\xf1\x873Q0959655AC\xf1\x890189\xf1\x82\r11110011110011021511110200', + b'\xf1\x873Q0959655AS\xf1\x890200\xf1\x82\r11110011110011021511110200', b'\xf1\x873Q0959655AS\xf1\x890200\xf1\x82\r12110012120012021612110200', + b'\xf1\x873Q0959655BH\xf1\x890703\xf1\x82\x0e1312001313001305171311052900', b'\xf1\x873Q0959655CM\xf1\x890720\xf1\x82\0161312001313001305171311052900', ], (Ecu.eps, 0x712, None): [ b'\xf1\x875Q0909144AB\xf1\x891082\xf1\x82\00521N01342A1', b'\xf1\x875Q0909144P \xf1\x891043\xf1\x82\00511N01805A0', + b'\xf1\x875Q0909144T \xf1\x891072\xf1\x82\x0521N01309A1', b'\xf1\x875Q0909144T \xf1\x891072\xf1\x82\00521N05808A1', ], (Ecu.fwdRadar, 0x757, None): [ b'\xf1\x875Q0907572B \xf1\x890200\xf1\x82\00101', b'\xf1\x875Q0907572H \xf1\x890620', + b'\xf1\x875Q0907572K \xf1\x890402\xf1\x82\x0101', b'\xf1\x875Q0907572P \xf1\x890682', ], }, + CAR.SKODA_FABIA_MK4: { + (Ecu.engine, 0x7e0, None): [ + b'\xf1\x8705E906018CF\xf1\x891905', + ], + (Ecu.transmission, 0x7e1, None): [ + b'\xf1\x870CW300051M \xf1\x891936', + ], + (Ecu.srs, 0x715, None): [ + b'\xf1\x875QF959655AT\xf1\x890755\xf1\x82\x1311110011110011111100110200--1111120749', + ], + (Ecu.eps, 0x712, None): [ + b'\xf1\x872Q1909144S \xf1\x896042', + ], + (Ecu.fwdRadar, 0x757, None): [ + b'\xf1\x872Q0907572AA\xf1\x890396', + ], + }, CAR.SKODA_KAMIQ_MK1: { (Ecu.engine, 0x7e0, None): [ b'\xf1\x8705C906032M \xf1\x891333', @@ -1005,31 +1078,41 @@ FW_VERSIONS = { (Ecu.engine, 0x7e0, None): [ b'\xf1\x8704E906027DD\xf1\x893123', b'\xf1\x8704L906026DE\xf1\x895418', + b'\xf1\x8704L906026EJ\xf1\x893661', + b'\xf1\x8704L906026HT\xf1\x893617', b'\xf1\x875NA907115E \xf1\x890003', + b'\xf1\x875NA907115E \xf1\x890005', ], (Ecu.transmission, 0x7e1, None): [ b'\xf1\x870D9300043 \xf1\x895202', + b'\xf1\x870DL300011N \xf1\x892014', b'\xf1\x870DL300012M \xf1\x892107', b'\xf1\x870DL300012N \xf1\x892110', b'\xf1\x870DL300013G \xf1\x892119', ], (Ecu.srs, 0x715, None): [ - b'\xf1\x873Q0959655BJ\xf1\x890703\xf1\x82\0161213001211001205212111052100', - b'\xf1\x873Q0959655CN\xf1\x890720\xf1\x82\0161213001211001205212112052100', + b'\xf1\x873Q0959655AP\xf1\x890306\xf1\x82\r11110011110011421111314211', + b'\xf1\x873Q0959655BJ\xf1\x890703\xf1\x82\x0e1213001211001205212111052100', + b'\xf1\x873Q0959655BK\xf1\x890703\xf1\x82\x0e1213001211001244212111442100', + b'\xf1\x873Q0959655CN\xf1\x890720\xf1\x82\x0e1213001211001205212112052100', b'\xf1\x873Q0959655CQ\xf1\x890720\xf1\x82\x0e1213111211001205212112052111', ], (Ecu.eps, 0x712, None): [ b'\xf1\x875Q0909143P \xf1\x892051\xf1\x820527T6050405', b'\xf1\x875Q0909143P \xf1\x892051\xf1\x820527T6060405', + b'\xf1\x875Q0909143P \xf1\x892051\xf1\x820527T6070405', b'\xf1\x875Q0910143C \xf1\x892211\xf1\x82\x0567T600G600', ], (Ecu.fwdRadar, 0x757, None): [ b'\xf1\x872Q0907572Q \xf1\x890342', b'\xf1\x872Q0907572R \xf1\x890372', + b'\xf1\x872Q0907572T \xf1\x890383', + b'\xf1\x872Q0907572AA\xf1\x890396', ], }, CAR.SKODA_OCTAVIA_MK3: { (Ecu.engine, 0x7e0, None): [ + b'\xf1\x8704C906025L \xf1\x896198', b'\xf1\x8704E906016ER\xf1\x895823', b'\xf1\x8704E906027HD\xf1\x893742', b'\xf1\x8704E906027MH\xf1\x894786', @@ -1041,6 +1124,7 @@ FW_VERSIONS = { b'\xf1\x870CW300041L \xf1\x891601', b'\xf1\x870CW300041N \xf1\x891605', b'\xf1\x870CW300043B \xf1\x891601', + b'\xf1\x870CW300043P \xf1\x891605', b'\xf1\x870D9300041C \xf1\x894936', b'\xf1\x870D9300041J \xf1\x894902', b'\xf1\x870D9300041P \xf1\x894507', @@ -1050,6 +1134,7 @@ FW_VERSIONS = { b'\xf1\x873Q0959655AQ\xf1\x890200\xf1\x82\r11120011100010312212113100', b'\xf1\x873Q0959655AS\xf1\x890200\xf1\x82\r11120011100010022212110200', b'\xf1\x873Q0959655BH\xf1\x890703\xf1\x82\0163221003221002105755331052100', + b'\xf1\x873Q0959655CM\xf1\x890720\xf1\x82\x0e3221003221002105755331052100', b'\xf1\x873Q0959655CN\xf1\x890720\xf1\x82\x0e3221003221002105755331052100', b'\xf1\x875QD959655 \xf1\x890388\xf1\x82\x111101000011110006110411111111119111', ], @@ -1076,6 +1161,7 @@ FW_VERSIONS = { b'\xf1\x870CW300050 \xf1\x891709', ], (Ecu.srs, 0x715, None): [ + b'\xf1\x872Q0959655AJ\xf1\x890250\xf1\x82\x1211110411110411--04040404131111112H14', b'\xf1\x872Q0959655AM\xf1\x890351\xf1\x82\022111104111104112104040404111111112H14', ], (Ecu.eps, 0x712, None): [ @@ -1091,6 +1177,7 @@ FW_VERSIONS = { b'\xf1\x8704L906026FP\xf1\x891196', b'\xf1\x8704L906026KB\xf1\x894071', b'\xf1\x8704L906026KD\xf1\x894798', + b'\xf1\x873G0906259 \xf1\x890004', b'\xf1\x873G0906259B \xf1\x890002', b'\xf1\x873G0906264A \xf1\x890002', ], @@ -1100,12 +1187,14 @@ FW_VERSIONS = { b'\xf1\x870D9300012 \xf1\x894940', b'\xf1\x870D9300041H \xf1\x894905', b'\xf1\x870GC300043 \xf1\x892301', + b'\xf1\x870D9300043F \xf1\x895202', ], (Ecu.srs, 0x715, None): [ b'\xf1\x875Q0959655AE\xf1\x890130\xf1\x82\x12111200111121001121110012211292221111', b'\xf1\x875Q0959655AE\xf1\x890130\xf1\x82\022111200111121001121118112231292221111', b'\xf1\x875Q0959655AK\xf1\x890130\xf1\x82\022111200111121001121110012211292221111', b'\xf1\x875Q0959655BH\xf1\x890336\xf1\x82\02331310031313100313131013141319331413100', + b'\xf1\x875Q0959655CA\xf1\x890403\xf1\x82\x1331310031313100313151013141319331423100', ], (Ecu.eps, 0x712, None): [ b'\xf1\x875Q0909143K \xf1\x892033\xf1\x820514UZ070203', diff --git a/selfdrive/controls/controlsd.py b/selfdrive/controls/controlsd.py index 58e280882..9f06f0e7a 100755 --- a/selfdrive/controls/controlsd.py +++ b/selfdrive/controls/controlsd.py @@ -16,8 +16,8 @@ from system.version import is_release_branch, get_short_branch from selfdrive.boardd.boardd import can_list_to_can_capnp from selfdrive.car.car_helpers import get_car, get_startup_event, get_one_can from selfdrive.controls.lib.lateral_planner import CAMERA_OFFSET -from selfdrive.controls.lib.drive_helpers import VCruiseHelper, get_lag_adjusted_curvature -from selfdrive.controls.lib.latcontrol import LatControl +from selfdrive.controls.lib.drive_helpers import VCruiseHelper, get_lag_adjusted_curvature, V_CRUISE_UNSET +from selfdrive.controls.lib.latcontrol import LatControl, MIN_LATERAL_CONTROL_SPEED from selfdrive.controls.lib.longcontrol import LongControl from selfdrive.controls.lib.latcontrol_pid import LatControlPID from selfdrive.controls.lib.latcontrol_indi import LatControlINDI @@ -39,7 +39,7 @@ REPLAY = "REPLAY" in os.environ SIMULATION = "SIMULATION" in os.environ NOSENSOR = "NOSENSOR" in os.environ IGNORE_PROCESSES = {"uploader", "deleter", "loggerd", "logmessaged", "tombstoned", "statsd", "mapd", "navd", "gpxd", - "logcatd", "proclogd", "clocksd", "updated", "timezoned", "manage_athenad", "laikad"} | \ + "logcatd", "proclogd", "clocksd", "updated", "timezoned", "manage_athenad"} | \ {k for k, v in managed_processes.items() if not v.enabled} ThermalStatus = log.DeviceState.ThermalStatus @@ -89,6 +89,7 @@ class Controls: # self.log_sock = messaging.sub_sock('androidLog') + # self.params = Params() self.sm = sm if self.sm is None: ignore = ['testJoystick'] @@ -109,11 +110,12 @@ class Controls: get_one_can(self.can_sock) num_pandas = len(messaging.recv_one_retry(self.sm.sock['pandaStates']).pandaStates) - self.CI, self.CP = get_car(self.can_sock, self.pm.sock['sendcan'], num_pandas) + experimental_long_allowed = self.params.get_bool("ExperimentalLongitudinalEnabled") and not is_release_branch() + self.CI, self.CP = get_car(self.can_sock, self.pm.sock['sendcan'], experimental_long_allowed, num_pandas) else: self.CI, self.CP = CI, CI.CP - self.joystick_mode = self.params.get_bool("JoystickDebugMode") or (self.CP.notCar and sm is None) + self.joystick_mode = self.params.get_bool("JoystickDebugMode") or self.CP.notCar # set alternative experiences from parameters self.disengage_on_accelerator = self.params.get_bool("DisengageOnAccelerator") @@ -121,14 +123,19 @@ class Controls: if not self.disengage_on_accelerator: self.CP.alternativeExperience |= ALTERNATIVE_EXPERIENCE.DISABLE_DISENGAGE_ON_GAS - if self.CP.dashcamOnly and self.params.get_bool("DashcamOverride"): - self.CP.dashcamOnly = False - # dp self.sm['dragonConf'].dpAtl = int(self.params.get('dp_atl', encoding='utf8')) if self.sm['dragonConf'].dpAtl: self.CP.alternativeExperience |= ALTERNATIVE_EXPERIENCE.ALKA self.dp_temp_check = self.params.get_bool('dp_temp_check') + self.dp_lateral_road_edge_detected = False + # alt lat ctrl + self.sm['dragonConf'].dpLateralAlt = False + self.sm['dragonConf'].dpLateralAltCtrl = 0 + self.sm['dragonConf'].dpLateralAltSpeed = 80 + self.dp_lateral_alt_v_cruise_kph = 0 + self.dp_lateral_alt_v_cruise_kph_prev = 0 + self.dp_lateral_alt_active = False # read params self.is_metric = self.params.get_bool("IsMetric") @@ -148,9 +155,6 @@ class Controls: safety_config.safetyModel = car.CarParams.SafetyModel.noOutput self.CP.safetyConfigs = [safety_config] - if is_release_branch(): - self.CP.experimentalLongitudinalAvailable = False - # Write CarParams for radard cp_bytes = self.CP.to_bytes() self.params.put("CarParams", cp_bytes) @@ -158,7 +162,7 @@ class Controls: put_nonblocking("CarParamsPersistent", cp_bytes) # cleanup old params - if not self.CP.experimentalLongitudinalAvailable: + if not self.CP.experimentalLongitudinalAvailable or is_release_branch(): self.params.remove("ExperimentalLongitudinalEnabled") if not self.CP.openpilotLongitudinalControl: self.params.remove("ExperimentalMode") @@ -183,16 +187,20 @@ class Controls: elif self.CP.lateralTuning.which() == 'lqr': self.LaC = LatControlLQR(self.CP, self.CI) + # dp, keep the original LaC for alt lac ctrl + self.LaC_default = self.LaC + self.initialized = False self.state = State.disabled self.enabled = False self.active = False - self.can_rcv_timeout = False self.soft_disable_timer = 0 self.mismatch_counter = 0 self.cruise_mismatch_counter = 0 - self.can_rcv_timeout_counter = 0 + self.can_rcv_timeout_counter = 0 # conseuctive timeout count + self.can_rcv_cum_timeout_counter = 0 # cumulative timeout count self.last_blinker_frame = 0 + self.last_steering_pressed_frame = 0 self.distance_traveled = 0 self.last_functional_fan_frame = 0 self.events_prev = [] @@ -202,10 +210,12 @@ class Controls: self.steer_limited = False self.desired_curvature = 0.0 self.desired_curvature_rate = 0.0 + self.experimental_mode = False self.v_cruise_helper = VCruiseHelper(self.CP) # TODO: no longer necessary, aside from process replay self.sm['liveParameters'].valid = True + self.can_log_mono_time = 0 self.startup_event = get_startup_event(car_recognized, controller_available, len(self.CP.carFw) > 0) @@ -227,6 +237,43 @@ class Controls: self.rk = Ratekeeper(100, print_delay_threshold=None) self.prof = Profiler(False) # off by default + def dp_update_lat_controller(self): + if self.sm['dragonConf'].dpLateralAlt: + self.dp_lateral_alt_v_cruise_kph = self.v_cruise_helper.v_cruise_kph + # when cruise set speed changed + if self.dp_lateral_alt_v_cruise_kph != self.dp_lateral_alt_v_cruise_kph_prev: + # when set speed below config speed or set speed equal unset speed, fallback to default + if self.dp_lateral_alt_v_cruise_kph == V_CRUISE_UNSET or self.dp_lateral_alt_v_cruise_kph < self.sm['dragonConf'].dpLateralAltSpeed: + self.dp_lateral_alt_active = False + if type(self.LaC) != type(self.LaC_default): + # set lateralTuning back + if isinstance(self.LaC_default, LatControlPID): + self.CP.lateralTuning.pid = self.CP.latTuneCollection.pid + elif isinstance(self.LaC_default, LatControlLQR): + self.CP.lateralTuning.lqr = self.CP.latTuneCollection.lqr + elif isinstance(self.LaC_default, LatControlTorque): + self.CP.lateralTuning.torque = self.CP.latTuneCollection.torque + # set LaC back + self.LaC = self.LaC_default + self.LaC.reset() + # when set speed >= config speed + else: + # save current status + if type(self.LaC) == type(self.LaC_default): + self.LaC_default = self.LaC + self.dp_lateral_alt_active = True + if getattr(self.CP.latTuneCollection.pid, 'kpV') and self.sm['dragonConf'].dpLateralAltCtrl == 1 and not isinstance(self.LaC, LatControlPID): + self.CP.lateralTuning.pid = self.CP.latTuneCollection.pid + self.LaC = LatControlPID(self.CP, self.CI) + elif self.sm['dragonConf'].dpLateralAltCtrl == 2 and not isinstance(self.LaC, LatControlLQR): + self.CP.lateralTuning.lqr = self.CP.latTuneCollection.lqr + self.LaC = LatControlLQR(self.CP, self.CI) + elif self.sm['dragonConf'].dpLateralAltCtrl == 3 and not isinstance(self.LaC, LatControlTorque): + self.CP.lateralTuning.torque = self.CP.latTuneCollection.torque + self.LaC = LatControlTorque(self.CP, self.CI) + self.LaC.reset() + self.dp_lateral_alt_v_cruise_kph_prev = self.dp_lateral_alt_v_cruise_kph + def set_initial_state(self): if REPLAY: controls_state = Params().get("ReplayControlsState") @@ -314,10 +361,24 @@ class Controls: # Handle lane change if self.sm['lateralPlan'].laneChangeState == LaneChangeState.preLaneChange: + self.dp_lateral_road_edge_detected = self.sm['dragonConf'].dpLateralRoadEdgeDetected direction = self.sm['lateralPlan'].laneChangeDirection if (CS.leftBlindspot and direction == LaneChangeDirection.left) or \ (CS.rightBlindspot and direction == LaneChangeDirection.right): self.events.add(EventName.laneChangeBlocked) + #dp + elif self.dp_lateral_road_edge_detected: + md = self.sm['modelV2'] + left_road_edge = -md.roadEdges[0].y[0] + right_road_edge = md.roadEdges[1].y[0] + if (((left_road_edge < 3.5) and direction == LaneChangeDirection.left) or \ + ((right_road_edge < 3.5) and direction == LaneChangeDirection.right)): + self.events.add(EventName.laneChangeBlocked) + else: + if direction == LaneChangeDirection.left: + self.events.add(EventName.preLaneChangeLeft) + else: + self.events.add(EventName.preLaneChangeRight) else: if direction == LaneChangeDirection.left: self.events.add(EventName.preLaneChangeLeft) @@ -368,9 +429,10 @@ class Controls: self.events.add(EventName.canError) # generic catch-all. ideally, a more specific event should be added above instead + can_rcv_timeout = self.can_rcv_timeout_counter >= 5 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_timeout) and no_system_errors: + if (not self.sm.all_checks() or can_rcv_timeout) and no_system_errors: if not self.sm.all_alive(): self.events.add(EventName.commIssue) elif not self.sm.all_freq_ok(): @@ -382,7 +444,7 @@ class Controls: 'invalid': [s for s, valid in self.sm.valid.items() if not valid], 'not_alive': [s for s, alive in self.sm.alive.items() if not alive], 'not_freq_ok': [s for s, freq_ok in self.sm.freq_ok.items() if not freq_ok], - 'can_rcv_timeout': self.can_rcv_timeout, + 'can_rcv_timeout': can_rcv_timeout, } if logs != self.logged_comm_issue: cloudlog.event("commIssue", error=True, **logs) @@ -446,6 +508,8 @@ class Controls: # Update carState from CAN can_strs = messaging.drain_sock_raw(self.can_sock, wait_for_one=True) CS = self.CI.update(self.CC, can_strs, self.sm['dragonConf']) + if len(can_strs) and REPLAY: + self.can_log_mono_time = messaging.log_from_bytes(can_strs[0]).logMonoTime self.sm.update(0) @@ -463,9 +527,9 @@ class Controls: # Check for CAN timeout if not can_strs: self.can_rcv_timeout_counter += 1 - self.can_rcv_timeout = True + self.can_rcv_cum_timeout_counter += 1 else: - self.can_rcv_timeout = False + self.can_rcv_timeout_counter = 0 # When the panda and controlsd do not agree on controls_allowed # we want to disengage openpilot. However the status from the panda goes through @@ -561,7 +625,7 @@ class Controls: else: self.state = State.enabled self.current_alert_types.append(ET.ENABLE) - self.v_cruise_helper.initialize_v_cruise(CS) + self.v_cruise_helper.initialize_v_cruise(CS, self.experimental_mode) # Check if openpilot is engaged and actuators are enabled self.enabled = self.state in ENABLED_STATES @@ -578,6 +642,7 @@ class Controls: sr = max(lp.steerRatio, 0.1) self.VM.update_params(x, sr) + self.dp_update_lat_controller() # Update Torque Params if self.CP.lateralTuning.which() == 'torque': torque_params = self.sm['liveTorqueParameters'] @@ -589,22 +654,22 @@ class Controls: CC = car.CarControl.new_message() CC.enabled = self.enabled + + # dp - keep the current lat controller type + CC.latController = self.CP.lateralTuning.which() # Check which actuators can be enabled + standstill = CS.vEgo <= max(self.CP.minSteerSpeed, MIN_LATERAL_CONTROL_SPEED) or CS.standstill CC.latActive = self.active and not CS.steerFaultTemporary and not CS.steerFaultPermanent and \ - CS.vEgo > self.CP.minSteerSpeed and not CS.standstill + (not standstill or self.joystick_mode) CC.longActive = self.enabled and not self.events.any(ET.OVERRIDE_LONGITUDINAL) and self.CP.openpilotLongitudinalControl - if self.sm['dragonConf'].dpAtl > 0: - if not self.sm['liveCalibration'].calStatus == Calibration.CALIBRATED: - pass - elif not CS.cruiseState.available: + if not standstill and CS.cruiseState.available and self.sm['dragonConf'].dpAtl > 0: + if self.sm['liveCalibration'].calStatus != Calibration.CALIBRATED: pass elif CS.steerFaultTemporary: pass elif CS.steerFaultPermanent: pass - elif CS.standstill: - pass elif CS.gearShifter == car.CarState.GearShifter.reverse: pass else: @@ -642,6 +707,7 @@ class Controls: actuators.steer, actuators.steeringAngleDeg, lac_log = self.LaC.update(CC.latActive, CS, self.VM, lp, self.last_actuators, self.steer_limited, self.desired_curvature, self.desired_curvature_rate, self.sm['liveLocationKalman']) + actuators.curvature = self.desired_curvature else: lac_log = log.ControlsState.LateralDebugState.new_message() if self.sm.rcv_frame['testJoystick'] > 0: @@ -658,29 +724,34 @@ class Controls: lac_log.output = actuators.steer lac_log.saturated = abs(actuators.steer) >= 0.9 + if CS.steeringPressed: + self.last_steering_pressed_frame = self.sm.frame + recent_steer_pressed = (self.sm.frame - self.last_steering_pressed_frame)*DT_CTRL < 2.0 + # Send a "steering required alert" if saturation count has reached the limit - if lac_log.active and not CS.steeringPressed and self.CP.lateralTuning.which() == 'torque' and not self.joystick_mode: - undershooting = abs(lac_log.desiredLateralAccel) / abs(1e-3 + lac_log.actualLateralAccel) > 1.2 - turning = abs(lac_log.desiredLateralAccel) > 1.0 - good_speed = CS.vEgo > 5 - max_torque = abs(self.last_actuators.steer) > 0.99 - if undershooting and turning and good_speed and max_torque: - self.events.add(EventName.steerSaturated) - elif lac_log.active and lac_log.saturated: - dpath_points = lat_plan.dPathPoints - if len(dpath_points): - # Check if we deviated from the path - # TODO use desired vs actual curvature - if self.CP.steerControlType == car.CarParams.SteerControlType.angle: - steering_value = actuators.steeringAngleDeg - else: - steering_value = actuators.steer + if lac_log.active and not recent_steer_pressed: + if self.CP.lateralTuning.which() == 'torque' and not self.joystick_mode: + undershooting = abs(lac_log.desiredLateralAccel) / abs(1e-3 + lac_log.actualLateralAccel) > 1.2 + turning = abs(lac_log.desiredLateralAccel) > 1.0 + good_speed = CS.vEgo > 5 + max_torque = abs(self.last_actuators.steer) > 0.99 + if undershooting and turning and good_speed and max_torque: + lac_log.active and self.events.add(EventName.steerSaturated) + elif lac_log.saturated: + dpath_points = lat_plan.dPathPoints + if len(dpath_points): + # Check if we deviated from the path + # TODO use desired vs actual curvature + if self.CP.steerControlType == car.CarParams.SteerControlType.angle: + steering_value = actuators.steeringAngleDeg + else: + steering_value = actuators.steer - left_deviation = steering_value > 0 and dpath_points[0] < -0.20 - right_deviation = steering_value < 0 and dpath_points[0] > 0.20 + left_deviation = steering_value > 0 and dpath_points[0] < -0.20 + right_deviation = steering_value < 0 and dpath_points[0] > 0.20 - if left_deviation or right_deviation: - self.events.add(EventName.steerSaturated) + if left_deviation or right_deviation: + self.events.add(EventName.steerSaturated) # Ensure no NaNs/Infs for p in ACTUATOR_FIELDS: @@ -695,7 +766,6 @@ class Controls: return CC, lac_log def publish_logs(self, CS, start_time, CC, lac_log): - """Send actuators and hud commands to the car, send controlsstate and MPC logging""" # Orientation and angle rates can be useful for carcontroller @@ -761,7 +831,8 @@ class Controls: if not self.read_only and self.initialized: # send car controls over can - self.last_actuators, can_sends = self.CI.apply(CC) + now_nanos = self.can_log_mono_time if REPLAY else int(sec_since_boot() * 1e9) + self.last_actuators, can_sends = self.CI.apply(CC, now_nanos) self.pm.send('sendcan', can_list_to_can_capnp(can_sends, msgtype='sendcan', valid=CS.canValid)) CC.actuatorsOutput = self.last_actuators if self.CP.steerControlType == car.CarParams.SteerControlType.angle: @@ -770,7 +841,7 @@ class Controls: else: self.steer_limited = abs(CC.actuators.steer - CC.actuatorsOutput.steer) > 1e-2 - force_decel = False if self.dp_jetson else (self.sm['driverMonitoringState'].awarenessStatus < 0.) or \ + force_decel = (self.sm['driverMonitoringState'].awarenessStatus < 0.) or \ (self.state == State.softDisabling) # Curvature & Steering angle @@ -792,7 +863,6 @@ class Controls: controlsState.alertType = current_alert.alert_type controlsState.alertSound = current_alert.audible_alert - controlsState.canMonoTimes = list(CS.canMonoTimes) controlsState.longitudinalPlanMonoTime = self.sm.logMonoTime['longitudinalPlan'] controlsState.lateralPlanMonoTime = self.sm.logMonoTime['lateralPlan'] controlsState.enabled = self.enabled @@ -812,8 +882,8 @@ class Controls: controlsState.cumLagMs = -self.rk.remaining * 1000. controlsState.startMonoTime = int(start_time * 1e9) controlsState.forceDecel = bool(force_decel) - controlsState.canErrorCounter = self.can_rcv_timeout_counter - controlsState.experimentalMode = (self.params.get_bool("ExperimentalMode") or self.sm['longitudinalPlan'].dpE2EIsBlended) and self.CP.openpilotLongitudinalControl + controlsState.canErrorCounter = self.can_rcv_cum_timeout_counter + controlsState.experimentalMode = self.experimental_mode lat_tuning = self.CP.lateralTuning.which() if self.joystick_mode: @@ -829,6 +899,7 @@ class Controls: elif lat_tuning == 'indi': controlsState.lateralControlState.indiState = lac_log + controlsState.dpLateralAltActive = self.dp_lateral_alt_active self.pm.send('controlsState', dat) # carState @@ -866,6 +937,11 @@ class Controls: self.prof.checkpoint("Ratekeeper", ignore=True) self.is_metric = self.params.get_bool("IsMetric") + if self.CP.openpilotLongitudinalControl: + if self.sm['dragonConf'].dpE2EConditional: + self.experimental_mode = self.sm['longitudinalPlan'].dpE2EIsBlended + else: + self.experimental_mode = self.params.get_bool("ExperimentalMode") # Sample data from sockets and get a carState CS = self.data_sample() diff --git a/selfdrive/controls/lib/desire_helper.py b/selfdrive/controls/lib/desire_helper.py index 342796f70..a45da946e 100644 --- a/selfdrive/controls/lib/desire_helper.py +++ b/selfdrive/controls/lib/desire_helper.py @@ -47,14 +47,16 @@ class DesireHelper: self.dp_lc_min_mph = LANE_CHANGE_SPEED_MIN self.dp_lc_auto_min_mph = LANE_CHANGE_SPEED_MIN + 10 self.dp_lc_auto_delay = 3 # secs + self.dp_lateral_road_edge_detected = False - def update(self, carstate, lateral_active, lane_change_prob, dragonconf): + def update(self, carstate, lateral_active, lane_change_prob, dragonconf, md): # dp - sync with dragonConf self.dp_lateral_mode = dragonconf.dpLateralMode self.dp_lc_min_mph = dragonconf.dpLcMinMph * CV.MPH_TO_MS self.dp_lc_auto_min_mph = dragonconf.dpLcAutoMinMph * CV.MPH_TO_MS self.dp_lc_auto_min_mph = self.dp_lc_min_mph if self.dp_lc_auto_min_mph < self.dp_lc_min_mph else self.dp_lc_auto_min_mph self.dp_lc_auto_delay = dragonconf.dpLcAutoDelay + self.dp_lateral_road_edge_detected = dragonconf.dpLateralRoadEdgeDetected v_ego = carstate.vEgo one_blinker = carstate.leftBlinker != carstate.rightBlinker @@ -94,9 +96,19 @@ class DesireHelper: blindspot_detected = ((carstate.leftBlindspot and self.lane_change_direction == LaneChangeDirection.left) or (carstate.rightBlindspot and self.lane_change_direction == LaneChangeDirection.right)) + #dp + if self.dp_lateral_road_edge_detected: + left_road_edge = -md.roadEdges[0].y[0] + right_road_edge = md.roadEdges[1].y[0] + + road_edge_detected = (((left_road_edge < 3.5) and self.lane_change_direction == LaneChangeDirection.left) or + ((right_road_edge < 3.5) and self.lane_change_direction == LaneChangeDirection.right)) + else: + road_edge_detected = False + if not one_blinker or below_lane_change_speed: self.lane_change_state = LaneChangeState.off - elif torque_applied and not blindspot_detected: + elif torque_applied and not blindspot_detected and not road_edge_detected: self.lane_change_state = LaneChangeState.laneChangeStarting # LaneChangeState.laneChangeStarting diff --git a/selfdrive/controls/lib/drive_helpers.py b/selfdrive/controls/lib/drive_helpers.py index 1ac43e2ef..27edb0d2c 100644 --- a/selfdrive/controls/lib/drive_helpers.py +++ b/selfdrive/controls/lib/drive_helpers.py @@ -8,18 +8,22 @@ from selfdrive.modeld.constants import T_IDXS # WARNING: this value was determined based on the model's training distribution, # model predictions above this speed can be unpredictable -V_CRUISE_MAX = 145 # kph -V_CRUISE_MIN = 8 # kph -V_CRUISE_ENABLE_MIN = 40 # kph -V_CRUISE_INITIAL = 255 # kph +# V_CRUISE's are in kph +V_CRUISE_MIN = 8 +V_CRUISE_MAX = 145 +V_CRUISE_UNSET = 255 +V_CRUISE_INITIAL = 40 +V_CRUISE_INITIAL_EXPERIMENTAL_MODE = 105 IMPERIAL_INCREMENT = 1.6 # should be CV.MPH_TO_KPH, but this causes rounding errors MIN_SPEED = 1.0 -LAT_MPC_N = 16 -LON_MPC_N = 32 CONTROL_N = 17 CAR_ROTATION_RADIUS = 0.0 +# dp - needed for 0813/0816 controller +LAT_MPC_N = 16 +LON_MPC_N = 32 + # EU guidelines MAX_LATERAL_JERK = 5.0 @@ -52,15 +56,15 @@ class MPC_COST_LAT: class VCruiseHelper: def __init__(self, CP): self.CP = CP - self.v_cruise_kph = V_CRUISE_INITIAL - self.v_cruise_cluster_kph = V_CRUISE_INITIAL + self.v_cruise_kph = V_CRUISE_UNSET + self.v_cruise_cluster_kph = V_CRUISE_UNSET self.v_cruise_kph_last = 0 self.button_timers = {ButtonType.decelCruise: 0, ButtonType.accelCruise: 0} self.button_change_states = {btn: {"standstill": False, "enabled": False} for btn in self.button_timers} @property def v_cruise_initialized(self): - return self.v_cruise_kph != V_CRUISE_INITIAL + return self.v_cruise_kph != V_CRUISE_UNSET def update_v_cruise(self, CS, enabled, is_metric): self.v_cruise_kph_last = self.v_cruise_kph @@ -75,8 +79,8 @@ class VCruiseHelper: self.v_cruise_kph = CS.cruiseState.speed * CV.MS_TO_KPH self.v_cruise_cluster_kph = CS.cruiseState.speedCluster * CV.MS_TO_KPH else: - self.v_cruise_kph = V_CRUISE_INITIAL - self.v_cruise_cluster_kph = V_CRUISE_INITIAL + self.v_cruise_kph = V_CRUISE_UNSET + self.v_cruise_cluster_kph = V_CRUISE_UNSET def _update_v_cruise_non_pcm(self, CS, enabled, is_metric): # handle button presses. TODO: this should be in state_control, but a decelCruise press @@ -138,16 +142,18 @@ class VCruiseHelper: self.button_timers[b.type.raw] = 1 if b.pressed else 0 self.button_change_states[b.type.raw] = {"standstill": CS.cruiseState.standstill, "enabled": enabled} - def initialize_v_cruise(self, CS): + def initialize_v_cruise(self, CS, experimental_mode: bool) -> None: # initializing is handled by the PCM if self.CP.pcmCruise: return + initial = V_CRUISE_INITIAL_EXPERIMENTAL_MODE if experimental_mode else V_CRUISE_INITIAL + # 250kph or above probably means we never had a set speed if any(b.type in (ButtonType.accelCruise, ButtonType.resumeCruise) for b in CS.buttonEvents) and self.v_cruise_kph_last < 250: self.v_cruise_kph = self.v_cruise_kph_last else: - self.v_cruise_kph = int(round(clip(CS.vEgo * CV.MS_TO_KPH, V_CRUISE_ENABLE_MIN, V_CRUISE_MAX))) + self.v_cruise_kph = int(round(clip(CS.vEgo * CV.MS_TO_KPH, initial, V_CRUISE_MAX))) self.v_cruise_cluster_kph = self.v_cruise_kph @@ -267,8 +273,8 @@ def get_0816_lag_adjusted_curvature(CP, v_ego, psis, curvatures, curvature_rates return safe_desired_curvature, safe_desired_curvature_rate def get_lane_laneless_mode(lll_prob, rll_prob, mode): - if (lll_prob + rll_prob)/2 < 0.3: + if lll_prob < 0.3 and rll_prob < 0.3: mode = False - elif (lll_prob + rll_prob)/2 > 0.5: + elif lll_prob > 0.5 or rll_prob > 0.5: mode = True return mode diff --git a/selfdrive/controls/lib/events.py b/selfdrive/controls/lib/events.py index 1ddb536ac..f3de09b18 100644 --- a/selfdrive/controls/lib/events.py +++ b/selfdrive/controls/lib/events.py @@ -195,7 +195,7 @@ class NormalPermanentAlert(Alert): class StartupAlert(Alert): - def __init__(self, alert_text_1: str, alert_text_2: str = _("Happy Holiday / New Years! Safe Travel, cya in 2023"), alert_status=AlertStatus.normal): + def __init__(self, alert_text_1: str, alert_text_2: str = _("Always keep hands on wheel and eyes on road"), alert_status=AlertStatus.normal): super().__init__(alert_text_1, alert_text_2, alert_status, AlertSize.mid, Priority.LOWER, VisualAlert.none, AudibleAlert.none, 10.), @@ -235,7 +235,7 @@ def startup_master_alert(CP: car.CarParams, CS: car.CarState, sm: messaging.SubM return StartupAlert(_("WARNING: This branch is not tested"), branch, alert_status=AlertStatus.userPrompt) def below_engage_speed_alert(CP: car.CarParams, CS: car.CarState, sm: messaging.SubMaster, metric: bool, soft_disable_time: int) -> Alert: - return NoEntryAlert(f"Speed Below {get_display_speed(CP.minEnableSpeed, metric)}") + return NoEntryAlert(f"Drive above {get_display_speed(CP.minEnableSpeed, metric)} to engage") def below_steer_speed_alert(CP: car.CarParams, CS: car.CarState, sm: messaging.SubMaster, metric: bool, soft_disable_time: int) -> Alert: @@ -297,7 +297,7 @@ def calibration_invalid_alert(CP: car.CarParams, CS: car.CarState, sm: messaging rpy = sm['liveCalibration'].rpyCalib yaw = math.degrees(rpy[2] if len(rpy) == 3 else math.nan) pitch = math.degrees(rpy[1] if len(rpy) == 3 else math.nan) - angles = f"Pitch: {pitch:.1f}°, Yaw: {yaw:.1f}°" + angles = f"Remount Device (Pitch: {pitch:.1f}°, Yaw: {yaw:.1f}°)" return NormalPermanentAlert(_("Calibration Invalid"), angles) @@ -322,9 +322,9 @@ def modeld_lagging_alert(CP: car.CarParams, CS: car.CarState, sm: messaging.SubM def wrong_car_mode_alert(CP: car.CarParams, CS: car.CarState, sm: messaging.SubMaster, metric: bool, soft_disable_time: int) -> Alert: - text = _("Cruise Mode Disabled") + text = _("Enable Adaptive Cruise to Engage") if CP.carName == "honda": - text = _("Main Switch Off") + text = _("Enable Main Switch to Engage") return NoEntryAlert(text) @@ -449,7 +449,7 @@ EVENTS: Dict[int, Dict[str, Union[Alert, AlertCallbackType]]] = { }, EventName.steerTempUnavailableSilent: { - ET.PERMANENT: Alert( + ET.WARNING: Alert( _("Steering Temporarily Unavailable"), "", AlertStatus.userPrompt, AlertSize.small, @@ -515,7 +515,7 @@ EVENTS: Dict[int, Dict[str, Union[Alert, AlertCallbackType]]] = { EventName.resumeRequired: { ET.WARNING: Alert( _("Press Resume to Exit Standstill"), - _(""), + "", AlertStatus.userPrompt, AlertSize.small, Priority.LOW, VisualAlert.none, AudibleAlert.none, .2), }, @@ -542,10 +542,10 @@ EVENTS: Dict[int, Dict[str, Union[Alert, AlertCallbackType]]] = { EventName.laneChangeBlocked: { ET.PERMANENT: Alert( - _("Car Detected in Blindspot"), + _("Car Detected in Blindspot or RoadEdge"), "", AlertStatus.userPrompt, AlertSize.small, - Priority.LOW, VisualAlert.none, AudibleAlert.prompt, .1), + Priority.LOW, VisualAlert.none, AudibleAlert.prompt, .2), }, EventName.laneChange: { @@ -756,8 +756,8 @@ EVENTS: Dict[int, Dict[str, Union[Alert, AlertCallbackType]]] = { }, EventName.espDisabled: { - ET.SOFT_DISABLE: soft_disable_alert(_("ESP Off")), - ET.NO_ENTRY: NoEntryAlert(_("ESP Off")), + ET.SOFT_DISABLE: soft_disable_alert(_("Electronic Stability Control Disabled")), + ET.NO_ENTRY: NoEntryAlert(_("Electronic Stability Control Disabled")), }, EventName.lowBattery: { diff --git a/selfdrive/controls/lib/lane_planner.py b/selfdrive/controls/lib/lane_planner.py index 37ce731c1..aedbb600f 100644 --- a/selfdrive/controls/lib/lane_planner.py +++ b/selfdrive/controls/lib/lane_planner.py @@ -3,7 +3,7 @@ from cereal import log from common.filter_simple import FirstOrderFilter from common.numpy_fast import interp from common.realtime import DT_MDL -from selfdrive.hardware import TICI, EON +from system.hardware import TICI, EON from system.swaglog import cloudlog diff --git a/selfdrive/controls/lib/latcontrol.py b/selfdrive/controls/lib/latcontrol.py index cefbc1078..d38959c56 100644 --- a/selfdrive/controls/lib/latcontrol.py +++ b/selfdrive/controls/lib/latcontrol.py @@ -3,7 +3,7 @@ from abc import abstractmethod, ABC from common.numpy_fast import clip from common.realtime import DT_CTRL -MIN_STEER_SPEED = 0.3 +MIN_LATERAL_CONTROL_SPEED = 0.3 # m/s class LatControl(ABC): diff --git a/selfdrive/controls/lib/latcontrol_angle.py b/selfdrive/controls/lib/latcontrol_angle.py index d692f80b4..9ed140d38 100644 --- a/selfdrive/controls/lib/latcontrol_angle.py +++ b/selfdrive/controls/lib/latcontrol_angle.py @@ -1,7 +1,7 @@ import math from cereal import log -from selfdrive.controls.lib.latcontrol import LatControl, MIN_STEER_SPEED +from selfdrive.controls.lib.latcontrol import LatControl STEER_ANGLE_SATURATION_THRESHOLD = 2.5 # Degrees @@ -14,7 +14,7 @@ class LatControlAngle(LatControl): def update(self, active, CS, VM, params, last_actuators, steer_limited, desired_curvature, desired_curvature_rate, llk): angle_log = log.ControlsState.LateralAngleState.new_message() - if CS.vEgo < MIN_STEER_SPEED or not active: + if not active: angle_log.active = False angle_steers_des = float(CS.steeringAngleDeg) else: diff --git a/selfdrive/controls/lib/latcontrol_indi.py b/selfdrive/controls/lib/latcontrol_indi.py index 2bc3cef76..dca82c672 100644 --- a/selfdrive/controls/lib/latcontrol_indi.py +++ b/selfdrive/controls/lib/latcontrol_indi.py @@ -5,7 +5,7 @@ from cereal import log from common.filter_simple import FirstOrderFilter from common.numpy_fast import clip, interp from common.realtime import DT_CTRL -from selfdrive.controls.lib.latcontrol import LatControl, MIN_STEER_SPEED +from selfdrive.controls.lib.latcontrol import LatControl class LatControlINDI(LatControl): @@ -82,7 +82,7 @@ class LatControlINDI(LatControl): rate_des = VM.get_steer_from_curvature(-desired_curvature_rate, CS.vEgo, 0) indi_log.steeringRateDesiredDeg = math.degrees(rate_des) - if CS.vEgo < MIN_STEER_SPEED or not active: + if not active: indi_log.active = False self.steer_filter.x = 0.0 output_steer = 0 diff --git a/selfdrive/controls/lib/latcontrol_lqr.py b/selfdrive/controls/lib/latcontrol_lqr.py index d74e3463d..a5f02e6ce 100644 --- a/selfdrive/controls/lib/latcontrol_lqr.py +++ b/selfdrive/controls/lib/latcontrol_lqr.py @@ -4,7 +4,7 @@ import numpy as np from common.numpy_fast import clip from common.realtime import DT_CTRL from cereal import log -from selfdrive.controls.lib.latcontrol import LatControl, MIN_STEER_SPEED +from selfdrive.controls.lib.latcontrol import LatControl class LatControlLQR(LatControl): @@ -50,7 +50,7 @@ class LatControlLQR(LatControl): e = steering_angle_no_offset - angle_steers_k self.x_hat = self.A.dot(self.x_hat) + self.B.dot(CS.steeringTorqueEps / torque_scale) + self.L.dot(e) - if CS.vEgo < MIN_STEER_SPEED or not active: + if not active: lqr_log.active = False lqr_output = 0. output_steer = 0. diff --git a/selfdrive/controls/lib/latcontrol_pid.py b/selfdrive/controls/lib/latcontrol_pid.py index 6bd678073..6696d2e30 100644 --- a/selfdrive/controls/lib/latcontrol_pid.py +++ b/selfdrive/controls/lib/latcontrol_pid.py @@ -1,7 +1,7 @@ import math from cereal import log -from selfdrive.controls.lib.latcontrol import LatControl, MIN_STEER_SPEED +from selfdrive.controls.lib.latcontrol import LatControl from selfdrive.controls.lib.pid import PIDController @@ -28,7 +28,7 @@ class LatControlPID(LatControl): pid_log.steeringAngleDesiredDeg = angle_steers_des pid_log.angleError = error - if CS.vEgo < MIN_STEER_SPEED or not active: + if not active: output_steer = 0.0 pid_log.active = False self.pid.reset() diff --git a/selfdrive/controls/lib/latcontrol_torque.py b/selfdrive/controls/lib/latcontrol_torque.py index d10d39d94..2f5609437 100644 --- a/selfdrive/controls/lib/latcontrol_torque.py +++ b/selfdrive/controls/lib/latcontrol_torque.py @@ -2,7 +2,7 @@ import math from cereal import log from common.numpy_fast import interp -from selfdrive.controls.lib.latcontrol import LatControl, MIN_STEER_SPEED +from selfdrive.controls.lib.latcontrol import LatControl from selfdrive.controls.lib.pid import PIDController from selfdrive.controls.lib.vehicle_model import ACCELERATION_DUE_TO_GRAVITY @@ -39,7 +39,7 @@ class LatControlTorque(LatControl): def update(self, active, CS, VM, params, last_actuators, steer_limited, desired_curvature, desired_curvature_rate, llk): pid_log = log.ControlsState.LateralTorqueState.new_message() - if CS.vEgo < MIN_STEER_SPEED or not active: + if not active: output_torque = 0.0 pid_log.active = False else: diff --git a/selfdrive/controls/lib/lateral_mpc_lib/acados_ocp_lat.json b/selfdrive/controls/lib/lateral_mpc_lib/acados_ocp_lat.json deleted file mode 100644 index af9c99f25..000000000 --- a/selfdrive/controls/lib/lateral_mpc_lib/acados_ocp_lat.json +++ /dev/null @@ -1,544 +0,0 @@ -{ - "acados_include_path": "/data/openpilot/third_party/acados/include/acados/include", - "acados_lib_path": "/data/openpilot/third_party/acados/include/acados/lib", - "code_export_directory": "/data/openpilot/selfdrive/controls/lib/lateral_mpc_lib/c_generated_code", - "constraints": { - "C": [], - "C_e": [], - "D": [], - "constr_type": "BGH", - "constr_type_e": "BGH", - "idxbu": [], - "idxbx": [ - 2, - 3 - ], - "idxbx_0": [ - 0, - 1, - 2, - 3 - ], - "idxbx_e": [], - "idxbxe_0": [ - 0, - 1, - 2, - 3 - ], - "idxsbu": [], - "idxsbx": [], - "idxsbx_e": [], - "idxsg": [], - "idxsg_e": [], - "idxsh": [], - "idxsh_e": [], - "idxsphi": [], - "idxsphi_e": [], - "lbu": [], - "lbx": [ - -1.5707963267948966, - -0.8726646259971648 - ], - "lbx_0": [ - 0.0, - 0.0, - 0.0, - 0.0 - ], - "lbx_e": [], - "lg": [], - "lg_e": [], - "lh": [], - "lh_e": [], - "lphi": [], - "lphi_e": [], - "lsbu": [], - "lsbx": [], - "lsbx_e": [], - "lsg": [], - "lsg_e": [], - "lsh": [], - "lsh_e": [], - "lsphi": [], - "lsphi_e": [], - "ubu": [], - "ubx": [ - 1.5707963267948966, - 0.8726646259971648 - ], - "ubx_0": [ - 0.0, - 0.0, - 0.0, - 0.0 - ], - "ubx_e": [], - "ug": [], - "ug_e": [], - "uh": [], - "uh_e": [], - "uphi": [], - "uphi_e": [], - "usbu": [], - "usbx": [], - "usbx_e": [], - "usg": [], - "usg_e": [], - "ush": [], - "ush_e": [], - "usphi": [], - "usphi_e": [] - }, - "cost": { - "Vu": [ - [ - 0.0 - ], - [ - 0.0 - ], - [ - 0.0 - ], - [ - 0.0 - ], - [ - 0.0 - ] - ], - "Vu_0": [ - [ - 0.0 - ], - [ - 0.0 - ], - [ - 0.0 - ], - [ - 0.0 - ], - [ - 0.0 - ] - ], - "Vx": [ - [ - 0.0, - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0, - 0.0 - ] - ], - "Vx_0": [ - [ - 0.0, - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0, - 0.0 - ] - ], - "Vx_e": [ - [ - 0.0, - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0, - 0.0 - ] - ], - "Vz": [], - "Vz_0": [], - "W": [ - [ - 0.0, - 0.0, - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0, - 0.0, - 0.0 - ] - ], - "W_0": [ - [ - 0.0, - 0.0, - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0, - 0.0, - 0.0 - ] - ], - "W_e": [ - [ - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0 - ] - ], - "Zl": [], - "Zl_e": [], - "Zu": [], - "Zu_e": [], - "cost_ext_fun_type": "casadi", - "cost_ext_fun_type_0": "casadi", - "cost_ext_fun_type_e": "casadi", - "cost_type": "NONLINEAR_LS", - "cost_type_0": "NONLINEAR_LS", - "cost_type_e": "NONLINEAR_LS", - "yref": [ - 0.0, - 0.0, - 0.0, - 0.0, - 0.0 - ], - "yref_0": [ - 0.0, - 0.0, - 0.0, - 0.0, - 0.0 - ], - "yref_e": [ - 0.0, - 0.0, - 0.0 - ], - "zl": [], - "zl_e": [], - "zu": [], - "zu_e": [] - }, - "cython_include_dirs": "/data/data/com.termux/files/usr/lib/python3.8/site-packages/numpy/core/include", - "dims": { - "N": 16, - "nbu": 0, - "nbx": 2, - "nbx_0": 4, - "nbx_e": 0, - "nbxe_0": 4, - "ng": 0, - "ng_e": 0, - "nh": 0, - "nh_e": 0, - "np": 2, - "nphi": 0, - "nphi_e": 0, - "nr": 0, - "nr_e": 0, - "ns": 0, - "ns_e": 0, - "nsbu": 0, - "nsbx": 0, - "nsbx_e": 0, - "nsg": 0, - "nsg_e": 0, - "nsh": 0, - "nsh_e": 0, - "nsphi": 0, - "nsphi_e": 0, - "nu": 1, - "nx": 4, - "ny": 5, - "ny_0": 5, - "ny_e": 3, - "nz": 0 - }, - "model": { - "dyn_disc_fun": null, - "dyn_disc_fun_jac": null, - "dyn_disc_fun_jac_hess": null, - "dyn_ext_fun_type": "casadi", - "dyn_source_discrete": null, - "gnsf": { - "nontrivial_f_LO": 1, - "purely_linear": 0 - }, - "name": "lat" - }, - "parameter_values": [ - 0.0, - 0.0 - ], - "problem_class": "OCP", - "simulink_opts": { - "inputs": { - "cost_W": 0, - "cost_W_0": 0, - "cost_W_e": 0, - "lbu": 1, - "lbx": 1, - "lbx_0": 1, - "lbx_e": 1, - "lg": 1, - "lh": 1, - "parameter_traj": 1, - "reset_solver": 0, - "u_init": 0, - "ubu": 1, - "ubx": 1, - "ubx_0": 1, - "ubx_e": 1, - "ug": 1, - "uh": 1, - "x_init": 0, - "y_ref": 1, - "y_ref_0": 1, - "y_ref_e": 1 - }, - "outputs": { - "CPU_time": 1, - "CPU_time_lin": 0, - "CPU_time_qp": 0, - "CPU_time_sim": 0, - "KKT_residual": 1, - "solver_status": 1, - "sqp_iter": 1, - "u0": 1, - "utraj": 0, - "x1": 1, - "xtraj": 0 - }, - "samplingtime": "t0" - }, - "solver_options": { - "Tsim": 0.009765625, - "alpha_min": 0.05, - "alpha_reduction": 0.7, - "collocation_type": "GAUSS_LEGENDRE", - "eps_sufficient_descent": 0.0001, - "exact_hess_constr": 1, - "exact_hess_cost": 1, - "exact_hess_dyn": 1, - "ext_cost_num_hess": 0, - "full_step_dual": 0, - "globalization": "FIXED_STEP", - "globalization_use_SOC": 0, - "hessian_approx": "GAUSS_NEWTON", - "hpipm_mode": "BALANCE", - "initialize_t_slacks": 0, - "integrator_type": "ERK", - "levenberg_marquardt": 0.0, - "line_search_use_sufficient_descent": 0, - "model_external_shared_lib_dir": null, - "model_external_shared_lib_name": null, - "nlp_solver_max_iter": 100, - "nlp_solver_step_length": 1.0, - "nlp_solver_tol_comp": 1e-06, - "nlp_solver_tol_eq": 1e-06, - "nlp_solver_tol_ineq": 1e-06, - "nlp_solver_tol_stat": 1e-06, - "nlp_solver_type": "SQP_RTI", - "print_level": 0, - "qp_solver": "PARTIAL_CONDENSING_HPIPM", - "qp_solver_cond_N": 1, - "qp_solver_iter_max": 1, - "qp_solver_tol_comp": null, - "qp_solver_tol_eq": null, - "qp_solver_tol_ineq": null, - "qp_solver_tol_stat": null, - "qp_solver_warm_start": 0, - "regularize_method": null, - "sim_method_jac_reuse": [ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0 - ], - "sim_method_newton_iter": 3, - "sim_method_num_stages": [ - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4 - ], - "sim_method_num_steps": [ - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1 - ], - "tf": 2.5, - "time_steps": [ - 0.009765625, - 0.029296875, - 0.048828125, - 0.068359375, - 0.087890625, - 0.107421875, - 0.126953125, - 0.146484375, - 0.166015625, - 0.185546875, - 0.205078125, - 0.224609375, - 0.244140625, - 0.263671875, - 0.283203125, - 0.302734375 - ] - } -} \ No newline at end of file diff --git a/selfdrive/controls/lib/lateral_mpc_lib/c_generated_code/acados_ocp_solver_pyx.c b/selfdrive/controls/lib/lateral_mpc_lib/c_generated_code/acados_ocp_solver_pyx.c index d48df6dc3..688df9dd8 100644 --- a/selfdrive/controls/lib/lateral_mpc_lib/c_generated_code/acados_ocp_solver_pyx.c +++ b/selfdrive/controls/lib/lateral_mpc_lib/c_generated_code/acados_ocp_solver_pyx.c @@ -923,7 +923,7 @@ static const char *__pyx_filename; static const char *__pyx_f[] = { - "pyextra/acados_template/acados_ocp_solver_pyx.pyx", + "third_party/acados/acados_template/acados_ocp_solver_pyx.pyx", "stringsource", "__init__.pxd", "type.pxd", diff --git a/selfdrive/controls/lib/lateral_mpc_lib/c_generated_code/acados_ocp_solver_pyx.so b/selfdrive/controls/lib/lateral_mpc_lib/c_generated_code/acados_ocp_solver_pyx.so index fc5ec38c0..7614090f7 100755 Binary files a/selfdrive/controls/lib/lateral_mpc_lib/c_generated_code/acados_ocp_solver_pyx.so and b/selfdrive/controls/lib/lateral_mpc_lib/c_generated_code/acados_ocp_solver_pyx.so differ diff --git a/selfdrive/controls/lib/lateral_mpc_lib/c_generated_code/acados_sim_solver_lat.c b/selfdrive/controls/lib/lateral_mpc_lib/c_generated_code/acados_sim_solver_lat.c deleted file mode 100644 index d0c541d3b..000000000 --- a/selfdrive/controls/lib/lateral_mpc_lib/c_generated_code/acados_sim_solver_lat.c +++ /dev/null @@ -1,278 +0,0 @@ -/* - * Copyright 2019 Gianluca Frison, Dimitris Kouzoupis, Robin Verschueren, - * Andrea Zanelli, Niels van Duijkeren, Jonathan Frey, Tommaso Sartor, - * Branimir Novoselnik, Rien Quirynen, Rezart Qelibari, Dang Doan, - * Jonas Koenemann, Yutao Chen, Tobias Schöls, Jonas Schlagenhauf, Moritz Diehl - * - * This file is part of acados. - * - * The 2-Clause BSD License - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE.; - */ -// standard -#include -#include - -// acados -#include "acados_c/external_function_interface.h" -#include "acados_c/sim_interface.h" -#include "acados_c/external_function_interface.h" - -#include "acados/sim/sim_common.h" -#include "acados/utils/external_function_generic.h" -#include "acados/utils/print.h" - - -// example specific -#include "lat_model/lat_model.h" -#include "acados_sim_solver_lat.h" - - -// ** solver data ** - -sim_solver_capsule * lat_acados_sim_solver_create_capsule() -{ - void* capsule_mem = malloc(sizeof(sim_solver_capsule)); - sim_solver_capsule *capsule = (sim_solver_capsule *) capsule_mem; - - return capsule; -} - - -int lat_acados_sim_solver_free_capsule(sim_solver_capsule * capsule) -{ - free(capsule); - return 0; -} - - -int lat_acados_sim_create(sim_solver_capsule * capsule) -{ - // initialize - const int nx = LAT_NX; - const int nu = LAT_NU; - const int nz = LAT_NZ; - const int np = LAT_NP; - bool tmp_bool; - - - double Tsim = 0.009765625; - - - // explicit ode - capsule->sim_forw_vde_casadi = (external_function_param_casadi *) malloc(sizeof(external_function_param_casadi)); - capsule->sim_expl_ode_fun_casadi = (external_function_param_casadi *) malloc(sizeof(external_function_param_casadi)); - - capsule->sim_forw_vde_casadi->casadi_fun = &lat_expl_vde_forw; - capsule->sim_forw_vde_casadi->casadi_n_in = &lat_expl_vde_forw_n_in; - capsule->sim_forw_vde_casadi->casadi_n_out = &lat_expl_vde_forw_n_out; - capsule->sim_forw_vde_casadi->casadi_sparsity_in = &lat_expl_vde_forw_sparsity_in; - capsule->sim_forw_vde_casadi->casadi_sparsity_out = &lat_expl_vde_forw_sparsity_out; - capsule->sim_forw_vde_casadi->casadi_work = &lat_expl_vde_forw_work; - external_function_param_casadi_create(capsule->sim_forw_vde_casadi, np); - - capsule->sim_expl_ode_fun_casadi->casadi_fun = &lat_expl_ode_fun; - capsule->sim_expl_ode_fun_casadi->casadi_n_in = &lat_expl_ode_fun_n_in; - capsule->sim_expl_ode_fun_casadi->casadi_n_out = &lat_expl_ode_fun_n_out; - capsule->sim_expl_ode_fun_casadi->casadi_sparsity_in = &lat_expl_ode_fun_sparsity_in; - capsule->sim_expl_ode_fun_casadi->casadi_sparsity_out = &lat_expl_ode_fun_sparsity_out; - capsule->sim_expl_ode_fun_casadi->casadi_work = &lat_expl_ode_fun_work; - external_function_param_casadi_create(capsule->sim_expl_ode_fun_casadi, np); - - - - // sim plan & config - sim_solver_plan_t plan; - plan.sim_solver = ERK; - - // create correct config based on plan - sim_config * lat_sim_config = sim_config_create(plan); - capsule->acados_sim_config = lat_sim_config; - - // sim dims - void *lat_sim_dims = sim_dims_create(lat_sim_config); - capsule->acados_sim_dims = lat_sim_dims; - sim_dims_set(lat_sim_config, lat_sim_dims, "nx", &nx); - sim_dims_set(lat_sim_config, lat_sim_dims, "nu", &nu); - sim_dims_set(lat_sim_config, lat_sim_dims, "nz", &nz); - - - // sim opts - sim_opts *lat_sim_opts = sim_opts_create(lat_sim_config, lat_sim_dims); - capsule->acados_sim_opts = lat_sim_opts; - int tmp_int = 3; - sim_opts_set(lat_sim_config, lat_sim_opts, "newton_iter", &tmp_int); - sim_collocation_type collocation_type = GAUSS_LEGENDRE; - sim_opts_set(lat_sim_config, lat_sim_opts, "collocation_type", &collocation_type); - - - tmp_int = 4; - sim_opts_set(lat_sim_config, lat_sim_opts, "num_stages", &tmp_int); - tmp_int = 1; - sim_opts_set(lat_sim_config, lat_sim_opts, "num_steps", &tmp_int); - tmp_bool = 0; - sim_opts_set(lat_sim_config, lat_sim_opts, "jac_reuse", &tmp_bool); - - - // sim in / out - sim_in *lat_sim_in = sim_in_create(lat_sim_config, lat_sim_dims); - capsule->acados_sim_in = lat_sim_in; - sim_out *lat_sim_out = sim_out_create(lat_sim_config, lat_sim_dims); - capsule->acados_sim_out = lat_sim_out; - - sim_in_set(lat_sim_config, lat_sim_dims, - lat_sim_in, "T", &Tsim); - - // model functions - lat_sim_config->model_set(lat_sim_in->model, - "expl_vde_for", capsule->sim_forw_vde_casadi); - lat_sim_config->model_set(lat_sim_in->model, - "expl_ode_fun", capsule->sim_expl_ode_fun_casadi); - - // sim solver - sim_solver *lat_sim_solver = sim_solver_create(lat_sim_config, - lat_sim_dims, lat_sim_opts); - capsule->acados_sim_solver = lat_sim_solver; - - - /* initialize parameter values */ - double* p = calloc(np, sizeof(double)); - - - lat_acados_sim_update_params(capsule, p, np); - free(p); - - - /* initialize input */ - // x - double x0[4]; - for (int ii = 0; ii < 4; ii++) - x0[ii] = 0.0; - - sim_in_set(lat_sim_config, lat_sim_dims, - lat_sim_in, "x", x0); - - - // u - double u0[1]; - for (int ii = 0; ii < 1; ii++) - u0[ii] = 0.0; - - sim_in_set(lat_sim_config, lat_sim_dims, - lat_sim_in, "u", u0); - - // S_forw - double S_forw[20]; - for (int ii = 0; ii < 20; ii++) - S_forw[ii] = 0.0; - for (int ii = 0; ii < 4; ii++) - S_forw[ii + ii * 4 ] = 1.0; - - - sim_in_set(lat_sim_config, lat_sim_dims, - lat_sim_in, "S_forw", S_forw); - - int status = sim_precompute(lat_sim_solver, lat_sim_in, lat_sim_out); - - return status; -} - - -int lat_acados_sim_solve(sim_solver_capsule *capsule) -{ - // integrate dynamics using acados sim_solver - int status = sim_solve(capsule->acados_sim_solver, - capsule->acados_sim_in, capsule->acados_sim_out); - if (status != 0) - printf("error in lat_acados_sim_solve()! Exiting.\n"); - - return status; -} - - -int lat_acados_sim_free(sim_solver_capsule *capsule) -{ - // free memory - sim_solver_destroy(capsule->acados_sim_solver); - sim_in_destroy(capsule->acados_sim_in); - sim_out_destroy(capsule->acados_sim_out); - sim_opts_destroy(capsule->acados_sim_opts); - sim_dims_destroy(capsule->acados_sim_dims); - sim_config_destroy(capsule->acados_sim_config); - - // free external function - external_function_param_casadi_free(capsule->sim_forw_vde_casadi); - external_function_param_casadi_free(capsule->sim_expl_ode_fun_casadi); - - return 0; -} - - -int lat_acados_sim_update_params(sim_solver_capsule *capsule, double *p, int np) -{ - int status = 0; - int casadi_np = LAT_NP; - - if (casadi_np != np) { - printf("lat_acados_sim_update_params: trying to set %i parameters for external functions." - " External function has %i parameters. Exiting.\n", np, casadi_np); - exit(1); - } - capsule->sim_forw_vde_casadi[0].set_param(capsule->sim_forw_vde_casadi, p); - capsule->sim_expl_ode_fun_casadi[0].set_param(capsule->sim_expl_ode_fun_casadi, p); - - return status; -} - -/* getters pointers to C objects*/ -sim_config * lat_acados_get_sim_config(sim_solver_capsule *capsule) -{ - return capsule->acados_sim_config; -}; - -sim_in * lat_acados_get_sim_in(sim_solver_capsule *capsule) -{ - return capsule->acados_sim_in; -}; - -sim_out * lat_acados_get_sim_out(sim_solver_capsule *capsule) -{ - return capsule->acados_sim_out; -}; - -void * lat_acados_get_sim_dims(sim_solver_capsule *capsule) -{ - return capsule->acados_sim_dims; -}; - -sim_opts * lat_acados_get_sim_opts(sim_solver_capsule *capsule) -{ - return capsule->acados_sim_opts; -}; - -sim_solver * lat_acados_get_sim_solver(sim_solver_capsule *capsule) -{ - return capsule->acados_sim_solver; -}; - diff --git a/selfdrive/controls/lib/lateral_mpc_lib/c_generated_code/acados_sim_solver_lat.h b/selfdrive/controls/lib/lateral_mpc_lib/c_generated_code/acados_sim_solver_lat.h deleted file mode 100644 index 86b9c84c9..000000000 --- a/selfdrive/controls/lib/lateral_mpc_lib/c_generated_code/acados_sim_solver_lat.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright 2019 Gianluca Frison, Dimitris Kouzoupis, Robin Verschueren, - * Andrea Zanelli, Niels van Duijkeren, Jonathan Frey, Tommaso Sartor, - * Branimir Novoselnik, Rien Quirynen, Rezart Qelibari, Dang Doan, - * Jonas Koenemann, Yutao Chen, Tobias Schöls, Jonas Schlagenhauf, Moritz Diehl - * - * This file is part of acados. - * - * The 2-Clause BSD License - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE.; - */ - -#ifndef ACADOS_SIM_lat_H_ -#define ACADOS_SIM_lat_H_ - -#include "acados_c/sim_interface.h" -#include "acados_c/external_function_interface.h" - -#define LAT_NX 4 -#define LAT_NZ 0 -#define LAT_NU 1 -#define LAT_NP 2 - -#ifdef __cplusplus -extern "C" { -#endif - - -// ** capsule for solver data ** -typedef struct sim_solver_capsule -{ - // acados objects - sim_in *acados_sim_in; - sim_out *acados_sim_out; - sim_solver *acados_sim_solver; - sim_opts *acados_sim_opts; - sim_config *acados_sim_config; - void *acados_sim_dims; - - /* external functions */ - // ERK - external_function_param_casadi * sim_forw_vde_casadi; - external_function_param_casadi * sim_expl_ode_fun_casadi; - external_function_param_casadi * sim_expl_ode_hess; - - // IRK - external_function_param_casadi * sim_impl_dae_fun; - external_function_param_casadi * sim_impl_dae_fun_jac_x_xdot_z; - external_function_param_casadi * sim_impl_dae_jac_x_xdot_u_z; - external_function_param_casadi * sim_impl_dae_hess; - - // GNSF - external_function_param_casadi * sim_gnsf_phi_fun; - external_function_param_casadi * sim_gnsf_phi_fun_jac_y; - external_function_param_casadi * sim_gnsf_phi_jac_y_uhat; - external_function_param_casadi * sim_gnsf_f_lo_jac_x1_x1dot_u_z; - external_function_param_casadi * sim_gnsf_get_matrices_fun; - -} sim_solver_capsule; - - -ACADOS_SYMBOL_EXPORT int lat_acados_sim_create(sim_solver_capsule *capsule); -ACADOS_SYMBOL_EXPORT int lat_acados_sim_solve(sim_solver_capsule *capsule); -ACADOS_SYMBOL_EXPORT int lat_acados_sim_free(sim_solver_capsule *capsule); -ACADOS_SYMBOL_EXPORT int lat_acados_sim_update_params(sim_solver_capsule *capsule, double *value, int np); - -ACADOS_SYMBOL_EXPORT sim_config * lat_acados_get_sim_config(sim_solver_capsule *capsule); -ACADOS_SYMBOL_EXPORT sim_in * lat_acados_get_sim_in(sim_solver_capsule *capsule); -ACADOS_SYMBOL_EXPORT sim_out * lat_acados_get_sim_out(sim_solver_capsule *capsule); -ACADOS_SYMBOL_EXPORT void * lat_acados_get_sim_dims(sim_solver_capsule *capsule); -ACADOS_SYMBOL_EXPORT sim_opts * lat_acados_get_sim_opts(sim_solver_capsule *capsule); -ACADOS_SYMBOL_EXPORT sim_solver * lat_acados_get_sim_solver(sim_solver_capsule *capsule); - - -ACADOS_SYMBOL_EXPORT sim_solver_capsule * lat_acados_sim_solver_create_capsule(void); -ACADOS_SYMBOL_EXPORT int lat_acados_sim_solver_free_capsule(sim_solver_capsule *capsule); - -#ifdef __cplusplus -} -#endif - -#endif // ACADOS_SIM_lat_H_ diff --git a/selfdrive/controls/lib/lateral_mpc_lib/c_generated_code/acados_solver_lat.c b/selfdrive/controls/lib/lateral_mpc_lib/c_generated_code/acados_solver_lat.c index 578d3d1b3..f95047dae 100644 --- a/selfdrive/controls/lib/lateral_mpc_lib/c_generated_code/acados_solver_lat.c +++ b/selfdrive/controls/lib/lateral_mpc_lib/c_generated_code/acados_solver_lat.c @@ -405,6 +405,22 @@ void lat_acados_create_5_set_nlp_in(lat_solver_capsule* capsule, const int N, do time_steps[13] = 0.263671875; time_steps[14] = 0.283203125; time_steps[15] = 0.302734375; + time_steps[16] = 0.322265625; + time_steps[17] = 0.341796875; + time_steps[18] = 0.361328125; + time_steps[19] = 0.380859375; + time_steps[20] = 0.400390625; + time_steps[21] = 0.419921875; + time_steps[22] = 0.439453125; + time_steps[23] = 0.458984375; + time_steps[24] = 0.478515625; + time_steps[25] = 0.498046875; + time_steps[26] = 0.517578125; + time_steps[27] = 0.537109375; + time_steps[28] = 0.556640625; + time_steps[29] = 0.576171875; + time_steps[30] = 0.595703125; + time_steps[31] = 0.615234375; lat_acados_update_time_steps(capsule, N, time_steps); free(time_steps); } diff --git a/selfdrive/controls/lib/lateral_mpc_lib/c_generated_code/acados_solver_lat.h b/selfdrive/controls/lib/lateral_mpc_lib/c_generated_code/acados_solver_lat.h index 9e6844651..0ef4698c2 100644 --- a/selfdrive/controls/lib/lateral_mpc_lib/c_generated_code/acados_solver_lat.h +++ b/selfdrive/controls/lib/lateral_mpc_lib/c_generated_code/acados_solver_lat.h @@ -63,7 +63,7 @@ #define LAT_NY0 5 #define LAT_NY 5 #define LAT_NYN 3 -#define LAT_N 16 +#define LAT_N 32 #define LAT_NH 0 #define LAT_NPHI 0 #define LAT_NHN 0 diff --git a/selfdrive/controls/lib/lateral_mpc_lib/c_generated_code/acados_solver_sfunction_lat.c b/selfdrive/controls/lib/lateral_mpc_lib/c_generated_code/acados_solver_sfunction_lat.c deleted file mode 100644 index 9294d2b70..000000000 --- a/selfdrive/controls/lib/lateral_mpc_lib/c_generated_code/acados_solver_sfunction_lat.c +++ /dev/null @@ -1,264 +0,0 @@ -/* - * Copyright 2019 Gianluca Frison, Dimitris Kouzoupis, Robin Verschueren, - * Andrea Zanelli, Niels van Duijkeren, Jonathan Frey, Tommaso Sartor, - * Branimir Novoselnik, Rien Quirynen, Rezart Qelibari, Dang Doan, - * Jonas Koenemann, Yutao Chen, Tobias Schöls, Jonas Schlagenhauf, Moritz Diehl - * - * This file is part of acados. - * - * The 2-Clause BSD License - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE.; - */ - -#define S_FUNCTION_NAME acados_solver_sfunction_lat -#define S_FUNCTION_LEVEL 2 - -#define MDL_START - -// acados -// #include "acados/utils/print.h" -#include "acados_c/sim_interface.h" -#include "acados_c/external_function_interface.h" - -// example specific -#include "lat_model/lat_model.h" -#include "acados_solver_lat.h" - -#include "simstruc.h" - -#define SAMPLINGTIME 0.009765625 - -static void mdlInitializeSizes (SimStruct *S) -{ - // specify the number of continuous and discrete states - ssSetNumContStates(S, 0); - ssSetNumDiscStates(S, 0);// specify the number of input ports - if ( !ssSetNumInputPorts(S, 8) ) - return; - - // specify the number of output ports - if ( !ssSetNumOutputPorts(S, 6) ) - return; - - // specify dimension information for the input ports - // lbx_0 - ssSetInputPortVectorDimension(S, 0, 4); - // ubx_0 - ssSetInputPortVectorDimension(S, 1, 4); - // parameters - ssSetInputPortVectorDimension(S, 2, (16+1) * 2); - // y_ref_0 - ssSetInputPortVectorDimension(S, 3, 5); - // y_ref - ssSetInputPortVectorDimension(S, 4, 75); - // y_ref_e - ssSetInputPortVectorDimension(S, 5, 3); - // lbx - ssSetInputPortVectorDimension(S, 6, 30); - // ubx - ssSetInputPortVectorDimension(S, 7, 30);/* specify dimension information for the OUTPUT ports */ - ssSetOutputPortVectorDimension(S, 0, 1 ); - ssSetOutputPortVectorDimension(S, 1, 1 ); - ssSetOutputPortVectorDimension(S, 2, 1 ); - ssSetOutputPortVectorDimension(S, 3, 4 ); // state at shooting node 1 - ssSetOutputPortVectorDimension(S, 4, 1); - ssSetOutputPortVectorDimension(S, 5, 1 ); - - // specify the direct feedthrough status - // should be set to 1 for all inputs used in mdlOutputs - ssSetInputPortDirectFeedThrough(S, 0, 1); - ssSetInputPortDirectFeedThrough(S, 1, 1); - ssSetInputPortDirectFeedThrough(S, 2, 1); - ssSetInputPortDirectFeedThrough(S, 3, 1); - ssSetInputPortDirectFeedThrough(S, 4, 1); - ssSetInputPortDirectFeedThrough(S, 5, 1); - ssSetInputPortDirectFeedThrough(S, 6, 1); - ssSetInputPortDirectFeedThrough(S, 7, 1); - - // one sample time - ssSetNumSampleTimes(S, 1); -} - - -#if defined(MATLAB_MEX_FILE) - -#define MDL_SET_INPUT_PORT_DIMENSION_INFO -#define MDL_SET_OUTPUT_PORT_DIMENSION_INFO - -static void mdlSetInputPortDimensionInfo(SimStruct *S, int_T port, const DimsInfo_T *dimsInfo) -{ - if ( !ssSetInputPortDimensionInfo(S, port, dimsInfo) ) - return; -} - -static void mdlSetOutputPortDimensionInfo(SimStruct *S, int_T port, const DimsInfo_T *dimsInfo) -{ - if ( !ssSetOutputPortDimensionInfo(S, port, dimsInfo) ) - return; -} - -#endif /* MATLAB_MEX_FILE */ - - -static void mdlInitializeSampleTimes(SimStruct *S) -{ - ssSetSampleTime(S, 0, SAMPLINGTIME); - ssSetOffsetTime(S, 0, 0.0); -} - - -static void mdlStart(SimStruct *S) -{ - lat_solver_capsule *capsule = lat_acados_create_capsule(); - lat_acados_create(capsule); - - ssSetUserData(S, (void*)capsule); -} - - -static void mdlOutputs(SimStruct *S, int_T tid) -{ - lat_solver_capsule *capsule = ssGetUserData(S); - ocp_nlp_config *nlp_config = lat_acados_get_nlp_config(capsule); - ocp_nlp_dims *nlp_dims = lat_acados_get_nlp_dims(capsule); - ocp_nlp_in *nlp_in = lat_acados_get_nlp_in(capsule); - ocp_nlp_out *nlp_out = lat_acados_get_nlp_out(capsule); - - InputRealPtrsType in_sign; - - // local buffer - real_t buffer[5]; - - /* go through inputs */ - // lbx_0 - in_sign = ssGetInputPortRealSignalPtrs(S, 0); - for (int i = 0; i < 4; i++) - buffer[i] = (double)(*in_sign[i]); - - ocp_nlp_constraints_model_set(nlp_config, nlp_dims, nlp_in, 0, "lbx", buffer); - // ubx_0 - in_sign = ssGetInputPortRealSignalPtrs(S, 1); - for (int i = 0; i < 4; i++) - buffer[i] = (double)(*in_sign[i]); - ocp_nlp_constraints_model_set(nlp_config, nlp_dims, nlp_in, 0, "ubx", buffer); - // parameters - stage-variant !!! - in_sign = ssGetInputPortRealSignalPtrs(S, 2); - - // update value of parameters - for (int ii = 0; ii <= 16; ii++) - { - for (int jj = 0; jj < 2; jj++) - buffer[jj] = (double)(*in_sign[ii*2+jj]); - lat_acados_update_params(capsule, ii, buffer, 2); - } - - - // y_ref_0 - in_sign = ssGetInputPortRealSignalPtrs(S, 3); - - for (int i = 0; i < 5; i++) - buffer[i] = (double)(*in_sign[i]); - - ocp_nlp_cost_model_set(nlp_config, nlp_dims, nlp_in, 0, "yref", (void *) buffer); - - - // y_ref - for stages 1 to N-1 - in_sign = ssGetInputPortRealSignalPtrs(S, 4); - - for (int ii = 1; ii < 16; ii++) - { - for (int jj = 0; jj < 5; jj++) - buffer[jj] = (double)(*in_sign[(ii-1)*5+jj]); - ocp_nlp_cost_model_set(nlp_config, nlp_dims, nlp_in, ii, "yref", (void *) buffer); - } - - - // y_ref_e - in_sign = ssGetInputPortRealSignalPtrs(S, 5); - - for (int i = 0; i < 3; i++) - buffer[i] = (double)(*in_sign[i]); - - ocp_nlp_cost_model_set(nlp_config, nlp_dims, nlp_in, 16, "yref", (void *) buffer); - // lbx - in_sign = ssGetInputPortRealSignalPtrs(S, 6); - for (int ii = 1; ii < 16; ii++) - { - for (int jj = 0; jj < 2; jj++) - buffer[jj] = (double)(*in_sign[(ii-1)*2+jj]); - ocp_nlp_constraints_model_set(nlp_config, nlp_dims, nlp_in, ii, "lbx", (void *) buffer); - } - // ubx - in_sign = ssGetInputPortRealSignalPtrs(S, 7); - for (int ii = 1; ii < 16; ii++) - { - for (int jj = 0; jj < 2; jj++) - buffer[jj] = (double)(*in_sign[(ii-1)*2+jj]); - ocp_nlp_constraints_model_set(nlp_config, nlp_dims, nlp_in, ii, "ubx", (void *) buffer); - } - - /* call solver */ - int rti_phase = 0; - ocp_nlp_solver_opts_set(nlp_config, capsule->nlp_opts, "rti_phase", &rti_phase); - int acados_status = lat_acados_solve(capsule); - - - /* set outputs */ - // assign pointers to output signals - real_t *out_u0, *out_utraj, *out_xtraj, *out_status, *out_sqp_iter, *out_KKT_res, *out_x1, *out_cpu_time, *out_cpu_time_sim, *out_cpu_time_qp, *out_cpu_time_lin; - int tmp_int; - out_u0 = ssGetOutputPortRealSignal(S, 0); - ocp_nlp_out_get(nlp_config, nlp_dims, nlp_out, 0, "u", (void *) out_u0); - - - out_status = ssGetOutputPortRealSignal(S, 1); - *out_status = (real_t) acados_status; - out_KKT_res = ssGetOutputPortRealSignal(S, 2); - *out_KKT_res = (real_t) nlp_out->inf_norm_res; - out_x1 = ssGetOutputPortRealSignal(S, 3); - ocp_nlp_out_get(nlp_config, nlp_dims, nlp_out, 1, "x", (void *) out_x1); - out_cpu_time = ssGetOutputPortRealSignal(S, 4); - // get solution time - ocp_nlp_get(nlp_config, capsule->nlp_solver, "time_tot", (void *) out_cpu_time); - out_sqp_iter = ssGetOutputPortRealSignal(S, 5); - // get sqp iter - ocp_nlp_get(nlp_config, capsule->nlp_solver, "sqp_iter", (void *) &tmp_int); - *out_sqp_iter = (real_t) tmp_int; - -} - -static void mdlTerminate(SimStruct *S) -{ - lat_solver_capsule *capsule = ssGetUserData(S); - - lat_acados_free(capsule); - lat_acados_free_capsule(capsule); -} - - -#ifdef MATLAB_MEX_FILE -#include "simulink.c" -#else -#include "cg_sfun.h" -#endif diff --git a/selfdrive/controls/lib/lateral_mpc_lib/c_generated_code/libacados_ocp_solver_lat.so b/selfdrive/controls/lib/lateral_mpc_lib/c_generated_code/libacados_ocp_solver_lat.so index 660363082..8146258fa 100755 Binary files a/selfdrive/controls/lib/lateral_mpc_lib/c_generated_code/libacados_ocp_solver_lat.so and b/selfdrive/controls/lib/lateral_mpc_lib/c_generated_code/libacados_ocp_solver_lat.so differ diff --git a/selfdrive/controls/lib/lateral_mpc_lib/c_generated_code/main_sim_lat.c b/selfdrive/controls/lib/lateral_mpc_lib/c_generated_code/main_sim_lat.c deleted file mode 100644 index c536654fd..000000000 --- a/selfdrive/controls/lib/lateral_mpc_lib/c_generated_code/main_sim_lat.c +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright 2019 Gianluca Frison, Dimitris Kouzoupis, Robin Verschueren, - * Andrea Zanelli, Niels van Duijkeren, Jonathan Frey, Tommaso Sartor, - * Branimir Novoselnik, Rien Quirynen, Rezart Qelibari, Dang Doan, - * Jonas Koenemann, Yutao Chen, Tobias Schöls, Jonas Schlagenhauf, Moritz Diehl - * - * This file is part of acados. - * - * The 2-Clause BSD License - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE.; - */ - - -// standard -#include -#include -// acados -#include "acados/utils/print.h" -#include "acados/utils/math.h" -#include "acados_c/sim_interface.h" -#include "acados_sim_solver_lat.h" - -#define NX LAT_NX -#define NZ LAT_NZ -#define NU LAT_NU -#define NP LAT_NP - - -int main() -{ - int status = 0; - sim_solver_capsule *capsule = lat_acados_sim_solver_create_capsule(); - status = lat_acados_sim_create(capsule); - - if (status) - { - printf("acados_create() returned status %d. Exiting.\n", status); - exit(1); - } - - sim_config *acados_sim_config = lat_acados_get_sim_config(capsule); - sim_in *acados_sim_in = lat_acados_get_sim_in(capsule); - sim_out *acados_sim_out = lat_acados_get_sim_out(capsule); - void *acados_sim_dims = lat_acados_get_sim_dims(capsule); - - // initial condition - double x_current[NX]; - x_current[0] = 0.0; - x_current[1] = 0.0; - x_current[2] = 0.0; - x_current[3] = 0.0; - - - x_current[0] = 0; - x_current[1] = 0; - x_current[2] = 0; - x_current[3] = 0; - - - - - // initial value for control input - double u0[NU]; - u0[0] = 0.0; - // set parameters - double p[NP]; - p[0] = 0; - p[1] = 0; - - lat_acados_sim_update_params(capsule, p, NP); - - - int n_sim_steps = 3; - // solve ocp in loop - for (int ii = 0; ii < n_sim_steps; ii++) - { - sim_in_set(acados_sim_config, acados_sim_dims, - acados_sim_in, "x", x_current); - status = lat_acados_sim_solve(capsule); - - if (status != ACADOS_SUCCESS) - { - printf("acados_solve() failed with status %d.\n", status); - } - - sim_out_get(acados_sim_config, acados_sim_dims, - acados_sim_out, "x", x_current); - - printf("\nx_current, %d\n", ii); - for (int jj = 0; jj < NX; jj++) - { - printf("%e\n", x_current[jj]); - } - } - - printf("\nPerformed %d simulation steps with acados integrator successfully.\n\n", n_sim_steps); - - // free solver - status = lat_acados_sim_free(capsule); - if (status) { - printf("lat_acados_sim_free() returned status %d. \n", status); - } - - lat_acados_sim_solver_free_capsule(capsule); - - return status; -} diff --git a/selfdrive/controls/lib/lateral_mpc_lib/c_generated_code/make_sfun_lat.m b/selfdrive/controls/lib/lateral_mpc_lib/c_generated_code/make_sfun_lat.m deleted file mode 100644 index f8371f3e8..000000000 --- a/selfdrive/controls/lib/lateral_mpc_lib/c_generated_code/make_sfun_lat.m +++ /dev/null @@ -1,125 +0,0 @@ -% -% Copyright 2019 Gianluca Frison, Dimitris Kouzoupis, Robin Verschueren, -% Andrea Zanelli, Niels van Duijkeren, Jonathan Frey, Tommaso Sartor, -% Branimir Novoselnik, Rien Quirynen, Rezart Qelibari, Dang Doan, -% Jonas Koenemann, Yutao Chen, Tobias Schöls, Jonas Schlagenhauf, Moritz Diehl -% -% This file is part of acados. -% -% The 2-Clause BSD License -% -% Redistribution and use in source and binary forms, with or without -% modification, are permitted provided that the following conditions are met: -% -% 1. Redistributions of source code must retain the above copyright notice, -% this list of conditions and the following disclaimer. -% -% 2. Redistributions in binary form must reproduce the above copyright notice, -% this list of conditions and the following disclaimer in the documentation -% and/or other materials provided with the distribution. -% -% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -% POSSIBILITY OF SUCH DAMAGE.; -% - -SOURCES = { ... - 'lat_model/lat_expl_ode_fun.c', ... - 'lat_model/lat_expl_vde_forw.c',... - 'lat_cost/lat_cost_y_0_fun.c',... - 'lat_cost/lat_cost_y_0_fun_jac_ut_xt.c',... - 'lat_cost/lat_cost_y_0_hess.c',... - 'lat_cost/lat_cost_y_fun.c',... - 'lat_cost/lat_cost_y_fun_jac_ut_xt.c',... - 'lat_cost/lat_cost_y_hess.c',... - 'lat_cost/lat_cost_y_e_fun.c',... - 'lat_cost/lat_cost_y_e_fun_jac_ut_xt.c',... - 'lat_cost/lat_cost_y_e_hess.c',... - 'acados_solver_sfunction_lat.c', ... - 'acados_solver_lat.c' - }; - -INC_PATH = '/data/openpilot/third_party/acados/include/acados/include'; - -INCS = {['-I', fullfile(INC_PATH, 'blasfeo', 'include')], ... - ['-I', fullfile(INC_PATH, 'hpipm', 'include')], ... - ['-I', fullfile(INC_PATH, 'acados')], ... - ['-I', fullfile(INC_PATH)]}; - - - -CFLAGS = 'CFLAGS=$CFLAGS'; -LDFLAGS = 'LDFLAGS=$LDFLAGS'; -COMPFLAGS = 'COMPFLAGS=$COMPFLAGS'; -COMPDEFINES = 'COMPDEFINES=$COMPDEFINES'; - - - -LIB_PATH = ['-L', fullfile('/data/openpilot/third_party/acados/include/acados/lib')]; - -LIBS = {'-lacados', '-lhpipm', '-lblasfeo'}; - -% acados linking libraries and flags - - -mex('-v', '-O', CFLAGS, LDFLAGS, COMPFLAGS, COMPDEFINES, INCS{:}, ... - LIB_PATH, LIBS{:}, SOURCES{:}, ... - '-output', 'acados_solver_sfunction_lat' ); - -fprintf( [ '\n\nSuccessfully created sfunction:\nacados_solver_sfunction_lat', '.', ... - eval('mexext')] ); - - -%% print note on usage of s-function -fprintf('\n\nNote: Usage of Sfunction is as follows:\n') -input_note = 'Inputs are:\n'; -i_in = 1; -input_note = strcat(input_note, num2str(i_in), ') lbx_0 - lower bound on x for stage 0,',... - ' size [4]\n '); -i_in = i_in + 1; -input_note = strcat(input_note, num2str(i_in), ') ubx_0 - upper bound on x for stage 0,',... - ' size [4]\n '); -i_in = i_in + 1; -input_note = strcat(input_note, num2str(i_in), ') parameters - concatenated for all shooting nodes 0 to N+1,',... - ' size [34]\n '); -i_in = i_in + 1; -input_note = strcat(input_note, num2str(i_in), ') y_ref_0, size [5]\n '); -i_in = i_in + 1; -input_note = strcat(input_note, num2str(i_in), ') y_ref - concatenated for shooting nodes 1 to N-1,',... - ' size [75]\n '); -i_in = i_in + 1; -input_note = strcat(input_note, num2str(i_in), ') y_ref_e, size [3]\n '); -i_in = i_in + 1; -input_note = strcat(input_note, num2str(i_in), ') lbx for shooting nodes 1 to N-1, size [30]\n '); -i_in = i_in + 1; -input_note = strcat(input_note, num2str(i_in), ') ubx for shooting nodes 1 to N-1, size [30]\n '); -i_in = i_in + 1; - -fprintf(input_note) - -disp(' ') - -output_note = 'Outputs are:\n'; -i_out = 0; -i_out = i_out + 1; -output_note = strcat(output_note, num2str(i_out), ') u0, control input at node 0, size [1]\n '); -i_out = i_out + 1; -output_note = strcat(output_note, num2str(i_out), ') acados solver status (0 = SUCCESS)\n '); -i_out = i_out + 1; -output_note = strcat(output_note, num2str(i_out), ') KKT residual\n '); -i_out = i_out + 1; -output_note = strcat(output_note, num2str(i_out), ') x1, state at node 1\n '); -i_out = i_out + 1; -output_note = strcat(output_note, num2str(i_out), ') CPU time\n '); -i_out = i_out + 1; -output_note = strcat(output_note, num2str(i_out), ') SQP iterations\n '); - -fprintf(output_note) diff --git a/selfdrive/controls/lib/lateral_mpc_lib/lat_mpc.py b/selfdrive/controls/lib/lateral_mpc_lib/lat_mpc.py index 9607532ac..ca7b991e6 100755 --- a/selfdrive/controls/lib/lateral_mpc_lib/lat_mpc.py +++ b/selfdrive/controls/lib/lateral_mpc_lib/lat_mpc.py @@ -3,12 +3,12 @@ import os import numpy as np from casadi import SX, vertcat, sin, cos - from common.realtime import sec_since_boot +# WARNING: imports outside of constants will not trigger a rebuild from selfdrive.modeld.constants import T_IDXS if __name__ == '__main__': # generating code - from pyextra.acados_template import AcadosModel, AcadosOcp, AcadosOcpSolver + from third_party.acados.acados_template import AcadosModel, AcadosOcp, AcadosOcpSolver else: from selfdrive.controls.lib.lateral_mpc_lib.c_generated_code.acados_ocp_solver_pyx import AcadosOcpSolverCython # pylint: disable=no-name-in-module, import-error @@ -17,12 +17,12 @@ EXPORT_DIR = os.path.join(LAT_MPC_DIR, "c_generated_code") JSON_FILE = os.path.join(LAT_MPC_DIR, "acados_ocp_lat.json") X_DIM = 4 P_DIM = 2 -N = 16 COST_E_DIM = 3 COST_DIM = COST_E_DIM + 2 SPEED_OFFSET = 10.0 MODEL_NAME = 'lat' ACADOS_SOLVER_TYPE = 'SQP_RTI' +N = 32 def gen_lat_model(): model = AcadosModel() @@ -168,14 +168,14 @@ class LateralMpc(): self.solver.constraints_set(0, "lbx", x0_cp) self.solver.constraints_set(0, "ubx", x0_cp) self.yref[:,0] = y_pts - v_ego = p_cp[0] + v_ego = p_cp[0, 0] # rotation_radius = p_cp[1] self.yref[:,1] = heading_pts * (v_ego + SPEED_OFFSET) self.yref[:,2] = yaw_rate_pts * (v_ego + SPEED_OFFSET) for i in range(N): self.solver.cost_set(i, "yref", self.yref[i]) - self.solver.set(i, "p", p_cp) - self.solver.set(N, "p", p_cp) + self.solver.set(i, "p", p_cp[i]) + self.solver.set(N, "p", p_cp[N]) self.solver.cost_set(N, "yref", self.yref[N][:COST_E_DIM]) t = sec_since_boot() diff --git a/selfdrive/controls/lib/lateral_planner.py b/selfdrive/controls/lib/lateral_planner.py index a7718eead..3a90daec7 100644 --- a/selfdrive/controls/lib/lateral_planner.py +++ b/selfdrive/controls/lib/lateral_planner.py @@ -4,12 +4,12 @@ from common.numpy_fast import interp from system.swaglog import cloudlog from selfdrive.controls.lib.lateral_mpc_lib.lat_mpc import LateralMpc from selfdrive.controls.lib.lateral_mpc_lib.lat_mpc import N as LAT_MPC_N -from selfdrive.controls.lib.drive_helpers import CONTROL_N, MIN_SPEED +from selfdrive.controls.lib.drive_helpers import CONTROL_N, MIN_SPEED, get_lane_laneless_mode from selfdrive.controls.lib.desire_helper import DesireHelper import cereal.messaging as messaging from cereal import log from selfdrive.controls.lib.lane_planner import LanePlanner -from selfdrive.hardware import TICI +from system.hardware import TICI from common.params import Params TRAJECTORY_SIZE = 33 @@ -19,12 +19,12 @@ CAMERA_OFFSET = 0.04 PATH_COST = 1.0 LATERAL_MOTION_COST = 0.11 LATERAL_ACCEL_COST = 0.0 -LATERAL_JERK_COST = 0.05 +LATERAL_JERK_COST = 0.04 # Extreme steering rate is unpleasant, even # when it does not cause bad jerk. # TODO this cost should be lowered when low # speed lateral control is stable on all cars -STEERING_RATE_COST = 800.0 +STEERING_RATE_COST = 700.0 class LateralPlanner: @@ -46,6 +46,7 @@ class LateralPlanner: self.solution_invalid_cnt = 0 self.path_xyz = np.zeros((TRAJECTORY_SIZE, 3)) + self.velocity_xyz = np.zeros((TRAJECTORY_SIZE, 3)) self.plan_yaw = np.zeros((TRAJECTORY_SIZE,)) self.plan_yaw_rate = np.zeros((TRAJECTORY_SIZE,)) self.t_idxs = np.arange(TRAJECTORY_SIZE) @@ -61,12 +62,15 @@ class LateralPlanner: def update(self, sm): # clip speed , lateral planning is not possible at 0 speed - self.v_ego = max(MIN_SPEED, sm['carState'].vEgo) measured_curvature = sm['controlsState'].curvature if sm.updated['dragonConf']: self.dp_lanelines_enable = sm['dragonConf'].dpLateralLanelines self.dp_camera_offset = sm['dragonConf'].dpLateralCameraOffset self.dp_path_offset = sm['dragonConf'].dpLateralPathOffset + if sm['controlsState'].dpLateralAltActive and sm['dragonConf'].dpLateralAltLanelines: + self.dp_lanelines_enable = True + self.dp_camera_offset = sm['dragonConf'].dpLateralAltCameraOffset + self.dp_path_offset = sm['dragonConf'].dpLateralAltPathOffset # Parse model predictions md = sm['modelV2'] @@ -75,6 +79,10 @@ class LateralPlanner: self.t_idxs = np.array(md.position.t) self.plan_yaw = np.array(md.orientation.z) self.plan_yaw_rate = np.array(md.orientationRate.z) + self.velocity_xyz = np.column_stack([md.velocity.x, md.velocity.y, md.velocity.z]) + car_speed = np.linalg.norm(self.velocity_xyz, axis=1) + self.v_plan = np.clip(car_speed, MIN_SPEED, np.inf) + self.v_ego = self.v_plan[0] if self.dp_lanelines_enable: # dp - when laneline mode enabled, we use old logic (including lane changing) @@ -87,7 +95,7 @@ class LateralPlanner: self.l_lane_change_prob = desire_state[log.LateralPlan.Desire.laneChangeLeft] self.r_lane_change_prob = desire_state[log.LateralPlan.Desire.laneChangeRight] lane_change_prob = self.l_lane_change_prob + self.r_lane_change_prob - self.DH.update(sm['carState'], sm['carControl'].latActive, lane_change_prob, sm['dragonConf']) + self.DH.update(sm['carState'], sm['carControl'].latActive, lane_change_prob, sm['dragonConf'], md) d_path_xyz = self.path_xyz # dp -- tab spacing end (stock logic) -- @@ -95,16 +103,16 @@ class LateralPlanner: LATERAL_ACCEL_COST, LATERAL_JERK_COST, STEERING_RATE_COST) - y_pts = np.interp(self.v_ego * self.t_idxs[:LAT_MPC_N + 1], np.linalg.norm(d_path_xyz, axis=1), d_path_xyz[:, 1]) - heading_pts = np.interp(self.v_ego * self.t_idxs[:LAT_MPC_N + 1], np.linalg.norm(self.path_xyz, axis=1), self.plan_yaw) - yaw_rate_pts = np.interp(self.v_ego * self.t_idxs[:LAT_MPC_N + 1], np.linalg.norm(self.path_xyz, axis=1), self.plan_yaw_rate) + y_pts = d_path_xyz[:LAT_MPC_N+1, 1] + heading_pts = self.plan_yaw[:LAT_MPC_N+1] + yaw_rate_pts = self.plan_yaw_rate[:LAT_MPC_N+1] self.y_pts = y_pts assert len(y_pts) == LAT_MPC_N + 1 assert len(heading_pts) == LAT_MPC_N + 1 assert len(yaw_rate_pts) == LAT_MPC_N + 1 - lateral_factor = max(0, self.factor1 - (self.factor2 * self.v_ego**2)) - p = np.array([self.v_ego, lateral_factor]) + lateral_factor = np.clip(self.factor1 - (self.factor2 * self.v_plan**2), 0.0, np.inf) + p = np.column_stack([self.v_plan, lateral_factor]) self.lat_mpc.run(self.x0, p, y_pts, @@ -148,7 +156,7 @@ class LateralPlanner: lateralPlan.solverExecutionTime = self.lat_mpc.solve_time lateralPlan.desire = self.DH.desire - lateralPlan.useLaneLines = False + lateralPlan.useLaneLines = self.dp_lanelines_enable and self.dp_lanelines_active lateralPlan.laneChangeState = self.DH.lane_change_state lateralPlan.laneChangeDirection = self.DH.lane_change_direction @@ -165,7 +173,7 @@ class LateralPlanner: # Lane change logic lane_change_prob = self.LP.l_lane_change_prob + self.LP.r_lane_change_prob - self.DH.update(car_state, lat_active, lane_change_prob, dragon_conf) + self.DH.update(car_state, lat_active, lane_change_prob, dragon_conf, md) # Turn off lanes during lane change if self.DH.desire == log.LateralPlan.Desire.laneChangeRight or self.DH.desire == log.LateralPlan.Desire.laneChangeLeft: @@ -173,10 +181,7 @@ class LateralPlanner: self.LP.rll_prob *= self.DH.lane_change_ll_prob # dynamic laneline/laneless logic - if self.LP.lll_prob < 0.3 and self.LP.rll_prob < 0.3: - self.dp_lanelines_active_tmp = False - elif self.LP.lll_prob > 0.5 and self.LP.rll_prob > 0.5: - self.dp_lanelines_active_tmp = True + self.dp_lanelines_active_tmp = get_lane_laneless_mode(self.LP.lll_prob, self.LP.rll_prob, self.dp_lanelines_active_tmp) self.dp_lanelines_active = self.dp_lanelines_active_tmp # Calculate final driving path and set MPC costs @@ -184,4 +189,3 @@ class LateralPlanner: return self.LP.get_d_path(self.v_ego, self.t_idxs, self.path_xyz) else: return self.path_xyz - diff --git a/selfdrive/controls/lib/longcontrol.py b/selfdrive/controls/lib/longcontrol.py index 545a4c43f..e8095813f 100644 --- a/selfdrive/controls/lib/longcontrol.py +++ b/selfdrive/controls/lib/longcontrol.py @@ -30,10 +30,8 @@ def long_control_state_trans(CP, active, long_control_state, v_ego, v_target, long_control_state = LongCtrlState.off else: - if long_control_state == LongCtrlState.off: + if long_control_state in (LongCtrlState.off, LongCtrlState.pid): long_control_state = LongCtrlState.pid - - elif long_control_state == LongCtrlState.pid: if stopping_condition: long_control_state = LongCtrlState.stopping diff --git a/selfdrive/controls/lib/longitudinal_mpc_lib/c_generated_code/acados_ocp_solver_pyx.c b/selfdrive/controls/lib/longitudinal_mpc_lib/c_generated_code/acados_ocp_solver_pyx.c index 5bceb34b0..4bbf8e112 100644 --- a/selfdrive/controls/lib/longitudinal_mpc_lib/c_generated_code/acados_ocp_solver_pyx.c +++ b/selfdrive/controls/lib/longitudinal_mpc_lib/c_generated_code/acados_ocp_solver_pyx.c @@ -923,7 +923,7 @@ static const char *__pyx_filename; static const char *__pyx_f[] = { - "pyextra/acados_template/acados_ocp_solver_pyx.pyx", + "third_party/acados/acados_template/acados_ocp_solver_pyx.pyx", "stringsource", "__init__.pxd", "type.pxd", diff --git a/selfdrive/controls/lib/longitudinal_mpc_lib/c_generated_code/acados_ocp_solver_pyx.so b/selfdrive/controls/lib/longitudinal_mpc_lib/c_generated_code/acados_ocp_solver_pyx.so index 93d707812..0916a10e4 100755 Binary files a/selfdrive/controls/lib/longitudinal_mpc_lib/c_generated_code/acados_ocp_solver_pyx.so and b/selfdrive/controls/lib/longitudinal_mpc_lib/c_generated_code/acados_ocp_solver_pyx.so differ diff --git a/selfdrive/controls/lib/longitudinal_mpc_lib/long_mpc.py b/selfdrive/controls/lib/longitudinal_mpc_lib/long_mpc.py index 1b4ccab54..d9f5d62f2 100644 --- a/selfdrive/controls/lib/longitudinal_mpc_lib/long_mpc.py +++ b/selfdrive/controls/lib/longitudinal_mpc_lib/long_mpc.py @@ -5,11 +5,12 @@ import numpy as np from common.realtime import sec_since_boot from common.numpy_fast import clip, interp from system.swaglog import cloudlog +# WARNING: imports outside of constants will not trigger a rebuild from selfdrive.modeld.constants import index_function from selfdrive.controls.lib.radar_helpers import _LEAD_ACCEL_TAU if __name__ == '__main__': # generating code - from pyextra.acados_template import AcadosModel, AcadosOcp, AcadosOcpSolver + from third_party.acados.acados_template import AcadosModel, AcadosOcp, AcadosOcpSolver else: from selfdrive.controls.lib.longitudinal_mpc_lib.c_generated_code.acados_ocp_solver_pyx import AcadosOcpSolverCython # pylint: disable=no-name-in-module, import-error @@ -320,7 +321,7 @@ class LongitudinalMpc: self.cruise_min_a = min_a self.max_a = max_a - def update(self, carstate, radarstate, v_cruise, x, v, a, j, prev_accel_constraint, desired_tf=T_FOLLOW): + def update(self, radarstate, v_cruise, x, v, a, j, prev_accel_constraint, desired_tf=T_FOLLOW): v_ego = self.x0[1] self.status = radarstate.leadOne.status or radarstate.leadTwo.status diff --git a/selfdrive/controls/lib/longitudinal_planner.py b/selfdrive/controls/lib/longitudinal_planner.py index 494a18144..000040ba8 100755 --- a/selfdrive/controls/lib/longitudinal_planner.py +++ b/selfdrive/controls/lib/longitudinal_planner.py @@ -20,7 +20,6 @@ from selfdrive.controls.lib.turn_speed_controller import TurnSpeedController from selfdrive.controls.lib.events import Events LON_MPC_STEP = 0.2 # first step is 0.2s -AWARENESS_DECEL = -0.2 # car smoothly decel at .2m/s^2 when user is distracted A_CRUISE_MIN = -1.2 A_CRUISE_MAX_VALS = [1.6, 1.2, 0.8, 0.6] A_CRUISE_MAX_BP = [0., 10.0, 25., 40.] @@ -41,13 +40,13 @@ DP_ACCEL_NORMAL = 1 DP_ACCEL_SPORT = 2 # accel profile by @arne182 modified by cgw -_DP_CRUISE_MIN_V = [-0.80, -0.80, -0.75, -0.75, -0.75, -0.60] -_DP_CRUISE_MIN_V_ECO = [-0.80, -0.75, -0.65, -0.65, -0.60, -0.50] -_DP_CRUISE_MIN_V_SPORT = [-1.0, -1.0, -1.0, -1.1, -1.1, -1.1] -_DP_CRUISE_MIN_BP = [0., 0.07, 10., 20., 30., 55.] +_DP_CRUISE_MIN_V = [-0.50, -0.50, -0.50, -0.50, -0.50, -0.45, -0.45] +_DP_CRUISE_MIN_V_ECO = [-0.40, -0.40, -0.40, -0.40, -0.40, -0.40, -0.40] +_DP_CRUISE_MIN_V_SPORT = [-0.52, -0.52, -0.52, -0.52, -0.52, -0.47, -0.47] +_DP_CRUISE_MIN_BP = [0., 0.07, 3.1, 10., 20., 30., 55.] -_DP_CRUISE_MAX_V = [3.5, 3.4, 2.1, 1.6, 1.1, 0.91, 0.68, 0.44, 0.34, 0.13] -_DP_CRUISE_MAX_V_ECO = [3.0, 2.2, 1.4, 1.0, 0.75, 0.6, 0.48, 0.36, 0.28, 0.09] +_DP_CRUISE_MAX_V = [3.5, 3.4, 2.1, 1.6, 1.1, 0.91, 0.69, 0.45, 0.34, 0.13] +_DP_CRUISE_MAX_V_ECO = [3.0, 1.8, 1.3, 1.0, 0.71, 0.59, 0.45, 0.36, 0.28, 0.09] _DP_CRUISE_MAX_V_SPORT = [3.5, 3.5, 3.4, 3.0, 2.1, 1.61, 1.1, 0.63, 0.50, 0.33] _DP_CRUISE_MAX_BP = [0., 3, 6., 8., 11., 15., 20., 25., 30., 55.] @@ -124,25 +123,19 @@ class LongitudinalPlanner: self.dp_e2e_tf = T_FOLLOW self.dp_e2e_tf_count = 0 - self.CP = CP - self.mpc = LongitudinalMpc() - self.fcw = False self.a_desired = init_a self.v_desired_filter = FirstOrderFilter(init_v, 2.0, DT_MDL) + self.v_model_error = 0.0 self.v_desired_trajectory = np.zeros(CONTROL_N) self.a_desired_trajectory = np.zeros(CONTROL_N) self.j_desired_trajectory = np.zeros(CONTROL_N) self.solverExecutionTime = 0.0 - def read_param(self): - e2e = self.params.get_bool('ExperimentalMode') and self.CP.openpilotLongitudinalControl - self.mpc.mode = 'blended' if e2e else 'acc' - def _set_dp_e2e_mode(self, mode, force=False): reset_state = False @@ -226,12 +219,12 @@ class LongitudinalPlanner: return self._set_dp_e2e_mode('acc') @staticmethod - def parse_model(model_msg): + def parse_model(model_msg, model_error): if (len(model_msg.position.x) == 33 and len(model_msg.velocity.x) == 33 and len(model_msg.acceleration.x) == 33): - x = np.interp(T_IDXS_MPC, T_IDXS, model_msg.position.x) - v = np.interp(T_IDXS_MPC, T_IDXS, model_msg.velocity.x) + x = np.interp(T_IDXS_MPC, T_IDXS, model_msg.position.x) - model_error * T_IDXS_MPC + v = np.interp(T_IDXS_MPC, T_IDXS, model_msg.velocity.x) - model_error a = np.interp(T_IDXS_MPC, T_IDXS, model_msg.acceleration.x) j = np.zeros(len(T_IDXS_MPC)) else: @@ -247,16 +240,16 @@ class LongitudinalPlanner: return desired_tf if self.dp_following_profile_ctrl: if self.dp_following_profile == 0: - x_vel = [0, 3., 13.89, 25.0, 41.67] - y_dist = [1.24, 1.34, 1.36, 1.26, 1.32] + x_vel = [1.1, 13.89, 25.0, 41.67] + y_dist = [1.35, 1.35, 1.27, 1.32] desired_tf = np.interp(v_ego, x_vel, y_dist) elif self.dp_following_profile == 1: - x_vel = [0, 5.556, 13.89, 41.67] - y_dist = [1.3, 1.460, 1.5000, 1.68] + x_vel = [5.556, 19.7, 41.67] + y_dist = [1.4, 1.6, 1.6 ] desired_tf = np.interp(v_ego, x_vel, y_dist) elif self.dp_following_profile == 2: - x_vel = [0, 5.556, 19.7, 41.67] - y_dist = [1.4, 1.54, 2.0, 2.2] + x_vel = [0, 19.7, 41.67] + y_dist = [1.4, 2.0, 2.0] desired_tf = np.interp(v_ego, x_vel, y_dist) return desired_tf @@ -311,17 +304,15 @@ class LongitudinalPlanner: # Prevent divergence, smooth in current v_ego self.v_desired_filter.x = max(0.0, self.v_desired_filter.update(v_ego)) # Compute model v_ego error - # if len(sm['modelV2'].temporalPose.trans): - # self.v_model_error = sm['modelV2'].temporalPose.trans[0] - v_ego + if len(sm['modelV2'].temporalPose.trans): + self.v_model_error = sm['modelV2'].temporalPose.trans[0] - v_ego # Get acceleration and active solutions for custom long mpc. self.cruise_source, a_min_sol, v_cruise_sol = self.cruise_solutions(not reset_state, self.v_desired_filter.x, self.a_desired, v_cruise, sm) if force_slow_decel: - # if required so, force a smooth deceleration - accel_limits_turns[1] = min(accel_limits_turns[1], AWARENESS_DECEL) - accel_limits_turns[0] = min(accel_limits_turns[0], accel_limits_turns[1]) + v_cruise_sol = 0.0 # clip limits, cannot init MPC outside of bounds accel_limits_turns[0] = min(accel_limits_turns[0], self.a_desired + 0.05, a_min_sol) accel_limits_turns[1] = max(accel_limits_turns[1], self.a_desired - 0.05) @@ -330,12 +321,14 @@ class LongitudinalPlanner: # self.mpc.set_weights(prev_accel_constraint) self.mpc.set_accel_limits(accel_limits_turns[0], accel_limits_turns[1]) self.mpc.set_cur_state(self.v_desired_filter.x, self.a_desired) - x, v, a, j = self.parse_model(sm['modelV2']) + x, v, a, j = self.parse_model(sm['modelV2'], self.v_model_error) self.dp_e2e_tf = self.get_df(v_ego) - self.mpc.update(sm['carState'], sm['radarState'], v_cruise_sol, x, v, a, j, prev_accel_constraint, self.dp_e2e_tf) + self.mpc.update(sm['radarState'], v_cruise_sol, x, v, a, j, prev_accel_constraint, self.dp_e2e_tf) - self.v_desired_trajectory = np.interp(T_IDXS[:CONTROL_N], T_IDXS_MPC, self.mpc.v_solution) - self.a_desired_trajectory = np.interp(T_IDXS[:CONTROL_N], T_IDXS_MPC, self.mpc.a_solution) + self.v_desired_trajectory_full = np.interp(T_IDXS, T_IDXS_MPC, self.mpc.v_solution) + self.a_desired_trajectory_full = np.interp(T_IDXS, T_IDXS_MPC, self.mpc.a_solution) + self.v_desired_trajectory = self.v_desired_trajectory_full[:CONTROL_N] + self.a_desired_trajectory = self.a_desired_trajectory_full[:CONTROL_N] self.j_desired_trajectory = np.interp(T_IDXS[:CONTROL_N], T_IDXS_MPC[:-1], self.mpc.j_solution) # TODO counter is only needed because radar is glitchy, remove once radar is gone diff --git a/selfdrive/controls/plannerd.py b/selfdrive/controls/plannerd.py index 5b9179c50..027b4a552 100755 --- a/selfdrive/controls/plannerd.py +++ b/selfdrive/controls/plannerd.py @@ -1,8 +1,10 @@ #!/usr/bin/env python3 +import numpy as np from cereal import car from common.params import Params from common.realtime import Priority, config_realtime_process from system.swaglog import cloudlog +from selfdrive.modeld.constants import T_IDXS from selfdrive.controls.lib.longitudinal_planner import LongitudinalPlanner from selfdrive.controls.lib.lateral_planner import LateralPlanner import cereal.messaging as messaging @@ -11,6 +13,22 @@ from system.hardware import TICI from selfdrive.dragonpilot.controls_0813.lib.lateral_planner import LateralPlanner as DPLateralPlanner from selfdrive.dragonpilot.controls_0816.lib.lateral_planner import LateralPlanner as FPLateralPlanner +def cumtrapz(x, t): + return np.concatenate([[0], np.cumsum(((x[0:-1] + x[1:])/2) * np.diff(t))]) + +def publish_ui_plan(sm, pm, lateral_planner, longitudinal_planner): + plan_odo = cumtrapz(longitudinal_planner.v_desired_trajectory_full, T_IDXS) + model_odo = cumtrapz(lateral_planner.v_plan, T_IDXS) + + ui_send = messaging.new_message('uiPlan') + ui_send.valid = sm.all_checks(service_list=['carState', 'controlsState', 'modelV2']) + uiPlan = ui_send.uiPlan + uiPlan.position.x = np.interp(plan_odo, model_odo, lateral_planner.lat_mpc.x_sol[:,0]).tolist() + uiPlan.position.y = np.interp(plan_odo, model_odo, lateral_planner.lat_mpc.x_sol[:,1]).tolist() + uiPlan.position.z = np.interp(plan_odo, model_odo, lateral_planner.path_xyz[:,2]).tolist() + uiPlan.accel = longitudinal_planner.a_desired_trajectory_full.tolist() + pm.send('uiPlan', ui_send) + def plannerd_thread(sm=None, pm=None): config_realtime_process(5 if TICI else 2, Priority.CTRL_LOW) @@ -38,7 +56,7 @@ def plannerd_thread(sm=None, pm=None): poll=['radarState', 'modelV2'], ignore_avg_freq=['radarState']) if pm is None: - pm = messaging.PubMaster(['longitudinalPlan', 'lateralPlan']) + pm = messaging.PubMaster(['longitudinalPlan', 'lateralPlan', 'uiPlan']) while True: sm.update() @@ -48,7 +66,8 @@ def plannerd_thread(sm=None, pm=None): lateral_planner.publish(sm, pm) longitudinal_planner.update(sm) longitudinal_planner.publish(sm, pm) - + if lat_version == 0: + publish_ui_plan(sm, pm, lateral_planner, longitudinal_planner) def main(sm=None, pm=None): plannerd_thread(sm, pm) diff --git a/selfdrive/controls/radard.py b/selfdrive/controls/radard.py index d5c5a8be0..620e7834e 100755 --- a/selfdrive/controls/radard.py +++ b/selfdrive/controls/radard.py @@ -8,9 +8,9 @@ from cereal import car from common.numpy_fast import interp from common.params import Params from common.realtime import Ratekeeper, Priority, config_realtime_process -from selfdrive.controls.lib.cluster.fastcluster_py import cluster_points_centroid from selfdrive.controls.lib.radar_helpers import Cluster, Track, RADAR_TO_CAMERA from system.swaglog import cloudlog +from third_party.cluster.fastcluster_py import cluster_points_centroid from system.hardware import TICI @@ -36,7 +36,7 @@ class KalmanParams(): self.K = [[interp(dt, dts, K0)], [interp(dt, dts, K1)]] -def laplacian_cdf(x, mu, b): +def laplacian_pdf(x, mu, b): b = max(b, 1e-4) return math.exp(-abs(x-mu)/b) @@ -46,9 +46,9 @@ def match_vision_to_cluster(v_ego, lead, clusters): offset_vision_dist = lead.x[0] - RADAR_TO_CAMERA def prob(c): - prob_d = laplacian_cdf(c.dRel, offset_vision_dist, lead.xStd[0]) - prob_y = laplacian_cdf(c.yRel, -lead.y[0], lead.yStd[0]) - prob_v = laplacian_cdf(c.vRel + v_ego, lead.v[0], lead.vStd[0]) + prob_d = laplacian_pdf(c.dRel, offset_vision_dist, lead.xStd[0]) + prob_y = laplacian_pdf(c.yRel, -lead.y[0], lead.yStd[0]) + prob_v = laplacian_pdf(c.vRel + v_ego, lead.v[0], lead.vStd[0]) # This is isn't exactly right, but good heuristic return prob_d * prob_y * prob_v @@ -166,7 +166,6 @@ class RadarD(): dat.valid = sm.all_checks() and len(rr.errors) == 0 radarState = dat.radarState radarState.mdMonoTime = sm.logMonoTime['modelV2'] - radarState.canMonoTimes = list(rr.canMonoTimes) radarState.radarErrors = list(rr.errors) radarState.carStateMonoTime = sm.logMonoTime['carState'] diff --git a/selfdrive/debug/get_fingerprint.py b/selfdrive/debug/get_fingerprint.py index e678db4f1..f7f7a1604 100755 --- a/selfdrive/debug/get_fingerprint.py +++ b/selfdrive/debug/get_fingerprint.py @@ -22,7 +22,7 @@ while True: for c in lc.can: # read also msgs sent by EON on CAN bus 0x80 and filter out the # addr with more than 11 bits - if c.src in [0, 2] and c.address < 0x800: + if c.src % 0x80 == 0 and c.address < 0x800 and c.address not in (0x7df, 0x7e0, 0x7e8): msgs[c.address] = len(c.dat) fingerprint = ', '.join("%d: %d" % v for v in sorted(msgs.items())) diff --git a/selfdrive/debug/hyundai_enable_radar_points.py b/selfdrive/debug/hyundai_enable_radar_points.py index ac7e7102d..07ce5ebdd 100755 --- a/selfdrive/debug/hyundai_enable_radar_points.py +++ b/selfdrive/debug/hyundai_enable_radar_points.py @@ -52,6 +52,10 @@ SUPPORTED_FW_VERSIONS = { b'IK__ SCC F-CUP 1.00 1.02 96400-G9100\x18\x07\x06\x17\x12 ': ConfigValues( default_config=b"\x00\x00\x00\x01\x00\x00", tracks_enabled=b"\x00\x00\x00\x01\x00\x01"), + # 2019 SANTA FE + b"TM__ SCC F-CUP 1.00 1.00 99110-S1210\x19\x01%\x168 ": ConfigValues( + default_config=b"\x00\x00\x00\x01\x00\x00", + tracks_enabled=b"\x00\x00\x00\x01\x00\x01"), } if __name__ == "__main__": diff --git a/selfdrive/debug/vw_mqb_config.py b/selfdrive/debug/vw_mqb_config.py index 8c4dbc55e..8952405b8 100755 --- a/selfdrive/debug/vw_mqb_config.py +++ b/selfdrive/debug/vw_mqb_config.py @@ -126,6 +126,7 @@ if __name__ == "__main__": uds_client.security_access(ACCESS_TYPE_LEVEL_1.SEND_KEY, struct.pack("!I", key)) # type: ignore except (NegativeResponseError, MessageTimeoutError): print("Security access failed!") + print("Open the hood and retry (disables the \"diagnostic firewall\" on newer vehicles)") quit() try: diff --git a/selfdrive/dragonpilot/controls_0813/lib/lateral_mpc_lib/acados_ocp_lat.json b/selfdrive/dragonpilot/controls_0813/lib/lateral_mpc_lib/acados_ocp_lat.json deleted file mode 100644 index 1cbe32253..000000000 --- a/selfdrive/dragonpilot/controls_0813/lib/lateral_mpc_lib/acados_ocp_lat.json +++ /dev/null @@ -1,450 +0,0 @@ -{ - "acados_include_path": "/data/openpilot/third_party/acados/include/acados/include", - "acados_lib_path": "/data/openpilot/third_party/acados/include/acados/lib", - "code_export_directory": "/data/openpilot/selfdrive/dragonpilot/controls_0813/lib/lateral_mpc_lib/c_generated_code", - "constraints": { - "C": [], - "C_e": [], - "D": [], - "constr_type": "BGH", - "constr_type_e": "BGH", - "idxbu": [], - "idxbx": [ - 2, - 3 - ], - "idxbx_0": [ - 0, - 1, - 2, - 3 - ], - "idxbx_e": [], - "idxbxe_0": [ - 0, - 1, - 2, - 3 - ], - "idxsbu": [], - "idxsbx": [], - "idxsbx_e": [], - "idxsg": [], - "idxsg_e": [], - "idxsh": [], - "idxsh_e": [], - "idxsphi": [], - "idxsphi_e": [], - "lbu": [], - "lbx": [ - -1.5707963267948966, - -0.8726646259971648 - ], - "lbx_0": [ - 0.0, - 0.0, - 0.0, - 0.0 - ], - "lbx_e": [], - "lg": [], - "lg_e": [], - "lh": [], - "lh_e": [], - "lphi": [], - "lphi_e": [], - "lsbu": [], - "lsbx": [], - "lsbx_e": [], - "lsg": [], - "lsg_e": [], - "lsh": [], - "lsh_e": [], - "lsphi": [], - "lsphi_e": [], - "ubu": [], - "ubx": [ - 1.5707963267948966, - 0.8726646259971648 - ], - "ubx_0": [ - 0.0, - 0.0, - 0.0, - 0.0 - ], - "ubx_e": [], - "ug": [], - "ug_e": [], - "uh": [], - "uh_e": [], - "uphi": [], - "uphi_e": [], - "usbu": [], - "usbx": [], - "usbx_e": [], - "usg": [], - "usg_e": [], - "ush": [], - "ush_e": [], - "usphi": [], - "usphi_e": [] - }, - "cost": { - "Vu": [ - [ - 0.0 - ], - [ - 0.0 - ], - [ - 0.0 - ] - ], - "Vu_0": [ - [ - 0.0 - ], - [ - 0.0 - ], - [ - 0.0 - ] - ], - "Vx": [ - [ - 0.0, - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0, - 0.0 - ] - ], - "Vx_0": [ - [ - 0.0, - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0, - 0.0 - ] - ], - "Vx_e": [ - [ - 0.0, - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0, - 0.0 - ] - ], - "Vz": [], - "Vz_0": [], - "W": [ - [ - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0 - ] - ], - "W_0": [ - [ - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0 - ] - ], - "W_e": [ - [ - 0.0, - 0.0 - ], - [ - 0.0, - 0.0 - ] - ], - "Zl": [], - "Zl_e": [], - "Zu": [], - "Zu_e": [], - "cost_ext_fun_type": "casadi", - "cost_ext_fun_type_0": "casadi", - "cost_ext_fun_type_e": "casadi", - "cost_type": "NONLINEAR_LS", - "cost_type_0": "NONLINEAR_LS", - "cost_type_e": "NONLINEAR_LS", - "yref": [ - 0.0, - 0.0, - 0.0 - ], - "yref_0": [ - 0.0, - 0.0, - 0.0 - ], - "yref_e": [ - 0.0, - 0.0 - ], - "zl": [], - "zl_e": [], - "zu": [], - "zu_e": [] - }, - "cython_include_dirs": "/data/data/com.termux/files/usr/lib/python3.8/site-packages/numpy/core/include", - "dims": { - "N": 16, - "nbu": 0, - "nbx": 2, - "nbx_0": 4, - "nbx_e": 0, - "nbxe_0": 4, - "ng": 0, - "ng_e": 0, - "nh": 0, - "nh_e": 0, - "np": 2, - "nphi": 0, - "nphi_e": 0, - "nr": 0, - "nr_e": 0, - "ns": 0, - "ns_e": 0, - "nsbu": 0, - "nsbx": 0, - "nsbx_e": 0, - "nsg": 0, - "nsg_e": 0, - "nsh": 0, - "nsh_e": 0, - "nsphi": 0, - "nsphi_e": 0, - "nu": 1, - "nx": 4, - "ny": 3, - "ny_0": 3, - "ny_e": 2, - "nz": 0 - }, - "model": { - "dyn_disc_fun": null, - "dyn_disc_fun_jac": null, - "dyn_disc_fun_jac_hess": null, - "dyn_ext_fun_type": "casadi", - "dyn_source_discrete": null, - "gnsf": { - "nontrivial_f_LO": 1, - "purely_linear": 0 - }, - "name": "lat" - }, - "parameter_values": [ - 0.0, - 0.0 - ], - "problem_class": "OCP", - "simulink_opts": { - "inputs": { - "cost_W": 0, - "cost_W_0": 0, - "cost_W_e": 0, - "lbu": 1, - "lbx": 1, - "lbx_0": 1, - "lbx_e": 1, - "lg": 1, - "lh": 1, - "parameter_traj": 1, - "reset_solver": 0, - "u_init": 0, - "ubu": 1, - "ubx": 1, - "ubx_0": 1, - "ubx_e": 1, - "ug": 1, - "uh": 1, - "x_init": 0, - "y_ref": 1, - "y_ref_0": 1, - "y_ref_e": 1 - }, - "outputs": { - "CPU_time": 1, - "CPU_time_lin": 0, - "CPU_time_qp": 0, - "CPU_time_sim": 0, - "KKT_residual": 1, - "solver_status": 1, - "sqp_iter": 1, - "u0": 1, - "utraj": 0, - "x1": 1, - "xtraj": 0 - }, - "samplingtime": "t0" - }, - "solver_options": { - "Tsim": 0.009765625, - "alpha_min": 0.05, - "alpha_reduction": 0.7, - "collocation_type": "GAUSS_LEGENDRE", - "eps_sufficient_descent": 0.0001, - "exact_hess_constr": 1, - "exact_hess_cost": 1, - "exact_hess_dyn": 1, - "ext_cost_num_hess": 0, - "full_step_dual": 0, - "globalization": "FIXED_STEP", - "globalization_use_SOC": 0, - "hessian_approx": "GAUSS_NEWTON", - "hpipm_mode": "BALANCE", - "initialize_t_slacks": 0, - "integrator_type": "ERK", - "levenberg_marquardt": 0.0, - "line_search_use_sufficient_descent": 0, - "model_external_shared_lib_dir": null, - "model_external_shared_lib_name": null, - "nlp_solver_max_iter": 100, - "nlp_solver_step_length": 1.0, - "nlp_solver_tol_comp": 1e-06, - "nlp_solver_tol_eq": 1e-06, - "nlp_solver_tol_ineq": 1e-06, - "nlp_solver_tol_stat": 1e-06, - "nlp_solver_type": "SQP_RTI", - "print_level": 0, - "qp_solver": "PARTIAL_CONDENSING_HPIPM", - "qp_solver_cond_N": 1, - "qp_solver_iter_max": 1, - "qp_solver_tol_comp": null, - "qp_solver_tol_eq": null, - "qp_solver_tol_ineq": null, - "qp_solver_tol_stat": null, - "qp_solver_warm_start": 0, - "regularize_method": null, - "sim_method_jac_reuse": [ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0 - ], - "sim_method_newton_iter": 3, - "sim_method_num_stages": [ - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4 - ], - "sim_method_num_steps": [ - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1 - ], - "tf": 2.5, - "time_steps": [ - 0.009765625, - 0.029296875, - 0.048828125, - 0.068359375, - 0.087890625, - 0.107421875, - 0.126953125, - 0.146484375, - 0.166015625, - 0.185546875, - 0.205078125, - 0.224609375, - 0.244140625, - 0.263671875, - 0.283203125, - 0.302734375 - ] - } -} \ No newline at end of file diff --git a/selfdrive/dragonpilot/controls_0813/lib/lateral_mpc_lib/c_generated_code/acados_ocp_solver_pyx.c b/selfdrive/dragonpilot/controls_0813/lib/lateral_mpc_lib/c_generated_code/acados_ocp_solver_pyx.c index d48df6dc3..688df9dd8 100644 --- a/selfdrive/dragonpilot/controls_0813/lib/lateral_mpc_lib/c_generated_code/acados_ocp_solver_pyx.c +++ b/selfdrive/dragonpilot/controls_0813/lib/lateral_mpc_lib/c_generated_code/acados_ocp_solver_pyx.c @@ -923,7 +923,7 @@ static const char *__pyx_filename; static const char *__pyx_f[] = { - "pyextra/acados_template/acados_ocp_solver_pyx.pyx", + "third_party/acados/acados_template/acados_ocp_solver_pyx.pyx", "stringsource", "__init__.pxd", "type.pxd", diff --git a/selfdrive/dragonpilot/controls_0813/lib/lateral_mpc_lib/c_generated_code/acados_ocp_solver_pyx.so b/selfdrive/dragonpilot/controls_0813/lib/lateral_mpc_lib/c_generated_code/acados_ocp_solver_pyx.so index ddcacbd09..083d30b93 100755 Binary files a/selfdrive/dragonpilot/controls_0813/lib/lateral_mpc_lib/c_generated_code/acados_ocp_solver_pyx.so and b/selfdrive/dragonpilot/controls_0813/lib/lateral_mpc_lib/c_generated_code/acados_ocp_solver_pyx.so differ diff --git a/selfdrive/dragonpilot/controls_0813/lib/lateral_mpc_lib/c_generated_code/acados_sim_solver_lat.c b/selfdrive/dragonpilot/controls_0813/lib/lateral_mpc_lib/c_generated_code/acados_sim_solver_lat.c deleted file mode 100644 index d0c541d3b..000000000 --- a/selfdrive/dragonpilot/controls_0813/lib/lateral_mpc_lib/c_generated_code/acados_sim_solver_lat.c +++ /dev/null @@ -1,278 +0,0 @@ -/* - * Copyright 2019 Gianluca Frison, Dimitris Kouzoupis, Robin Verschueren, - * Andrea Zanelli, Niels van Duijkeren, Jonathan Frey, Tommaso Sartor, - * Branimir Novoselnik, Rien Quirynen, Rezart Qelibari, Dang Doan, - * Jonas Koenemann, Yutao Chen, Tobias Schöls, Jonas Schlagenhauf, Moritz Diehl - * - * This file is part of acados. - * - * The 2-Clause BSD License - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE.; - */ -// standard -#include -#include - -// acados -#include "acados_c/external_function_interface.h" -#include "acados_c/sim_interface.h" -#include "acados_c/external_function_interface.h" - -#include "acados/sim/sim_common.h" -#include "acados/utils/external_function_generic.h" -#include "acados/utils/print.h" - - -// example specific -#include "lat_model/lat_model.h" -#include "acados_sim_solver_lat.h" - - -// ** solver data ** - -sim_solver_capsule * lat_acados_sim_solver_create_capsule() -{ - void* capsule_mem = malloc(sizeof(sim_solver_capsule)); - sim_solver_capsule *capsule = (sim_solver_capsule *) capsule_mem; - - return capsule; -} - - -int lat_acados_sim_solver_free_capsule(sim_solver_capsule * capsule) -{ - free(capsule); - return 0; -} - - -int lat_acados_sim_create(sim_solver_capsule * capsule) -{ - // initialize - const int nx = LAT_NX; - const int nu = LAT_NU; - const int nz = LAT_NZ; - const int np = LAT_NP; - bool tmp_bool; - - - double Tsim = 0.009765625; - - - // explicit ode - capsule->sim_forw_vde_casadi = (external_function_param_casadi *) malloc(sizeof(external_function_param_casadi)); - capsule->sim_expl_ode_fun_casadi = (external_function_param_casadi *) malloc(sizeof(external_function_param_casadi)); - - capsule->sim_forw_vde_casadi->casadi_fun = &lat_expl_vde_forw; - capsule->sim_forw_vde_casadi->casadi_n_in = &lat_expl_vde_forw_n_in; - capsule->sim_forw_vde_casadi->casadi_n_out = &lat_expl_vde_forw_n_out; - capsule->sim_forw_vde_casadi->casadi_sparsity_in = &lat_expl_vde_forw_sparsity_in; - capsule->sim_forw_vde_casadi->casadi_sparsity_out = &lat_expl_vde_forw_sparsity_out; - capsule->sim_forw_vde_casadi->casadi_work = &lat_expl_vde_forw_work; - external_function_param_casadi_create(capsule->sim_forw_vde_casadi, np); - - capsule->sim_expl_ode_fun_casadi->casadi_fun = &lat_expl_ode_fun; - capsule->sim_expl_ode_fun_casadi->casadi_n_in = &lat_expl_ode_fun_n_in; - capsule->sim_expl_ode_fun_casadi->casadi_n_out = &lat_expl_ode_fun_n_out; - capsule->sim_expl_ode_fun_casadi->casadi_sparsity_in = &lat_expl_ode_fun_sparsity_in; - capsule->sim_expl_ode_fun_casadi->casadi_sparsity_out = &lat_expl_ode_fun_sparsity_out; - capsule->sim_expl_ode_fun_casadi->casadi_work = &lat_expl_ode_fun_work; - external_function_param_casadi_create(capsule->sim_expl_ode_fun_casadi, np); - - - - // sim plan & config - sim_solver_plan_t plan; - plan.sim_solver = ERK; - - // create correct config based on plan - sim_config * lat_sim_config = sim_config_create(plan); - capsule->acados_sim_config = lat_sim_config; - - // sim dims - void *lat_sim_dims = sim_dims_create(lat_sim_config); - capsule->acados_sim_dims = lat_sim_dims; - sim_dims_set(lat_sim_config, lat_sim_dims, "nx", &nx); - sim_dims_set(lat_sim_config, lat_sim_dims, "nu", &nu); - sim_dims_set(lat_sim_config, lat_sim_dims, "nz", &nz); - - - // sim opts - sim_opts *lat_sim_opts = sim_opts_create(lat_sim_config, lat_sim_dims); - capsule->acados_sim_opts = lat_sim_opts; - int tmp_int = 3; - sim_opts_set(lat_sim_config, lat_sim_opts, "newton_iter", &tmp_int); - sim_collocation_type collocation_type = GAUSS_LEGENDRE; - sim_opts_set(lat_sim_config, lat_sim_opts, "collocation_type", &collocation_type); - - - tmp_int = 4; - sim_opts_set(lat_sim_config, lat_sim_opts, "num_stages", &tmp_int); - tmp_int = 1; - sim_opts_set(lat_sim_config, lat_sim_opts, "num_steps", &tmp_int); - tmp_bool = 0; - sim_opts_set(lat_sim_config, lat_sim_opts, "jac_reuse", &tmp_bool); - - - // sim in / out - sim_in *lat_sim_in = sim_in_create(lat_sim_config, lat_sim_dims); - capsule->acados_sim_in = lat_sim_in; - sim_out *lat_sim_out = sim_out_create(lat_sim_config, lat_sim_dims); - capsule->acados_sim_out = lat_sim_out; - - sim_in_set(lat_sim_config, lat_sim_dims, - lat_sim_in, "T", &Tsim); - - // model functions - lat_sim_config->model_set(lat_sim_in->model, - "expl_vde_for", capsule->sim_forw_vde_casadi); - lat_sim_config->model_set(lat_sim_in->model, - "expl_ode_fun", capsule->sim_expl_ode_fun_casadi); - - // sim solver - sim_solver *lat_sim_solver = sim_solver_create(lat_sim_config, - lat_sim_dims, lat_sim_opts); - capsule->acados_sim_solver = lat_sim_solver; - - - /* initialize parameter values */ - double* p = calloc(np, sizeof(double)); - - - lat_acados_sim_update_params(capsule, p, np); - free(p); - - - /* initialize input */ - // x - double x0[4]; - for (int ii = 0; ii < 4; ii++) - x0[ii] = 0.0; - - sim_in_set(lat_sim_config, lat_sim_dims, - lat_sim_in, "x", x0); - - - // u - double u0[1]; - for (int ii = 0; ii < 1; ii++) - u0[ii] = 0.0; - - sim_in_set(lat_sim_config, lat_sim_dims, - lat_sim_in, "u", u0); - - // S_forw - double S_forw[20]; - for (int ii = 0; ii < 20; ii++) - S_forw[ii] = 0.0; - for (int ii = 0; ii < 4; ii++) - S_forw[ii + ii * 4 ] = 1.0; - - - sim_in_set(lat_sim_config, lat_sim_dims, - lat_sim_in, "S_forw", S_forw); - - int status = sim_precompute(lat_sim_solver, lat_sim_in, lat_sim_out); - - return status; -} - - -int lat_acados_sim_solve(sim_solver_capsule *capsule) -{ - // integrate dynamics using acados sim_solver - int status = sim_solve(capsule->acados_sim_solver, - capsule->acados_sim_in, capsule->acados_sim_out); - if (status != 0) - printf("error in lat_acados_sim_solve()! Exiting.\n"); - - return status; -} - - -int lat_acados_sim_free(sim_solver_capsule *capsule) -{ - // free memory - sim_solver_destroy(capsule->acados_sim_solver); - sim_in_destroy(capsule->acados_sim_in); - sim_out_destroy(capsule->acados_sim_out); - sim_opts_destroy(capsule->acados_sim_opts); - sim_dims_destroy(capsule->acados_sim_dims); - sim_config_destroy(capsule->acados_sim_config); - - // free external function - external_function_param_casadi_free(capsule->sim_forw_vde_casadi); - external_function_param_casadi_free(capsule->sim_expl_ode_fun_casadi); - - return 0; -} - - -int lat_acados_sim_update_params(sim_solver_capsule *capsule, double *p, int np) -{ - int status = 0; - int casadi_np = LAT_NP; - - if (casadi_np != np) { - printf("lat_acados_sim_update_params: trying to set %i parameters for external functions." - " External function has %i parameters. Exiting.\n", np, casadi_np); - exit(1); - } - capsule->sim_forw_vde_casadi[0].set_param(capsule->sim_forw_vde_casadi, p); - capsule->sim_expl_ode_fun_casadi[0].set_param(capsule->sim_expl_ode_fun_casadi, p); - - return status; -} - -/* getters pointers to C objects*/ -sim_config * lat_acados_get_sim_config(sim_solver_capsule *capsule) -{ - return capsule->acados_sim_config; -}; - -sim_in * lat_acados_get_sim_in(sim_solver_capsule *capsule) -{ - return capsule->acados_sim_in; -}; - -sim_out * lat_acados_get_sim_out(sim_solver_capsule *capsule) -{ - return capsule->acados_sim_out; -}; - -void * lat_acados_get_sim_dims(sim_solver_capsule *capsule) -{ - return capsule->acados_sim_dims; -}; - -sim_opts * lat_acados_get_sim_opts(sim_solver_capsule *capsule) -{ - return capsule->acados_sim_opts; -}; - -sim_solver * lat_acados_get_sim_solver(sim_solver_capsule *capsule) -{ - return capsule->acados_sim_solver; -}; - diff --git a/selfdrive/dragonpilot/controls_0813/lib/lateral_mpc_lib/c_generated_code/acados_sim_solver_lat.h b/selfdrive/dragonpilot/controls_0813/lib/lateral_mpc_lib/c_generated_code/acados_sim_solver_lat.h deleted file mode 100644 index 86b9c84c9..000000000 --- a/selfdrive/dragonpilot/controls_0813/lib/lateral_mpc_lib/c_generated_code/acados_sim_solver_lat.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright 2019 Gianluca Frison, Dimitris Kouzoupis, Robin Verschueren, - * Andrea Zanelli, Niels van Duijkeren, Jonathan Frey, Tommaso Sartor, - * Branimir Novoselnik, Rien Quirynen, Rezart Qelibari, Dang Doan, - * Jonas Koenemann, Yutao Chen, Tobias Schöls, Jonas Schlagenhauf, Moritz Diehl - * - * This file is part of acados. - * - * The 2-Clause BSD License - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE.; - */ - -#ifndef ACADOS_SIM_lat_H_ -#define ACADOS_SIM_lat_H_ - -#include "acados_c/sim_interface.h" -#include "acados_c/external_function_interface.h" - -#define LAT_NX 4 -#define LAT_NZ 0 -#define LAT_NU 1 -#define LAT_NP 2 - -#ifdef __cplusplus -extern "C" { -#endif - - -// ** capsule for solver data ** -typedef struct sim_solver_capsule -{ - // acados objects - sim_in *acados_sim_in; - sim_out *acados_sim_out; - sim_solver *acados_sim_solver; - sim_opts *acados_sim_opts; - sim_config *acados_sim_config; - void *acados_sim_dims; - - /* external functions */ - // ERK - external_function_param_casadi * sim_forw_vde_casadi; - external_function_param_casadi * sim_expl_ode_fun_casadi; - external_function_param_casadi * sim_expl_ode_hess; - - // IRK - external_function_param_casadi * sim_impl_dae_fun; - external_function_param_casadi * sim_impl_dae_fun_jac_x_xdot_z; - external_function_param_casadi * sim_impl_dae_jac_x_xdot_u_z; - external_function_param_casadi * sim_impl_dae_hess; - - // GNSF - external_function_param_casadi * sim_gnsf_phi_fun; - external_function_param_casadi * sim_gnsf_phi_fun_jac_y; - external_function_param_casadi * sim_gnsf_phi_jac_y_uhat; - external_function_param_casadi * sim_gnsf_f_lo_jac_x1_x1dot_u_z; - external_function_param_casadi * sim_gnsf_get_matrices_fun; - -} sim_solver_capsule; - - -ACADOS_SYMBOL_EXPORT int lat_acados_sim_create(sim_solver_capsule *capsule); -ACADOS_SYMBOL_EXPORT int lat_acados_sim_solve(sim_solver_capsule *capsule); -ACADOS_SYMBOL_EXPORT int lat_acados_sim_free(sim_solver_capsule *capsule); -ACADOS_SYMBOL_EXPORT int lat_acados_sim_update_params(sim_solver_capsule *capsule, double *value, int np); - -ACADOS_SYMBOL_EXPORT sim_config * lat_acados_get_sim_config(sim_solver_capsule *capsule); -ACADOS_SYMBOL_EXPORT sim_in * lat_acados_get_sim_in(sim_solver_capsule *capsule); -ACADOS_SYMBOL_EXPORT sim_out * lat_acados_get_sim_out(sim_solver_capsule *capsule); -ACADOS_SYMBOL_EXPORT void * lat_acados_get_sim_dims(sim_solver_capsule *capsule); -ACADOS_SYMBOL_EXPORT sim_opts * lat_acados_get_sim_opts(sim_solver_capsule *capsule); -ACADOS_SYMBOL_EXPORT sim_solver * lat_acados_get_sim_solver(sim_solver_capsule *capsule); - - -ACADOS_SYMBOL_EXPORT sim_solver_capsule * lat_acados_sim_solver_create_capsule(void); -ACADOS_SYMBOL_EXPORT int lat_acados_sim_solver_free_capsule(sim_solver_capsule *capsule); - -#ifdef __cplusplus -} -#endif - -#endif // ACADOS_SIM_lat_H_ diff --git a/selfdrive/dragonpilot/controls_0813/lib/lateral_mpc_lib/c_generated_code/acados_solver_sfunction_lat.c b/selfdrive/dragonpilot/controls_0813/lib/lateral_mpc_lib/c_generated_code/acados_solver_sfunction_lat.c deleted file mode 100644 index 827b6c7f0..000000000 --- a/selfdrive/dragonpilot/controls_0813/lib/lateral_mpc_lib/c_generated_code/acados_solver_sfunction_lat.c +++ /dev/null @@ -1,264 +0,0 @@ -/* - * Copyright 2019 Gianluca Frison, Dimitris Kouzoupis, Robin Verschueren, - * Andrea Zanelli, Niels van Duijkeren, Jonathan Frey, Tommaso Sartor, - * Branimir Novoselnik, Rien Quirynen, Rezart Qelibari, Dang Doan, - * Jonas Koenemann, Yutao Chen, Tobias Schöls, Jonas Schlagenhauf, Moritz Diehl - * - * This file is part of acados. - * - * The 2-Clause BSD License - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE.; - */ - -#define S_FUNCTION_NAME acados_solver_sfunction_lat -#define S_FUNCTION_LEVEL 2 - -#define MDL_START - -// acados -// #include "acados/utils/print.h" -#include "acados_c/sim_interface.h" -#include "acados_c/external_function_interface.h" - -// example specific -#include "lat_model/lat_model.h" -#include "acados_solver_lat.h" - -#include "simstruc.h" - -#define SAMPLINGTIME 0.009765625 - -static void mdlInitializeSizes (SimStruct *S) -{ - // specify the number of continuous and discrete states - ssSetNumContStates(S, 0); - ssSetNumDiscStates(S, 0);// specify the number of input ports - if ( !ssSetNumInputPorts(S, 8) ) - return; - - // specify the number of output ports - if ( !ssSetNumOutputPorts(S, 6) ) - return; - - // specify dimension information for the input ports - // lbx_0 - ssSetInputPortVectorDimension(S, 0, 4); - // ubx_0 - ssSetInputPortVectorDimension(S, 1, 4); - // parameters - ssSetInputPortVectorDimension(S, 2, (16+1) * 2); - // y_ref_0 - ssSetInputPortVectorDimension(S, 3, 3); - // y_ref - ssSetInputPortVectorDimension(S, 4, 45); - // y_ref_e - ssSetInputPortVectorDimension(S, 5, 2); - // lbx - ssSetInputPortVectorDimension(S, 6, 30); - // ubx - ssSetInputPortVectorDimension(S, 7, 30);/* specify dimension information for the OUTPUT ports */ - ssSetOutputPortVectorDimension(S, 0, 1 ); - ssSetOutputPortVectorDimension(S, 1, 1 ); - ssSetOutputPortVectorDimension(S, 2, 1 ); - ssSetOutputPortVectorDimension(S, 3, 4 ); // state at shooting node 1 - ssSetOutputPortVectorDimension(S, 4, 1); - ssSetOutputPortVectorDimension(S, 5, 1 ); - - // specify the direct feedthrough status - // should be set to 1 for all inputs used in mdlOutputs - ssSetInputPortDirectFeedThrough(S, 0, 1); - ssSetInputPortDirectFeedThrough(S, 1, 1); - ssSetInputPortDirectFeedThrough(S, 2, 1); - ssSetInputPortDirectFeedThrough(S, 3, 1); - ssSetInputPortDirectFeedThrough(S, 4, 1); - ssSetInputPortDirectFeedThrough(S, 5, 1); - ssSetInputPortDirectFeedThrough(S, 6, 1); - ssSetInputPortDirectFeedThrough(S, 7, 1); - - // one sample time - ssSetNumSampleTimes(S, 1); -} - - -#if defined(MATLAB_MEX_FILE) - -#define MDL_SET_INPUT_PORT_DIMENSION_INFO -#define MDL_SET_OUTPUT_PORT_DIMENSION_INFO - -static void mdlSetInputPortDimensionInfo(SimStruct *S, int_T port, const DimsInfo_T *dimsInfo) -{ - if ( !ssSetInputPortDimensionInfo(S, port, dimsInfo) ) - return; -} - -static void mdlSetOutputPortDimensionInfo(SimStruct *S, int_T port, const DimsInfo_T *dimsInfo) -{ - if ( !ssSetOutputPortDimensionInfo(S, port, dimsInfo) ) - return; -} - -#endif /* MATLAB_MEX_FILE */ - - -static void mdlInitializeSampleTimes(SimStruct *S) -{ - ssSetSampleTime(S, 0, SAMPLINGTIME); - ssSetOffsetTime(S, 0, 0.0); -} - - -static void mdlStart(SimStruct *S) -{ - lat_solver_capsule *capsule = lat_acados_create_capsule(); - lat_acados_create(capsule); - - ssSetUserData(S, (void*)capsule); -} - - -static void mdlOutputs(SimStruct *S, int_T tid) -{ - lat_solver_capsule *capsule = ssGetUserData(S); - ocp_nlp_config *nlp_config = lat_acados_get_nlp_config(capsule); - ocp_nlp_dims *nlp_dims = lat_acados_get_nlp_dims(capsule); - ocp_nlp_in *nlp_in = lat_acados_get_nlp_in(capsule); - ocp_nlp_out *nlp_out = lat_acados_get_nlp_out(capsule); - - InputRealPtrsType in_sign; - - // local buffer - real_t buffer[4]; - - /* go through inputs */ - // lbx_0 - in_sign = ssGetInputPortRealSignalPtrs(S, 0); - for (int i = 0; i < 4; i++) - buffer[i] = (double)(*in_sign[i]); - - ocp_nlp_constraints_model_set(nlp_config, nlp_dims, nlp_in, 0, "lbx", buffer); - // ubx_0 - in_sign = ssGetInputPortRealSignalPtrs(S, 1); - for (int i = 0; i < 4; i++) - buffer[i] = (double)(*in_sign[i]); - ocp_nlp_constraints_model_set(nlp_config, nlp_dims, nlp_in, 0, "ubx", buffer); - // parameters - stage-variant !!! - in_sign = ssGetInputPortRealSignalPtrs(S, 2); - - // update value of parameters - for (int ii = 0; ii <= 16; ii++) - { - for (int jj = 0; jj < 2; jj++) - buffer[jj] = (double)(*in_sign[ii*2+jj]); - lat_acados_update_params(capsule, ii, buffer, 2); - } - - - // y_ref_0 - in_sign = ssGetInputPortRealSignalPtrs(S, 3); - - for (int i = 0; i < 3; i++) - buffer[i] = (double)(*in_sign[i]); - - ocp_nlp_cost_model_set(nlp_config, nlp_dims, nlp_in, 0, "yref", (void *) buffer); - - - // y_ref - for stages 1 to N-1 - in_sign = ssGetInputPortRealSignalPtrs(S, 4); - - for (int ii = 1; ii < 16; ii++) - { - for (int jj = 0; jj < 3; jj++) - buffer[jj] = (double)(*in_sign[(ii-1)*3+jj]); - ocp_nlp_cost_model_set(nlp_config, nlp_dims, nlp_in, ii, "yref", (void *) buffer); - } - - - // y_ref_e - in_sign = ssGetInputPortRealSignalPtrs(S, 5); - - for (int i = 0; i < 2; i++) - buffer[i] = (double)(*in_sign[i]); - - ocp_nlp_cost_model_set(nlp_config, nlp_dims, nlp_in, 16, "yref", (void *) buffer); - // lbx - in_sign = ssGetInputPortRealSignalPtrs(S, 6); - for (int ii = 1; ii < 16; ii++) - { - for (int jj = 0; jj < 2; jj++) - buffer[jj] = (double)(*in_sign[(ii-1)*2+jj]); - ocp_nlp_constraints_model_set(nlp_config, nlp_dims, nlp_in, ii, "lbx", (void *) buffer); - } - // ubx - in_sign = ssGetInputPortRealSignalPtrs(S, 7); - for (int ii = 1; ii < 16; ii++) - { - for (int jj = 0; jj < 2; jj++) - buffer[jj] = (double)(*in_sign[(ii-1)*2+jj]); - ocp_nlp_constraints_model_set(nlp_config, nlp_dims, nlp_in, ii, "ubx", (void *) buffer); - } - - /* call solver */ - int rti_phase = 0; - ocp_nlp_solver_opts_set(nlp_config, capsule->nlp_opts, "rti_phase", &rti_phase); - int acados_status = lat_acados_solve(capsule); - - - /* set outputs */ - // assign pointers to output signals - real_t *out_u0, *out_utraj, *out_xtraj, *out_status, *out_sqp_iter, *out_KKT_res, *out_x1, *out_cpu_time, *out_cpu_time_sim, *out_cpu_time_qp, *out_cpu_time_lin; - int tmp_int; - out_u0 = ssGetOutputPortRealSignal(S, 0); - ocp_nlp_out_get(nlp_config, nlp_dims, nlp_out, 0, "u", (void *) out_u0); - - - out_status = ssGetOutputPortRealSignal(S, 1); - *out_status = (real_t) acados_status; - out_KKT_res = ssGetOutputPortRealSignal(S, 2); - *out_KKT_res = (real_t) nlp_out->inf_norm_res; - out_x1 = ssGetOutputPortRealSignal(S, 3); - ocp_nlp_out_get(nlp_config, nlp_dims, nlp_out, 1, "x", (void *) out_x1); - out_cpu_time = ssGetOutputPortRealSignal(S, 4); - // get solution time - ocp_nlp_get(nlp_config, capsule->nlp_solver, "time_tot", (void *) out_cpu_time); - out_sqp_iter = ssGetOutputPortRealSignal(S, 5); - // get sqp iter - ocp_nlp_get(nlp_config, capsule->nlp_solver, "sqp_iter", (void *) &tmp_int); - *out_sqp_iter = (real_t) tmp_int; - -} - -static void mdlTerminate(SimStruct *S) -{ - lat_solver_capsule *capsule = ssGetUserData(S); - - lat_acados_free(capsule); - lat_acados_free_capsule(capsule); -} - - -#ifdef MATLAB_MEX_FILE -#include "simulink.c" -#else -#include "cg_sfun.h" -#endif diff --git a/selfdrive/dragonpilot/controls_0813/lib/lateral_mpc_lib/c_generated_code/main_sim_lat.c b/selfdrive/dragonpilot/controls_0813/lib/lateral_mpc_lib/c_generated_code/main_sim_lat.c deleted file mode 100644 index c536654fd..000000000 --- a/selfdrive/dragonpilot/controls_0813/lib/lateral_mpc_lib/c_generated_code/main_sim_lat.c +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright 2019 Gianluca Frison, Dimitris Kouzoupis, Robin Verschueren, - * Andrea Zanelli, Niels van Duijkeren, Jonathan Frey, Tommaso Sartor, - * Branimir Novoselnik, Rien Quirynen, Rezart Qelibari, Dang Doan, - * Jonas Koenemann, Yutao Chen, Tobias Schöls, Jonas Schlagenhauf, Moritz Diehl - * - * This file is part of acados. - * - * The 2-Clause BSD License - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE.; - */ - - -// standard -#include -#include -// acados -#include "acados/utils/print.h" -#include "acados/utils/math.h" -#include "acados_c/sim_interface.h" -#include "acados_sim_solver_lat.h" - -#define NX LAT_NX -#define NZ LAT_NZ -#define NU LAT_NU -#define NP LAT_NP - - -int main() -{ - int status = 0; - sim_solver_capsule *capsule = lat_acados_sim_solver_create_capsule(); - status = lat_acados_sim_create(capsule); - - if (status) - { - printf("acados_create() returned status %d. Exiting.\n", status); - exit(1); - } - - sim_config *acados_sim_config = lat_acados_get_sim_config(capsule); - sim_in *acados_sim_in = lat_acados_get_sim_in(capsule); - sim_out *acados_sim_out = lat_acados_get_sim_out(capsule); - void *acados_sim_dims = lat_acados_get_sim_dims(capsule); - - // initial condition - double x_current[NX]; - x_current[0] = 0.0; - x_current[1] = 0.0; - x_current[2] = 0.0; - x_current[3] = 0.0; - - - x_current[0] = 0; - x_current[1] = 0; - x_current[2] = 0; - x_current[3] = 0; - - - - - // initial value for control input - double u0[NU]; - u0[0] = 0.0; - // set parameters - double p[NP]; - p[0] = 0; - p[1] = 0; - - lat_acados_sim_update_params(capsule, p, NP); - - - int n_sim_steps = 3; - // solve ocp in loop - for (int ii = 0; ii < n_sim_steps; ii++) - { - sim_in_set(acados_sim_config, acados_sim_dims, - acados_sim_in, "x", x_current); - status = lat_acados_sim_solve(capsule); - - if (status != ACADOS_SUCCESS) - { - printf("acados_solve() failed with status %d.\n", status); - } - - sim_out_get(acados_sim_config, acados_sim_dims, - acados_sim_out, "x", x_current); - - printf("\nx_current, %d\n", ii); - for (int jj = 0; jj < NX; jj++) - { - printf("%e\n", x_current[jj]); - } - } - - printf("\nPerformed %d simulation steps with acados integrator successfully.\n\n", n_sim_steps); - - // free solver - status = lat_acados_sim_free(capsule); - if (status) { - printf("lat_acados_sim_free() returned status %d. \n", status); - } - - lat_acados_sim_solver_free_capsule(capsule); - - return status; -} diff --git a/selfdrive/dragonpilot/controls_0813/lib/lateral_mpc_lib/c_generated_code/make_sfun_lat.m b/selfdrive/dragonpilot/controls_0813/lib/lateral_mpc_lib/c_generated_code/make_sfun_lat.m deleted file mode 100644 index 2c6679ecb..000000000 --- a/selfdrive/dragonpilot/controls_0813/lib/lateral_mpc_lib/c_generated_code/make_sfun_lat.m +++ /dev/null @@ -1,125 +0,0 @@ -% -% Copyright 2019 Gianluca Frison, Dimitris Kouzoupis, Robin Verschueren, -% Andrea Zanelli, Niels van Duijkeren, Jonathan Frey, Tommaso Sartor, -% Branimir Novoselnik, Rien Quirynen, Rezart Qelibari, Dang Doan, -% Jonas Koenemann, Yutao Chen, Tobias Schöls, Jonas Schlagenhauf, Moritz Diehl -% -% This file is part of acados. -% -% The 2-Clause BSD License -% -% Redistribution and use in source and binary forms, with or without -% modification, are permitted provided that the following conditions are met: -% -% 1. Redistributions of source code must retain the above copyright notice, -% this list of conditions and the following disclaimer. -% -% 2. Redistributions in binary form must reproduce the above copyright notice, -% this list of conditions and the following disclaimer in the documentation -% and/or other materials provided with the distribution. -% -% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -% POSSIBILITY OF SUCH DAMAGE.; -% - -SOURCES = { ... - 'lat_model/lat_expl_ode_fun.c', ... - 'lat_model/lat_expl_vde_forw.c',... - 'lat_cost/lat_cost_y_0_fun.c',... - 'lat_cost/lat_cost_y_0_fun_jac_ut_xt.c',... - 'lat_cost/lat_cost_y_0_hess.c',... - 'lat_cost/lat_cost_y_fun.c',... - 'lat_cost/lat_cost_y_fun_jac_ut_xt.c',... - 'lat_cost/lat_cost_y_hess.c',... - 'lat_cost/lat_cost_y_e_fun.c',... - 'lat_cost/lat_cost_y_e_fun_jac_ut_xt.c',... - 'lat_cost/lat_cost_y_e_hess.c',... - 'acados_solver_sfunction_lat.c', ... - 'acados_solver_lat.c' - }; - -INC_PATH = '/data/openpilot/third_party/acados/include/acados/include'; - -INCS = {['-I', fullfile(INC_PATH, 'blasfeo', 'include')], ... - ['-I', fullfile(INC_PATH, 'hpipm', 'include')], ... - ['-I', fullfile(INC_PATH, 'acados')], ... - ['-I', fullfile(INC_PATH)]}; - - - -CFLAGS = 'CFLAGS=$CFLAGS'; -LDFLAGS = 'LDFLAGS=$LDFLAGS'; -COMPFLAGS = 'COMPFLAGS=$COMPFLAGS'; -COMPDEFINES = 'COMPDEFINES=$COMPDEFINES'; - - - -LIB_PATH = ['-L', fullfile('/data/openpilot/third_party/acados/include/acados/lib')]; - -LIBS = {'-lacados', '-lhpipm', '-lblasfeo'}; - -% acados linking libraries and flags - - -mex('-v', '-O', CFLAGS, LDFLAGS, COMPFLAGS, COMPDEFINES, INCS{:}, ... - LIB_PATH, LIBS{:}, SOURCES{:}, ... - '-output', 'acados_solver_sfunction_lat' ); - -fprintf( [ '\n\nSuccessfully created sfunction:\nacados_solver_sfunction_lat', '.', ... - eval('mexext')] ); - - -%% print note on usage of s-function -fprintf('\n\nNote: Usage of Sfunction is as follows:\n') -input_note = 'Inputs are:\n'; -i_in = 1; -input_note = strcat(input_note, num2str(i_in), ') lbx_0 - lower bound on x for stage 0,',... - ' size [4]\n '); -i_in = i_in + 1; -input_note = strcat(input_note, num2str(i_in), ') ubx_0 - upper bound on x for stage 0,',... - ' size [4]\n '); -i_in = i_in + 1; -input_note = strcat(input_note, num2str(i_in), ') parameters - concatenated for all shooting nodes 0 to N+1,',... - ' size [34]\n '); -i_in = i_in + 1; -input_note = strcat(input_note, num2str(i_in), ') y_ref_0, size [3]\n '); -i_in = i_in + 1; -input_note = strcat(input_note, num2str(i_in), ') y_ref - concatenated for shooting nodes 1 to N-1,',... - ' size [45]\n '); -i_in = i_in + 1; -input_note = strcat(input_note, num2str(i_in), ') y_ref_e, size [2]\n '); -i_in = i_in + 1; -input_note = strcat(input_note, num2str(i_in), ') lbx for shooting nodes 1 to N-1, size [30]\n '); -i_in = i_in + 1; -input_note = strcat(input_note, num2str(i_in), ') ubx for shooting nodes 1 to N-1, size [30]\n '); -i_in = i_in + 1; - -fprintf(input_note) - -disp(' ') - -output_note = 'Outputs are:\n'; -i_out = 0; -i_out = i_out + 1; -output_note = strcat(output_note, num2str(i_out), ') u0, control input at node 0, size [1]\n '); -i_out = i_out + 1; -output_note = strcat(output_note, num2str(i_out), ') acados solver status (0 = SUCCESS)\n '); -i_out = i_out + 1; -output_note = strcat(output_note, num2str(i_out), ') KKT residual\n '); -i_out = i_out + 1; -output_note = strcat(output_note, num2str(i_out), ') x1, state at node 1\n '); -i_out = i_out + 1; -output_note = strcat(output_note, num2str(i_out), ') CPU time\n '); -i_out = i_out + 1; -output_note = strcat(output_note, num2str(i_out), ') SQP iterations\n '); - -fprintf(output_note) diff --git a/selfdrive/dragonpilot/controls_0813/lib/lateral_mpc_lib/lat_mpc.py b/selfdrive/dragonpilot/controls_0813/lib/lateral_mpc_lib/lat_mpc.py index 2eeb0cb6b..881fcc599 100755 --- a/selfdrive/dragonpilot/controls_0813/lib/lateral_mpc_lib/lat_mpc.py +++ b/selfdrive/dragonpilot/controls_0813/lib/lateral_mpc_lib/lat_mpc.py @@ -9,7 +9,7 @@ from selfdrive.controls.lib.drive_helpers import LAT_MPC_N as N from selfdrive.modeld.constants import T_IDXS if __name__ == '__main__': # generating code - from pyextra.acados_template import AcadosModel, AcadosOcp, AcadosOcpSolver + from third_party.acados.acados_template import AcadosModel, AcadosOcp, AcadosOcpSolver else: from selfdrive.dragonpilot.controls_0813.lib.lateral_mpc_lib.c_generated_code.acados_ocp_solver_pyx import AcadosOcpSolverCython # pylint: disable=no-name-in-module, import-error diff --git a/selfdrive/dragonpilot/controls_0813/lib/lateral_planner.py b/selfdrive/dragonpilot/controls_0813/lib/lateral_planner.py index 9fab88eaf..646ea5872 100644 --- a/selfdrive/dragonpilot/controls_0813/lib/lateral_planner.py +++ b/selfdrive/dragonpilot/controls_0813/lib/lateral_planner.py @@ -8,7 +8,7 @@ from selfdrive.controls.lib.lane_planner import LanePlanner, TRAJECTORY_SIZE from selfdrive.controls.lib.desire_helper import DesireHelper import cereal.messaging as messaging from cereal import log -from selfdrive.hardware import TICI +from system.hardware import TICI from common.params import Params @@ -51,6 +51,10 @@ class LateralPlanner: self.dp_lanelines_enable = sm['dragonConf'].dpLateralLanelines self.dp_camera_offset = sm['dragonConf'].dpLateralCameraOffset self.dp_path_offset = sm['dragonConf'].dpLateralPathOffset + if sm['controlsState'].dpLateralAltActive and sm['dragonConf'].dpLateralAltLanelines: + self.dp_lanelines_enable = True + self.dp_camera_offset = sm['dragonConf'].dpLateralAltCameraOffset + self.dp_path_offset = sm['dragonConf'].dpLateralAltPathOffset # Parse model predictions md = sm['modelV2'] @@ -67,7 +71,7 @@ class LateralPlanner: # Lane change logic lane_change_prob = self.LP.l_lane_change_prob + self.LP.r_lane_change_prob - self.DH.update(sm['carState'], sm['carControl'].latActive, lane_change_prob, sm['dragonConf']) + self.DH.update(sm['carState'], sm['carControl'].latActive, lane_change_prob, sm['dragonConf'], md) # Turn off lanes during lane change if self.DH.desire == log.LateralPlan.Desire.laneChangeRight or self.DH.desire == log.LateralPlan.Desire.laneChangeLeft: diff --git a/selfdrive/dragonpilot/controls_0816/lib/lateral_mpc_lib/acados_ocp_lat.json b/selfdrive/dragonpilot/controls_0816/lib/lateral_mpc_lib/acados_ocp_lat.json deleted file mode 100644 index f7b5bb7f8..000000000 --- a/selfdrive/dragonpilot/controls_0816/lib/lateral_mpc_lib/acados_ocp_lat.json +++ /dev/null @@ -1,450 +0,0 @@ -{ - "acados_include_path": "/data/openpilot/third_party/acados/include/acados/include", - "acados_lib_path": "/data/openpilot/third_party/acados/include/acados/lib", - "code_export_directory": "/data/openpilot/selfdrive/dragonpilot/controls_0816/lib/lateral_mpc_lib/c_generated_code", - "constraints": { - "C": [], - "C_e": [], - "D": [], - "constr_type": "BGH", - "constr_type_e": "BGH", - "idxbu": [], - "idxbx": [ - 2, - 3 - ], - "idxbx_0": [ - 0, - 1, - 2, - 3 - ], - "idxbx_e": [], - "idxbxe_0": [ - 0, - 1, - 2, - 3 - ], - "idxsbu": [], - "idxsbx": [], - "idxsbx_e": [], - "idxsg": [], - "idxsg_e": [], - "idxsh": [], - "idxsh_e": [], - "idxsphi": [], - "idxsphi_e": [], - "lbu": [], - "lbx": [ - -1.5707963267948966, - -0.8726646259971648 - ], - "lbx_0": [ - 0.0, - 0.0, - 0.0, - 0.0 - ], - "lbx_e": [], - "lg": [], - "lg_e": [], - "lh": [], - "lh_e": [], - "lphi": [], - "lphi_e": [], - "lsbu": [], - "lsbx": [], - "lsbx_e": [], - "lsg": [], - "lsg_e": [], - "lsh": [], - "lsh_e": [], - "lsphi": [], - "lsphi_e": [], - "ubu": [], - "ubx": [ - 1.5707963267948966, - 0.8726646259971648 - ], - "ubx_0": [ - 0.0, - 0.0, - 0.0, - 0.0 - ], - "ubx_e": [], - "ug": [], - "ug_e": [], - "uh": [], - "uh_e": [], - "uphi": [], - "uphi_e": [], - "usbu": [], - "usbx": [], - "usbx_e": [], - "usg": [], - "usg_e": [], - "ush": [], - "ush_e": [], - "usphi": [], - "usphi_e": [] - }, - "cost": { - "Vu": [ - [ - 0.0 - ], - [ - 0.0 - ], - [ - 0.0 - ] - ], - "Vu_0": [ - [ - 0.0 - ], - [ - 0.0 - ], - [ - 0.0 - ] - ], - "Vx": [ - [ - 0.0, - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0, - 0.0 - ] - ], - "Vx_0": [ - [ - 0.0, - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0, - 0.0 - ] - ], - "Vx_e": [ - [ - 0.0, - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0, - 0.0 - ] - ], - "Vz": [], - "Vz_0": [], - "W": [ - [ - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0 - ] - ], - "W_0": [ - [ - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0 - ] - ], - "W_e": [ - [ - 0.0, - 0.0 - ], - [ - 0.0, - 0.0 - ] - ], - "Zl": [], - "Zl_e": [], - "Zu": [], - "Zu_e": [], - "cost_ext_fun_type": "casadi", - "cost_ext_fun_type_0": "casadi", - "cost_ext_fun_type_e": "casadi", - "cost_type": "NONLINEAR_LS", - "cost_type_0": "NONLINEAR_LS", - "cost_type_e": "NONLINEAR_LS", - "yref": [ - 0.0, - 0.0, - 0.0 - ], - "yref_0": [ - 0.0, - 0.0, - 0.0 - ], - "yref_e": [ - 0.0, - 0.0 - ], - "zl": [], - "zl_e": [], - "zu": [], - "zu_e": [] - }, - "cython_include_dirs": "/data/data/com.termux/files/usr/lib/python3.8/site-packages/numpy/core/include", - "dims": { - "N": 16, - "nbu": 0, - "nbx": 2, - "nbx_0": 4, - "nbx_e": 0, - "nbxe_0": 4, - "ng": 0, - "ng_e": 0, - "nh": 0, - "nh_e": 0, - "np": 2, - "nphi": 0, - "nphi_e": 0, - "nr": 0, - "nr_e": 0, - "ns": 0, - "ns_e": 0, - "nsbu": 0, - "nsbx": 0, - "nsbx_e": 0, - "nsg": 0, - "nsg_e": 0, - "nsh": 0, - "nsh_e": 0, - "nsphi": 0, - "nsphi_e": 0, - "nu": 1, - "nx": 4, - "ny": 3, - "ny_0": 3, - "ny_e": 2, - "nz": 0 - }, - "model": { - "dyn_disc_fun": null, - "dyn_disc_fun_jac": null, - "dyn_disc_fun_jac_hess": null, - "dyn_ext_fun_type": "casadi", - "dyn_source_discrete": null, - "gnsf": { - "nontrivial_f_LO": 1, - "purely_linear": 0 - }, - "name": "lat" - }, - "parameter_values": [ - 0.0, - 0.0 - ], - "problem_class": "OCP", - "simulink_opts": { - "inputs": { - "cost_W": 0, - "cost_W_0": 0, - "cost_W_e": 0, - "lbu": 1, - "lbx": 1, - "lbx_0": 1, - "lbx_e": 1, - "lg": 1, - "lh": 1, - "parameter_traj": 1, - "reset_solver": 0, - "u_init": 0, - "ubu": 1, - "ubx": 1, - "ubx_0": 1, - "ubx_e": 1, - "ug": 1, - "uh": 1, - "x_init": 0, - "y_ref": 1, - "y_ref_0": 1, - "y_ref_e": 1 - }, - "outputs": { - "CPU_time": 1, - "CPU_time_lin": 0, - "CPU_time_qp": 0, - "CPU_time_sim": 0, - "KKT_residual": 1, - "solver_status": 1, - "sqp_iter": 1, - "u0": 1, - "utraj": 0, - "x1": 1, - "xtraj": 0 - }, - "samplingtime": "t0" - }, - "solver_options": { - "Tsim": 0.009765625, - "alpha_min": 0.05, - "alpha_reduction": 0.7, - "collocation_type": "GAUSS_LEGENDRE", - "eps_sufficient_descent": 0.0001, - "exact_hess_constr": 1, - "exact_hess_cost": 1, - "exact_hess_dyn": 1, - "ext_cost_num_hess": 0, - "full_step_dual": 0, - "globalization": "FIXED_STEP", - "globalization_use_SOC": 0, - "hessian_approx": "GAUSS_NEWTON", - "hpipm_mode": "BALANCE", - "initialize_t_slacks": 0, - "integrator_type": "ERK", - "levenberg_marquardt": 0.0, - "line_search_use_sufficient_descent": 0, - "model_external_shared_lib_dir": null, - "model_external_shared_lib_name": null, - "nlp_solver_max_iter": 100, - "nlp_solver_step_length": 1.0, - "nlp_solver_tol_comp": 1e-06, - "nlp_solver_tol_eq": 1e-06, - "nlp_solver_tol_ineq": 1e-06, - "nlp_solver_tol_stat": 1e-06, - "nlp_solver_type": "SQP_RTI", - "print_level": 0, - "qp_solver": "PARTIAL_CONDENSING_HPIPM", - "qp_solver_cond_N": 1, - "qp_solver_iter_max": 1, - "qp_solver_tol_comp": null, - "qp_solver_tol_eq": null, - "qp_solver_tol_ineq": null, - "qp_solver_tol_stat": null, - "qp_solver_warm_start": 0, - "regularize_method": null, - "sim_method_jac_reuse": [ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0 - ], - "sim_method_newton_iter": 3, - "sim_method_num_stages": [ - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4 - ], - "sim_method_num_steps": [ - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1 - ], - "tf": 2.5, - "time_steps": [ - 0.009765625, - 0.029296875, - 0.048828125, - 0.068359375, - 0.087890625, - 0.107421875, - 0.126953125, - 0.146484375, - 0.166015625, - 0.185546875, - 0.205078125, - 0.224609375, - 0.244140625, - 0.263671875, - 0.283203125, - 0.302734375 - ] - } -} \ No newline at end of file diff --git a/selfdrive/dragonpilot/controls_0816/lib/lateral_mpc_lib/c_generated_code/acados_ocp_solver_pyx.c b/selfdrive/dragonpilot/controls_0816/lib/lateral_mpc_lib/c_generated_code/acados_ocp_solver_pyx.c index d48df6dc3..688df9dd8 100644 --- a/selfdrive/dragonpilot/controls_0816/lib/lateral_mpc_lib/c_generated_code/acados_ocp_solver_pyx.c +++ b/selfdrive/dragonpilot/controls_0816/lib/lateral_mpc_lib/c_generated_code/acados_ocp_solver_pyx.c @@ -923,7 +923,7 @@ static const char *__pyx_filename; static const char *__pyx_f[] = { - "pyextra/acados_template/acados_ocp_solver_pyx.pyx", + "third_party/acados/acados_template/acados_ocp_solver_pyx.pyx", "stringsource", "__init__.pxd", "type.pxd", diff --git a/selfdrive/dragonpilot/controls_0816/lib/lateral_mpc_lib/c_generated_code/acados_ocp_solver_pyx.so b/selfdrive/dragonpilot/controls_0816/lib/lateral_mpc_lib/c_generated_code/acados_ocp_solver_pyx.so index adcae95d6..8ac56f8ab 100755 Binary files a/selfdrive/dragonpilot/controls_0816/lib/lateral_mpc_lib/c_generated_code/acados_ocp_solver_pyx.so and b/selfdrive/dragonpilot/controls_0816/lib/lateral_mpc_lib/c_generated_code/acados_ocp_solver_pyx.so differ diff --git a/selfdrive/dragonpilot/controls_0816/lib/lateral_mpc_lib/c_generated_code/acados_sim_solver_lat.c b/selfdrive/dragonpilot/controls_0816/lib/lateral_mpc_lib/c_generated_code/acados_sim_solver_lat.c deleted file mode 100644 index d0c541d3b..000000000 --- a/selfdrive/dragonpilot/controls_0816/lib/lateral_mpc_lib/c_generated_code/acados_sim_solver_lat.c +++ /dev/null @@ -1,278 +0,0 @@ -/* - * Copyright 2019 Gianluca Frison, Dimitris Kouzoupis, Robin Verschueren, - * Andrea Zanelli, Niels van Duijkeren, Jonathan Frey, Tommaso Sartor, - * Branimir Novoselnik, Rien Quirynen, Rezart Qelibari, Dang Doan, - * Jonas Koenemann, Yutao Chen, Tobias Schöls, Jonas Schlagenhauf, Moritz Diehl - * - * This file is part of acados. - * - * The 2-Clause BSD License - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE.; - */ -// standard -#include -#include - -// acados -#include "acados_c/external_function_interface.h" -#include "acados_c/sim_interface.h" -#include "acados_c/external_function_interface.h" - -#include "acados/sim/sim_common.h" -#include "acados/utils/external_function_generic.h" -#include "acados/utils/print.h" - - -// example specific -#include "lat_model/lat_model.h" -#include "acados_sim_solver_lat.h" - - -// ** solver data ** - -sim_solver_capsule * lat_acados_sim_solver_create_capsule() -{ - void* capsule_mem = malloc(sizeof(sim_solver_capsule)); - sim_solver_capsule *capsule = (sim_solver_capsule *) capsule_mem; - - return capsule; -} - - -int lat_acados_sim_solver_free_capsule(sim_solver_capsule * capsule) -{ - free(capsule); - return 0; -} - - -int lat_acados_sim_create(sim_solver_capsule * capsule) -{ - // initialize - const int nx = LAT_NX; - const int nu = LAT_NU; - const int nz = LAT_NZ; - const int np = LAT_NP; - bool tmp_bool; - - - double Tsim = 0.009765625; - - - // explicit ode - capsule->sim_forw_vde_casadi = (external_function_param_casadi *) malloc(sizeof(external_function_param_casadi)); - capsule->sim_expl_ode_fun_casadi = (external_function_param_casadi *) malloc(sizeof(external_function_param_casadi)); - - capsule->sim_forw_vde_casadi->casadi_fun = &lat_expl_vde_forw; - capsule->sim_forw_vde_casadi->casadi_n_in = &lat_expl_vde_forw_n_in; - capsule->sim_forw_vde_casadi->casadi_n_out = &lat_expl_vde_forw_n_out; - capsule->sim_forw_vde_casadi->casadi_sparsity_in = &lat_expl_vde_forw_sparsity_in; - capsule->sim_forw_vde_casadi->casadi_sparsity_out = &lat_expl_vde_forw_sparsity_out; - capsule->sim_forw_vde_casadi->casadi_work = &lat_expl_vde_forw_work; - external_function_param_casadi_create(capsule->sim_forw_vde_casadi, np); - - capsule->sim_expl_ode_fun_casadi->casadi_fun = &lat_expl_ode_fun; - capsule->sim_expl_ode_fun_casadi->casadi_n_in = &lat_expl_ode_fun_n_in; - capsule->sim_expl_ode_fun_casadi->casadi_n_out = &lat_expl_ode_fun_n_out; - capsule->sim_expl_ode_fun_casadi->casadi_sparsity_in = &lat_expl_ode_fun_sparsity_in; - capsule->sim_expl_ode_fun_casadi->casadi_sparsity_out = &lat_expl_ode_fun_sparsity_out; - capsule->sim_expl_ode_fun_casadi->casadi_work = &lat_expl_ode_fun_work; - external_function_param_casadi_create(capsule->sim_expl_ode_fun_casadi, np); - - - - // sim plan & config - sim_solver_plan_t plan; - plan.sim_solver = ERK; - - // create correct config based on plan - sim_config * lat_sim_config = sim_config_create(plan); - capsule->acados_sim_config = lat_sim_config; - - // sim dims - void *lat_sim_dims = sim_dims_create(lat_sim_config); - capsule->acados_sim_dims = lat_sim_dims; - sim_dims_set(lat_sim_config, lat_sim_dims, "nx", &nx); - sim_dims_set(lat_sim_config, lat_sim_dims, "nu", &nu); - sim_dims_set(lat_sim_config, lat_sim_dims, "nz", &nz); - - - // sim opts - sim_opts *lat_sim_opts = sim_opts_create(lat_sim_config, lat_sim_dims); - capsule->acados_sim_opts = lat_sim_opts; - int tmp_int = 3; - sim_opts_set(lat_sim_config, lat_sim_opts, "newton_iter", &tmp_int); - sim_collocation_type collocation_type = GAUSS_LEGENDRE; - sim_opts_set(lat_sim_config, lat_sim_opts, "collocation_type", &collocation_type); - - - tmp_int = 4; - sim_opts_set(lat_sim_config, lat_sim_opts, "num_stages", &tmp_int); - tmp_int = 1; - sim_opts_set(lat_sim_config, lat_sim_opts, "num_steps", &tmp_int); - tmp_bool = 0; - sim_opts_set(lat_sim_config, lat_sim_opts, "jac_reuse", &tmp_bool); - - - // sim in / out - sim_in *lat_sim_in = sim_in_create(lat_sim_config, lat_sim_dims); - capsule->acados_sim_in = lat_sim_in; - sim_out *lat_sim_out = sim_out_create(lat_sim_config, lat_sim_dims); - capsule->acados_sim_out = lat_sim_out; - - sim_in_set(lat_sim_config, lat_sim_dims, - lat_sim_in, "T", &Tsim); - - // model functions - lat_sim_config->model_set(lat_sim_in->model, - "expl_vde_for", capsule->sim_forw_vde_casadi); - lat_sim_config->model_set(lat_sim_in->model, - "expl_ode_fun", capsule->sim_expl_ode_fun_casadi); - - // sim solver - sim_solver *lat_sim_solver = sim_solver_create(lat_sim_config, - lat_sim_dims, lat_sim_opts); - capsule->acados_sim_solver = lat_sim_solver; - - - /* initialize parameter values */ - double* p = calloc(np, sizeof(double)); - - - lat_acados_sim_update_params(capsule, p, np); - free(p); - - - /* initialize input */ - // x - double x0[4]; - for (int ii = 0; ii < 4; ii++) - x0[ii] = 0.0; - - sim_in_set(lat_sim_config, lat_sim_dims, - lat_sim_in, "x", x0); - - - // u - double u0[1]; - for (int ii = 0; ii < 1; ii++) - u0[ii] = 0.0; - - sim_in_set(lat_sim_config, lat_sim_dims, - lat_sim_in, "u", u0); - - // S_forw - double S_forw[20]; - for (int ii = 0; ii < 20; ii++) - S_forw[ii] = 0.0; - for (int ii = 0; ii < 4; ii++) - S_forw[ii + ii * 4 ] = 1.0; - - - sim_in_set(lat_sim_config, lat_sim_dims, - lat_sim_in, "S_forw", S_forw); - - int status = sim_precompute(lat_sim_solver, lat_sim_in, lat_sim_out); - - return status; -} - - -int lat_acados_sim_solve(sim_solver_capsule *capsule) -{ - // integrate dynamics using acados sim_solver - int status = sim_solve(capsule->acados_sim_solver, - capsule->acados_sim_in, capsule->acados_sim_out); - if (status != 0) - printf("error in lat_acados_sim_solve()! Exiting.\n"); - - return status; -} - - -int lat_acados_sim_free(sim_solver_capsule *capsule) -{ - // free memory - sim_solver_destroy(capsule->acados_sim_solver); - sim_in_destroy(capsule->acados_sim_in); - sim_out_destroy(capsule->acados_sim_out); - sim_opts_destroy(capsule->acados_sim_opts); - sim_dims_destroy(capsule->acados_sim_dims); - sim_config_destroy(capsule->acados_sim_config); - - // free external function - external_function_param_casadi_free(capsule->sim_forw_vde_casadi); - external_function_param_casadi_free(capsule->sim_expl_ode_fun_casadi); - - return 0; -} - - -int lat_acados_sim_update_params(sim_solver_capsule *capsule, double *p, int np) -{ - int status = 0; - int casadi_np = LAT_NP; - - if (casadi_np != np) { - printf("lat_acados_sim_update_params: trying to set %i parameters for external functions." - " External function has %i parameters. Exiting.\n", np, casadi_np); - exit(1); - } - capsule->sim_forw_vde_casadi[0].set_param(capsule->sim_forw_vde_casadi, p); - capsule->sim_expl_ode_fun_casadi[0].set_param(capsule->sim_expl_ode_fun_casadi, p); - - return status; -} - -/* getters pointers to C objects*/ -sim_config * lat_acados_get_sim_config(sim_solver_capsule *capsule) -{ - return capsule->acados_sim_config; -}; - -sim_in * lat_acados_get_sim_in(sim_solver_capsule *capsule) -{ - return capsule->acados_sim_in; -}; - -sim_out * lat_acados_get_sim_out(sim_solver_capsule *capsule) -{ - return capsule->acados_sim_out; -}; - -void * lat_acados_get_sim_dims(sim_solver_capsule *capsule) -{ - return capsule->acados_sim_dims; -}; - -sim_opts * lat_acados_get_sim_opts(sim_solver_capsule *capsule) -{ - return capsule->acados_sim_opts; -}; - -sim_solver * lat_acados_get_sim_solver(sim_solver_capsule *capsule) -{ - return capsule->acados_sim_solver; -}; - diff --git a/selfdrive/dragonpilot/controls_0816/lib/lateral_mpc_lib/c_generated_code/acados_sim_solver_lat.h b/selfdrive/dragonpilot/controls_0816/lib/lateral_mpc_lib/c_generated_code/acados_sim_solver_lat.h deleted file mode 100644 index 86b9c84c9..000000000 --- a/selfdrive/dragonpilot/controls_0816/lib/lateral_mpc_lib/c_generated_code/acados_sim_solver_lat.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright 2019 Gianluca Frison, Dimitris Kouzoupis, Robin Verschueren, - * Andrea Zanelli, Niels van Duijkeren, Jonathan Frey, Tommaso Sartor, - * Branimir Novoselnik, Rien Quirynen, Rezart Qelibari, Dang Doan, - * Jonas Koenemann, Yutao Chen, Tobias Schöls, Jonas Schlagenhauf, Moritz Diehl - * - * This file is part of acados. - * - * The 2-Clause BSD License - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE.; - */ - -#ifndef ACADOS_SIM_lat_H_ -#define ACADOS_SIM_lat_H_ - -#include "acados_c/sim_interface.h" -#include "acados_c/external_function_interface.h" - -#define LAT_NX 4 -#define LAT_NZ 0 -#define LAT_NU 1 -#define LAT_NP 2 - -#ifdef __cplusplus -extern "C" { -#endif - - -// ** capsule for solver data ** -typedef struct sim_solver_capsule -{ - // acados objects - sim_in *acados_sim_in; - sim_out *acados_sim_out; - sim_solver *acados_sim_solver; - sim_opts *acados_sim_opts; - sim_config *acados_sim_config; - void *acados_sim_dims; - - /* external functions */ - // ERK - external_function_param_casadi * sim_forw_vde_casadi; - external_function_param_casadi * sim_expl_ode_fun_casadi; - external_function_param_casadi * sim_expl_ode_hess; - - // IRK - external_function_param_casadi * sim_impl_dae_fun; - external_function_param_casadi * sim_impl_dae_fun_jac_x_xdot_z; - external_function_param_casadi * sim_impl_dae_jac_x_xdot_u_z; - external_function_param_casadi * sim_impl_dae_hess; - - // GNSF - external_function_param_casadi * sim_gnsf_phi_fun; - external_function_param_casadi * sim_gnsf_phi_fun_jac_y; - external_function_param_casadi * sim_gnsf_phi_jac_y_uhat; - external_function_param_casadi * sim_gnsf_f_lo_jac_x1_x1dot_u_z; - external_function_param_casadi * sim_gnsf_get_matrices_fun; - -} sim_solver_capsule; - - -ACADOS_SYMBOL_EXPORT int lat_acados_sim_create(sim_solver_capsule *capsule); -ACADOS_SYMBOL_EXPORT int lat_acados_sim_solve(sim_solver_capsule *capsule); -ACADOS_SYMBOL_EXPORT int lat_acados_sim_free(sim_solver_capsule *capsule); -ACADOS_SYMBOL_EXPORT int lat_acados_sim_update_params(sim_solver_capsule *capsule, double *value, int np); - -ACADOS_SYMBOL_EXPORT sim_config * lat_acados_get_sim_config(sim_solver_capsule *capsule); -ACADOS_SYMBOL_EXPORT sim_in * lat_acados_get_sim_in(sim_solver_capsule *capsule); -ACADOS_SYMBOL_EXPORT sim_out * lat_acados_get_sim_out(sim_solver_capsule *capsule); -ACADOS_SYMBOL_EXPORT void * lat_acados_get_sim_dims(sim_solver_capsule *capsule); -ACADOS_SYMBOL_EXPORT sim_opts * lat_acados_get_sim_opts(sim_solver_capsule *capsule); -ACADOS_SYMBOL_EXPORT sim_solver * lat_acados_get_sim_solver(sim_solver_capsule *capsule); - - -ACADOS_SYMBOL_EXPORT sim_solver_capsule * lat_acados_sim_solver_create_capsule(void); -ACADOS_SYMBOL_EXPORT int lat_acados_sim_solver_free_capsule(sim_solver_capsule *capsule); - -#ifdef __cplusplus -} -#endif - -#endif // ACADOS_SIM_lat_H_ diff --git a/selfdrive/dragonpilot/controls_0816/lib/lateral_mpc_lib/c_generated_code/acados_solver_sfunction_lat.c b/selfdrive/dragonpilot/controls_0816/lib/lateral_mpc_lib/c_generated_code/acados_solver_sfunction_lat.c deleted file mode 100644 index 827b6c7f0..000000000 --- a/selfdrive/dragonpilot/controls_0816/lib/lateral_mpc_lib/c_generated_code/acados_solver_sfunction_lat.c +++ /dev/null @@ -1,264 +0,0 @@ -/* - * Copyright 2019 Gianluca Frison, Dimitris Kouzoupis, Robin Verschueren, - * Andrea Zanelli, Niels van Duijkeren, Jonathan Frey, Tommaso Sartor, - * Branimir Novoselnik, Rien Quirynen, Rezart Qelibari, Dang Doan, - * Jonas Koenemann, Yutao Chen, Tobias Schöls, Jonas Schlagenhauf, Moritz Diehl - * - * This file is part of acados. - * - * The 2-Clause BSD License - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE.; - */ - -#define S_FUNCTION_NAME acados_solver_sfunction_lat -#define S_FUNCTION_LEVEL 2 - -#define MDL_START - -// acados -// #include "acados/utils/print.h" -#include "acados_c/sim_interface.h" -#include "acados_c/external_function_interface.h" - -// example specific -#include "lat_model/lat_model.h" -#include "acados_solver_lat.h" - -#include "simstruc.h" - -#define SAMPLINGTIME 0.009765625 - -static void mdlInitializeSizes (SimStruct *S) -{ - // specify the number of continuous and discrete states - ssSetNumContStates(S, 0); - ssSetNumDiscStates(S, 0);// specify the number of input ports - if ( !ssSetNumInputPorts(S, 8) ) - return; - - // specify the number of output ports - if ( !ssSetNumOutputPorts(S, 6) ) - return; - - // specify dimension information for the input ports - // lbx_0 - ssSetInputPortVectorDimension(S, 0, 4); - // ubx_0 - ssSetInputPortVectorDimension(S, 1, 4); - // parameters - ssSetInputPortVectorDimension(S, 2, (16+1) * 2); - // y_ref_0 - ssSetInputPortVectorDimension(S, 3, 3); - // y_ref - ssSetInputPortVectorDimension(S, 4, 45); - // y_ref_e - ssSetInputPortVectorDimension(S, 5, 2); - // lbx - ssSetInputPortVectorDimension(S, 6, 30); - // ubx - ssSetInputPortVectorDimension(S, 7, 30);/* specify dimension information for the OUTPUT ports */ - ssSetOutputPortVectorDimension(S, 0, 1 ); - ssSetOutputPortVectorDimension(S, 1, 1 ); - ssSetOutputPortVectorDimension(S, 2, 1 ); - ssSetOutputPortVectorDimension(S, 3, 4 ); // state at shooting node 1 - ssSetOutputPortVectorDimension(S, 4, 1); - ssSetOutputPortVectorDimension(S, 5, 1 ); - - // specify the direct feedthrough status - // should be set to 1 for all inputs used in mdlOutputs - ssSetInputPortDirectFeedThrough(S, 0, 1); - ssSetInputPortDirectFeedThrough(S, 1, 1); - ssSetInputPortDirectFeedThrough(S, 2, 1); - ssSetInputPortDirectFeedThrough(S, 3, 1); - ssSetInputPortDirectFeedThrough(S, 4, 1); - ssSetInputPortDirectFeedThrough(S, 5, 1); - ssSetInputPortDirectFeedThrough(S, 6, 1); - ssSetInputPortDirectFeedThrough(S, 7, 1); - - // one sample time - ssSetNumSampleTimes(S, 1); -} - - -#if defined(MATLAB_MEX_FILE) - -#define MDL_SET_INPUT_PORT_DIMENSION_INFO -#define MDL_SET_OUTPUT_PORT_DIMENSION_INFO - -static void mdlSetInputPortDimensionInfo(SimStruct *S, int_T port, const DimsInfo_T *dimsInfo) -{ - if ( !ssSetInputPortDimensionInfo(S, port, dimsInfo) ) - return; -} - -static void mdlSetOutputPortDimensionInfo(SimStruct *S, int_T port, const DimsInfo_T *dimsInfo) -{ - if ( !ssSetOutputPortDimensionInfo(S, port, dimsInfo) ) - return; -} - -#endif /* MATLAB_MEX_FILE */ - - -static void mdlInitializeSampleTimes(SimStruct *S) -{ - ssSetSampleTime(S, 0, SAMPLINGTIME); - ssSetOffsetTime(S, 0, 0.0); -} - - -static void mdlStart(SimStruct *S) -{ - lat_solver_capsule *capsule = lat_acados_create_capsule(); - lat_acados_create(capsule); - - ssSetUserData(S, (void*)capsule); -} - - -static void mdlOutputs(SimStruct *S, int_T tid) -{ - lat_solver_capsule *capsule = ssGetUserData(S); - ocp_nlp_config *nlp_config = lat_acados_get_nlp_config(capsule); - ocp_nlp_dims *nlp_dims = lat_acados_get_nlp_dims(capsule); - ocp_nlp_in *nlp_in = lat_acados_get_nlp_in(capsule); - ocp_nlp_out *nlp_out = lat_acados_get_nlp_out(capsule); - - InputRealPtrsType in_sign; - - // local buffer - real_t buffer[4]; - - /* go through inputs */ - // lbx_0 - in_sign = ssGetInputPortRealSignalPtrs(S, 0); - for (int i = 0; i < 4; i++) - buffer[i] = (double)(*in_sign[i]); - - ocp_nlp_constraints_model_set(nlp_config, nlp_dims, nlp_in, 0, "lbx", buffer); - // ubx_0 - in_sign = ssGetInputPortRealSignalPtrs(S, 1); - for (int i = 0; i < 4; i++) - buffer[i] = (double)(*in_sign[i]); - ocp_nlp_constraints_model_set(nlp_config, nlp_dims, nlp_in, 0, "ubx", buffer); - // parameters - stage-variant !!! - in_sign = ssGetInputPortRealSignalPtrs(S, 2); - - // update value of parameters - for (int ii = 0; ii <= 16; ii++) - { - for (int jj = 0; jj < 2; jj++) - buffer[jj] = (double)(*in_sign[ii*2+jj]); - lat_acados_update_params(capsule, ii, buffer, 2); - } - - - // y_ref_0 - in_sign = ssGetInputPortRealSignalPtrs(S, 3); - - for (int i = 0; i < 3; i++) - buffer[i] = (double)(*in_sign[i]); - - ocp_nlp_cost_model_set(nlp_config, nlp_dims, nlp_in, 0, "yref", (void *) buffer); - - - // y_ref - for stages 1 to N-1 - in_sign = ssGetInputPortRealSignalPtrs(S, 4); - - for (int ii = 1; ii < 16; ii++) - { - for (int jj = 0; jj < 3; jj++) - buffer[jj] = (double)(*in_sign[(ii-1)*3+jj]); - ocp_nlp_cost_model_set(nlp_config, nlp_dims, nlp_in, ii, "yref", (void *) buffer); - } - - - // y_ref_e - in_sign = ssGetInputPortRealSignalPtrs(S, 5); - - for (int i = 0; i < 2; i++) - buffer[i] = (double)(*in_sign[i]); - - ocp_nlp_cost_model_set(nlp_config, nlp_dims, nlp_in, 16, "yref", (void *) buffer); - // lbx - in_sign = ssGetInputPortRealSignalPtrs(S, 6); - for (int ii = 1; ii < 16; ii++) - { - for (int jj = 0; jj < 2; jj++) - buffer[jj] = (double)(*in_sign[(ii-1)*2+jj]); - ocp_nlp_constraints_model_set(nlp_config, nlp_dims, nlp_in, ii, "lbx", (void *) buffer); - } - // ubx - in_sign = ssGetInputPortRealSignalPtrs(S, 7); - for (int ii = 1; ii < 16; ii++) - { - for (int jj = 0; jj < 2; jj++) - buffer[jj] = (double)(*in_sign[(ii-1)*2+jj]); - ocp_nlp_constraints_model_set(nlp_config, nlp_dims, nlp_in, ii, "ubx", (void *) buffer); - } - - /* call solver */ - int rti_phase = 0; - ocp_nlp_solver_opts_set(nlp_config, capsule->nlp_opts, "rti_phase", &rti_phase); - int acados_status = lat_acados_solve(capsule); - - - /* set outputs */ - // assign pointers to output signals - real_t *out_u0, *out_utraj, *out_xtraj, *out_status, *out_sqp_iter, *out_KKT_res, *out_x1, *out_cpu_time, *out_cpu_time_sim, *out_cpu_time_qp, *out_cpu_time_lin; - int tmp_int; - out_u0 = ssGetOutputPortRealSignal(S, 0); - ocp_nlp_out_get(nlp_config, nlp_dims, nlp_out, 0, "u", (void *) out_u0); - - - out_status = ssGetOutputPortRealSignal(S, 1); - *out_status = (real_t) acados_status; - out_KKT_res = ssGetOutputPortRealSignal(S, 2); - *out_KKT_res = (real_t) nlp_out->inf_norm_res; - out_x1 = ssGetOutputPortRealSignal(S, 3); - ocp_nlp_out_get(nlp_config, nlp_dims, nlp_out, 1, "x", (void *) out_x1); - out_cpu_time = ssGetOutputPortRealSignal(S, 4); - // get solution time - ocp_nlp_get(nlp_config, capsule->nlp_solver, "time_tot", (void *) out_cpu_time); - out_sqp_iter = ssGetOutputPortRealSignal(S, 5); - // get sqp iter - ocp_nlp_get(nlp_config, capsule->nlp_solver, "sqp_iter", (void *) &tmp_int); - *out_sqp_iter = (real_t) tmp_int; - -} - -static void mdlTerminate(SimStruct *S) -{ - lat_solver_capsule *capsule = ssGetUserData(S); - - lat_acados_free(capsule); - lat_acados_free_capsule(capsule); -} - - -#ifdef MATLAB_MEX_FILE -#include "simulink.c" -#else -#include "cg_sfun.h" -#endif diff --git a/selfdrive/dragonpilot/controls_0816/lib/lateral_mpc_lib/c_generated_code/main_sim_lat.c b/selfdrive/dragonpilot/controls_0816/lib/lateral_mpc_lib/c_generated_code/main_sim_lat.c deleted file mode 100644 index c536654fd..000000000 --- a/selfdrive/dragonpilot/controls_0816/lib/lateral_mpc_lib/c_generated_code/main_sim_lat.c +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright 2019 Gianluca Frison, Dimitris Kouzoupis, Robin Verschueren, - * Andrea Zanelli, Niels van Duijkeren, Jonathan Frey, Tommaso Sartor, - * Branimir Novoselnik, Rien Quirynen, Rezart Qelibari, Dang Doan, - * Jonas Koenemann, Yutao Chen, Tobias Schöls, Jonas Schlagenhauf, Moritz Diehl - * - * This file is part of acados. - * - * The 2-Clause BSD License - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE.; - */ - - -// standard -#include -#include -// acados -#include "acados/utils/print.h" -#include "acados/utils/math.h" -#include "acados_c/sim_interface.h" -#include "acados_sim_solver_lat.h" - -#define NX LAT_NX -#define NZ LAT_NZ -#define NU LAT_NU -#define NP LAT_NP - - -int main() -{ - int status = 0; - sim_solver_capsule *capsule = lat_acados_sim_solver_create_capsule(); - status = lat_acados_sim_create(capsule); - - if (status) - { - printf("acados_create() returned status %d. Exiting.\n", status); - exit(1); - } - - sim_config *acados_sim_config = lat_acados_get_sim_config(capsule); - sim_in *acados_sim_in = lat_acados_get_sim_in(capsule); - sim_out *acados_sim_out = lat_acados_get_sim_out(capsule); - void *acados_sim_dims = lat_acados_get_sim_dims(capsule); - - // initial condition - double x_current[NX]; - x_current[0] = 0.0; - x_current[1] = 0.0; - x_current[2] = 0.0; - x_current[3] = 0.0; - - - x_current[0] = 0; - x_current[1] = 0; - x_current[2] = 0; - x_current[3] = 0; - - - - - // initial value for control input - double u0[NU]; - u0[0] = 0.0; - // set parameters - double p[NP]; - p[0] = 0; - p[1] = 0; - - lat_acados_sim_update_params(capsule, p, NP); - - - int n_sim_steps = 3; - // solve ocp in loop - for (int ii = 0; ii < n_sim_steps; ii++) - { - sim_in_set(acados_sim_config, acados_sim_dims, - acados_sim_in, "x", x_current); - status = lat_acados_sim_solve(capsule); - - if (status != ACADOS_SUCCESS) - { - printf("acados_solve() failed with status %d.\n", status); - } - - sim_out_get(acados_sim_config, acados_sim_dims, - acados_sim_out, "x", x_current); - - printf("\nx_current, %d\n", ii); - for (int jj = 0; jj < NX; jj++) - { - printf("%e\n", x_current[jj]); - } - } - - printf("\nPerformed %d simulation steps with acados integrator successfully.\n\n", n_sim_steps); - - // free solver - status = lat_acados_sim_free(capsule); - if (status) { - printf("lat_acados_sim_free() returned status %d. \n", status); - } - - lat_acados_sim_solver_free_capsule(capsule); - - return status; -} diff --git a/selfdrive/dragonpilot/controls_0816/lib/lateral_mpc_lib/c_generated_code/make_sfun_lat.m b/selfdrive/dragonpilot/controls_0816/lib/lateral_mpc_lib/c_generated_code/make_sfun_lat.m deleted file mode 100644 index 2c6679ecb..000000000 --- a/selfdrive/dragonpilot/controls_0816/lib/lateral_mpc_lib/c_generated_code/make_sfun_lat.m +++ /dev/null @@ -1,125 +0,0 @@ -% -% Copyright 2019 Gianluca Frison, Dimitris Kouzoupis, Robin Verschueren, -% Andrea Zanelli, Niels van Duijkeren, Jonathan Frey, Tommaso Sartor, -% Branimir Novoselnik, Rien Quirynen, Rezart Qelibari, Dang Doan, -% Jonas Koenemann, Yutao Chen, Tobias Schöls, Jonas Schlagenhauf, Moritz Diehl -% -% This file is part of acados. -% -% The 2-Clause BSD License -% -% Redistribution and use in source and binary forms, with or without -% modification, are permitted provided that the following conditions are met: -% -% 1. Redistributions of source code must retain the above copyright notice, -% this list of conditions and the following disclaimer. -% -% 2. Redistributions in binary form must reproduce the above copyright notice, -% this list of conditions and the following disclaimer in the documentation -% and/or other materials provided with the distribution. -% -% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -% POSSIBILITY OF SUCH DAMAGE.; -% - -SOURCES = { ... - 'lat_model/lat_expl_ode_fun.c', ... - 'lat_model/lat_expl_vde_forw.c',... - 'lat_cost/lat_cost_y_0_fun.c',... - 'lat_cost/lat_cost_y_0_fun_jac_ut_xt.c',... - 'lat_cost/lat_cost_y_0_hess.c',... - 'lat_cost/lat_cost_y_fun.c',... - 'lat_cost/lat_cost_y_fun_jac_ut_xt.c',... - 'lat_cost/lat_cost_y_hess.c',... - 'lat_cost/lat_cost_y_e_fun.c',... - 'lat_cost/lat_cost_y_e_fun_jac_ut_xt.c',... - 'lat_cost/lat_cost_y_e_hess.c',... - 'acados_solver_sfunction_lat.c', ... - 'acados_solver_lat.c' - }; - -INC_PATH = '/data/openpilot/third_party/acados/include/acados/include'; - -INCS = {['-I', fullfile(INC_PATH, 'blasfeo', 'include')], ... - ['-I', fullfile(INC_PATH, 'hpipm', 'include')], ... - ['-I', fullfile(INC_PATH, 'acados')], ... - ['-I', fullfile(INC_PATH)]}; - - - -CFLAGS = 'CFLAGS=$CFLAGS'; -LDFLAGS = 'LDFLAGS=$LDFLAGS'; -COMPFLAGS = 'COMPFLAGS=$COMPFLAGS'; -COMPDEFINES = 'COMPDEFINES=$COMPDEFINES'; - - - -LIB_PATH = ['-L', fullfile('/data/openpilot/third_party/acados/include/acados/lib')]; - -LIBS = {'-lacados', '-lhpipm', '-lblasfeo'}; - -% acados linking libraries and flags - - -mex('-v', '-O', CFLAGS, LDFLAGS, COMPFLAGS, COMPDEFINES, INCS{:}, ... - LIB_PATH, LIBS{:}, SOURCES{:}, ... - '-output', 'acados_solver_sfunction_lat' ); - -fprintf( [ '\n\nSuccessfully created sfunction:\nacados_solver_sfunction_lat', '.', ... - eval('mexext')] ); - - -%% print note on usage of s-function -fprintf('\n\nNote: Usage of Sfunction is as follows:\n') -input_note = 'Inputs are:\n'; -i_in = 1; -input_note = strcat(input_note, num2str(i_in), ') lbx_0 - lower bound on x for stage 0,',... - ' size [4]\n '); -i_in = i_in + 1; -input_note = strcat(input_note, num2str(i_in), ') ubx_0 - upper bound on x for stage 0,',... - ' size [4]\n '); -i_in = i_in + 1; -input_note = strcat(input_note, num2str(i_in), ') parameters - concatenated for all shooting nodes 0 to N+1,',... - ' size [34]\n '); -i_in = i_in + 1; -input_note = strcat(input_note, num2str(i_in), ') y_ref_0, size [3]\n '); -i_in = i_in + 1; -input_note = strcat(input_note, num2str(i_in), ') y_ref - concatenated for shooting nodes 1 to N-1,',... - ' size [45]\n '); -i_in = i_in + 1; -input_note = strcat(input_note, num2str(i_in), ') y_ref_e, size [2]\n '); -i_in = i_in + 1; -input_note = strcat(input_note, num2str(i_in), ') lbx for shooting nodes 1 to N-1, size [30]\n '); -i_in = i_in + 1; -input_note = strcat(input_note, num2str(i_in), ') ubx for shooting nodes 1 to N-1, size [30]\n '); -i_in = i_in + 1; - -fprintf(input_note) - -disp(' ') - -output_note = 'Outputs are:\n'; -i_out = 0; -i_out = i_out + 1; -output_note = strcat(output_note, num2str(i_out), ') u0, control input at node 0, size [1]\n '); -i_out = i_out + 1; -output_note = strcat(output_note, num2str(i_out), ') acados solver status (0 = SUCCESS)\n '); -i_out = i_out + 1; -output_note = strcat(output_note, num2str(i_out), ') KKT residual\n '); -i_out = i_out + 1; -output_note = strcat(output_note, num2str(i_out), ') x1, state at node 1\n '); -i_out = i_out + 1; -output_note = strcat(output_note, num2str(i_out), ') CPU time\n '); -i_out = i_out + 1; -output_note = strcat(output_note, num2str(i_out), ') SQP iterations\n '); - -fprintf(output_note) diff --git a/selfdrive/dragonpilot/controls_0816/lib/lateral_mpc_lib/lat_mpc.py b/selfdrive/dragonpilot/controls_0816/lib/lateral_mpc_lib/lat_mpc.py index ba8d78ae2..b674a29ff 100755 --- a/selfdrive/dragonpilot/controls_0816/lib/lateral_mpc_lib/lat_mpc.py +++ b/selfdrive/dragonpilot/controls_0816/lib/lateral_mpc_lib/lat_mpc.py @@ -9,7 +9,7 @@ from selfdrive.controls.lib.drive_helpers import LAT_MPC_N as N from selfdrive.modeld.constants import T_IDXS if __name__ == '__main__': # generating code - from pyextra.acados_template import AcadosModel, AcadosOcp, AcadosOcpSolver + from third_party.acados.acados_template import AcadosModel, AcadosOcp, AcadosOcpSolver else: from selfdrive.dragonpilot.controls_0816.lib.lateral_mpc_lib.c_generated_code.acados_ocp_solver_pyx import AcadosOcpSolverCython # pylint: disable=no-name-in-module, import-error diff --git a/selfdrive/dragonpilot/controls_0816/lib/lateral_planner.py b/selfdrive/dragonpilot/controls_0816/lib/lateral_planner.py index ce3137700..42dabf305 100644 --- a/selfdrive/dragonpilot/controls_0816/lib/lateral_planner.py +++ b/selfdrive/dragonpilot/controls_0816/lib/lateral_planner.py @@ -8,7 +8,7 @@ from selfdrive.controls.lib.lane_planner import LanePlanner, TRAJECTORY_SIZE from selfdrive.controls.lib.desire_helper import DesireHelper import cereal.messaging as messaging from cereal import log -from selfdrive.hardware import TICI +from system.hardware import TICI from common.params import Params @@ -50,6 +50,10 @@ class LateralPlanner: self.dp_lanelines_enable = sm['dragonConf'].dpLateralLanelines self.dp_camera_offset = sm['dragonConf'].dpLateralCameraOffset self.dp_path_offset = sm['dragonConf'].dpLateralPathOffset + if sm['controlsState'].dpLateralAltActive and sm['dragonConf'].dpLateralAltLanelines: + self.dp_lanelines_enable = True + self.dp_camera_offset = sm['dragonConf'].dpLateralAltCameraOffset + self.dp_path_offset = sm['dragonConf'].dpLateralAltPathOffset # Parse model predictions md = sm['modelV2'] @@ -64,7 +68,7 @@ class LateralPlanner: # Lane change logic lane_change_prob = self.LP.l_lane_change_prob + self.LP.r_lane_change_prob - self.DH.update(sm['carState'], sm['carControl'].latActive, lane_change_prob, sm['dragonConf']) + self.DH.update(sm['carState'], sm['carControl'].latActive, lane_change_prob, sm['dragonConf'], md) # Turn off lanes during lane change if self.DH.desire == log.LateralPlan.Desire.laneChangeRight or self.DH.desire == log.LateralPlan.Desire.laneChangeLeft: diff --git a/selfdrive/locationd/.gitignore b/selfdrive/locationd/.gitignore index 526890278..11b9f127b 100644 --- a/selfdrive/locationd/.gitignore +++ b/selfdrive/locationd/.gitignore @@ -1,5 +1,3 @@ -ubloxd -ubloxd_test params_learner paramsd locationd diff --git a/selfdrive/locationd/laikad.py b/selfdrive/locationd/laikad.py index 63920101c..bca03f75d 100755 --- a/selfdrive/locationd/laikad.py +++ b/selfdrive/locationd/laikad.py @@ -3,6 +3,7 @@ import json import math import os import time +import shutil from collections import defaultdict from concurrent.futures import Future, ProcessPoolExecutor from datetime import datetime @@ -16,30 +17,30 @@ from common.params import Params, put_nonblocking from laika import AstroDog from laika.constants import SECS_IN_HR, SECS_IN_MIN from laika.downloader import DownloadFailed -from laika.ephemeris import Ephemeris, EphemerisType, convert_ublox_ephem, parse_qcom_ephem +from laika.ephemeris import Ephemeris, EphemerisType, convert_ublox_gps_ephem, convert_ublox_glonass_ephem, parse_qcom_ephem from laika.gps_time import GPSTime from laika.helpers import ConstellationId from laika.raw_gnss import GNSSMeasurement, correct_measurements, process_measurements, read_raw_ublox, read_raw_qcom -from selfdrive.locationd.laikad_helpers import calc_pos_fix_gauss_newton, get_posfix_sympy_fun +from laika.opt import calc_pos_fix, get_posfix_sympy_fun, calc_vel_fix, get_velfix_sympy_func from selfdrive.locationd.models.constants import GENERATED_DIR, ObservationKind from selfdrive.locationd.models.gnss_kf import GNSSKalman from selfdrive.locationd.models.gnss_kf import States as GStates from system.swaglog import cloudlog MAX_TIME_GAP = 10 -EPHEMERIS_CACHE = 'LaikadEphemeris' +EPHEMERIS_CACHE = 'LaikadEphemerisV2' DOWNLOADS_CACHE_FOLDER = "/tmp/comma_download_cache/" -CACHE_VERSION = 0.1 +CACHE_VERSION = 0.2 POS_FIX_RESIDUAL_THRESHOLD = 100.0 class Laikad: - def __init__(self, valid_const=("GPS", "GLONASS"), auto_fetch_orbits=True, auto_update=False, - valid_ephem_types=(EphemerisType.ULTRA_RAPID_ORBIT, EphemerisType.NAV), + def __init__(self, valid_const=("GPS", "GLONASS"), auto_fetch_navs=True, auto_update=False, + valid_ephem_types=(EphemerisType.NAV,), save_ephemeris=False, use_qcom=False): """ valid_const: GNSS constellation which can be used - auto_fetch_orbits: If true fetch orbits from internet when needed + auto_fetch_navs: If true fetch navs from internet when needed auto_update: If true download AstroDog will download all files needed. This can be ephemeris or correction data like ionosphere. valid_ephem_types: Valid ephemeris types to be used by AstroDog save_ephemeris: If true saves and loads nav and orbit ephemeris to cache. @@ -47,20 +48,20 @@ class Laikad: self.astro_dog = AstroDog(valid_const=valid_const, auto_update=auto_update, valid_ephem_types=valid_ephem_types, clear_old_ephemeris=True, cache_dir=DOWNLOADS_CACHE_FOLDER) self.gnss_kf = GNSSKalman(GENERATED_DIR, cython=True, erratic_clock=use_qcom) - self.auto_fetch_orbits = auto_fetch_orbits + self.auto_fetch_navs = auto_fetch_navs self.orbit_fetch_executor: Optional[ProcessPoolExecutor] = None self.orbit_fetch_future: Optional[Future] = None - self.last_fetch_orbits_t = None + self.last_fetch_navs_t = None self.got_first_gnss_msg = False self.last_cached_t = None self.save_ephemeris = save_ephemeris self.load_cache() self.posfix_functions = {constellation: get_posfix_sympy_fun(constellation) for constellation in (ConstellationId.GPS, ConstellationId.GLONASS)} - self.last_pos_fix = [] - self.last_pos_residual = [] - self.last_pos_fix_t = None + self.velfix_function = get_velfix_sympy_func() + self.last_fix_pos = None + self.last_fix_t = None self.gps_week = None self.use_qcom = use_qcom @@ -74,38 +75,48 @@ class Laikad: try: cache = json.loads(cache, object_hook=deserialize_hook) - self.astro_dog.add_orbits(cache['orbits']) - self.astro_dog.add_navs(cache['nav']) - self.last_fetch_orbits_t = cache['last_fetch_orbits_t'] + if cache['version'] == CACHE_VERSION: + self.astro_dog.add_navs(cache['navs']) + self.last_fetch_navs_t = cache['last_fetch_navs_t'] + else: + cache['navs'] = {} except json.decoder.JSONDecodeError: cloudlog.exception("Error parsing cache") - timestamp = self.last_fetch_orbits_t.as_datetime() if self.last_fetch_orbits_t is not None else 'Nan' + timestamp = self.last_fetch_navs_t.as_datetime() if self.last_fetch_navs_t is not None else 'Nan' cloudlog.debug( - 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]}") + f"Loaded navs ({sum([len(v) for v in cache['navs']])}) cache with timestamp: {timestamp}. Unique orbit and nav sats: {list(cache['navs'].keys())} " + + f"With time range: {[f'{start.as_datetime()}, {end.as_datetime()}' for (start,end) in self.astro_dog.navs_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): put_nonblocking(EPHEMERIS_CACHE, json.dumps( - {'version': CACHE_VERSION, 'last_fetch_orbits_t': self.last_fetch_orbits_t, 'orbits': self.astro_dog.orbits, 'nav': self.astro_dog.nav}, + {'version': CACHE_VERSION, 'last_fetch_navs_t': self.last_fetch_navs_t, 'navs': self.astro_dog.navs}, cls=CacheSerializer)) cloudlog.debug("Cache saved") self.last_cached_t = t - def get_est_pos(self, t, processed_measurements): - 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: - 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 get_lsq_fix(self, t, measurements): + if self.last_fix_t is None or abs(self.last_fix_t - t) > 0: + min_measurements = 5 if any(p.constellation_id == ConstellationId.GLONASS for p in measurements) else 4 + position_solution, pr_residuals, pos_std = calc_pos_fix(measurements, self.posfix_functions, min_measurements=min_measurements) + if len(position_solution) < 3: + return None + position_estimate = position_solution[:3] + + position_std_residual = np.median(np.abs(pr_residuals)) + position_std = np.median(np.abs(pos_std))/10 + position_std = max(position_std_residual, position_std) * np.ones(3) + + velocity_solution, prr_residuals, vel_std = calc_vel_fix(measurements, position_estimate, self.velfix_function, min_measurements=min_measurements) + if len(velocity_solution) < 3: + return None + velocity_estimate = velocity_solution[:3] + + velocity_std_residual = np.median(np.abs(prr_residuals)) + velocity_std = np.median(np.abs(vel_std))/10 + velocity_std = max(velocity_std, velocity_std_residual) * np.ones(3) + + return position_estimate, position_std, velocity_estimate, velocity_std def is_good_report(self, gnss_msg): if gnss_msg.which() == 'drMeasurementReport' and self.use_qcom: @@ -134,70 +145,97 @@ class Laikad: if self.use_qcom: return gnss_msg.which() == 'drSvPoly' else: - return gnss_msg.which() == 'ephemeris' + return gnss_msg.which() in ('ephemeris', 'glonassEphemeris') def read_ephemeris(self, gnss_msg): - # TODO this only works on GLONASS if self.use_qcom: # TODO this is not robust to gps week rollover if self.gps_week is None: return ephem = parse_qcom_ephem(gnss_msg.drSvPoly, self.gps_week) else: - ephem = convert_ublox_ephem(gnss_msg.ephemeris) + if gnss_msg.which() == 'ephemeris': + ephem = convert_ublox_gps_ephem(gnss_msg.ephemeris) + elif gnss_msg.which() == 'glonassEphemeris': + ephem = convert_ublox_glonass_ephem(gnss_msg.glonassEphemeris) + else: + cloudlog.error(f"Unsupported ephemeris type: {gnss_msg.which()}") + return self.astro_dog.add_navs({ephem.prn: [ephem]}) self.cache_ephemeris(t=ephem.epoch) + def process_report(self, new_meas, t): + # Filter measurements with unexpected pseudoranges for GPS and GLONASS satellites + new_meas = [m for m in new_meas if 1e7 < m.observables['C1C'] < 3e7] + processed_measurements = process_measurements(new_meas, self.astro_dog) + if self.last_fix_pos is not None: + corrected_measurements = correct_measurements(processed_measurements, self.last_fix_pos, self.astro_dog) + instant_fix = self.get_lsq_fix(t, corrected_measurements) + #instant_fix = self.get_lsq_fix(t, processed_measurements) + else: + corrected_measurements = [] + instant_fix = self.get_lsq_fix(t, processed_measurements) + if instant_fix is None: + return None + else: + position_estimate, position_std, velocity_estimate, velocity_std = instant_fix + self.last_fix_t = t + self.last_fix_pos = position_estimate + self.lat_fix_pos_std = position_std + if (t*1e9) % 10 == 0: + cloudlog.debug(f"Measurements Incoming/Processed/Corrected: {len(new_meas), len(processed_measurements), len(corrected_measurements)}") + return position_estimate, position_std, velocity_estimate, velocity_std, corrected_measurements, processed_measurements + def process_gnss_msg(self, gnss_msg, gnss_mono_time: int, block=False): - if self.is_good_report(gnss_msg): + if self.is_ephemeris(gnss_msg): + self.read_ephemeris(gnss_msg) + return None + elif self.is_good_report(gnss_msg): + week, tow, new_meas = self.read_report(gnss_msg) self.gps_week = week + if len(new_meas) == 0: + return None t = gnss_mono_time * 1e-9 if week > 0: self.got_first_gnss_msg = True latest_msg_t = GPSTime(week, tow) - if self.auto_fetch_orbits: - self.fetch_orbits(latest_msg_t, block) + if self.auto_fetch_navs: + self.fetch_navs(latest_msg_t, block) - # Filter measurements with unexpected pseudoranges for GPS and GLONASS satellites - 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 gnss_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)) - ecef_pos = self.gnss_kf.x[GStates.ECEF_POS] - ecef_vel = self.gnss_kf.x[GStates.ECEF_VELOCITY] - - p = self.gnss_kf.P.diagonal() - pos_std = np.sqrt(p[GStates.ECEF_POS]) - vel_std = np.sqrt(p[GStates.ECEF_VELOCITY]) + output = self.process_report(new_meas, t) + if output is None: + return None + position_estimate, position_std, velocity_estimate, velocity_std, corrected_measurements, _ = output + self.update_localizer(position_estimate, t, corrected_measurements) meas_msgs = [create_measurement_msg(m) for m in corrected_measurements] - dat = messaging.new_message("gnssMeasurements") + msg = messaging.new_message("gnssMeasurements") measurement_msg = log.LiveLocationKalman.Measurement.new_message - dat.gnssMeasurements = { + + P_diag = self.gnss_kf.P.diagonal() + kf_valid = all(self.kf_valid(t)) + msg.gnssMeasurements = { "gpsWeek": week, "gpsTimeOfWeek": tow, - "positionECEF": measurement_msg(value=ecef_pos.tolist(), std=pos_std.tolist(), valid=kf_valid), - "velocityECEF": measurement_msg(value=ecef_vel.tolist(), std=vel_std.tolist(), valid=kf_valid), - # TODO std is incorrectly the dimension of the measurements and not 3D - "positionFixECEF": measurement_msg(value=self.last_pos_fix, std=self.last_pos_residual, valid=self.last_pos_fix_t == t), - "ubloxMonoTime": gnss_mono_time, + "kalmanPositionECEF": measurement_msg(value=self.gnss_kf.x[GStates.ECEF_POS].tolist(), + std=np.sqrt(P_diag[GStates.ECEF_POS]).tolist(), + valid=kf_valid), + "kalmanVelocityECEF": measurement_msg(value=self.gnss_kf.x[GStates.ECEF_VELOCITY].tolist(), + std=np.sqrt(P_diag[GStates.ECEF_VELOCITY]).tolist(), + valid=kf_valid), + "positionECEF": measurement_msg(value=position_estimate, std=position_std.tolist(), valid=bool(self.last_fix_t == t)), + "velocityECEF": measurement_msg(value=velocity_estimate, std=velocity_std.tolist(), valid=bool(self.last_fix_t == t)), + + "measTime": gnss_mono_time, "correctedMeasurements": meas_msgs } - return dat - elif self.is_ephemeris(gnss_msg): - self.read_ephemeris(gnss_msg) + return msg #elif gnss_msg.which() == 'ionoData': - # todo add this. Needed to better correct messages offline. First fix ublox_msg.cc to sent them. + # TODO: add this, Needed to better correct messages offline. First fix ublox_msg.cc to sent them. + def update_localizer(self, est_pos, t: float, measurements: List[GNSSMeasurement]): # Check time and outputs are valid @@ -232,9 +270,9 @@ class Laikad: p_initial_diag[GStates.ECEF_POS] = 1000 ** 2 self.gnss_kf.init_state(x_initial, covs_diag=p_initial_diag) - def fetch_orbits(self, t: GPSTime, block): - # Download new orbits if 1 hour of orbits data left - if t + SECS_IN_HR not in self.astro_dog.orbit_fetched_times and (self.last_fetch_orbits_t is None or abs(t - self.last_fetch_orbits_t) > SECS_IN_MIN): + def fetch_navs(self, t: GPSTime, block): + # Download new navs if 1 hour of navs data left + if t + SECS_IN_HR not in self.astro_dog.navs_fetched_times and (self.last_fetch_navs_t is None or abs(t - self.last_fetch_navs_t) > SECS_IN_MIN): astro_dog_vars = self.astro_dog.valid_const, self.astro_dog.auto_update, self.astro_dog.valid_ephem_types, self.astro_dog.cache_dir ret = None @@ -249,22 +287,22 @@ class Laikad: if ret is not None: if ret[0] is None: - self.last_fetch_orbits_t = ret[2] + self.last_fetch_navs_t = ret[2] else: - self.astro_dog.orbits, self.astro_dog.orbit_fetched_times, self.last_fetch_orbits_t = ret + self.astro_dog.navs, self.astro_dog.navs_fetched_times, self.last_fetch_navs_t = ret self.cache_ephemeris(t=t) def get_orbit_data(t: GPSTime, valid_const, auto_update, valid_ephem_types, cache_dir): astro_dog = AstroDog(valid_const=valid_const, auto_update=auto_update, valid_ephem_types=valid_ephem_types, cache_dir=cache_dir) - cloudlog.info(f"Start to download/parse orbits for time {t.as_datetime()}") + cloudlog.info(f"Start to download/parse navs for time {t.as_datetime()}") start_time = time.monotonic() 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())}" + + astro_dog.get_navs(t) + cloudlog.info(f"Done parsing navs. Took {time.monotonic() - start_time:.1f}s") + cloudlog.debug(f"Downloaded navs ({sum([len(v) for v in astro_dog.navs])}): {list(astro_dog.navs.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 + return astro_dog.navs, astro_dog.navs_fetched_times, t except (DownloadFailed, RuntimeError, ValueError, IOError) as e: cloudlog.warning(f"No orbit data found or parsing failure: {e}") return None, None, t @@ -349,9 +387,31 @@ class EphemerisSourceType(IntEnum): qcom = 3 -def main(sm=None, pm=None): +def process_msg(laikad, gnss_msg, mono_time, block=False): + # TODO: Understand and use remaining unknown constellations + if gnss_msg.which() == "drMeasurementReport": + if getattr(gnss_msg, gnss_msg.which()).source not in ['glonass', 'gps', 'beidou', 'sbas']: + return None + + if getattr(gnss_msg, gnss_msg.which()).gpsWeek > np.iinfo(np.int16).max: + # gpsWeek 65535 is received rarely from quectel, this cannot be + # passed to GnssMeasurements's gpsWeek (Int16) + return None + + return laikad.process_gnss_msg(gnss_msg, mono_time, block=block) + + +def clear_tmp_cache(): + if os.path.exists(DOWNLOADS_CACHE_FOLDER): + shutil.rmtree(DOWNLOADS_CACHE_FOLDER) + os.mkdir(DOWNLOADS_CACHE_FOLDER) + + +def main(sm=None, pm=None, qc=None): + #clear_tmp_cache() + use_qcom = not Params().get_bool("UbloxAvailable", block=True) - if use_qcom: + if use_qcom or (qc is not None and qc): raw_gnss_socket = "qcomGnss" else: raw_gnss_socket = "ubloxGnss" @@ -361,9 +421,14 @@ def main(sm=None, pm=None): if pm is None: pm = messaging.PubMaster(['gnssMeasurements']) + # disable until set as main gps source, to better analyze startup time + use_internet = False #"LAIKAD_NO_INTERNET" not in os.environ + replay = "REPLAY" in os.environ - use_internet = "LAIKAD_NO_INTERNET" not in os.environ - laikad = Laikad(save_ephemeris=not replay, auto_fetch_orbits=use_internet, use_qcom=use_qcom) + if replay or "CI" in os.environ: + use_internet = True + + laikad = Laikad(save_ephemeris=not replay, auto_fetch_navs=use_internet, use_qcom=use_qcom) while True: sm.update() @@ -371,25 +436,17 @@ def main(sm=None, pm=None): if sm.updated[raw_gnss_socket]: gnss_msg = sm[raw_gnss_socket] - # TODO: Understand and use remaining unknown constellations - if gnss_msg.which() == "drMeasurementReport": - if getattr(gnss_msg, gnss_msg.which()).source not in ['glonass', 'gps', 'beidou', 'sbas']: - continue + msg = process_msg(laikad, gnss_msg, sm.logMonoTime[raw_gnss_socket], replay) + if msg is None: + # TODO: beautify this, locationd needs a valid message + msg = messaging.new_message("gnssMeasurements") + pm.send('gnssMeasurements', msg) - if getattr(gnss_msg, gnss_msg.which()).gpsWeek > np.iinfo(np.int16).max: - # gpsWeek 65535 is received rarely from quectel, this cannot be - # passed to GnssMeasurements's gpsWeek (Int16) - continue - - msg = laikad.process_gnss_msg(gnss_msg, sm.logMonoTime[raw_gnss_socket], block=replay) - if msg is not None: - pm.send('gnssMeasurements', msg) if not laikad.got_first_gnss_msg and sm.updated['clocks']: clocks_msg = sm['clocks'] t = GPSTime.from_datetime(datetime.utcfromtimestamp(clocks_msg.wallTimeNanos * 1E-9)) - if laikad.auto_fetch_orbits: - laikad.fetch_orbits(t, block=replay) - + if laikad.auto_fetch_navs: + laikad.fetch_navs(t, block=replay) if __name__ == "__main__": main() diff --git a/selfdrive/locationd/laikad_helpers.py b/selfdrive/locationd/laikad_helpers.py deleted file mode 100644 index f13e8e73b..000000000 --- a/selfdrive/locationd/laikad_helpers.py +++ /dev/null @@ -1,89 +0,0 @@ -import numpy as np -import sympy - -from laika.constants import EARTH_ROTATION_RATE, SPEED_OF_LIGHT -from laika.helpers import ConstellationId - - -def calc_pos_fix_gauss_newton(measurements, posfix_functions, x0=None, signal='C1C', min_measurements=6): - ''' - Calculates gps fix using gauss newton method - To solve the problem a minimal of 4 measurements are required. - If Glonass is included 5 are required to solve for the additional free variable. - returns: - 0 -> list with positions - ''' - if x0 is None: - x0 = [0, 0, 0, 0, 0] - n = len(measurements) - if n < min_measurements: - return [], [] - - Fx_pos = pr_residual(measurements, posfix_functions, signal=signal) - x = gauss_newton(Fx_pos, x0) - residual, _ = Fx_pos(x, weight=1.0) - return x.tolist(), residual.tolist() - - -def pr_residual(measurements, posfix_functions, signal='C1C'): - def Fx_pos(inp, weight=None): - vals, gradients = [], [] - - for meas in measurements: - pr = meas.observables[signal] - pr += meas.sat_clock_err * SPEED_OF_LIGHT - - w = (1 / meas.observables_std[signal]) if weight is None else weight - - val, *gradient = posfix_functions[meas.constellation_id](*inp, pr, *meas.sat_pos, w) - vals.append(val) - gradients.append(gradient) - return np.asarray(vals), np.asarray(gradients) - - return Fx_pos - - -def gauss_newton(fun, b, xtol=1e-8, max_n=25): - for _ in range(max_n): - # Compute function and jacobian on current estimate - r, J = fun(b) - - # Update estimate - delta = np.linalg.pinv(J) @ r - b -= delta - - # Check step size for stopping condition - if np.linalg.norm(delta) < xtol: - break - return b - - -def get_posfix_sympy_fun(constellation): - # Unknowns - x, y, z = sympy.Symbol('x'), sympy.Symbol('y'), sympy.Symbol('z') - bc = sympy.Symbol('bc') - bg = sympy.Symbol('bg') - var = [x, y, z, bc, bg] - - # Knowns - pr = sympy.Symbol('pr') - sat_x, sat_y, sat_z = sympy.Symbol('sat_x'), sympy.Symbol('sat_y'), sympy.Symbol('sat_z') - weight = sympy.Symbol('weight') - - theta = EARTH_ROTATION_RATE * (pr - bc) / SPEED_OF_LIGHT - val = sympy.sqrt( - (sat_x * sympy.cos(theta) + sat_y * sympy.sin(theta) - x) ** 2 + - (sat_y * sympy.cos(theta) - sat_x * sympy.sin(theta) - y) ** 2 + - (sat_z - z) ** 2 - ) - - if constellation == ConstellationId.GLONASS: - res = weight * (val - (pr - bc - bg)) - elif constellation == ConstellationId.GPS: - res = weight * (val - (pr - bc)) - else: - raise NotImplementedError(f"Constellation {constellation} not supported") - - res = [res] + [sympy.diff(res, v) for v in var] - - return sympy.lambdify([x, y, z, bc, bg, pr, sat_x, sat_y, sat_z, weight], res, modules=["numpy"]) diff --git a/selfdrive/locationd/locationd b/selfdrive/locationd/locationd index c6bc61612..fbb95a975 100755 Binary files a/selfdrive/locationd/locationd and b/selfdrive/locationd/locationd differ diff --git a/selfdrive/locationd/locationd.h b/selfdrive/locationd/locationd.h index 0151304c8..1e16b687c 100755 --- a/selfdrive/locationd/locationd.h +++ b/selfdrive/locationd/locationd.h @@ -3,6 +3,7 @@ #include #include #include +#include #include #include "cereal/messaging/messaging.h" @@ -13,7 +14,7 @@ #include "common/timing.h" #include "common/util.h" -#include "selfdrive/sensord/sensors/constants.h" +#include "system/sensord/sensors/constants.h" #define VISION_DECIMATION 2 #define SENSOR_DECIMATION 10 #include "selfdrive/locationd/models/live_kf.h" @@ -23,6 +24,7 @@ class Localizer { public: Localizer(); + Localizer(bool has_ublox); int locationd_thread(); @@ -33,7 +35,11 @@ public: void time_check(double current_time = NAN); void update_reset_tracker(); bool is_gps_ok(); + bool critical_services_valid(std::map critical_services); + bool is_timestamp_valid(double current_time); void determine_gps_mode(double current_time); + bool are_inputs_ok(); + void observation_timings_invalid_reset(); kj::ArrayPtr get_message_bytes(MessageBuilder& msg_builder, bool inputsOK, bool sensorsOK, bool gpsOK, bool msgValid); @@ -48,6 +54,7 @@ public: void handle_sensors(double current_time, const capnp::List::Reader& log); // void handle_sensor(double current_time, const cereal::SensorEventData::Reader& log); void handle_gps(double current_time, const cereal::GpsLocationData::Reader& log, const double sensor_time_offset); + void handle_gnss(double current_time, const cereal::GnssMeasurements::Reader& log); void handle_car_state(double current_time, const cereal::CarState::Reader& log); void handle_cam_odo(double current_time, const cereal::CameraOdometry::Reader& log); void handle_live_calib(double current_time, const cereal::LiveCalibrationData::Reader& log); @@ -72,6 +79,10 @@ private: double reset_tracker = 0.0; bool device_fell = false; bool gps_mode = false; - bool gps_valid = false; -// bool ublox_available = true; + double last_gps_msg = 0; + bool ublox_available = true; + bool observation_timings_invalid = false; + std::map observation_values_invalid; + bool standstill = true; + int32_t orientation_reset_count = 0; }; diff --git a/selfdrive/locationd/models/generated/car.cpp b/selfdrive/locationd/models/generated/car.cpp index df8e9853c..824d03b48 100644 --- a/selfdrive/locationd/models/generated/car.cpp +++ b/selfdrive/locationd/models/generated/car.cpp @@ -45,326 +45,326 @@ const static double MAHA_THRESH_31 = 3.8414588206941227; * * * This file is part of 'ekf' * ******************************************************************************/ -void err_fun(double *nom_x, double *delta_x, double *out_5232708683747839446) { - out_5232708683747839446[0] = delta_x[0] + nom_x[0]; - out_5232708683747839446[1] = delta_x[1] + nom_x[1]; - out_5232708683747839446[2] = delta_x[2] + nom_x[2]; - out_5232708683747839446[3] = delta_x[3] + nom_x[3]; - out_5232708683747839446[4] = delta_x[4] + nom_x[4]; - out_5232708683747839446[5] = delta_x[5] + nom_x[5]; - out_5232708683747839446[6] = delta_x[6] + nom_x[6]; - out_5232708683747839446[7] = delta_x[7] + nom_x[7]; - out_5232708683747839446[8] = delta_x[8] + nom_x[8]; +void err_fun(double *nom_x, double *delta_x, double *out_559111814741085424) { + out_559111814741085424[0] = delta_x[0] + nom_x[0]; + out_559111814741085424[1] = delta_x[1] + nom_x[1]; + out_559111814741085424[2] = delta_x[2] + nom_x[2]; + out_559111814741085424[3] = delta_x[3] + nom_x[3]; + out_559111814741085424[4] = delta_x[4] + nom_x[4]; + out_559111814741085424[5] = delta_x[5] + nom_x[5]; + out_559111814741085424[6] = delta_x[6] + nom_x[6]; + out_559111814741085424[7] = delta_x[7] + nom_x[7]; + out_559111814741085424[8] = delta_x[8] + nom_x[8]; } -void inv_err_fun(double *nom_x, double *true_x, double *out_6273110318621425138) { - out_6273110318621425138[0] = -nom_x[0] + true_x[0]; - out_6273110318621425138[1] = -nom_x[1] + true_x[1]; - out_6273110318621425138[2] = -nom_x[2] + true_x[2]; - out_6273110318621425138[3] = -nom_x[3] + true_x[3]; - out_6273110318621425138[4] = -nom_x[4] + true_x[4]; - out_6273110318621425138[5] = -nom_x[5] + true_x[5]; - out_6273110318621425138[6] = -nom_x[6] + true_x[6]; - out_6273110318621425138[7] = -nom_x[7] + true_x[7]; - out_6273110318621425138[8] = -nom_x[8] + true_x[8]; +void inv_err_fun(double *nom_x, double *true_x, double *out_8525802223358923727) { + out_8525802223358923727[0] = -nom_x[0] + true_x[0]; + out_8525802223358923727[1] = -nom_x[1] + true_x[1]; + out_8525802223358923727[2] = -nom_x[2] + true_x[2]; + out_8525802223358923727[3] = -nom_x[3] + true_x[3]; + out_8525802223358923727[4] = -nom_x[4] + true_x[4]; + out_8525802223358923727[5] = -nom_x[5] + true_x[5]; + out_8525802223358923727[6] = -nom_x[6] + true_x[6]; + out_8525802223358923727[7] = -nom_x[7] + true_x[7]; + out_8525802223358923727[8] = -nom_x[8] + true_x[8]; } -void H_mod_fun(double *state, double *out_376479380516898605) { - out_376479380516898605[0] = 1.0; - out_376479380516898605[1] = 0; - out_376479380516898605[2] = 0; - out_376479380516898605[3] = 0; - out_376479380516898605[4] = 0; - out_376479380516898605[5] = 0; - out_376479380516898605[6] = 0; - out_376479380516898605[7] = 0; - out_376479380516898605[8] = 0; - out_376479380516898605[9] = 0; - out_376479380516898605[10] = 1.0; - out_376479380516898605[11] = 0; - out_376479380516898605[12] = 0; - out_376479380516898605[13] = 0; - out_376479380516898605[14] = 0; - out_376479380516898605[15] = 0; - out_376479380516898605[16] = 0; - out_376479380516898605[17] = 0; - out_376479380516898605[18] = 0; - out_376479380516898605[19] = 0; - out_376479380516898605[20] = 1.0; - out_376479380516898605[21] = 0; - out_376479380516898605[22] = 0; - out_376479380516898605[23] = 0; - out_376479380516898605[24] = 0; - out_376479380516898605[25] = 0; - out_376479380516898605[26] = 0; - out_376479380516898605[27] = 0; - out_376479380516898605[28] = 0; - out_376479380516898605[29] = 0; - out_376479380516898605[30] = 1.0; - out_376479380516898605[31] = 0; - out_376479380516898605[32] = 0; - out_376479380516898605[33] = 0; - out_376479380516898605[34] = 0; - out_376479380516898605[35] = 0; - out_376479380516898605[36] = 0; - out_376479380516898605[37] = 0; - out_376479380516898605[38] = 0; - out_376479380516898605[39] = 0; - out_376479380516898605[40] = 1.0; - out_376479380516898605[41] = 0; - out_376479380516898605[42] = 0; - out_376479380516898605[43] = 0; - out_376479380516898605[44] = 0; - out_376479380516898605[45] = 0; - out_376479380516898605[46] = 0; - out_376479380516898605[47] = 0; - out_376479380516898605[48] = 0; - out_376479380516898605[49] = 0; - out_376479380516898605[50] = 1.0; - out_376479380516898605[51] = 0; - out_376479380516898605[52] = 0; - out_376479380516898605[53] = 0; - out_376479380516898605[54] = 0; - out_376479380516898605[55] = 0; - out_376479380516898605[56] = 0; - out_376479380516898605[57] = 0; - out_376479380516898605[58] = 0; - out_376479380516898605[59] = 0; - out_376479380516898605[60] = 1.0; - out_376479380516898605[61] = 0; - out_376479380516898605[62] = 0; - out_376479380516898605[63] = 0; - out_376479380516898605[64] = 0; - out_376479380516898605[65] = 0; - out_376479380516898605[66] = 0; - out_376479380516898605[67] = 0; - out_376479380516898605[68] = 0; - out_376479380516898605[69] = 0; - out_376479380516898605[70] = 1.0; - out_376479380516898605[71] = 0; - out_376479380516898605[72] = 0; - out_376479380516898605[73] = 0; - out_376479380516898605[74] = 0; - out_376479380516898605[75] = 0; - out_376479380516898605[76] = 0; - out_376479380516898605[77] = 0; - out_376479380516898605[78] = 0; - out_376479380516898605[79] = 0; - out_376479380516898605[80] = 1.0; +void H_mod_fun(double *state, double *out_6521334698987505192) { + out_6521334698987505192[0] = 1.0; + out_6521334698987505192[1] = 0; + out_6521334698987505192[2] = 0; + out_6521334698987505192[3] = 0; + out_6521334698987505192[4] = 0; + out_6521334698987505192[5] = 0; + out_6521334698987505192[6] = 0; + out_6521334698987505192[7] = 0; + out_6521334698987505192[8] = 0; + out_6521334698987505192[9] = 0; + out_6521334698987505192[10] = 1.0; + out_6521334698987505192[11] = 0; + out_6521334698987505192[12] = 0; + out_6521334698987505192[13] = 0; + out_6521334698987505192[14] = 0; + out_6521334698987505192[15] = 0; + out_6521334698987505192[16] = 0; + out_6521334698987505192[17] = 0; + out_6521334698987505192[18] = 0; + out_6521334698987505192[19] = 0; + out_6521334698987505192[20] = 1.0; + out_6521334698987505192[21] = 0; + out_6521334698987505192[22] = 0; + out_6521334698987505192[23] = 0; + out_6521334698987505192[24] = 0; + out_6521334698987505192[25] = 0; + out_6521334698987505192[26] = 0; + out_6521334698987505192[27] = 0; + out_6521334698987505192[28] = 0; + out_6521334698987505192[29] = 0; + out_6521334698987505192[30] = 1.0; + out_6521334698987505192[31] = 0; + out_6521334698987505192[32] = 0; + out_6521334698987505192[33] = 0; + out_6521334698987505192[34] = 0; + out_6521334698987505192[35] = 0; + out_6521334698987505192[36] = 0; + out_6521334698987505192[37] = 0; + out_6521334698987505192[38] = 0; + out_6521334698987505192[39] = 0; + out_6521334698987505192[40] = 1.0; + out_6521334698987505192[41] = 0; + out_6521334698987505192[42] = 0; + out_6521334698987505192[43] = 0; + out_6521334698987505192[44] = 0; + out_6521334698987505192[45] = 0; + out_6521334698987505192[46] = 0; + out_6521334698987505192[47] = 0; + out_6521334698987505192[48] = 0; + out_6521334698987505192[49] = 0; + out_6521334698987505192[50] = 1.0; + out_6521334698987505192[51] = 0; + out_6521334698987505192[52] = 0; + out_6521334698987505192[53] = 0; + out_6521334698987505192[54] = 0; + out_6521334698987505192[55] = 0; + out_6521334698987505192[56] = 0; + out_6521334698987505192[57] = 0; + out_6521334698987505192[58] = 0; + out_6521334698987505192[59] = 0; + out_6521334698987505192[60] = 1.0; + out_6521334698987505192[61] = 0; + out_6521334698987505192[62] = 0; + out_6521334698987505192[63] = 0; + out_6521334698987505192[64] = 0; + out_6521334698987505192[65] = 0; + out_6521334698987505192[66] = 0; + out_6521334698987505192[67] = 0; + out_6521334698987505192[68] = 0; + out_6521334698987505192[69] = 0; + out_6521334698987505192[70] = 1.0; + out_6521334698987505192[71] = 0; + out_6521334698987505192[72] = 0; + out_6521334698987505192[73] = 0; + out_6521334698987505192[74] = 0; + out_6521334698987505192[75] = 0; + out_6521334698987505192[76] = 0; + out_6521334698987505192[77] = 0; + out_6521334698987505192[78] = 0; + out_6521334698987505192[79] = 0; + out_6521334698987505192[80] = 1.0; } -void f_fun(double *state, double dt, double *out_7586787697879010325) { - out_7586787697879010325[0] = state[0]; - out_7586787697879010325[1] = state[1]; - out_7586787697879010325[2] = state[2]; - out_7586787697879010325[3] = state[3]; - out_7586787697879010325[4] = state[4]; - out_7586787697879010325[5] = dt*((-state[4] + (-center_to_front*stiffness_front*state[0] + center_to_rear*stiffness_rear*state[0])/(mass*state[4]))*state[6] - 9.8000000000000007*state[8] + stiffness_front*(-state[2] - state[3] + state[7])*state[0]/(mass*state[1]) + (-stiffness_front*state[0] - stiffness_rear*state[0])*state[5]/(mass*state[4])) + state[5]; - out_7586787697879010325[6] = dt*(center_to_front*stiffness_front*(-state[2] - state[3] + state[7])*state[0]/(rotational_inertia*state[1]) + (-center_to_front*stiffness_front*state[0] + center_to_rear*stiffness_rear*state[0])*state[5]/(rotational_inertia*state[4]) + (-pow(center_to_front, 2)*stiffness_front*state[0] - pow(center_to_rear, 2)*stiffness_rear*state[0])*state[6]/(rotational_inertia*state[4])) + state[6]; - out_7586787697879010325[7] = state[7]; - out_7586787697879010325[8] = state[8]; +void f_fun(double *state, double dt, double *out_5157815911269073647) { + out_5157815911269073647[0] = state[0]; + out_5157815911269073647[1] = state[1]; + out_5157815911269073647[2] = state[2]; + out_5157815911269073647[3] = state[3]; + out_5157815911269073647[4] = state[4]; + out_5157815911269073647[5] = dt*((-state[4] + (-center_to_front*stiffness_front*state[0] + center_to_rear*stiffness_rear*state[0])/(mass*state[4]))*state[6] - 9.8000000000000007*state[8] + stiffness_front*(-state[2] - state[3] + state[7])*state[0]/(mass*state[1]) + (-stiffness_front*state[0] - stiffness_rear*state[0])*state[5]/(mass*state[4])) + state[5]; + out_5157815911269073647[6] = dt*(center_to_front*stiffness_front*(-state[2] - state[3] + state[7])*state[0]/(rotational_inertia*state[1]) + (-center_to_front*stiffness_front*state[0] + center_to_rear*stiffness_rear*state[0])*state[5]/(rotational_inertia*state[4]) + (-pow(center_to_front, 2)*stiffness_front*state[0] - pow(center_to_rear, 2)*stiffness_rear*state[0])*state[6]/(rotational_inertia*state[4])) + state[6]; + out_5157815911269073647[7] = state[7]; + out_5157815911269073647[8] = state[8]; } -void F_fun(double *state, double dt, double *out_472790716300753243) { - out_472790716300753243[0] = 1; - out_472790716300753243[1] = 0; - out_472790716300753243[2] = 0; - out_472790716300753243[3] = 0; - out_472790716300753243[4] = 0; - out_472790716300753243[5] = 0; - out_472790716300753243[6] = 0; - out_472790716300753243[7] = 0; - out_472790716300753243[8] = 0; - out_472790716300753243[9] = 0; - out_472790716300753243[10] = 1; - out_472790716300753243[11] = 0; - out_472790716300753243[12] = 0; - out_472790716300753243[13] = 0; - out_472790716300753243[14] = 0; - out_472790716300753243[15] = 0; - out_472790716300753243[16] = 0; - out_472790716300753243[17] = 0; - out_472790716300753243[18] = 0; - out_472790716300753243[19] = 0; - out_472790716300753243[20] = 1; - out_472790716300753243[21] = 0; - out_472790716300753243[22] = 0; - out_472790716300753243[23] = 0; - out_472790716300753243[24] = 0; - out_472790716300753243[25] = 0; - out_472790716300753243[26] = 0; - out_472790716300753243[27] = 0; - out_472790716300753243[28] = 0; - out_472790716300753243[29] = 0; - out_472790716300753243[30] = 1; - out_472790716300753243[31] = 0; - out_472790716300753243[32] = 0; - out_472790716300753243[33] = 0; - out_472790716300753243[34] = 0; - out_472790716300753243[35] = 0; - out_472790716300753243[36] = 0; - out_472790716300753243[37] = 0; - out_472790716300753243[38] = 0; - out_472790716300753243[39] = 0; - out_472790716300753243[40] = 1; - out_472790716300753243[41] = 0; - out_472790716300753243[42] = 0; - out_472790716300753243[43] = 0; - out_472790716300753243[44] = 0; - out_472790716300753243[45] = dt*(stiffness_front*(-state[2] - state[3] + state[7])/(mass*state[1]) + (-stiffness_front - stiffness_rear)*state[5]/(mass*state[4]) + (-center_to_front*stiffness_front + center_to_rear*stiffness_rear)*state[6]/(mass*state[4])); - out_472790716300753243[46] = -dt*stiffness_front*(-state[2] - state[3] + state[7])*state[0]/(mass*pow(state[1], 2)); - out_472790716300753243[47] = -dt*stiffness_front*state[0]/(mass*state[1]); - out_472790716300753243[48] = -dt*stiffness_front*state[0]/(mass*state[1]); - out_472790716300753243[49] = dt*((-1 - (-center_to_front*stiffness_front*state[0] + center_to_rear*stiffness_rear*state[0])/(mass*pow(state[4], 2)))*state[6] - (-stiffness_front*state[0] - stiffness_rear*state[0])*state[5]/(mass*pow(state[4], 2))); - out_472790716300753243[50] = dt*(-stiffness_front*state[0] - stiffness_rear*state[0])/(mass*state[4]) + 1; - out_472790716300753243[51] = dt*(-state[4] + (-center_to_front*stiffness_front*state[0] + center_to_rear*stiffness_rear*state[0])/(mass*state[4])); - out_472790716300753243[52] = dt*stiffness_front*state[0]/(mass*state[1]); - out_472790716300753243[53] = -9.8000000000000007*dt; - out_472790716300753243[54] = dt*(center_to_front*stiffness_front*(-state[2] - state[3] + state[7])/(rotational_inertia*state[1]) + (-center_to_front*stiffness_front + center_to_rear*stiffness_rear)*state[5]/(rotational_inertia*state[4]) + (-pow(center_to_front, 2)*stiffness_front - pow(center_to_rear, 2)*stiffness_rear)*state[6]/(rotational_inertia*state[4])); - out_472790716300753243[55] = -center_to_front*dt*stiffness_front*(-state[2] - state[3] + state[7])*state[0]/(rotational_inertia*pow(state[1], 2)); - out_472790716300753243[56] = -center_to_front*dt*stiffness_front*state[0]/(rotational_inertia*state[1]); - out_472790716300753243[57] = -center_to_front*dt*stiffness_front*state[0]/(rotational_inertia*state[1]); - out_472790716300753243[58] = dt*(-(-center_to_front*stiffness_front*state[0] + center_to_rear*stiffness_rear*state[0])*state[5]/(rotational_inertia*pow(state[4], 2)) - (-pow(center_to_front, 2)*stiffness_front*state[0] - pow(center_to_rear, 2)*stiffness_rear*state[0])*state[6]/(rotational_inertia*pow(state[4], 2))); - out_472790716300753243[59] = dt*(-center_to_front*stiffness_front*state[0] + center_to_rear*stiffness_rear*state[0])/(rotational_inertia*state[4]); - out_472790716300753243[60] = dt*(-pow(center_to_front, 2)*stiffness_front*state[0] - pow(center_to_rear, 2)*stiffness_rear*state[0])/(rotational_inertia*state[4]) + 1; - out_472790716300753243[61] = center_to_front*dt*stiffness_front*state[0]/(rotational_inertia*state[1]); - out_472790716300753243[62] = 0; - out_472790716300753243[63] = 0; - out_472790716300753243[64] = 0; - out_472790716300753243[65] = 0; - out_472790716300753243[66] = 0; - out_472790716300753243[67] = 0; - out_472790716300753243[68] = 0; - out_472790716300753243[69] = 0; - out_472790716300753243[70] = 1; - out_472790716300753243[71] = 0; - out_472790716300753243[72] = 0; - out_472790716300753243[73] = 0; - out_472790716300753243[74] = 0; - out_472790716300753243[75] = 0; - out_472790716300753243[76] = 0; - out_472790716300753243[77] = 0; - out_472790716300753243[78] = 0; - out_472790716300753243[79] = 0; - out_472790716300753243[80] = 1; +void F_fun(double *state, double dt, double *out_4341564588224271600) { + out_4341564588224271600[0] = 1; + out_4341564588224271600[1] = 0; + out_4341564588224271600[2] = 0; + out_4341564588224271600[3] = 0; + out_4341564588224271600[4] = 0; + out_4341564588224271600[5] = 0; + out_4341564588224271600[6] = 0; + out_4341564588224271600[7] = 0; + out_4341564588224271600[8] = 0; + out_4341564588224271600[9] = 0; + out_4341564588224271600[10] = 1; + out_4341564588224271600[11] = 0; + out_4341564588224271600[12] = 0; + out_4341564588224271600[13] = 0; + out_4341564588224271600[14] = 0; + out_4341564588224271600[15] = 0; + out_4341564588224271600[16] = 0; + out_4341564588224271600[17] = 0; + out_4341564588224271600[18] = 0; + out_4341564588224271600[19] = 0; + out_4341564588224271600[20] = 1; + out_4341564588224271600[21] = 0; + out_4341564588224271600[22] = 0; + out_4341564588224271600[23] = 0; + out_4341564588224271600[24] = 0; + out_4341564588224271600[25] = 0; + out_4341564588224271600[26] = 0; + out_4341564588224271600[27] = 0; + out_4341564588224271600[28] = 0; + out_4341564588224271600[29] = 0; + out_4341564588224271600[30] = 1; + out_4341564588224271600[31] = 0; + out_4341564588224271600[32] = 0; + out_4341564588224271600[33] = 0; + out_4341564588224271600[34] = 0; + out_4341564588224271600[35] = 0; + out_4341564588224271600[36] = 0; + out_4341564588224271600[37] = 0; + out_4341564588224271600[38] = 0; + out_4341564588224271600[39] = 0; + out_4341564588224271600[40] = 1; + out_4341564588224271600[41] = 0; + out_4341564588224271600[42] = 0; + out_4341564588224271600[43] = 0; + out_4341564588224271600[44] = 0; + out_4341564588224271600[45] = dt*(stiffness_front*(-state[2] - state[3] + state[7])/(mass*state[1]) + (-stiffness_front - stiffness_rear)*state[5]/(mass*state[4]) + (-center_to_front*stiffness_front + center_to_rear*stiffness_rear)*state[6]/(mass*state[4])); + out_4341564588224271600[46] = -dt*stiffness_front*(-state[2] - state[3] + state[7])*state[0]/(mass*pow(state[1], 2)); + out_4341564588224271600[47] = -dt*stiffness_front*state[0]/(mass*state[1]); + out_4341564588224271600[48] = -dt*stiffness_front*state[0]/(mass*state[1]); + out_4341564588224271600[49] = dt*((-1 - (-center_to_front*stiffness_front*state[0] + center_to_rear*stiffness_rear*state[0])/(mass*pow(state[4], 2)))*state[6] - (-stiffness_front*state[0] - stiffness_rear*state[0])*state[5]/(mass*pow(state[4], 2))); + out_4341564588224271600[50] = dt*(-stiffness_front*state[0] - stiffness_rear*state[0])/(mass*state[4]) + 1; + out_4341564588224271600[51] = dt*(-state[4] + (-center_to_front*stiffness_front*state[0] + center_to_rear*stiffness_rear*state[0])/(mass*state[4])); + out_4341564588224271600[52] = dt*stiffness_front*state[0]/(mass*state[1]); + out_4341564588224271600[53] = -9.8000000000000007*dt; + out_4341564588224271600[54] = dt*(center_to_front*stiffness_front*(-state[2] - state[3] + state[7])/(rotational_inertia*state[1]) + (-center_to_front*stiffness_front + center_to_rear*stiffness_rear)*state[5]/(rotational_inertia*state[4]) + (-pow(center_to_front, 2)*stiffness_front - pow(center_to_rear, 2)*stiffness_rear)*state[6]/(rotational_inertia*state[4])); + out_4341564588224271600[55] = -center_to_front*dt*stiffness_front*(-state[2] - state[3] + state[7])*state[0]/(rotational_inertia*pow(state[1], 2)); + out_4341564588224271600[56] = -center_to_front*dt*stiffness_front*state[0]/(rotational_inertia*state[1]); + out_4341564588224271600[57] = -center_to_front*dt*stiffness_front*state[0]/(rotational_inertia*state[1]); + out_4341564588224271600[58] = dt*(-(-center_to_front*stiffness_front*state[0] + center_to_rear*stiffness_rear*state[0])*state[5]/(rotational_inertia*pow(state[4], 2)) - (-pow(center_to_front, 2)*stiffness_front*state[0] - pow(center_to_rear, 2)*stiffness_rear*state[0])*state[6]/(rotational_inertia*pow(state[4], 2))); + out_4341564588224271600[59] = dt*(-center_to_front*stiffness_front*state[0] + center_to_rear*stiffness_rear*state[0])/(rotational_inertia*state[4]); + out_4341564588224271600[60] = dt*(-pow(center_to_front, 2)*stiffness_front*state[0] - pow(center_to_rear, 2)*stiffness_rear*state[0])/(rotational_inertia*state[4]) + 1; + out_4341564588224271600[61] = center_to_front*dt*stiffness_front*state[0]/(rotational_inertia*state[1]); + out_4341564588224271600[62] = 0; + out_4341564588224271600[63] = 0; + out_4341564588224271600[64] = 0; + out_4341564588224271600[65] = 0; + out_4341564588224271600[66] = 0; + out_4341564588224271600[67] = 0; + out_4341564588224271600[68] = 0; + out_4341564588224271600[69] = 0; + out_4341564588224271600[70] = 1; + out_4341564588224271600[71] = 0; + out_4341564588224271600[72] = 0; + out_4341564588224271600[73] = 0; + out_4341564588224271600[74] = 0; + out_4341564588224271600[75] = 0; + out_4341564588224271600[76] = 0; + out_4341564588224271600[77] = 0; + out_4341564588224271600[78] = 0; + out_4341564588224271600[79] = 0; + out_4341564588224271600[80] = 1; } -void h_25(double *state, double *unused, double *out_6846635756302794664) { - out_6846635756302794664[0] = state[6]; +void h_25(double *state, double *unused, double *out_8809968363646297090) { + out_8809968363646297090[0] = state[6]; } -void H_25(double *state, double *unused, double *out_1681825998279428652) { - out_1681825998279428652[0] = 0; - out_1681825998279428652[1] = 0; - out_1681825998279428652[2] = 0; - out_1681825998279428652[3] = 0; - out_1681825998279428652[4] = 0; - out_1681825998279428652[5] = 0; - out_1681825998279428652[6] = 1; - out_1681825998279428652[7] = 0; - out_1681825998279428652[8] = 0; +void H_25(double *state, double *unused, double *out_1959634654218019643) { + out_1959634654218019643[0] = 0; + out_1959634654218019643[1] = 0; + out_1959634654218019643[2] = 0; + out_1959634654218019643[3] = 0; + out_1959634654218019643[4] = 0; + out_1959634654218019643[5] = 0; + out_1959634654218019643[6] = 1; + out_1959634654218019643[7] = 0; + out_1959634654218019643[8] = 0; } -void h_24(double *state, double *unused, double *out_7639061379755997248) { - out_7639061379755997248[0] = state[4]; - out_7639061379755997248[1] = state[5]; +void h_24(double *state, double *unused, double *out_8028835485487409495) { + out_8028835485487409495[0] = state[4]; + out_8028835485487409495[1] = state[5]; } -void H_24(double *state, double *unused, double *out_4893745808312089449) { - out_4893745808312089449[0] = 0; - out_4893745808312089449[1] = 0; - out_4893745808312089449[2] = 0; - out_4893745808312089449[3] = 0; - out_4893745808312089449[4] = 1; - out_4893745808312089449[5] = 0; - out_4893745808312089449[6] = 0; - out_4893745808312089449[7] = 0; - out_4893745808312089449[8] = 0; - out_4893745808312089449[9] = 0; - out_4893745808312089449[10] = 0; - out_4893745808312089449[11] = 0; - out_4893745808312089449[12] = 0; - out_4893745808312089449[13] = 0; - out_4893745808312089449[14] = 1; - out_4893745808312089449[15] = 0; - out_4893745808312089449[16] = 0; - out_4893745808312089449[17] = 0; +void H_24(double *state, double *unused, double *out_2786874672748489391) { + out_2786874672748489391[0] = 0; + out_2786874672748489391[1] = 0; + out_2786874672748489391[2] = 0; + out_2786874672748489391[3] = 0; + out_2786874672748489391[4] = 1; + out_2786874672748489391[5] = 0; + out_2786874672748489391[6] = 0; + out_2786874672748489391[7] = 0; + out_2786874672748489391[8] = 0; + out_2786874672748489391[9] = 0; + out_2786874672748489391[10] = 0; + out_2786874672748489391[11] = 0; + out_2786874672748489391[12] = 0; + out_2786874672748489391[13] = 0; + out_2786874672748489391[14] = 1; + out_2786874672748489391[15] = 0; + out_2786874672748489391[16] = 0; + out_2786874672748489391[17] = 0; } -void h_30(double *state, double *unused, double *out_2046273354615198377) { - out_2046273354615198377[0] = state[4]; +void h_30(double *state, double *unused, double *out_8967155031997426235) { + out_8967155031997426235[0] = state[4]; } -void H_30(double *state, double *unused, double *out_5234864343212188103) { - out_5234864343212188103[0] = 0; - out_5234864343212188103[1] = 0; - out_5234864343212188103[2] = 0; - out_5234864343212188103[3] = 0; - out_5234864343212188103[4] = 1; - out_5234864343212188103[5] = 0; - out_5234864343212188103[6] = 0; - out_5234864343212188103[7] = 0; - out_5234864343212188103[8] = 0; +void H_30(double *state, double *unused, double *out_4477967612725268270) { + out_4477967612725268270[0] = 0; + out_4477967612725268270[1] = 0; + out_4477967612725268270[2] = 0; + out_4477967612725268270[3] = 0; + out_4477967612725268270[4] = 1; + out_4477967612725268270[5] = 0; + out_4477967612725268270[6] = 0; + out_4477967612725268270[7] = 0; + out_4477967612725268270[8] = 0; } -void h_26(double *state, double *unused, double *out_4200177702844975091) { - out_4200177702844975091[0] = state[7]; +void h_26(double *state, double *unused, double *out_4004775034316133003) { + out_4004775034316133003[0] = state[7]; } -void H_26(double *state, double *unused, double *out_5423329317153484876) { - out_5423329317153484876[0] = 0; - out_5423329317153484876[1] = 0; - out_5423329317153484876[2] = 0; - out_5423329317153484876[3] = 0; - out_5423329317153484876[4] = 0; - out_5423329317153484876[5] = 0; - out_5423329317153484876[6] = 0; - out_5423329317153484876[7] = 1; - out_5423329317153484876[8] = 0; +void H_26(double *state, double *unused, double *out_5264160623978820244) { + out_5264160623978820244[0] = 0; + out_5264160623978820244[1] = 0; + out_5264160623978820244[2] = 0; + out_5264160623978820244[3] = 0; + out_5264160623978820244[4] = 0; + out_5264160623978820244[5] = 0; + out_5264160623978820244[6] = 0; + out_5264160623978820244[7] = 1; + out_5264160623978820244[8] = 0; } -void h_27(double *state, double *unused, double *out_6628820938264559055) { - out_6628820938264559055[0] = state[3]; +void h_27(double *state, double *unused, double *out_6824223606793401143) { + out_6824223606793401143[0] = state[3]; } -void H_27(double *state, double *unused, double *out_3985928257223093633) { - out_3985928257223093633[0] = 0; - out_3985928257223093633[1] = 0; - out_3985928257223093633[2] = 0; - out_3985928257223093633[3] = 1; - out_3985928257223093633[4] = 0; - out_3985928257223093633[5] = 0; - out_3985928257223093633[6] = 0; - out_3985928257223093633[7] = 0; - out_3985928257223093633[8] = 0; +void H_27(double *state, double *unused, double *out_2303204300924843359) { + out_2303204300924843359[0] = 0; + out_2303204300924843359[1] = 0; + out_2303204300924843359[2] = 0; + out_2303204300924843359[3] = 1; + out_2303204300924843359[4] = 0; + out_2303204300924843359[5] = 0; + out_2303204300924843359[6] = 0; + out_2303204300924843359[7] = 0; + out_2303204300924843359[8] = 0; } -void h_29(double *state, double *unused, double *out_1102763501713535942) { - out_1102763501713535942[0] = state[1]; +void h_29(double *state, double *unused, double *out_53388380443050207) { + out_53388380443050207[0] = state[1]; } -void H_29(double *state, double *unused, double *out_5699290984092644666) { - out_5699290984092644666[0] = 0; - out_5699290984092644666[1] = 1; - out_5699290984092644666[2] = 0; - out_5699290984092644666[3] = 0; - out_5699290984092644666[4] = 0; - out_5699290984092644666[5] = 0; - out_5699290984092644666[6] = 0; - out_5699290984092644666[7] = 0; - out_5699290984092644666[8] = 0; +void H_29(double *state, double *unused, double *out_4988198957039660454) { + out_4988198957039660454[0] = 0; + out_4988198957039660454[1] = 1; + out_4988198957039660454[2] = 0; + out_4988198957039660454[3] = 0; + out_4988198957039660454[4] = 0; + out_4988198957039660454[5] = 0; + out_4988198957039660454[6] = 0; + out_4988198957039660454[7] = 0; + out_4988198957039660454[8] = 0; } -void h_28(double *state, double *unused, double *out_6175193264364035726) { - out_6175193264364035726[0] = state[0]; +void h_28(double *state, double *unused, double *out_6620847199255304828) { + out_6620847199255304828[0] = state[0]; } -void H_28(double *state, double *unused, double *out_3735660712527318415) { - out_3735660712527318415[0] = 1; - out_3735660712527318415[1] = 0; - out_3735660712527318415[2] = 0; - out_3735660712527318415[3] = 0; - out_3735660712527318415[4] = 0; - out_3735660712527318415[5] = 0; - out_3735660712527318415[6] = 0; - out_3735660712527318415[7] = 0; - out_3735660712527318415[8] = 0; +void H_28(double *state, double *unused, double *out_94200060029870120) { + out_94200060029870120[0] = 1; + out_94200060029870120[1] = 0; + out_94200060029870120[2] = 0; + out_94200060029870120[3] = 0; + out_94200060029870120[4] = 0; + out_94200060029870120[5] = 0; + out_94200060029870120[6] = 0; + out_94200060029870120[7] = 0; + out_94200060029870120[8] = 0; } -void h_31(double *state, double *unused, double *out_3077779063232596577) { - out_3077779063232596577[0] = state[8]; +void h_31(double *state, double *unused, double *out_9085162425930802979) { + out_9085162425930802979[0] = state[8]; } -void H_31(double *state, double *unused, double *out_1651180036402468224) { - out_1651180036402468224[0] = 0; - out_1651180036402468224[1] = 0; - out_1651180036402468224[2] = 0; - out_1651180036402468224[3] = 0; - out_1651180036402468224[4] = 0; - out_1651180036402468224[5] = 0; - out_1651180036402468224[6] = 0; - out_1651180036402468224[7] = 0; - out_1651180036402468224[8] = 1; +void H_31(double *state, double *unused, double *out_4637952521745468768) { + out_4637952521745468768[0] = 0; + out_4637952521745468768[1] = 0; + out_4637952521745468768[2] = 0; + out_4637952521745468768[3] = 0; + out_4637952521745468768[4] = 0; + out_4637952521745468768[5] = 0; + out_4637952521745468768[6] = 0; + out_4637952521745468768[7] = 0; + out_4637952521745468768[8] = 1; } #include #include @@ -518,68 +518,68 @@ void car_update_28(double *in_x, double *in_P, double *in_z, double *in_R, doubl void car_update_31(double *in_x, double *in_P, double *in_z, double *in_R, double *in_ea) { update<1, 3, 0>(in_x, in_P, h_31, H_31, NULL, in_z, in_R, in_ea, MAHA_THRESH_31); } -void car_err_fun(double *nom_x, double *delta_x, double *out_5232708683747839446) { - err_fun(nom_x, delta_x, out_5232708683747839446); +void car_err_fun(double *nom_x, double *delta_x, double *out_559111814741085424) { + err_fun(nom_x, delta_x, out_559111814741085424); } -void car_inv_err_fun(double *nom_x, double *true_x, double *out_6273110318621425138) { - inv_err_fun(nom_x, true_x, out_6273110318621425138); +void car_inv_err_fun(double *nom_x, double *true_x, double *out_8525802223358923727) { + inv_err_fun(nom_x, true_x, out_8525802223358923727); } -void car_H_mod_fun(double *state, double *out_376479380516898605) { - H_mod_fun(state, out_376479380516898605); +void car_H_mod_fun(double *state, double *out_6521334698987505192) { + H_mod_fun(state, out_6521334698987505192); } -void car_f_fun(double *state, double dt, double *out_7586787697879010325) { - f_fun(state, dt, out_7586787697879010325); +void car_f_fun(double *state, double dt, double *out_5157815911269073647) { + f_fun(state, dt, out_5157815911269073647); } -void car_F_fun(double *state, double dt, double *out_472790716300753243) { - F_fun(state, dt, out_472790716300753243); +void car_F_fun(double *state, double dt, double *out_4341564588224271600) { + F_fun(state, dt, out_4341564588224271600); } -void car_h_25(double *state, double *unused, double *out_6846635756302794664) { - h_25(state, unused, out_6846635756302794664); +void car_h_25(double *state, double *unused, double *out_8809968363646297090) { + h_25(state, unused, out_8809968363646297090); } -void car_H_25(double *state, double *unused, double *out_1681825998279428652) { - H_25(state, unused, out_1681825998279428652); +void car_H_25(double *state, double *unused, double *out_1959634654218019643) { + H_25(state, unused, out_1959634654218019643); } -void car_h_24(double *state, double *unused, double *out_7639061379755997248) { - h_24(state, unused, out_7639061379755997248); +void car_h_24(double *state, double *unused, double *out_8028835485487409495) { + h_24(state, unused, out_8028835485487409495); } -void car_H_24(double *state, double *unused, double *out_4893745808312089449) { - H_24(state, unused, out_4893745808312089449); +void car_H_24(double *state, double *unused, double *out_2786874672748489391) { + H_24(state, unused, out_2786874672748489391); } -void car_h_30(double *state, double *unused, double *out_2046273354615198377) { - h_30(state, unused, out_2046273354615198377); +void car_h_30(double *state, double *unused, double *out_8967155031997426235) { + h_30(state, unused, out_8967155031997426235); } -void car_H_30(double *state, double *unused, double *out_5234864343212188103) { - H_30(state, unused, out_5234864343212188103); +void car_H_30(double *state, double *unused, double *out_4477967612725268270) { + H_30(state, unused, out_4477967612725268270); } -void car_h_26(double *state, double *unused, double *out_4200177702844975091) { - h_26(state, unused, out_4200177702844975091); +void car_h_26(double *state, double *unused, double *out_4004775034316133003) { + h_26(state, unused, out_4004775034316133003); } -void car_H_26(double *state, double *unused, double *out_5423329317153484876) { - H_26(state, unused, out_5423329317153484876); +void car_H_26(double *state, double *unused, double *out_5264160623978820244) { + H_26(state, unused, out_5264160623978820244); } -void car_h_27(double *state, double *unused, double *out_6628820938264559055) { - h_27(state, unused, out_6628820938264559055); +void car_h_27(double *state, double *unused, double *out_6824223606793401143) { + h_27(state, unused, out_6824223606793401143); } -void car_H_27(double *state, double *unused, double *out_3985928257223093633) { - H_27(state, unused, out_3985928257223093633); +void car_H_27(double *state, double *unused, double *out_2303204300924843359) { + H_27(state, unused, out_2303204300924843359); } -void car_h_29(double *state, double *unused, double *out_1102763501713535942) { - h_29(state, unused, out_1102763501713535942); +void car_h_29(double *state, double *unused, double *out_53388380443050207) { + h_29(state, unused, out_53388380443050207); } -void car_H_29(double *state, double *unused, double *out_5699290984092644666) { - H_29(state, unused, out_5699290984092644666); +void car_H_29(double *state, double *unused, double *out_4988198957039660454) { + H_29(state, unused, out_4988198957039660454); } -void car_h_28(double *state, double *unused, double *out_6175193264364035726) { - h_28(state, unused, out_6175193264364035726); +void car_h_28(double *state, double *unused, double *out_6620847199255304828) { + h_28(state, unused, out_6620847199255304828); } -void car_H_28(double *state, double *unused, double *out_3735660712527318415) { - H_28(state, unused, out_3735660712527318415); +void car_H_28(double *state, double *unused, double *out_94200060029870120) { + H_28(state, unused, out_94200060029870120); } -void car_h_31(double *state, double *unused, double *out_3077779063232596577) { - h_31(state, unused, out_3077779063232596577); +void car_h_31(double *state, double *unused, double *out_9085162425930802979) { + h_31(state, unused, out_9085162425930802979); } -void car_H_31(double *state, double *unused, double *out_1651180036402468224) { - H_31(state, unused, out_1651180036402468224); +void car_H_31(double *state, double *unused, double *out_4637952521745468768) { + H_31(state, unused, out_4637952521745468768); } void car_predict(double *in_x, double *in_P, double *in_Q, double dt) { predict(in_x, in_P, in_Q, dt); diff --git a/selfdrive/locationd/models/generated/car.h b/selfdrive/locationd/models/generated/car.h index c648170bb..38b7d94b2 100644 --- a/selfdrive/locationd/models/generated/car.h +++ b/selfdrive/locationd/models/generated/car.h @@ -9,27 +9,27 @@ void car_update_27(double *in_x, double *in_P, double *in_z, double *in_R, doubl void car_update_29(double *in_x, double *in_P, double *in_z, double *in_R, double *in_ea); void car_update_28(double *in_x, double *in_P, double *in_z, double *in_R, double *in_ea); void car_update_31(double *in_x, double *in_P, double *in_z, double *in_R, double *in_ea); -void car_err_fun(double *nom_x, double *delta_x, double *out_5232708683747839446); -void car_inv_err_fun(double *nom_x, double *true_x, double *out_6273110318621425138); -void car_H_mod_fun(double *state, double *out_376479380516898605); -void car_f_fun(double *state, double dt, double *out_7586787697879010325); -void car_F_fun(double *state, double dt, double *out_472790716300753243); -void car_h_25(double *state, double *unused, double *out_6846635756302794664); -void car_H_25(double *state, double *unused, double *out_1681825998279428652); -void car_h_24(double *state, double *unused, double *out_7639061379755997248); -void car_H_24(double *state, double *unused, double *out_4893745808312089449); -void car_h_30(double *state, double *unused, double *out_2046273354615198377); -void car_H_30(double *state, double *unused, double *out_5234864343212188103); -void car_h_26(double *state, double *unused, double *out_4200177702844975091); -void car_H_26(double *state, double *unused, double *out_5423329317153484876); -void car_h_27(double *state, double *unused, double *out_6628820938264559055); -void car_H_27(double *state, double *unused, double *out_3985928257223093633); -void car_h_29(double *state, double *unused, double *out_1102763501713535942); -void car_H_29(double *state, double *unused, double *out_5699290984092644666); -void car_h_28(double *state, double *unused, double *out_6175193264364035726); -void car_H_28(double *state, double *unused, double *out_3735660712527318415); -void car_h_31(double *state, double *unused, double *out_3077779063232596577); -void car_H_31(double *state, double *unused, double *out_1651180036402468224); +void car_err_fun(double *nom_x, double *delta_x, double *out_559111814741085424); +void car_inv_err_fun(double *nom_x, double *true_x, double *out_8525802223358923727); +void car_H_mod_fun(double *state, double *out_6521334698987505192); +void car_f_fun(double *state, double dt, double *out_5157815911269073647); +void car_F_fun(double *state, double dt, double *out_4341564588224271600); +void car_h_25(double *state, double *unused, double *out_8809968363646297090); +void car_H_25(double *state, double *unused, double *out_1959634654218019643); +void car_h_24(double *state, double *unused, double *out_8028835485487409495); +void car_H_24(double *state, double *unused, double *out_2786874672748489391); +void car_h_30(double *state, double *unused, double *out_8967155031997426235); +void car_H_30(double *state, double *unused, double *out_4477967612725268270); +void car_h_26(double *state, double *unused, double *out_4004775034316133003); +void car_H_26(double *state, double *unused, double *out_5264160623978820244); +void car_h_27(double *state, double *unused, double *out_6824223606793401143); +void car_H_27(double *state, double *unused, double *out_2303204300924843359); +void car_h_29(double *state, double *unused, double *out_53388380443050207); +void car_H_29(double *state, double *unused, double *out_4988198957039660454); +void car_h_28(double *state, double *unused, double *out_6620847199255304828); +void car_H_28(double *state, double *unused, double *out_94200060029870120); +void car_h_31(double *state, double *unused, double *out_9085162425930802979); +void car_H_31(double *state, double *unused, double *out_4637952521745468768); void car_predict(double *in_x, double *in_P, double *in_Q, double dt); void car_set_mass(double x); void car_set_rotational_inertia(double x); diff --git a/selfdrive/locationd/models/generated/gnss.cpp b/selfdrive/locationd/models/generated/gnss.cpp index 7edb96132..84946aada 100644 --- a/selfdrive/locationd/models/generated/gnss.cpp +++ b/selfdrive/locationd/models/generated/gnss.cpp @@ -17,354 +17,354 @@ const static double MAHA_THRESH_21 = 3.8414588206941227; * * * This file is part of 'ekf' * ******************************************************************************/ -void err_fun(double *nom_x, double *delta_x, double *out_4281415265925619745) { - out_4281415265925619745[0] = delta_x[0] + nom_x[0]; - out_4281415265925619745[1] = delta_x[1] + nom_x[1]; - out_4281415265925619745[2] = delta_x[2] + nom_x[2]; - out_4281415265925619745[3] = delta_x[3] + nom_x[3]; - out_4281415265925619745[4] = delta_x[4] + nom_x[4]; - out_4281415265925619745[5] = delta_x[5] + nom_x[5]; - out_4281415265925619745[6] = delta_x[6] + nom_x[6]; - out_4281415265925619745[7] = delta_x[7] + nom_x[7]; - out_4281415265925619745[8] = delta_x[8] + nom_x[8]; - out_4281415265925619745[9] = delta_x[9] + nom_x[9]; - out_4281415265925619745[10] = delta_x[10] + nom_x[10]; +void err_fun(double *nom_x, double *delta_x, double *out_654910612427940843) { + out_654910612427940843[0] = delta_x[0] + nom_x[0]; + out_654910612427940843[1] = delta_x[1] + nom_x[1]; + out_654910612427940843[2] = delta_x[2] + nom_x[2]; + out_654910612427940843[3] = delta_x[3] + nom_x[3]; + out_654910612427940843[4] = delta_x[4] + nom_x[4]; + out_654910612427940843[5] = delta_x[5] + nom_x[5]; + out_654910612427940843[6] = delta_x[6] + nom_x[6]; + out_654910612427940843[7] = delta_x[7] + nom_x[7]; + out_654910612427940843[8] = delta_x[8] + nom_x[8]; + out_654910612427940843[9] = delta_x[9] + nom_x[9]; + out_654910612427940843[10] = delta_x[10] + nom_x[10]; } -void inv_err_fun(double *nom_x, double *true_x, double *out_8058048663833159220) { - out_8058048663833159220[0] = -nom_x[0] + true_x[0]; - out_8058048663833159220[1] = -nom_x[1] + true_x[1]; - out_8058048663833159220[2] = -nom_x[2] + true_x[2]; - out_8058048663833159220[3] = -nom_x[3] + true_x[3]; - out_8058048663833159220[4] = -nom_x[4] + true_x[4]; - out_8058048663833159220[5] = -nom_x[5] + true_x[5]; - out_8058048663833159220[6] = -nom_x[6] + true_x[6]; - out_8058048663833159220[7] = -nom_x[7] + true_x[7]; - out_8058048663833159220[8] = -nom_x[8] + true_x[8]; - out_8058048663833159220[9] = -nom_x[9] + true_x[9]; - out_8058048663833159220[10] = -nom_x[10] + true_x[10]; +void inv_err_fun(double *nom_x, double *true_x, double *out_6637724801134549563) { + out_6637724801134549563[0] = -nom_x[0] + true_x[0]; + out_6637724801134549563[1] = -nom_x[1] + true_x[1]; + out_6637724801134549563[2] = -nom_x[2] + true_x[2]; + out_6637724801134549563[3] = -nom_x[3] + true_x[3]; + out_6637724801134549563[4] = -nom_x[4] + true_x[4]; + out_6637724801134549563[5] = -nom_x[5] + true_x[5]; + out_6637724801134549563[6] = -nom_x[6] + true_x[6]; + out_6637724801134549563[7] = -nom_x[7] + true_x[7]; + out_6637724801134549563[8] = -nom_x[8] + true_x[8]; + out_6637724801134549563[9] = -nom_x[9] + true_x[9]; + out_6637724801134549563[10] = -nom_x[10] + true_x[10]; } -void H_mod_fun(double *state, double *out_3690945488544052836) { - out_3690945488544052836[0] = 1.0; - out_3690945488544052836[1] = 0; - out_3690945488544052836[2] = 0; - out_3690945488544052836[3] = 0; - out_3690945488544052836[4] = 0; - out_3690945488544052836[5] = 0; - out_3690945488544052836[6] = 0; - out_3690945488544052836[7] = 0; - out_3690945488544052836[8] = 0; - out_3690945488544052836[9] = 0; - out_3690945488544052836[10] = 0; - out_3690945488544052836[11] = 0; - out_3690945488544052836[12] = 1.0; - out_3690945488544052836[13] = 0; - out_3690945488544052836[14] = 0; - out_3690945488544052836[15] = 0; - out_3690945488544052836[16] = 0; - out_3690945488544052836[17] = 0; - out_3690945488544052836[18] = 0; - out_3690945488544052836[19] = 0; - out_3690945488544052836[20] = 0; - out_3690945488544052836[21] = 0; - out_3690945488544052836[22] = 0; - out_3690945488544052836[23] = 0; - out_3690945488544052836[24] = 1.0; - out_3690945488544052836[25] = 0; - out_3690945488544052836[26] = 0; - out_3690945488544052836[27] = 0; - out_3690945488544052836[28] = 0; - out_3690945488544052836[29] = 0; - out_3690945488544052836[30] = 0; - out_3690945488544052836[31] = 0; - out_3690945488544052836[32] = 0; - out_3690945488544052836[33] = 0; - out_3690945488544052836[34] = 0; - out_3690945488544052836[35] = 0; - out_3690945488544052836[36] = 1.0; - out_3690945488544052836[37] = 0; - out_3690945488544052836[38] = 0; - out_3690945488544052836[39] = 0; - out_3690945488544052836[40] = 0; - out_3690945488544052836[41] = 0; - out_3690945488544052836[42] = 0; - out_3690945488544052836[43] = 0; - out_3690945488544052836[44] = 0; - out_3690945488544052836[45] = 0; - out_3690945488544052836[46] = 0; - out_3690945488544052836[47] = 0; - out_3690945488544052836[48] = 1.0; - out_3690945488544052836[49] = 0; - out_3690945488544052836[50] = 0; - out_3690945488544052836[51] = 0; - out_3690945488544052836[52] = 0; - out_3690945488544052836[53] = 0; - out_3690945488544052836[54] = 0; - out_3690945488544052836[55] = 0; - out_3690945488544052836[56] = 0; - out_3690945488544052836[57] = 0; - out_3690945488544052836[58] = 0; - out_3690945488544052836[59] = 0; - out_3690945488544052836[60] = 1.0; - out_3690945488544052836[61] = 0; - out_3690945488544052836[62] = 0; - out_3690945488544052836[63] = 0; - out_3690945488544052836[64] = 0; - out_3690945488544052836[65] = 0; - out_3690945488544052836[66] = 0; - out_3690945488544052836[67] = 0; - out_3690945488544052836[68] = 0; - out_3690945488544052836[69] = 0; - out_3690945488544052836[70] = 0; - out_3690945488544052836[71] = 0; - out_3690945488544052836[72] = 1.0; - out_3690945488544052836[73] = 0; - out_3690945488544052836[74] = 0; - out_3690945488544052836[75] = 0; - out_3690945488544052836[76] = 0; - out_3690945488544052836[77] = 0; - out_3690945488544052836[78] = 0; - out_3690945488544052836[79] = 0; - out_3690945488544052836[80] = 0; - out_3690945488544052836[81] = 0; - out_3690945488544052836[82] = 0; - out_3690945488544052836[83] = 0; - out_3690945488544052836[84] = 1.0; - out_3690945488544052836[85] = 0; - out_3690945488544052836[86] = 0; - out_3690945488544052836[87] = 0; - out_3690945488544052836[88] = 0; - out_3690945488544052836[89] = 0; - out_3690945488544052836[90] = 0; - out_3690945488544052836[91] = 0; - out_3690945488544052836[92] = 0; - out_3690945488544052836[93] = 0; - out_3690945488544052836[94] = 0; - out_3690945488544052836[95] = 0; - out_3690945488544052836[96] = 1.0; - out_3690945488544052836[97] = 0; - out_3690945488544052836[98] = 0; - out_3690945488544052836[99] = 0; - out_3690945488544052836[100] = 0; - out_3690945488544052836[101] = 0; - out_3690945488544052836[102] = 0; - out_3690945488544052836[103] = 0; - out_3690945488544052836[104] = 0; - out_3690945488544052836[105] = 0; - out_3690945488544052836[106] = 0; - out_3690945488544052836[107] = 0; - out_3690945488544052836[108] = 1.0; - out_3690945488544052836[109] = 0; - out_3690945488544052836[110] = 0; - out_3690945488544052836[111] = 0; - out_3690945488544052836[112] = 0; - out_3690945488544052836[113] = 0; - out_3690945488544052836[114] = 0; - out_3690945488544052836[115] = 0; - out_3690945488544052836[116] = 0; - out_3690945488544052836[117] = 0; - out_3690945488544052836[118] = 0; - out_3690945488544052836[119] = 0; - out_3690945488544052836[120] = 1.0; +void H_mod_fun(double *state, double *out_805386010827368873) { + out_805386010827368873[0] = 1.0; + out_805386010827368873[1] = 0; + out_805386010827368873[2] = 0; + out_805386010827368873[3] = 0; + out_805386010827368873[4] = 0; + out_805386010827368873[5] = 0; + out_805386010827368873[6] = 0; + out_805386010827368873[7] = 0; + out_805386010827368873[8] = 0; + out_805386010827368873[9] = 0; + out_805386010827368873[10] = 0; + out_805386010827368873[11] = 0; + out_805386010827368873[12] = 1.0; + out_805386010827368873[13] = 0; + out_805386010827368873[14] = 0; + out_805386010827368873[15] = 0; + out_805386010827368873[16] = 0; + out_805386010827368873[17] = 0; + out_805386010827368873[18] = 0; + out_805386010827368873[19] = 0; + out_805386010827368873[20] = 0; + out_805386010827368873[21] = 0; + out_805386010827368873[22] = 0; + out_805386010827368873[23] = 0; + out_805386010827368873[24] = 1.0; + out_805386010827368873[25] = 0; + out_805386010827368873[26] = 0; + out_805386010827368873[27] = 0; + out_805386010827368873[28] = 0; + out_805386010827368873[29] = 0; + out_805386010827368873[30] = 0; + out_805386010827368873[31] = 0; + out_805386010827368873[32] = 0; + out_805386010827368873[33] = 0; + out_805386010827368873[34] = 0; + out_805386010827368873[35] = 0; + out_805386010827368873[36] = 1.0; + out_805386010827368873[37] = 0; + out_805386010827368873[38] = 0; + out_805386010827368873[39] = 0; + out_805386010827368873[40] = 0; + out_805386010827368873[41] = 0; + out_805386010827368873[42] = 0; + out_805386010827368873[43] = 0; + out_805386010827368873[44] = 0; + out_805386010827368873[45] = 0; + out_805386010827368873[46] = 0; + out_805386010827368873[47] = 0; + out_805386010827368873[48] = 1.0; + out_805386010827368873[49] = 0; + out_805386010827368873[50] = 0; + out_805386010827368873[51] = 0; + out_805386010827368873[52] = 0; + out_805386010827368873[53] = 0; + out_805386010827368873[54] = 0; + out_805386010827368873[55] = 0; + out_805386010827368873[56] = 0; + out_805386010827368873[57] = 0; + out_805386010827368873[58] = 0; + out_805386010827368873[59] = 0; + out_805386010827368873[60] = 1.0; + out_805386010827368873[61] = 0; + out_805386010827368873[62] = 0; + out_805386010827368873[63] = 0; + out_805386010827368873[64] = 0; + out_805386010827368873[65] = 0; + out_805386010827368873[66] = 0; + out_805386010827368873[67] = 0; + out_805386010827368873[68] = 0; + out_805386010827368873[69] = 0; + out_805386010827368873[70] = 0; + out_805386010827368873[71] = 0; + out_805386010827368873[72] = 1.0; + out_805386010827368873[73] = 0; + out_805386010827368873[74] = 0; + out_805386010827368873[75] = 0; + out_805386010827368873[76] = 0; + out_805386010827368873[77] = 0; + out_805386010827368873[78] = 0; + out_805386010827368873[79] = 0; + out_805386010827368873[80] = 0; + out_805386010827368873[81] = 0; + out_805386010827368873[82] = 0; + out_805386010827368873[83] = 0; + out_805386010827368873[84] = 1.0; + out_805386010827368873[85] = 0; + out_805386010827368873[86] = 0; + out_805386010827368873[87] = 0; + out_805386010827368873[88] = 0; + out_805386010827368873[89] = 0; + out_805386010827368873[90] = 0; + out_805386010827368873[91] = 0; + out_805386010827368873[92] = 0; + out_805386010827368873[93] = 0; + out_805386010827368873[94] = 0; + out_805386010827368873[95] = 0; + out_805386010827368873[96] = 1.0; + out_805386010827368873[97] = 0; + out_805386010827368873[98] = 0; + out_805386010827368873[99] = 0; + out_805386010827368873[100] = 0; + out_805386010827368873[101] = 0; + out_805386010827368873[102] = 0; + out_805386010827368873[103] = 0; + out_805386010827368873[104] = 0; + out_805386010827368873[105] = 0; + out_805386010827368873[106] = 0; + out_805386010827368873[107] = 0; + out_805386010827368873[108] = 1.0; + out_805386010827368873[109] = 0; + out_805386010827368873[110] = 0; + out_805386010827368873[111] = 0; + out_805386010827368873[112] = 0; + out_805386010827368873[113] = 0; + out_805386010827368873[114] = 0; + out_805386010827368873[115] = 0; + out_805386010827368873[116] = 0; + out_805386010827368873[117] = 0; + out_805386010827368873[118] = 0; + out_805386010827368873[119] = 0; + out_805386010827368873[120] = 1.0; } -void f_fun(double *state, double dt, double *out_2954456239899519205) { - out_2954456239899519205[0] = dt*state[3] + state[0]; - out_2954456239899519205[1] = dt*state[4] + state[1]; - out_2954456239899519205[2] = dt*state[5] + state[2]; - out_2954456239899519205[3] = state[3]; - out_2954456239899519205[4] = state[4]; - out_2954456239899519205[5] = state[5]; - out_2954456239899519205[6] = dt*state[7] + state[6]; - out_2954456239899519205[7] = dt*state[8] + state[7]; - out_2954456239899519205[8] = state[8]; - out_2954456239899519205[9] = state[9]; - out_2954456239899519205[10] = state[10]; +void f_fun(double *state, double dt, double *out_4766656596405504851) { + out_4766656596405504851[0] = dt*state[3] + state[0]; + out_4766656596405504851[1] = dt*state[4] + state[1]; + out_4766656596405504851[2] = dt*state[5] + state[2]; + out_4766656596405504851[3] = state[3]; + out_4766656596405504851[4] = state[4]; + out_4766656596405504851[5] = state[5]; + out_4766656596405504851[6] = dt*state[7] + state[6]; + out_4766656596405504851[7] = dt*state[8] + state[7]; + out_4766656596405504851[8] = state[8]; + out_4766656596405504851[9] = state[9]; + out_4766656596405504851[10] = state[10]; } -void F_fun(double *state, double dt, double *out_709514566261682476) { - out_709514566261682476[0] = 1; - out_709514566261682476[1] = 0; - out_709514566261682476[2] = 0; - out_709514566261682476[3] = dt; - out_709514566261682476[4] = 0; - out_709514566261682476[5] = 0; - out_709514566261682476[6] = 0; - out_709514566261682476[7] = 0; - out_709514566261682476[8] = 0; - out_709514566261682476[9] = 0; - out_709514566261682476[10] = 0; - out_709514566261682476[11] = 0; - out_709514566261682476[12] = 1; - out_709514566261682476[13] = 0; - out_709514566261682476[14] = 0; - out_709514566261682476[15] = dt; - out_709514566261682476[16] = 0; - out_709514566261682476[17] = 0; - out_709514566261682476[18] = 0; - out_709514566261682476[19] = 0; - out_709514566261682476[20] = 0; - out_709514566261682476[21] = 0; - out_709514566261682476[22] = 0; - out_709514566261682476[23] = 0; - out_709514566261682476[24] = 1; - out_709514566261682476[25] = 0; - out_709514566261682476[26] = 0; - out_709514566261682476[27] = dt; - out_709514566261682476[28] = 0; - out_709514566261682476[29] = 0; - out_709514566261682476[30] = 0; - out_709514566261682476[31] = 0; - out_709514566261682476[32] = 0; - out_709514566261682476[33] = 0; - out_709514566261682476[34] = 0; - out_709514566261682476[35] = 0; - out_709514566261682476[36] = 1; - out_709514566261682476[37] = 0; - out_709514566261682476[38] = 0; - out_709514566261682476[39] = 0; - out_709514566261682476[40] = 0; - out_709514566261682476[41] = 0; - out_709514566261682476[42] = 0; - out_709514566261682476[43] = 0; - out_709514566261682476[44] = 0; - out_709514566261682476[45] = 0; - out_709514566261682476[46] = 0; - out_709514566261682476[47] = 0; - out_709514566261682476[48] = 1; - out_709514566261682476[49] = 0; - out_709514566261682476[50] = 0; - out_709514566261682476[51] = 0; - out_709514566261682476[52] = 0; - out_709514566261682476[53] = 0; - out_709514566261682476[54] = 0; - out_709514566261682476[55] = 0; - out_709514566261682476[56] = 0; - out_709514566261682476[57] = 0; - out_709514566261682476[58] = 0; - out_709514566261682476[59] = 0; - out_709514566261682476[60] = 1; - out_709514566261682476[61] = 0; - out_709514566261682476[62] = 0; - out_709514566261682476[63] = 0; - out_709514566261682476[64] = 0; - out_709514566261682476[65] = 0; - out_709514566261682476[66] = 0; - out_709514566261682476[67] = 0; - out_709514566261682476[68] = 0; - out_709514566261682476[69] = 0; - out_709514566261682476[70] = 0; - out_709514566261682476[71] = 0; - out_709514566261682476[72] = 1; - out_709514566261682476[73] = dt; - out_709514566261682476[74] = 0; - out_709514566261682476[75] = 0; - out_709514566261682476[76] = 0; - out_709514566261682476[77] = 0; - out_709514566261682476[78] = 0; - out_709514566261682476[79] = 0; - out_709514566261682476[80] = 0; - out_709514566261682476[81] = 0; - out_709514566261682476[82] = 0; - out_709514566261682476[83] = 0; - out_709514566261682476[84] = 1; - out_709514566261682476[85] = dt; - out_709514566261682476[86] = 0; - out_709514566261682476[87] = 0; - out_709514566261682476[88] = 0; - out_709514566261682476[89] = 0; - out_709514566261682476[90] = 0; - out_709514566261682476[91] = 0; - out_709514566261682476[92] = 0; - out_709514566261682476[93] = 0; - out_709514566261682476[94] = 0; - out_709514566261682476[95] = 0; - out_709514566261682476[96] = 1; - out_709514566261682476[97] = 0; - out_709514566261682476[98] = 0; - out_709514566261682476[99] = 0; - out_709514566261682476[100] = 0; - out_709514566261682476[101] = 0; - out_709514566261682476[102] = 0; - out_709514566261682476[103] = 0; - out_709514566261682476[104] = 0; - out_709514566261682476[105] = 0; - out_709514566261682476[106] = 0; - out_709514566261682476[107] = 0; - out_709514566261682476[108] = 1; - out_709514566261682476[109] = 0; - out_709514566261682476[110] = 0; - out_709514566261682476[111] = 0; - out_709514566261682476[112] = 0; - out_709514566261682476[113] = 0; - out_709514566261682476[114] = 0; - out_709514566261682476[115] = 0; - out_709514566261682476[116] = 0; - out_709514566261682476[117] = 0; - out_709514566261682476[118] = 0; - out_709514566261682476[119] = 0; - out_709514566261682476[120] = 1; +void F_fun(double *state, double dt, double *out_4029299056587768608) { + out_4029299056587768608[0] = 1; + out_4029299056587768608[1] = 0; + out_4029299056587768608[2] = 0; + out_4029299056587768608[3] = dt; + out_4029299056587768608[4] = 0; + out_4029299056587768608[5] = 0; + out_4029299056587768608[6] = 0; + out_4029299056587768608[7] = 0; + out_4029299056587768608[8] = 0; + out_4029299056587768608[9] = 0; + out_4029299056587768608[10] = 0; + out_4029299056587768608[11] = 0; + out_4029299056587768608[12] = 1; + out_4029299056587768608[13] = 0; + out_4029299056587768608[14] = 0; + out_4029299056587768608[15] = dt; + out_4029299056587768608[16] = 0; + out_4029299056587768608[17] = 0; + out_4029299056587768608[18] = 0; + out_4029299056587768608[19] = 0; + out_4029299056587768608[20] = 0; + out_4029299056587768608[21] = 0; + out_4029299056587768608[22] = 0; + out_4029299056587768608[23] = 0; + out_4029299056587768608[24] = 1; + out_4029299056587768608[25] = 0; + out_4029299056587768608[26] = 0; + out_4029299056587768608[27] = dt; + out_4029299056587768608[28] = 0; + out_4029299056587768608[29] = 0; + out_4029299056587768608[30] = 0; + out_4029299056587768608[31] = 0; + out_4029299056587768608[32] = 0; + out_4029299056587768608[33] = 0; + out_4029299056587768608[34] = 0; + out_4029299056587768608[35] = 0; + out_4029299056587768608[36] = 1; + out_4029299056587768608[37] = 0; + out_4029299056587768608[38] = 0; + out_4029299056587768608[39] = 0; + out_4029299056587768608[40] = 0; + out_4029299056587768608[41] = 0; + out_4029299056587768608[42] = 0; + out_4029299056587768608[43] = 0; + out_4029299056587768608[44] = 0; + out_4029299056587768608[45] = 0; + out_4029299056587768608[46] = 0; + out_4029299056587768608[47] = 0; + out_4029299056587768608[48] = 1; + out_4029299056587768608[49] = 0; + out_4029299056587768608[50] = 0; + out_4029299056587768608[51] = 0; + out_4029299056587768608[52] = 0; + out_4029299056587768608[53] = 0; + out_4029299056587768608[54] = 0; + out_4029299056587768608[55] = 0; + out_4029299056587768608[56] = 0; + out_4029299056587768608[57] = 0; + out_4029299056587768608[58] = 0; + out_4029299056587768608[59] = 0; + out_4029299056587768608[60] = 1; + out_4029299056587768608[61] = 0; + out_4029299056587768608[62] = 0; + out_4029299056587768608[63] = 0; + out_4029299056587768608[64] = 0; + out_4029299056587768608[65] = 0; + out_4029299056587768608[66] = 0; + out_4029299056587768608[67] = 0; + out_4029299056587768608[68] = 0; + out_4029299056587768608[69] = 0; + out_4029299056587768608[70] = 0; + out_4029299056587768608[71] = 0; + out_4029299056587768608[72] = 1; + out_4029299056587768608[73] = dt; + out_4029299056587768608[74] = 0; + out_4029299056587768608[75] = 0; + out_4029299056587768608[76] = 0; + out_4029299056587768608[77] = 0; + out_4029299056587768608[78] = 0; + out_4029299056587768608[79] = 0; + out_4029299056587768608[80] = 0; + out_4029299056587768608[81] = 0; + out_4029299056587768608[82] = 0; + out_4029299056587768608[83] = 0; + out_4029299056587768608[84] = 1; + out_4029299056587768608[85] = dt; + out_4029299056587768608[86] = 0; + out_4029299056587768608[87] = 0; + out_4029299056587768608[88] = 0; + out_4029299056587768608[89] = 0; + out_4029299056587768608[90] = 0; + out_4029299056587768608[91] = 0; + out_4029299056587768608[92] = 0; + out_4029299056587768608[93] = 0; + out_4029299056587768608[94] = 0; + out_4029299056587768608[95] = 0; + out_4029299056587768608[96] = 1; + out_4029299056587768608[97] = 0; + out_4029299056587768608[98] = 0; + out_4029299056587768608[99] = 0; + out_4029299056587768608[100] = 0; + out_4029299056587768608[101] = 0; + out_4029299056587768608[102] = 0; + out_4029299056587768608[103] = 0; + out_4029299056587768608[104] = 0; + out_4029299056587768608[105] = 0; + out_4029299056587768608[106] = 0; + out_4029299056587768608[107] = 0; + out_4029299056587768608[108] = 1; + out_4029299056587768608[109] = 0; + out_4029299056587768608[110] = 0; + out_4029299056587768608[111] = 0; + out_4029299056587768608[112] = 0; + out_4029299056587768608[113] = 0; + out_4029299056587768608[114] = 0; + out_4029299056587768608[115] = 0; + out_4029299056587768608[116] = 0; + out_4029299056587768608[117] = 0; + out_4029299056587768608[118] = 0; + out_4029299056587768608[119] = 0; + out_4029299056587768608[120] = 1; } -void h_6(double *state, double *sat_pos, double *out_2648966289655583926) { - out_2648966289655583926[0] = sqrt(pow(-sat_pos[0] + state[0], 2) + pow(-sat_pos[1] + state[1], 2) + pow(-sat_pos[2] + state[2], 2)) + state[6]; +void h_6(double *state, double *sat_pos, double *out_1067178731754715050) { + out_1067178731754715050[0] = sqrt(pow(-sat_pos[0] + state[0], 2) + pow(-sat_pos[1] + state[1], 2) + pow(-sat_pos[2] + state[2], 2)) + state[6]; } -void H_6(double *state, double *sat_pos, double *out_1516634108393932450) { - out_1516634108393932450[0] = (-sat_pos[0] + state[0])/sqrt(pow(-sat_pos[0] + state[0], 2) + pow(-sat_pos[1] + state[1], 2) + pow(-sat_pos[2] + state[2], 2)); - out_1516634108393932450[1] = (-sat_pos[1] + state[1])/sqrt(pow(-sat_pos[0] + state[0], 2) + pow(-sat_pos[1] + state[1], 2) + pow(-sat_pos[2] + state[2], 2)); - out_1516634108393932450[2] = (-sat_pos[2] + state[2])/sqrt(pow(-sat_pos[0] + state[0], 2) + pow(-sat_pos[1] + state[1], 2) + pow(-sat_pos[2] + state[2], 2)); - out_1516634108393932450[3] = 0; - out_1516634108393932450[4] = 0; - out_1516634108393932450[5] = 0; - out_1516634108393932450[6] = 1; - out_1516634108393932450[7] = 0; - out_1516634108393932450[8] = 0; - out_1516634108393932450[9] = 0; - out_1516634108393932450[10] = 0; +void H_6(double *state, double *sat_pos, double *out_7962220724729872721) { + out_7962220724729872721[0] = (-sat_pos[0] + state[0])/sqrt(pow(-sat_pos[0] + state[0], 2) + pow(-sat_pos[1] + state[1], 2) + pow(-sat_pos[2] + state[2], 2)); + out_7962220724729872721[1] = (-sat_pos[1] + state[1])/sqrt(pow(-sat_pos[0] + state[0], 2) + pow(-sat_pos[1] + state[1], 2) + pow(-sat_pos[2] + state[2], 2)); + out_7962220724729872721[2] = (-sat_pos[2] + state[2])/sqrt(pow(-sat_pos[0] + state[0], 2) + pow(-sat_pos[1] + state[1], 2) + pow(-sat_pos[2] + state[2], 2)); + out_7962220724729872721[3] = 0; + out_7962220724729872721[4] = 0; + out_7962220724729872721[5] = 0; + out_7962220724729872721[6] = 1; + out_7962220724729872721[7] = 0; + out_7962220724729872721[8] = 0; + out_7962220724729872721[9] = 0; + out_7962220724729872721[10] = 0; } -void h_20(double *state, double *sat_pos, double *out_1322673160422067744) { - out_1322673160422067744[0] = sqrt(pow(-sat_pos[0] + state[0], 2) + pow(-sat_pos[1] + state[1], 2) + pow(-sat_pos[2] + state[2], 2)) + sat_pos[3]*state[10] + state[6] + state[9]; +void h_20(double *state, double *sat_pos, double *out_7444431052127272697) { + out_7444431052127272697[0] = sqrt(pow(-sat_pos[0] + state[0], 2) + pow(-sat_pos[1] + state[1], 2) + pow(-sat_pos[2] + state[2], 2)) + sat_pos[3]*state[10] + state[6] + state[9]; } -void H_20(double *state, double *sat_pos, double *out_6746823634573947585) { - out_6746823634573947585[0] = (-sat_pos[0] + state[0])/sqrt(pow(-sat_pos[0] + state[0], 2) + pow(-sat_pos[1] + state[1], 2) + pow(-sat_pos[2] + state[2], 2)); - out_6746823634573947585[1] = (-sat_pos[1] + state[1])/sqrt(pow(-sat_pos[0] + state[0], 2) + pow(-sat_pos[1] + state[1], 2) + pow(-sat_pos[2] + state[2], 2)); - out_6746823634573947585[2] = (-sat_pos[2] + state[2])/sqrt(pow(-sat_pos[0] + state[0], 2) + pow(-sat_pos[1] + state[1], 2) + pow(-sat_pos[2] + state[2], 2)); - out_6746823634573947585[3] = 0; - out_6746823634573947585[4] = 0; - out_6746823634573947585[5] = 0; - out_6746823634573947585[6] = 1; - out_6746823634573947585[7] = 0; - out_6746823634573947585[8] = 0; - out_6746823634573947585[9] = 1; - out_6746823634573947585[10] = sat_pos[3]; +void H_20(double *state, double *sat_pos, double *out_799492558915393744) { + out_799492558915393744[0] = (-sat_pos[0] + state[0])/sqrt(pow(-sat_pos[0] + state[0], 2) + pow(-sat_pos[1] + state[1], 2) + pow(-sat_pos[2] + state[2], 2)); + out_799492558915393744[1] = (-sat_pos[1] + state[1])/sqrt(pow(-sat_pos[0] + state[0], 2) + pow(-sat_pos[1] + state[1], 2) + pow(-sat_pos[2] + state[2], 2)); + out_799492558915393744[2] = (-sat_pos[2] + state[2])/sqrt(pow(-sat_pos[0] + state[0], 2) + pow(-sat_pos[1] + state[1], 2) + pow(-sat_pos[2] + state[2], 2)); + out_799492558915393744[3] = 0; + out_799492558915393744[4] = 0; + out_799492558915393744[5] = 0; + out_799492558915393744[6] = 1; + out_799492558915393744[7] = 0; + out_799492558915393744[8] = 0; + out_799492558915393744[9] = 1; + out_799492558915393744[10] = sat_pos[3]; } -void h_7(double *state, double *sat_pos_vel, double *out_3768133833178917308) { - out_3768133833178917308[0] = (sat_pos_vel[0] - state[0])*(sat_pos_vel[3] - state[3])/sqrt(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2)) + (sat_pos_vel[1] - state[1])*(sat_pos_vel[4] - state[4])/sqrt(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2)) + (sat_pos_vel[2] - state[2])*(sat_pos_vel[5] - state[5])/sqrt(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2)) + state[7]; +void h_7(double *state, double *sat_pos_vel, double *out_7430002568771021643) { + out_7430002568771021643[0] = (sat_pos_vel[0] - state[0])*(sat_pos_vel[3] - state[3])/sqrt(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2)) + (sat_pos_vel[1] - state[1])*(sat_pos_vel[4] - state[4])/sqrt(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2)) + (sat_pos_vel[2] - state[2])*(sat_pos_vel[5] - state[5])/sqrt(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2)) + state[7]; } -void H_7(double *state, double *sat_pos_vel, double *out_6978532755514735815) { - out_6978532755514735815[0] = pow(sat_pos_vel[0] - state[0], 2)*(sat_pos_vel[3] - state[3])/pow(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2), 3.0/2.0) + (sat_pos_vel[0] - state[0])*(sat_pos_vel[1] - state[1])*(sat_pos_vel[4] - state[4])/pow(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2), 3.0/2.0) + (sat_pos_vel[0] - state[0])*(sat_pos_vel[2] - state[2])*(sat_pos_vel[5] - state[5])/pow(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2), 3.0/2.0) - (sat_pos_vel[3] - state[3])/sqrt(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2)); - out_6978532755514735815[1] = (sat_pos_vel[0] - state[0])*(sat_pos_vel[1] - state[1])*(sat_pos_vel[3] - state[3])/pow(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2), 3.0/2.0) + pow(sat_pos_vel[1] - state[1], 2)*(sat_pos_vel[4] - state[4])/pow(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2), 3.0/2.0) + (sat_pos_vel[1] - state[1])*(sat_pos_vel[2] - state[2])*(sat_pos_vel[5] - state[5])/pow(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2), 3.0/2.0) - (sat_pos_vel[4] - state[4])/sqrt(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2)); - out_6978532755514735815[2] = (sat_pos_vel[0] - state[0])*(sat_pos_vel[2] - state[2])*(sat_pos_vel[3] - state[3])/pow(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2), 3.0/2.0) + (sat_pos_vel[1] - state[1])*(sat_pos_vel[2] - state[2])*(sat_pos_vel[4] - state[4])/pow(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2), 3.0/2.0) + pow(sat_pos_vel[2] - state[2], 2)*(sat_pos_vel[5] - state[5])/pow(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2), 3.0/2.0) - (sat_pos_vel[5] - state[5])/sqrt(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2)); - out_6978532755514735815[3] = -(sat_pos_vel[0] - state[0])/sqrt(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2)); - out_6978532755514735815[4] = -(sat_pos_vel[1] - state[1])/sqrt(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2)); - out_6978532755514735815[5] = -(sat_pos_vel[2] - state[2])/sqrt(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2)); - out_6978532755514735815[6] = 0; - out_6978532755514735815[7] = 1; - out_6978532755514735815[8] = 0; - out_6978532755514735815[9] = 0; - out_6978532755514735815[10] = 0; +void H_7(double *state, double *sat_pos_vel, double *out_7060224876276749950) { + out_7060224876276749950[0] = pow(sat_pos_vel[0] - state[0], 2)*(sat_pos_vel[3] - state[3])/pow(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2), 3.0/2.0) + (sat_pos_vel[0] - state[0])*(sat_pos_vel[1] - state[1])*(sat_pos_vel[4] - state[4])/pow(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2), 3.0/2.0) + (sat_pos_vel[0] - state[0])*(sat_pos_vel[2] - state[2])*(sat_pos_vel[5] - state[5])/pow(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2), 3.0/2.0) - (sat_pos_vel[3] - state[3])/sqrt(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2)); + out_7060224876276749950[1] = (sat_pos_vel[0] - state[0])*(sat_pos_vel[1] - state[1])*(sat_pos_vel[3] - state[3])/pow(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2), 3.0/2.0) + pow(sat_pos_vel[1] - state[1], 2)*(sat_pos_vel[4] - state[4])/pow(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2), 3.0/2.0) + (sat_pos_vel[1] - state[1])*(sat_pos_vel[2] - state[2])*(sat_pos_vel[5] - state[5])/pow(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2), 3.0/2.0) - (sat_pos_vel[4] - state[4])/sqrt(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2)); + out_7060224876276749950[2] = (sat_pos_vel[0] - state[0])*(sat_pos_vel[2] - state[2])*(sat_pos_vel[3] - state[3])/pow(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2), 3.0/2.0) + (sat_pos_vel[1] - state[1])*(sat_pos_vel[2] - state[2])*(sat_pos_vel[4] - state[4])/pow(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2), 3.0/2.0) + pow(sat_pos_vel[2] - state[2], 2)*(sat_pos_vel[5] - state[5])/pow(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2), 3.0/2.0) - (sat_pos_vel[5] - state[5])/sqrt(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2)); + out_7060224876276749950[3] = -(sat_pos_vel[0] - state[0])/sqrt(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2)); + out_7060224876276749950[4] = -(sat_pos_vel[1] - state[1])/sqrt(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2)); + out_7060224876276749950[5] = -(sat_pos_vel[2] - state[2])/sqrt(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2)); + out_7060224876276749950[6] = 0; + out_7060224876276749950[7] = 1; + out_7060224876276749950[8] = 0; + out_7060224876276749950[9] = 0; + out_7060224876276749950[10] = 0; } -void h_21(double *state, double *sat_pos_vel, double *out_3768133833178917308) { - out_3768133833178917308[0] = (sat_pos_vel[0] - state[0])*(sat_pos_vel[3] - state[3])/sqrt(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2)) + (sat_pos_vel[1] - state[1])*(sat_pos_vel[4] - state[4])/sqrt(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2)) + (sat_pos_vel[2] - state[2])*(sat_pos_vel[5] - state[5])/sqrt(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2)) + state[7]; +void h_21(double *state, double *sat_pos_vel, double *out_7430002568771021643) { + out_7430002568771021643[0] = (sat_pos_vel[0] - state[0])*(sat_pos_vel[3] - state[3])/sqrt(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2)) + (sat_pos_vel[1] - state[1])*(sat_pos_vel[4] - state[4])/sqrt(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2)) + (sat_pos_vel[2] - state[2])*(sat_pos_vel[5] - state[5])/sqrt(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2)) + state[7]; } -void H_21(double *state, double *sat_pos_vel, double *out_6978532755514735815) { - out_6978532755514735815[0] = pow(sat_pos_vel[0] - state[0], 2)*(sat_pos_vel[3] - state[3])/pow(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2), 3.0/2.0) + (sat_pos_vel[0] - state[0])*(sat_pos_vel[1] - state[1])*(sat_pos_vel[4] - state[4])/pow(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2), 3.0/2.0) + (sat_pos_vel[0] - state[0])*(sat_pos_vel[2] - state[2])*(sat_pos_vel[5] - state[5])/pow(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2), 3.0/2.0) - (sat_pos_vel[3] - state[3])/sqrt(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2)); - out_6978532755514735815[1] = (sat_pos_vel[0] - state[0])*(sat_pos_vel[1] - state[1])*(sat_pos_vel[3] - state[3])/pow(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2), 3.0/2.0) + pow(sat_pos_vel[1] - state[1], 2)*(sat_pos_vel[4] - state[4])/pow(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2), 3.0/2.0) + (sat_pos_vel[1] - state[1])*(sat_pos_vel[2] - state[2])*(sat_pos_vel[5] - state[5])/pow(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2), 3.0/2.0) - (sat_pos_vel[4] - state[4])/sqrt(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2)); - out_6978532755514735815[2] = (sat_pos_vel[0] - state[0])*(sat_pos_vel[2] - state[2])*(sat_pos_vel[3] - state[3])/pow(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2), 3.0/2.0) + (sat_pos_vel[1] - state[1])*(sat_pos_vel[2] - state[2])*(sat_pos_vel[4] - state[4])/pow(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2), 3.0/2.0) + pow(sat_pos_vel[2] - state[2], 2)*(sat_pos_vel[5] - state[5])/pow(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2), 3.0/2.0) - (sat_pos_vel[5] - state[5])/sqrt(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2)); - out_6978532755514735815[3] = -(sat_pos_vel[0] - state[0])/sqrt(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2)); - out_6978532755514735815[4] = -(sat_pos_vel[1] - state[1])/sqrt(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2)); - out_6978532755514735815[5] = -(sat_pos_vel[2] - state[2])/sqrt(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2)); - out_6978532755514735815[6] = 0; - out_6978532755514735815[7] = 1; - out_6978532755514735815[8] = 0; - out_6978532755514735815[9] = 0; - out_6978532755514735815[10] = 0; +void H_21(double *state, double *sat_pos_vel, double *out_7060224876276749950) { + out_7060224876276749950[0] = pow(sat_pos_vel[0] - state[0], 2)*(sat_pos_vel[3] - state[3])/pow(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2), 3.0/2.0) + (sat_pos_vel[0] - state[0])*(sat_pos_vel[1] - state[1])*(sat_pos_vel[4] - state[4])/pow(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2), 3.0/2.0) + (sat_pos_vel[0] - state[0])*(sat_pos_vel[2] - state[2])*(sat_pos_vel[5] - state[5])/pow(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2), 3.0/2.0) - (sat_pos_vel[3] - state[3])/sqrt(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2)); + out_7060224876276749950[1] = (sat_pos_vel[0] - state[0])*(sat_pos_vel[1] - state[1])*(sat_pos_vel[3] - state[3])/pow(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2), 3.0/2.0) + pow(sat_pos_vel[1] - state[1], 2)*(sat_pos_vel[4] - state[4])/pow(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2), 3.0/2.0) + (sat_pos_vel[1] - state[1])*(sat_pos_vel[2] - state[2])*(sat_pos_vel[5] - state[5])/pow(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2), 3.0/2.0) - (sat_pos_vel[4] - state[4])/sqrt(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2)); + out_7060224876276749950[2] = (sat_pos_vel[0] - state[0])*(sat_pos_vel[2] - state[2])*(sat_pos_vel[3] - state[3])/pow(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2), 3.0/2.0) + (sat_pos_vel[1] - state[1])*(sat_pos_vel[2] - state[2])*(sat_pos_vel[4] - state[4])/pow(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2), 3.0/2.0) + pow(sat_pos_vel[2] - state[2], 2)*(sat_pos_vel[5] - state[5])/pow(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2), 3.0/2.0) - (sat_pos_vel[5] - state[5])/sqrt(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2)); + out_7060224876276749950[3] = -(sat_pos_vel[0] - state[0])/sqrt(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2)); + out_7060224876276749950[4] = -(sat_pos_vel[1] - state[1])/sqrt(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2)); + out_7060224876276749950[5] = -(sat_pos_vel[2] - state[2])/sqrt(pow(sat_pos_vel[0] - state[0], 2) + pow(sat_pos_vel[1] - state[1], 2) + pow(sat_pos_vel[2] - state[2], 2)); + out_7060224876276749950[6] = 0; + out_7060224876276749950[7] = 1; + out_7060224876276749950[8] = 0; + out_7060224876276749950[9] = 0; + out_7060224876276749950[10] = 0; } #include #include @@ -506,44 +506,44 @@ void gnss_update_7(double *in_x, double *in_P, double *in_z, double *in_R, doubl void gnss_update_21(double *in_x, double *in_P, double *in_z, double *in_R, double *in_ea) { update<1, 3, 0>(in_x, in_P, h_21, H_21, NULL, in_z, in_R, in_ea, MAHA_THRESH_21); } -void gnss_err_fun(double *nom_x, double *delta_x, double *out_4281415265925619745) { - err_fun(nom_x, delta_x, out_4281415265925619745); +void gnss_err_fun(double *nom_x, double *delta_x, double *out_654910612427940843) { + err_fun(nom_x, delta_x, out_654910612427940843); } -void gnss_inv_err_fun(double *nom_x, double *true_x, double *out_8058048663833159220) { - inv_err_fun(nom_x, true_x, out_8058048663833159220); +void gnss_inv_err_fun(double *nom_x, double *true_x, double *out_6637724801134549563) { + inv_err_fun(nom_x, true_x, out_6637724801134549563); } -void gnss_H_mod_fun(double *state, double *out_3690945488544052836) { - H_mod_fun(state, out_3690945488544052836); +void gnss_H_mod_fun(double *state, double *out_805386010827368873) { + H_mod_fun(state, out_805386010827368873); } -void gnss_f_fun(double *state, double dt, double *out_2954456239899519205) { - f_fun(state, dt, out_2954456239899519205); +void gnss_f_fun(double *state, double dt, double *out_4766656596405504851) { + f_fun(state, dt, out_4766656596405504851); } -void gnss_F_fun(double *state, double dt, double *out_709514566261682476) { - F_fun(state, dt, out_709514566261682476); +void gnss_F_fun(double *state, double dt, double *out_4029299056587768608) { + F_fun(state, dt, out_4029299056587768608); } -void gnss_h_6(double *state, double *sat_pos, double *out_2648966289655583926) { - h_6(state, sat_pos, out_2648966289655583926); +void gnss_h_6(double *state, double *sat_pos, double *out_1067178731754715050) { + h_6(state, sat_pos, out_1067178731754715050); } -void gnss_H_6(double *state, double *sat_pos, double *out_1516634108393932450) { - H_6(state, sat_pos, out_1516634108393932450); +void gnss_H_6(double *state, double *sat_pos, double *out_7962220724729872721) { + H_6(state, sat_pos, out_7962220724729872721); } -void gnss_h_20(double *state, double *sat_pos, double *out_1322673160422067744) { - h_20(state, sat_pos, out_1322673160422067744); +void gnss_h_20(double *state, double *sat_pos, double *out_7444431052127272697) { + h_20(state, sat_pos, out_7444431052127272697); } -void gnss_H_20(double *state, double *sat_pos, double *out_6746823634573947585) { - H_20(state, sat_pos, out_6746823634573947585); +void gnss_H_20(double *state, double *sat_pos, double *out_799492558915393744) { + H_20(state, sat_pos, out_799492558915393744); } -void gnss_h_7(double *state, double *sat_pos_vel, double *out_3768133833178917308) { - h_7(state, sat_pos_vel, out_3768133833178917308); +void gnss_h_7(double *state, double *sat_pos_vel, double *out_7430002568771021643) { + h_7(state, sat_pos_vel, out_7430002568771021643); } -void gnss_H_7(double *state, double *sat_pos_vel, double *out_6978532755514735815) { - H_7(state, sat_pos_vel, out_6978532755514735815); +void gnss_H_7(double *state, double *sat_pos_vel, double *out_7060224876276749950) { + H_7(state, sat_pos_vel, out_7060224876276749950); } -void gnss_h_21(double *state, double *sat_pos_vel, double *out_3768133833178917308) { - h_21(state, sat_pos_vel, out_3768133833178917308); +void gnss_h_21(double *state, double *sat_pos_vel, double *out_7430002568771021643) { + h_21(state, sat_pos_vel, out_7430002568771021643); } -void gnss_H_21(double *state, double *sat_pos_vel, double *out_6978532755514735815) { - H_21(state, sat_pos_vel, out_6978532755514735815); +void gnss_H_21(double *state, double *sat_pos_vel, double *out_7060224876276749950) { + H_21(state, sat_pos_vel, out_7060224876276749950); } void gnss_predict(double *in_x, double *in_P, double *in_Q, double dt) { predict(in_x, in_P, in_Q, dt); diff --git a/selfdrive/locationd/models/generated/gnss.h b/selfdrive/locationd/models/generated/gnss.h index ee031ed22..4d7136256 100644 --- a/selfdrive/locationd/models/generated/gnss.h +++ b/selfdrive/locationd/models/generated/gnss.h @@ -5,18 +5,18 @@ void gnss_update_6(double *in_x, double *in_P, double *in_z, double *in_R, doubl void gnss_update_20(double *in_x, double *in_P, double *in_z, double *in_R, double *in_ea); void gnss_update_7(double *in_x, double *in_P, double *in_z, double *in_R, double *in_ea); void gnss_update_21(double *in_x, double *in_P, double *in_z, double *in_R, double *in_ea); -void gnss_err_fun(double *nom_x, double *delta_x, double *out_4281415265925619745); -void gnss_inv_err_fun(double *nom_x, double *true_x, double *out_8058048663833159220); -void gnss_H_mod_fun(double *state, double *out_3690945488544052836); -void gnss_f_fun(double *state, double dt, double *out_2954456239899519205); -void gnss_F_fun(double *state, double dt, double *out_709514566261682476); -void gnss_h_6(double *state, double *sat_pos, double *out_2648966289655583926); -void gnss_H_6(double *state, double *sat_pos, double *out_1516634108393932450); -void gnss_h_20(double *state, double *sat_pos, double *out_1322673160422067744); -void gnss_H_20(double *state, double *sat_pos, double *out_6746823634573947585); -void gnss_h_7(double *state, double *sat_pos_vel, double *out_3768133833178917308); -void gnss_H_7(double *state, double *sat_pos_vel, double *out_6978532755514735815); -void gnss_h_21(double *state, double *sat_pos_vel, double *out_3768133833178917308); -void gnss_H_21(double *state, double *sat_pos_vel, double *out_6978532755514735815); +void gnss_err_fun(double *nom_x, double *delta_x, double *out_654910612427940843); +void gnss_inv_err_fun(double *nom_x, double *true_x, double *out_6637724801134549563); +void gnss_H_mod_fun(double *state, double *out_805386010827368873); +void gnss_f_fun(double *state, double dt, double *out_4766656596405504851); +void gnss_F_fun(double *state, double dt, double *out_4029299056587768608); +void gnss_h_6(double *state, double *sat_pos, double *out_1067178731754715050); +void gnss_H_6(double *state, double *sat_pos, double *out_7962220724729872721); +void gnss_h_20(double *state, double *sat_pos, double *out_7444431052127272697); +void gnss_H_20(double *state, double *sat_pos, double *out_799492558915393744); +void gnss_h_7(double *state, double *sat_pos_vel, double *out_7430002568771021643); +void gnss_H_7(double *state, double *sat_pos_vel, double *out_7060224876276749950); +void gnss_h_21(double *state, double *sat_pos_vel, double *out_7430002568771021643); +void gnss_H_21(double *state, double *sat_pos_vel, double *out_7060224876276749950); void gnss_predict(double *in_x, double *in_P, double *in_Q, double dt); } \ No newline at end of file diff --git a/selfdrive/locationd/models/generated/libkf.so b/selfdrive/locationd/models/generated/libkf.so index 7ada2c02e..6e8cfa41c 100755 Binary files a/selfdrive/locationd/models/generated/libkf.so and b/selfdrive/locationd/models/generated/libkf.so differ diff --git a/selfdrive/locationd/models/generated/live.cpp b/selfdrive/locationd/models/generated/live.cpp index 5a75cde58..b4326ddc3 100644 --- a/selfdrive/locationd/models/generated/live.cpp +++ b/selfdrive/locationd/models/generated/live.cpp @@ -22,1683 +22,1683 @@ const static double MAHA_THRESH_33 = 7.814727903251177; * * * This file is part of 'ekf' * ******************************************************************************/ -void H(double *in_vec, double *out_907497564161450989) { - out_907497564161450989[0] = 0; - out_907497564161450989[1] = -sin(in_vec[1])*sin(in_vec[2])*in_vec[4] - sin(in_vec[1])*cos(in_vec[2])*in_vec[3] - cos(in_vec[1])*in_vec[5]; - out_907497564161450989[2] = -sin(in_vec[2])*cos(in_vec[1])*in_vec[3] + cos(in_vec[1])*cos(in_vec[2])*in_vec[4]; - out_907497564161450989[3] = cos(in_vec[1])*cos(in_vec[2]); - out_907497564161450989[4] = sin(in_vec[2])*cos(in_vec[1]); - out_907497564161450989[5] = -sin(in_vec[1]); - out_907497564161450989[6] = (sin(in_vec[0])*sin(in_vec[2]) + sin(in_vec[1])*cos(in_vec[0])*cos(in_vec[2]))*in_vec[3] + (-sin(in_vec[0])*cos(in_vec[2]) + sin(in_vec[1])*sin(in_vec[2])*cos(in_vec[0]))*in_vec[4] + cos(in_vec[0])*cos(in_vec[1])*in_vec[5]; - out_907497564161450989[7] = -sin(in_vec[0])*sin(in_vec[1])*in_vec[5] + sin(in_vec[0])*sin(in_vec[2])*cos(in_vec[1])*in_vec[4] + sin(in_vec[0])*cos(in_vec[1])*cos(in_vec[2])*in_vec[3]; - out_907497564161450989[8] = (-sin(in_vec[0])*sin(in_vec[1])*sin(in_vec[2]) - cos(in_vec[0])*cos(in_vec[2]))*in_vec[3] + (sin(in_vec[0])*sin(in_vec[1])*cos(in_vec[2]) - sin(in_vec[2])*cos(in_vec[0]))*in_vec[4]; - out_907497564161450989[9] = sin(in_vec[0])*sin(in_vec[1])*cos(in_vec[2]) - sin(in_vec[2])*cos(in_vec[0]); - out_907497564161450989[10] = sin(in_vec[0])*sin(in_vec[1])*sin(in_vec[2]) + cos(in_vec[0])*cos(in_vec[2]); - out_907497564161450989[11] = sin(in_vec[0])*cos(in_vec[1]); - out_907497564161450989[12] = (-sin(in_vec[0])*sin(in_vec[1])*sin(in_vec[2]) - cos(in_vec[0])*cos(in_vec[2]))*in_vec[4] + (-sin(in_vec[0])*sin(in_vec[1])*cos(in_vec[2]) + sin(in_vec[2])*cos(in_vec[0]))*in_vec[3] - sin(in_vec[0])*cos(in_vec[1])*in_vec[5]; - out_907497564161450989[13] = -sin(in_vec[1])*cos(in_vec[0])*in_vec[5] + sin(in_vec[2])*cos(in_vec[0])*cos(in_vec[1])*in_vec[4] + cos(in_vec[0])*cos(in_vec[1])*cos(in_vec[2])*in_vec[3]; - out_907497564161450989[14] = (sin(in_vec[0])*sin(in_vec[2]) + sin(in_vec[1])*cos(in_vec[0])*cos(in_vec[2]))*in_vec[4] + (sin(in_vec[0])*cos(in_vec[2]) - sin(in_vec[1])*sin(in_vec[2])*cos(in_vec[0]))*in_vec[3]; - out_907497564161450989[15] = sin(in_vec[0])*sin(in_vec[2]) + sin(in_vec[1])*cos(in_vec[0])*cos(in_vec[2]); - out_907497564161450989[16] = -sin(in_vec[0])*cos(in_vec[2]) + sin(in_vec[1])*sin(in_vec[2])*cos(in_vec[0]); - out_907497564161450989[17] = cos(in_vec[0])*cos(in_vec[1]); +void H(double *in_vec, double *out_2989134609448912360) { + out_2989134609448912360[0] = 0; + out_2989134609448912360[1] = -sin(in_vec[1])*sin(in_vec[2])*in_vec[4] - sin(in_vec[1])*cos(in_vec[2])*in_vec[3] - cos(in_vec[1])*in_vec[5]; + out_2989134609448912360[2] = -sin(in_vec[2])*cos(in_vec[1])*in_vec[3] + cos(in_vec[1])*cos(in_vec[2])*in_vec[4]; + out_2989134609448912360[3] = cos(in_vec[1])*cos(in_vec[2]); + out_2989134609448912360[4] = sin(in_vec[2])*cos(in_vec[1]); + out_2989134609448912360[5] = -sin(in_vec[1]); + out_2989134609448912360[6] = (sin(in_vec[0])*sin(in_vec[2]) + sin(in_vec[1])*cos(in_vec[0])*cos(in_vec[2]))*in_vec[3] + (-sin(in_vec[0])*cos(in_vec[2]) + sin(in_vec[1])*sin(in_vec[2])*cos(in_vec[0]))*in_vec[4] + cos(in_vec[0])*cos(in_vec[1])*in_vec[5]; + out_2989134609448912360[7] = -sin(in_vec[0])*sin(in_vec[1])*in_vec[5] + sin(in_vec[0])*sin(in_vec[2])*cos(in_vec[1])*in_vec[4] + sin(in_vec[0])*cos(in_vec[1])*cos(in_vec[2])*in_vec[3]; + out_2989134609448912360[8] = (-sin(in_vec[0])*sin(in_vec[1])*sin(in_vec[2]) - cos(in_vec[0])*cos(in_vec[2]))*in_vec[3] + (sin(in_vec[0])*sin(in_vec[1])*cos(in_vec[2]) - sin(in_vec[2])*cos(in_vec[0]))*in_vec[4]; + out_2989134609448912360[9] = sin(in_vec[0])*sin(in_vec[1])*cos(in_vec[2]) - sin(in_vec[2])*cos(in_vec[0]); + out_2989134609448912360[10] = sin(in_vec[0])*sin(in_vec[1])*sin(in_vec[2]) + cos(in_vec[0])*cos(in_vec[2]); + out_2989134609448912360[11] = sin(in_vec[0])*cos(in_vec[1]); + out_2989134609448912360[12] = (-sin(in_vec[0])*sin(in_vec[1])*sin(in_vec[2]) - cos(in_vec[0])*cos(in_vec[2]))*in_vec[4] + (-sin(in_vec[0])*sin(in_vec[1])*cos(in_vec[2]) + sin(in_vec[2])*cos(in_vec[0]))*in_vec[3] - sin(in_vec[0])*cos(in_vec[1])*in_vec[5]; + out_2989134609448912360[13] = -sin(in_vec[1])*cos(in_vec[0])*in_vec[5] + sin(in_vec[2])*cos(in_vec[0])*cos(in_vec[1])*in_vec[4] + cos(in_vec[0])*cos(in_vec[1])*cos(in_vec[2])*in_vec[3]; + out_2989134609448912360[14] = (sin(in_vec[0])*sin(in_vec[2]) + sin(in_vec[1])*cos(in_vec[0])*cos(in_vec[2]))*in_vec[4] + (sin(in_vec[0])*cos(in_vec[2]) - sin(in_vec[1])*sin(in_vec[2])*cos(in_vec[0]))*in_vec[3]; + out_2989134609448912360[15] = sin(in_vec[0])*sin(in_vec[2]) + sin(in_vec[1])*cos(in_vec[0])*cos(in_vec[2]); + out_2989134609448912360[16] = -sin(in_vec[0])*cos(in_vec[2]) + sin(in_vec[1])*sin(in_vec[2])*cos(in_vec[0]); + out_2989134609448912360[17] = cos(in_vec[0])*cos(in_vec[1]); } -void err_fun(double *nom_x, double *delta_x, double *out_403017012035771763) { - out_403017012035771763[0] = delta_x[0] + nom_x[0]; - out_403017012035771763[1] = delta_x[1] + nom_x[1]; - out_403017012035771763[2] = delta_x[2] + nom_x[2]; - out_403017012035771763[3] = -0.5*delta_x[3]*nom_x[4] - 0.5*delta_x[4]*nom_x[5] - 0.5*delta_x[5]*nom_x[6] + 1.0*nom_x[3]; - out_403017012035771763[4] = 0.5*delta_x[3]*nom_x[3] + 0.5*delta_x[4]*nom_x[6] - 0.5*delta_x[5]*nom_x[5] + 1.0*nom_x[4]; - out_403017012035771763[5] = -0.5*delta_x[3]*nom_x[6] + 0.5*delta_x[4]*nom_x[3] + 0.5*delta_x[5]*nom_x[4] + 1.0*nom_x[5]; - out_403017012035771763[6] = 0.5*delta_x[3]*nom_x[5] - 0.5*delta_x[4]*nom_x[4] + 0.5*delta_x[5]*nom_x[3] + 1.0*nom_x[6]; - out_403017012035771763[7] = delta_x[6] + nom_x[7]; - out_403017012035771763[8] = delta_x[7] + nom_x[8]; - out_403017012035771763[9] = delta_x[8] + nom_x[9]; - out_403017012035771763[10] = delta_x[9] + nom_x[10]; - out_403017012035771763[11] = delta_x[10] + nom_x[11]; - out_403017012035771763[12] = delta_x[11] + nom_x[12]; - out_403017012035771763[13] = delta_x[12] + nom_x[13]; - out_403017012035771763[14] = delta_x[13] + nom_x[14]; - out_403017012035771763[15] = delta_x[14] + nom_x[15]; - out_403017012035771763[16] = delta_x[15] + nom_x[16]; - out_403017012035771763[17] = delta_x[16] + nom_x[17]; - out_403017012035771763[18] = delta_x[17] + nom_x[18]; - out_403017012035771763[19] = delta_x[18] + nom_x[19]; - out_403017012035771763[20] = delta_x[19] + nom_x[20]; - out_403017012035771763[21] = delta_x[20] + nom_x[21]; +void err_fun(double *nom_x, double *delta_x, double *out_4134642150611912562) { + out_4134642150611912562[0] = delta_x[0] + nom_x[0]; + out_4134642150611912562[1] = delta_x[1] + nom_x[1]; + out_4134642150611912562[2] = delta_x[2] + nom_x[2]; + out_4134642150611912562[3] = -0.5*delta_x[3]*nom_x[4] - 0.5*delta_x[4]*nom_x[5] - 0.5*delta_x[5]*nom_x[6] + 1.0*nom_x[3]; + out_4134642150611912562[4] = 0.5*delta_x[3]*nom_x[3] + 0.5*delta_x[4]*nom_x[6] - 0.5*delta_x[5]*nom_x[5] + 1.0*nom_x[4]; + out_4134642150611912562[5] = -0.5*delta_x[3]*nom_x[6] + 0.5*delta_x[4]*nom_x[3] + 0.5*delta_x[5]*nom_x[4] + 1.0*nom_x[5]; + out_4134642150611912562[6] = 0.5*delta_x[3]*nom_x[5] - 0.5*delta_x[4]*nom_x[4] + 0.5*delta_x[5]*nom_x[3] + 1.0*nom_x[6]; + out_4134642150611912562[7] = delta_x[6] + nom_x[7]; + out_4134642150611912562[8] = delta_x[7] + nom_x[8]; + out_4134642150611912562[9] = delta_x[8] + nom_x[9]; + out_4134642150611912562[10] = delta_x[9] + nom_x[10]; + out_4134642150611912562[11] = delta_x[10] + nom_x[11]; + out_4134642150611912562[12] = delta_x[11] + nom_x[12]; + out_4134642150611912562[13] = delta_x[12] + nom_x[13]; + out_4134642150611912562[14] = delta_x[13] + nom_x[14]; + out_4134642150611912562[15] = delta_x[14] + nom_x[15]; + out_4134642150611912562[16] = delta_x[15] + nom_x[16]; + out_4134642150611912562[17] = delta_x[16] + nom_x[17]; + out_4134642150611912562[18] = delta_x[17] + nom_x[18]; + out_4134642150611912562[19] = delta_x[18] + nom_x[19]; + out_4134642150611912562[20] = delta_x[19] + nom_x[20]; + out_4134642150611912562[21] = delta_x[20] + nom_x[21]; } -void inv_err_fun(double *nom_x, double *true_x, double *out_2932713747370631150) { - out_2932713747370631150[0] = -nom_x[0] + true_x[0]; - out_2932713747370631150[1] = -nom_x[1] + true_x[1]; - out_2932713747370631150[2] = -nom_x[2] + true_x[2]; - out_2932713747370631150[3] = 2*nom_x[3]*true_x[4] - 2*nom_x[4]*true_x[3] + 2*nom_x[5]*true_x[6] - 2*nom_x[6]*true_x[5]; - out_2932713747370631150[4] = 2*nom_x[3]*true_x[5] - 2*nom_x[4]*true_x[6] - 2*nom_x[5]*true_x[3] + 2*nom_x[6]*true_x[4]; - out_2932713747370631150[5] = 2*nom_x[3]*true_x[6] + 2*nom_x[4]*true_x[5] - 2*nom_x[5]*true_x[4] - 2*nom_x[6]*true_x[3]; - out_2932713747370631150[6] = -nom_x[7] + true_x[7]; - out_2932713747370631150[7] = -nom_x[8] + true_x[8]; - out_2932713747370631150[8] = -nom_x[9] + true_x[9]; - out_2932713747370631150[9] = -nom_x[10] + true_x[10]; - out_2932713747370631150[10] = -nom_x[11] + true_x[11]; - out_2932713747370631150[11] = -nom_x[12] + true_x[12]; - out_2932713747370631150[12] = -nom_x[13] + true_x[13]; - out_2932713747370631150[13] = -nom_x[14] + true_x[14]; - out_2932713747370631150[14] = -nom_x[15] + true_x[15]; - out_2932713747370631150[15] = -nom_x[16] + true_x[16]; - out_2932713747370631150[16] = -nom_x[17] + true_x[17]; - out_2932713747370631150[17] = -nom_x[18] + true_x[18]; - out_2932713747370631150[18] = -nom_x[19] + true_x[19]; - out_2932713747370631150[19] = -nom_x[20] + true_x[20]; - out_2932713747370631150[20] = -nom_x[21] + true_x[21]; +void inv_err_fun(double *nom_x, double *true_x, double *out_102578031842580524) { + out_102578031842580524[0] = -nom_x[0] + true_x[0]; + out_102578031842580524[1] = -nom_x[1] + true_x[1]; + out_102578031842580524[2] = -nom_x[2] + true_x[2]; + out_102578031842580524[3] = 2*nom_x[3]*true_x[4] - 2*nom_x[4]*true_x[3] + 2*nom_x[5]*true_x[6] - 2*nom_x[6]*true_x[5]; + out_102578031842580524[4] = 2*nom_x[3]*true_x[5] - 2*nom_x[4]*true_x[6] - 2*nom_x[5]*true_x[3] + 2*nom_x[6]*true_x[4]; + out_102578031842580524[5] = 2*nom_x[3]*true_x[6] + 2*nom_x[4]*true_x[5] - 2*nom_x[5]*true_x[4] - 2*nom_x[6]*true_x[3]; + out_102578031842580524[6] = -nom_x[7] + true_x[7]; + out_102578031842580524[7] = -nom_x[8] + true_x[8]; + out_102578031842580524[8] = -nom_x[9] + true_x[9]; + out_102578031842580524[9] = -nom_x[10] + true_x[10]; + out_102578031842580524[10] = -nom_x[11] + true_x[11]; + out_102578031842580524[11] = -nom_x[12] + true_x[12]; + out_102578031842580524[12] = -nom_x[13] + true_x[13]; + out_102578031842580524[13] = -nom_x[14] + true_x[14]; + out_102578031842580524[14] = -nom_x[15] + true_x[15]; + out_102578031842580524[15] = -nom_x[16] + true_x[16]; + out_102578031842580524[16] = -nom_x[17] + true_x[17]; + out_102578031842580524[17] = -nom_x[18] + true_x[18]; + out_102578031842580524[18] = -nom_x[19] + true_x[19]; + out_102578031842580524[19] = -nom_x[20] + true_x[20]; + out_102578031842580524[20] = -nom_x[21] + true_x[21]; } -void H_mod_fun(double *state, double *out_6036032580712144890) { - out_6036032580712144890[0] = 1.0; - out_6036032580712144890[1] = 0; - out_6036032580712144890[2] = 0; - out_6036032580712144890[3] = 0; - out_6036032580712144890[4] = 0; - out_6036032580712144890[5] = 0; - out_6036032580712144890[6] = 0; - out_6036032580712144890[7] = 0; - out_6036032580712144890[8] = 0; - out_6036032580712144890[9] = 0; - out_6036032580712144890[10] = 0; - out_6036032580712144890[11] = 0; - out_6036032580712144890[12] = 0; - out_6036032580712144890[13] = 0; - out_6036032580712144890[14] = 0; - out_6036032580712144890[15] = 0; - out_6036032580712144890[16] = 0; - out_6036032580712144890[17] = 0; - out_6036032580712144890[18] = 0; - out_6036032580712144890[19] = 0; - out_6036032580712144890[20] = 0; - out_6036032580712144890[21] = 0; - out_6036032580712144890[22] = 1.0; - out_6036032580712144890[23] = 0; - out_6036032580712144890[24] = 0; - out_6036032580712144890[25] = 0; - out_6036032580712144890[26] = 0; - out_6036032580712144890[27] = 0; - out_6036032580712144890[28] = 0; - out_6036032580712144890[29] = 0; - out_6036032580712144890[30] = 0; - out_6036032580712144890[31] = 0; - out_6036032580712144890[32] = 0; - out_6036032580712144890[33] = 0; - out_6036032580712144890[34] = 0; - out_6036032580712144890[35] = 0; - out_6036032580712144890[36] = 0; - out_6036032580712144890[37] = 0; - out_6036032580712144890[38] = 0; - out_6036032580712144890[39] = 0; - out_6036032580712144890[40] = 0; - out_6036032580712144890[41] = 0; - out_6036032580712144890[42] = 0; - out_6036032580712144890[43] = 0; - out_6036032580712144890[44] = 1.0; - out_6036032580712144890[45] = 0; - out_6036032580712144890[46] = 0; - out_6036032580712144890[47] = 0; - out_6036032580712144890[48] = 0; - out_6036032580712144890[49] = 0; - out_6036032580712144890[50] = 0; - out_6036032580712144890[51] = 0; - out_6036032580712144890[52] = 0; - out_6036032580712144890[53] = 0; - out_6036032580712144890[54] = 0; - out_6036032580712144890[55] = 0; - out_6036032580712144890[56] = 0; - out_6036032580712144890[57] = 0; - out_6036032580712144890[58] = 0; - out_6036032580712144890[59] = 0; - out_6036032580712144890[60] = 0; - out_6036032580712144890[61] = 0; - out_6036032580712144890[62] = 0; - out_6036032580712144890[63] = 0; - out_6036032580712144890[64] = 0; - out_6036032580712144890[65] = 0; - out_6036032580712144890[66] = -0.5*state[4]; - out_6036032580712144890[67] = -0.5*state[5]; - out_6036032580712144890[68] = -0.5*state[6]; - out_6036032580712144890[69] = 0; - out_6036032580712144890[70] = 0; - out_6036032580712144890[71] = 0; - out_6036032580712144890[72] = 0; - out_6036032580712144890[73] = 0; - out_6036032580712144890[74] = 0; - out_6036032580712144890[75] = 0; - out_6036032580712144890[76] = 0; - out_6036032580712144890[77] = 0; - out_6036032580712144890[78] = 0; - out_6036032580712144890[79] = 0; - out_6036032580712144890[80] = 0; - out_6036032580712144890[81] = 0; - out_6036032580712144890[82] = 0; - out_6036032580712144890[83] = 0; - out_6036032580712144890[84] = 0; - out_6036032580712144890[85] = 0; - out_6036032580712144890[86] = 0; - out_6036032580712144890[87] = 0.5*state[3]; - out_6036032580712144890[88] = 0.5*state[6]; - out_6036032580712144890[89] = -0.5*state[5]; - out_6036032580712144890[90] = 0; - out_6036032580712144890[91] = 0; - out_6036032580712144890[92] = 0; - out_6036032580712144890[93] = 0; - out_6036032580712144890[94] = 0; - out_6036032580712144890[95] = 0; - out_6036032580712144890[96] = 0; - out_6036032580712144890[97] = 0; - out_6036032580712144890[98] = 0; - out_6036032580712144890[99] = 0; - out_6036032580712144890[100] = 0; - out_6036032580712144890[101] = 0; - out_6036032580712144890[102] = 0; - out_6036032580712144890[103] = 0; - out_6036032580712144890[104] = 0; - out_6036032580712144890[105] = 0; - out_6036032580712144890[106] = 0; - out_6036032580712144890[107] = 0; - out_6036032580712144890[108] = -0.5*state[6]; - out_6036032580712144890[109] = 0.5*state[3]; - out_6036032580712144890[110] = 0.5*state[4]; - out_6036032580712144890[111] = 0; - out_6036032580712144890[112] = 0; - out_6036032580712144890[113] = 0; - out_6036032580712144890[114] = 0; - out_6036032580712144890[115] = 0; - out_6036032580712144890[116] = 0; - out_6036032580712144890[117] = 0; - out_6036032580712144890[118] = 0; - out_6036032580712144890[119] = 0; - out_6036032580712144890[120] = 0; - out_6036032580712144890[121] = 0; - out_6036032580712144890[122] = 0; - out_6036032580712144890[123] = 0; - out_6036032580712144890[124] = 0; - out_6036032580712144890[125] = 0; - out_6036032580712144890[126] = 0; - out_6036032580712144890[127] = 0; - out_6036032580712144890[128] = 0; - out_6036032580712144890[129] = 0.5*state[5]; - out_6036032580712144890[130] = -0.5*state[4]; - out_6036032580712144890[131] = 0.5*state[3]; - out_6036032580712144890[132] = 0; - out_6036032580712144890[133] = 0; - out_6036032580712144890[134] = 0; - out_6036032580712144890[135] = 0; - out_6036032580712144890[136] = 0; - out_6036032580712144890[137] = 0; - out_6036032580712144890[138] = 0; - out_6036032580712144890[139] = 0; - out_6036032580712144890[140] = 0; - out_6036032580712144890[141] = 0; - out_6036032580712144890[142] = 0; - out_6036032580712144890[143] = 0; - out_6036032580712144890[144] = 0; - out_6036032580712144890[145] = 0; - out_6036032580712144890[146] = 0; - out_6036032580712144890[147] = 0; - out_6036032580712144890[148] = 0; - out_6036032580712144890[149] = 0; - out_6036032580712144890[150] = 0; - out_6036032580712144890[151] = 0; - out_6036032580712144890[152] = 0; - out_6036032580712144890[153] = 1.0; - out_6036032580712144890[154] = 0; - out_6036032580712144890[155] = 0; - out_6036032580712144890[156] = 0; - out_6036032580712144890[157] = 0; - out_6036032580712144890[158] = 0; - out_6036032580712144890[159] = 0; - out_6036032580712144890[160] = 0; - out_6036032580712144890[161] = 0; - out_6036032580712144890[162] = 0; - out_6036032580712144890[163] = 0; - out_6036032580712144890[164] = 0; - out_6036032580712144890[165] = 0; - out_6036032580712144890[166] = 0; - out_6036032580712144890[167] = 0; - out_6036032580712144890[168] = 0; - out_6036032580712144890[169] = 0; - out_6036032580712144890[170] = 0; - out_6036032580712144890[171] = 0; - out_6036032580712144890[172] = 0; - out_6036032580712144890[173] = 0; - out_6036032580712144890[174] = 0; - out_6036032580712144890[175] = 1.0; - out_6036032580712144890[176] = 0; - out_6036032580712144890[177] = 0; - out_6036032580712144890[178] = 0; - out_6036032580712144890[179] = 0; - out_6036032580712144890[180] = 0; - out_6036032580712144890[181] = 0; - out_6036032580712144890[182] = 0; - out_6036032580712144890[183] = 0; - out_6036032580712144890[184] = 0; - out_6036032580712144890[185] = 0; - out_6036032580712144890[186] = 0; - out_6036032580712144890[187] = 0; - out_6036032580712144890[188] = 0; - out_6036032580712144890[189] = 0; - out_6036032580712144890[190] = 0; - out_6036032580712144890[191] = 0; - out_6036032580712144890[192] = 0; - out_6036032580712144890[193] = 0; - out_6036032580712144890[194] = 0; - out_6036032580712144890[195] = 0; - out_6036032580712144890[196] = 0; - out_6036032580712144890[197] = 1.0; - out_6036032580712144890[198] = 0; - out_6036032580712144890[199] = 0; - out_6036032580712144890[200] = 0; - out_6036032580712144890[201] = 0; - out_6036032580712144890[202] = 0; - out_6036032580712144890[203] = 0; - out_6036032580712144890[204] = 0; - out_6036032580712144890[205] = 0; - out_6036032580712144890[206] = 0; - out_6036032580712144890[207] = 0; - out_6036032580712144890[208] = 0; - out_6036032580712144890[209] = 0; - out_6036032580712144890[210] = 0; - out_6036032580712144890[211] = 0; - out_6036032580712144890[212] = 0; - out_6036032580712144890[213] = 0; - out_6036032580712144890[214] = 0; - out_6036032580712144890[215] = 0; - out_6036032580712144890[216] = 0; - out_6036032580712144890[217] = 0; - out_6036032580712144890[218] = 0; - out_6036032580712144890[219] = 1.0; - out_6036032580712144890[220] = 0; - out_6036032580712144890[221] = 0; - out_6036032580712144890[222] = 0; - out_6036032580712144890[223] = 0; - out_6036032580712144890[224] = 0; - out_6036032580712144890[225] = 0; - out_6036032580712144890[226] = 0; - out_6036032580712144890[227] = 0; - out_6036032580712144890[228] = 0; - out_6036032580712144890[229] = 0; - out_6036032580712144890[230] = 0; - out_6036032580712144890[231] = 0; - out_6036032580712144890[232] = 0; - out_6036032580712144890[233] = 0; - out_6036032580712144890[234] = 0; - out_6036032580712144890[235] = 0; - out_6036032580712144890[236] = 0; - out_6036032580712144890[237] = 0; - out_6036032580712144890[238] = 0; - out_6036032580712144890[239] = 0; - out_6036032580712144890[240] = 0; - out_6036032580712144890[241] = 1.0; - out_6036032580712144890[242] = 0; - out_6036032580712144890[243] = 0; - out_6036032580712144890[244] = 0; - out_6036032580712144890[245] = 0; - out_6036032580712144890[246] = 0; - out_6036032580712144890[247] = 0; - out_6036032580712144890[248] = 0; - out_6036032580712144890[249] = 0; - out_6036032580712144890[250] = 0; - out_6036032580712144890[251] = 0; - out_6036032580712144890[252] = 0; - out_6036032580712144890[253] = 0; - out_6036032580712144890[254] = 0; - out_6036032580712144890[255] = 0; - out_6036032580712144890[256] = 0; - out_6036032580712144890[257] = 0; - out_6036032580712144890[258] = 0; - out_6036032580712144890[259] = 0; - out_6036032580712144890[260] = 0; - out_6036032580712144890[261] = 0; - out_6036032580712144890[262] = 0; - out_6036032580712144890[263] = 1.0; - out_6036032580712144890[264] = 0; - out_6036032580712144890[265] = 0; - out_6036032580712144890[266] = 0; - out_6036032580712144890[267] = 0; - out_6036032580712144890[268] = 0; - out_6036032580712144890[269] = 0; - out_6036032580712144890[270] = 0; - out_6036032580712144890[271] = 0; - out_6036032580712144890[272] = 0; - out_6036032580712144890[273] = 0; - out_6036032580712144890[274] = 0; - out_6036032580712144890[275] = 0; - out_6036032580712144890[276] = 0; - out_6036032580712144890[277] = 0; - out_6036032580712144890[278] = 0; - out_6036032580712144890[279] = 0; - out_6036032580712144890[280] = 0; - out_6036032580712144890[281] = 0; - out_6036032580712144890[282] = 0; - out_6036032580712144890[283] = 0; - out_6036032580712144890[284] = 0; - out_6036032580712144890[285] = 1.0; - out_6036032580712144890[286] = 0; - out_6036032580712144890[287] = 0; - out_6036032580712144890[288] = 0; - out_6036032580712144890[289] = 0; - out_6036032580712144890[290] = 0; - out_6036032580712144890[291] = 0; - out_6036032580712144890[292] = 0; - out_6036032580712144890[293] = 0; - out_6036032580712144890[294] = 0; - out_6036032580712144890[295] = 0; - out_6036032580712144890[296] = 0; - out_6036032580712144890[297] = 0; - out_6036032580712144890[298] = 0; - out_6036032580712144890[299] = 0; - out_6036032580712144890[300] = 0; - out_6036032580712144890[301] = 0; - out_6036032580712144890[302] = 0; - out_6036032580712144890[303] = 0; - out_6036032580712144890[304] = 0; - out_6036032580712144890[305] = 0; - out_6036032580712144890[306] = 0; - out_6036032580712144890[307] = 1.0; - out_6036032580712144890[308] = 0; - out_6036032580712144890[309] = 0; - out_6036032580712144890[310] = 0; - out_6036032580712144890[311] = 0; - out_6036032580712144890[312] = 0; - out_6036032580712144890[313] = 0; - out_6036032580712144890[314] = 0; - out_6036032580712144890[315] = 0; - out_6036032580712144890[316] = 0; - out_6036032580712144890[317] = 0; - out_6036032580712144890[318] = 0; - out_6036032580712144890[319] = 0; - out_6036032580712144890[320] = 0; - out_6036032580712144890[321] = 0; - out_6036032580712144890[322] = 0; - out_6036032580712144890[323] = 0; - out_6036032580712144890[324] = 0; - out_6036032580712144890[325] = 0; - out_6036032580712144890[326] = 0; - out_6036032580712144890[327] = 0; - out_6036032580712144890[328] = 0; - out_6036032580712144890[329] = 1.0; - out_6036032580712144890[330] = 0; - out_6036032580712144890[331] = 0; - out_6036032580712144890[332] = 0; - out_6036032580712144890[333] = 0; - out_6036032580712144890[334] = 0; - out_6036032580712144890[335] = 0; - out_6036032580712144890[336] = 0; - out_6036032580712144890[337] = 0; - out_6036032580712144890[338] = 0; - out_6036032580712144890[339] = 0; - out_6036032580712144890[340] = 0; - out_6036032580712144890[341] = 0; - out_6036032580712144890[342] = 0; - out_6036032580712144890[343] = 0; - out_6036032580712144890[344] = 0; - out_6036032580712144890[345] = 0; - out_6036032580712144890[346] = 0; - out_6036032580712144890[347] = 0; - out_6036032580712144890[348] = 0; - out_6036032580712144890[349] = 0; - out_6036032580712144890[350] = 0; - out_6036032580712144890[351] = 1.0; - out_6036032580712144890[352] = 0; - out_6036032580712144890[353] = 0; - out_6036032580712144890[354] = 0; - out_6036032580712144890[355] = 0; - out_6036032580712144890[356] = 0; - out_6036032580712144890[357] = 0; - out_6036032580712144890[358] = 0; - out_6036032580712144890[359] = 0; - out_6036032580712144890[360] = 0; - out_6036032580712144890[361] = 0; - out_6036032580712144890[362] = 0; - out_6036032580712144890[363] = 0; - out_6036032580712144890[364] = 0; - out_6036032580712144890[365] = 0; - out_6036032580712144890[366] = 0; - out_6036032580712144890[367] = 0; - out_6036032580712144890[368] = 0; - out_6036032580712144890[369] = 0; - out_6036032580712144890[370] = 0; - out_6036032580712144890[371] = 0; - out_6036032580712144890[372] = 0; - out_6036032580712144890[373] = 1.0; - out_6036032580712144890[374] = 0; - out_6036032580712144890[375] = 0; - out_6036032580712144890[376] = 0; - out_6036032580712144890[377] = 0; - out_6036032580712144890[378] = 0; - out_6036032580712144890[379] = 0; - out_6036032580712144890[380] = 0; - out_6036032580712144890[381] = 0; - out_6036032580712144890[382] = 0; - out_6036032580712144890[383] = 0; - out_6036032580712144890[384] = 0; - out_6036032580712144890[385] = 0; - out_6036032580712144890[386] = 0; - out_6036032580712144890[387] = 0; - out_6036032580712144890[388] = 0; - out_6036032580712144890[389] = 0; - out_6036032580712144890[390] = 0; - out_6036032580712144890[391] = 0; - out_6036032580712144890[392] = 0; - out_6036032580712144890[393] = 0; - out_6036032580712144890[394] = 0; - out_6036032580712144890[395] = 1.0; - out_6036032580712144890[396] = 0; - out_6036032580712144890[397] = 0; - out_6036032580712144890[398] = 0; - out_6036032580712144890[399] = 0; - out_6036032580712144890[400] = 0; - out_6036032580712144890[401] = 0; - out_6036032580712144890[402] = 0; - out_6036032580712144890[403] = 0; - out_6036032580712144890[404] = 0; - out_6036032580712144890[405] = 0; - out_6036032580712144890[406] = 0; - out_6036032580712144890[407] = 0; - out_6036032580712144890[408] = 0; - out_6036032580712144890[409] = 0; - out_6036032580712144890[410] = 0; - out_6036032580712144890[411] = 0; - out_6036032580712144890[412] = 0; - out_6036032580712144890[413] = 0; - out_6036032580712144890[414] = 0; - out_6036032580712144890[415] = 0; - out_6036032580712144890[416] = 0; - out_6036032580712144890[417] = 1.0; - out_6036032580712144890[418] = 0; - out_6036032580712144890[419] = 0; - out_6036032580712144890[420] = 0; - out_6036032580712144890[421] = 0; - out_6036032580712144890[422] = 0; - out_6036032580712144890[423] = 0; - out_6036032580712144890[424] = 0; - out_6036032580712144890[425] = 0; - out_6036032580712144890[426] = 0; - out_6036032580712144890[427] = 0; - out_6036032580712144890[428] = 0; - out_6036032580712144890[429] = 0; - out_6036032580712144890[430] = 0; - out_6036032580712144890[431] = 0; - out_6036032580712144890[432] = 0; - out_6036032580712144890[433] = 0; - out_6036032580712144890[434] = 0; - out_6036032580712144890[435] = 0; - out_6036032580712144890[436] = 0; - out_6036032580712144890[437] = 0; - out_6036032580712144890[438] = 0; - out_6036032580712144890[439] = 1.0; - out_6036032580712144890[440] = 0; - out_6036032580712144890[441] = 0; - out_6036032580712144890[442] = 0; - out_6036032580712144890[443] = 0; - out_6036032580712144890[444] = 0; - out_6036032580712144890[445] = 0; - out_6036032580712144890[446] = 0; - out_6036032580712144890[447] = 0; - out_6036032580712144890[448] = 0; - out_6036032580712144890[449] = 0; - out_6036032580712144890[450] = 0; - out_6036032580712144890[451] = 0; - out_6036032580712144890[452] = 0; - out_6036032580712144890[453] = 0; - out_6036032580712144890[454] = 0; - out_6036032580712144890[455] = 0; - out_6036032580712144890[456] = 0; - out_6036032580712144890[457] = 0; - out_6036032580712144890[458] = 0; - out_6036032580712144890[459] = 0; - out_6036032580712144890[460] = 0; - out_6036032580712144890[461] = 1.0; +void H_mod_fun(double *state, double *out_1333467034631963441) { + out_1333467034631963441[0] = 1.0; + out_1333467034631963441[1] = 0; + out_1333467034631963441[2] = 0; + out_1333467034631963441[3] = 0; + out_1333467034631963441[4] = 0; + out_1333467034631963441[5] = 0; + out_1333467034631963441[6] = 0; + out_1333467034631963441[7] = 0; + out_1333467034631963441[8] = 0; + out_1333467034631963441[9] = 0; + out_1333467034631963441[10] = 0; + out_1333467034631963441[11] = 0; + out_1333467034631963441[12] = 0; + out_1333467034631963441[13] = 0; + out_1333467034631963441[14] = 0; + out_1333467034631963441[15] = 0; + out_1333467034631963441[16] = 0; + out_1333467034631963441[17] = 0; + out_1333467034631963441[18] = 0; + out_1333467034631963441[19] = 0; + out_1333467034631963441[20] = 0; + out_1333467034631963441[21] = 0; + out_1333467034631963441[22] = 1.0; + out_1333467034631963441[23] = 0; + out_1333467034631963441[24] = 0; + out_1333467034631963441[25] = 0; + out_1333467034631963441[26] = 0; + out_1333467034631963441[27] = 0; + out_1333467034631963441[28] = 0; + out_1333467034631963441[29] = 0; + out_1333467034631963441[30] = 0; + out_1333467034631963441[31] = 0; + out_1333467034631963441[32] = 0; + out_1333467034631963441[33] = 0; + out_1333467034631963441[34] = 0; + out_1333467034631963441[35] = 0; + out_1333467034631963441[36] = 0; + out_1333467034631963441[37] = 0; + out_1333467034631963441[38] = 0; + out_1333467034631963441[39] = 0; + out_1333467034631963441[40] = 0; + out_1333467034631963441[41] = 0; + out_1333467034631963441[42] = 0; + out_1333467034631963441[43] = 0; + out_1333467034631963441[44] = 1.0; + out_1333467034631963441[45] = 0; + out_1333467034631963441[46] = 0; + out_1333467034631963441[47] = 0; + out_1333467034631963441[48] = 0; + out_1333467034631963441[49] = 0; + out_1333467034631963441[50] = 0; + out_1333467034631963441[51] = 0; + out_1333467034631963441[52] = 0; + out_1333467034631963441[53] = 0; + out_1333467034631963441[54] = 0; + out_1333467034631963441[55] = 0; + out_1333467034631963441[56] = 0; + out_1333467034631963441[57] = 0; + out_1333467034631963441[58] = 0; + out_1333467034631963441[59] = 0; + out_1333467034631963441[60] = 0; + out_1333467034631963441[61] = 0; + out_1333467034631963441[62] = 0; + out_1333467034631963441[63] = 0; + out_1333467034631963441[64] = 0; + out_1333467034631963441[65] = 0; + out_1333467034631963441[66] = -0.5*state[4]; + out_1333467034631963441[67] = -0.5*state[5]; + out_1333467034631963441[68] = -0.5*state[6]; + out_1333467034631963441[69] = 0; + out_1333467034631963441[70] = 0; + out_1333467034631963441[71] = 0; + out_1333467034631963441[72] = 0; + out_1333467034631963441[73] = 0; + out_1333467034631963441[74] = 0; + out_1333467034631963441[75] = 0; + out_1333467034631963441[76] = 0; + out_1333467034631963441[77] = 0; + out_1333467034631963441[78] = 0; + out_1333467034631963441[79] = 0; + out_1333467034631963441[80] = 0; + out_1333467034631963441[81] = 0; + out_1333467034631963441[82] = 0; + out_1333467034631963441[83] = 0; + out_1333467034631963441[84] = 0; + out_1333467034631963441[85] = 0; + out_1333467034631963441[86] = 0; + out_1333467034631963441[87] = 0.5*state[3]; + out_1333467034631963441[88] = 0.5*state[6]; + out_1333467034631963441[89] = -0.5*state[5]; + out_1333467034631963441[90] = 0; + out_1333467034631963441[91] = 0; + out_1333467034631963441[92] = 0; + out_1333467034631963441[93] = 0; + out_1333467034631963441[94] = 0; + out_1333467034631963441[95] = 0; + out_1333467034631963441[96] = 0; + out_1333467034631963441[97] = 0; + out_1333467034631963441[98] = 0; + out_1333467034631963441[99] = 0; + out_1333467034631963441[100] = 0; + out_1333467034631963441[101] = 0; + out_1333467034631963441[102] = 0; + out_1333467034631963441[103] = 0; + out_1333467034631963441[104] = 0; + out_1333467034631963441[105] = 0; + out_1333467034631963441[106] = 0; + out_1333467034631963441[107] = 0; + out_1333467034631963441[108] = -0.5*state[6]; + out_1333467034631963441[109] = 0.5*state[3]; + out_1333467034631963441[110] = 0.5*state[4]; + out_1333467034631963441[111] = 0; + out_1333467034631963441[112] = 0; + out_1333467034631963441[113] = 0; + out_1333467034631963441[114] = 0; + out_1333467034631963441[115] = 0; + out_1333467034631963441[116] = 0; + out_1333467034631963441[117] = 0; + out_1333467034631963441[118] = 0; + out_1333467034631963441[119] = 0; + out_1333467034631963441[120] = 0; + out_1333467034631963441[121] = 0; + out_1333467034631963441[122] = 0; + out_1333467034631963441[123] = 0; + out_1333467034631963441[124] = 0; + out_1333467034631963441[125] = 0; + out_1333467034631963441[126] = 0; + out_1333467034631963441[127] = 0; + out_1333467034631963441[128] = 0; + out_1333467034631963441[129] = 0.5*state[5]; + out_1333467034631963441[130] = -0.5*state[4]; + out_1333467034631963441[131] = 0.5*state[3]; + out_1333467034631963441[132] = 0; + out_1333467034631963441[133] = 0; + out_1333467034631963441[134] = 0; + out_1333467034631963441[135] = 0; + out_1333467034631963441[136] = 0; + out_1333467034631963441[137] = 0; + out_1333467034631963441[138] = 0; + out_1333467034631963441[139] = 0; + out_1333467034631963441[140] = 0; + out_1333467034631963441[141] = 0; + out_1333467034631963441[142] = 0; + out_1333467034631963441[143] = 0; + out_1333467034631963441[144] = 0; + out_1333467034631963441[145] = 0; + out_1333467034631963441[146] = 0; + out_1333467034631963441[147] = 0; + out_1333467034631963441[148] = 0; + out_1333467034631963441[149] = 0; + out_1333467034631963441[150] = 0; + out_1333467034631963441[151] = 0; + out_1333467034631963441[152] = 0; + out_1333467034631963441[153] = 1.0; + out_1333467034631963441[154] = 0; + out_1333467034631963441[155] = 0; + out_1333467034631963441[156] = 0; + out_1333467034631963441[157] = 0; + out_1333467034631963441[158] = 0; + out_1333467034631963441[159] = 0; + out_1333467034631963441[160] = 0; + out_1333467034631963441[161] = 0; + out_1333467034631963441[162] = 0; + out_1333467034631963441[163] = 0; + out_1333467034631963441[164] = 0; + out_1333467034631963441[165] = 0; + out_1333467034631963441[166] = 0; + out_1333467034631963441[167] = 0; + out_1333467034631963441[168] = 0; + out_1333467034631963441[169] = 0; + out_1333467034631963441[170] = 0; + out_1333467034631963441[171] = 0; + out_1333467034631963441[172] = 0; + out_1333467034631963441[173] = 0; + out_1333467034631963441[174] = 0; + out_1333467034631963441[175] = 1.0; + out_1333467034631963441[176] = 0; + out_1333467034631963441[177] = 0; + out_1333467034631963441[178] = 0; + out_1333467034631963441[179] = 0; + out_1333467034631963441[180] = 0; + out_1333467034631963441[181] = 0; + out_1333467034631963441[182] = 0; + out_1333467034631963441[183] = 0; + out_1333467034631963441[184] = 0; + out_1333467034631963441[185] = 0; + out_1333467034631963441[186] = 0; + out_1333467034631963441[187] = 0; + out_1333467034631963441[188] = 0; + out_1333467034631963441[189] = 0; + out_1333467034631963441[190] = 0; + out_1333467034631963441[191] = 0; + out_1333467034631963441[192] = 0; + out_1333467034631963441[193] = 0; + out_1333467034631963441[194] = 0; + out_1333467034631963441[195] = 0; + out_1333467034631963441[196] = 0; + out_1333467034631963441[197] = 1.0; + out_1333467034631963441[198] = 0; + out_1333467034631963441[199] = 0; + out_1333467034631963441[200] = 0; + out_1333467034631963441[201] = 0; + out_1333467034631963441[202] = 0; + out_1333467034631963441[203] = 0; + out_1333467034631963441[204] = 0; + out_1333467034631963441[205] = 0; + out_1333467034631963441[206] = 0; + out_1333467034631963441[207] = 0; + out_1333467034631963441[208] = 0; + out_1333467034631963441[209] = 0; + out_1333467034631963441[210] = 0; + out_1333467034631963441[211] = 0; + out_1333467034631963441[212] = 0; + out_1333467034631963441[213] = 0; + out_1333467034631963441[214] = 0; + out_1333467034631963441[215] = 0; + out_1333467034631963441[216] = 0; + out_1333467034631963441[217] = 0; + out_1333467034631963441[218] = 0; + out_1333467034631963441[219] = 1.0; + out_1333467034631963441[220] = 0; + out_1333467034631963441[221] = 0; + out_1333467034631963441[222] = 0; + out_1333467034631963441[223] = 0; + out_1333467034631963441[224] = 0; + out_1333467034631963441[225] = 0; + out_1333467034631963441[226] = 0; + out_1333467034631963441[227] = 0; + out_1333467034631963441[228] = 0; + out_1333467034631963441[229] = 0; + out_1333467034631963441[230] = 0; + out_1333467034631963441[231] = 0; + out_1333467034631963441[232] = 0; + out_1333467034631963441[233] = 0; + out_1333467034631963441[234] = 0; + out_1333467034631963441[235] = 0; + out_1333467034631963441[236] = 0; + out_1333467034631963441[237] = 0; + out_1333467034631963441[238] = 0; + out_1333467034631963441[239] = 0; + out_1333467034631963441[240] = 0; + out_1333467034631963441[241] = 1.0; + out_1333467034631963441[242] = 0; + out_1333467034631963441[243] = 0; + out_1333467034631963441[244] = 0; + out_1333467034631963441[245] = 0; + out_1333467034631963441[246] = 0; + out_1333467034631963441[247] = 0; + out_1333467034631963441[248] = 0; + out_1333467034631963441[249] = 0; + out_1333467034631963441[250] = 0; + out_1333467034631963441[251] = 0; + out_1333467034631963441[252] = 0; + out_1333467034631963441[253] = 0; + out_1333467034631963441[254] = 0; + out_1333467034631963441[255] = 0; + out_1333467034631963441[256] = 0; + out_1333467034631963441[257] = 0; + out_1333467034631963441[258] = 0; + out_1333467034631963441[259] = 0; + out_1333467034631963441[260] = 0; + out_1333467034631963441[261] = 0; + out_1333467034631963441[262] = 0; + out_1333467034631963441[263] = 1.0; + out_1333467034631963441[264] = 0; + out_1333467034631963441[265] = 0; + out_1333467034631963441[266] = 0; + out_1333467034631963441[267] = 0; + out_1333467034631963441[268] = 0; + out_1333467034631963441[269] = 0; + out_1333467034631963441[270] = 0; + out_1333467034631963441[271] = 0; + out_1333467034631963441[272] = 0; + out_1333467034631963441[273] = 0; + out_1333467034631963441[274] = 0; + out_1333467034631963441[275] = 0; + out_1333467034631963441[276] = 0; + out_1333467034631963441[277] = 0; + out_1333467034631963441[278] = 0; + out_1333467034631963441[279] = 0; + out_1333467034631963441[280] = 0; + out_1333467034631963441[281] = 0; + out_1333467034631963441[282] = 0; + out_1333467034631963441[283] = 0; + out_1333467034631963441[284] = 0; + out_1333467034631963441[285] = 1.0; + out_1333467034631963441[286] = 0; + out_1333467034631963441[287] = 0; + out_1333467034631963441[288] = 0; + out_1333467034631963441[289] = 0; + out_1333467034631963441[290] = 0; + out_1333467034631963441[291] = 0; + out_1333467034631963441[292] = 0; + out_1333467034631963441[293] = 0; + out_1333467034631963441[294] = 0; + out_1333467034631963441[295] = 0; + out_1333467034631963441[296] = 0; + out_1333467034631963441[297] = 0; + out_1333467034631963441[298] = 0; + out_1333467034631963441[299] = 0; + out_1333467034631963441[300] = 0; + out_1333467034631963441[301] = 0; + out_1333467034631963441[302] = 0; + out_1333467034631963441[303] = 0; + out_1333467034631963441[304] = 0; + out_1333467034631963441[305] = 0; + out_1333467034631963441[306] = 0; + out_1333467034631963441[307] = 1.0; + out_1333467034631963441[308] = 0; + out_1333467034631963441[309] = 0; + out_1333467034631963441[310] = 0; + out_1333467034631963441[311] = 0; + out_1333467034631963441[312] = 0; + out_1333467034631963441[313] = 0; + out_1333467034631963441[314] = 0; + out_1333467034631963441[315] = 0; + out_1333467034631963441[316] = 0; + out_1333467034631963441[317] = 0; + out_1333467034631963441[318] = 0; + out_1333467034631963441[319] = 0; + out_1333467034631963441[320] = 0; + out_1333467034631963441[321] = 0; + out_1333467034631963441[322] = 0; + out_1333467034631963441[323] = 0; + out_1333467034631963441[324] = 0; + out_1333467034631963441[325] = 0; + out_1333467034631963441[326] = 0; + out_1333467034631963441[327] = 0; + out_1333467034631963441[328] = 0; + out_1333467034631963441[329] = 1.0; + out_1333467034631963441[330] = 0; + out_1333467034631963441[331] = 0; + out_1333467034631963441[332] = 0; + out_1333467034631963441[333] = 0; + out_1333467034631963441[334] = 0; + out_1333467034631963441[335] = 0; + out_1333467034631963441[336] = 0; + out_1333467034631963441[337] = 0; + out_1333467034631963441[338] = 0; + out_1333467034631963441[339] = 0; + out_1333467034631963441[340] = 0; + out_1333467034631963441[341] = 0; + out_1333467034631963441[342] = 0; + out_1333467034631963441[343] = 0; + out_1333467034631963441[344] = 0; + out_1333467034631963441[345] = 0; + out_1333467034631963441[346] = 0; + out_1333467034631963441[347] = 0; + out_1333467034631963441[348] = 0; + out_1333467034631963441[349] = 0; + out_1333467034631963441[350] = 0; + out_1333467034631963441[351] = 1.0; + out_1333467034631963441[352] = 0; + out_1333467034631963441[353] = 0; + out_1333467034631963441[354] = 0; + out_1333467034631963441[355] = 0; + out_1333467034631963441[356] = 0; + out_1333467034631963441[357] = 0; + out_1333467034631963441[358] = 0; + out_1333467034631963441[359] = 0; + out_1333467034631963441[360] = 0; + out_1333467034631963441[361] = 0; + out_1333467034631963441[362] = 0; + out_1333467034631963441[363] = 0; + out_1333467034631963441[364] = 0; + out_1333467034631963441[365] = 0; + out_1333467034631963441[366] = 0; + out_1333467034631963441[367] = 0; + out_1333467034631963441[368] = 0; + out_1333467034631963441[369] = 0; + out_1333467034631963441[370] = 0; + out_1333467034631963441[371] = 0; + out_1333467034631963441[372] = 0; + out_1333467034631963441[373] = 1.0; + out_1333467034631963441[374] = 0; + out_1333467034631963441[375] = 0; + out_1333467034631963441[376] = 0; + out_1333467034631963441[377] = 0; + out_1333467034631963441[378] = 0; + out_1333467034631963441[379] = 0; + out_1333467034631963441[380] = 0; + out_1333467034631963441[381] = 0; + out_1333467034631963441[382] = 0; + out_1333467034631963441[383] = 0; + out_1333467034631963441[384] = 0; + out_1333467034631963441[385] = 0; + out_1333467034631963441[386] = 0; + out_1333467034631963441[387] = 0; + out_1333467034631963441[388] = 0; + out_1333467034631963441[389] = 0; + out_1333467034631963441[390] = 0; + out_1333467034631963441[391] = 0; + out_1333467034631963441[392] = 0; + out_1333467034631963441[393] = 0; + out_1333467034631963441[394] = 0; + out_1333467034631963441[395] = 1.0; + out_1333467034631963441[396] = 0; + out_1333467034631963441[397] = 0; + out_1333467034631963441[398] = 0; + out_1333467034631963441[399] = 0; + out_1333467034631963441[400] = 0; + out_1333467034631963441[401] = 0; + out_1333467034631963441[402] = 0; + out_1333467034631963441[403] = 0; + out_1333467034631963441[404] = 0; + out_1333467034631963441[405] = 0; + out_1333467034631963441[406] = 0; + out_1333467034631963441[407] = 0; + out_1333467034631963441[408] = 0; + out_1333467034631963441[409] = 0; + out_1333467034631963441[410] = 0; + out_1333467034631963441[411] = 0; + out_1333467034631963441[412] = 0; + out_1333467034631963441[413] = 0; + out_1333467034631963441[414] = 0; + out_1333467034631963441[415] = 0; + out_1333467034631963441[416] = 0; + out_1333467034631963441[417] = 1.0; + out_1333467034631963441[418] = 0; + out_1333467034631963441[419] = 0; + out_1333467034631963441[420] = 0; + out_1333467034631963441[421] = 0; + out_1333467034631963441[422] = 0; + out_1333467034631963441[423] = 0; + out_1333467034631963441[424] = 0; + out_1333467034631963441[425] = 0; + out_1333467034631963441[426] = 0; + out_1333467034631963441[427] = 0; + out_1333467034631963441[428] = 0; + out_1333467034631963441[429] = 0; + out_1333467034631963441[430] = 0; + out_1333467034631963441[431] = 0; + out_1333467034631963441[432] = 0; + out_1333467034631963441[433] = 0; + out_1333467034631963441[434] = 0; + out_1333467034631963441[435] = 0; + out_1333467034631963441[436] = 0; + out_1333467034631963441[437] = 0; + out_1333467034631963441[438] = 0; + out_1333467034631963441[439] = 1.0; + out_1333467034631963441[440] = 0; + out_1333467034631963441[441] = 0; + out_1333467034631963441[442] = 0; + out_1333467034631963441[443] = 0; + out_1333467034631963441[444] = 0; + out_1333467034631963441[445] = 0; + out_1333467034631963441[446] = 0; + out_1333467034631963441[447] = 0; + out_1333467034631963441[448] = 0; + out_1333467034631963441[449] = 0; + out_1333467034631963441[450] = 0; + out_1333467034631963441[451] = 0; + out_1333467034631963441[452] = 0; + out_1333467034631963441[453] = 0; + out_1333467034631963441[454] = 0; + out_1333467034631963441[455] = 0; + out_1333467034631963441[456] = 0; + out_1333467034631963441[457] = 0; + out_1333467034631963441[458] = 0; + out_1333467034631963441[459] = 0; + out_1333467034631963441[460] = 0; + out_1333467034631963441[461] = 1.0; } -void f_fun(double *state, double dt, double *out_653667760006229873) { - out_653667760006229873[0] = dt*state[7] + state[0]; - out_653667760006229873[1] = dt*state[8] + state[1]; - out_653667760006229873[2] = dt*state[9] + state[2]; - out_653667760006229873[3] = dt*(-0.5*state[4]*state[10] - 0.5*state[5]*state[11] - 0.5*state[6]*state[12]) + state[3]; - out_653667760006229873[4] = dt*(0.5*state[3]*state[10] + 0.5*state[5]*state[12] - 0.5*state[6]*state[11]) + state[4]; - out_653667760006229873[5] = dt*(0.5*state[3]*state[11] - 0.5*state[4]*state[12] + 0.5*state[6]*state[10]) + state[5]; - out_653667760006229873[6] = dt*(0.5*state[3]*state[12] + 0.5*state[4]*state[11] - 0.5*state[5]*state[10]) + state[6]; - out_653667760006229873[7] = dt*((2*state[3]*state[5] + 2*state[4]*state[6])*state[18] + (-2*state[3]*state[6] + 2*state[4]*state[5])*state[17] + (pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) - pow(state[6], 2))*state[16]) + state[7]; - out_653667760006229873[8] = dt*((-2*state[3]*state[4] + 2*state[5]*state[6])*state[18] + (2*state[3]*state[6] + 2*state[4]*state[5])*state[16] + (pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) - pow(state[6], 2))*state[17]) + state[8]; - out_653667760006229873[9] = dt*((2*state[3]*state[4] + 2*state[5]*state[6])*state[17] + (-2*state[3]*state[5] + 2*state[4]*state[6])*state[16] + (pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2))*state[18]) + state[9]; - out_653667760006229873[10] = state[10]; - out_653667760006229873[11] = state[11]; - out_653667760006229873[12] = state[12]; - out_653667760006229873[13] = state[13]; - out_653667760006229873[14] = state[14]; - out_653667760006229873[15] = state[15]; - out_653667760006229873[16] = state[16]; - out_653667760006229873[17] = state[17]; - out_653667760006229873[18] = state[18]; - out_653667760006229873[19] = state[19]; - out_653667760006229873[20] = state[20]; - out_653667760006229873[21] = state[21]; +void f_fun(double *state, double dt, double *out_1638653065682139689) { + out_1638653065682139689[0] = dt*state[7] + state[0]; + out_1638653065682139689[1] = dt*state[8] + state[1]; + out_1638653065682139689[2] = dt*state[9] + state[2]; + out_1638653065682139689[3] = dt*(-0.5*state[4]*state[10] - 0.5*state[5]*state[11] - 0.5*state[6]*state[12]) + state[3]; + out_1638653065682139689[4] = dt*(0.5*state[3]*state[10] + 0.5*state[5]*state[12] - 0.5*state[6]*state[11]) + state[4]; + out_1638653065682139689[5] = dt*(0.5*state[3]*state[11] - 0.5*state[4]*state[12] + 0.5*state[6]*state[10]) + state[5]; + out_1638653065682139689[6] = dt*(0.5*state[3]*state[12] + 0.5*state[4]*state[11] - 0.5*state[5]*state[10]) + state[6]; + out_1638653065682139689[7] = dt*((2*state[3]*state[5] + 2*state[4]*state[6])*state[18] + (-2*state[3]*state[6] + 2*state[4]*state[5])*state[17] + (pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) - pow(state[6], 2))*state[16]) + state[7]; + out_1638653065682139689[8] = dt*((-2*state[3]*state[4] + 2*state[5]*state[6])*state[18] + (2*state[3]*state[6] + 2*state[4]*state[5])*state[16] + (pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) - pow(state[6], 2))*state[17]) + state[8]; + out_1638653065682139689[9] = dt*((2*state[3]*state[4] + 2*state[5]*state[6])*state[17] + (-2*state[3]*state[5] + 2*state[4]*state[6])*state[16] + (pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2))*state[18]) + state[9]; + out_1638653065682139689[10] = state[10]; + out_1638653065682139689[11] = state[11]; + out_1638653065682139689[12] = state[12]; + out_1638653065682139689[13] = state[13]; + out_1638653065682139689[14] = state[14]; + out_1638653065682139689[15] = state[15]; + out_1638653065682139689[16] = state[16]; + out_1638653065682139689[17] = state[17]; + out_1638653065682139689[18] = state[18]; + out_1638653065682139689[19] = state[19]; + out_1638653065682139689[20] = state[20]; + out_1638653065682139689[21] = state[21]; } -void F_fun(double *state, double dt, double *out_8944506884882647575) { - out_8944506884882647575[0] = 1; - out_8944506884882647575[1] = 0; - out_8944506884882647575[2] = 0; - out_8944506884882647575[3] = 0; - out_8944506884882647575[4] = 0; - out_8944506884882647575[5] = 0; - out_8944506884882647575[6] = dt; - out_8944506884882647575[7] = 0; - out_8944506884882647575[8] = 0; - out_8944506884882647575[9] = 0; - out_8944506884882647575[10] = 0; - out_8944506884882647575[11] = 0; - out_8944506884882647575[12] = 0; - out_8944506884882647575[13] = 0; - out_8944506884882647575[14] = 0; - out_8944506884882647575[15] = 0; - out_8944506884882647575[16] = 0; - out_8944506884882647575[17] = 0; - out_8944506884882647575[18] = 0; - out_8944506884882647575[19] = 0; - out_8944506884882647575[20] = 0; - out_8944506884882647575[21] = 0; - out_8944506884882647575[22] = 1; - out_8944506884882647575[23] = 0; - out_8944506884882647575[24] = 0; - out_8944506884882647575[25] = 0; - out_8944506884882647575[26] = 0; - out_8944506884882647575[27] = 0; - out_8944506884882647575[28] = dt; - out_8944506884882647575[29] = 0; - out_8944506884882647575[30] = 0; - out_8944506884882647575[31] = 0; - out_8944506884882647575[32] = 0; - out_8944506884882647575[33] = 0; - out_8944506884882647575[34] = 0; - out_8944506884882647575[35] = 0; - out_8944506884882647575[36] = 0; - out_8944506884882647575[37] = 0; - out_8944506884882647575[38] = 0; - out_8944506884882647575[39] = 0; - out_8944506884882647575[40] = 0; - out_8944506884882647575[41] = 0; - out_8944506884882647575[42] = 0; - out_8944506884882647575[43] = 0; - out_8944506884882647575[44] = 1; - out_8944506884882647575[45] = 0; - out_8944506884882647575[46] = 0; - out_8944506884882647575[47] = 0; - out_8944506884882647575[48] = 0; - out_8944506884882647575[49] = 0; - out_8944506884882647575[50] = dt; - out_8944506884882647575[51] = 0; - out_8944506884882647575[52] = 0; - out_8944506884882647575[53] = 0; - out_8944506884882647575[54] = 0; - out_8944506884882647575[55] = 0; - out_8944506884882647575[56] = 0; - out_8944506884882647575[57] = 0; - out_8944506884882647575[58] = 0; - out_8944506884882647575[59] = 0; - out_8944506884882647575[60] = 0; - out_8944506884882647575[61] = 0; - out_8944506884882647575[62] = 0; - out_8944506884882647575[63] = 0; - out_8944506884882647575[64] = 0; - out_8944506884882647575[65] = 0; - out_8944506884882647575[66] = 1; - out_8944506884882647575[67] = dt*((2*state[3]*state[4] + 2*state[5]*state[6])*state[11] + (-2*state[3]*state[5] + 2*state[4]*state[6])*state[10] + (pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2))*state[12]); - out_8944506884882647575[68] = dt*((2*state[3]*state[4] - 2*state[5]*state[6])*state[12] + (-2*state[3]*state[6] - 2*state[4]*state[5])*state[10] + (-pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2))*state[11]); - out_8944506884882647575[69] = 0; - out_8944506884882647575[70] = 0; - out_8944506884882647575[71] = 0; - out_8944506884882647575[72] = dt*(pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) - pow(state[6], 2)); - out_8944506884882647575[73] = dt*(-2*state[3]*state[6] + 2*state[4]*state[5]); - out_8944506884882647575[74] = dt*(2*state[3]*state[5] + 2*state[4]*state[6]); - out_8944506884882647575[75] = 0; - out_8944506884882647575[76] = 0; - out_8944506884882647575[77] = 0; - out_8944506884882647575[78] = 0; - out_8944506884882647575[79] = 0; - out_8944506884882647575[80] = 0; - out_8944506884882647575[81] = 0; - out_8944506884882647575[82] = 0; - out_8944506884882647575[83] = 0; - out_8944506884882647575[84] = 0; - out_8944506884882647575[85] = 0; - out_8944506884882647575[86] = 0; - out_8944506884882647575[87] = dt*(-(2*state[3]*state[4] + 2*state[5]*state[6])*state[11] - (-2*state[3]*state[5] + 2*state[4]*state[6])*state[10] - (pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2))*state[12]); - out_8944506884882647575[88] = 1; - out_8944506884882647575[89] = dt*((2*state[3]*state[5] + 2*state[4]*state[6])*state[12] + (-2*state[3]*state[6] + 2*state[4]*state[5])*state[11] + (pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) - pow(state[6], 2))*state[10]); - out_8944506884882647575[90] = 0; - out_8944506884882647575[91] = 0; - out_8944506884882647575[92] = 0; - out_8944506884882647575[93] = dt*(2*state[3]*state[6] + 2*state[4]*state[5]); - out_8944506884882647575[94] = dt*(pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) - pow(state[6], 2)); - out_8944506884882647575[95] = dt*(-2*state[3]*state[4] + 2*state[5]*state[6]); - out_8944506884882647575[96] = 0; - out_8944506884882647575[97] = 0; - out_8944506884882647575[98] = 0; - out_8944506884882647575[99] = 0; - out_8944506884882647575[100] = 0; - out_8944506884882647575[101] = 0; - out_8944506884882647575[102] = 0; - out_8944506884882647575[103] = 0; - out_8944506884882647575[104] = 0; - out_8944506884882647575[105] = 0; - out_8944506884882647575[106] = 0; - out_8944506884882647575[107] = 0; - out_8944506884882647575[108] = dt*((-2*state[3]*state[4] + 2*state[5]*state[6])*state[12] + (2*state[3]*state[6] + 2*state[4]*state[5])*state[10] + (pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) - pow(state[6], 2))*state[11]); - out_8944506884882647575[109] = dt*((-2*state[3]*state[5] - 2*state[4]*state[6])*state[12] + (2*state[3]*state[6] - 2*state[4]*state[5])*state[11] + (-pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) + pow(state[6], 2))*state[10]); - out_8944506884882647575[110] = 1; - out_8944506884882647575[111] = 0; - out_8944506884882647575[112] = 0; - out_8944506884882647575[113] = 0; - out_8944506884882647575[114] = dt*(-2*state[3]*state[5] + 2*state[4]*state[6]); - out_8944506884882647575[115] = dt*(2*state[3]*state[4] + 2*state[5]*state[6]); - out_8944506884882647575[116] = dt*(pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2)); - out_8944506884882647575[117] = 0; - out_8944506884882647575[118] = 0; - out_8944506884882647575[119] = 0; - out_8944506884882647575[120] = 0; - out_8944506884882647575[121] = 0; - out_8944506884882647575[122] = 0; - out_8944506884882647575[123] = 0; - out_8944506884882647575[124] = 0; - out_8944506884882647575[125] = 0; - out_8944506884882647575[126] = 0; - out_8944506884882647575[127] = 0; - out_8944506884882647575[128] = 0; - out_8944506884882647575[129] = 0; - out_8944506884882647575[130] = dt*((2*state[3]*state[4] + 2*state[5]*state[6])*state[17] + (-2*state[3]*state[5] + 2*state[4]*state[6])*state[16] + (pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2))*state[18]); - out_8944506884882647575[131] = dt*((2*state[3]*state[4] - 2*state[5]*state[6])*state[18] + (-2*state[3]*state[6] - 2*state[4]*state[5])*state[16] + (-pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2))*state[17]); - out_8944506884882647575[132] = 1; - out_8944506884882647575[133] = 0; - out_8944506884882647575[134] = 0; - out_8944506884882647575[135] = 0; - out_8944506884882647575[136] = 0; - out_8944506884882647575[137] = 0; - out_8944506884882647575[138] = 0; - out_8944506884882647575[139] = 0; - out_8944506884882647575[140] = 0; - out_8944506884882647575[141] = dt*(pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) - pow(state[6], 2)); - out_8944506884882647575[142] = dt*(-2*state[3]*state[6] + 2*state[4]*state[5]); - out_8944506884882647575[143] = dt*(2*state[3]*state[5] + 2*state[4]*state[6]); - out_8944506884882647575[144] = 0; - out_8944506884882647575[145] = 0; - out_8944506884882647575[146] = 0; - out_8944506884882647575[147] = 0; - out_8944506884882647575[148] = 0; - out_8944506884882647575[149] = 0; - out_8944506884882647575[150] = dt*(-(2*state[3]*state[4] + 2*state[5]*state[6])*state[17] - (-2*state[3]*state[5] + 2*state[4]*state[6])*state[16] - (pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2))*state[18]); - out_8944506884882647575[151] = 0; - out_8944506884882647575[152] = dt*((2*state[3]*state[5] + 2*state[4]*state[6])*state[18] + (-2*state[3]*state[6] + 2*state[4]*state[5])*state[17] + (pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) - pow(state[6], 2))*state[16]); - out_8944506884882647575[153] = 0; - out_8944506884882647575[154] = 1; - out_8944506884882647575[155] = 0; - out_8944506884882647575[156] = 0; - out_8944506884882647575[157] = 0; - out_8944506884882647575[158] = 0; - out_8944506884882647575[159] = 0; - out_8944506884882647575[160] = 0; - out_8944506884882647575[161] = 0; - out_8944506884882647575[162] = dt*(2*state[3]*state[6] + 2*state[4]*state[5]); - out_8944506884882647575[163] = dt*(pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) - pow(state[6], 2)); - out_8944506884882647575[164] = dt*(-2*state[3]*state[4] + 2*state[5]*state[6]); - out_8944506884882647575[165] = 0; - out_8944506884882647575[166] = 0; - out_8944506884882647575[167] = 0; - out_8944506884882647575[168] = 0; - out_8944506884882647575[169] = 0; - out_8944506884882647575[170] = 0; - out_8944506884882647575[171] = dt*((-2*state[3]*state[4] + 2*state[5]*state[6])*state[18] + (2*state[3]*state[6] + 2*state[4]*state[5])*state[16] + (pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) - pow(state[6], 2))*state[17]); - out_8944506884882647575[172] = dt*((-2*state[3]*state[5] - 2*state[4]*state[6])*state[18] + (2*state[3]*state[6] - 2*state[4]*state[5])*state[17] + (-pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) + pow(state[6], 2))*state[16]); - out_8944506884882647575[173] = 0; - out_8944506884882647575[174] = 0; - out_8944506884882647575[175] = 0; - out_8944506884882647575[176] = 1; - out_8944506884882647575[177] = 0; - out_8944506884882647575[178] = 0; - out_8944506884882647575[179] = 0; - out_8944506884882647575[180] = 0; - out_8944506884882647575[181] = 0; - out_8944506884882647575[182] = 0; - out_8944506884882647575[183] = dt*(-2*state[3]*state[5] + 2*state[4]*state[6]); - out_8944506884882647575[184] = dt*(2*state[3]*state[4] + 2*state[5]*state[6]); - out_8944506884882647575[185] = dt*(pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2)); - out_8944506884882647575[186] = 0; - out_8944506884882647575[187] = 0; - out_8944506884882647575[188] = 0; - out_8944506884882647575[189] = 0; - out_8944506884882647575[190] = 0; - out_8944506884882647575[191] = 0; - out_8944506884882647575[192] = 0; - out_8944506884882647575[193] = 0; - out_8944506884882647575[194] = 0; - out_8944506884882647575[195] = 0; - out_8944506884882647575[196] = 0; - out_8944506884882647575[197] = 0; - out_8944506884882647575[198] = 1; - out_8944506884882647575[199] = 0; - out_8944506884882647575[200] = 0; - out_8944506884882647575[201] = 0; - out_8944506884882647575[202] = 0; - out_8944506884882647575[203] = 0; - out_8944506884882647575[204] = 0; - out_8944506884882647575[205] = 0; - out_8944506884882647575[206] = 0; - out_8944506884882647575[207] = 0; - out_8944506884882647575[208] = 0; - out_8944506884882647575[209] = 0; - out_8944506884882647575[210] = 0; - out_8944506884882647575[211] = 0; - out_8944506884882647575[212] = 0; - out_8944506884882647575[213] = 0; - out_8944506884882647575[214] = 0; - out_8944506884882647575[215] = 0; - out_8944506884882647575[216] = 0; - out_8944506884882647575[217] = 0; - out_8944506884882647575[218] = 0; - out_8944506884882647575[219] = 0; - out_8944506884882647575[220] = 1; - out_8944506884882647575[221] = 0; - out_8944506884882647575[222] = 0; - out_8944506884882647575[223] = 0; - out_8944506884882647575[224] = 0; - out_8944506884882647575[225] = 0; - out_8944506884882647575[226] = 0; - out_8944506884882647575[227] = 0; - out_8944506884882647575[228] = 0; - out_8944506884882647575[229] = 0; - out_8944506884882647575[230] = 0; - out_8944506884882647575[231] = 0; - out_8944506884882647575[232] = 0; - out_8944506884882647575[233] = 0; - out_8944506884882647575[234] = 0; - out_8944506884882647575[235] = 0; - out_8944506884882647575[236] = 0; - out_8944506884882647575[237] = 0; - out_8944506884882647575[238] = 0; - out_8944506884882647575[239] = 0; - out_8944506884882647575[240] = 0; - out_8944506884882647575[241] = 0; - out_8944506884882647575[242] = 1; - out_8944506884882647575[243] = 0; - out_8944506884882647575[244] = 0; - out_8944506884882647575[245] = 0; - out_8944506884882647575[246] = 0; - out_8944506884882647575[247] = 0; - out_8944506884882647575[248] = 0; - out_8944506884882647575[249] = 0; - out_8944506884882647575[250] = 0; - out_8944506884882647575[251] = 0; - out_8944506884882647575[252] = 0; - out_8944506884882647575[253] = 0; - out_8944506884882647575[254] = 0; - out_8944506884882647575[255] = 0; - out_8944506884882647575[256] = 0; - out_8944506884882647575[257] = 0; - out_8944506884882647575[258] = 0; - out_8944506884882647575[259] = 0; - out_8944506884882647575[260] = 0; - out_8944506884882647575[261] = 0; - out_8944506884882647575[262] = 0; - out_8944506884882647575[263] = 0; - out_8944506884882647575[264] = 1; - out_8944506884882647575[265] = 0; - out_8944506884882647575[266] = 0; - out_8944506884882647575[267] = 0; - out_8944506884882647575[268] = 0; - out_8944506884882647575[269] = 0; - out_8944506884882647575[270] = 0; - out_8944506884882647575[271] = 0; - out_8944506884882647575[272] = 0; - out_8944506884882647575[273] = 0; - out_8944506884882647575[274] = 0; - out_8944506884882647575[275] = 0; - out_8944506884882647575[276] = 0; - out_8944506884882647575[277] = 0; - out_8944506884882647575[278] = 0; - out_8944506884882647575[279] = 0; - out_8944506884882647575[280] = 0; - out_8944506884882647575[281] = 0; - out_8944506884882647575[282] = 0; - out_8944506884882647575[283] = 0; - out_8944506884882647575[284] = 0; - out_8944506884882647575[285] = 0; - out_8944506884882647575[286] = 1; - out_8944506884882647575[287] = 0; - out_8944506884882647575[288] = 0; - out_8944506884882647575[289] = 0; - out_8944506884882647575[290] = 0; - out_8944506884882647575[291] = 0; - out_8944506884882647575[292] = 0; - out_8944506884882647575[293] = 0; - out_8944506884882647575[294] = 0; - out_8944506884882647575[295] = 0; - out_8944506884882647575[296] = 0; - out_8944506884882647575[297] = 0; - out_8944506884882647575[298] = 0; - out_8944506884882647575[299] = 0; - out_8944506884882647575[300] = 0; - out_8944506884882647575[301] = 0; - out_8944506884882647575[302] = 0; - out_8944506884882647575[303] = 0; - out_8944506884882647575[304] = 0; - out_8944506884882647575[305] = 0; - out_8944506884882647575[306] = 0; - out_8944506884882647575[307] = 0; - out_8944506884882647575[308] = 1; - out_8944506884882647575[309] = 0; - out_8944506884882647575[310] = 0; - out_8944506884882647575[311] = 0; - out_8944506884882647575[312] = 0; - out_8944506884882647575[313] = 0; - out_8944506884882647575[314] = 0; - out_8944506884882647575[315] = 0; - out_8944506884882647575[316] = 0; - out_8944506884882647575[317] = 0; - out_8944506884882647575[318] = 0; - out_8944506884882647575[319] = 0; - out_8944506884882647575[320] = 0; - out_8944506884882647575[321] = 0; - out_8944506884882647575[322] = 0; - out_8944506884882647575[323] = 0; - out_8944506884882647575[324] = 0; - out_8944506884882647575[325] = 0; - out_8944506884882647575[326] = 0; - out_8944506884882647575[327] = 0; - out_8944506884882647575[328] = 0; - out_8944506884882647575[329] = 0; - out_8944506884882647575[330] = 1; - out_8944506884882647575[331] = 0; - out_8944506884882647575[332] = 0; - out_8944506884882647575[333] = 0; - out_8944506884882647575[334] = 0; - out_8944506884882647575[335] = 0; - out_8944506884882647575[336] = 0; - out_8944506884882647575[337] = 0; - out_8944506884882647575[338] = 0; - out_8944506884882647575[339] = 0; - out_8944506884882647575[340] = 0; - out_8944506884882647575[341] = 0; - out_8944506884882647575[342] = 0; - out_8944506884882647575[343] = 0; - out_8944506884882647575[344] = 0; - out_8944506884882647575[345] = 0; - out_8944506884882647575[346] = 0; - out_8944506884882647575[347] = 0; - out_8944506884882647575[348] = 0; - out_8944506884882647575[349] = 0; - out_8944506884882647575[350] = 0; - out_8944506884882647575[351] = 0; - out_8944506884882647575[352] = 1; - out_8944506884882647575[353] = 0; - out_8944506884882647575[354] = 0; - out_8944506884882647575[355] = 0; - out_8944506884882647575[356] = 0; - out_8944506884882647575[357] = 0; - out_8944506884882647575[358] = 0; - out_8944506884882647575[359] = 0; - out_8944506884882647575[360] = 0; - out_8944506884882647575[361] = 0; - out_8944506884882647575[362] = 0; - out_8944506884882647575[363] = 0; - out_8944506884882647575[364] = 0; - out_8944506884882647575[365] = 0; - out_8944506884882647575[366] = 0; - out_8944506884882647575[367] = 0; - out_8944506884882647575[368] = 0; - out_8944506884882647575[369] = 0; - out_8944506884882647575[370] = 0; - out_8944506884882647575[371] = 0; - out_8944506884882647575[372] = 0; - out_8944506884882647575[373] = 0; - out_8944506884882647575[374] = 1; - out_8944506884882647575[375] = 0; - out_8944506884882647575[376] = 0; - out_8944506884882647575[377] = 0; - out_8944506884882647575[378] = 0; - out_8944506884882647575[379] = 0; - out_8944506884882647575[380] = 0; - out_8944506884882647575[381] = 0; - out_8944506884882647575[382] = 0; - out_8944506884882647575[383] = 0; - out_8944506884882647575[384] = 0; - out_8944506884882647575[385] = 0; - out_8944506884882647575[386] = 0; - out_8944506884882647575[387] = 0; - out_8944506884882647575[388] = 0; - out_8944506884882647575[389] = 0; - out_8944506884882647575[390] = 0; - out_8944506884882647575[391] = 0; - out_8944506884882647575[392] = 0; - out_8944506884882647575[393] = 0; - out_8944506884882647575[394] = 0; - out_8944506884882647575[395] = 0; - out_8944506884882647575[396] = 1; - out_8944506884882647575[397] = 0; - out_8944506884882647575[398] = 0; - out_8944506884882647575[399] = 0; - out_8944506884882647575[400] = 0; - out_8944506884882647575[401] = 0; - out_8944506884882647575[402] = 0; - out_8944506884882647575[403] = 0; - out_8944506884882647575[404] = 0; - out_8944506884882647575[405] = 0; - out_8944506884882647575[406] = 0; - out_8944506884882647575[407] = 0; - out_8944506884882647575[408] = 0; - out_8944506884882647575[409] = 0; - out_8944506884882647575[410] = 0; - out_8944506884882647575[411] = 0; - out_8944506884882647575[412] = 0; - out_8944506884882647575[413] = 0; - out_8944506884882647575[414] = 0; - out_8944506884882647575[415] = 0; - out_8944506884882647575[416] = 0; - out_8944506884882647575[417] = 0; - out_8944506884882647575[418] = 1; - out_8944506884882647575[419] = 0; - out_8944506884882647575[420] = 0; - out_8944506884882647575[421] = 0; - out_8944506884882647575[422] = 0; - out_8944506884882647575[423] = 0; - out_8944506884882647575[424] = 0; - out_8944506884882647575[425] = 0; - out_8944506884882647575[426] = 0; - out_8944506884882647575[427] = 0; - out_8944506884882647575[428] = 0; - out_8944506884882647575[429] = 0; - out_8944506884882647575[430] = 0; - out_8944506884882647575[431] = 0; - out_8944506884882647575[432] = 0; - out_8944506884882647575[433] = 0; - out_8944506884882647575[434] = 0; - out_8944506884882647575[435] = 0; - out_8944506884882647575[436] = 0; - out_8944506884882647575[437] = 0; - out_8944506884882647575[438] = 0; - out_8944506884882647575[439] = 0; - out_8944506884882647575[440] = 1; +void F_fun(double *state, double dt, double *out_3627592268953963269) { + out_3627592268953963269[0] = 1; + out_3627592268953963269[1] = 0; + out_3627592268953963269[2] = 0; + out_3627592268953963269[3] = 0; + out_3627592268953963269[4] = 0; + out_3627592268953963269[5] = 0; + out_3627592268953963269[6] = dt; + out_3627592268953963269[7] = 0; + out_3627592268953963269[8] = 0; + out_3627592268953963269[9] = 0; + out_3627592268953963269[10] = 0; + out_3627592268953963269[11] = 0; + out_3627592268953963269[12] = 0; + out_3627592268953963269[13] = 0; + out_3627592268953963269[14] = 0; + out_3627592268953963269[15] = 0; + out_3627592268953963269[16] = 0; + out_3627592268953963269[17] = 0; + out_3627592268953963269[18] = 0; + out_3627592268953963269[19] = 0; + out_3627592268953963269[20] = 0; + out_3627592268953963269[21] = 0; + out_3627592268953963269[22] = 1; + out_3627592268953963269[23] = 0; + out_3627592268953963269[24] = 0; + out_3627592268953963269[25] = 0; + out_3627592268953963269[26] = 0; + out_3627592268953963269[27] = 0; + out_3627592268953963269[28] = dt; + out_3627592268953963269[29] = 0; + out_3627592268953963269[30] = 0; + out_3627592268953963269[31] = 0; + out_3627592268953963269[32] = 0; + out_3627592268953963269[33] = 0; + out_3627592268953963269[34] = 0; + out_3627592268953963269[35] = 0; + out_3627592268953963269[36] = 0; + out_3627592268953963269[37] = 0; + out_3627592268953963269[38] = 0; + out_3627592268953963269[39] = 0; + out_3627592268953963269[40] = 0; + out_3627592268953963269[41] = 0; + out_3627592268953963269[42] = 0; + out_3627592268953963269[43] = 0; + out_3627592268953963269[44] = 1; + out_3627592268953963269[45] = 0; + out_3627592268953963269[46] = 0; + out_3627592268953963269[47] = 0; + out_3627592268953963269[48] = 0; + out_3627592268953963269[49] = 0; + out_3627592268953963269[50] = dt; + out_3627592268953963269[51] = 0; + out_3627592268953963269[52] = 0; + out_3627592268953963269[53] = 0; + out_3627592268953963269[54] = 0; + out_3627592268953963269[55] = 0; + out_3627592268953963269[56] = 0; + out_3627592268953963269[57] = 0; + out_3627592268953963269[58] = 0; + out_3627592268953963269[59] = 0; + out_3627592268953963269[60] = 0; + out_3627592268953963269[61] = 0; + out_3627592268953963269[62] = 0; + out_3627592268953963269[63] = 0; + out_3627592268953963269[64] = 0; + out_3627592268953963269[65] = 0; + out_3627592268953963269[66] = 1; + out_3627592268953963269[67] = dt*((2*state[3]*state[4] + 2*state[5]*state[6])*state[11] + (-2*state[3]*state[5] + 2*state[4]*state[6])*state[10] + (pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2))*state[12]); + out_3627592268953963269[68] = dt*((2*state[3]*state[4] - 2*state[5]*state[6])*state[12] + (-2*state[3]*state[6] - 2*state[4]*state[5])*state[10] + (-pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2))*state[11]); + out_3627592268953963269[69] = 0; + out_3627592268953963269[70] = 0; + out_3627592268953963269[71] = 0; + out_3627592268953963269[72] = dt*(pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) - pow(state[6], 2)); + out_3627592268953963269[73] = dt*(-2*state[3]*state[6] + 2*state[4]*state[5]); + out_3627592268953963269[74] = dt*(2*state[3]*state[5] + 2*state[4]*state[6]); + out_3627592268953963269[75] = 0; + out_3627592268953963269[76] = 0; + out_3627592268953963269[77] = 0; + out_3627592268953963269[78] = 0; + out_3627592268953963269[79] = 0; + out_3627592268953963269[80] = 0; + out_3627592268953963269[81] = 0; + out_3627592268953963269[82] = 0; + out_3627592268953963269[83] = 0; + out_3627592268953963269[84] = 0; + out_3627592268953963269[85] = 0; + out_3627592268953963269[86] = 0; + out_3627592268953963269[87] = dt*(-(2*state[3]*state[4] + 2*state[5]*state[6])*state[11] - (-2*state[3]*state[5] + 2*state[4]*state[6])*state[10] - (pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2))*state[12]); + out_3627592268953963269[88] = 1; + out_3627592268953963269[89] = dt*((2*state[3]*state[5] + 2*state[4]*state[6])*state[12] + (-2*state[3]*state[6] + 2*state[4]*state[5])*state[11] + (pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) - pow(state[6], 2))*state[10]); + out_3627592268953963269[90] = 0; + out_3627592268953963269[91] = 0; + out_3627592268953963269[92] = 0; + out_3627592268953963269[93] = dt*(2*state[3]*state[6] + 2*state[4]*state[5]); + out_3627592268953963269[94] = dt*(pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) - pow(state[6], 2)); + out_3627592268953963269[95] = dt*(-2*state[3]*state[4] + 2*state[5]*state[6]); + out_3627592268953963269[96] = 0; + out_3627592268953963269[97] = 0; + out_3627592268953963269[98] = 0; + out_3627592268953963269[99] = 0; + out_3627592268953963269[100] = 0; + out_3627592268953963269[101] = 0; + out_3627592268953963269[102] = 0; + out_3627592268953963269[103] = 0; + out_3627592268953963269[104] = 0; + out_3627592268953963269[105] = 0; + out_3627592268953963269[106] = 0; + out_3627592268953963269[107] = 0; + out_3627592268953963269[108] = dt*((-2*state[3]*state[4] + 2*state[5]*state[6])*state[12] + (2*state[3]*state[6] + 2*state[4]*state[5])*state[10] + (pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) - pow(state[6], 2))*state[11]); + out_3627592268953963269[109] = dt*((-2*state[3]*state[5] - 2*state[4]*state[6])*state[12] + (2*state[3]*state[6] - 2*state[4]*state[5])*state[11] + (-pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) + pow(state[6], 2))*state[10]); + out_3627592268953963269[110] = 1; + out_3627592268953963269[111] = 0; + out_3627592268953963269[112] = 0; + out_3627592268953963269[113] = 0; + out_3627592268953963269[114] = dt*(-2*state[3]*state[5] + 2*state[4]*state[6]); + out_3627592268953963269[115] = dt*(2*state[3]*state[4] + 2*state[5]*state[6]); + out_3627592268953963269[116] = dt*(pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2)); + out_3627592268953963269[117] = 0; + out_3627592268953963269[118] = 0; + out_3627592268953963269[119] = 0; + out_3627592268953963269[120] = 0; + out_3627592268953963269[121] = 0; + out_3627592268953963269[122] = 0; + out_3627592268953963269[123] = 0; + out_3627592268953963269[124] = 0; + out_3627592268953963269[125] = 0; + out_3627592268953963269[126] = 0; + out_3627592268953963269[127] = 0; + out_3627592268953963269[128] = 0; + out_3627592268953963269[129] = 0; + out_3627592268953963269[130] = dt*((2*state[3]*state[4] + 2*state[5]*state[6])*state[17] + (-2*state[3]*state[5] + 2*state[4]*state[6])*state[16] + (pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2))*state[18]); + out_3627592268953963269[131] = dt*((2*state[3]*state[4] - 2*state[5]*state[6])*state[18] + (-2*state[3]*state[6] - 2*state[4]*state[5])*state[16] + (-pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2))*state[17]); + out_3627592268953963269[132] = 1; + out_3627592268953963269[133] = 0; + out_3627592268953963269[134] = 0; + out_3627592268953963269[135] = 0; + out_3627592268953963269[136] = 0; + out_3627592268953963269[137] = 0; + out_3627592268953963269[138] = 0; + out_3627592268953963269[139] = 0; + out_3627592268953963269[140] = 0; + out_3627592268953963269[141] = dt*(pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) - pow(state[6], 2)); + out_3627592268953963269[142] = dt*(-2*state[3]*state[6] + 2*state[4]*state[5]); + out_3627592268953963269[143] = dt*(2*state[3]*state[5] + 2*state[4]*state[6]); + out_3627592268953963269[144] = 0; + out_3627592268953963269[145] = 0; + out_3627592268953963269[146] = 0; + out_3627592268953963269[147] = 0; + out_3627592268953963269[148] = 0; + out_3627592268953963269[149] = 0; + out_3627592268953963269[150] = dt*(-(2*state[3]*state[4] + 2*state[5]*state[6])*state[17] - (-2*state[3]*state[5] + 2*state[4]*state[6])*state[16] - (pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2))*state[18]); + out_3627592268953963269[151] = 0; + out_3627592268953963269[152] = dt*((2*state[3]*state[5] + 2*state[4]*state[6])*state[18] + (-2*state[3]*state[6] + 2*state[4]*state[5])*state[17] + (pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) - pow(state[6], 2))*state[16]); + out_3627592268953963269[153] = 0; + out_3627592268953963269[154] = 1; + out_3627592268953963269[155] = 0; + out_3627592268953963269[156] = 0; + out_3627592268953963269[157] = 0; + out_3627592268953963269[158] = 0; + out_3627592268953963269[159] = 0; + out_3627592268953963269[160] = 0; + out_3627592268953963269[161] = 0; + out_3627592268953963269[162] = dt*(2*state[3]*state[6] + 2*state[4]*state[5]); + out_3627592268953963269[163] = dt*(pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) - pow(state[6], 2)); + out_3627592268953963269[164] = dt*(-2*state[3]*state[4] + 2*state[5]*state[6]); + out_3627592268953963269[165] = 0; + out_3627592268953963269[166] = 0; + out_3627592268953963269[167] = 0; + out_3627592268953963269[168] = 0; + out_3627592268953963269[169] = 0; + out_3627592268953963269[170] = 0; + out_3627592268953963269[171] = dt*((-2*state[3]*state[4] + 2*state[5]*state[6])*state[18] + (2*state[3]*state[6] + 2*state[4]*state[5])*state[16] + (pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) - pow(state[6], 2))*state[17]); + out_3627592268953963269[172] = dt*((-2*state[3]*state[5] - 2*state[4]*state[6])*state[18] + (2*state[3]*state[6] - 2*state[4]*state[5])*state[17] + (-pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) + pow(state[6], 2))*state[16]); + out_3627592268953963269[173] = 0; + out_3627592268953963269[174] = 0; + out_3627592268953963269[175] = 0; + out_3627592268953963269[176] = 1; + out_3627592268953963269[177] = 0; + out_3627592268953963269[178] = 0; + out_3627592268953963269[179] = 0; + out_3627592268953963269[180] = 0; + out_3627592268953963269[181] = 0; + out_3627592268953963269[182] = 0; + out_3627592268953963269[183] = dt*(-2*state[3]*state[5] + 2*state[4]*state[6]); + out_3627592268953963269[184] = dt*(2*state[3]*state[4] + 2*state[5]*state[6]); + out_3627592268953963269[185] = dt*(pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2)); + out_3627592268953963269[186] = 0; + out_3627592268953963269[187] = 0; + out_3627592268953963269[188] = 0; + out_3627592268953963269[189] = 0; + out_3627592268953963269[190] = 0; + out_3627592268953963269[191] = 0; + out_3627592268953963269[192] = 0; + out_3627592268953963269[193] = 0; + out_3627592268953963269[194] = 0; + out_3627592268953963269[195] = 0; + out_3627592268953963269[196] = 0; + out_3627592268953963269[197] = 0; + out_3627592268953963269[198] = 1; + out_3627592268953963269[199] = 0; + out_3627592268953963269[200] = 0; + out_3627592268953963269[201] = 0; + out_3627592268953963269[202] = 0; + out_3627592268953963269[203] = 0; + out_3627592268953963269[204] = 0; + out_3627592268953963269[205] = 0; + out_3627592268953963269[206] = 0; + out_3627592268953963269[207] = 0; + out_3627592268953963269[208] = 0; + out_3627592268953963269[209] = 0; + out_3627592268953963269[210] = 0; + out_3627592268953963269[211] = 0; + out_3627592268953963269[212] = 0; + out_3627592268953963269[213] = 0; + out_3627592268953963269[214] = 0; + out_3627592268953963269[215] = 0; + out_3627592268953963269[216] = 0; + out_3627592268953963269[217] = 0; + out_3627592268953963269[218] = 0; + out_3627592268953963269[219] = 0; + out_3627592268953963269[220] = 1; + out_3627592268953963269[221] = 0; + out_3627592268953963269[222] = 0; + out_3627592268953963269[223] = 0; + out_3627592268953963269[224] = 0; + out_3627592268953963269[225] = 0; + out_3627592268953963269[226] = 0; + out_3627592268953963269[227] = 0; + out_3627592268953963269[228] = 0; + out_3627592268953963269[229] = 0; + out_3627592268953963269[230] = 0; + out_3627592268953963269[231] = 0; + out_3627592268953963269[232] = 0; + out_3627592268953963269[233] = 0; + out_3627592268953963269[234] = 0; + out_3627592268953963269[235] = 0; + out_3627592268953963269[236] = 0; + out_3627592268953963269[237] = 0; + out_3627592268953963269[238] = 0; + out_3627592268953963269[239] = 0; + out_3627592268953963269[240] = 0; + out_3627592268953963269[241] = 0; + out_3627592268953963269[242] = 1; + out_3627592268953963269[243] = 0; + out_3627592268953963269[244] = 0; + out_3627592268953963269[245] = 0; + out_3627592268953963269[246] = 0; + out_3627592268953963269[247] = 0; + out_3627592268953963269[248] = 0; + out_3627592268953963269[249] = 0; + out_3627592268953963269[250] = 0; + out_3627592268953963269[251] = 0; + out_3627592268953963269[252] = 0; + out_3627592268953963269[253] = 0; + out_3627592268953963269[254] = 0; + out_3627592268953963269[255] = 0; + out_3627592268953963269[256] = 0; + out_3627592268953963269[257] = 0; + out_3627592268953963269[258] = 0; + out_3627592268953963269[259] = 0; + out_3627592268953963269[260] = 0; + out_3627592268953963269[261] = 0; + out_3627592268953963269[262] = 0; + out_3627592268953963269[263] = 0; + out_3627592268953963269[264] = 1; + out_3627592268953963269[265] = 0; + out_3627592268953963269[266] = 0; + out_3627592268953963269[267] = 0; + out_3627592268953963269[268] = 0; + out_3627592268953963269[269] = 0; + out_3627592268953963269[270] = 0; + out_3627592268953963269[271] = 0; + out_3627592268953963269[272] = 0; + out_3627592268953963269[273] = 0; + out_3627592268953963269[274] = 0; + out_3627592268953963269[275] = 0; + out_3627592268953963269[276] = 0; + out_3627592268953963269[277] = 0; + out_3627592268953963269[278] = 0; + out_3627592268953963269[279] = 0; + out_3627592268953963269[280] = 0; + out_3627592268953963269[281] = 0; + out_3627592268953963269[282] = 0; + out_3627592268953963269[283] = 0; + out_3627592268953963269[284] = 0; + out_3627592268953963269[285] = 0; + out_3627592268953963269[286] = 1; + out_3627592268953963269[287] = 0; + out_3627592268953963269[288] = 0; + out_3627592268953963269[289] = 0; + out_3627592268953963269[290] = 0; + out_3627592268953963269[291] = 0; + out_3627592268953963269[292] = 0; + out_3627592268953963269[293] = 0; + out_3627592268953963269[294] = 0; + out_3627592268953963269[295] = 0; + out_3627592268953963269[296] = 0; + out_3627592268953963269[297] = 0; + out_3627592268953963269[298] = 0; + out_3627592268953963269[299] = 0; + out_3627592268953963269[300] = 0; + out_3627592268953963269[301] = 0; + out_3627592268953963269[302] = 0; + out_3627592268953963269[303] = 0; + out_3627592268953963269[304] = 0; + out_3627592268953963269[305] = 0; + out_3627592268953963269[306] = 0; + out_3627592268953963269[307] = 0; + out_3627592268953963269[308] = 1; + out_3627592268953963269[309] = 0; + out_3627592268953963269[310] = 0; + out_3627592268953963269[311] = 0; + out_3627592268953963269[312] = 0; + out_3627592268953963269[313] = 0; + out_3627592268953963269[314] = 0; + out_3627592268953963269[315] = 0; + out_3627592268953963269[316] = 0; + out_3627592268953963269[317] = 0; + out_3627592268953963269[318] = 0; + out_3627592268953963269[319] = 0; + out_3627592268953963269[320] = 0; + out_3627592268953963269[321] = 0; + out_3627592268953963269[322] = 0; + out_3627592268953963269[323] = 0; + out_3627592268953963269[324] = 0; + out_3627592268953963269[325] = 0; + out_3627592268953963269[326] = 0; + out_3627592268953963269[327] = 0; + out_3627592268953963269[328] = 0; + out_3627592268953963269[329] = 0; + out_3627592268953963269[330] = 1; + out_3627592268953963269[331] = 0; + out_3627592268953963269[332] = 0; + out_3627592268953963269[333] = 0; + out_3627592268953963269[334] = 0; + out_3627592268953963269[335] = 0; + out_3627592268953963269[336] = 0; + out_3627592268953963269[337] = 0; + out_3627592268953963269[338] = 0; + out_3627592268953963269[339] = 0; + out_3627592268953963269[340] = 0; + out_3627592268953963269[341] = 0; + out_3627592268953963269[342] = 0; + out_3627592268953963269[343] = 0; + out_3627592268953963269[344] = 0; + out_3627592268953963269[345] = 0; + out_3627592268953963269[346] = 0; + out_3627592268953963269[347] = 0; + out_3627592268953963269[348] = 0; + out_3627592268953963269[349] = 0; + out_3627592268953963269[350] = 0; + out_3627592268953963269[351] = 0; + out_3627592268953963269[352] = 1; + out_3627592268953963269[353] = 0; + out_3627592268953963269[354] = 0; + out_3627592268953963269[355] = 0; + out_3627592268953963269[356] = 0; + out_3627592268953963269[357] = 0; + out_3627592268953963269[358] = 0; + out_3627592268953963269[359] = 0; + out_3627592268953963269[360] = 0; + out_3627592268953963269[361] = 0; + out_3627592268953963269[362] = 0; + out_3627592268953963269[363] = 0; + out_3627592268953963269[364] = 0; + out_3627592268953963269[365] = 0; + out_3627592268953963269[366] = 0; + out_3627592268953963269[367] = 0; + out_3627592268953963269[368] = 0; + out_3627592268953963269[369] = 0; + out_3627592268953963269[370] = 0; + out_3627592268953963269[371] = 0; + out_3627592268953963269[372] = 0; + out_3627592268953963269[373] = 0; + out_3627592268953963269[374] = 1; + out_3627592268953963269[375] = 0; + out_3627592268953963269[376] = 0; + out_3627592268953963269[377] = 0; + out_3627592268953963269[378] = 0; + out_3627592268953963269[379] = 0; + out_3627592268953963269[380] = 0; + out_3627592268953963269[381] = 0; + out_3627592268953963269[382] = 0; + out_3627592268953963269[383] = 0; + out_3627592268953963269[384] = 0; + out_3627592268953963269[385] = 0; + out_3627592268953963269[386] = 0; + out_3627592268953963269[387] = 0; + out_3627592268953963269[388] = 0; + out_3627592268953963269[389] = 0; + out_3627592268953963269[390] = 0; + out_3627592268953963269[391] = 0; + out_3627592268953963269[392] = 0; + out_3627592268953963269[393] = 0; + out_3627592268953963269[394] = 0; + out_3627592268953963269[395] = 0; + out_3627592268953963269[396] = 1; + out_3627592268953963269[397] = 0; + out_3627592268953963269[398] = 0; + out_3627592268953963269[399] = 0; + out_3627592268953963269[400] = 0; + out_3627592268953963269[401] = 0; + out_3627592268953963269[402] = 0; + out_3627592268953963269[403] = 0; + out_3627592268953963269[404] = 0; + out_3627592268953963269[405] = 0; + out_3627592268953963269[406] = 0; + out_3627592268953963269[407] = 0; + out_3627592268953963269[408] = 0; + out_3627592268953963269[409] = 0; + out_3627592268953963269[410] = 0; + out_3627592268953963269[411] = 0; + out_3627592268953963269[412] = 0; + out_3627592268953963269[413] = 0; + out_3627592268953963269[414] = 0; + out_3627592268953963269[415] = 0; + out_3627592268953963269[416] = 0; + out_3627592268953963269[417] = 0; + out_3627592268953963269[418] = 1; + out_3627592268953963269[419] = 0; + out_3627592268953963269[420] = 0; + out_3627592268953963269[421] = 0; + out_3627592268953963269[422] = 0; + out_3627592268953963269[423] = 0; + out_3627592268953963269[424] = 0; + out_3627592268953963269[425] = 0; + out_3627592268953963269[426] = 0; + out_3627592268953963269[427] = 0; + out_3627592268953963269[428] = 0; + out_3627592268953963269[429] = 0; + out_3627592268953963269[430] = 0; + out_3627592268953963269[431] = 0; + out_3627592268953963269[432] = 0; + out_3627592268953963269[433] = 0; + out_3627592268953963269[434] = 0; + out_3627592268953963269[435] = 0; + out_3627592268953963269[436] = 0; + out_3627592268953963269[437] = 0; + out_3627592268953963269[438] = 0; + out_3627592268953963269[439] = 0; + out_3627592268953963269[440] = 1; } -void h_4(double *state, double *unused, double *out_6967130088459663654) { - out_6967130088459663654[0] = state[10] + state[13]; - out_6967130088459663654[1] = state[11] + state[14]; - out_6967130088459663654[2] = state[12] + state[15]; +void h_4(double *state, double *unused, double *out_8187072558274677226) { + out_8187072558274677226[0] = state[10] + state[13]; + out_8187072558274677226[1] = state[11] + state[14]; + out_8187072558274677226[2] = state[12] + state[15]; } -void H_4(double *state, double *unused, double *out_2805776108884249108) { - out_2805776108884249108[0] = 0; - out_2805776108884249108[1] = 0; - out_2805776108884249108[2] = 0; - out_2805776108884249108[3] = 0; - out_2805776108884249108[4] = 0; - out_2805776108884249108[5] = 0; - out_2805776108884249108[6] = 0; - out_2805776108884249108[7] = 0; - out_2805776108884249108[8] = 0; - out_2805776108884249108[9] = 0; - out_2805776108884249108[10] = 1; - out_2805776108884249108[11] = 0; - out_2805776108884249108[12] = 0; - out_2805776108884249108[13] = 1; - out_2805776108884249108[14] = 0; - out_2805776108884249108[15] = 0; - out_2805776108884249108[16] = 0; - out_2805776108884249108[17] = 0; - out_2805776108884249108[18] = 0; - out_2805776108884249108[19] = 0; - out_2805776108884249108[20] = 0; - out_2805776108884249108[21] = 0; - out_2805776108884249108[22] = 0; - out_2805776108884249108[23] = 0; - out_2805776108884249108[24] = 0; - out_2805776108884249108[25] = 0; - out_2805776108884249108[26] = 0; - out_2805776108884249108[27] = 0; - out_2805776108884249108[28] = 0; - out_2805776108884249108[29] = 0; - out_2805776108884249108[30] = 0; - out_2805776108884249108[31] = 0; - out_2805776108884249108[32] = 0; - out_2805776108884249108[33] = 1; - out_2805776108884249108[34] = 0; - out_2805776108884249108[35] = 0; - out_2805776108884249108[36] = 1; - out_2805776108884249108[37] = 0; - out_2805776108884249108[38] = 0; - out_2805776108884249108[39] = 0; - out_2805776108884249108[40] = 0; - out_2805776108884249108[41] = 0; - out_2805776108884249108[42] = 0; - out_2805776108884249108[43] = 0; - out_2805776108884249108[44] = 0; - out_2805776108884249108[45] = 0; - out_2805776108884249108[46] = 0; - out_2805776108884249108[47] = 0; - out_2805776108884249108[48] = 0; - out_2805776108884249108[49] = 0; - out_2805776108884249108[50] = 0; - out_2805776108884249108[51] = 0; - out_2805776108884249108[52] = 0; - out_2805776108884249108[53] = 0; - out_2805776108884249108[54] = 0; - out_2805776108884249108[55] = 0; - out_2805776108884249108[56] = 1; - out_2805776108884249108[57] = 0; - out_2805776108884249108[58] = 0; - out_2805776108884249108[59] = 1; - out_2805776108884249108[60] = 0; - out_2805776108884249108[61] = 0; - out_2805776108884249108[62] = 0; - out_2805776108884249108[63] = 0; - out_2805776108884249108[64] = 0; - out_2805776108884249108[65] = 0; +void H_4(double *state, double *unused, double *out_5073553165915915446) { + out_5073553165915915446[0] = 0; + out_5073553165915915446[1] = 0; + out_5073553165915915446[2] = 0; + out_5073553165915915446[3] = 0; + out_5073553165915915446[4] = 0; + out_5073553165915915446[5] = 0; + out_5073553165915915446[6] = 0; + out_5073553165915915446[7] = 0; + out_5073553165915915446[8] = 0; + out_5073553165915915446[9] = 0; + out_5073553165915915446[10] = 1; + out_5073553165915915446[11] = 0; + out_5073553165915915446[12] = 0; + out_5073553165915915446[13] = 1; + out_5073553165915915446[14] = 0; + out_5073553165915915446[15] = 0; + out_5073553165915915446[16] = 0; + out_5073553165915915446[17] = 0; + out_5073553165915915446[18] = 0; + out_5073553165915915446[19] = 0; + out_5073553165915915446[20] = 0; + out_5073553165915915446[21] = 0; + out_5073553165915915446[22] = 0; + out_5073553165915915446[23] = 0; + out_5073553165915915446[24] = 0; + out_5073553165915915446[25] = 0; + out_5073553165915915446[26] = 0; + out_5073553165915915446[27] = 0; + out_5073553165915915446[28] = 0; + out_5073553165915915446[29] = 0; + out_5073553165915915446[30] = 0; + out_5073553165915915446[31] = 0; + out_5073553165915915446[32] = 0; + out_5073553165915915446[33] = 1; + out_5073553165915915446[34] = 0; + out_5073553165915915446[35] = 0; + out_5073553165915915446[36] = 1; + out_5073553165915915446[37] = 0; + out_5073553165915915446[38] = 0; + out_5073553165915915446[39] = 0; + out_5073553165915915446[40] = 0; + out_5073553165915915446[41] = 0; + out_5073553165915915446[42] = 0; + out_5073553165915915446[43] = 0; + out_5073553165915915446[44] = 0; + out_5073553165915915446[45] = 0; + out_5073553165915915446[46] = 0; + out_5073553165915915446[47] = 0; + out_5073553165915915446[48] = 0; + out_5073553165915915446[49] = 0; + out_5073553165915915446[50] = 0; + out_5073553165915915446[51] = 0; + out_5073553165915915446[52] = 0; + out_5073553165915915446[53] = 0; + out_5073553165915915446[54] = 0; + out_5073553165915915446[55] = 0; + out_5073553165915915446[56] = 1; + out_5073553165915915446[57] = 0; + out_5073553165915915446[58] = 0; + out_5073553165915915446[59] = 1; + out_5073553165915915446[60] = 0; + out_5073553165915915446[61] = 0; + out_5073553165915915446[62] = 0; + out_5073553165915915446[63] = 0; + out_5073553165915915446[64] = 0; + out_5073553165915915446[65] = 0; } -void h_9(double *state, double *unused, double *out_5944074116138401933) { - out_5944074116138401933[0] = state[10]; - out_5944074116138401933[1] = state[11]; - out_5944074116138401933[2] = state[12]; +void h_9(double *state, double *unused, double *out_7751183598308146162) { + out_7751183598308146162[0] = state[10]; + out_7751183598308146162[1] = state[11]; + out_7751183598308146162[2] = state[12]; } -void H_9(double *state, double *unused, double *out_2564586462254658463) { - out_2564586462254658463[0] = 0; - out_2564586462254658463[1] = 0; - out_2564586462254658463[2] = 0; - out_2564586462254658463[3] = 0; - out_2564586462254658463[4] = 0; - out_2564586462254658463[5] = 0; - out_2564586462254658463[6] = 0; - out_2564586462254658463[7] = 0; - out_2564586462254658463[8] = 0; - out_2564586462254658463[9] = 0; - out_2564586462254658463[10] = 1; - out_2564586462254658463[11] = 0; - out_2564586462254658463[12] = 0; - out_2564586462254658463[13] = 0; - out_2564586462254658463[14] = 0; - out_2564586462254658463[15] = 0; - out_2564586462254658463[16] = 0; - out_2564586462254658463[17] = 0; - out_2564586462254658463[18] = 0; - out_2564586462254658463[19] = 0; - out_2564586462254658463[20] = 0; - out_2564586462254658463[21] = 0; - out_2564586462254658463[22] = 0; - out_2564586462254658463[23] = 0; - out_2564586462254658463[24] = 0; - out_2564586462254658463[25] = 0; - out_2564586462254658463[26] = 0; - out_2564586462254658463[27] = 0; - out_2564586462254658463[28] = 0; - out_2564586462254658463[29] = 0; - out_2564586462254658463[30] = 0; - out_2564586462254658463[31] = 0; - out_2564586462254658463[32] = 0; - out_2564586462254658463[33] = 1; - out_2564586462254658463[34] = 0; - out_2564586462254658463[35] = 0; - out_2564586462254658463[36] = 0; - out_2564586462254658463[37] = 0; - out_2564586462254658463[38] = 0; - out_2564586462254658463[39] = 0; - out_2564586462254658463[40] = 0; - out_2564586462254658463[41] = 0; - out_2564586462254658463[42] = 0; - out_2564586462254658463[43] = 0; - out_2564586462254658463[44] = 0; - out_2564586462254658463[45] = 0; - out_2564586462254658463[46] = 0; - out_2564586462254658463[47] = 0; - out_2564586462254658463[48] = 0; - out_2564586462254658463[49] = 0; - out_2564586462254658463[50] = 0; - out_2564586462254658463[51] = 0; - out_2564586462254658463[52] = 0; - out_2564586462254658463[53] = 0; - out_2564586462254658463[54] = 0; - out_2564586462254658463[55] = 0; - out_2564586462254658463[56] = 1; - out_2564586462254658463[57] = 0; - out_2564586462254658463[58] = 0; - out_2564586462254658463[59] = 0; - out_2564586462254658463[60] = 0; - out_2564586462254658463[61] = 0; - out_2564586462254658463[62] = 0; - out_2564586462254658463[63] = 0; - out_2564586462254658463[64] = 0; - out_2564586462254658463[65] = 0; +void H_9(double *state, double *unused, double *out_6085971972529188700) { + out_6085971972529188700[0] = 0; + out_6085971972529188700[1] = 0; + out_6085971972529188700[2] = 0; + out_6085971972529188700[3] = 0; + out_6085971972529188700[4] = 0; + out_6085971972529188700[5] = 0; + out_6085971972529188700[6] = 0; + out_6085971972529188700[7] = 0; + out_6085971972529188700[8] = 0; + out_6085971972529188700[9] = 0; + out_6085971972529188700[10] = 1; + out_6085971972529188700[11] = 0; + out_6085971972529188700[12] = 0; + out_6085971972529188700[13] = 0; + out_6085971972529188700[14] = 0; + out_6085971972529188700[15] = 0; + out_6085971972529188700[16] = 0; + out_6085971972529188700[17] = 0; + out_6085971972529188700[18] = 0; + out_6085971972529188700[19] = 0; + out_6085971972529188700[20] = 0; + out_6085971972529188700[21] = 0; + out_6085971972529188700[22] = 0; + out_6085971972529188700[23] = 0; + out_6085971972529188700[24] = 0; + out_6085971972529188700[25] = 0; + out_6085971972529188700[26] = 0; + out_6085971972529188700[27] = 0; + out_6085971972529188700[28] = 0; + out_6085971972529188700[29] = 0; + out_6085971972529188700[30] = 0; + out_6085971972529188700[31] = 0; + out_6085971972529188700[32] = 0; + out_6085971972529188700[33] = 1; + out_6085971972529188700[34] = 0; + out_6085971972529188700[35] = 0; + out_6085971972529188700[36] = 0; + out_6085971972529188700[37] = 0; + out_6085971972529188700[38] = 0; + out_6085971972529188700[39] = 0; + out_6085971972529188700[40] = 0; + out_6085971972529188700[41] = 0; + out_6085971972529188700[42] = 0; + out_6085971972529188700[43] = 0; + out_6085971972529188700[44] = 0; + out_6085971972529188700[45] = 0; + out_6085971972529188700[46] = 0; + out_6085971972529188700[47] = 0; + out_6085971972529188700[48] = 0; + out_6085971972529188700[49] = 0; + out_6085971972529188700[50] = 0; + out_6085971972529188700[51] = 0; + out_6085971972529188700[52] = 0; + out_6085971972529188700[53] = 0; + out_6085971972529188700[54] = 0; + out_6085971972529188700[55] = 0; + out_6085971972529188700[56] = 1; + out_6085971972529188700[57] = 0; + out_6085971972529188700[58] = 0; + out_6085971972529188700[59] = 0; + out_6085971972529188700[60] = 0; + out_6085971972529188700[61] = 0; + out_6085971972529188700[62] = 0; + out_6085971972529188700[63] = 0; + out_6085971972529188700[64] = 0; + out_6085971972529188700[65] = 0; } -void h_10(double *state, double *unused, double *out_3024176660760462318) { - out_3024176660760462318[0] = 398600500000000.0*(-2*state[3]*state[5] + 2*state[4]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2] + 398600500000000.0*(2*state[3]*state[6] + 2*state[4]*state[5])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1] + 398600500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*(pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) - pow(state[6], 2))*state[0] + state[16] + state[19]; - out_3024176660760462318[1] = 398600500000000.0*(2*state[3]*state[4] + 2*state[5]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2] + 398600500000000.0*(-2*state[3]*state[6] + 2*state[4]*state[5])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0] + 398600500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*(pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) - pow(state[6], 2))*state[1] + state[17] + state[20]; - out_3024176660760462318[2] = 398600500000000.0*(-2*state[3]*state[4] + 2*state[5]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1] + 398600500000000.0*(2*state[3]*state[5] + 2*state[4]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0] + 398600500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*(pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2))*state[2] + state[18] + state[21]; +void h_10(double *state, double *unused, double *out_7475415363803884616) { + out_7475415363803884616[0] = 398600500000000.0*(-2*state[3]*state[5] + 2*state[4]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2] + 398600500000000.0*(2*state[3]*state[6] + 2*state[4]*state[5])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1] + 398600500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*(pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) - pow(state[6], 2))*state[0] + state[16] + state[19]; + out_7475415363803884616[1] = 398600500000000.0*(2*state[3]*state[4] + 2*state[5]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2] + 398600500000000.0*(-2*state[3]*state[6] + 2*state[4]*state[5])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0] + 398600500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*(pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) - pow(state[6], 2))*state[1] + state[17] + state[20]; + out_7475415363803884616[2] = 398600500000000.0*(-2*state[3]*state[4] + 2*state[5]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1] + 398600500000000.0*(2*state[3]*state[5] + 2*state[4]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0] + 398600500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*(pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2))*state[2] + state[18] + state[21]; } -void H_10(double *state, double *unused, double *out_3594957374532062379) { - out_3594957374532062379[0] = -1195801500000000.0*(-2*state[3]*state[5] + 2*state[4]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*state[0]*state[2] - 1195801500000000.0*(2*state[3]*state[6] + 2*state[4]*state[5])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*state[0]*state[1] - 1195801500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*(pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) - pow(state[6], 2))*pow(state[0], 2) + 398600500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*(pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) - pow(state[6], 2)); - out_3594957374532062379[1] = -1195801500000000.0*(-2*state[3]*state[5] + 2*state[4]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*state[1]*state[2] - 1195801500000000.0*(2*state[3]*state[6] + 2*state[4]*state[5])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*pow(state[1], 2) + 398600500000000.0*(2*state[3]*state[6] + 2*state[4]*state[5])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5) - 1195801500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*(pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) - pow(state[6], 2))*state[0]*state[1]; - out_3594957374532062379[2] = -1195801500000000.0*(-2*state[3]*state[5] + 2*state[4]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*pow(state[2], 2) + 398600500000000.0*(-2*state[3]*state[5] + 2*state[4]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5) - 1195801500000000.0*(2*state[3]*state[6] + 2*state[4]*state[5])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*state[1]*state[2] - 1195801500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*(pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) - pow(state[6], 2))*state[0]*state[2]; - out_3594957374532062379[3] = 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0]*state[3] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1]*state[6] - 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2]*state[5]; - out_3594957374532062379[4] = 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0]*state[4] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1]*state[5] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2]*state[6]; - out_3594957374532062379[5] = -797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0]*state[5] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1]*state[4] - 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2]*state[3]; - out_3594957374532062379[6] = -797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0]*state[6] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1]*state[3] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2]*state[4]; - out_3594957374532062379[7] = 0; - out_3594957374532062379[8] = 0; - out_3594957374532062379[9] = 0; - out_3594957374532062379[10] = 0; - out_3594957374532062379[11] = 0; - out_3594957374532062379[12] = 0; - out_3594957374532062379[13] = 0; - out_3594957374532062379[14] = 0; - out_3594957374532062379[15] = 0; - out_3594957374532062379[16] = 1; - out_3594957374532062379[17] = 0; - out_3594957374532062379[18] = 0; - out_3594957374532062379[19] = 1; - out_3594957374532062379[20] = 0; - out_3594957374532062379[21] = 0; - out_3594957374532062379[22] = -1195801500000000.0*(2*state[3]*state[4] + 2*state[5]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*state[0]*state[2] - 1195801500000000.0*(-2*state[3]*state[6] + 2*state[4]*state[5])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*pow(state[0], 2) + 398600500000000.0*(-2*state[3]*state[6] + 2*state[4]*state[5])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5) - 1195801500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*(pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) - pow(state[6], 2))*state[0]*state[1]; - out_3594957374532062379[23] = -1195801500000000.0*(2*state[3]*state[4] + 2*state[5]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*state[1]*state[2] - 1195801500000000.0*(-2*state[3]*state[6] + 2*state[4]*state[5])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*state[0]*state[1] - 1195801500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*(pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) - pow(state[6], 2))*pow(state[1], 2) + 398600500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*(pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) - pow(state[6], 2)); - out_3594957374532062379[24] = -1195801500000000.0*(2*state[3]*state[4] + 2*state[5]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*pow(state[2], 2) + 398600500000000.0*(2*state[3]*state[4] + 2*state[5]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5) - 1195801500000000.0*(-2*state[3]*state[6] + 2*state[4]*state[5])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*state[0]*state[2] - 1195801500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*(pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) - pow(state[6], 2))*state[1]*state[2]; - out_3594957374532062379[25] = -797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0]*state[6] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1]*state[3] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2]*state[4]; - out_3594957374532062379[26] = 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0]*state[5] - 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1]*state[4] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2]*state[3]; - out_3594957374532062379[27] = 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0]*state[4] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1]*state[5] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2]*state[6]; - out_3594957374532062379[28] = -797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0]*state[3] - 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1]*state[6] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2]*state[5]; - out_3594957374532062379[29] = 0; - out_3594957374532062379[30] = 0; - out_3594957374532062379[31] = 0; - out_3594957374532062379[32] = 0; - out_3594957374532062379[33] = 0; - out_3594957374532062379[34] = 0; - out_3594957374532062379[35] = 0; - out_3594957374532062379[36] = 0; - out_3594957374532062379[37] = 0; - out_3594957374532062379[38] = 0; - out_3594957374532062379[39] = 1; - out_3594957374532062379[40] = 0; - out_3594957374532062379[41] = 0; - out_3594957374532062379[42] = 1; - out_3594957374532062379[43] = 0; - out_3594957374532062379[44] = -1195801500000000.0*(-2*state[3]*state[4] + 2*state[5]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*state[0]*state[1] - 1195801500000000.0*(2*state[3]*state[5] + 2*state[4]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*pow(state[0], 2) + 398600500000000.0*(2*state[3]*state[5] + 2*state[4]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5) - 1195801500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*(pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2))*state[0]*state[2]; - out_3594957374532062379[45] = -1195801500000000.0*(-2*state[3]*state[4] + 2*state[5]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*pow(state[1], 2) + 398600500000000.0*(-2*state[3]*state[4] + 2*state[5]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5) - 1195801500000000.0*(2*state[3]*state[5] + 2*state[4]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*state[0]*state[1] - 1195801500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*(pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2))*state[1]*state[2]; - out_3594957374532062379[46] = -1195801500000000.0*(-2*state[3]*state[4] + 2*state[5]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*state[1]*state[2] - 1195801500000000.0*(2*state[3]*state[5] + 2*state[4]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*state[0]*state[2] - 1195801500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*(pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2))*pow(state[2], 2) + 398600500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*(pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2)); - out_3594957374532062379[47] = 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0]*state[5] - 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1]*state[4] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2]*state[3]; - out_3594957374532062379[48] = 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0]*state[6] - 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1]*state[3] - 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2]*state[4]; - out_3594957374532062379[49] = 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0]*state[3] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1]*state[6] - 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2]*state[5]; - out_3594957374532062379[50] = 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0]*state[4] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1]*state[5] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2]*state[6]; - out_3594957374532062379[51] = 0; - out_3594957374532062379[52] = 0; - out_3594957374532062379[53] = 0; - out_3594957374532062379[54] = 0; - out_3594957374532062379[55] = 0; - out_3594957374532062379[56] = 0; - out_3594957374532062379[57] = 0; - out_3594957374532062379[58] = 0; - out_3594957374532062379[59] = 0; - out_3594957374532062379[60] = 0; - out_3594957374532062379[61] = 0; - out_3594957374532062379[62] = 1; - out_3594957374532062379[63] = 0; - out_3594957374532062379[64] = 0; - out_3594957374532062379[65] = 1; +void H_10(double *state, double *unused, double *out_7599748917935120017) { + out_7599748917935120017[0] = -1195801500000000.0*(-2*state[3]*state[5] + 2*state[4]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*state[0]*state[2] - 1195801500000000.0*(2*state[3]*state[6] + 2*state[4]*state[5])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*state[0]*state[1] - 1195801500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*(pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) - pow(state[6], 2))*pow(state[0], 2) + 398600500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*(pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) - pow(state[6], 2)); + out_7599748917935120017[1] = -1195801500000000.0*(-2*state[3]*state[5] + 2*state[4]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*state[1]*state[2] - 1195801500000000.0*(2*state[3]*state[6] + 2*state[4]*state[5])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*pow(state[1], 2) + 398600500000000.0*(2*state[3]*state[6] + 2*state[4]*state[5])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5) - 1195801500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*(pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) - pow(state[6], 2))*state[0]*state[1]; + out_7599748917935120017[2] = -1195801500000000.0*(-2*state[3]*state[5] + 2*state[4]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*pow(state[2], 2) + 398600500000000.0*(-2*state[3]*state[5] + 2*state[4]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5) - 1195801500000000.0*(2*state[3]*state[6] + 2*state[4]*state[5])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*state[1]*state[2] - 1195801500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*(pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) - pow(state[6], 2))*state[0]*state[2]; + out_7599748917935120017[3] = 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0]*state[3] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1]*state[6] - 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2]*state[5]; + out_7599748917935120017[4] = 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0]*state[4] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1]*state[5] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2]*state[6]; + out_7599748917935120017[5] = -797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0]*state[5] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1]*state[4] - 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2]*state[3]; + out_7599748917935120017[6] = -797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0]*state[6] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1]*state[3] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2]*state[4]; + out_7599748917935120017[7] = 0; + out_7599748917935120017[8] = 0; + out_7599748917935120017[9] = 0; + out_7599748917935120017[10] = 0; + out_7599748917935120017[11] = 0; + out_7599748917935120017[12] = 0; + out_7599748917935120017[13] = 0; + out_7599748917935120017[14] = 0; + out_7599748917935120017[15] = 0; + out_7599748917935120017[16] = 1; + out_7599748917935120017[17] = 0; + out_7599748917935120017[18] = 0; + out_7599748917935120017[19] = 1; + out_7599748917935120017[20] = 0; + out_7599748917935120017[21] = 0; + out_7599748917935120017[22] = -1195801500000000.0*(2*state[3]*state[4] + 2*state[5]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*state[0]*state[2] - 1195801500000000.0*(-2*state[3]*state[6] + 2*state[4]*state[5])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*pow(state[0], 2) + 398600500000000.0*(-2*state[3]*state[6] + 2*state[4]*state[5])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5) - 1195801500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*(pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) - pow(state[6], 2))*state[0]*state[1]; + out_7599748917935120017[23] = -1195801500000000.0*(2*state[3]*state[4] + 2*state[5]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*state[1]*state[2] - 1195801500000000.0*(-2*state[3]*state[6] + 2*state[4]*state[5])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*state[0]*state[1] - 1195801500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*(pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) - pow(state[6], 2))*pow(state[1], 2) + 398600500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*(pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) - pow(state[6], 2)); + out_7599748917935120017[24] = -1195801500000000.0*(2*state[3]*state[4] + 2*state[5]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*pow(state[2], 2) + 398600500000000.0*(2*state[3]*state[4] + 2*state[5]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5) - 1195801500000000.0*(-2*state[3]*state[6] + 2*state[4]*state[5])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*state[0]*state[2] - 1195801500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*(pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) - pow(state[6], 2))*state[1]*state[2]; + out_7599748917935120017[25] = -797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0]*state[6] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1]*state[3] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2]*state[4]; + out_7599748917935120017[26] = 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0]*state[5] - 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1]*state[4] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2]*state[3]; + out_7599748917935120017[27] = 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0]*state[4] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1]*state[5] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2]*state[6]; + out_7599748917935120017[28] = -797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0]*state[3] - 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1]*state[6] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2]*state[5]; + out_7599748917935120017[29] = 0; + out_7599748917935120017[30] = 0; + out_7599748917935120017[31] = 0; + out_7599748917935120017[32] = 0; + out_7599748917935120017[33] = 0; + out_7599748917935120017[34] = 0; + out_7599748917935120017[35] = 0; + out_7599748917935120017[36] = 0; + out_7599748917935120017[37] = 0; + out_7599748917935120017[38] = 0; + out_7599748917935120017[39] = 1; + out_7599748917935120017[40] = 0; + out_7599748917935120017[41] = 0; + out_7599748917935120017[42] = 1; + out_7599748917935120017[43] = 0; + out_7599748917935120017[44] = -1195801500000000.0*(-2*state[3]*state[4] + 2*state[5]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*state[0]*state[1] - 1195801500000000.0*(2*state[3]*state[5] + 2*state[4]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*pow(state[0], 2) + 398600500000000.0*(2*state[3]*state[5] + 2*state[4]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5) - 1195801500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*(pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2))*state[0]*state[2]; + out_7599748917935120017[45] = -1195801500000000.0*(-2*state[3]*state[4] + 2*state[5]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*pow(state[1], 2) + 398600500000000.0*(-2*state[3]*state[4] + 2*state[5]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5) - 1195801500000000.0*(2*state[3]*state[5] + 2*state[4]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*state[0]*state[1] - 1195801500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*(pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2))*state[1]*state[2]; + out_7599748917935120017[46] = -1195801500000000.0*(-2*state[3]*state[4] + 2*state[5]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*state[1]*state[2] - 1195801500000000.0*(2*state[3]*state[5] + 2*state[4]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*state[0]*state[2] - 1195801500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*(pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2))*pow(state[2], 2) + 398600500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*(pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2)); + out_7599748917935120017[47] = 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0]*state[5] - 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1]*state[4] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2]*state[3]; + out_7599748917935120017[48] = 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0]*state[6] - 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1]*state[3] - 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2]*state[4]; + out_7599748917935120017[49] = 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0]*state[3] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1]*state[6] - 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2]*state[5]; + out_7599748917935120017[50] = 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0]*state[4] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1]*state[5] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2]*state[6]; + out_7599748917935120017[51] = 0; + out_7599748917935120017[52] = 0; + out_7599748917935120017[53] = 0; + out_7599748917935120017[54] = 0; + out_7599748917935120017[55] = 0; + out_7599748917935120017[56] = 0; + out_7599748917935120017[57] = 0; + out_7599748917935120017[58] = 0; + out_7599748917935120017[59] = 0; + out_7599748917935120017[60] = 0; + out_7599748917935120017[61] = 0; + out_7599748917935120017[62] = 1; + out_7599748917935120017[63] = 0; + out_7599748917935120017[64] = 0; + out_7599748917935120017[65] = 1; } -void h_12(double *state, double *unused, double *out_1781567485764299655) { - out_1781567485764299655[0] = state[0]; - out_1781567485764299655[1] = state[1]; - out_1781567485764299655[2] = state[2]; +void h_12(double *state, double *unused, double *out_4560316742219209161) { + out_4560316742219209161[0] = state[0]; + out_4560316742219209161[1] = state[1]; + out_4560316742219209161[2] = state[2]; } -void H_12(double *state, double *unused, double *out_2213680299147712687) { - out_2213680299147712687[0] = 1; - out_2213680299147712687[1] = 0; - out_2213680299147712687[2] = 0; - out_2213680299147712687[3] = 0; - out_2213680299147712687[4] = 0; - out_2213680299147712687[5] = 0; - out_2213680299147712687[6] = 0; - out_2213680299147712687[7] = 0; - out_2213680299147712687[8] = 0; - out_2213680299147712687[9] = 0; - out_2213680299147712687[10] = 0; - out_2213680299147712687[11] = 0; - out_2213680299147712687[12] = 0; - out_2213680299147712687[13] = 0; - out_2213680299147712687[14] = 0; - out_2213680299147712687[15] = 0; - out_2213680299147712687[16] = 0; - out_2213680299147712687[17] = 0; - out_2213680299147712687[18] = 0; - out_2213680299147712687[19] = 0; - out_2213680299147712687[20] = 0; - out_2213680299147712687[21] = 0; - out_2213680299147712687[22] = 0; - out_2213680299147712687[23] = 1; - out_2213680299147712687[24] = 0; - out_2213680299147712687[25] = 0; - out_2213680299147712687[26] = 0; - out_2213680299147712687[27] = 0; - out_2213680299147712687[28] = 0; - out_2213680299147712687[29] = 0; - out_2213680299147712687[30] = 0; - out_2213680299147712687[31] = 0; - out_2213680299147712687[32] = 0; - out_2213680299147712687[33] = 0; - out_2213680299147712687[34] = 0; - out_2213680299147712687[35] = 0; - out_2213680299147712687[36] = 0; - out_2213680299147712687[37] = 0; - out_2213680299147712687[38] = 0; - out_2213680299147712687[39] = 0; - out_2213680299147712687[40] = 0; - out_2213680299147712687[41] = 0; - out_2213680299147712687[42] = 0; - out_2213680299147712687[43] = 0; - out_2213680299147712687[44] = 0; - out_2213680299147712687[45] = 0; - out_2213680299147712687[46] = 1; - out_2213680299147712687[47] = 0; - out_2213680299147712687[48] = 0; - out_2213680299147712687[49] = 0; - out_2213680299147712687[50] = 0; - out_2213680299147712687[51] = 0; - out_2213680299147712687[52] = 0; - out_2213680299147712687[53] = 0; - out_2213680299147712687[54] = 0; - out_2213680299147712687[55] = 0; - out_2213680299147712687[56] = 0; - out_2213680299147712687[57] = 0; - out_2213680299147712687[58] = 0; - out_2213680299147712687[59] = 0; - out_2213680299147712687[60] = 0; - out_2213680299147712687[61] = 0; - out_2213680299147712687[62] = 0; - out_2213680299147712687[63] = 0; - out_2213680299147712687[64] = 0; - out_2213680299147712687[65] = 0; +void H_12(double *state, double *unused, double *out_8353734499761674375) { + out_8353734499761674375[0] = 1; + out_8353734499761674375[1] = 0; + out_8353734499761674375[2] = 0; + out_8353734499761674375[3] = 0; + out_8353734499761674375[4] = 0; + out_8353734499761674375[5] = 0; + out_8353734499761674375[6] = 0; + out_8353734499761674375[7] = 0; + out_8353734499761674375[8] = 0; + out_8353734499761674375[9] = 0; + out_8353734499761674375[10] = 0; + out_8353734499761674375[11] = 0; + out_8353734499761674375[12] = 0; + out_8353734499761674375[13] = 0; + out_8353734499761674375[14] = 0; + out_8353734499761674375[15] = 0; + out_8353734499761674375[16] = 0; + out_8353734499761674375[17] = 0; + out_8353734499761674375[18] = 0; + out_8353734499761674375[19] = 0; + out_8353734499761674375[20] = 0; + out_8353734499761674375[21] = 0; + out_8353734499761674375[22] = 0; + out_8353734499761674375[23] = 1; + out_8353734499761674375[24] = 0; + out_8353734499761674375[25] = 0; + out_8353734499761674375[26] = 0; + out_8353734499761674375[27] = 0; + out_8353734499761674375[28] = 0; + out_8353734499761674375[29] = 0; + out_8353734499761674375[30] = 0; + out_8353734499761674375[31] = 0; + out_8353734499761674375[32] = 0; + out_8353734499761674375[33] = 0; + out_8353734499761674375[34] = 0; + out_8353734499761674375[35] = 0; + out_8353734499761674375[36] = 0; + out_8353734499761674375[37] = 0; + out_8353734499761674375[38] = 0; + out_8353734499761674375[39] = 0; + out_8353734499761674375[40] = 0; + out_8353734499761674375[41] = 0; + out_8353734499761674375[42] = 0; + out_8353734499761674375[43] = 0; + out_8353734499761674375[44] = 0; + out_8353734499761674375[45] = 0; + out_8353734499761674375[46] = 1; + out_8353734499761674375[47] = 0; + out_8353734499761674375[48] = 0; + out_8353734499761674375[49] = 0; + out_8353734499761674375[50] = 0; + out_8353734499761674375[51] = 0; + out_8353734499761674375[52] = 0; + out_8353734499761674375[53] = 0; + out_8353734499761674375[54] = 0; + out_8353734499761674375[55] = 0; + out_8353734499761674375[56] = 0; + out_8353734499761674375[57] = 0; + out_8353734499761674375[58] = 0; + out_8353734499761674375[59] = 0; + out_8353734499761674375[60] = 0; + out_8353734499761674375[61] = 0; + out_8353734499761674375[62] = 0; + out_8353734499761674375[63] = 0; + out_8353734499761674375[64] = 0; + out_8353734499761674375[65] = 0; } -void h_35(double *state, double *unused, double *out_3392135172365373817) { - out_3392135172365373817[0] = state[7]; - out_3392135172365373817[1] = state[8]; - out_3392135172365373817[2] = state[9]; +void h_35(double *state, double *unused, double *out_395256144382285655) { + out_395256144382285655[0] = state[7]; + out_395256144382285655[1] = state[8]; + out_395256144382285655[2] = state[9]; } -void H_35(double *state, double *unused, double *out_4959243331472726396) { - out_4959243331472726396[0] = 0; - out_4959243331472726396[1] = 0; - out_4959243331472726396[2] = 0; - out_4959243331472726396[3] = 0; - out_4959243331472726396[4] = 0; - out_4959243331472726396[5] = 0; - out_4959243331472726396[6] = 0; - out_4959243331472726396[7] = 1; - out_4959243331472726396[8] = 0; - out_4959243331472726396[9] = 0; - out_4959243331472726396[10] = 0; - out_4959243331472726396[11] = 0; - out_4959243331472726396[12] = 0; - out_4959243331472726396[13] = 0; - out_4959243331472726396[14] = 0; - out_4959243331472726396[15] = 0; - out_4959243331472726396[16] = 0; - out_4959243331472726396[17] = 0; - out_4959243331472726396[18] = 0; - out_4959243331472726396[19] = 0; - out_4959243331472726396[20] = 0; - out_4959243331472726396[21] = 0; - out_4959243331472726396[22] = 0; - out_4959243331472726396[23] = 0; - out_4959243331472726396[24] = 0; - out_4959243331472726396[25] = 0; - out_4959243331472726396[26] = 0; - out_4959243331472726396[27] = 0; - out_4959243331472726396[28] = 0; - out_4959243331472726396[29] = 0; - out_4959243331472726396[30] = 1; - out_4959243331472726396[31] = 0; - out_4959243331472726396[32] = 0; - out_4959243331472726396[33] = 0; - out_4959243331472726396[34] = 0; - out_4959243331472726396[35] = 0; - out_4959243331472726396[36] = 0; - out_4959243331472726396[37] = 0; - out_4959243331472726396[38] = 0; - out_4959243331472726396[39] = 0; - out_4959243331472726396[40] = 0; - out_4959243331472726396[41] = 0; - out_4959243331472726396[42] = 0; - out_4959243331472726396[43] = 0; - out_4959243331472726396[44] = 0; - out_4959243331472726396[45] = 0; - out_4959243331472726396[46] = 0; - out_4959243331472726396[47] = 0; - out_4959243331472726396[48] = 0; - out_4959243331472726396[49] = 0; - out_4959243331472726396[50] = 0; - out_4959243331472726396[51] = 0; - out_4959243331472726396[52] = 0; - out_4959243331472726396[53] = 1; - out_4959243331472726396[54] = 0; - out_4959243331472726396[55] = 0; - out_4959243331472726396[56] = 0; - out_4959243331472726396[57] = 0; - out_4959243331472726396[58] = 0; - out_4959243331472726396[59] = 0; - out_4959243331472726396[60] = 0; - out_4959243331472726396[61] = 0; - out_4959243331472726396[62] = 0; - out_4959243331472726396[63] = 0; - out_4959243331472726396[64] = 0; - out_4959243331472726396[65] = 0; +void H_35(double *state, double *unused, double *out_5608171467436660666) { + out_5608171467436660666[0] = 0; + out_5608171467436660666[1] = 0; + out_5608171467436660666[2] = 0; + out_5608171467436660666[3] = 0; + out_5608171467436660666[4] = 0; + out_5608171467436660666[5] = 0; + out_5608171467436660666[6] = 0; + out_5608171467436660666[7] = 1; + out_5608171467436660666[8] = 0; + out_5608171467436660666[9] = 0; + out_5608171467436660666[10] = 0; + out_5608171467436660666[11] = 0; + out_5608171467436660666[12] = 0; + out_5608171467436660666[13] = 0; + out_5608171467436660666[14] = 0; + out_5608171467436660666[15] = 0; + out_5608171467436660666[16] = 0; + out_5608171467436660666[17] = 0; + out_5608171467436660666[18] = 0; + out_5608171467436660666[19] = 0; + out_5608171467436660666[20] = 0; + out_5608171467436660666[21] = 0; + out_5608171467436660666[22] = 0; + out_5608171467436660666[23] = 0; + out_5608171467436660666[24] = 0; + out_5608171467436660666[25] = 0; + out_5608171467436660666[26] = 0; + out_5608171467436660666[27] = 0; + out_5608171467436660666[28] = 0; + out_5608171467436660666[29] = 0; + out_5608171467436660666[30] = 1; + out_5608171467436660666[31] = 0; + out_5608171467436660666[32] = 0; + out_5608171467436660666[33] = 0; + out_5608171467436660666[34] = 0; + out_5608171467436660666[35] = 0; + out_5608171467436660666[36] = 0; + out_5608171467436660666[37] = 0; + out_5608171467436660666[38] = 0; + out_5608171467436660666[39] = 0; + out_5608171467436660666[40] = 0; + out_5608171467436660666[41] = 0; + out_5608171467436660666[42] = 0; + out_5608171467436660666[43] = 0; + out_5608171467436660666[44] = 0; + out_5608171467436660666[45] = 0; + out_5608171467436660666[46] = 0; + out_5608171467436660666[47] = 0; + out_5608171467436660666[48] = 0; + out_5608171467436660666[49] = 0; + out_5608171467436660666[50] = 0; + out_5608171467436660666[51] = 0; + out_5608171467436660666[52] = 0; + out_5608171467436660666[53] = 1; + out_5608171467436660666[54] = 0; + out_5608171467436660666[55] = 0; + out_5608171467436660666[56] = 0; + out_5608171467436660666[57] = 0; + out_5608171467436660666[58] = 0; + out_5608171467436660666[59] = 0; + out_5608171467436660666[60] = 0; + out_5608171467436660666[61] = 0; + out_5608171467436660666[62] = 0; + out_5608171467436660666[63] = 0; + out_5608171467436660666[64] = 0; + out_5608171467436660666[65] = 0; } -void h_32(double *state, double *unused, double *out_5713026107165599538) { - out_5713026107165599538[0] = state[3]; - out_5713026107165599538[1] = state[4]; - out_5713026107165599538[2] = state[5]; - out_5713026107165599538[3] = state[6]; +void h_32(double *state, double *unused, double *out_2629447041285500641) { + out_2629447041285500641[0] = state[3]; + out_2629447041285500641[1] = state[4]; + out_2629447041285500641[2] = state[5]; + out_2629447041285500641[3] = state[6]; } -void H_32(double *state, double *unused, double *out_8507087671459885125) { - out_8507087671459885125[0] = 0; - out_8507087671459885125[1] = 0; - out_8507087671459885125[2] = 0; - out_8507087671459885125[3] = 1; - out_8507087671459885125[4] = 0; - out_8507087671459885125[5] = 0; - out_8507087671459885125[6] = 0; - out_8507087671459885125[7] = 0; - out_8507087671459885125[8] = 0; - out_8507087671459885125[9] = 0; - out_8507087671459885125[10] = 0; - out_8507087671459885125[11] = 0; - out_8507087671459885125[12] = 0; - out_8507087671459885125[13] = 0; - out_8507087671459885125[14] = 0; - out_8507087671459885125[15] = 0; - out_8507087671459885125[16] = 0; - out_8507087671459885125[17] = 0; - out_8507087671459885125[18] = 0; - out_8507087671459885125[19] = 0; - out_8507087671459885125[20] = 0; - out_8507087671459885125[21] = 0; - out_8507087671459885125[22] = 0; - out_8507087671459885125[23] = 0; - out_8507087671459885125[24] = 0; - out_8507087671459885125[25] = 0; - out_8507087671459885125[26] = 1; - out_8507087671459885125[27] = 0; - out_8507087671459885125[28] = 0; - out_8507087671459885125[29] = 0; - out_8507087671459885125[30] = 0; - out_8507087671459885125[31] = 0; - out_8507087671459885125[32] = 0; - out_8507087671459885125[33] = 0; - out_8507087671459885125[34] = 0; - out_8507087671459885125[35] = 0; - out_8507087671459885125[36] = 0; - out_8507087671459885125[37] = 0; - out_8507087671459885125[38] = 0; - out_8507087671459885125[39] = 0; - out_8507087671459885125[40] = 0; - out_8507087671459885125[41] = 0; - out_8507087671459885125[42] = 0; - out_8507087671459885125[43] = 0; - out_8507087671459885125[44] = 0; - out_8507087671459885125[45] = 0; - out_8507087671459885125[46] = 0; - out_8507087671459885125[47] = 0; - out_8507087671459885125[48] = 0; - out_8507087671459885125[49] = 1; - out_8507087671459885125[50] = 0; - out_8507087671459885125[51] = 0; - out_8507087671459885125[52] = 0; - out_8507087671459885125[53] = 0; - out_8507087671459885125[54] = 0; - out_8507087671459885125[55] = 0; - out_8507087671459885125[56] = 0; - out_8507087671459885125[57] = 0; - out_8507087671459885125[58] = 0; - out_8507087671459885125[59] = 0; - out_8507087671459885125[60] = 0; - out_8507087671459885125[61] = 0; - out_8507087671459885125[62] = 0; - out_8507087671459885125[63] = 0; - out_8507087671459885125[64] = 0; - out_8507087671459885125[65] = 0; - out_8507087671459885125[66] = 0; - out_8507087671459885125[67] = 0; - out_8507087671459885125[68] = 0; - out_8507087671459885125[69] = 0; - out_8507087671459885125[70] = 0; - out_8507087671459885125[71] = 0; - out_8507087671459885125[72] = 1; - out_8507087671459885125[73] = 0; - out_8507087671459885125[74] = 0; - out_8507087671459885125[75] = 0; - out_8507087671459885125[76] = 0; - out_8507087671459885125[77] = 0; - out_8507087671459885125[78] = 0; - out_8507087671459885125[79] = 0; - out_8507087671459885125[80] = 0; - out_8507087671459885125[81] = 0; - out_8507087671459885125[82] = 0; - out_8507087671459885125[83] = 0; - out_8507087671459885125[84] = 0; - out_8507087671459885125[85] = 0; - out_8507087671459885125[86] = 0; - out_8507087671459885125[87] = 0; +void H_32(double *state, double *unused, double *out_5477006682495920197) { + out_5477006682495920197[0] = 0; + out_5477006682495920197[1] = 0; + out_5477006682495920197[2] = 0; + out_5477006682495920197[3] = 1; + out_5477006682495920197[4] = 0; + out_5477006682495920197[5] = 0; + out_5477006682495920197[6] = 0; + out_5477006682495920197[7] = 0; + out_5477006682495920197[8] = 0; + out_5477006682495920197[9] = 0; + out_5477006682495920197[10] = 0; + out_5477006682495920197[11] = 0; + out_5477006682495920197[12] = 0; + out_5477006682495920197[13] = 0; + out_5477006682495920197[14] = 0; + out_5477006682495920197[15] = 0; + out_5477006682495920197[16] = 0; + out_5477006682495920197[17] = 0; + out_5477006682495920197[18] = 0; + out_5477006682495920197[19] = 0; + out_5477006682495920197[20] = 0; + out_5477006682495920197[21] = 0; + out_5477006682495920197[22] = 0; + out_5477006682495920197[23] = 0; + out_5477006682495920197[24] = 0; + out_5477006682495920197[25] = 0; + out_5477006682495920197[26] = 1; + out_5477006682495920197[27] = 0; + out_5477006682495920197[28] = 0; + out_5477006682495920197[29] = 0; + out_5477006682495920197[30] = 0; + out_5477006682495920197[31] = 0; + out_5477006682495920197[32] = 0; + out_5477006682495920197[33] = 0; + out_5477006682495920197[34] = 0; + out_5477006682495920197[35] = 0; + out_5477006682495920197[36] = 0; + out_5477006682495920197[37] = 0; + out_5477006682495920197[38] = 0; + out_5477006682495920197[39] = 0; + out_5477006682495920197[40] = 0; + out_5477006682495920197[41] = 0; + out_5477006682495920197[42] = 0; + out_5477006682495920197[43] = 0; + out_5477006682495920197[44] = 0; + out_5477006682495920197[45] = 0; + out_5477006682495920197[46] = 0; + out_5477006682495920197[47] = 0; + out_5477006682495920197[48] = 0; + out_5477006682495920197[49] = 1; + out_5477006682495920197[50] = 0; + out_5477006682495920197[51] = 0; + out_5477006682495920197[52] = 0; + out_5477006682495920197[53] = 0; + out_5477006682495920197[54] = 0; + out_5477006682495920197[55] = 0; + out_5477006682495920197[56] = 0; + out_5477006682495920197[57] = 0; + out_5477006682495920197[58] = 0; + out_5477006682495920197[59] = 0; + out_5477006682495920197[60] = 0; + out_5477006682495920197[61] = 0; + out_5477006682495920197[62] = 0; + out_5477006682495920197[63] = 0; + out_5477006682495920197[64] = 0; + out_5477006682495920197[65] = 0; + out_5477006682495920197[66] = 0; + out_5477006682495920197[67] = 0; + out_5477006682495920197[68] = 0; + out_5477006682495920197[69] = 0; + out_5477006682495920197[70] = 0; + out_5477006682495920197[71] = 0; + out_5477006682495920197[72] = 1; + out_5477006682495920197[73] = 0; + out_5477006682495920197[74] = 0; + out_5477006682495920197[75] = 0; + out_5477006682495920197[76] = 0; + out_5477006682495920197[77] = 0; + out_5477006682495920197[78] = 0; + out_5477006682495920197[79] = 0; + out_5477006682495920197[80] = 0; + out_5477006682495920197[81] = 0; + out_5477006682495920197[82] = 0; + out_5477006682495920197[83] = 0; + out_5477006682495920197[84] = 0; + out_5477006682495920197[85] = 0; + out_5477006682495920197[86] = 0; + out_5477006682495920197[87] = 0; } -void h_13(double *state, double *unused, double *out_8591731605088062953) { - out_8591731605088062953[0] = (-2*state[3]*state[5] + 2*state[4]*state[6])*state[9] + (2*state[3]*state[6] + 2*state[4]*state[5])*state[8] + (pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) - pow(state[6], 2))*state[7]; - out_8591731605088062953[1] = (2*state[3]*state[4] + 2*state[5]*state[6])*state[9] + (-2*state[3]*state[6] + 2*state[4]*state[5])*state[7] + (pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) - pow(state[6], 2))*state[8]; - out_8591731605088062953[2] = (-2*state[3]*state[4] + 2*state[5]*state[6])*state[8] + (2*state[3]*state[5] + 2*state[4]*state[6])*state[7] + (pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2))*state[9]; +void h_13(double *state, double *unused, double *out_4411752618062649722) { + out_4411752618062649722[0] = (-2*state[3]*state[5] + 2*state[4]*state[6])*state[9] + (2*state[3]*state[6] + 2*state[4]*state[5])*state[8] + (pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) - pow(state[6], 2))*state[7]; + out_4411752618062649722[1] = (2*state[3]*state[4] + 2*state[5]*state[6])*state[9] + (-2*state[3]*state[6] + 2*state[4]*state[5])*state[7] + (pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) - pow(state[6], 2))*state[8]; + out_4411752618062649722[2] = (-2*state[3]*state[4] + 2*state[5]*state[6])*state[8] + (2*state[3]*state[5] + 2*state[4]*state[6])*state[7] + (pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2))*state[9]; } -void H_13(double *state, double *unused, double *out_1226506526531533769) { - out_1226506526531533769[0] = 0; - out_1226506526531533769[1] = 0; - out_1226506526531533769[2] = 0; - out_1226506526531533769[3] = 2*state[3]*state[7] - 2*state[5]*state[9] + 2*state[6]*state[8]; - out_1226506526531533769[4] = 2*state[4]*state[7] + 2*state[5]*state[8] + 2*state[6]*state[9]; - out_1226506526531533769[5] = -2*state[3]*state[9] + 2*state[4]*state[8] - 2*state[5]*state[7]; - out_1226506526531533769[6] = 2*state[3]*state[8] + 2*state[4]*state[9] - 2*state[6]*state[7]; - out_1226506526531533769[7] = pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) - pow(state[6], 2); - out_1226506526531533769[8] = 2*state[3]*state[6] + 2*state[4]*state[5]; - out_1226506526531533769[9] = -2*state[3]*state[5] + 2*state[4]*state[6]; - out_1226506526531533769[10] = 0; - out_1226506526531533769[11] = 0; - out_1226506526531533769[12] = 0; - out_1226506526531533769[13] = 0; - out_1226506526531533769[14] = 0; - out_1226506526531533769[15] = 0; - out_1226506526531533769[16] = 0; - out_1226506526531533769[17] = 0; - out_1226506526531533769[18] = 0; - out_1226506526531533769[19] = 0; - out_1226506526531533769[20] = 0; - out_1226506526531533769[21] = 0; - out_1226506526531533769[22] = 0; - out_1226506526531533769[23] = 0; - out_1226506526531533769[24] = 0; - out_1226506526531533769[25] = 2*state[3]*state[8] + 2*state[4]*state[9] - 2*state[6]*state[7]; - out_1226506526531533769[26] = 2*state[3]*state[9] - 2*state[4]*state[8] + 2*state[5]*state[7]; - out_1226506526531533769[27] = 2*state[4]*state[7] + 2*state[5]*state[8] + 2*state[6]*state[9]; - out_1226506526531533769[28] = -2*state[3]*state[7] + 2*state[5]*state[9] - 2*state[6]*state[8]; - out_1226506526531533769[29] = -2*state[3]*state[6] + 2*state[4]*state[5]; - out_1226506526531533769[30] = pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) - pow(state[6], 2); - out_1226506526531533769[31] = 2*state[3]*state[4] + 2*state[5]*state[6]; - out_1226506526531533769[32] = 0; - out_1226506526531533769[33] = 0; - out_1226506526531533769[34] = 0; - out_1226506526531533769[35] = 0; - out_1226506526531533769[36] = 0; - out_1226506526531533769[37] = 0; - out_1226506526531533769[38] = 0; - out_1226506526531533769[39] = 0; - out_1226506526531533769[40] = 0; - out_1226506526531533769[41] = 0; - out_1226506526531533769[42] = 0; - out_1226506526531533769[43] = 0; - out_1226506526531533769[44] = 0; - out_1226506526531533769[45] = 0; - out_1226506526531533769[46] = 0; - out_1226506526531533769[47] = 2*state[3]*state[9] - 2*state[4]*state[8] + 2*state[5]*state[7]; - out_1226506526531533769[48] = -2*state[3]*state[8] - 2*state[4]*state[9] + 2*state[6]*state[7]; - out_1226506526531533769[49] = 2*state[3]*state[7] - 2*state[5]*state[9] + 2*state[6]*state[8]; - out_1226506526531533769[50] = 2*state[4]*state[7] + 2*state[5]*state[8] + 2*state[6]*state[9]; - out_1226506526531533769[51] = 2*state[3]*state[5] + 2*state[4]*state[6]; - out_1226506526531533769[52] = -2*state[3]*state[4] + 2*state[5]*state[6]; - out_1226506526531533769[53] = pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2); - out_1226506526531533769[54] = 0; - out_1226506526531533769[55] = 0; - out_1226506526531533769[56] = 0; - out_1226506526531533769[57] = 0; - out_1226506526531533769[58] = 0; - out_1226506526531533769[59] = 0; - out_1226506526531533769[60] = 0; - out_1226506526531533769[61] = 0; - out_1226506526531533769[62] = 0; - out_1226506526531533769[63] = 0; - out_1226506526531533769[64] = 0; - out_1226506526531533769[65] = 0; +void H_13(double *state, double *unused, double *out_6527861414729128748) { + out_6527861414729128748[0] = 0; + out_6527861414729128748[1] = 0; + out_6527861414729128748[2] = 0; + out_6527861414729128748[3] = 2*state[3]*state[7] - 2*state[5]*state[9] + 2*state[6]*state[8]; + out_6527861414729128748[4] = 2*state[4]*state[7] + 2*state[5]*state[8] + 2*state[6]*state[9]; + out_6527861414729128748[5] = -2*state[3]*state[9] + 2*state[4]*state[8] - 2*state[5]*state[7]; + out_6527861414729128748[6] = 2*state[3]*state[8] + 2*state[4]*state[9] - 2*state[6]*state[7]; + out_6527861414729128748[7] = pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) - pow(state[6], 2); + out_6527861414729128748[8] = 2*state[3]*state[6] + 2*state[4]*state[5]; + out_6527861414729128748[9] = -2*state[3]*state[5] + 2*state[4]*state[6]; + out_6527861414729128748[10] = 0; + out_6527861414729128748[11] = 0; + out_6527861414729128748[12] = 0; + out_6527861414729128748[13] = 0; + out_6527861414729128748[14] = 0; + out_6527861414729128748[15] = 0; + out_6527861414729128748[16] = 0; + out_6527861414729128748[17] = 0; + out_6527861414729128748[18] = 0; + out_6527861414729128748[19] = 0; + out_6527861414729128748[20] = 0; + out_6527861414729128748[21] = 0; + out_6527861414729128748[22] = 0; + out_6527861414729128748[23] = 0; + out_6527861414729128748[24] = 0; + out_6527861414729128748[25] = 2*state[3]*state[8] + 2*state[4]*state[9] - 2*state[6]*state[7]; + out_6527861414729128748[26] = 2*state[3]*state[9] - 2*state[4]*state[8] + 2*state[5]*state[7]; + out_6527861414729128748[27] = 2*state[4]*state[7] + 2*state[5]*state[8] + 2*state[6]*state[9]; + out_6527861414729128748[28] = -2*state[3]*state[7] + 2*state[5]*state[9] - 2*state[6]*state[8]; + out_6527861414729128748[29] = -2*state[3]*state[6] + 2*state[4]*state[5]; + out_6527861414729128748[30] = pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) - pow(state[6], 2); + out_6527861414729128748[31] = 2*state[3]*state[4] + 2*state[5]*state[6]; + out_6527861414729128748[32] = 0; + out_6527861414729128748[33] = 0; + out_6527861414729128748[34] = 0; + out_6527861414729128748[35] = 0; + out_6527861414729128748[36] = 0; + out_6527861414729128748[37] = 0; + out_6527861414729128748[38] = 0; + out_6527861414729128748[39] = 0; + out_6527861414729128748[40] = 0; + out_6527861414729128748[41] = 0; + out_6527861414729128748[42] = 0; + out_6527861414729128748[43] = 0; + out_6527861414729128748[44] = 0; + out_6527861414729128748[45] = 0; + out_6527861414729128748[46] = 0; + out_6527861414729128748[47] = 2*state[3]*state[9] - 2*state[4]*state[8] + 2*state[5]*state[7]; + out_6527861414729128748[48] = -2*state[3]*state[8] - 2*state[4]*state[9] + 2*state[6]*state[7]; + out_6527861414729128748[49] = 2*state[3]*state[7] - 2*state[5]*state[9] + 2*state[6]*state[8]; + out_6527861414729128748[50] = 2*state[4]*state[7] + 2*state[5]*state[8] + 2*state[6]*state[9]; + out_6527861414729128748[51] = 2*state[3]*state[5] + 2*state[4]*state[6]; + out_6527861414729128748[52] = -2*state[3]*state[4] + 2*state[5]*state[6]; + out_6527861414729128748[53] = pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2); + out_6527861414729128748[54] = 0; + out_6527861414729128748[55] = 0; + out_6527861414729128748[56] = 0; + out_6527861414729128748[57] = 0; + out_6527861414729128748[58] = 0; + out_6527861414729128748[59] = 0; + out_6527861414729128748[60] = 0; + out_6527861414729128748[61] = 0; + out_6527861414729128748[62] = 0; + out_6527861414729128748[63] = 0; + out_6527861414729128748[64] = 0; + out_6527861414729128748[65] = 0; } -void h_14(double *state, double *unused, double *out_5944074116138401933) { - out_5944074116138401933[0] = state[10]; - out_5944074116138401933[1] = state[11]; - out_5944074116138401933[2] = state[12]; +void h_14(double *state, double *unused, double *out_7751183598308146162) { + out_7751183598308146162[0] = state[10]; + out_7751183598308146162[1] = state[11]; + out_7751183598308146162[2] = state[12]; } -void H_14(double *state, double *unused, double *out_2564586462254658463) { - out_2564586462254658463[0] = 0; - out_2564586462254658463[1] = 0; - out_2564586462254658463[2] = 0; - out_2564586462254658463[3] = 0; - out_2564586462254658463[4] = 0; - out_2564586462254658463[5] = 0; - out_2564586462254658463[6] = 0; - out_2564586462254658463[7] = 0; - out_2564586462254658463[8] = 0; - out_2564586462254658463[9] = 0; - out_2564586462254658463[10] = 1; - out_2564586462254658463[11] = 0; - out_2564586462254658463[12] = 0; - out_2564586462254658463[13] = 0; - out_2564586462254658463[14] = 0; - out_2564586462254658463[15] = 0; - out_2564586462254658463[16] = 0; - out_2564586462254658463[17] = 0; - out_2564586462254658463[18] = 0; - out_2564586462254658463[19] = 0; - out_2564586462254658463[20] = 0; - out_2564586462254658463[21] = 0; - out_2564586462254658463[22] = 0; - out_2564586462254658463[23] = 0; - out_2564586462254658463[24] = 0; - out_2564586462254658463[25] = 0; - out_2564586462254658463[26] = 0; - out_2564586462254658463[27] = 0; - out_2564586462254658463[28] = 0; - out_2564586462254658463[29] = 0; - out_2564586462254658463[30] = 0; - out_2564586462254658463[31] = 0; - out_2564586462254658463[32] = 0; - out_2564586462254658463[33] = 1; - out_2564586462254658463[34] = 0; - out_2564586462254658463[35] = 0; - out_2564586462254658463[36] = 0; - out_2564586462254658463[37] = 0; - out_2564586462254658463[38] = 0; - out_2564586462254658463[39] = 0; - out_2564586462254658463[40] = 0; - out_2564586462254658463[41] = 0; - out_2564586462254658463[42] = 0; - out_2564586462254658463[43] = 0; - out_2564586462254658463[44] = 0; - out_2564586462254658463[45] = 0; - out_2564586462254658463[46] = 0; - out_2564586462254658463[47] = 0; - out_2564586462254658463[48] = 0; - out_2564586462254658463[49] = 0; - out_2564586462254658463[50] = 0; - out_2564586462254658463[51] = 0; - out_2564586462254658463[52] = 0; - out_2564586462254658463[53] = 0; - out_2564586462254658463[54] = 0; - out_2564586462254658463[55] = 0; - out_2564586462254658463[56] = 1; - out_2564586462254658463[57] = 0; - out_2564586462254658463[58] = 0; - out_2564586462254658463[59] = 0; - out_2564586462254658463[60] = 0; - out_2564586462254658463[61] = 0; - out_2564586462254658463[62] = 0; - out_2564586462254658463[63] = 0; - out_2564586462254658463[64] = 0; - out_2564586462254658463[65] = 0; +void H_14(double *state, double *unused, double *out_6085971972529188700) { + out_6085971972529188700[0] = 0; + out_6085971972529188700[1] = 0; + out_6085971972529188700[2] = 0; + out_6085971972529188700[3] = 0; + out_6085971972529188700[4] = 0; + out_6085971972529188700[5] = 0; + out_6085971972529188700[6] = 0; + out_6085971972529188700[7] = 0; + out_6085971972529188700[8] = 0; + out_6085971972529188700[9] = 0; + out_6085971972529188700[10] = 1; + out_6085971972529188700[11] = 0; + out_6085971972529188700[12] = 0; + out_6085971972529188700[13] = 0; + out_6085971972529188700[14] = 0; + out_6085971972529188700[15] = 0; + out_6085971972529188700[16] = 0; + out_6085971972529188700[17] = 0; + out_6085971972529188700[18] = 0; + out_6085971972529188700[19] = 0; + out_6085971972529188700[20] = 0; + out_6085971972529188700[21] = 0; + out_6085971972529188700[22] = 0; + out_6085971972529188700[23] = 0; + out_6085971972529188700[24] = 0; + out_6085971972529188700[25] = 0; + out_6085971972529188700[26] = 0; + out_6085971972529188700[27] = 0; + out_6085971972529188700[28] = 0; + out_6085971972529188700[29] = 0; + out_6085971972529188700[30] = 0; + out_6085971972529188700[31] = 0; + out_6085971972529188700[32] = 0; + out_6085971972529188700[33] = 1; + out_6085971972529188700[34] = 0; + out_6085971972529188700[35] = 0; + out_6085971972529188700[36] = 0; + out_6085971972529188700[37] = 0; + out_6085971972529188700[38] = 0; + out_6085971972529188700[39] = 0; + out_6085971972529188700[40] = 0; + out_6085971972529188700[41] = 0; + out_6085971972529188700[42] = 0; + out_6085971972529188700[43] = 0; + out_6085971972529188700[44] = 0; + out_6085971972529188700[45] = 0; + out_6085971972529188700[46] = 0; + out_6085971972529188700[47] = 0; + out_6085971972529188700[48] = 0; + out_6085971972529188700[49] = 0; + out_6085971972529188700[50] = 0; + out_6085971972529188700[51] = 0; + out_6085971972529188700[52] = 0; + out_6085971972529188700[53] = 0; + out_6085971972529188700[54] = 0; + out_6085971972529188700[55] = 0; + out_6085971972529188700[56] = 1; + out_6085971972529188700[57] = 0; + out_6085971972529188700[58] = 0; + out_6085971972529188700[59] = 0; + out_6085971972529188700[60] = 0; + out_6085971972529188700[61] = 0; + out_6085971972529188700[62] = 0; + out_6085971972529188700[63] = 0; + out_6085971972529188700[64] = 0; + out_6085971972529188700[65] = 0; } -void h_33(double *state, double *unused, double *out_3376577180674409820) { - out_3376577180674409820[0] = state[16]; - out_3376577180674409820[1] = state[17]; - out_3376577180674409820[2] = state[18]; +void h_33(double *state, double *unused, double *out_6706316243285295529) { + out_6706316243285295529[0] = state[16]; + out_6706316243285295529[1] = state[17]; + out_6706316243285295529[2] = state[18]; } -void H_33(double *state, double *unused, double *out_3711442953127215872) { - out_3711442953127215872[0] = 0; - out_3711442953127215872[1] = 0; - out_3711442953127215872[2] = 0; - out_3711442953127215872[3] = 0; - out_3711442953127215872[4] = 0; - out_3711442953127215872[5] = 0; - out_3711442953127215872[6] = 0; - out_3711442953127215872[7] = 0; - out_3711442953127215872[8] = 0; - out_3711442953127215872[9] = 0; - out_3711442953127215872[10] = 0; - out_3711442953127215872[11] = 0; - out_3711442953127215872[12] = 0; - out_3711442953127215872[13] = 0; - out_3711442953127215872[14] = 0; - out_3711442953127215872[15] = 0; - out_3711442953127215872[16] = 1; - out_3711442953127215872[17] = 0; - out_3711442953127215872[18] = 0; - out_3711442953127215872[19] = 0; - out_3711442953127215872[20] = 0; - out_3711442953127215872[21] = 0; - out_3711442953127215872[22] = 0; - out_3711442953127215872[23] = 0; - out_3711442953127215872[24] = 0; - out_3711442953127215872[25] = 0; - out_3711442953127215872[26] = 0; - out_3711442953127215872[27] = 0; - out_3711442953127215872[28] = 0; - out_3711442953127215872[29] = 0; - out_3711442953127215872[30] = 0; - out_3711442953127215872[31] = 0; - out_3711442953127215872[32] = 0; - out_3711442953127215872[33] = 0; - out_3711442953127215872[34] = 0; - out_3711442953127215872[35] = 0; - out_3711442953127215872[36] = 0; - out_3711442953127215872[37] = 0; - out_3711442953127215872[38] = 0; - out_3711442953127215872[39] = 1; - out_3711442953127215872[40] = 0; - out_3711442953127215872[41] = 0; - out_3711442953127215872[42] = 0; - out_3711442953127215872[43] = 0; - out_3711442953127215872[44] = 0; - out_3711442953127215872[45] = 0; - out_3711442953127215872[46] = 0; - out_3711442953127215872[47] = 0; - out_3711442953127215872[48] = 0; - out_3711442953127215872[49] = 0; - out_3711442953127215872[50] = 0; - out_3711442953127215872[51] = 0; - out_3711442953127215872[52] = 0; - out_3711442953127215872[53] = 0; - out_3711442953127215872[54] = 0; - out_3711442953127215872[55] = 0; - out_3711442953127215872[56] = 0; - out_3711442953127215872[57] = 0; - out_3711442953127215872[58] = 0; - out_3711442953127215872[59] = 0; - out_3711442953127215872[60] = 0; - out_3711442953127215872[61] = 0; - out_3711442953127215872[62] = 1; - out_3711442953127215872[63] = 0; - out_3711442953127215872[64] = 0; - out_3711442953127215872[65] = 0; +void H_33(double *state, double *unused, double *out_2457614462797803062) { + out_2457614462797803062[0] = 0; + out_2457614462797803062[1] = 0; + out_2457614462797803062[2] = 0; + out_2457614462797803062[3] = 0; + out_2457614462797803062[4] = 0; + out_2457614462797803062[5] = 0; + out_2457614462797803062[6] = 0; + out_2457614462797803062[7] = 0; + out_2457614462797803062[8] = 0; + out_2457614462797803062[9] = 0; + out_2457614462797803062[10] = 0; + out_2457614462797803062[11] = 0; + out_2457614462797803062[12] = 0; + out_2457614462797803062[13] = 0; + out_2457614462797803062[14] = 0; + out_2457614462797803062[15] = 0; + out_2457614462797803062[16] = 1; + out_2457614462797803062[17] = 0; + out_2457614462797803062[18] = 0; + out_2457614462797803062[19] = 0; + out_2457614462797803062[20] = 0; + out_2457614462797803062[21] = 0; + out_2457614462797803062[22] = 0; + out_2457614462797803062[23] = 0; + out_2457614462797803062[24] = 0; + out_2457614462797803062[25] = 0; + out_2457614462797803062[26] = 0; + out_2457614462797803062[27] = 0; + out_2457614462797803062[28] = 0; + out_2457614462797803062[29] = 0; + out_2457614462797803062[30] = 0; + out_2457614462797803062[31] = 0; + out_2457614462797803062[32] = 0; + out_2457614462797803062[33] = 0; + out_2457614462797803062[34] = 0; + out_2457614462797803062[35] = 0; + out_2457614462797803062[36] = 0; + out_2457614462797803062[37] = 0; + out_2457614462797803062[38] = 0; + out_2457614462797803062[39] = 1; + out_2457614462797803062[40] = 0; + out_2457614462797803062[41] = 0; + out_2457614462797803062[42] = 0; + out_2457614462797803062[43] = 0; + out_2457614462797803062[44] = 0; + out_2457614462797803062[45] = 0; + out_2457614462797803062[46] = 0; + out_2457614462797803062[47] = 0; + out_2457614462797803062[48] = 0; + out_2457614462797803062[49] = 0; + out_2457614462797803062[50] = 0; + out_2457614462797803062[51] = 0; + out_2457614462797803062[52] = 0; + out_2457614462797803062[53] = 0; + out_2457614462797803062[54] = 0; + out_2457614462797803062[55] = 0; + out_2457614462797803062[56] = 0; + out_2457614462797803062[57] = 0; + out_2457614462797803062[58] = 0; + out_2457614462797803062[59] = 0; + out_2457614462797803062[60] = 0; + out_2457614462797803062[61] = 0; + out_2457614462797803062[62] = 1; + out_2457614462797803062[63] = 0; + out_2457614462797803062[64] = 0; + out_2457614462797803062[65] = 0; } #include #include @@ -1855,77 +1855,77 @@ void live_update_14(double *in_x, double *in_P, double *in_z, double *in_R, doub void live_update_33(double *in_x, double *in_P, double *in_z, double *in_R, double *in_ea) { update<3, 3, 0>(in_x, in_P, h_33, H_33, NULL, in_z, in_R, in_ea, MAHA_THRESH_33); } -void live_H(double *in_vec, double *out_907497564161450989) { - H(in_vec, out_907497564161450989); +void live_H(double *in_vec, double *out_2989134609448912360) { + H(in_vec, out_2989134609448912360); } -void live_err_fun(double *nom_x, double *delta_x, double *out_403017012035771763) { - err_fun(nom_x, delta_x, out_403017012035771763); +void live_err_fun(double *nom_x, double *delta_x, double *out_4134642150611912562) { + err_fun(nom_x, delta_x, out_4134642150611912562); } -void live_inv_err_fun(double *nom_x, double *true_x, double *out_2932713747370631150) { - inv_err_fun(nom_x, true_x, out_2932713747370631150); +void live_inv_err_fun(double *nom_x, double *true_x, double *out_102578031842580524) { + inv_err_fun(nom_x, true_x, out_102578031842580524); } -void live_H_mod_fun(double *state, double *out_6036032580712144890) { - H_mod_fun(state, out_6036032580712144890); +void live_H_mod_fun(double *state, double *out_1333467034631963441) { + H_mod_fun(state, out_1333467034631963441); } -void live_f_fun(double *state, double dt, double *out_653667760006229873) { - f_fun(state, dt, out_653667760006229873); +void live_f_fun(double *state, double dt, double *out_1638653065682139689) { + f_fun(state, dt, out_1638653065682139689); } -void live_F_fun(double *state, double dt, double *out_8944506884882647575) { - F_fun(state, dt, out_8944506884882647575); +void live_F_fun(double *state, double dt, double *out_3627592268953963269) { + F_fun(state, dt, out_3627592268953963269); } -void live_h_4(double *state, double *unused, double *out_6967130088459663654) { - h_4(state, unused, out_6967130088459663654); +void live_h_4(double *state, double *unused, double *out_8187072558274677226) { + h_4(state, unused, out_8187072558274677226); } -void live_H_4(double *state, double *unused, double *out_2805776108884249108) { - H_4(state, unused, out_2805776108884249108); +void live_H_4(double *state, double *unused, double *out_5073553165915915446) { + H_4(state, unused, out_5073553165915915446); } -void live_h_9(double *state, double *unused, double *out_5944074116138401933) { - h_9(state, unused, out_5944074116138401933); +void live_h_9(double *state, double *unused, double *out_7751183598308146162) { + h_9(state, unused, out_7751183598308146162); } -void live_H_9(double *state, double *unused, double *out_2564586462254658463) { - H_9(state, unused, out_2564586462254658463); +void live_H_9(double *state, double *unused, double *out_6085971972529188700) { + H_9(state, unused, out_6085971972529188700); } -void live_h_10(double *state, double *unused, double *out_3024176660760462318) { - h_10(state, unused, out_3024176660760462318); +void live_h_10(double *state, double *unused, double *out_7475415363803884616) { + h_10(state, unused, out_7475415363803884616); } -void live_H_10(double *state, double *unused, double *out_3594957374532062379) { - H_10(state, unused, out_3594957374532062379); +void live_H_10(double *state, double *unused, double *out_7599748917935120017) { + H_10(state, unused, out_7599748917935120017); } -void live_h_12(double *state, double *unused, double *out_1781567485764299655) { - h_12(state, unused, out_1781567485764299655); +void live_h_12(double *state, double *unused, double *out_4560316742219209161) { + h_12(state, unused, out_4560316742219209161); } -void live_H_12(double *state, double *unused, double *out_2213680299147712687) { - H_12(state, unused, out_2213680299147712687); +void live_H_12(double *state, double *unused, double *out_8353734499761674375) { + H_12(state, unused, out_8353734499761674375); } -void live_h_35(double *state, double *unused, double *out_3392135172365373817) { - h_35(state, unused, out_3392135172365373817); +void live_h_35(double *state, double *unused, double *out_395256144382285655) { + h_35(state, unused, out_395256144382285655); } -void live_H_35(double *state, double *unused, double *out_4959243331472726396) { - H_35(state, unused, out_4959243331472726396); +void live_H_35(double *state, double *unused, double *out_5608171467436660666) { + H_35(state, unused, out_5608171467436660666); } -void live_h_32(double *state, double *unused, double *out_5713026107165599538) { - h_32(state, unused, out_5713026107165599538); +void live_h_32(double *state, double *unused, double *out_2629447041285500641) { + h_32(state, unused, out_2629447041285500641); } -void live_H_32(double *state, double *unused, double *out_8507087671459885125) { - H_32(state, unused, out_8507087671459885125); +void live_H_32(double *state, double *unused, double *out_5477006682495920197) { + H_32(state, unused, out_5477006682495920197); } -void live_h_13(double *state, double *unused, double *out_8591731605088062953) { - h_13(state, unused, out_8591731605088062953); +void live_h_13(double *state, double *unused, double *out_4411752618062649722) { + h_13(state, unused, out_4411752618062649722); } -void live_H_13(double *state, double *unused, double *out_1226506526531533769) { - H_13(state, unused, out_1226506526531533769); +void live_H_13(double *state, double *unused, double *out_6527861414729128748) { + H_13(state, unused, out_6527861414729128748); } -void live_h_14(double *state, double *unused, double *out_5944074116138401933) { - h_14(state, unused, out_5944074116138401933); +void live_h_14(double *state, double *unused, double *out_7751183598308146162) { + h_14(state, unused, out_7751183598308146162); } -void live_H_14(double *state, double *unused, double *out_2564586462254658463) { - H_14(state, unused, out_2564586462254658463); +void live_H_14(double *state, double *unused, double *out_6085971972529188700) { + H_14(state, unused, out_6085971972529188700); } -void live_h_33(double *state, double *unused, double *out_3376577180674409820) { - h_33(state, unused, out_3376577180674409820); +void live_h_33(double *state, double *unused, double *out_6706316243285295529) { + h_33(state, unused, out_6706316243285295529); } -void live_H_33(double *state, double *unused, double *out_3711442953127215872) { - H_33(state, unused, out_3711442953127215872); +void live_H_33(double *state, double *unused, double *out_2457614462797803062) { + H_33(state, unused, out_2457614462797803062); } void live_predict(double *in_x, double *in_P, double *in_Q, double dt) { predict(in_x, in_P, in_Q, dt); diff --git a/selfdrive/locationd/models/generated/live.h b/selfdrive/locationd/models/generated/live.h index 95350f4c6..3746ea9bf 100644 --- a/selfdrive/locationd/models/generated/live.h +++ b/selfdrive/locationd/models/generated/live.h @@ -10,29 +10,29 @@ void live_update_32(double *in_x, double *in_P, double *in_z, double *in_R, doub void live_update_13(double *in_x, double *in_P, double *in_z, double *in_R, double *in_ea); void live_update_14(double *in_x, double *in_P, double *in_z, double *in_R, double *in_ea); void live_update_33(double *in_x, double *in_P, double *in_z, double *in_R, double *in_ea); -void live_H(double *in_vec, double *out_907497564161450989); -void live_err_fun(double *nom_x, double *delta_x, double *out_403017012035771763); -void live_inv_err_fun(double *nom_x, double *true_x, double *out_2932713747370631150); -void live_H_mod_fun(double *state, double *out_6036032580712144890); -void live_f_fun(double *state, double dt, double *out_653667760006229873); -void live_F_fun(double *state, double dt, double *out_8944506884882647575); -void live_h_4(double *state, double *unused, double *out_6967130088459663654); -void live_H_4(double *state, double *unused, double *out_2805776108884249108); -void live_h_9(double *state, double *unused, double *out_5944074116138401933); -void live_H_9(double *state, double *unused, double *out_2564586462254658463); -void live_h_10(double *state, double *unused, double *out_3024176660760462318); -void live_H_10(double *state, double *unused, double *out_3594957374532062379); -void live_h_12(double *state, double *unused, double *out_1781567485764299655); -void live_H_12(double *state, double *unused, double *out_2213680299147712687); -void live_h_35(double *state, double *unused, double *out_3392135172365373817); -void live_H_35(double *state, double *unused, double *out_4959243331472726396); -void live_h_32(double *state, double *unused, double *out_5713026107165599538); -void live_H_32(double *state, double *unused, double *out_8507087671459885125); -void live_h_13(double *state, double *unused, double *out_8591731605088062953); -void live_H_13(double *state, double *unused, double *out_1226506526531533769); -void live_h_14(double *state, double *unused, double *out_5944074116138401933); -void live_H_14(double *state, double *unused, double *out_2564586462254658463); -void live_h_33(double *state, double *unused, double *out_3376577180674409820); -void live_H_33(double *state, double *unused, double *out_3711442953127215872); +void live_H(double *in_vec, double *out_2989134609448912360); +void live_err_fun(double *nom_x, double *delta_x, double *out_4134642150611912562); +void live_inv_err_fun(double *nom_x, double *true_x, double *out_102578031842580524); +void live_H_mod_fun(double *state, double *out_1333467034631963441); +void live_f_fun(double *state, double dt, double *out_1638653065682139689); +void live_F_fun(double *state, double dt, double *out_3627592268953963269); +void live_h_4(double *state, double *unused, double *out_8187072558274677226); +void live_H_4(double *state, double *unused, double *out_5073553165915915446); +void live_h_9(double *state, double *unused, double *out_7751183598308146162); +void live_H_9(double *state, double *unused, double *out_6085971972529188700); +void live_h_10(double *state, double *unused, double *out_7475415363803884616); +void live_H_10(double *state, double *unused, double *out_7599748917935120017); +void live_h_12(double *state, double *unused, double *out_4560316742219209161); +void live_H_12(double *state, double *unused, double *out_8353734499761674375); +void live_h_35(double *state, double *unused, double *out_395256144382285655); +void live_H_35(double *state, double *unused, double *out_5608171467436660666); +void live_h_32(double *state, double *unused, double *out_2629447041285500641); +void live_H_32(double *state, double *unused, double *out_5477006682495920197); +void live_h_13(double *state, double *unused, double *out_4411752618062649722); +void live_H_13(double *state, double *unused, double *out_6527861414729128748); +void live_h_14(double *state, double *unused, double *out_7751183598308146162); +void live_H_14(double *state, double *unused, double *out_6085971972529188700); +void live_h_33(double *state, double *unused, double *out_6706316243285295529); +void live_H_33(double *state, double *unused, double *out_2457614462797803062); void live_predict(double *in_x, double *in_P, double *in_Q, double dt); } \ No newline at end of file diff --git a/selfdrive/locationd/paramsd.py b/selfdrive/locationd/paramsd.py index 9bd4ed083..7e30b1e3a 100755 --- a/selfdrive/locationd/paramsd.py +++ b/selfdrive/locationd/paramsd.py @@ -14,8 +14,9 @@ from system.swaglog import cloudlog MAX_ANGLE_OFFSET_DELTA = 20 * DT_MDL # Max 20 deg/s -ROLL_MAX_DELTA = np.radians(20.0) * DT_MDL # 20deg in 1 second is well within curvature limits +ROLL_MAX_DELTA = math.radians(20.0) * DT_MDL # 20deg in 1 second is well within curvature limits ROLL_MIN, ROLL_MAX = math.radians(-10), math.radians(10) +ROLL_STD_MAX = math.radians(1.5) LATERAL_ACC_SENSOR_THRESHOLD = 4.0 @@ -36,10 +37,8 @@ class ParamsLearner: self.yaw_rate = 0.0 self.yaw_rate_std = 0.0 self.roll = 0.0 - self.steering_pressed = False self.steering_angle = 0.0 - - self.valid = True + self.roll_valid = False def handle_log(self, t, which, msg): if which == 'liveLocationKalman': @@ -48,8 +47,8 @@ class ParamsLearner: localizer_roll = msg.orientationNED.value[0] localizer_roll_std = np.radians(1) if np.isnan(msg.orientationNED.std[0]) else msg.orientationNED.std[0] - roll_valid = msg.orientationNED.valid and ROLL_MIN < localizer_roll < ROLL_MAX - if roll_valid: + self.roll_valid = (localizer_roll_std < ROLL_STD_MAX) and (ROLL_MIN < localizer_roll < ROLL_MAX) and msg.sensorsOK + if self.roll_valid: roll = localizer_roll # Experimentally found multiplier of 2 to be best trade-off between stability and accuracy or similar? roll_std = 2 * localizer_roll_std @@ -88,10 +87,9 @@ class ParamsLearner: elif which == 'carState': self.steering_angle = msg.steeringAngleDeg - self.steering_pressed = msg.steeringPressed self.speed = msg.vEgo - in_linear_region = abs(self.steering_angle) < 45 or not self.steering_pressed + in_linear_region = abs(self.steering_angle) < 45 self.active = self.speed > 1 and in_linear_region if self.active: @@ -158,6 +156,7 @@ def main(sm=None, pm=None): learner = ParamsLearner(CP, params['steerRatio'], params['stiffnessFactor'], math.radians(params['angleOffsetAverageDeg'])) angle_offset_average = params['angleOffsetAverageDeg'] angle_offset = angle_offset_average + roll = 0.0 while True: sm.update() @@ -177,6 +176,8 @@ def main(sm=None, pm=None): angle_offset_average = clip(math.degrees(x[States.ANGLE_OFFSET]), angle_offset_average - MAX_ANGLE_OFFSET_DELTA, angle_offset_average + MAX_ANGLE_OFFSET_DELTA) angle_offset = clip(math.degrees(x[States.ANGLE_OFFSET] + x[States.ANGLE_OFFSET_FAST]), angle_offset - MAX_ANGLE_OFFSET_DELTA, angle_offset + MAX_ANGLE_OFFSET_DELTA) + roll = clip(float(x[States.ROAD_ROLL]), roll - ROLL_MAX_DELTA, roll + ROLL_MAX_DELTA) + roll_std = float(P[States.ROAD_ROLL]) # Account for the opposite signs of the yaw rates sensors_valid = bool(abs(learner.speed * (x[States.YAW_RATE] + learner.yaw_rate)) < LATERAL_ACC_SENSOR_THRESHOLD) @@ -187,12 +188,14 @@ def main(sm=None, pm=None): liveParameters.sensorValid = sensors_valid liveParameters.steerRatio = float(x[States.STEER_RATIO]) liveParameters.stiffnessFactor = float(x[States.STIFFNESS]) - liveParameters.roll = float(x[States.ROAD_ROLL]) + liveParameters.roll = roll liveParameters.angleOffsetAverageDeg = angle_offset_average liveParameters.angleOffsetDeg = angle_offset liveParameters.valid = all(( abs(liveParameters.angleOffsetAverageDeg) < 10.0, abs(liveParameters.angleOffsetDeg) < 10.0, + abs(liveParameters.roll) < ROLL_MAX, + roll_std < ROLL_STD_MAX, 0.2 <= liveParameters.stiffnessFactor <= 5.0, min_sr <= liveParameters.steerRatio <= max_sr, )) diff --git a/selfdrive/locationd/torqued.py b/selfdrive/locationd/torqued.py index 161c308fb..74a10ed71 100755 --- a/selfdrive/locationd/torqued.py +++ b/selfdrive/locationd/torqued.py @@ -22,15 +22,15 @@ FIT_POINTS_TOTAL_QLOG = 600 MIN_VEL = 15 # m/s FRICTION_FACTOR = 1.5 # ~85% of data coverage FACTOR_SANITY = 0.3 +FACTOR_SANITY_QLOG = 0.5 FRICTION_SANITY = 0.5 +FRICTION_SANITY_QLOG = 0.8 STEER_MIN_THRESHOLD = 0.02 MIN_FILTER_DECAY = 50 MAX_FILTER_DECAY = 250 LAT_ACC_THRESHOLD = 1 STEER_BUCKET_BOUNDS = [(-0.5, -0.3), (-0.3, -0.2), (-0.2, -0.1), (-0.1, 0), (0, 0.1), (0.1, 0.2), (0.2, 0.3), (0.3, 0.5)] MIN_BUCKET_POINTS = np.array([100, 300, 500, 500, 500, 500, 300, 100]) -MAX_RESETS = 5.0 -MAX_INVALID_THRESHOLD = 10 MIN_ENGAGE_BUFFER = 2 # secs VERSION = 1 # bump this to invalidate old parameter caches @@ -100,10 +100,15 @@ class TorqueEstimator: self.min_bucket_points = MIN_BUCKET_POINTS / 10 self.min_points_total = MIN_POINTS_TOTAL_QLOG self.fit_points = FIT_POINTS_TOTAL_QLOG + self.factor_sanity = FACTOR_SANITY_QLOG + self.friction_sanity = FRICTION_SANITY_QLOG + else: self.min_bucket_points = MIN_BUCKET_POINTS self.min_points_total = MIN_POINTS_TOTAL self.fit_points = FIT_POINTS_TOTAL + self.factor_sanity = FACTOR_SANITY + self.friction_sanity = FRICTION_SANITY self.offline_friction = 0.0 self.offline_latAccelFactor = 0.0 @@ -123,10 +128,10 @@ class TorqueEstimator: 'points': [] } self.decay = MIN_FILTER_DECAY - self.min_lataccel_factor = (1.0 - FACTOR_SANITY) * self.offline_latAccelFactor - self.max_lataccel_factor = (1.0 + FACTOR_SANITY) * self.offline_latAccelFactor - self.min_friction = (1.0 - FRICTION_SANITY) * self.offline_friction - self.max_friction = (1.0 + FRICTION_SANITY) * self.offline_friction + self.min_lataccel_factor = (1.0 - self.factor_sanity) * self.offline_latAccelFactor + self.max_lataccel_factor = (1.0 + self.factor_sanity) * self.offline_latAccelFactor + self.min_friction = (1.0 - self.friction_sanity) * self.offline_friction + self.max_friction = (1.0 + self.friction_sanity) * self.offline_friction # try to restore cached params params = Params() @@ -165,7 +170,6 @@ class TorqueEstimator: def reset(self): self.resets += 1.0 - self.invalid_values_tracker = 0.0 self.decay = MIN_FILTER_DECAY self.raw_points = defaultdict(lambda: deque(maxlen=self.hist_len)) self.filtered_points = PointBuckets(x_bounds=STEER_BUCKET_BOUNDS, min_points=self.min_bucket_points, min_points_total=self.min_points_total) @@ -190,12 +194,6 @@ class TorqueEstimator: self.filtered_params[param].update(value) self.filtered_params[param].update_alpha(self.decay) - def is_sane(self, latAccelFactor, latAccelOffset, friction): - if any([val is None or np.isnan(val) for val in [latAccelFactor, latAccelOffset, friction]]): - return False - return (self.max_friction >= friction >= self.min_friction) and\ - (self.max_lataccel_factor >= latAccelFactor >= self.min_lataccel_factor) - def handle_log(self, t, which, msg): if which == "carControl": self.raw_points["carControl_t"].append(t + self.lag) @@ -225,23 +223,20 @@ class TorqueEstimator: liveTorqueParameters.useParams = self.use_params if self.filtered_points.is_valid(): - latAccelFactor, latAccelOffset, friction_coeff = self.estimate_params() + latAccelFactor, latAccelOffset, frictionCoeff = self.estimate_params() liveTorqueParameters.latAccelFactorRaw = float(latAccelFactor) liveTorqueParameters.latAccelOffsetRaw = float(latAccelOffset) - liveTorqueParameters.frictionCoefficientRaw = float(friction_coeff) + liveTorqueParameters.frictionCoefficientRaw = float(frictionCoeff) - if self.is_sane(latAccelFactor, latAccelOffset, friction_coeff): - liveTorqueParameters.liveValid = True - self.update_params({'latAccelFactor': latAccelFactor, 'latAccelOffset': latAccelOffset, 'frictionCoefficient': friction_coeff}) - self.invalid_values_tracker = max(0.0, self.invalid_values_tracker - 0.5) - else: - cloudlog.exception("Live torque parameters are outside acceptable bounds.") + if any([val is None or np.isnan(val) for val in [latAccelFactor, latAccelOffset, frictionCoeff]]): + cloudlog.exception("Live torque parameters are invalid.") liveTorqueParameters.liveValid = False - self.invalid_values_tracker += 1.0 - # Reset when ~10 invalid over 5 secs - if self.invalid_values_tracker > MAX_INVALID_THRESHOLD: - # Do not reset the filter as it may cause a drastic jump, just reset points - self.reset() + self.reset() + else: + liveTorqueParameters.liveValid = True + latAccelFactor = np.clip(latAccelFactor, self.min_lataccel_factor, self.max_lataccel_factor) + frictionCoeff = np.clip(frictionCoeff, self.min_friction, self.max_friction) + self.update_params({'latAccelFactor': latAccelFactor, 'latAccelOffset': latAccelOffset, 'frictionCoefficient': frictionCoeff}) else: liveTorqueParameters.liveValid = False diff --git a/selfdrive/locationd/ubloxd b/selfdrive/locationd/ubloxd deleted file mode 100755 index 32f32927f..000000000 Binary files a/selfdrive/locationd/ubloxd and /dev/null differ diff --git a/selfdrive/logcatd/logcatd b/selfdrive/logcatd/logcatd new file mode 100755 index 000000000..9ea88e1a9 Binary files /dev/null and b/selfdrive/logcatd/logcatd differ diff --git a/selfdrive/loggerd/bootlog b/selfdrive/loggerd/bootlog new file mode 100755 index 000000000..c48ffe68b Binary files /dev/null and b/selfdrive/loggerd/bootlog differ diff --git a/selfdrive/loggerd/config.py b/selfdrive/loggerd/config.py index 33f3a8caf..168c9fba9 100644 --- a/selfdrive/loggerd/config.py +++ b/selfdrive/loggerd/config.py @@ -1,15 +1,13 @@ import os from pathlib import Path from system.hardware import PC -from common.params import Params if os.environ.get('LOG_ROOT', False): ROOT = os.environ['LOG_ROOT'] elif PC: ROOT = os.path.join(str(Path.home()), ".comma", "media", "0", "realdata") else: - ROOT = '/data/media/0/fakedata/' - #ROOT = '/data/media/0/realdata/' + ROOT = '/data/media/0/realdata/' CAMERA_FPS = 20 diff --git a/selfdrive/loggerd/deleter.py b/selfdrive/loggerd/deleter.py index 560628802..e17d38965 100644 --- a/selfdrive/loggerd/deleter.py +++ b/selfdrive/loggerd/deleter.py @@ -28,10 +28,7 @@ def deleter_thread(exit_event): try: cloudlog.info(f"deleting {delete_path}") - if os.path.isfile(delete_path): - os.remove(delete_path) - else: - shutil.rmtree(delete_path) + shutil.rmtree(delete_path) break except OSError: cloudlog.exception(f"issue deleting {delete_path}") diff --git a/selfdrive/loggerd/encoder.h b/selfdrive/loggerd/encoder.h new file mode 100644 index 000000000..572a635a7 --- /dev/null +++ b/selfdrive/loggerd/encoder.h @@ -0,0 +1,12 @@ +#pragma once + +#include + +class VideoEncoder { +public: + virtual ~VideoEncoder() {} + virtual int encode_frame(const uint8_t *y_ptr, const uint8_t *u_ptr, const uint8_t *v_ptr, + int in_width, int in_height, uint64_t ts) = 0; + virtual void encoder_open(const char* path) = 0; + virtual void encoder_close() = 0; +}; diff --git a/selfdrive/loggerd/include/msm_media_info.h b/selfdrive/loggerd/include/msm_media_info.h new file mode 100644 index 000000000..39dceb2c4 --- /dev/null +++ b/selfdrive/loggerd/include/msm_media_info.h @@ -0,0 +1,819 @@ +#ifndef __MEDIA_INFO_H__ +#define __MEDIA_INFO_H__ + +#ifndef MSM_MEDIA_ALIGN +#define MSM_MEDIA_ALIGN(__sz, __align) (((__sz) + (__align-1)) & (~(__align-1))) +#endif + +#ifndef MSM_MEDIA_ROUNDUP +#define MSM_MEDIA_ROUNDUP(__sz, __r) (((__sz) + ((__r) - 1)) / (__r)) +#endif + +#ifndef MSM_MEDIA_MAX +#define MSM_MEDIA_MAX(__a, __b) ((__a) > (__b)?(__a):(__b)) +#endif + +enum color_fmts { + /* Venus NV12: + * YUV 4:2:0 image with a plane of 8 bit Y samples followed + * by an interleaved U/V plane containing 8 bit 2x2 subsampled + * colour difference samples. + * + * <-------- Y/UV_Stride --------> + * <------- Width -------> + * Y Y Y Y Y Y Y Y Y Y Y Y . . . . ^ ^ + * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | | + * Y Y Y Y Y Y Y Y Y Y Y Y . . . . Height | + * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | Y_Scanlines + * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | | + * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | | + * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | | + * Y Y Y Y Y Y Y Y Y Y Y Y . . . . V | + * . . . . . . . . . . . . . . . . | + * . . . . . . . . . . . . . . . . | + * . . . . . . . . . . . . . . . . | + * . . . . . . . . . . . . . . . . V + * U V U V U V U V U V U V . . . . ^ + * U V U V U V U V U V U V . . . . | + * U V U V U V U V U V U V . . . . | + * U V U V U V U V U V U V . . . . UV_Scanlines + * . . . . . . . . . . . . . . . . | + * . . . . . . . . . . . . . . . . V + * . . . . . . . . . . . . . . . . --> Buffer size alignment + * + * Y_Stride : Width aligned to 128 + * UV_Stride : Width aligned to 128 + * Y_Scanlines: Height aligned to 32 + * UV_Scanlines: Height/2 aligned to 16 + * Extradata: Arbitrary (software-imposed) padding + * Total size = align((Y_Stride * Y_Scanlines + * + UV_Stride * UV_Scanlines + * + max(Extradata, Y_Stride * 8), 4096) + */ + COLOR_FMT_NV12, + + /* Venus NV21: + * YUV 4:2:0 image with a plane of 8 bit Y samples followed + * by an interleaved V/U plane containing 8 bit 2x2 subsampled + * colour difference samples. + * + * <-------- Y/UV_Stride --------> + * <------- Width -------> + * Y Y Y Y Y Y Y Y Y Y Y Y . . . . ^ ^ + * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | | + * Y Y Y Y Y Y Y Y Y Y Y Y . . . . Height | + * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | Y_Scanlines + * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | | + * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | | + * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | | + * Y Y Y Y Y Y Y Y Y Y Y Y . . . . V | + * . . . . . . . . . . . . . . . . | + * . . . . . . . . . . . . . . . . | + * . . . . . . . . . . . . . . . . | + * . . . . . . . . . . . . . . . . V + * V U V U V U V U V U V U . . . . ^ + * V U V U V U V U V U V U . . . . | + * V U V U V U V U V U V U . . . . | + * V U V U V U V U V U V U . . . . UV_Scanlines + * . . . . . . . . . . . . . . . . | + * . . . . . . . . . . . . . . . . V + * . . . . . . . . . . . . . . . . --> Padding & Buffer size alignment + * + * Y_Stride : Width aligned to 128 + * UV_Stride : Width aligned to 128 + * Y_Scanlines: Height aligned to 32 + * UV_Scanlines: Height/2 aligned to 16 + * Extradata: Arbitrary (software-imposed) padding + * Total size = align((Y_Stride * Y_Scanlines + * + UV_Stride * UV_Scanlines + * + max(Extradata, Y_Stride * 8), 4096) + */ + COLOR_FMT_NV21, + /* Venus NV12_MVTB: + * Two YUV 4:2:0 images/views one after the other + * in a top-bottom layout, same as NV12 + * with a plane of 8 bit Y samples followed + * by an interleaved U/V plane containing 8 bit 2x2 subsampled + * colour difference samples. + * + * + * <-------- Y/UV_Stride --------> + * <------- Width -------> + * Y Y Y Y Y Y Y Y Y Y Y Y . . . . ^ ^ ^ + * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | | | + * Y Y Y Y Y Y Y Y Y Y Y Y . . . . Height | | + * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | Y_Scanlines | + * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | | | + * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | | | + * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | | | + * Y Y Y Y Y Y Y Y Y Y Y Y . . . . V | | + * . . . . . . . . . . . . . . . . | View_1 + * . . . . . . . . . . . . . . . . | | + * . . . . . . . . . . . . . . . . | | + * . . . . . . . . . . . . . . . . V | + * U V U V U V U V U V U V . . . . ^ | + * U V U V U V U V U V U V . . . . | | + * U V U V U V U V U V U V . . . . | | + * U V U V U V U V U V U V . . . . UV_Scanlines | + * . . . . . . . . . . . . . . . . | | + * . . . . . . . . . . . . . . . . V V + * Y Y Y Y Y Y Y Y Y Y Y Y . . . . ^ ^ ^ + * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | | | + * Y Y Y Y Y Y Y Y Y Y Y Y . . . . Height | | + * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | Y_Scanlines | + * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | | | + * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | | | + * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | | | + * Y Y Y Y Y Y Y Y Y Y Y Y . . . . V | | + * . . . . . . . . . . . . . . . . | View_2 + * . . . . . . . . . . . . . . . . | | + * . . . . . . . . . . . . . . . . | | + * . . . . . . . . . . . . . . . . V | + * U V U V U V U V U V U V . . . . ^ | + * U V U V U V U V U V U V . . . . | | + * U V U V U V U V U V U V . . . . | | + * U V U V U V U V U V U V . . . . UV_Scanlines | + * . . . . . . . . . . . . . . . . | | + * . . . . . . . . . . . . . . . . V V + * . . . . . . . . . . . . . . . . --> Buffer size alignment + * + * Y_Stride : Width aligned to 128 + * UV_Stride : Width aligned to 128 + * Y_Scanlines: Height aligned to 32 + * UV_Scanlines: Height/2 aligned to 16 + * View_1 begin at: 0 (zero) + * View_2 begin at: Y_Stride * Y_Scanlines + UV_Stride * UV_Scanlines + * Extradata: Arbitrary (software-imposed) padding + * Total size = align((2*(Y_Stride * Y_Scanlines) + * + 2*(UV_Stride * UV_Scanlines) + Extradata), 4096) + */ + COLOR_FMT_NV12_MVTB, + /* Venus NV12 UBWC: + * Compressed Macro-tile format for NV12. + * Contains 4 planes in the following order - + * (A) Y_Meta_Plane + * (B) Y_UBWC_Plane + * (C) UV_Meta_Plane + * (D) UV_UBWC_Plane + * + * Y_Meta_Plane consists of meta information to decode compressed + * tile data in Y_UBWC_Plane. + * Y_UBWC_Plane consists of Y data in compressed macro-tile format. + * UBWC decoder block will use the Y_Meta_Plane data together with + * Y_UBWC_Plane data to produce loss-less uncompressed 8 bit Y samples. + * + * UV_Meta_Plane consists of meta information to decode compressed + * tile data in UV_UBWC_Plane. + * UV_UBWC_Plane consists of UV data in compressed macro-tile format. + * UBWC decoder block will use UV_Meta_Plane data together with + * UV_UBWC_Plane data to produce loss-less uncompressed 8 bit 2x2 + * subsampled color difference samples. + * + * Each tile in Y_UBWC_Plane/UV_UBWC_Plane is independently decodable + * and randomly accessible. There is no dependency between tiles. + * + * <----- Y_Meta_Stride ----> + * <-------- Width ------> + * M M M M M M M M M M M M . . ^ ^ + * M M M M M M M M M M M M . . | | + * M M M M M M M M M M M M . . Height | + * M M M M M M M M M M M M . . | Meta_Y_Scanlines + * M M M M M M M M M M M M . . | | + * M M M M M M M M M M M M . . | | + * M M M M M M M M M M M M . . | | + * M M M M M M M M M M M M . . V | + * . . . . . . . . . . . . . . | + * . . . . . . . . . . . . . . | + * . . . . . . . . . . . . . . -------> Buffer size aligned to 4k + * . . . . . . . . . . . . . . V + * <--Compressed tile Y Stride---> + * <------- Width -------> + * Y* Y* Y* Y* Y* Y* Y* Y* . . . . ^ ^ + * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | | + * Y* Y* Y* Y* Y* Y* Y* Y* . . . . Height | + * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | Macro_tile_Y_Scanlines + * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | | + * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | | + * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | | + * Y* Y* Y* Y* Y* Y* Y* Y* . . . . V | + * . . . . . . . . . . . . . . . . | + * . . . . . . . . . . . . . . . . | + * . . . . . . . . . . . . . . . . -------> Buffer size aligned to 4k + * . . . . . . . . . . . . . . . . V + * <----- UV_Meta_Stride ----> + * M M M M M M M M M M M M . . ^ + * M M M M M M M M M M M M . . | + * M M M M M M M M M M M M . . | + * M M M M M M M M M M M M . . M_UV_Scanlines + * . . . . . . . . . . . . . . | + * . . . . . . . . . . . . . . V + * . . . . . . . . . . . . . . -------> Buffer size aligned to 4k + * <--Compressed tile UV Stride---> + * U* V* U* V* U* V* U* V* . . . . ^ + * U* V* U* V* U* V* U* V* . . . . | + * U* V* U* V* U* V* U* V* . . . . | + * U* V* U* V* U* V* U* V* . . . . UV_Scanlines + * . . . . . . . . . . . . . . . . | + * . . . . . . . . . . . . . . . . V + * . . . . . . . . . . . . . . . . -------> Buffer size aligned to 4k + * + * Y_Stride = align(Width, 128) + * UV_Stride = align(Width, 128) + * Y_Scanlines = align(Height, 32) + * UV_Scanlines = align(Height/2, 16) + * Y_UBWC_Plane_size = align(Y_Stride * Y_Scanlines, 4096) + * UV_UBWC_Plane_size = align(UV_Stride * UV_Scanlines, 4096) + * Y_Meta_Stride = align(roundup(Width, Y_TileWidth), 64) + * Y_Meta_Scanlines = align(roundup(Height, Y_TileHeight), 16) + * Y_Meta_Plane_size = align(Y_Meta_Stride * Y_Meta_Scanlines, 4096) + * UV_Meta_Stride = align(roundup(Width, UV_TileWidth), 64) + * UV_Meta_Scanlines = align(roundup(Height, UV_TileHeight), 16) + * UV_Meta_Plane_size = align(UV_Meta_Stride * UV_Meta_Scanlines, 4096) + * Extradata = 8k + * + * Total size = align( Y_UBWC_Plane_size + UV_UBWC_Plane_size + + * Y_Meta_Plane_size + UV_Meta_Plane_size + * + max(Extradata, Y_Stride * 48), 4096) + */ + COLOR_FMT_NV12_UBWC, + /* Venus NV12 10-bit UBWC: + * Compressed Macro-tile format for NV12. + * Contains 4 planes in the following order - + * (A) Y_Meta_Plane + * (B) Y_UBWC_Plane + * (C) UV_Meta_Plane + * (D) UV_UBWC_Plane + * + * Y_Meta_Plane consists of meta information to decode compressed + * tile data in Y_UBWC_Plane. + * Y_UBWC_Plane consists of Y data in compressed macro-tile format. + * UBWC decoder block will use the Y_Meta_Plane data together with + * Y_UBWC_Plane data to produce loss-less uncompressed 10 bit Y samples. + * + * UV_Meta_Plane consists of meta information to decode compressed + * tile data in UV_UBWC_Plane. + * UV_UBWC_Plane consists of UV data in compressed macro-tile format. + * UBWC decoder block will use UV_Meta_Plane data together with + * UV_UBWC_Plane data to produce loss-less uncompressed 10 bit 2x2 + * subsampled color difference samples. + * + * Each tile in Y_UBWC_Plane/UV_UBWC_Plane is independently decodable + * and randomly accessible. There is no dependency between tiles. + * + * <----- Y_Meta_Stride -----> + * <-------- Width ------> + * M M M M M M M M M M M M . . ^ ^ + * M M M M M M M M M M M M . . | | + * M M M M M M M M M M M M . . Height | + * M M M M M M M M M M M M . . | Meta_Y_Scanlines + * M M M M M M M M M M M M . . | | + * M M M M M M M M M M M M . . | | + * M M M M M M M M M M M M . . | | + * M M M M M M M M M M M M . . V | + * . . . . . . . . . . . . . . | + * . . . . . . . . . . . . . . | + * . . . . . . . . . . . . . . -------> Buffer size aligned to 4k + * . . . . . . . . . . . . . . V + * <--Compressed tile Y Stride---> + * <------- Width -------> + * Y* Y* Y* Y* Y* Y* Y* Y* . . . . ^ ^ + * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | | + * Y* Y* Y* Y* Y* Y* Y* Y* . . . . Height | + * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | Macro_tile_Y_Scanlines + * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | | + * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | | + * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | | + * Y* Y* Y* Y* Y* Y* Y* Y* . . . . V | + * . . . . . . . . . . . . . . . . | + * . . . . . . . . . . . . . . . . | + * . . . . . . . . . . . . . . . . -------> Buffer size aligned to 4k + * . . . . . . . . . . . . . . . . V + * <----- UV_Meta_Stride ----> + * M M M M M M M M M M M M . . ^ + * M M M M M M M M M M M M . . | + * M M M M M M M M M M M M . . | + * M M M M M M M M M M M M . . M_UV_Scanlines + * . . . . . . . . . . . . . . | + * . . . . . . . . . . . . . . V + * . . . . . . . . . . . . . . -------> Buffer size aligned to 4k + * <--Compressed tile UV Stride---> + * U* V* U* V* U* V* U* V* . . . . ^ + * U* V* U* V* U* V* U* V* . . . . | + * U* V* U* V* U* V* U* V* . . . . | + * U* V* U* V* U* V* U* V* . . . . UV_Scanlines + * . . . . . . . . . . . . . . . . | + * . . . . . . . . . . . . . . . . V + * . . . . . . . . . . . . . . . . -------> Buffer size aligned to 4k + * + * + * Y_Stride = align(Width * 4/3, 128) + * UV_Stride = align(Width * 4/3, 128) + * Y_Scanlines = align(Height, 32) + * UV_Scanlines = align(Height/2, 16) + * Y_UBWC_Plane_Size = align(Y_Stride * Y_Scanlines, 4096) + * UV_UBWC_Plane_Size = align(UV_Stride * UV_Scanlines, 4096) + * Y_Meta_Stride = align(roundup(Width, Y_TileWidth), 64) + * Y_Meta_Scanlines = align(roundup(Height, Y_TileHeight), 16) + * Y_Meta_Plane_size = align(Y_Meta_Stride * Y_Meta_Scanlines, 4096) + * UV_Meta_Stride = align(roundup(Width, UV_TileWidth), 64) + * UV_Meta_Scanlines = align(roundup(Height, UV_TileHeight), 16) + * UV_Meta_Plane_size = align(UV_Meta_Stride * UV_Meta_Scanlines, 4096) + * Extradata = 8k + * + * Total size = align(Y_UBWC_Plane_size + UV_UBWC_Plane_size + + * Y_Meta_Plane_size + UV_Meta_Plane_size + * + max(Extradata, Y_Stride * 48), 4096) + */ + COLOR_FMT_NV12_BPP10_UBWC, + /* Venus RGBA8888 format: + * Contains 1 plane in the following order - + * (A) RGBA plane + * + * <-------- RGB_Stride --------> + * <------- Width -------> + * R R R R R R R R R R R R . . . . ^ ^ + * R R R R R R R R R R R R . . . . | | + * R R R R R R R R R R R R . . . . Height | + * R R R R R R R R R R R R . . . . | RGB_Scanlines + * R R R R R R R R R R R R . . . . | | + * R R R R R R R R R R R R . . . . | | + * R R R R R R R R R R R R . . . . | | + * R R R R R R R R R R R R . . . . V | + * . . . . . . . . . . . . . . . . | + * . . . . . . . . . . . . . . . . | + * . . . . . . . . . . . . . . . . | + * . . . . . . . . . . . . . . . . V + * + * RGB_Stride = align(Width * 4, 128) + * RGB_Scanlines = align(Height, 32) + * RGB_Plane_size = align(RGB_Stride * RGB_Scanlines, 4096) + * Extradata = 8k + * + * Total size = align(RGB_Plane_size + Extradata, 4096) + */ + COLOR_FMT_RGBA8888, + /* Venus RGBA8888 UBWC format: + * Contains 2 planes in the following order - + * (A) Meta plane + * (B) RGBA plane + * + * <--- RGB_Meta_Stride ----> + * <-------- Width ------> + * M M M M M M M M M M M M . . ^ ^ + * M M M M M M M M M M M M . . | | + * M M M M M M M M M M M M . . Height | + * M M M M M M M M M M M M . . | Meta_RGB_Scanlines + * M M M M M M M M M M M M . . | | + * M M M M M M M M M M M M . . | | + * M M M M M M M M M M M M . . | | + * M M M M M M M M M M M M . . V | + * . . . . . . . . . . . . . . | + * . . . . . . . . . . . . . . | + * . . . . . . . . . . . . . . -------> Buffer size aligned to 4k + * . . . . . . . . . . . . . . V + * <-------- RGB_Stride --------> + * <------- Width -------> + * R R R R R R R R R R R R . . . . ^ ^ + * R R R R R R R R R R R R . . . . | | + * R R R R R R R R R R R R . . . . Height | + * R R R R R R R R R R R R . . . . | RGB_Scanlines + * R R R R R R R R R R R R . . . . | | + * R R R R R R R R R R R R . . . . | | + * R R R R R R R R R R R R . . . . | | + * R R R R R R R R R R R R . . . . V | + * . . . . . . . . . . . . . . . . | + * . . . . . . . . . . . . . . . . | + * . . . . . . . . . . . . . . . . -------> Buffer size aligned to 4k + * . . . . . . . . . . . . . . . . V + * + * RGB_Stride = align(Width * 4, 128) + * RGB_Scanlines = align(Height, 32) + * RGB_Plane_size = align(RGB_Stride * RGB_Scanlines, 4096) + * RGB_Meta_Stride = align(roundup(Width, RGB_TileWidth), 64) + * RGB_Meta_Scanline = align(roundup(Height, RGB_TileHeight), 16) + * RGB_Meta_Plane_size = align(RGB_Meta_Stride * + * RGB_Meta_Scanlines, 4096) + * Extradata = 8k + * + * Total size = align(RGB_Meta_Plane_size + RGB_Plane_size + + * Extradata, 4096) + */ + COLOR_FMT_RGBA8888_UBWC, +}; + +static inline unsigned int VENUS_EXTRADATA_SIZE(int width, int height) +{ + (void)height; + (void)width; + + /* + * In the future, calculate the size based on the w/h but just + * hardcode it for now since 16K satisfies all current usecases. + */ + return 16 * 1024; +} + +static inline unsigned int VENUS_Y_STRIDE(int color_fmt, int width) +{ + unsigned int alignment, stride = 0; + if (!width) + goto invalid_input; + + switch (color_fmt) { + case COLOR_FMT_NV21: + case COLOR_FMT_NV12: + case COLOR_FMT_NV12_MVTB: + case COLOR_FMT_NV12_UBWC: + alignment = 128; + stride = MSM_MEDIA_ALIGN(width, alignment); + break; + case COLOR_FMT_NV12_BPP10_UBWC: + alignment = 256; + stride = MSM_MEDIA_ALIGN(width, 192); + stride = MSM_MEDIA_ALIGN(stride * 4/3, alignment); + break; + default: + break; + } +invalid_input: + return stride; +} + +static inline unsigned int VENUS_UV_STRIDE(int color_fmt, int width) +{ + unsigned int alignment, stride = 0; + if (!width) + goto invalid_input; + + switch (color_fmt) { + case COLOR_FMT_NV21: + case COLOR_FMT_NV12: + case COLOR_FMT_NV12_MVTB: + case COLOR_FMT_NV12_UBWC: + alignment = 128; + stride = MSM_MEDIA_ALIGN(width, alignment); + break; + case COLOR_FMT_NV12_BPP10_UBWC: + alignment = 256; + stride = MSM_MEDIA_ALIGN(width, 192); + stride = MSM_MEDIA_ALIGN(stride * 4/3, alignment); + break; + default: + break; + } +invalid_input: + return stride; +} + +static inline unsigned int VENUS_Y_SCANLINES(int color_fmt, int height) +{ + unsigned int alignment, sclines = 0; + if (!height) + goto invalid_input; + + switch (color_fmt) { + case COLOR_FMT_NV21: + case COLOR_FMT_NV12: + case COLOR_FMT_NV12_MVTB: + case COLOR_FMT_NV12_UBWC: + alignment = 32; + break; + case COLOR_FMT_NV12_BPP10_UBWC: + alignment = 16; + break; + default: + return 0; + } + sclines = MSM_MEDIA_ALIGN(height, alignment); +invalid_input: + return sclines; +} + +static inline unsigned int VENUS_UV_SCANLINES(int color_fmt, int height) +{ + unsigned int alignment, sclines = 0; + if (!height) + goto invalid_input; + + switch (color_fmt) { + case COLOR_FMT_NV21: + case COLOR_FMT_NV12: + case COLOR_FMT_NV12_MVTB: + case COLOR_FMT_NV12_BPP10_UBWC: + alignment = 16; + break; + case COLOR_FMT_NV12_UBWC: + alignment = 32; + break; + default: + goto invalid_input; + } + + sclines = MSM_MEDIA_ALIGN(height / 2, alignment); + +invalid_input: + return sclines; +} + +static inline unsigned int VENUS_Y_META_STRIDE(int color_fmt, int width) +{ + int y_tile_width = 0, y_meta_stride = 0; + + if (!width) + goto invalid_input; + + switch (color_fmt) { + case COLOR_FMT_NV12_UBWC: + y_tile_width = 32; + break; + case COLOR_FMT_NV12_BPP10_UBWC: + y_tile_width = 48; + break; + default: + goto invalid_input; + } + + y_meta_stride = MSM_MEDIA_ROUNDUP(width, y_tile_width); + y_meta_stride = MSM_MEDIA_ALIGN(y_meta_stride, 64); + +invalid_input: + return y_meta_stride; +} + +static inline unsigned int VENUS_Y_META_SCANLINES(int color_fmt, int height) +{ + int y_tile_height = 0, y_meta_scanlines = 0; + + if (!height) + goto invalid_input; + + switch (color_fmt) { + case COLOR_FMT_NV12_UBWC: + y_tile_height = 8; + break; + case COLOR_FMT_NV12_BPP10_UBWC: + y_tile_height = 4; + break; + default: + goto invalid_input; + } + + y_meta_scanlines = MSM_MEDIA_ROUNDUP(height, y_tile_height); + y_meta_scanlines = MSM_MEDIA_ALIGN(y_meta_scanlines, 16); + +invalid_input: + return y_meta_scanlines; +} + +static inline unsigned int VENUS_UV_META_STRIDE(int color_fmt, int width) +{ + int uv_tile_width = 0, uv_meta_stride = 0; + + if (!width) + goto invalid_input; + + switch (color_fmt) { + case COLOR_FMT_NV12_UBWC: + uv_tile_width = 16; + break; + case COLOR_FMT_NV12_BPP10_UBWC: + uv_tile_width = 24; + break; + default: + goto invalid_input; + } + + uv_meta_stride = MSM_MEDIA_ROUNDUP(width / 2, uv_tile_width); + uv_meta_stride = MSM_MEDIA_ALIGN(uv_meta_stride, 64); + +invalid_input: + return uv_meta_stride; +} + +static inline unsigned int VENUS_UV_META_SCANLINES(int color_fmt, int height) +{ + int uv_tile_height = 0, uv_meta_scanlines = 0; + + if (!height) + goto invalid_input; + + switch (color_fmt) { + case COLOR_FMT_NV12_UBWC: + uv_tile_height = 8; + break; + case COLOR_FMT_NV12_BPP10_UBWC: + uv_tile_height = 4; + break; + default: + goto invalid_input; + } + + uv_meta_scanlines = MSM_MEDIA_ROUNDUP(height / 2, uv_tile_height); + uv_meta_scanlines = MSM_MEDIA_ALIGN(uv_meta_scanlines, 16); + +invalid_input: + return uv_meta_scanlines; +} + +static inline unsigned int VENUS_RGB_STRIDE(int color_fmt, int width) +{ + unsigned int alignment = 0, stride = 0; + if (!width) + goto invalid_input; + + switch (color_fmt) { + case COLOR_FMT_RGBA8888: + alignment = 128; + break; + case COLOR_FMT_RGBA8888_UBWC: + alignment = 256; + break; + default: + goto invalid_input; + } + + stride = MSM_MEDIA_ALIGN(width * 4, alignment); + +invalid_input: + return stride; +} + +static inline unsigned int VENUS_RGB_SCANLINES(int color_fmt, int height) +{ + unsigned int alignment = 0, scanlines = 0; + + if (!height) + goto invalid_input; + + switch (color_fmt) { + case COLOR_FMT_RGBA8888: + alignment = 32; + break; + case COLOR_FMT_RGBA8888_UBWC: + alignment = 16; + break; + default: + goto invalid_input; + } + + scanlines = MSM_MEDIA_ALIGN(height, alignment); + +invalid_input: + return scanlines; +} + +static inline unsigned int VENUS_RGB_META_STRIDE(int color_fmt, int width) +{ + int rgb_tile_width = 0, rgb_meta_stride = 0; + + if (!width) + goto invalid_input; + + switch (color_fmt) { + case COLOR_FMT_RGBA8888_UBWC: + rgb_tile_width = 16; + break; + default: + goto invalid_input; + } + + rgb_meta_stride = MSM_MEDIA_ROUNDUP(width, rgb_tile_width); + rgb_meta_stride = MSM_MEDIA_ALIGN(rgb_meta_stride, 64); + +invalid_input: + return rgb_meta_stride; +} + +static inline unsigned int VENUS_RGB_META_SCANLINES(int color_fmt, int height) +{ + int rgb_tile_height = 0, rgb_meta_scanlines = 0; + + if (!height) + goto invalid_input; + + switch (color_fmt) { + case COLOR_FMT_RGBA8888_UBWC: + rgb_tile_height = 4; + break; + default: + goto invalid_input; + } + + rgb_meta_scanlines = MSM_MEDIA_ROUNDUP(height, rgb_tile_height); + rgb_meta_scanlines = MSM_MEDIA_ALIGN(rgb_meta_scanlines, 16); + +invalid_input: + return rgb_meta_scanlines; +} + +static inline unsigned int VENUS_BUFFER_SIZE( + int color_fmt, int width, int height) +{ + const unsigned int extra_size = VENUS_EXTRADATA_SIZE(width, height); + unsigned int uv_alignment = 0, size = 0; + unsigned int y_plane, uv_plane, y_stride, + uv_stride, y_sclines, uv_sclines; + unsigned int y_ubwc_plane = 0, uv_ubwc_plane = 0; + unsigned int y_meta_stride = 0, y_meta_scanlines = 0; + unsigned int uv_meta_stride = 0, uv_meta_scanlines = 0; + unsigned int y_meta_plane = 0, uv_meta_plane = 0; + unsigned int rgb_stride = 0, rgb_scanlines = 0; + unsigned int rgb_plane = 0, rgb_ubwc_plane = 0, rgb_meta_plane = 0; + unsigned int rgb_meta_stride = 0, rgb_meta_scanlines = 0; + + if (!width || !height) + goto invalid_input; + + y_stride = VENUS_Y_STRIDE(color_fmt, width); + uv_stride = VENUS_UV_STRIDE(color_fmt, width); + y_sclines = VENUS_Y_SCANLINES(color_fmt, height); + uv_sclines = VENUS_UV_SCANLINES(color_fmt, height); + rgb_stride = VENUS_RGB_STRIDE(color_fmt, width); + rgb_scanlines = VENUS_RGB_SCANLINES(color_fmt, height); + + switch (color_fmt) { + case COLOR_FMT_NV21: + case COLOR_FMT_NV12: + uv_alignment = 4096; + y_plane = y_stride * y_sclines; + uv_plane = uv_stride * uv_sclines + uv_alignment; + size = y_plane + uv_plane + + MSM_MEDIA_MAX(extra_size, 8 * y_stride); + size = MSM_MEDIA_ALIGN(size, 4096); + break; + case COLOR_FMT_NV12_MVTB: + uv_alignment = 4096; + y_plane = y_stride * y_sclines; + uv_plane = uv_stride * uv_sclines + uv_alignment; + size = y_plane + uv_plane; + size = 2 * size + extra_size; + size = MSM_MEDIA_ALIGN(size, 4096); + break; + case COLOR_FMT_NV12_UBWC: + case COLOR_FMT_NV12_BPP10_UBWC: + y_ubwc_plane = MSM_MEDIA_ALIGN(y_stride * y_sclines, 4096); + uv_ubwc_plane = MSM_MEDIA_ALIGN(uv_stride * uv_sclines, 4096); + y_meta_stride = VENUS_Y_META_STRIDE(color_fmt, width); + y_meta_scanlines = VENUS_Y_META_SCANLINES(color_fmt, height); + y_meta_plane = MSM_MEDIA_ALIGN( + y_meta_stride * y_meta_scanlines, 4096); + uv_meta_stride = VENUS_UV_META_STRIDE(color_fmt, width); + uv_meta_scanlines = VENUS_UV_META_SCANLINES(color_fmt, height); + uv_meta_plane = MSM_MEDIA_ALIGN(uv_meta_stride * + uv_meta_scanlines, 4096); + + size = y_ubwc_plane + uv_ubwc_plane + y_meta_plane + + uv_meta_plane + + MSM_MEDIA_MAX(extra_size + 8192, 48 * y_stride); + size = MSM_MEDIA_ALIGN(size, 4096); + break; + case COLOR_FMT_RGBA8888: + rgb_plane = MSM_MEDIA_ALIGN(rgb_stride * rgb_scanlines, 4096); + size = rgb_plane; + size = MSM_MEDIA_ALIGN(size, 4096); + break; + case COLOR_FMT_RGBA8888_UBWC: + rgb_ubwc_plane = MSM_MEDIA_ALIGN(rgb_stride * rgb_scanlines, + 4096); + rgb_meta_stride = VENUS_RGB_META_STRIDE(color_fmt, width); + rgb_meta_scanlines = VENUS_RGB_META_SCANLINES(color_fmt, + height); + rgb_meta_plane = MSM_MEDIA_ALIGN(rgb_meta_stride * + rgb_meta_scanlines, 4096); + size = rgb_ubwc_plane + rgb_meta_plane; + size = MSM_MEDIA_ALIGN(size, 4096); + break; + default: + break; + } +invalid_input: + return size; +} + +static inline unsigned int VENUS_VIEW2_OFFSET( + int color_fmt, int width, int height) +{ + unsigned int offset = 0; + unsigned int y_plane, uv_plane, y_stride, + uv_stride, y_sclines, uv_sclines; + if (!width || !height) + goto invalid_input; + + y_stride = VENUS_Y_STRIDE(color_fmt, width); + uv_stride = VENUS_UV_STRIDE(color_fmt, width); + y_sclines = VENUS_Y_SCANLINES(color_fmt, height); + uv_sclines = VENUS_UV_SCANLINES(color_fmt, height); + switch (color_fmt) { + case COLOR_FMT_NV12_MVTB: + y_plane = y_stride * y_sclines; + uv_plane = uv_stride * uv_sclines; + offset = y_plane + uv_plane; + break; + default: + break; + } +invalid_input: + return offset; +} + +#endif diff --git a/selfdrive/loggerd/logger.h b/selfdrive/loggerd/logger.h index e7594cee8..3b8be3978 100644 --- a/selfdrive/loggerd/logger.h +++ b/selfdrive/loggerd/logger.h @@ -7,37 +7,55 @@ #include #include +#include #include #include #include "cereal/messaging/messaging.h" #include "common/util.h" #include "common/swaglog.h" -#include "system/hardware/hw.h" +#include "selfdrive/hardware/hw.h" const std::string LOG_ROOT = Path::log_root(); #define LOGGER_MAX_HANDLES 16 -class RawFile { +class BZFile { public: - RawFile(const char* path) { + BZFile(const char* path) { file = util::safe_fopen(path, "wb"); assert(file != nullptr); + int bzerror; + bz_file = BZ2_bzWriteOpen(&bzerror, file, 9, 0, 30); + assert(bzerror == BZ_OK); } - ~RawFile() { + ~BZFile() { + int bzerror; + BZ2_bzWriteClose(&bzerror, bz_file, 0, nullptr, nullptr); + if (bzerror != BZ_OK) { + LOGE("BZ2_bzWriteClose error, bzerror=%d", bzerror); + } util::safe_fflush(file); int err = fclose(file); assert(err == 0); } inline void write(void* data, size_t size) { - int written = util::safe_fwrite(data, 1, size, file); - assert(written == size); + int bzerror; + do { + BZ2_bzWrite(&bzerror, bz_file, data, size); + } while (bzerror == BZ_IO_ERROR && errno == EINTR); + + if (bzerror != BZ_OK && !error_logged) { + LOGE("BZ2_bzWrite error, bzerror=%d", bzerror); + error_logged = true; + } } inline void write(kj::ArrayPtr array) { write(array.begin(), array.size()); } private: + bool error_logged = false; FILE* file = nullptr; + BZFILE* bz_file = nullptr; }; typedef cereal::Sentinel::SentinelType SentinelType; @@ -51,7 +69,7 @@ typedef struct LoggerHandle { char log_path[4096]; char qlog_path[4096]; char lock_path[4096]; - std::unique_ptr log, q_log; + std::unique_ptr log, q_log; } LoggerHandle; typedef struct LoggerState { @@ -68,7 +86,7 @@ typedef struct LoggerState { kj::Array logger_build_init_data(); std::string logger_get_route_name(); -void logger_init(LoggerState *s, bool has_qlog); +void logger_init(LoggerState *s, const char* log_name, bool has_qlog); int logger_next(LoggerState *s, const char* root_path, char* out_segment_path, size_t out_segment_path_len, int* out_part); @@ -78,3 +96,4 @@ void logger_log(LoggerState *s, uint8_t* data, size_t data_size, bool in_qlog); void lh_log(LoggerHandle* h, uint8_t* data, size_t data_size, bool in_qlog); void lh_close(LoggerHandle* h); +void clear_locks(const std::string log_root); diff --git a/selfdrive/loggerd/loggerd b/selfdrive/loggerd/loggerd new file mode 100755 index 000000000..3a750420a Binary files /dev/null and b/selfdrive/loggerd/loggerd differ diff --git a/selfdrive/loggerd/loggerd.h b/selfdrive/loggerd/loggerd.h index 1fa634982..1be40789c 100644 --- a/selfdrive/loggerd/loggerd.h +++ b/selfdrive/loggerd/loggerd.h @@ -10,7 +10,6 @@ #include #include #include -#include #include "cereal/messaging/messaging.h" #include "cereal/services.h" @@ -21,21 +20,21 @@ #include "common/swaglog.h" #include "common/timing.h" #include "common/util.h" -#include "system/hardware/hw.h" +#include "selfdrive/hardware/hw.h" -#include "selfdrive/loggerd/encoder/encoder.h" +#include "selfdrive/loggerd/encoder.h" #include "selfdrive/loggerd/logger.h" -#ifdef QCOM2 -#include "selfdrive/loggerd/encoder/v4l_encoder.h" -#define Encoder V4LEncoder +#if defined(QCOM) || defined(QCOM2) +#include "selfdrive/loggerd/omx_encoder.h" +#define Encoder OmxEncoder #else -#include "selfdrive/loggerd/encoder/ffmpeg_encoder.h" -#define Encoder FfmpegEncoder +#include "selfdrive/loggerd/raw_logger.h" +#define Encoder RawLogger #endif constexpr int MAIN_FPS = 20; -const int MAIN_BITRATE = 10000000; -const int DCAM_BITRATE = MAIN_BITRATE; +const int MAIN_BITRATE = Hardware::TICI() ? 10000000 : 5000000; +const int DCAM_BITRATE = Hardware::TICI() ? MAIN_BITRATE : 2500000; #define NO_CAMERA_PATIENCE 500 // fall back to time-based rotation if all cameras are dead @@ -50,7 +49,10 @@ struct LogCameraInfo { int fps; int bitrate; bool is_h265; + bool downscale; bool has_qcamera; + bool trigger_rotate; + bool enable; bool record; }; @@ -62,22 +64,24 @@ const LogCameraInfo cameras_logged[] = { .fps = MAIN_FPS, .bitrate = MAIN_BITRATE, .is_h265 = true, + .downscale = false, .has_qcamera = true, + .trigger_rotate = true, + .enable = true, .record = true, - .frame_width = 1928, - .frame_height = 1208, }, { .type = DriverCam, .stream_type = VISION_STREAM_DRIVER, .filename = "dcamera.hevc", - .fps = MAIN_FPS, + .fps = MAIN_FPS, // on EONs, more compressed this way .bitrate = DCAM_BITRATE, .is_h265 = true, + .downscale = false, .has_qcamera = false, + .trigger_rotate = Hardware::TICI(), + .enable = true, .record = Params().getBool("RecordFront"), - .frame_width = 1928, - .frame_height = 1208, }, { .type = WideRoadCam, @@ -86,10 +90,11 @@ const LogCameraInfo cameras_logged[] = { .fps = MAIN_FPS, .bitrate = MAIN_BITRATE, .is_h265 = true, + .downscale = false, .has_qcamera = false, - .record = true, - .frame_width = 1928, - .frame_height = 1208, + .trigger_rotate = true, + .enable = Hardware::TICI(), + .record = Hardware::TICI(), }, }; const LogCameraInfo qcam_info = { @@ -97,7 +102,30 @@ const LogCameraInfo qcam_info = { .fps = MAIN_FPS, .bitrate = 256000, .is_h265 = false, - .record = true, - .frame_width = 526, - .frame_height = 330, + .downscale = true, + .frame_width = Hardware::TICI() ? 526 : 480, + .frame_height = Hardware::TICI() ? 330 : 360 // keep pixel count the same? }; + +struct LoggerdState { + LoggerState logger = {}; + char segment_path[4096]; + std::mutex rotate_lock; + std::condition_variable rotate_cv; + std::atomic rotate_segment; + std::atomic last_camera_seen_tms; + std::atomic ready_to_rotate; // count of encoders ready to rotate + int max_waiting = 0; + double last_rotate_tms = 0.; // last rotate time in ms + + // Sync logic for startup + std::atomic encoders_ready = 0; + std::atomic start_frame_id = 0; + bool camera_ready[WideRoadCam + 1] = {}; + bool camera_synced[WideRoadCam + 1] = {}; +}; + +bool sync_encoders(LoggerdState *s, CameraType cam_type, uint32_t frame_id); +bool trigger_rotate_if_needed(LoggerdState *s, int cur_seg, uint32_t frame_id); +void rotate_if_needed(LoggerdState *s); +void loggerd_thread(); diff --git a/selfdrive/loggerd/omx_encoder.h b/selfdrive/loggerd/omx_encoder.h new file mode 100644 index 000000000..0434b3bae --- /dev/null +++ b/selfdrive/loggerd/omx_encoder.h @@ -0,0 +1,73 @@ +#pragma once + +#include +#include +#include + +#include +extern "C" { +#include +} + +#include "common/queue.h" +#include "selfdrive/loggerd/encoder.h" + +// OmxEncoder, lossey codec using hardware hevc +class OmxEncoder : public VideoEncoder { +public: + OmxEncoder(const char* filename, int width, int height, int fps, int bitrate, bool h265, bool downscale, bool write = true); + ~OmxEncoder(); + int encode_frame(const uint8_t *y_ptr, const uint8_t *u_ptr, const uint8_t *v_ptr, + int in_width, int in_height, uint64_t ts); + void encoder_open(const char* path); + void encoder_close(); + + // OMX callbacks + static OMX_ERRORTYPE event_handler(OMX_HANDLETYPE component, OMX_PTR app_data, OMX_EVENTTYPE event, + OMX_U32 data1, OMX_U32 data2, OMX_PTR event_data); + static OMX_ERRORTYPE empty_buffer_done(OMX_HANDLETYPE component, OMX_PTR app_data, + OMX_BUFFERHEADERTYPE *buffer); + static OMX_ERRORTYPE fill_buffer_done(OMX_HANDLETYPE component, OMX_PTR app_data, + OMX_BUFFERHEADERTYPE *buffer); + +private: + void wait_for_state(OMX_STATETYPE state); + static void handle_out_buf(OmxEncoder *e, OMX_BUFFERHEADERTYPE *out_buf); + + int width, height, fps; + char vid_path[1024]; + char lock_path[1024]; + bool is_open = false; + bool dirty = false; + bool write = false; + int counter = 0; + + const char* filename; + FILE *of = nullptr; + + size_t codec_config_len; + uint8_t *codec_config = NULL; + bool wrote_codec_config; + + std::mutex state_lock; + std::condition_variable state_cv; + OMX_STATETYPE state = OMX_StateLoaded; + + OMX_HANDLETYPE handle; + + std::vector in_buf_headers; + std::vector out_buf_headers; + + uint64_t last_t; + + SafeQueue free_in; + SafeQueue done_out; + + AVFormatContext *ofmt_ctx; + AVCodecContext *codec_ctx; + AVStream *out_stream; + bool remuxing; + + bool downscale; + uint8_t *y_ptr2, *u_ptr2, *v_ptr2; +}; diff --git a/selfdrive/loggerd/raw_logger.h b/selfdrive/loggerd/raw_logger.h new file mode 100644 index 000000000..75d906784 --- /dev/null +++ b/selfdrive/loggerd/raw_logger.h @@ -0,0 +1,43 @@ +#pragma once + +#include +#include +#include +#include + +extern "C" { +#include +#include +#include +} + +#include "selfdrive/loggerd/encoder.h" + +class RawLogger : public VideoEncoder { + public: + RawLogger(const char* filename, int width, int height, int fps, + int bitrate, bool h265, bool downscale, bool write = true); + ~RawLogger(); + int encode_frame(const uint8_t *y_ptr, const uint8_t *u_ptr, const uint8_t *v_ptr, + int in_width, int in_height, uint64_t ts); + void encoder_open(const char* path); + void encoder_close(); + +private: + const char* filename; + //bool write; + int fps; + int counter = 0; + bool is_open = false; + + std::string vid_path, lock_path; + + AVCodec *codec = NULL; + AVCodecContext *codec_ctx = NULL; + + AVStream *stream = NULL; + AVFormatContext *format_ctx = NULL; + + AVFrame *frame = NULL; + std::vector downscale_buf; +}; diff --git a/selfdrive/loggerd/uploader.py b/selfdrive/loggerd/uploader.py index f97bafecb..c5e4a1f99 100644 --- a/selfdrive/loggerd/uploader.py +++ b/selfdrive/loggerd/uploader.py @@ -1,6 +1,4 @@ #!/usr/bin/env python3 -import bz2 -import io import json import os import random @@ -14,7 +12,6 @@ from cereal import log import cereal.messaging as messaging from common.api import Api from common.params import Params -from common.realtime import set_core_affinity from system.hardware import TICI from selfdrive.loggerd.xattr_cache import getxattr, setxattr from selfdrive.loggerd.config import ROOT @@ -24,8 +21,6 @@ NetworkType = log.DeviceState.NetworkType UPLOAD_ATTR_NAME = 'user.upload' UPLOAD_ATTR_VALUE = b'1' -UPLOAD_QLOG_QCAM_MAX_SIZE = 100 * 1e6 # MB - allow_sleep = bool(os.getenv("UPLOADER_SLEEP", "1")) force_wifi = os.getenv("FORCEWIFI") is not None fake_upload = os.getenv("FAKEUPLOAD") is not None @@ -69,12 +64,12 @@ class Uploader(): self.immediate_count = 0 # stats for last successfully uploaded file - self.last_time = 0.0 - self.last_speed = 0.0 + self.last_time = 0 + self.last_speed = 0 self.last_filename = "" self.immediate_folders = ["crash/", "boot/"] - self.immediate_priority = {"qlog": 0, "qlog.bz2": 0, "qcamera.ts": 1} + self.immediate_priority = {"qlog.bz2": 0, "qcamera.ts": 1} def get_upload_sort(self, name): if name in self.immediate_priority: @@ -124,11 +119,11 @@ class Uploader(): for name, key, fn in upload_files: if any(f in fn for f in self.immediate_folders): - return (name, key, fn) + return (key, fn) for name, key, fn in upload_files: if name in self.immediate_priority: - return (name, key, fn) + return (key, fn) return None @@ -154,13 +149,7 @@ class Uploader(): self.last_resp = FakeResponse() else: with open(fn, "rb") as f: - if key.endswith('.bz2') and not fn.endswith('.bz2'): - data = bz2.compress(f.read()) - data = io.BytesIO(data) - else: - data = f - - self.last_resp = requests.put(url, data=data, headers=headers, timeout=10) + self.last_resp = requests.put(url, data=f, headers=headers, timeout=10) except Exception as e: self.last_exc = (e, traceback.format_exc()) raise @@ -176,40 +165,40 @@ class Uploader(): return self.last_resp - def upload(self, name, key, fn, network_type, metered): + def upload(self, key, fn, network_type): try: sz = os.path.getsize(fn) except OSError: cloudlog.exception("upload: getsize failed") return False - cloudlog.event("upload_start", key=key, fn=fn, sz=sz, network_type=network_type, metered=metered) + cloudlog.event("upload_start", key=key, fn=fn, sz=sz, network_type=network_type) if sz == 0: - # tag files of 0 size as uploaded - success = True - elif name in self.immediate_priority and sz > UPLOAD_QLOG_QCAM_MAX_SIZE: - cloudlog.event("uploader_too_large", key=key, fn=fn, sz=sz) + try: + # tag files of 0 size as uploaded + setxattr(fn, UPLOAD_ATTR_NAME, UPLOAD_ATTR_VALUE) + except OSError: + cloudlog.event("uploader_setxattr_failed", exc=self.last_exc, key=key, fn=fn, sz=sz) success = True else: start_time = time.monotonic() stat = self.normal_upload(key, fn) - if stat is not None and stat.status_code in (200, 201, 401, 403, 412): + if stat is not None and stat.status_code in (200, 201, 403, 412): + try: + # tag file as uploaded + setxattr(fn, UPLOAD_ATTR_NAME, UPLOAD_ATTR_VALUE) + except OSError: + cloudlog.event("uploader_setxattr_failed", exc=self.last_exc, key=key, fn=fn, sz=sz) + self.last_filename = fn self.last_time = time.monotonic() - start_time self.last_speed = (sz / 1e6) / self.last_time success = True - cloudlog.event("upload_success" if stat.status_code != 412 else "upload_ignored", key=key, fn=fn, sz=sz, network_type=network_type, metered=metered) + cloudlog.event("upload_success" if stat.status_code != 412 else "upload_ignored", key=key, fn=fn, sz=sz, network_type=network_type) else: success = False - cloudlog.event("upload_failed", stat=stat, exc=self.last_exc, key=key, fn=fn, sz=sz, network_type=network_type, metered=metered) - - if success: - # tag file as uploaded - try: - setxattr(fn, UPLOAD_ATTR_NAME, UPLOAD_ATTR_VALUE) - except OSError: - cloudlog.event("uploader_setxattr_failed", exc=self.last_exc, key=key, fn=fn, sz=sz) + cloudlog.event("upload_failed", stat=stat, exc=self.last_exc, key=key, fn=fn, sz=sz, network_type=network_type) return success @@ -223,21 +212,12 @@ class Uploader(): us.lastFilename = self.last_filename return msg - def uploader_fn(exit_event): - try: - set_core_affinity([0, 1, 2, 3]) - except Exception: - cloudlog.exception("failed to set core affinity") - - clear_locks(ROOT) - params = Params() dongle_id = params.get("DongleId", encoding='utf8') if dongle_id is None: - cloudlog.info("uploader missing dongle_id") - raise Exception("uploader can't start without dongle id") + return if TICI and not Path("/data/media").is_mount(): cloudlog.warning("NVME not mounted") @@ -262,13 +242,9 @@ def uploader_fn(exit_event): time.sleep(60 if offroad else 5) continue - name, key, fn = d + key, fn = d - # qlogs and bootlogs need to be compressed before uploading - if key.endswith(('qlog', 'rlog')) or (key.startswith('boot/') and not key.endswith('.bz2')): - key += ".bz2" - - success = uploader.upload(name, key, fn, sm['deviceState'].networkType.raw, sm['deviceState'].networkMetered) + success = uploader.upload(key, fn, sm['deviceState'].networkType.raw) if success: backoff = 0.1 elif allow_sleep: @@ -278,7 +254,6 @@ def uploader_fn(exit_event): pm.send("uploaderState", uploader.get_msg()) - def main(): uploader_fn(threading.Event()) diff --git a/selfdrive/loggerd/xattr_cache.py b/selfdrive/loggerd/xattr_cache.py index ae6c80c57..e72169250 100644 --- a/selfdrive/loggerd/xattr_cache.py +++ b/selfdrive/loggerd/xattr_cache.py @@ -1,25 +1,15 @@ -# import os -import errno -from typing import Dict, Tuple, Optional +from typing import Dict, Tuple + from common.xattr import getxattr as getattr1 from common.xattr import setxattr as setattr1 -_cached_attributes: Dict[Tuple, Optional[bytes]] = {} - -def getxattr(path: str, attr_name: str) -> Optional[bytes]: - key = (path, attr_name) - if key not in _cached_attributes: - try: - response = getattr1(path, attr_name) - except OSError as e: - # ENODATA means attribute hasn't been set - if e.errno == errno.ENODATA: - response = None - else: - raise - _cached_attributes[key] = response - return _cached_attributes[key] +cached_attributes: Dict[Tuple, bytes] = {} +def getxattr(path: str, attr_name: bytes) -> bytes: + if (path, attr_name) not in cached_attributes: + response = getattr1(path, attr_name) + cached_attributes[(path, attr_name)] = response + return cached_attributes[(path, attr_name)] def setxattr(path: str, attr_name: str, attr_value: bytes) -> None: - _cached_attributes.pop((path, attr_name), None) + cached_attributes.pop((path, attr_name), None) return setattr1(path, attr_name, attr_value) diff --git a/selfdrive/manager/build.py b/selfdrive/manager/build.py index 6b57f8579..ef2884b40 100755 --- a/selfdrive/manager/build.py +++ b/selfdrive/manager/build.py @@ -16,7 +16,7 @@ from system.version import is_dirty MAX_CACHE_SIZE = 4e9 if "CI" in os.environ else 2e9 CACHE_DIR = Path("/data/scons_cache" if AGNOS else "/tmp/scons_cache") -TOTAL_SCONS_NODES = 2395 +TOTAL_SCONS_NODES = 2460 MAX_BUILD_PROGRESS = 100 PREBUILT = os.path.exists(os.path.join(BASEDIR, 'prebuilt')) @@ -77,7 +77,7 @@ def build(spinner: Spinner, dirty: bool = False) -> None: spinner.close() if not os.getenv("CI"): error_s = "\n \n".join(["\n".join(textwrap.wrap(e, 65)) for e in errors]) - with TextWindow(("openpilot failed to build (IP: %s)\n \n" % ip) + error_s) as t: + with TextWindow(("dragonpilot failed to build (IP: %s)\n \n" % ip) + error_s) as t: t.wait_for_exit() exit(1) diff --git a/selfdrive/manager/manager.py b/selfdrive/manager/manager.py index a1d53bbf9..8f16f0902 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, is_tested_branch + terms_version, training_version, is_tested_branch, is_release_branch from common.dp_conf import init_params_vals @@ -32,19 +32,19 @@ def manager_init() -> None: set_time(cloudlog) # save boot log - #subprocess.call("./bootlog", cwd=os.path.join(BASEDIR, "selfdrive/loggerd")) + # subprocess.call("./bootlog", cwd=os.path.join(BASEDIR, "system/loggerd")) params = Params() params.clear_all(ParamKeyType.CLEAR_ON_MANAGER_START) default_params: List[Tuple[str, Union[str, bytes]]] = [ ("CompletedTrainingVersion", "0"), - ("DisengageOnAccelerator", "1"), + ("DisengageOnAccelerator", "0"), ("GsmMetered", "1"), ("HasAcceptedTerms", "0"), ("LanguageSetting", "main_en"), ("OpenpilotEnabledToggle", "1"), - ("ShowDebugUI", "0"), + # ("ShowDebugUI", "0"), ("SpeedLimitControl", "0"), ("SpeedLimitPercOffset", "0"), ("TurnSpeedControl", "0"), @@ -87,6 +87,7 @@ def manager_init() -> None: params.put("GitBranch", get_short_branch(default="")) params.put("GitRemote", get_origin(default="")) params.put_bool("IsTestedBranch", is_tested_branch()) + params.put_bool("IsReleaseBranch", is_release_branch()) # set dongle id reg_res = register(show_spinner=True) @@ -135,13 +136,15 @@ def manager_thread() -> None: # dp dp_nav = params.get_bool('dp_nav') dp_otisserv = dp_nav and params.get_bool('dp_otisserv') - ignore += ['dmonitoringmodeld', 'dmonitoringd', 'dpmonitoringd'] if params.get_bool('dp_jetson') else [] - ignore += ['navd'] if not dp_nav else [] + dp_jetson = params.get_bool('dp_jetson') + ignore += ['dmonitoringmodeld', 'dmonitoringd', 'dpmonitoringd'] if dp_jetson else [] + ignore += ['navd', 'mapsd'] if not dp_nav else [] ignore += ['otisserv'] if not dp_nav or not dp_otisserv else [] dp_mapd = params.get_bool('dp_mapd') ignore += ['mapd'] if not dp_mapd else [] ignore += ['gpxd'] if not dp_otisserv and not dp_mapd and not params.get_bool('dp_gpxd') else [] - ignore += ['uploader'] if not params.get_bool('dp_api_custom') and params.get_bool('dp_jetson') else [] + ignore += ['uploader'] if not params.get_bool('dp_api_custom') and dp_jetson else [] + ignore += ['logcatd', 'proclogd', 'loggerd', 'logmessaged', 'encoderd', ''] if params.get("DongleId", encoding='utf8') in (None, UNREGISTERED_DONGLE_ID): ignore += ["manage_athenad", "uploader"] diff --git a/selfdrive/manager/process.py b/selfdrive/manager/process.py index dabfbe4ee..ce18073d9 100644 --- a/selfdrive/manager/process.py +++ b/selfdrive/manager/process.py @@ -290,10 +290,11 @@ class DaemonProcess(ManagerProcess): def ensure_running(procs: ValuesView[ManagerProcess], started: bool, params=None, CP: car.CarParams=None, - not_run: Optional[List[str]]=None) -> None: + not_run: Optional[List[str]]=None) -> List[ManagerProcess]: if not_run is None: not_run = [] + running = [] for p in procs: # Conditions that make a process run run = any(( @@ -311,7 +312,10 @@ def ensure_running(procs: ValuesView[ManagerProcess], started: bool, params=None if run: p.start() + running.append(p) else: p.stop(block=False) p.check_watchdog(started) + + return running diff --git a/selfdrive/manager/process_config.py b/selfdrive/manager/process_config.py index fb53cb64b..827d6057b 100644 --- a/selfdrive/manager/process_config.py +++ b/selfdrive/manager/process_config.py @@ -19,6 +19,11 @@ def logging(started, params, CP: car.CarParams) -> bool: run = (not CP.notCar) or not params.get_bool("DisableLogging") return started and run +def ublox(started, params, CP: car.CarParams) -> bool: + use_ublox = True #os.path.exists('/dev/ttyHS0') and not os.path.exists('/persist/comma/use-quectel-gps') + params.put_bool("UbloxAvailable", use_ublox) + return started and use_ublox + procs = [ # due to qualcomm kernel bugs SIGKILLing camerad sometimes causes page table corruption NativeProcess("camerad", "system/camerad", ["./camerad"], unkillable=True, callback=driverview), @@ -30,35 +35,35 @@ procs = [ # PythonProcess("timezoned", "system.timezoned", enabled=not PC, offroad=True), DaemonProcess("manage_athenad", "selfdrive.athena.manage_athenad", "AthenadPid"), - NativeProcess("dmonitoringmodeld", "selfdrive/modeld", ["./dmonitoringmodeld"], enabled=dp_dm, callback=driverview), - # NativeProcess("encoderd", "selfdrive/loggerd", ["./encoderd"]), - # NativeProcess("loggerd", "selfdrive/loggerd", ["./loggerd"], onroad=False, callback=logging), + # NativeProcess("dmonitoringmodeld", "selfdrive/modeld", ["./dmonitoringmodeld"], enabled=(not PC or WEBCAM), callback=driverview), + # NativeProcess("encoderd", "system/loggerd", ["./encoderd"]), + # NativeProcess("loggerd", "system/loggerd", ["./loggerd"], onroad=False, callback=logging), NativeProcess("modeld", "selfdrive/modeld", ["./modeld"]), - NativeProcess("mapsd", "selfdrive/navd", ["./map_renderer"], enabled=False), + # NativeProcess("mapsd", "selfdrive/navd", ["./map_renderer"], enabled=False), # NativeProcess("navmodeld", "selfdrive/modeld", ["./navmodeld"], enabled=False), - NativeProcess("sensord", "selfdrive/sensord", ["./sensord"], enabled=not PC, offroad=EON, sigkill=EON), - NativeProcess("ubloxd", "selfdrive/locationd", ["./ubloxd"], enabled=(not PC or WEBCAM)), - NativeProcess("ui", "selfdrive/ui", ["./ui"], offroad=True, watchdog_max_dt=(5 if (TICI or EON) else None)), + # NativeProcess("sensord", "system/sensord", ["./sensord"], enabled=not PC), + NativeProcess("ui", "selfdrive/ui", ["./ui"], offroad=True, watchdog_max_dt=(5 if not PC else None)), NativeProcess("soundd", "selfdrive/ui/soundd", ["./soundd"], offroad=True), NativeProcess("locationd", "selfdrive/locationd", ["./locationd"]), NativeProcess("boardd", "selfdrive/boardd", ["./boardd"], enabled=False), PythonProcess("calibrationd", "selfdrive.locationd.calibrationd"), PythonProcess("torqued", "selfdrive.locationd.torqued"), PythonProcess("controlsd", "selfdrive.controls.controlsd"), - # PythonProcess("deleter", "selfdrive.loggerd.deleter", offroad=True), - PythonProcess("dmonitoringd", "selfdrive.monitoring.dmonitoringd", enabled=(not PC or WEBCAM), callback=driverview), + # PythonProcess("deleter", "system.loggerd.deleter", offroad=True), + # PythonProcess("dmonitoringd", "selfdrive.monitoring.dmonitoringd", enabled=(not PC or WEBCAM), callback=driverview), # PythonProcess("laikad", "selfdrive.locationd.laikad"), - # PythonProcess("rawgpsd", "selfdrive.sensord.rawgps.rawgpsd", enabled=TICI), + # PythonProcess("rawgpsd", "system.sensord.rawgps.rawgpsd", enabled=TICI), PythonProcess("navd", "selfdrive.navd.navd"), PythonProcess("pandad", "selfdrive.boardd.pandad", offroad=True), PythonProcess("paramsd", "selfdrive.locationd.paramsd"), - PythonProcess("pigeond", "selfdrive.sensord.pigeond", enabled=TICI), + # NativeProcess("ubloxd", "system/ubloxd", ["./ubloxd"], enabled=TICI, onroad=False, callback=ublox), + # PythonProcess("pigeond", "system.sensord.pigeond", enabled=TICI, onroad=False, callback=ublox), PythonProcess("plannerd", "selfdrive.controls.plannerd"), PythonProcess("radard", "selfdrive.controls.radard"), PythonProcess("thermald", "selfdrive.thermald.thermald", offroad=True), # PythonProcess("tombstoned", "selfdrive.tombstoned", enabled=not PC, offroad=True), PythonProcess("updated", "selfdrive.updated", enabled=not PC, onroad=False, offroad=True), - # PythonProcess("uploader", "selfdrive.loggerd.uploader", offroad=True), + # PythonProcess("uploader", "system.loggerd.uploader", offroad=True), # PythonProcess("statsd", "selfdrive.statsd", offroad=True), # NativeProcess("bridge", "cereal/messaging", ["./bridge"], onroad=False, callback=notcar), @@ -70,12 +75,21 @@ procs = [ PythonProcess("androidd", "system.hardware.eon.androidd", enabled=EON, offroad=True), # dp + NativeProcess("dmonitoringmodeld", "selfdrive/modeld", ["./dmonitoringmodeld"], enabled=dp_dm, callback=driverview), + PythonProcess("dmonitoringd", "selfdrive.monitoring.dmonitoringd", enabled=dp_dm, callback=driverview), PythonProcess("dpmonitoringd", "selfdrive.dragonpilot.dpmonitoringd", enabled=not dp_dm), PythonProcess("mapd", "selfdrive.mapd.mapd"), PythonProcess("systemd", "selfdrive.dragonpilot.systemd", offroad=True), PythonProcess("gpxd", "selfdrive.dragonpilot.gpxd"), PythonProcess("otisserv", "selfdrive.dragonpilot.otisserv", offroad=True), - # PythonProcess("loggerd", "selfdrive.dragonpilot.loggerd"), + NativeProcess("sensord", "system/sensord", ["./sensord"], enabled=not PC, offroad=True, sigkill=EON), + NativeProcess("ubloxd", "system/ubloxd", ["./ubloxd"], onroad=False, callback=ublox), + # NativeProcess("logcatd", "selfdrive/logcatd", ["./logcatd"]), + # NativeProcess("proclogd", "selfdrive/proclogd", ["./proclogd"]), + # PythonProcess("loggerd", "selfdrive/loggerd", ["./loggerd"]), + # PythonProcess("deleter", "selfdrive.loggerd.deleter", offroad=True), + # PythonProcess("uploader", "selfdrive.loggerd.uploader", offroad=True), + # PythonProcess("logmessaged", "system.logmessaged", offroad=True), ] managed_processes = {p.name: p for p in procs} diff --git a/selfdrive/mapd/lib/WayRelation.py b/selfdrive/mapd/lib/WayRelation.py index cb3b4f161..ac38242cd 100644 --- a/selfdrive/mapd/lib/WayRelation.py +++ b/selfdrive/mapd/lib/WayRelation.py @@ -174,10 +174,8 @@ def speed_limit_value_for_highway_type(areas, tags): if rule_valid: max_speed = rule['speed'] break #stop searching region - except KeyError as e: - print(e) - except TypeError as e: - print(f"TypeError: {e} object is not iterable.") + except Exception: + return None if max_speed is None: return 0 v = re.match(r'^\s*([0-9]{1,3})\s*?(mph)?\s*$', str(max_speed)) diff --git a/selfdrive/mapd/lib/helpers.py b/selfdrive/mapd/lib/helpers.py index 8bc5ea3e3..785469d3e 100644 --- a/selfdrive/mapd/lib/helpers.py +++ b/selfdrive/mapd/lib/helpers.py @@ -5,7 +5,7 @@ import email.utils as eut import time from common.params import Params -from selfdrive.hardware import TICI +from system.hardware import TICI OSM_LOCAL_PATH = "/data/media/0/osm" OSM_DB_STAMP_FILE = OSM_LOCAL_PATH + "/db_stamp" diff --git a/selfdrive/mapd/sp_osm_db.json b/selfdrive/mapd/sp_osm_db.json index 48b300d75..83bf96dd6 100644 --- a/selfdrive/mapd/sp_osm_db.json +++ b/selfdrive/mapd/sp_osm_db.json @@ -1,5 +1,5 @@ { - "== None ==": "", + "N/A": "", "US - West": "https://thecorgirosie-my.sharepoint.com/:u:/p/jason_wen/EYWdXcNpOhJCuOLymUHSwH4BwdRddfiYEbZAK1ltd-hZJA?e=TW5ia4&download=1", "US - South": "https://thecorgirosie-my.sharepoint.com/:u:/p/jason_wen/EWNHW-27AzRIr8KRd3EGMkABVEoXf8KLz3uRvvEgfP7xAw?e=4Cbkcu&download=1", "TW": "https://thecorgirosie-my.sharepoint.com/:u:/p/jason_wen/EYdsed4UDtNFtR7z6_3nffkBqS40qoO9kGZfKGsfz51g5w?e=Werz8B&download=1", diff --git a/selfdrive/modeld/_dmonitoringmodeld b/selfdrive/modeld/_dmonitoringmodeld index e385b22ea..6025eabee 100755 Binary files a/selfdrive/modeld/_dmonitoringmodeld and b/selfdrive/modeld/_dmonitoringmodeld differ diff --git a/selfdrive/modeld/_modeld b/selfdrive/modeld/_modeld index 6eaeb3f66..3cc5f2d56 100755 Binary files a/selfdrive/modeld/_modeld and b/selfdrive/modeld/_modeld differ diff --git a/selfdrive/modeld/models/commonmodel.h b/selfdrive/modeld/models/commonmodel.h index 044d75a63..cb83c3d27 100644 --- a/selfdrive/modeld/models/commonmodel.h +++ b/selfdrive/modeld/models/commonmodel.h @@ -20,6 +20,7 @@ const bool send_raw_pred = getenv("SEND_RAW_PRED") != NULL; void softmax(const float* input, float* output, size_t len); +float softplus(float input); float sigmoid(float input); template diff --git a/selfdrive/modeld/models/dmonitoring.h b/selfdrive/modeld/models/dmonitoring.h index db4e2ef72..f09300b1b 100644 --- a/selfdrive/modeld/models/dmonitoring.h +++ b/selfdrive/modeld/models/dmonitoring.h @@ -7,10 +7,7 @@ #include "selfdrive/modeld/models/commonmodel.h" #include "selfdrive/modeld/runners/run.h" -#define CALIB_LEN 3 - -#define OUTPUT_SIZE 45 -#define REG_SCALE 0.25f +#define OUTPUT_SIZE 39 typedef struct DMonitoringResult { float face_orientation[3]; @@ -28,8 +25,6 @@ typedef struct DMonitoringResult { float distracted_pose; float distracted_eyes; float occluded_prob; - float ready_prob[4]; - float not_ready_prob[2]; float dsp_execution_time; } DMonitoringResult; @@ -41,12 +36,11 @@ typedef struct DMonitoringModelState { std::vector cropped_buf; std::vector premirror_cropped_buf; std::vector net_input_buf; - float calib[CALIB_LEN]; float tensor[UINT8_MAX + 1]; } DMonitoringModelState; void dmonitoring_init(DMonitoringModelState* s); -DMonitoringResult dmonitoring_eval_frame(DMonitoringModelState* s, void* stream_buf, int width, int height, float *calib); +DMonitoringResult dmonitoring_eval_frame(DMonitoringModelState* s, void* stream_buf, int width, int height); void dmonitoring_publish(PubMaster &pm, uint32_t frame_id, const DMonitoringResult &res, float execution_time, kj::ArrayPtr raw_pred); void dmonitoring_free(DMonitoringModelState* s); diff --git a/selfdrive/modeld/models/dmonitoring_model_q.dlc b/selfdrive/modeld/models/dmonitoring_model_q.dlc index 03f82c577..be61a6c30 100644 Binary files a/selfdrive/modeld/models/dmonitoring_model_q.dlc and b/selfdrive/modeld/models/dmonitoring_model_q.dlc differ diff --git a/selfdrive/modeld/models/supercombo.thneed b/selfdrive/modeld/models/supercombo.thneed index d142a04f0..c86e4cc29 100644 Binary files a/selfdrive/modeld/models/supercombo.thneed and b/selfdrive/modeld/models/supercombo.thneed differ diff --git a/selfdrive/modeld/thneed/compile b/selfdrive/modeld/thneed/compile index 3935684aa..f64e1cf60 100755 Binary files a/selfdrive/modeld/thneed/compile and b/selfdrive/modeld/thneed/compile differ diff --git a/selfdrive/modeld/thneed/thneed.h b/selfdrive/modeld/thneed/thneed.h index b09d32b0e..ba50f6479 100644 --- a/selfdrive/modeld/thneed/thneed.h +++ b/selfdrive/modeld/thneed/thneed.h @@ -12,7 +12,7 @@ #include -#include "selfdrive/modeld/thneed/include/msm_kgsl.h" +#include "msm_kgsl.h" using namespace std; diff --git a/selfdrive/monitoring/dmonitoringd.py b/selfdrive/monitoring/dmonitoringd.py index 0f05563b6..156704b9d 100755 --- a/selfdrive/monitoring/dmonitoringd.py +++ b/selfdrive/monitoring/dmonitoringd.py @@ -46,6 +46,8 @@ def dmonitoringd_thread(sm=None, pm=None): sm['carState'].steeringPressed or \ sm['carState'].gasPressed or \ sm['carState'].brakePressed + if driver_engaged: + driver_status.update(Events(), True, sm['controlsState'].enabled, sm['carState'].standstill) v_cruise_last = v_cruise if sm.updated['modelV2']: @@ -53,7 +55,7 @@ def dmonitoringd_thread(sm=None, pm=None): # Get data from dmonitoringmodeld events = Events() - driver_status.update_states(sm['driverState'], sm['liveCalibration'].rpyCalib, sm['carState'].vEgo, sm['controlsState'].enabled) + driver_status.get_pose(sm['driverState'], sm['liveCalibration'].rpyCalib, sm['carState'].vEgo, sm['controlsState'].enabled) # Block engaging after max number of distrations if driver_status.terminal_alert_cnt >= driver_status.settings._MAX_TERMINAL_ALERTS or \ @@ -61,7 +63,7 @@ def dmonitoringd_thread(sm=None, pm=None): events.add(car.CarEvent.EventName.tooDistracted) # Update events from driver state - driver_status.update_events(events, driver_engaged, sm['controlsState'].enabled, sm['carState'].standstill) + driver_status.update(events, driver_engaged, sm['controlsState'].enabled, sm['carState'].standstill) # build driverMonitoringState packet dat = messaging.new_message('driverMonitoringState') @@ -69,7 +71,6 @@ def dmonitoringd_thread(sm=None, pm=None): "events": events.to_msg(), "faceDetected": driver_status.face_detected, "isDistracted": driver_status.driver_distracted, - "distractedType": sum(driver_status.distracted_types), "awarenessStatus": driver_status.awareness, "posePitchOffset": driver_status.pose.pitch_offseter.filtered_stat.mean(), "posePitchValidCount": driver_status.pose.pitch_offseter.filtered_stat.n, @@ -85,11 +86,6 @@ def dmonitoringd_thread(sm=None, pm=None): } pm.send('driverMonitoringState', dat) - # # save rhd virtual toggle every 5 mins - # if (sm['driverStateV2'].frameId % 6000 == 0 and - # driver_status.wheelpos_learner.filtered_stat.n > driver_status.settings._WHEELPOS_FILTER_MIN_COUNT and - # driver_status.wheel_on_right == (driver_status.wheelpos_learner.filtered_stat.M > driver_status.settings._WHEELPOS_THRESHOLD)): - # put_bool_nonblocking("IsRhdDetected", driver_status.wheel_on_right) def main(sm=None, pm=None): dmonitoringd_thread(sm, pm) diff --git a/selfdrive/monitoring/driver_monitor.py b/selfdrive/monitoring/driver_monitor.py index ee4dd52e0..137aab7cf 100644 --- a/selfdrive/monitoring/driver_monitor.py +++ b/selfdrive/monitoring/driver_monitor.py @@ -17,27 +17,21 @@ EventName = car.CarEvent.EventName class DRIVER_MONITOR_SETTINGS(): def __init__(self, DT_DMON=DT_DMON): self._DT_DMON = DT_DMON - # ref (page15-16): https://eur-lex.europa.eu/legal-content/EN/TXT/PDF/?uri=CELEX:42018X1947&rid=2 - self._AWARENESS_TIME = 30. # passive wheeltouch total timeout - self._AWARENESS_PRE_TIME_TILL_TERMINAL = 15. + self._AWARENESS_TIME = 35. # passive wheeltouch total timeout + self._AWARENESS_PRE_TIME_TILL_TERMINAL = 12. self._AWARENESS_PROMPT_TIME_TILL_TERMINAL = 6. self._DISTRACTED_TIME = 11. # active monitoring total timeout self._DISTRACTED_PRE_TIME_TILL_TERMINAL = 8. self._DISTRACTED_PROMPT_TIME_TILL_TERMINAL = 6. self._FACE_THRESHOLD = 0.5 - self._PARTIAL_FACE_THRESHOLD = 0.45 - self._EYE_THRESHOLD = 0.6 - self._SG_THRESHOLD = 0.91 - self._BLINK_THRESHOLD = 0.55 - self._BLINK_THRESHOLD_SLACK = 0.7 + self._PARTIAL_FACE_THRESHOLD = 0.43 + self._EYE_THRESHOLD = 0.55 + self._SG_THRESHOLD = 0.86 + self._BLINK_THRESHOLD = 0.588 + self._BLINK_THRESHOLD_SLACK = 0.77 self._BLINK_THRESHOLD_STRICT = self._BLINK_THRESHOLD - self._EE_THRESH11 = 0.4 - self._EE_THRESH12 = 2.45 - self._EE_THRESH21 = 0.01 - self._EE_THRESH22 = 0.35 - self._POSE_PITCH_THRESHOLD = 0.3237 self._POSE_PITCH_THRESHOLD_SLACK = 0.3657 self._POSE_PITCH_THRESHOLD_STRICT = self._POSE_PITCH_THRESHOLD @@ -51,7 +45,7 @@ class DRIVER_MONITOR_SETTINGS(): self._YAW_MAX_OFFSET = 0.289 self._YAW_MIN_OFFSET = -0.0246 - self._POSESTD_THRESHOLD = 0.315 + self._POSESTD_THRESHOLD = 0.3 self._HI_STD_FALLBACK_TIME = int(10 / self._DT_DMON) # fall back to wheel touch if model is uncertain for 10s self._DISTRACTED_FILTER_TS = 0.25 # 0.6Hz @@ -72,9 +66,8 @@ H, W, FULL_W = 320, 160, 426 class DistractedType: NOT_DISTRACTED = 0 - DISTRACTED_POSE = 1 - DISTRACTED_BLINK = 2 - DISTRACTED_E2E = 4 + BAD_POSE = 1 + BAD_BLINK = 2 def face_orientation_from_net(angles_desc, pos_desc, rpy_calib, is_rhd): # the output of these angles are in device frame @@ -124,17 +117,9 @@ class DriverStatus(): self.pose = DriverPose(self.settings._POSE_OFFSET_MAX_COUNT) self.pose_calibrated = False self.blink = DriverBlink() - self.eev1 = 0. - self.eev2 = 1. - self.ee1_offseter = RunningStatFilter(max_trackable=self.settings._POSE_OFFSET_MAX_COUNT) - self.ee2_offseter = RunningStatFilter(max_trackable=self.settings._POSE_OFFSET_MAX_COUNT) - self.ee1_calibrated = False - self.ee2_calibrated = False - self.awareness = 1. self.awareness_active = 1. self.awareness_passive = 1. - self.distracted_types = [] self.driver_distracted = False self.driver_distraction_filter = FirstOrderFilter(0., self.settings._DISTRACTED_FILTER_TS, self.settings._DT_DMON) self.face_detected = False @@ -150,11 +135,6 @@ class DriverStatus(): self._set_timers(active_monitoring=True) - def _reset_awareness(self): - self.awareness = 1. - self.awareness_active = 1. - self.awareness_passive = 1. - def _set_timers(self, active_monitoring): if self.active_monitoring_mode and self.awareness <= self.threshold_prompt: if active_monitoring: @@ -185,38 +165,26 @@ class DriverStatus(): self.step_change = self.settings._DT_DMON / self.settings._AWARENESS_TIME self.active_monitoring_mode = False - def _get_distracted_types(self): - distracted_types = [] - + def _is_driver_distracted(self, pose, blink): if not self.pose_calibrated: - pitch_error = self.pose.pitch - self.settings._PITCH_NATURAL_OFFSET - yaw_error = self.pose.yaw - self.settings._YAW_NATURAL_OFFSET + pitch_error = pose.pitch - self.settings._PITCH_NATURAL_OFFSET + yaw_error = pose.yaw - self.settings._YAW_NATURAL_OFFSET else: - pitch_error = self.pose.pitch - min(max(self.pose.pitch_offseter.filtered_stat.mean(), - self.settings._PITCH_MIN_OFFSET), self.settings._PITCH_MAX_OFFSET) - yaw_error = self.pose.yaw - min(max(self.pose.yaw_offseter.filtered_stat.mean(), - self.settings._YAW_MIN_OFFSET), self.settings._YAW_MAX_OFFSET) + pitch_error = pose.pitch - min(max(self.pose.pitch_offseter.filtered_stat.mean(), + self.settings._PITCH_MIN_OFFSET), self.settings._PITCH_MAX_OFFSET) + yaw_error = pose.yaw - min(max(self.pose.yaw_offseter.filtered_stat.mean(), + self.settings._YAW_MIN_OFFSET), self.settings._YAW_MAX_OFFSET) + pitch_error = 0 if pitch_error > 0 else abs(pitch_error) # no positive pitch limit yaw_error = abs(yaw_error) - if pitch_error > self.settings._POSE_PITCH_THRESHOLD*self.pose.cfactor_pitch or \ - yaw_error > self.settings._POSE_YAW_THRESHOLD*self.pose.cfactor_yaw: - distracted_types.append(DistractedType.DISTRACTED_POSE) - if (self.blink.left_blink + self.blink.right_blink)*0.5 > self.settings._BLINK_THRESHOLD*self.blink.cfactor: - distracted_types.append(DistractedType.DISTRACTED_BLINK) - - if self.ee1_calibrated: - ee1_dist = self.eev1 > self.ee1_offseter.filtered_stat.M * self.settings._EE_THRESH12 + if pitch_error > self.settings._POSE_PITCH_THRESHOLD*pose.cfactor_pitch or \ + yaw_error > self.settings._POSE_YAW_THRESHOLD*pose.cfactor_yaw: + return DistractedType.BAD_POSE + elif (blink.left_blink + blink.right_blink)*0.5 > self.settings._BLINK_THRESHOLD*blink.cfactor: + return DistractedType.BAD_BLINK else: - ee1_dist = self.eev1 > self.settings._EE_THRESH11 - if self.ee2_calibrated: - ee2_dist = self.eev2 < self.ee2_offseter.filtered_stat.M * self.settings._EE_THRESH22 - else: - ee2_dist = self.eev2 < self.settings._EE_THRESH21 - if ee1_dist or ee2_dist: - distracted_types.append(DistractedType.DISTRACTED_E2E) - - return distracted_types + return DistractedType.NOT_DISTRACTED def set_policy(self, model_data, car_speed): ep = min(model_data.meta.engagedProb, 0.8) / 0.8 # engaged prob @@ -229,16 +197,15 @@ class DriverStatus(): k1 = max(-0.00156*((car_speed-16)**2)+0.6, 0.2) bp_normal = max(min(bp / k1, 0.5),0) self.pose.cfactor_pitch = interp(bp_normal, [0, 0.5], - [self.settings._POSE_PITCH_THRESHOLD_SLACK, - self.settings._POSE_PITCH_THRESHOLD_STRICT]) / self.settings._POSE_PITCH_THRESHOLD + [self.settings._POSE_PITCH_THRESHOLD_SLACK, + self.settings._POSE_PITCH_THRESHOLD_STRICT]) / self.settings._POSE_PITCH_THRESHOLD self.pose.cfactor_yaw = interp(bp_normal, [0, 0.5], - [self.settings._POSE_YAW_THRESHOLD_SLACK, - self.settings._POSE_YAW_THRESHOLD_STRICT]) / self.settings._POSE_YAW_THRESHOLD + [self.settings._POSE_YAW_THRESHOLD_SLACK, + self.settings._POSE_YAW_THRESHOLD_STRICT]) / self.settings._POSE_YAW_THRESHOLD - def update_states(self, driver_state, cal_rpy, car_speed, op_engaged): + def get_pose(self, driver_state, cal_rpy, car_speed, op_engaged): if not all(len(x) > 0 for x in (driver_state.faceOrientation, driver_state.facePosition, - driver_state.faceOrientationStd, driver_state.facePositionStd, - driver_state.readyProb, driver_state.notReadyProb)): + driver_state.faceOrientationStd, driver_state.facePositionStd)): return self.face_partial = driver_state.partialFace > self.settings._PARTIAL_FACE_THRESHOLD @@ -251,12 +218,8 @@ class DriverStatus(): self.pose.low_std = model_std_max < self.settings._POSESTD_THRESHOLD and not self.face_partial self.blink.left_blink = driver_state.leftBlinkProb * (driver_state.leftEyeProb > self.settings._EYE_THRESHOLD) * (driver_state.sunglassesProb < self.settings._SG_THRESHOLD) self.blink.right_blink = driver_state.rightBlinkProb * (driver_state.rightEyeProb > self.settings._EYE_THRESHOLD) * (driver_state.sunglassesProb < self.settings._SG_THRESHOLD) - self.eev1 = driver_state.notReadyProb[1] - self.eev2 = driver_state.readyProb[0] - self.distracted_types = self._get_distracted_types() - self.driver_distracted = (DistractedType.DISTRACTED_POSE in self.distracted_types or - DistractedType.DISTRACTED_BLINK in self.distracted_types) and \ + self.driver_distracted = self._is_driver_distracted(self.pose, self.blink) > 0 and \ driver_state.faceProb > self.settings._FACE_THRESHOLD and self.pose.low_std self.driver_distraction_filter.update(self.driver_distracted) @@ -265,13 +228,9 @@ class DriverStatus(): if self.face_detected and car_speed > self.settings._POSE_CALIB_MIN_SPEED and self.pose.low_std and (not op_engaged or not self.driver_distracted): self.pose.pitch_offseter.push_and_update(self.pose.pitch) self.pose.yaw_offseter.push_and_update(self.pose.yaw) - self.ee1_offseter.push_and_update(self.eev1) - self.ee2_offseter.push_and_update(self.eev2) self.pose_calibrated = self.pose.pitch_offseter.filtered_stat.n > self.settings._POSE_OFFSET_MIN_COUNT and \ - self.pose.yaw_offseter.filtered_stat.n > self.settings._POSE_OFFSET_MIN_COUNT - self.ee1_calibrated = self.ee1_offseter.filtered_stat.n > self.settings._POSE_OFFSET_MIN_COUNT - self.ee2_calibrated = self.ee2_offseter.filtered_stat.n > self.settings._POSE_OFFSET_MIN_COUNT + self.pose.yaw_offseter.filtered_stat.n > self.settings._POSE_OFFSET_MIN_COUNT self.is_model_uncertain = self.hi_stds > self.settings._HI_STD_FALLBACK_TIME self._set_timers(self.face_detected and not self.is_model_uncertain) @@ -280,18 +239,18 @@ class DriverStatus(): elif self.face_detected and self.pose.low_std: self.hi_stds = 0 - def update_events(self, events, driver_engaged, ctrl_active, standstill): - if (driver_engaged and self.awareness > 0 and not self.active_monitoring_mode) or not ctrl_active: # reset only when on disengagement if red reached - self._reset_awareness() + def update(self, events, driver_engaged, ctrl_active, standstill): + if (driver_engaged and self.awareness > 0) or not ctrl_active: + # reset only when on disengagement if red reached + self.awareness = 1. + self.awareness_active = 1. + self.awareness_passive = 1. return driver_attentive = self.driver_distraction_filter.x < 0.37 awareness_prev = self.awareness if (driver_attentive and self.face_detected and self.pose.low_std and self.awareness > 0): - if driver_engaged: - self._reset_awareness() - return # only restore awareness when paying attention and alert is not red self.awareness = min(self.awareness + ((self.settings._RECOVERY_FACTOR_MAX-self.settings._RECOVERY_FACTOR_MIN)*(1.-self.awareness)+self.settings._RECOVERY_FACTOR_MIN)*self.step_change, 1.) if self.awareness == 1.: diff --git a/selfdrive/navd/navd.py b/selfdrive/navd/navd.py index a05957286..cb6667af2 100755 --- a/selfdrive/navd/navd.py +++ b/selfdrive/navd/navd.py @@ -1,4 +1,5 @@ #!/usr/bin/env python3 +import json import math import os import threading @@ -21,6 +22,7 @@ from system.swaglog import cloudlog REROUTE_DISTANCE = 25 MANEUVER_TRANSITION_THRESHOLD = 10 VALID_POS_STD = 50.0 +REROUTE_COUNTER_MIN = 3 class RouteEngine: @@ -47,6 +49,8 @@ class RouteEngine: self.ui_pid = None + self.reroute_counter = 0 + if self.params.get_bool("dp_otisserv"): self.mapbox_token = self.params.get("dp_nav_mapbox_token_pk", encoding='utf8') self.mapbox_host = "https://api.mapbox.com" @@ -116,6 +120,7 @@ class RouteEngine: self.recompute_countdown = 2**self.recompute_backoff self.recompute_backoff = min(6, self.recompute_backoff + 1) self.calculate_route(new_destination) + self.reroute_counter = 0 else: self.recompute_countdown = max(0, self.recompute_countdown - 1) @@ -138,12 +143,27 @@ class RouteEngine: 'language': lang, } - if self.last_bearing is not None: - params['bearings'] = f"{(self.last_bearing + 360) % 360:.0f},90;" + # TODO: move waypoints into NavDestination param? + waypoints = self.params.get('NavDestinationWaypoints', encoding='utf8') + waypoint_coords = [] + if waypoints is not None and len(waypoints) > 0: + waypoint_coords = json.loads(waypoints) - url = self.mapbox_host + f'/directions/v5/mapbox/driving-traffic/{self.last_position.longitude},{self.last_position.latitude};{destination.longitude},{destination.latitude}' + coords = [ + (self.last_position.longitude, self.last_position.latitude), + *waypoint_coords, + (destination.longitude, destination.latitude) + ] + params['waypoints'] = f'0;{len(coords)-1}' + if self.last_bearing is not None: + params['bearings'] = f"{(self.last_bearing + 360) % 360:.0f},90" + (';'*(len(coords)-1)) + + coords_str = ';'.join([f'{lon},{lat}' for lon, lat in coords]) + url = self.mapbox_host + '/directions/v5/mapbox/driving-traffic/' + coords_str try: resp = requests.get(url, params=params, timeout=10) + if resp.status_code != 200: + cloudlog.event("API request failed", status_code=resp.status_code, text=resp.text, error=True) resp.raise_for_status() r = resp.json() @@ -178,6 +198,10 @@ class RouteEngine: cloudlog.warning("Got empty route response") self.clear_route() + # clear waypoints to avoid a re-route including past waypoints + # TODO: only clear once we're past a waypoint + self.params.remove('NavDestinationWaypoints') + except requests.exceptions.RequestException: cloudlog.exception("failed to get route") self.clear_route() @@ -205,7 +229,11 @@ class RouteEngine: remaining = 1.0 - along_geometry / max(step['distance'], 1) total_distance = step['distance'] * remaining total_time = step['duration'] * remaining - total_time_typical = step['duration_typical'] * remaining + + if step['duration_typical'] is None: + total_time_typical = total_time + else: + total_time_typical = step['duration_typical'] * remaining # Add up totals for future steps for i in range(self.step_idx + 1, len(self.route)): @@ -288,8 +316,11 @@ class RouteEngine: min_d = min(min_d, minimum_distance(a, b, self.last_position)) - return min_d > REROUTE_DISTANCE - + if min_d > REROUTE_DISTANCE: + self.reroute_counter += 1 + else: + self.reroute_counter = 0 + return self.reroute_counter > REROUTE_COUNTER_MIN # TODO: Check for going wrong way in segment diff --git a/selfdrive/proclogd/proclog.h b/selfdrive/proclogd/proclog.h new file mode 100644 index 000000000..9ed53d1ba --- /dev/null +++ b/selfdrive/proclogd/proclog.h @@ -0,0 +1,40 @@ +#include +#include +#include +#include + +#include "cereal/messaging/messaging.h" + +struct CPUTime { + int id; + unsigned long utime, ntime, stime, itime; + unsigned long iowtime, irqtime, sirqtime; +}; + +struct ProcCache { + int pid; + std::string name, exe; + std::vector cmdline; +}; + +struct ProcStat { + int pid, ppid, processor; + char state; + long cutime, cstime, priority, nice, num_threads; + unsigned long utime, stime, vms, rss; + unsigned long long starttime; + std::string name; +}; + +namespace Parser { + +std::vector pids(); +std::optional procStat(std::string stat); +std::vector cmdline(std::istream &stream); +std::vector cpuTimes(std::istream &stream); +std::unordered_map memInfo(std::istream &stream); +const ProcCache &getProcExtraInfo(int pid, const std::string &name); + +}; // namespace Parser + +void buildProcLogMessage(MessageBuilder &msg); diff --git a/selfdrive/proclogd/proclogd b/selfdrive/proclogd/proclogd new file mode 100755 index 000000000..a6777a117 Binary files /dev/null and b/selfdrive/proclogd/proclogd differ diff --git a/selfdrive/sensord/_sensord b/selfdrive/sensord/_sensord deleted file mode 100755 index b485c5ebf..000000000 Binary files a/selfdrive/sensord/_sensord and /dev/null differ diff --git a/selfdrive/sensord/libdiag.h b/selfdrive/sensord/libdiag.h deleted file mode 100644 index 03a59464e..000000000 --- a/selfdrive/sensord/libdiag.h +++ /dev/null @@ -1,37 +0,0 @@ -#pragma once - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define DIAG_MAX_RX_PKT_SIZ 4096 - -bool Diag_LSM_Init(uint8_t* pIEnv); -bool Diag_LSM_DeInit(void); - -// DCI - -#define DIAG_CON_APSS 0x001 -#define DIAG_CON_MPSS 0x002 -#define DIAG_CON_LPASS 0x004 -#define DIAG_CON_WCNSS 0x008 - -enum { - DIAG_DCI_NO_ERROR = 1001, -} diag_dci_error_type; - -int diag_register_dci_client(int*, uint16_t*, int, void*); -int diag_log_stream_config(int client_id, int set_mask, uint16_t log_codes_array[], int num_codes); -int diag_register_dci_stream(void (*func_ptr_logs)(unsigned char *ptr, int len), void (*func_ptr_events)(unsigned char *ptr, int len)); -int diag_release_dci_client(int*); - -int diag_send_dci_async_req(int client_id, unsigned char buf[], int bytes, unsigned char *rsp_ptr, int rsp_len, - void (*func_ptr)(unsigned char *ptr, int len, void *data_ptr), void *data_ptr); - - -#ifdef __cplusplus -} -#endif diff --git a/selfdrive/sentry.py b/selfdrive/sentry.py index d2f4aa0eb..3c90af6ba 100644 --- a/selfdrive/sentry.py +++ b/selfdrive/sentry.py @@ -43,6 +43,15 @@ except Exception: ip = "255.255.255.255" error_tags = {'dirty': is_dirty(), 'dongle_id': dongle_id, 'branch': get_branch(), 'remote': get_origin(), 'fingerprintedAs': candidate, 'gitname':gitname} +try: + cached_params = params.get("CarParams") + if cached_params is not None: + cached_params = car.CarParams.from_bytes(cached_params) + car_name = cached_params.carFingerprint + else: + car_name = "None" +except Exception: + car_name = "None" def report_tombstone(fn: str, message: str, contents: str) -> None: cloudlog.error({'tombstone': message}) @@ -118,6 +127,7 @@ def init(project: SentryProject) -> None: sentry_sdk.set_tag("branch", get_branch()) sentry_sdk.set_tag("commit", get_commit()) sentry_sdk.set_tag("device", HARDWARE.get_device_type()) + sentry_sdk.set_tag("model", car_name) if project == SentryProject.SELFDRIVE: sentry_sdk.Hub.current.start_session() diff --git a/selfdrive/statsd.py b/selfdrive/statsd.py index 7dc002727..e64907149 100755 --- a/selfdrive/statsd.py +++ b/selfdrive/statsd.py @@ -13,7 +13,7 @@ from system.swaglog import cloudlog from system.hardware import HARDWARE from common.file_helpers import atomic_write_in_dir from system.version import get_normalized_origin, get_short_branch, get_short_version, is_dirty -from selfdrive.loggerd.config import STATS_DIR, STATS_DIR_FILE_LIMIT, STATS_SOCKET, STATS_FLUSH_TIME_S +from system.loggerd.config import STATS_DIR, STATS_DIR_FILE_LIMIT, STATS_SOCKET, STATS_FLUSH_TIME_S class METRIC_TYPE: diff --git a/selfdrive/thermald/fan_controller.py b/selfdrive/thermald/fan_controller.py index 93ec84de8..799ae47d8 100644 --- a/selfdrive/thermald/fan_controller.py +++ b/selfdrive/thermald/fan_controller.py @@ -105,9 +105,9 @@ class UnoFanController(BaseFanController): cloudlog.info("Setting up UNO fan handler") def update(self, max_cpu_temp: float, ignition: bool) -> int: - new_speed = int(interp(max_cpu_temp, [40.0, 80.0], [0, 80])) + new_speed = int(interp(max_cpu_temp, [40.0, 60.0, 70.0, 80.0], [0, 20, 50, 80])) if not ignition: - new_speed = min(30, new_speed) + new_speed = min(15, new_speed) return new_speed diff --git a/selfdrive/thermald/power_monitoring.py b/selfdrive/thermald/power_monitoring.py index 8a69415dd..f710296f8 100644 --- a/selfdrive/thermald/power_monitoring.py +++ b/selfdrive/thermald/power_monitoring.py @@ -36,6 +36,8 @@ class PowerMonitoring: self.car_voltage_instant_mV = 12e3 # Last value of peripheralState voltage self.integration_lock = threading.Lock() self.is_oneplus = os.path.isfile('/ONEPLUS') + self.dp_auto_shutdown = self.params.get_bool("dp_auto_shutdown") + self.dp_auto_shutdown_in = int(self.params.get("dp_auto_shutdown_in", encoding='utf8')) * 60 car_battery_capacity_uWh = self.params.get("CarBatteryCapacity") if car_battery_capacity_uWh is None: @@ -157,11 +159,16 @@ class PowerMonitoring: return int(self.car_battery_capacity_uWh) # See if we need to disable charging - def should_disable_charging(self, ignition: bool, in_car: bool, offroad_timestamp: Optional[float]) -> bool: + def should_disable_charging(self, ignition: bool, in_car: bool, offroad_timestamp: Optional[float], started_seen: bool) -> bool: if offroad_timestamp is None: return False now = sec_since_boot() + + if started_seen and self.dp_auto_shutdown and (now - offroad_timestamp) > self.dp_auto_shutdown_in: + self.params.put_bool("DoShutdown", True) + return True + disable_charging = False disable_charging |= (now - offroad_timestamp) > MAX_TIME_OFFROAD_S disable_charging |= (self.car_voltage_mV < (VBATT_PAUSE_CHARGING * 1e3)) and (self.car_voltage_instant_mV > (VBATT_INSTANT_PAUSE_CHARGING * 1e3)) diff --git a/selfdrive/thermald/thermald.py b/selfdrive/thermald/thermald.py index 3d1ee7382..0c22d972b 100755 --- a/selfdrive/thermald/thermald.py +++ b/selfdrive/thermald/thermald.py @@ -18,7 +18,7 @@ from common.params import Params from common.realtime import DT_TRML, sec_since_boot from selfdrive.controls.lib.alertmanager import set_offroad_alert from system.hardware import HARDWARE, TICI, AGNOS, EON -from selfdrive.loggerd.config import get_available_percent +from system.loggerd.config import get_available_percent # from selfdrive.statsd import statlog from system.swaglog import cloudlog from selfdrive.thermald.power_monitoring import PowerMonitoring @@ -192,9 +192,6 @@ def thermald_thread(end_event, hw_queue): fan_controller = None - dp_auto_shutdown = params.get_bool("dp_auto_shutdown") - dp_auto_shutdown_in = int(params.get("dp_auto_shutdown_in", encoding='utf8')) * 60 - while not end_event.is_set(): sm.update(PANDA_STATES_TIMEOUT) @@ -361,7 +358,7 @@ def thermald_thread(end_event, hw_queue): # Offroad power monitoring voltage = None if peripheralState is None or peripheralState.pandaType == log.PandaState.PandaType.unknown else peripheralState.voltage power_monitor.calculate(voltage, onroad_conditions["ignition"]) - msg.deviceState.offroadPowerUsageUwh = power_monitor.get_power_used() + msg.deviceState.offroadPowerUsageUwh = max(0, power_monitor.get_power_used()) msg.deviceState.carBatteryCapacityUwh = max(0, power_monitor.get_car_battery_capacity()) current_power_draw = HARDWARE.get_current_power_draw() # statlog.sample("power_draw", current_power_draw) @@ -372,13 +369,9 @@ def thermald_thread(end_event, hw_queue): msg.deviceState.somPowerDrawW = som_power_draw # Check if we need to disable charging (handled by boardd) - msg.deviceState.chargingDisabled = power_monitor.should_disable_charging(onroad_conditions["ignition"], in_car, off_ts) - - # Check if we need to auto shut down - # we only enable it when it's been on-road once. - if started_seen and dp_auto_shutdown and off_ts is not None and (sec_since_boot() - off_ts > dp_auto_shutdown_in): - params.put_bool("DoShutdown", True) + msg.deviceState.chargingDisabled = power_monitor.should_disable_charging(onroad_conditions["ignition"], in_car, off_ts, started_seen) + # Check if we need to shut down if power_monitor.should_shutdown(peripheralState, onroad_conditions["ignition"], in_car, off_ts, started_seen): cloudlog.warning(f"shutting device down, offroad since {off_ts}") params.put_bool("DoShutdown", True) @@ -414,7 +407,7 @@ def thermald_thread(end_event, hw_queue): # statlog.gauge(f"nvme_temperature{i}", temp) # for i, temp in enumerate(last_hw_state.modem_temps): # statlog.gauge(f"modem_temperature{i}", temp) - # statlog.gauge("fan_speed_percent_desired", msg.deviceState.fanSpeedPercentDesired) + # statlog.gauge("fan_speed_percent_desired", msg.deviceState.fanSpeeZercentDesired) # statlog.gauge("screen_brightness_percent", msg.deviceState.screenBrightnessPercent) # report to server once every 10 minutes diff --git a/selfdrive/tombstoned.py b/selfdrive/tombstoned.py index 61a575f14..65fb45b67 100755 --- a/selfdrive/tombstoned.py +++ b/selfdrive/tombstoned.py @@ -10,7 +10,7 @@ import glob from typing import NoReturn from common.file_helpers import mkdirs_exists_ok -from selfdrive.loggerd.config import ROOT +from system.loggerd.config import ROOT import selfdrive.sentry as sentry from system.swaglog import cloudlog from system.version import get_commit diff --git a/selfdrive/ui/_ui b/selfdrive/ui/_ui index 39f22e4c9..df58a12b5 100755 Binary files a/selfdrive/ui/_ui and b/selfdrive/ui/_ui differ diff --git a/selfdrive/ui/_ui_nonav b/selfdrive/ui/_ui_nonav index bb81ff205..3f0625e31 100755 Binary files a/selfdrive/ui/_ui_nonav and b/selfdrive/ui/_ui_nonav differ diff --git a/selfdrive/ui/qt/libpython_helpers.so b/selfdrive/ui/qt/libpython_helpers.so index b26754744..2640226eb 100755 Binary files a/selfdrive/ui/qt/libpython_helpers.so and b/selfdrive/ui/qt/libpython_helpers.so differ diff --git a/selfdrive/ui/qt/spinner b/selfdrive/ui/qt/spinner index 1b943ac25..fbe77262a 100755 Binary files a/selfdrive/ui/qt/spinner and b/selfdrive/ui/qt/spinner differ diff --git a/selfdrive/ui/qt/text b/selfdrive/ui/qt/text index 2b165c710..65b5a6c01 100755 Binary files a/selfdrive/ui/qt/text and b/selfdrive/ui/qt/text differ diff --git a/selfdrive/ui/soundd/_soundd b/selfdrive/ui/soundd/_soundd index 359ea1b7c..64c3d7529 100755 Binary files a/selfdrive/ui/soundd/_soundd and b/selfdrive/ui/soundd/_soundd differ diff --git a/selfdrive/ui/translations/main_de.qm b/selfdrive/ui/translations/main_de.qm index 54eb23d64..1e1142582 100644 Binary files a/selfdrive/ui/translations/main_de.qm and b/selfdrive/ui/translations/main_de.qm differ diff --git a/selfdrive/ui/translations/main_de.ts b/selfdrive/ui/translations/main_de.ts index 49b6efa9b..22016e50a 100644 --- a/selfdrive/ui/translations/main_de.ts +++ b/selfdrive/ui/translations/main_de.ts @@ -93,10 +93,6 @@ REAL STEER - - RAM PER - - OFF @@ -137,6 +133,10 @@ ACCEL + + Lat Ctrl + + C2NetworkPanel @@ -270,19 +270,6 @@ Reboot Required. Enable this will increase steering, USE IT ONLY if you have a modded EPS firmware. -Reboot required. - - - - Volkswagen - - - - Enable VAG Resume Fix - - - - Enable this if your car does not auto resume (stop and go). Reboot required. @@ -307,13 +294,18 @@ Thanks to @TheCrowd Enable this to bypass dashcam mode. + + Enable Reverse ACC Set speed. + + + + Enabling this will reverse set acc short press +5 jump, Long press +1 Jump. +Reboot Required. + + DPControlPanel - - ALCA Delay - - Once the vehicle meets all ALCA criteria, it will wait for the seconds set here before performing lane change automatically. @@ -322,10 +314,6 @@ Thanks to @TheCrowd secs - - ALCA Min Speed - - ALCA minimum engage speed in mph. 1 mph = 1.61 km/h. @@ -335,10 +323,6 @@ Thanks to @TheCrowd mph - - LCA Min Speed - - LCA minimum engage speed in mph. 1 mph = 1.61 km/h. @@ -353,18 +337,10 @@ Thanks to @TheCrowd 2 = Auto Lane Change Assist (ALCA) - - Camera Offset - - Adjust your camera position if your device is not mounted as per guidance. - - Driving Path Offset - - Adjust this if you wish to let openpilot drive slightly towards to left (+) or right (-) @@ -411,26 +387,14 @@ openpilot by default keeps 1.45 secs distance to lead car. When on close will be dynamic but get closer in traffic. Normal is also dynamic and it get further and far is stock 1.45sec - - DE2E Adapt Following Mode - - Enable this if you wish to use following dist. mode in DE2E. - - DE2E Adapt Accel Mode - - Enable this if you wish to use accel mode in DE2E. - - DE2E w/ VOACC - - Enable this if your vehicles is in VOACC (e.g. Honda Bosch / VAG). @@ -510,13 +474,82 @@ Reboot required. Enable Max Ctrl Speed Check + + ALC RoadEdge Detection + + + + Enabling this will prevent lane change when you are too close to road edge. + + + + ALCA Delay + + + + ALCA Min Speed + + + + LCA Min Speed + + + + Camera Offset + + + + Driving Path Offset + + + + DE2E Adapt Following Mode + + + + DE2E Adapt Accel Mode + + + + DE2E w/ VOACC + + + + When Set Speed Above: + + + + when acc SET speed above the setting, it will switch to alternative controller. +1 km/h = 0.62 mph + + + + km/h + + + + Alternative Controller + + + + +1 = PID +2 = LQR +3 = Torque +Your Vehicle may not support all the options, YMMV. + + + + Use Alternative Controller + + + + This feature will let you use alternative lateral controller at higher set speed. + + DPGeneralPanel - - Auto Shutdown In - - Adjust your shutdown waiting period. 0 = shutdown immediately. @@ -582,27 +615,6 @@ Reboot required. Miscellaneous - - Enable Driver Monitor (Front Cam) - - - - Enable this option if you wish to use front camera for driver monitoring. -On = Front Cam Monitor + Steering Monitor -Off = Steering Monitor only. -Enable this will increase device temp a lot, use at your own risk. -Reboot Required. - - - - Reboot recommended. -Reboot? - - - - Reboot - Neustart - Enable Jetson Support @@ -612,6 +624,11 @@ Reboot? Reboot required. + + Reboot recommended. +Reboot? + + Flashing Panda Firmware @@ -678,6 +695,26 @@ Reboot required. Are you sure delete all media? + + Auto Shutdown In + + + + Enable Driver Monitor (Front Cam) + + + + Enable this option if you wish to use front camera for driver monitoring. +On = Front Cam Monitor + Steering Monitor +Off = Steering Monitor only. +Enable this will increase device temp a lot, use at your own risk. +Reboot Required. + + + + Reboot + Neustart + DPMapsPanel @@ -749,14 +786,6 @@ Reboot required. Use curvature info from map data to define speed limits to take turns ahead - - Show debug UI elements - - - - Show UI elements that aid debugging. - - Enable MapD @@ -770,6 +799,38 @@ Please note: 4. Not connecting to the internet for while might feel up device storage from all the gps traces. + + OpenStreetMap Database Update + + + + CHECK + ÜBERPRÜFEN + + + "OpenStreetMap Database Update" +Your device will reboot and perform a database update based on the region you have selected. +Reboot now? + + + + OpenStreetMap Database + + + + SELECT + AUSWÄHLEN + + + Select your location + + + + "OpenStreetMap Database" +Restart your device to start downloading the selected database. Dragonpilot will only start downloading the database on reboot. +Reboot now? + + DPUIPanel @@ -794,14 +855,6 @@ Please note: AUTO - - Alert Volume - - - - Adjust your alert volume. - - Quiet Drive @@ -818,10 +871,6 @@ Please note: Enable this to display your current speed. - - Display Event / Steer Icon - - Enable this to display the icon. @@ -854,6 +903,22 @@ Please note: Display detected lead objects' speed and distance. + + Display Driver Camera + + + + Display Driver Camera when reversing. + + + + Rainbow Path + + + + for all the tesla fanboy's. + + Volume @@ -1082,18 +1147,6 @@ Please note: Installing... Installiere... - - Receiving objects: - Empfange Objekte: - - - Resolving deltas: - Unterschiede verarbeiten: - - - Updating files: - Dateien aktualisieren: - MapETA @@ -1358,18 +1411,10 @@ location set Are you sure you want to reset your device? Bist du sicher, dass du das Gerät auf Werkseinstellungen zurücksetzen möchtest? - - Resetting device... - Gerät wird zurückgesetzt... - System Reset System auf Werkseinstellungen zurücksetzen - - System reset triggered. Press confirm to erase all content and settings. Press cancel to resume boot. - Zurücksetzen auf Werkseinstellungen wurde ausgewählt. Drücke Annehmen, um alle Inhalte und Einstellungen zu löschen. Drücke Abbrechen, um mit dem Starten des Gerätes fortzufahren. - Cancel Abbrechen @@ -1383,8 +1428,17 @@ location set Bestätigen - Unable to mount data partition. Press confirm to reset your device. - Datenpartition kann nicht geöffnet werden. Drücke Annehmen, um dein Gerät auf Werkseinstellungen zurückzusetzen. + Unable to mount data partition. Partition may be corrupted. Press confirm to erase and reset your device. + + + + Press confirm to erase all content and settings. Press cancel to resume boot. + + + + Resetting device... +This may take up to a minute. + @@ -1480,18 +1534,6 @@ location set Waiting for internet Auf Internet warten - - Choose Software to Install - Software zum installieren auswählen - - - Dashcam - Dashcam - - - Custom Software - Spezifische Software - Enter URL URL eingeben @@ -1520,6 +1562,14 @@ location set Start over Von neuem beginnen + + No custom software found at this URL. + + + + Something went wrong. Reboot the device. + + SetupWidget @@ -1669,7 +1719,7 @@ location set SELECT - AUSWÄHLEN + AUSWÄHLEN Select a branch @@ -1679,30 +1729,6 @@ location set Uninstall Deinstallieren - - OpenStreetMap Database Update - - - - "OpenStreetMap Database Update" -Your device will reboot and perform a database update based on the region you have selected. -Reboot now? - - - - OpenStreetMap Database - - - - Select your location - - - - "OpenStreetMap Database" -Restart your device to start downloading the selected database. Dragonpilot will only start downloading the database on reboot. -Reboot now? - - SshControl @@ -1866,11 +1892,19 @@ Reboot now? Die Fahrvisualisierung wechselt bei niedrigen Geschwindigkeiten zur Straßengewandten Weitwinkelkamera, um manche Kurven besser zu zeigen. Außerdem wird das Experimenteller Modus logo oben rechts angezeigt. - Experimental mode is currently unavailable on this car, since the car's stock ACC is used for longitudinal control. - Der experimentelle Modus ist momentan für dieses Auto nicht verfügbar, da es den eingebauten adaptiven Tempomaten des Autos benutzt. + Experimental mode is currently unavailable on this car since the car's stock ACC is used for longitudinal control. + Der experimentelle Modus ist momentan für dieses Auto nicht verfügbar da es den eingebauten adaptiven Tempomaten des Autos benutzt. - Enable experimental longitudinal control to allow experimental mode. + openpilot longitudinal control may come in a future update. + + + + An experimental version of openpilot longitudinal control can be tested, along with Experimental mode, on non-release branches. + + + + Enable experimental longitudinal control to allow Experimental mode. Aktiviere den experimentellen Openpilot Tempomaten für experimentelle Funktionen. diff --git a/selfdrive/ui/translations/main_ja.qm b/selfdrive/ui/translations/main_ja.qm index c61509b1b..335f17860 100644 Binary files a/selfdrive/ui/translations/main_ja.qm and b/selfdrive/ui/translations/main_ja.qm differ diff --git a/selfdrive/ui/translations/main_ja.ts b/selfdrive/ui/translations/main_ja.ts index 06bae7b2e..3b273b371 100644 --- a/selfdrive/ui/translations/main_ja.ts +++ b/selfdrive/ui/translations/main_ja.ts @@ -93,10 +93,6 @@ REAL STEER - - RAM PER - - OFF @@ -137,6 +133,10 @@ ACCEL + + Lat Ctrl + + C2NetworkPanel @@ -270,19 +270,6 @@ Reboot Required. Enable this will increase steering, USE IT ONLY if you have a modded EPS firmware. -Reboot required. - - - - Volkswagen - - - - Enable VAG Resume Fix - - - - Enable this if your car does not auto resume (stop and go). Reboot required. @@ -307,13 +294,18 @@ Thanks to @TheCrowd Enable this to bypass dashcam mode. + + Enable Reverse ACC Set speed. + + + + Enabling this will reverse set acc short press +5 jump, Long press +1 Jump. +Reboot Required. + + DPControlPanel - - ALCA Delay - - Once the vehicle meets all ALCA criteria, it will wait for the seconds set here before performing lane change automatically. @@ -322,10 +314,6 @@ Thanks to @TheCrowd secs - - ALCA Min Speed - - ALCA minimum engage speed in mph. 1 mph = 1.61 km/h. @@ -335,10 +323,6 @@ Thanks to @TheCrowd mph - - LCA Min Speed - - LCA minimum engage speed in mph. 1 mph = 1.61 km/h. @@ -353,18 +337,10 @@ Thanks to @TheCrowd 2 = Auto Lane Change Assist (ALCA) - - Camera Offset - - Adjust your camera position if your device is not mounted as per guidance. - - Driving Path Offset - - Adjust this if you wish to let openpilot drive slightly towards to left (+) or right (-) @@ -486,37 +462,94 @@ More linear steering experience. Reboot required. - - DE2E Adapt Following Mode - - Enable this if you wish to use following dist. mode in DE2E. - - DE2E Adapt Accel Mode - - Enable this if you wish to use accel mode in DE2E. + + Enable this if your vehicles is in VOACC (e.g. Honda Bosch / VAG). + + + + ALC RoadEdge Detection + + + + Enabling this will prevent lane change when you are too close to road edge. + + + + ALCA Delay + + + + ALCA Min Speed + + + + LCA Min Speed + + + + Camera Offset + + + + Driving Path Offset + + + + DE2E Adapt Following Mode + + + + DE2E Adapt Accel Mode + + DE2E w/ VOACC - Enable this if your vehicles is in VOACC (e.g. Honda Bosch / VAG). + When Set Speed Above: + + + + when acc SET speed above the setting, it will switch to alternative controller. +1 km/h = 0.62 mph + + + + km/h + + + + Alternative Controller + + + + +1 = PID +2 = LQR +3 = Torque +Your Vehicle may not support all the options, YMMV. + + + + Use Alternative Controller + + + + This feature will let you use alternative lateral controller at higher set speed. DPGeneralPanel - - Auto Shutdown In - - Adjust your shutdown waiting period. 0 = shutdown immediately. @@ -662,6 +695,10 @@ Reboot required. Are you sure delete all media? + + Auto Shutdown In + + Enable Driver Monitor (Front Cam) @@ -749,14 +786,6 @@ Reboot required. Use curvature info from map data to define speed limits to take turns ahead - - Show debug UI elements - - - - Show UI elements that aid debugging. - - Enable MapD @@ -770,6 +799,38 @@ Please note: 4. Not connecting to the internet for while might feel up device storage from all the gps traces. + + OpenStreetMap Database Update + + + + CHECK + 確認 + + + "OpenStreetMap Database Update" +Your device will reboot and perform a database update based on the region you have selected. +Reboot now? + + + + OpenStreetMap Database + + + + SELECT + 選択 + + + Select your location + + + + "OpenStreetMap Database" +Restart your device to start downloading the selected database. Dragonpilot will only start downloading the database on reboot. +Reboot now? + + DPUIPanel @@ -794,14 +855,6 @@ Please note: AUTO - - Alert Volume - - - - Adjust your alert volume. - - Quiet Drive @@ -818,10 +871,6 @@ Please note: Enable this to display your current speed. - - Display Event / Steer Icon - - Enable this to display the icon. @@ -854,6 +903,22 @@ Please note: Display detected lead objects' speed and distance. + + Display Driver Camera + + + + Display Driver Camera when reversing. + + + + Rainbow Path + + + + for all the tesla fanboy's. + + Volume @@ -1081,18 +1146,6 @@ Please note: Installing... インストールしています... - - Receiving objects: - オブジェクトをダウンロードしています: - - - Resolving deltas: - デルタを解決しています: - - - Updating files: - ファイルを更新しています: - MapETA @@ -1356,18 +1409,10 @@ location set Are you sure you want to reset your device? 初期化してもよろしいですか? - - Resetting device... - デバイスが初期化されます... - System Reset システムを初期化 - - System reset triggered. Press confirm to erase all content and settings. Press cancel to resume boot. - システムの初期化をリクエストしました。「確認」ボタンを押すとデバイスが初期化されます。「キャンセル」ボタンを押すと起動を続行します。 - Cancel キャンセル @@ -1381,8 +1426,17 @@ location set 確認 - Unable to mount data partition. Press confirm to reset your device. - 「data」パーティションをマウントできません。「確認」ボタンを押すとデバイスが初期化されます。 + Unable to mount data partition. Partition may be corrupted. Press confirm to erase and reset your device. + + + + Press confirm to erase all content and settings. Press cancel to resume boot. + + + + Resetting device... +This may take up to a minute. + @@ -1478,18 +1532,6 @@ location set Waiting for internet インターネット接続を待機中 - - Choose Software to Install - インストールするソフトウェアを選択してください - - - Dashcam - ドライブレコーダー - - - Custom Software - カスタムソフトウェア - Enter URL URL を入力 @@ -1518,6 +1560,14 @@ location set Start over 最初からやり直す + + No custom software found at this URL. + + + + Something went wrong. Reboot the device. + + SetupWidget @@ -1649,7 +1699,7 @@ location set SELECT - 選択 + 選択 Select a branch @@ -1675,30 +1725,6 @@ location set Uninstall アンインストール - - OpenStreetMap Database Update - - - - "OpenStreetMap Database Update" -Your device will reboot and perform a database update based on the region you have selected. -Reboot now? - - - - OpenStreetMap Database - - - - Select your location - - - - "OpenStreetMap Database" -Restart your device to start downloading the selected database. Dragonpilot will only start downloading the database on reboot. -Reboot now? - - SshControl @@ -1839,14 +1865,6 @@ Reboot now? On this car, openpilot defaults to the car's built-in ACC instead of openpilot's longitudinal control. Enable this to switch to openpilot longitudinal control. Enabling Experimental mode is recommended when using experimental openpilot longitudinal control. openpilotはこの車の場合、車に内蔵されているACCを標準で利用します。この機能を有効にすることで実験段階のopenpilotによるアクセル制御を利用できます。実験モードと合わせて利用することをお勧めします。 - - Experimental mode is currently unavailable on this car, since the car's stock ACC is used for longitudinal control. - この車のACCがアクセル制御を行うため、実験モードを利用することができません。 - - - Enable experimental longitudinal control to allow experimental mode. - 実験段階のopenpilotによるアクセル制御を有効にしてください。 - openpilot defaults to driving in <b>chill mode</b>. Experimental mode enables <b>alpha-level features</b> that aren't ready for chill mode. Experimental features are listed below: openpilotは標準ではゆっくりとくつろげる運転を提供します。この実験モードを有効にすると、以下のくつろげる段階ではない開発中の機能を利用する事ができます。 @@ -1867,6 +1885,22 @@ Reboot now? The driving visualization will transition to the road-facing wide-angle camera at low speeds to better show some turns. The Experimental mode logo will also be shown in the top right corner. 新しい運転画面では、低速時に広角カメラの映像を表示することで、曲がる際の道路の視覚を向上します。実験段階を表すマークが右上に表示されます。 + + Experimental mode is currently unavailable on this car since the car's stock ACC is used for longitudinal control. + この車のACCがアクセル制御を行うため実験モードを利用することができません。 + + + openpilot longitudinal control may come in a future update. + + + + An experimental version of openpilot longitudinal control can be tested, along with Experimental mode, on non-release branches. + + + + Enable experimental longitudinal control to allow Experimental mode. + 実験段階のopenpilotによるアクセル制御を有効にしてください。 + Enable Right-Hand Drive diff --git a/selfdrive/ui/translations/main_ko.qm b/selfdrive/ui/translations/main_ko.qm index 2f40d3686..7c9e885a6 100644 Binary files a/selfdrive/ui/translations/main_ko.qm and b/selfdrive/ui/translations/main_ko.qm differ diff --git a/selfdrive/ui/translations/main_ko.ts b/selfdrive/ui/translations/main_ko.ts index 2216056fa..c1c19485c 100644 --- a/selfdrive/ui/translations/main_ko.ts +++ b/selfdrive/ui/translations/main_ko.ts @@ -93,10 +93,6 @@ REAL STEER - - RAM PER - - OFF @@ -137,6 +133,10 @@ ACCEL + + Lat Ctrl + + C2NetworkPanel @@ -270,19 +270,6 @@ Reboot Required. Enable this will increase steering, USE IT ONLY if you have a modded EPS firmware. -Reboot required. - - - - Volkswagen - - - - Enable VAG Resume Fix - - - - Enable this if your car does not auto resume (stop and go). Reboot required. @@ -307,13 +294,18 @@ Thanks to @TheCrowd Enable this to bypass dashcam mode. + + Enable Reverse ACC Set speed. + + + + Enabling this will reverse set acc short press +5 jump, Long press +1 Jump. +Reboot Required. + + DPControlPanel - - ALCA Delay - - Once the vehicle meets all ALCA criteria, it will wait for the seconds set here before performing lane change automatically. @@ -322,10 +314,6 @@ Thanks to @TheCrowd secs - - ALCA Min Speed - - ALCA minimum engage speed in mph. 1 mph = 1.61 km/h. @@ -335,10 +323,6 @@ Thanks to @TheCrowd mph - - LCA Min Speed - - LCA minimum engage speed in mph. 1 mph = 1.61 km/h. @@ -353,18 +337,10 @@ Thanks to @TheCrowd 2 = Auto Lane Change Assist (ALCA) - - Camera Offset - - Adjust your camera position if your device is not mounted as per guidance. - - Driving Path Offset - - Adjust this if you wish to let openpilot drive slightly towards to left (+) or right (-) @@ -486,37 +462,94 @@ More linear steering experience. Reboot required. - - DE2E Adapt Following Mode - - Enable this if you wish to use following dist. mode in DE2E. - - DE2E Adapt Accel Mode - - Enable this if you wish to use accel mode in DE2E. + + Enable this if your vehicles is in VOACC (e.g. Honda Bosch / VAG). + + + + ALC RoadEdge Detection + + + + Enabling this will prevent lane change when you are too close to road edge. + + + + ALCA Delay + + + + ALCA Min Speed + + + + LCA Min Speed + + + + Camera Offset + + + + Driving Path Offset + + + + DE2E Adapt Following Mode + + + + DE2E Adapt Accel Mode + + DE2E w/ VOACC - Enable this if your vehicles is in VOACC (e.g. Honda Bosch / VAG). + When Set Speed Above: + + + + when acc SET speed above the setting, it will switch to alternative controller. +1 km/h = 0.62 mph + + + + km/h + + + + Alternative Controller + + + + +1 = PID +2 = LQR +3 = Torque +Your Vehicle may not support all the options, YMMV. + + + + Use Alternative Controller + + + + This feature will let you use alternative lateral controller at higher set speed. DPGeneralPanel - - Auto Shutdown In - - Adjust your shutdown waiting period. 0 = shutdown immediately. @@ -662,6 +695,10 @@ Reboot required. Are you sure delete all media? + + Auto Shutdown In + + Enable Driver Monitor (Front Cam) @@ -749,14 +786,6 @@ Reboot required. Use curvature info from map data to define speed limits to take turns ahead - - Show debug UI elements - - - - Show UI elements that aid debugging. - - Enable MapD @@ -770,6 +799,38 @@ Please note: 4. Not connecting to the internet for while might feel up device storage from all the gps traces. + + OpenStreetMap Database Update + + + + CHECK + 확인 + + + "OpenStreetMap Database Update" +Your device will reboot and perform a database update based on the region you have selected. +Reboot now? + + + + OpenStreetMap Database + + + + SELECT + 선택 + + + Select your location + + + + "OpenStreetMap Database" +Restart your device to start downloading the selected database. Dragonpilot will only start downloading the database on reboot. +Reboot now? + + DPUIPanel @@ -794,14 +855,6 @@ Please note: AUTO - - Alert Volume - - - - Adjust your alert volume. - - Quiet Drive @@ -818,10 +871,6 @@ Please note: Enable this to display your current speed. - - Display Event / Steer Icon - - Enable this to display the icon. @@ -854,6 +903,22 @@ Please note: Display detected lead objects' speed and distance. + + Display Driver Camera + + + + Display Driver Camera when reversing. + + + + Rainbow Path + + + + for all the tesla fanboy's. + + Volume @@ -1081,18 +1146,6 @@ Please note: Installing... 설치중... - - Receiving objects: - 수신중: - - - Resolving deltas: - 델타병합: - - - Updating files: - 파일갱신: - MapETA @@ -1185,7 +1238,7 @@ location set Waiting for GPS - GPS를 기다리는 중 + GPS 수신중 입니다 @@ -1271,7 +1324,7 @@ location set Become a comma prime member at connect.comma.ai - connect.comma.ai에서 comma prime에 가입합니다 + connect.comma.ai 접속 comma prime 가입 PRIME FEATURES: @@ -1356,18 +1409,10 @@ location set Are you sure you want to reset your device? 장치를 초기화 하시겠습니까? - - Resetting device... - 장치 초기화중... - System Reset 장치 초기화 - - System reset triggered. Press confirm to erase all content and settings. Press cancel to resume boot. - 장치를 초기화 합니다. 확인버튼을 누르면 모든 내용과 설정이 초기화됩니다. 부팅을 재개하려면 취소를 누르세요. - Cancel 취소 @@ -1381,8 +1426,18 @@ location set 확인 - Unable to mount data partition. Press confirm to reset your device. - 데이터 파티션을 마운트할 수 없습니다. 확인 버튼을 눌러 장치를 리셋합니다. + Unable to mount data partition. Partition may be corrupted. Press confirm to erase and reset your device. + 데이터 파티션을 마운트할 수 없습니다. 파티션이 손상되었을 수 있습니다. 장치를 초기화하려면 확인을 누르세요. + + + Press confirm to erase all content and settings. Press cancel to resume boot. + 모든 콘텐츠와 설정을 지우려면 확인을 누르세요. 부팅을 재개하려면 취소를 누르세요. + + + Resetting device... +This may take up to a minute. + 장치 초기화 중... +최대 1분이 소요될 수 있습니다. @@ -1478,18 +1533,6 @@ location set Waiting for internet 네트워크 접속을 기다립니다 - - Choose Software to Install - 설치할 소프트웨어를 선택하세요 - - - Dashcam - Dashcam - - - Custom Software - Custom Software - Enter URL URL 입력 @@ -1518,6 +1561,14 @@ location set Start over 다시 시작 + + Something went wrong. Reboot the device. + 문제가 발생했습니다. 장치를 재부팅하세요. + + + No custom software found at this URL. + 이 URL에서 커스텀 소프트웨어를 찾을 수 없습니다. + SetupWidget @@ -1649,7 +1700,7 @@ location set SELECT - 선택 + 선택 Select a branch @@ -1675,30 +1726,6 @@ location set Uninstall 제거 - - OpenStreetMap Database Update - - - - "OpenStreetMap Database Update" -Your device will reboot and perform a database update based on the region you have selected. -Reboot now? - - - - OpenStreetMap Database - - - - Select your location - - - - "OpenStreetMap Database" -Restart your device to start downloading the selected database. Dragonpilot will only start downloading the database on reboot. -Reboot now? - - SshControl @@ -1839,17 +1866,9 @@ Reboot now? On this car, openpilot defaults to the car's built-in ACC instead of openpilot's longitudinal control. Enable this to switch to openpilot longitudinal control. Enabling Experimental mode is recommended when using experimental openpilot longitudinal control. 이 차량은 openpilot 롱컨트롤 대신 차량의 내장 ACC로 기본 설정됩니다. openpilot 롱컨트롤을 사용하려면 이 옵션을 활성화하세요. 실험적 openpilot 롱컨트롤을 사용하는 경우 실험적 모드를 활성화 하세요. - - Experimental mode is currently unavailable on this car, since the car's stock ACC is used for longitudinal control. - 차량의 기본 ACC가 롱컨트롤에 사용되기 때문에 현재 이 차량에서는 실험적 모드를 사용할수 없습니다. - - - Enable experimental longitudinal control to allow experimental mode. - 실험적 롱컨트롤을 사용하려면 실험적 모드를 활성화 하세요. - openpilot defaults to driving in <b>chill mode</b>. Experimental mode enables <b>alpha-level features</b> that aren't ready for chill mode. Experimental features are listed below: - openpilot은 기본적으로 <b>안정적 모드</b>로 주행합니다. 실험적 모드는 안정적 모드에 준비되지 않은 <b>알파 수준 기능</b>을 활성화 합니다. 실험 모드의 특징은 아래에 나열되어 있습니다 + openpilot은 기본적으로 <b>안정적 모드</b>로 주행합니다. 실험적 모드는 안정적 모드에 준비되지 않은 <b>알파 수준 기능</b>을 활성화 합니다. 실험적 모드의 특징은 아래에 나열되어 있습니다 🌮 End-to-End Longitudinal Control 🌮 @@ -1865,7 +1884,23 @@ Reboot now? The driving visualization will transition to the road-facing wide-angle camera at low speeds to better show some turns. The Experimental mode logo will also be shown in the top right corner. - 주행 시각화는 저속에서 도로를 향하는 광각 카메라로 전환되어 일부 회전을 더 잘 보여줍니다. 실험적 모드 로고도 우측상단에 표시됩니다. + 주행 시각화는 저속에서 도로를 향하는 광각 카메라로 전환되어 일부 회전을 더 잘 보여줍니다. 실험적 모드의 로고도 우측상단에 표시됩니다. + + + Experimental mode is currently unavailable on this car since the car's stock ACC is used for longitudinal control. + 차량에 장착된 ACC가 롱컨트롤에 사용되기 때문에 현재 이 차량은 실험적 모드를 사용할 수 없습니다. + + + openpilot longitudinal control may come in a future update. + 오픈파일럿 롱컨트롤은 향후 업데이트에서 제공될 수 있습니다. + + + An experimental version of openpilot longitudinal control can be tested, along with Experimental mode, on non-release branches. + 오픈파일럿 롱컨트롤의 실험 버전은 실험적 모드와 함께 릴리즈 되지 않은 브랜치에서 테스트할 수 있습니다. + + + Enable experimental longitudinal control to allow Experimental mode. + 실험적 롱컨트롤을 사용하려면 실험적 모드를 활성화 하세요. Enable Right-Hand Drive diff --git a/selfdrive/ui/translations/main_pt-BR.qm b/selfdrive/ui/translations/main_pt-BR.qm index 6e8f7aa2e..c76f98ebb 100644 Binary files a/selfdrive/ui/translations/main_pt-BR.qm and b/selfdrive/ui/translations/main_pt-BR.qm differ diff --git a/selfdrive/ui/translations/main_pt-BR.ts b/selfdrive/ui/translations/main_pt-BR.ts index 51aad502b..98ce4a136 100644 --- a/selfdrive/ui/translations/main_pt-BR.ts +++ b/selfdrive/ui/translations/main_pt-BR.ts @@ -93,10 +93,6 @@ REAL STEER - - RAM PER - - OFF @@ -137,6 +133,10 @@ ACCEL + + Lat Ctrl + + C2NetworkPanel @@ -270,19 +270,6 @@ Reboot Required. Enable this will increase steering, USE IT ONLY if you have a modded EPS firmware. -Reboot required. - - - - Volkswagen - - - - Enable VAG Resume Fix - - - - Enable this if your car does not auto resume (stop and go). Reboot required. @@ -307,13 +294,18 @@ Thanks to @TheCrowd Enable this to bypass dashcam mode. + + Enable Reverse ACC Set speed. + + + + Enabling this will reverse set acc short press +5 jump, Long press +1 Jump. +Reboot Required. + + DPControlPanel - - ALCA Delay - - Once the vehicle meets all ALCA criteria, it will wait for the seconds set here before performing lane change automatically. @@ -322,10 +314,6 @@ Thanks to @TheCrowd secs - - ALCA Min Speed - - ALCA minimum engage speed in mph. 1 mph = 1.61 km/h. @@ -335,10 +323,6 @@ Thanks to @TheCrowd mph - - LCA Min Speed - - LCA minimum engage speed in mph. 1 mph = 1.61 km/h. @@ -353,18 +337,10 @@ Thanks to @TheCrowd 2 = Auto Lane Change Assist (ALCA) - - Camera Offset - - Adjust your camera position if your device is not mounted as per guidance. - - Driving Path Offset - - Adjust this if you wish to let openpilot drive slightly towards to left (+) or right (-) @@ -486,37 +462,94 @@ More linear steering experience. Reboot required. - - DE2E Adapt Following Mode - - Enable this if you wish to use following dist. mode in DE2E. - - DE2E Adapt Accel Mode - - Enable this if you wish to use accel mode in DE2E. + + Enable this if your vehicles is in VOACC (e.g. Honda Bosch / VAG). + + + + ALC RoadEdge Detection + + + + Enabling this will prevent lane change when you are too close to road edge. + + + + ALCA Delay + + + + ALCA Min Speed + + + + LCA Min Speed + + + + Camera Offset + + + + Driving Path Offset + + + + DE2E Adapt Following Mode + + + + DE2E Adapt Accel Mode + + DE2E w/ VOACC - Enable this if your vehicles is in VOACC (e.g. Honda Bosch / VAG). + When Set Speed Above: + + + + when acc SET speed above the setting, it will switch to alternative controller. +1 km/h = 0.62 mph + + + + km/h + + + + Alternative Controller + + + + +1 = PID +2 = LQR +3 = Torque +Your Vehicle may not support all the options, YMMV. + + + + Use Alternative Controller + + + + This feature will let you use alternative lateral controller at higher set speed. DPGeneralPanel - - Auto Shutdown In - - Adjust your shutdown waiting period. 0 = shutdown immediately. @@ -662,6 +695,10 @@ Reboot required. Are you sure delete all media? + + Auto Shutdown In + + Enable Driver Monitor (Front Cam) @@ -749,14 +786,6 @@ Reboot required. Use curvature info from map data to define speed limits to take turns ahead - - Show debug UI elements - - - - Show UI elements that aid debugging. - - Enable MapD @@ -770,6 +799,38 @@ Please note: 4. Not connecting to the internet for while might feel up device storage from all the gps traces. + + OpenStreetMap Database Update + + + + CHECK + VERIFICAR + + + "OpenStreetMap Database Update" +Your device will reboot and perform a database update based on the region you have selected. +Reboot now? + + + + OpenStreetMap Database + + + + SELECT + SELECIONE + + + Select your location + + + + "OpenStreetMap Database" +Restart your device to start downloading the selected database. Dragonpilot will only start downloading the database on reboot. +Reboot now? + + DPUIPanel @@ -794,14 +855,6 @@ Please note: AUTO - - Alert Volume - - - - Adjust your alert volume. - - Quiet Drive @@ -818,10 +871,6 @@ Please note: Enable this to display your current speed. - - Display Event / Steer Icon - - Enable this to display the icon. @@ -854,6 +903,22 @@ Please note: Display detected lead objects' speed and distance. + + Display Driver Camera + + + + Display Driver Camera when reversing. + + + + Rainbow Path + + + + for all the tesla fanboy's. + + Volume @@ -898,19 +963,19 @@ Please note: Driver Camera - Câmera voltada para o Motorista + Câmera do Motorista PREVIEW - PREVISUAL + VER Preview the driver facing camera to ensure that driver monitoring has good visibility. (vehicle must be off) - Pré-visualizar a câmera voltada para o motorista para garantir que monitor tem uma boa visibilidade (veículo precisa estar desligado) + Pré-visualizar a câmera voltada para o motorista para garantir que o monitoramento do sistema tenha uma boa visibilidade (veículo precisa estar desligado) Reset Calibration - Resetar Calibragem + Reinicializar Calibragem RESET @@ -966,7 +1031,7 @@ Please note: 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. - o openpilot requer que o dispositivo seja montado dentro de 4° esquerda ou direita e dentro de 5° para cima ou 8° para baixo. o openpilot está continuamente calibrando, resetar raramente é necessário. + O openpilot requer que o dispositivo seja montado dentro de 4° esquerda ou direita e dentro de 5° para cima ou 8° para baixo. O openpilot está continuamente calibrando, resetar raramente é necessário. Your device is pointed %1° %2 and %3° %4. @@ -1082,18 +1147,6 @@ Please note: Installing... Instalando... - - Receiving objects: - Recebendo objetos: - - - Resolving deltas: - Resolvendo deltas: - - - Updating files: - Atualizando arquivos: - MapETA @@ -1158,8 +1211,8 @@ Please note: Get turn-by-turn directions displayed and more with a comma prime subscription. Sign up now: https://connect.comma.ai - Obtenha instruções passo a passo exibidas e muito mais com -uma assinatura prime Inscreva-se agora: https://connect.comma.ai + Obtenha instruções passo a passo exibidas e muito mais com +uma assinatura prime. Inscreva-se agora: https://connect.comma.ai No home @@ -1272,7 +1325,7 @@ trabalho definido Become a comma prime member at connect.comma.ai - Torne-se um membro comma prime em connect.comma.ai + Seja um membro comma prime em connect.comma.ai PRIME FEATURES: @@ -1284,11 +1337,11 @@ trabalho definido 1 year of storage - 1 ano de armazenamento + 1 ano na nuvem Developer perks - Benefícios para desenvolvedor + Benefícios para devs @@ -1360,18 +1413,10 @@ trabalho definido Are you sure you want to reset your device? Tem certeza que quer resetar seu dispositivo? - - Resetting device... - Resetando dispositivo... - System Reset Resetar Sistema - - System reset triggered. Press confirm to erase all content and settings. Press cancel to resume boot. - Solicitado reset do sistema. Confirme para apagar todo conteúdo e configurações. Aperte cancelar para continuar boot. - Cancel Cancelar @@ -1385,8 +1430,17 @@ trabalho definido Confirmar - Unable to mount data partition. Press confirm to reset your device. - Não foi possível montar a partição de dados. Pressione confirmar para resetar seu dispositivo. + Unable to mount data partition. Partition may be corrupted. Press confirm to erase and reset your device. + + + + Press confirm to erase all content and settings. Press cancel to resume boot. + + + + Resetting device... +This may take up to a minute. + @@ -1482,18 +1536,6 @@ trabalho definido Waiting for internet Esperando pela internet - - Choose Software to Install - Escolher Software para Instalar - - - Dashcam - Dashcam - - - Custom Software - Sofware Customizado - Enter URL Preencher URL @@ -1522,6 +1564,14 @@ trabalho definido Start over Inicializar + + No custom software found at this URL. + + + + Something went wrong. Reboot the device. + + SetupWidget @@ -1633,7 +1683,7 @@ trabalho definido Current Version - Versao Atual + Versão Atual Download @@ -1653,7 +1703,7 @@ trabalho definido SELECT - SELECIONE + SELECIONE Select a branch @@ -1661,11 +1711,11 @@ trabalho definido UNINSTALL - DESINSTAL + REMOVER Uninstall %1 - Desintalar o %1 + Desinstalar o %1 Are you sure you want to uninstall? @@ -1679,30 +1729,6 @@ trabalho definido Uninstall Desinstalar - - OpenStreetMap Database Update - - - - "OpenStreetMap Database Update" -Your device will reboot and perform a database update based on the region you have selected. -Reboot now? - - - - OpenStreetMap Database - - - - Select your location - - - - "OpenStreetMap Database" -Restart your device to start downloading the selected database. Dragonpilot will only start downloading the database on reboot. -Reboot now? - - SshControl @@ -1809,7 +1835,7 @@ Reboot now? Disengage on Accelerator Pedal - Desacionar Com Pedal Do Acelerador + Desacionar com Pedal do Acelerador When enabled, pressing the accelerator pedal will disengage openpilot. @@ -1817,7 +1843,7 @@ Reboot now? Show ETA in 24h Format - Mostrar ETA em formato 24h + Mostrar ETA em Formato 24h Use 24h format instead of am/pm @@ -1843,14 +1869,6 @@ Reboot now? On this car, openpilot defaults to the car's built-in ACC instead of openpilot's longitudinal control. Enable this to switch to openpilot longitudinal control. Enabling Experimental mode is recommended when using experimental openpilot longitudinal control. Neste carro o penpilot por padrão utiliza o ACC nativo do veículo ao invés de controlar longitudinalmente. Ative isto para mudar para o controle longitudinal do openpilot. Ativar o Modo Experimental é recomendado quando em uso do controle longitudinal experimental do openpilot. - - Experimental mode is currently unavailable on this car, since the car's stock ACC is used for longitudinal control. - O Modo Experimental está atualmente indisponível para este carro, já que o ACC original do carro é usado para controle longitudinal. - - - Enable experimental longitudinal control to allow experimental mode. - Ative o controle longitudinal experimental para permitir o modo experimental. - openpilot defaults to driving in <b>chill mode</b>. Experimental mode enables <b>alpha-level features</b> that aren't ready for chill mode. Experimental features are listed below: openpilot por padrão funciona em <b>modo chill</b>. modo Experimental ativa <b>recursos de nível-alfa</b> que não estão prontos para o modo chill. Recursos experimentais estão listados abaixo: @@ -1871,6 +1889,22 @@ Reboot now? The driving visualization will transition to the road-facing wide-angle camera at low speeds to better show some turns. The Experimental mode logo will also be shown in the top right corner. A visualização da direção fará a transição para a câmera grande angular voltada para a estrada em baixas velocidades para mostrar melhor algumas curvas. O logotipo do modo Experimental também será exibido no canto superior direito. + + Experimental mode is currently unavailable on this car since the car's stock ACC is used for longitudinal control. + O modo Experimental está atualmente indisponível para este carro já que o ACC original do carro é usado para controle longitudinal. + + + openpilot longitudinal control may come in a future update. + O controle longitudinal openpilot pode vir em uma atualização futura. + + + An experimental version of openpilot longitudinal control can be tested, along with Experimental mode, on non-release branches. + Uma versão experimental do controle longitudinal openpilot pode ser testada, juntamente com o modo Experimental, em branches de desenvolvimento. + + + Enable experimental longitudinal control to allow Experimental mode. + Ative o controle longitudinal experimental para permitir o modo Experimental. + Enable Right-Hand Drive diff --git a/selfdrive/ui/translations/main_th.ts b/selfdrive/ui/translations/main_th.ts index 0de0ba5f9..45f91f1cd 100644 --- a/selfdrive/ui/translations/main_th.ts +++ b/selfdrive/ui/translations/main_th.ts @@ -238,6 +238,14 @@ Disengage to Power Off ยกเลิกระบบช่วยขับเพื่อปิดเครื่อง + + Reset + รีเซ็ต + + + Review + ทบทวน + DriveStats @@ -273,6 +281,17 @@ กำลังเปิดกล้อง + + ExperimentalModeButton + + EXPERIMENTAL MODE ON + คุณกำลังใช้โหมดทดลอง + + + CHILL MODE ON + คุณกำลังใช้โหมดชิล + + InputDialog @@ -292,18 +311,6 @@ Installing... กำลังติดตั้ง... - - Receiving objects: - กำลังรับข้อมูล: - - - Resolving deltas: - การแก้ไขเดลต้า: - - - Updating files: - กำลังอัปเดตไฟล์: - MapETA @@ -463,6 +470,17 @@ location set จดจำ connect.comma.ai โดยการเพิ่มไปยังหน้าจอโฮม เพื่อใช้งานเหมือนเป็นแอปพลิเคชัน + + ParamControl + + Enable + เปิดใช้งาน + + + Cancel + ยกเลิก + + PrimeAdWidget @@ -556,18 +574,10 @@ location set Are you sure you want to reset your device? คุณแน่ใจหรือไม่ว่าต้องการรีเซ็ตอุปกรณ์? - - Resetting device... - กำลังรีเซ็ตอุปกรณ์... - System Reset รีเซ็ตระบบ - - System reset triggered. Press confirm to erase all content and settings. Press cancel to resume boot. - มีการสั่งรีเซ็ตระบบ กดยืนยันเพื่อลบข้อมูลและการตั้งค่าทั้งหมด กดยกเลิกเพื่อบูตเข้าระบบตามปกติ - Cancel ยกเลิก @@ -581,15 +591,18 @@ location set ยืนยัน - Unable to mount data partition. Press confirm to reset your device. - ไม่สามารถเมานต์พาร์ติชั่นข้อมูล กดยืนยันเพื่อรีเซ็ตอุปกรณ์ของคุณ + Resetting device... +This may take up to a minute. + กำลังรีเซ็ตอุปกรณ์... +อาจใช้เวลาถึงหนึ่งนาที - - - RichTextDialog - Ok - ตกลง + Press confirm to erase all content and settings. Press cancel to resume boot. + กดยืนยันเพื่อลบข้อมูลและการตั้งค่าทั้งหมด กดยกเลิกเพื่อบูตต่อ + + + Unable to mount data partition. Partition may be corrupted. Press confirm to erase and reset your device. + ไม่สามารถเมานต์พาร์ติชั่นข้อมูลได้ พาร์ติชั่นอาจเสียหาย กดยืนยันเพื่อลบและรีเซ็ตอุปกรณ์ของคุณ @@ -661,18 +674,6 @@ location set Waiting for internet กำลังรอสัญญาณอินเตอร์เน็ต - - Choose Software to Install - เลือกซอฟต์แวร์ที่จะติดตั้ง - - - Dashcam - กล้องติดรถยนต์ - - - Custom Software - ซอฟต์แวร์ที่กำหนดเอง - Enter URL ป้อน URL @@ -701,6 +702,14 @@ location set Start over เริ่มต้นใหม่ + + Something went wrong. Reboot the device. + มีบางอย่างผิดพลาด รีบูตอุปกรณ์ + + + No custom software found at this URL. + ไม่พบซอฟต์แวร์ที่กำหนดเองที่ URL นี้ + SetupWidget @@ -850,6 +859,10 @@ location set Select a branch เลือก Branch + + Uninstall + ถอนการติดตั้ง + SshControl @@ -974,29 +987,57 @@ location set Show map on left side when in split screen view. แสดงแผนที่ด้านซ้ายของหน้าจอเมื่ออยู่ในโหมดแบ่งหน้าจอ - - 🌮 End-to-end longitudinal (extremely alpha) 🌮 - 🌮 ควบคุมเร่ง/เบรคแบบ End-to-end (อยู่ขั้นพัฒนา) 🌮 - Experimental openpilot Longitudinal Control ทดลองใช้ระบบควบคุมการเร่ง/เบรคโดย openpilot - <b>WARNING: openpilot longitudinal control is experimental for this car and will disable AEB.</b> - <b>คำเตือน: การควบคุมการเร่ง/เบรคโดย openpilot สำหรับรถคันนี้ยังอยู่ในขั้นทดลอง และระบบเบรคฉุกเฉินอัตโนมัติ (AEB) จะถูกปิด</b> + Experimental Mode + โหมดทดลอง - Let the driving model control the gas and brakes. openpilot will drive as it thinks a human would. Super experimental. - ให้ openpilot ควบคุมการเร่ง/เบรคแบบ end-to-end โดย openpilot จะขับอย่างที่มนุษย์คิด ระบบยังอยู่ในขั้นทดลอง + WARNING: openpilot longitudinal control is experimental for this car and will disable Automatic Emergency Braking (AEB). + คำเตือน: การควบคุมการเร่ง/เบรคโดย openpilot สำหรับรถคันนี้ยังอยู่ในขั้นพัฒนา และระบบเบรคฉุกเฉินอัตโนมัติ (AEB) จะถูกปิด - openpilot longitudinal control is not currently available for this car. - ขณะนี้ยังไม่มีระบบควบคุมการเร่ง/เบรคโดย openpilot สำหรับรถคันนี้ + On this car, openpilot defaults to the car's built-in ACC instead of openpilot's longitudinal control. Enable this to switch to openpilot longitudinal control. Enabling Experimental mode is recommended when using experimental openpilot longitudinal control. + โดยปกติสำหรับรถคันนี้ openpilot จะควบคุมการเร่ง/เบรคด้วยระบบ ACC จากโรงงาน แทนการควยคุมโดย openpilot เปิดสวิตซ์นี้เพื่อให้ openpilot ควบคุมการเร่ง/เบรค แนะนำให้เปิดโหมดทดลองเมื่อต้องการให้ openpilot ควบคุมการเร่ง/เบรค ซึ่งอยู่ในขั้นพัฒนา - Enable experimental longitudinal control to enable this. - เปิดใช้งานระบบควบคุมการเร่ง/เบรคขั้นทดลอง เพื่อเปิดใช้งานสิ่งนี้ + openpilot defaults to driving in <b>chill mode</b>. Experimental mode enables <b>alpha-level features</b> that aren't ready for chill mode. Experimental features are listed below: + โดยปกติ openpilot จะขับใน<b>โหมดชิล</b> เปิดโหมดทดลองเพื่อใช้<b>ความสามารถในขั้นพัฒนา</b> ซึ่งยังไม่พร้อมสำหรับโหมดชิล ความสามารถในขั้นพัฒนามีดังนี้: + + + 🌮 End-to-End Longitudinal Control 🌮 + 🌮 ควบคุมเร่ง/เบรคแบบ End-to-End 🌮 + + + Let the driving model control the gas and brakes. openpilot will drive as it thinks a human would, including stopping for red lights and stop signs. Since the driving model decides the speed to drive, the set speed will only act as an upper bound. This is an alpha quality feature; mistakes should be expected. + ให้ openpilot ควบคุมการเร่ง/เบรค โดย openpilot จะขับอย่างที่มนุษย์คิด รวมถึงการหยุดที่ไฟแดง และป้ายหยุดรถ เนื่องจาก openpilot จะกำหนดความเร็วในการขับด้วยตัวเอง การตั้งความเร็วจะเป็นเพียงการกำหนดความเร็วสูงสูดเท่านั้น ความสามารถนี้ยังอยู่ในขั้นพัฒนา อาจเกิดข้อผิดพลาดขึ้นได้ + + + New Driving Visualization + การแสดงภาพการขับขี่แบบใหม่ + + + The driving visualization will transition to the road-facing wide-angle camera at low speeds to better show some turns. The Experimental mode logo will also be shown in the top right corner. + การแสดงภาพการขับขี่จะเปลี่ยนไปใช้กล้องมุมกว้างที่หันหน้าไปทางถนนเมื่ออยู่ในความเร็วต่ำ เพื่อแสดงภาพการเลี้ยวที่ดีขึ้น โลโก้โหมดการทดลองจะแสดงที่มุมบนขวาด้วย + + + Experimental mode is currently unavailable on this car since the car's stock ACC is used for longitudinal control. + ขณะนี้โหมดทดลองไม่สามารถใช้งานได้ในรถคันนี้ เนื่องจากเปิดใช้ระบบควบคุมการเร่ง/เบรคของรถที่ติดตั้งจากโรงงานอยู่ + + + openpilot longitudinal control may come in a future update. + ระบบควบคุมการเร่ง/เบรคโดย openpilot อาจมาในการอัปเดตในอนาคต + + + An experimental version of openpilot longitudinal control can be tested, along with Experimental mode, on non-release branches. + เวอร์ชันทดลองของระบบควบคุมการเร่ง/เบรคโดย openpilot สามารถทดสอบได้พร้อมกับโหมดการทดลอง บน branch ที่กำลังพัฒนา + + + Enable experimental longitudinal control to allow Experimental mode. + เปิดระบบควบคุมการเร่ง/เบรคขั้นพัฒนาโดย openpilot เพื่อเปิดใช้งานโหมดทดลอง @@ -1052,5 +1093,9 @@ location set Forget Wi-Fi Network "%1"? เลิกใช้เครือข่าย Wi-Fi "%1"? + + Forget + เลิกใช้ + diff --git a/selfdrive/ui/translations/main_zh-CHS.qm b/selfdrive/ui/translations/main_zh-CHS.qm index af5857687..1e4070dc9 100644 Binary files a/selfdrive/ui/translations/main_zh-CHS.qm and b/selfdrive/ui/translations/main_zh-CHS.qm differ diff --git a/selfdrive/ui/translations/main_zh-CHS.ts b/selfdrive/ui/translations/main_zh-CHS.ts index ea5fee986..d6f780ba3 100644 --- a/selfdrive/ui/translations/main_zh-CHS.ts +++ b/selfdrive/ui/translations/main_zh-CHS.ts @@ -93,10 +93,6 @@ REAL STEER - - RAM PER - - OFF @@ -137,6 +133,10 @@ ACCEL + + Lat Ctrl + + C2NetworkPanel @@ -270,19 +270,6 @@ Reboot Required. Enable this will increase steering, USE IT ONLY if you have a modded EPS firmware. -Reboot required. - - - - Volkswagen - - - - Enable VAG Resume Fix - - - - Enable this if your car does not auto resume (stop and go). Reboot required. @@ -307,13 +294,18 @@ Thanks to @TheCrowd Enable this to bypass dashcam mode. + + Enable Reverse ACC Set speed. + + + + Enabling this will reverse set acc short press +5 jump, Long press +1 Jump. +Reboot Required. + + DPControlPanel - - ALCA Delay - - Once the vehicle meets all ALCA criteria, it will wait for the seconds set here before performing lane change automatically. @@ -322,10 +314,6 @@ Thanks to @TheCrowd secs - - ALCA Min Speed - - ALCA minimum engage speed in mph. 1 mph = 1.61 km/h. @@ -335,10 +323,6 @@ Thanks to @TheCrowd mph - - LCA Min Speed - - LCA minimum engage speed in mph. 1 mph = 1.61 km/h. @@ -353,18 +337,10 @@ Thanks to @TheCrowd 2 = Auto Lane Change Assist (ALCA) - - Camera Offset - - Adjust your camera position if your device is not mounted as per guidance. - - Driving Path Offset - - Adjust this if you wish to let openpilot drive slightly towards to left (+) or right (-) @@ -486,37 +462,94 @@ More linear steering experience. Reboot required. - - DE2E Adapt Following Mode - - Enable this if you wish to use following dist. mode in DE2E. - - DE2E Adapt Accel Mode - - Enable this if you wish to use accel mode in DE2E. + + Enable this if your vehicles is in VOACC (e.g. Honda Bosch / VAG). + + + + ALC RoadEdge Detection + + + + Enabling this will prevent lane change when you are too close to road edge. + + + + ALCA Delay + + + + ALCA Min Speed + + + + LCA Min Speed + + + + Camera Offset + + + + Driving Path Offset + + + + DE2E Adapt Following Mode + + + + DE2E Adapt Accel Mode + + DE2E w/ VOACC - Enable this if your vehicles is in VOACC (e.g. Honda Bosch / VAG). + When Set Speed Above: + + + + when acc SET speed above the setting, it will switch to alternative controller. +1 km/h = 0.62 mph + + + + km/h + + + + Alternative Controller + + + + +1 = PID +2 = LQR +3 = Torque +Your Vehicle may not support all the options, YMMV. + + + + Use Alternative Controller + + + + This feature will let you use alternative lateral controller at higher set speed. DPGeneralPanel - - Auto Shutdown In - - Adjust your shutdown waiting period. 0 = shutdown immediately. @@ -662,6 +695,10 @@ Reboot required. Are you sure delete all media? + + Auto Shutdown In + + Enable Driver Monitor (Front Cam) @@ -749,14 +786,6 @@ Reboot required. Use curvature info from map data to define speed limits to take turns ahead - - Show debug UI elements - - - - Show UI elements that aid debugging. - - Enable MapD @@ -770,6 +799,38 @@ Please note: 4. Not connecting to the internet for while might feel up device storage from all the gps traces. + + OpenStreetMap Database Update + + + + CHECK + 查看 + + + "OpenStreetMap Database Update" +Your device will reboot and perform a database update based on the region you have selected. +Reboot now? + + + + OpenStreetMap Database + + + + SELECT + 选择 + + + Select your location + + + + "OpenStreetMap Database" +Restart your device to start downloading the selected database. Dragonpilot will only start downloading the database on reboot. +Reboot now? + + DPUIPanel @@ -794,14 +855,6 @@ Please note: AUTO - - Alert Volume - - - - Adjust your alert volume. - - Quiet Drive @@ -818,10 +871,6 @@ Please note: Enable this to display your current speed. - - Display Event / Steer Icon - - Enable this to display the icon. @@ -854,6 +903,22 @@ Please note: Display detected lead objects' speed and distance. + + Display Driver Camera + + + + Display Driver Camera when reversing. + + + + Rainbow Path + + + + for all the tesla fanboy's. + + Volume @@ -1081,18 +1146,6 @@ Please note: Installing... 正在安装…… - - Receiving objects: - 正在接收: - - - Resolving deltas: - 正在处理: - - - Updating files: - 正在更新文件: - MapETA @@ -1354,18 +1407,10 @@ location set Are you sure you want to reset your device? 您确定要重置您的设备吗? - - Resetting device... - 正在重置设备…… - System Reset 恢复出厂设置 - - System reset triggered. Press confirm to erase all content and settings. Press cancel to resume boot. - 已触发系统重置:确认以删除所有内容和设置。取消以正常启动设备。 - Cancel 取消 @@ -1379,8 +1424,17 @@ location set 确认 - Unable to mount data partition. Press confirm to reset your device. - 无法挂载数据分区。 确认以重置您的设备。 + Unable to mount data partition. Partition may be corrupted. Press confirm to erase and reset your device. + + + + Press confirm to erase all content and settings. Press cancel to resume boot. + + + + Resetting device... +This may take up to a minute. + @@ -1476,18 +1530,6 @@ location set Waiting for internet 等待网络连接 - - Choose Software to Install - 选择要安装的软件 - - - Dashcam - Dashcam(行车记录仪) - - - Custom Software - 自定义软件 - Enter URL 输入网址 @@ -1516,6 +1558,14 @@ location set Start over 重来 + + No custom software found at this URL. + + + + Something went wrong. Reboot the device. + + SetupWidget @@ -1647,7 +1697,7 @@ location set SELECT - 选择 + 选择 Select a branch @@ -1673,30 +1723,6 @@ location set Uninstall 卸载 - - OpenStreetMap Database Update - - - - "OpenStreetMap Database Update" -Your device will reboot and perform a database update based on the region you have selected. -Reboot now? - - - - OpenStreetMap Database - - - - Select your location - - - - "OpenStreetMap Database" -Restart your device to start downloading the selected database. Dragonpilot will only start downloading the database on reboot. -Reboot now? - - SshControl @@ -1837,14 +1863,6 @@ Reboot now? On this car, openpilot defaults to the car's built-in ACC instead of openpilot's longitudinal control. Enable this to switch to openpilot longitudinal control. Enabling Experimental mode is recommended when using experimental openpilot longitudinal control. 针对此车辆,openpilot默认使用车辆自带的ACC,而非openpilot的纵向控制。启用此选项将切换到openpilot纵向控制。当使用试验性的openpilot纵向控制时,建议同时启用试验模式。 - - Experimental mode is currently unavailable on this car, since the car's stock ACC is used for longitudinal control. - 由于此车辆使用自带的ACC纵向控制,当前无法使用试验模式。 - - - Enable experimental longitudinal control to allow experimental mode. - 启用试验性的纵向控制,以便允许使用试验模式。 - openpilot defaults to driving in <b>chill mode</b>. Experimental mode enables <b>alpha-level features</b> that aren't ready for chill mode. Experimental features are listed below: openpilot 默认 <b>轻松模式</b>驾驶车辆。试验模式启用一些轻松模式之外的 <b>试验性功能</b>。试验性功能包括: @@ -1865,6 +1883,22 @@ Reboot now? The driving visualization will transition to the road-facing wide-angle camera at low speeds to better show some turns. The Experimental mode logo will also be shown in the top right corner. 当低速行驶时,驾驶视角将切换到前向广角摄像头,便于更完整地显示转向路径。右上角将显示试验模式图标。 + + Experimental mode is currently unavailable on this car since the car's stock ACC is used for longitudinal control. + 由于此车辆使用自带的ACC纵向控制,当前无法使用试验模式。 + + + openpilot longitudinal control may come in a future update. + + + + An experimental version of openpilot longitudinal control can be tested, along with Experimental mode, on non-release branches. + + + + Enable experimental longitudinal control to allow Experimental mode. + 启用试验性的纵向控制,以便允许使用试验模式。 + Enable Right-Hand Drive diff --git a/selfdrive/ui/translations/main_zh-CHT.qm b/selfdrive/ui/translations/main_zh-CHT.qm index a6c138a10..3ae3a2a7d 100644 Binary files a/selfdrive/ui/translations/main_zh-CHT.qm and b/selfdrive/ui/translations/main_zh-CHT.qm differ diff --git a/selfdrive/ui/translations/main_zh-CHT.ts b/selfdrive/ui/translations/main_zh-CHT.ts index f1063d4e4..462aac58c 100644 --- a/selfdrive/ui/translations/main_zh-CHT.ts +++ b/selfdrive/ui/translations/main_zh-CHT.ts @@ -95,7 +95,7 @@ RAM PER - 記憶體 % + 記憶體 % OFF @@ -137,6 +137,10 @@ ACCEL 加速模式 + + Lat Ctrl + 橫向控制器 + C2NetworkPanel @@ -284,18 +288,14 @@ Reboot required. 啟用這個選項後 openpilot 將可以使用更廣的方向盤控制值。註:您的方向盤需要刷過修改過的 EPS 固件。 需重新啟動。 - - Volkswagen - - Enable VAG Resume Fix - 啟用 VAG RES 修正 + 啟用 VAG RES 修正 Enable this if your car does not auto resume (stop and go). Reboot required. - 如果您的車子無法自動跟車,請開啟這個功能。 + 如果您的車子無法自動跟車,請開啟這個功能。 需重新啟動。 @@ -319,6 +319,19 @@ Thanks to @TheCrowd Enable this to bypass dashcam mode. 啟用這個選項來繞過行車記錄模式。 + + Enable Reverse ACC Set speed. + + + + Enabling this will reverse set acc short press +5 jump, Long press +1 Jump. +Reboot Required. + + + + Use Alternative Controller + 使用替代控制器 + DPControlPanel @@ -528,7 +541,7 @@ Reboot required. km/h - km/h + km/h when lead car is going below the setting, e2e will be turned on automatically. @@ -554,7 +567,7 @@ Reboot required. Enable this if you wish to use following dist. mode in DE2E. - + DE2E Adapt Accel Mode @@ -562,27 +575,75 @@ Reboot required. Enable this if you wish to use accel mode in DE2E. - + - when acc set speed below the setting and there is no lead car, e2e will be turned on automatically. -1 km/h = 0.62 mph - 當車子的定速低於設定值並且在沒有前車的情形下,系統會自動開啟 E2E 模式。 -1 km/h = 0.62 mph - - - when lead car is going below the setting, e2e will be turned on automatically. -1 km/h = 0.62 mph - 當前車車速於低於設定值時,系統將自動切換至 E2E 模式。 -1 km/h = 0.62 mph + Enable this if your vehicles is in VOACC (e.g. Honda Bosch / VAG). + 如果您的車子使用的是 VOACC (例如:Honda Bosch / VAG/HKG),可以開啟這個功能增進剎車效能。 DE2E w/ VOACC DE2E 用於 VOACC 下 - Enable this if your vehicles is in VOACC (e.g. Honda Bosch / VAG). - 如果您的車子使用的是 VOACC (例如:Honda Bosch / VAG/HKG),可以開啟這個功能增進剎車效能。 + Camera Offset + 相機偏移 + + + Driving Path Offset + 駕駛路徑偏移 + + + When Set Speed Above: + 當定速高於: + + + when acc SET speed above the setting, it will switch to alternative controller. +1 km/h = 0.62 mph + 當定速高於設定的速度時,將會啟用替代的控制器 + + + Alternative Controller + 替代控制器 + + + +1 = PID +2 = LQR +3 = Torque +Your Vehicle may not support all the options, YMMV. + 1 = PID +2 = LQR +3 = Torque +你的車型可能無法適用所有的選項。 + + + Use Lanelines + 使用線道 + + + This feature will let you use alternative lateral controller at higher set speed. + 這個功能讓你在較高的定速下使用替代控制器 + + + Use Alternative Controller + 使用替代控制器 + + + ALC RoadEdge Detection + 換道路緣檢測 + + + Enabling this will prevent lane change when you are too close to road edge. + 啟用此選項可以防止當您靠近道路邊緣時進行車道變換。 + + + When Set Speed Above: + 當定速高於: + + + Alternative Controller + 替代控制器 @@ -594,11 +655,12 @@ Reboot required. Adjust your shutdown waiting period. 0 = shutdown immediately. - 調整自動關機時間。0 = 馬上關機 + 調整自動關機時間。 +0 = 馬上關機 mins - 分鐘 + 分鐘 Enable Auto Shutdown @@ -842,11 +904,11 @@ Reboot required. Show debug UI elements - 顯示除錯用圖示 + 顯示除錯用圖示 Show UI elements that aid debugging. - 於右上方顯示除錯用訊息 + 於右上方顯示除錯用訊息 Enable MapD @@ -877,6 +939,42 @@ Please note: If you decide not to upgrade you can delete all logs under dp-general 您設備的 /data/media/0/ 將需要至少 50GB 的存儲空間。 + + OpenStreetMap Database Update + OpenStreetMap 數據庫更新 + + + CHECK + 檢查 + + + "OpenStreetMap Database Update" +Your device will reboot and perform a database update based on the region you have selected. +Reboot now? + "OpenStreetMap 數據庫更新" +您的設備將會重新啟動,並基於您選擇的區域執行一次數據庫更新。 +現在重新啟動嗎? + + + OpenStreetMap Database + OpenStreetMap 數據庫 + + + SELECT + 選取 + + + Select your location + 請選擇您的位置 + + + "OpenStreetMap Database" +Restart your device to start downloading the selected database. Dragonpilot will only start downloading the database on reboot. +Reboot now? + "OpenStreetMap 數據庫" +請重新啟動您的設備以開始下載選定的數據庫。Dragonpilot 只會在重新啟動後開始下載數據庫。 +現在重新啟動嗎? + DPUIPanel @@ -904,11 +1002,11 @@ Please note: Alert Volume - 提示音量 + 提示音量 Adjust your alert volume. - 調整設備的提示音量。 + 調整設備的提示音量。 Quiet Drive @@ -928,7 +1026,7 @@ Please note: Display Event / Steer Icon - 顯示事件圖示 + 顯示事件圖示 Enable this to display the icon. @@ -964,11 +1062,19 @@ Please note: Display Driver Camera - 倒車顯示駕駛監控畫面 + 倒車顯示駕駛監控畫面 Display Driver Camera when reversing. - 倒車顯示駕駛監控畫面 + 倒車顯示駕駛監控畫面 + + + Rainbow Path + + + + for all the tesla fanboy's. + LAUNCH @@ -1197,18 +1303,6 @@ Please note: Installing... 安裝中… - - Receiving objects: - 接收對象: - - - Resolving deltas: - 分析差異: - - - Updating files: - 更新檔案: - MapETA @@ -1472,18 +1566,10 @@ location set Are you sure you want to reset your device? 您確定要重置你的設備嗎? - - Resetting device... - 重置設備中… - System Reset 系統重置 - - System reset triggered. Press confirm to erase all content and settings. Press cancel to resume boot. - 系統重置已觸發。請按確認刪除所有內容和設置。按取消恢復啟動。 - Cancel 取消 @@ -1497,8 +1583,18 @@ location set 確認 - Unable to mount data partition. Press confirm to reset your device. - 無法掛載數據分區。請按確認重置您的設備。 + Unable to mount data partition. Partition may be corrupted. Press confirm to erase and reset your device. + 無法掛載數據分區。分區可能已損壞。請按確認以清除並重置您的設備。 + + + Press confirm to erase all content and settings. Press cancel to resume boot. + 按確認以清除所有內容和設置。按取消以繼續啟動。 + + + Resetting device... +This may take up to a minute. + 正在重置設備... +這可能需要一分鐘的時間。 @@ -1594,18 +1690,6 @@ location set Waiting for internet 連接至網路中 - - Choose Software to Install - 選擇要安裝的軟體 - - - Dashcam - 行車記錄器 - - - Custom Software - 定制的軟體 - Enter URL 輸入網址 @@ -1634,6 +1718,14 @@ location set Start over 重新開始 + + No custom software found at this URL. + 在此 URL 上未找到自定義軟件。 + + + Something went wrong. Reboot the device. + 出現了問題。請重新啟動設備。 + SetupWidget @@ -1765,7 +1857,7 @@ location set SELECT - 選取 + 選取 Select a branch @@ -1791,30 +1883,6 @@ location set Uninstall 解除安裝 - - OpenStreetMap Database Update - - - - "OpenStreetMap Database Update" -Your device will reboot and perform a database update based on the region you have selected. -Reboot now? - - - - OpenStreetMap Database - - - - Select your location - - - - "OpenStreetMap Database" -Restart your device to start downloading the selected database. Dragonpilot will only start downloading the database on reboot. -Reboot now? - - SshControl @@ -1955,14 +2023,6 @@ Reboot now? On this car, openpilot defaults to the car's built-in ACC instead of openpilot's longitudinal control. Enable this to switch to openpilot longitudinal control. Enabling Experimental mode is recommended when using experimental openpilot longitudinal control. 在本車輛中,openpilot預設將使用原車內建的ACC系統,而非openpilot縱向控制。開啟此開關來啟用openpilot縱向控制,使用此選項時建議一併啟用實驗模式。 - - Experimental mode is currently unavailable on this car, since the car's stock ACC is used for longitudinal control. - 因車輛使用內建ACC系統,無法在本車輛上啟動實驗模式。 - - - Enable experimental longitudinal control to allow experimental mode. - 啟用實驗性縱向控制以使用實驗模式。 - openpilot defaults to driving in <b>chill mode</b>. Experimental mode enables <b>alpha-level features</b> that aren't ready for chill mode. Experimental features are listed below: openpilot 預設以 <b>輕鬆模式</b> 駕駛。 實驗模式啟用了尚未準備好進入輕鬆模式的 <b>alpha 級功能</b>。實驗功能如下: @@ -1991,6 +2051,22 @@ Reboot now? Allow openpilot to obey left-hand traffic conventions and perform driver monitoring on right driver seat. openpilot 將對右側駕駛進行監控 (但仍遵守靠左駕的交通慣例)。 + + Experimental mode is currently unavailable on this car since the car's stock ACC is used for longitudinal control. + 因車輛使用內建ACC系統,無法在本車輛上啟動實驗模式。 + + + openpilot longitudinal control may come in a future update. + + + + An experimental version of openpilot longitudinal control can be tested, along with Experimental mode, on non-release branches. + + + + Enable experimental longitudinal control to allow Experimental mode. + 啟用實驗性縱向控制以使用實驗模式。 + Updater diff --git a/selfdrive/updated.py b/selfdrive/updated.py index 1aa8a015d..b9f398299 100755 --- a/selfdrive/updated.py +++ b/selfdrive/updated.py @@ -72,7 +72,7 @@ def set_consistent_flag(consistent: bool) -> None: def parse_release_notes(basedir: str) -> bytes: try: - with open(os.path.join(basedir, "CHANGELOGS.md"), "rb") as f: + with open(os.path.join(basedir, "CHANGELOGS_c2.md"), "rb") as f: r = f.read().split(b'\n\n', 1)[0] # Slice latest release notes try: return bytes(MarkdownIt().render(r.decode("utf-8")), encoding="utf-8") @@ -165,9 +165,9 @@ def init_overlay() -> None: else: run(mount_cmd) - # git_diff = run(["git", "diff"], OVERLAY_MERGED) - # params.put("GitDiff", git_diff) - # cloudlog.info(f"git diff output:\n{git_diff}") + git_diff = run(["git", "diff"], OVERLAY_MERGED) + params.put("GitDiff", git_diff) + cloudlog.info(f"git diff output:\n{git_diff}") def finalize_update() -> None: @@ -450,6 +450,9 @@ def main() -> None: wait_helper = WaitTimeHelper() wait_helper.only_check_for_update = True + # invalidate old finalized update + set_consistent_flag(False) + # Run the update loop while True: wait_helper.ready_event.clear() diff --git a/system/camerad/camerad b/system/camerad/camerad index 982ab88c6..60329dfcf 100755 Binary files a/system/camerad/camerad and b/system/camerad/camerad differ diff --git a/system/camerad/cameras/camera_common.h b/system/camerad/cameras/camera_common.h index 95f96561d..81426a74e 100644 --- a/system/camerad/cameras/camera_common.h +++ b/system/camerad/cameras/camera_common.h @@ -29,7 +29,7 @@ #define CAMERA_ID_MAX 10 const int UI_BUF_COUNT = 4; -const int YUV_BUFFER_COUNT = Hardware::EON() ? 100 : 40; +const int YUV_BUFFER_COUNT = 100; enum CameraType { RoadCam = 0, diff --git a/system/camerad/cameras/camera_qcom.h b/system/camerad/cameras/camera_qcom.h index 1bf659fac..f4aeeb11d 100644 --- a/system/camerad/cameras/camera_qcom.h +++ b/system/camerad/cameras/camera_qcom.h @@ -8,10 +8,10 @@ #include "cereal/visionipc/visionbuf.h" #include "system/camerad/cameras/camera_common.h" #include "system/camerad/imgproc/utils.h" -#include "system/camerad/include/msm_cam_sensor.h" -#include "system/camerad/include/msmb_camera.h" -#include "system/camerad/include/msmb_isp.h" -#include "system/camerad/include/msmb_ispif.h" +#include "third_party/linux/include/msm_cam_sensor.h" +#include "third_party/linux/include/msmb_camera.h" +#include "third_party/linux/include/msmb_isp.h" +#include "third_party/linux/include/msmb_ispif.h" #include "common/mat.h" #include "common/util.h" diff --git a/system/camerad/cameras/sensor2_i2c.h b/system/camerad/cameras/sensor2_i2c.h index ab51059d9..83fcb8f7a 100644 --- a/system/camerad/cameras/sensor2_i2c.h +++ b/system/camerad/cameras/sensor2_i2c.h @@ -126,7 +126,7 @@ struct i2c_random_wr_payload init_array_ox03c10[] = { {0x3219, 0x08}, {0x3506, 0x20}, {0x3507, 0x00}, // hcg fine exposure - {0x350a, 0x04}, {0x350b, 0x00}, {0x350c, 0x00}, // hcg digital gain + {0x350a, 0x01}, {0x350b, 0x00}, {0x350c, 0x00}, // hcg digital gain {0x3586, 0x40}, {0x3587, 0x00}, // lcg fine exposure {0x358a, 0x01}, {0x358b, 0x00}, {0x358c, 0x00}, // lcg digital gain @@ -711,11 +711,11 @@ struct i2c_random_wr_payload init_array_ox03c10[] = { {0x4221, 0x03}, // this is changed from 1 -> 3 // DCG exposure coarse - {0x3501, 0x01}, {0x3502, 0xc8}, + // {0x3501, 0x01}, {0x3502, 0xc8}, // SPD exposure coarse - {0x3541, 0x01}, {0x3542, 0xc8}, + // {0x3541, 0x01}, {0x3542, 0xc8}, // VS exposure coarse - {0x35c1, 0x00}, {0x35c2, 0x01}, + // {0x35c1, 0x00}, {0x35c2, 0x01}, // crc reference {0x420e, 0x66}, {0x420f, 0x5d}, {0x4210, 0xa8}, {0x4211, 0x55}, diff --git a/system/clocksd/clocksd b/system/clocksd/clocksd index 6ac77fc2c..b83000ab4 100755 Binary files a/system/clocksd/clocksd and b/system/clocksd/clocksd differ diff --git a/system/hardware/base.h b/system/hardware/base.h index f6e0b42d7..6cfc1d874 100644 --- a/system/hardware/base.h +++ b/system/hardware/base.h @@ -16,6 +16,8 @@ public: static int get_voltage() { return 0; }; static int get_current() { return 0; }; + static std::string get_serial() { return "cccccc"; } + static void reboot() {} static void poweroff() {} static void set_brightness(int percent) {} diff --git a/system/hardware/hw.h b/system/hardware/hw.h index b8b223e8e..31f1631a9 100644 --- a/system/hardware/hw.h +++ b/system/hardware/hw.h @@ -2,7 +2,6 @@ #include "system/hardware/base.h" #include "common/util.h" -#include "common/params.h" #if QCOM2 #include "system/hardware/tici/hardware.h" @@ -20,8 +19,7 @@ inline std::string log_root() { if (const char *env = getenv("LOG_ROOT")) { return env; } - return "/data/media/0/fakedata"; - //return Hardware::PC() ? util::getenv("HOME") + "/.comma/media/0/realdata" : "/data/media/0/realdata"; + return Hardware::PC() ? util::getenv("HOME") + "/.comma/media/0/realdata" : "/data/media/0/realdata"; } inline std::string params() { return Hardware::PC() ? util::getenv("HOME") + "/.comma/params" : "/data/params"; diff --git a/system/hardware/tici/amplifier.py b/system/hardware/tici/amplifier.py old mode 100755 new mode 100644 index a8b279863..8233834d1 --- a/system/hardware/tici/amplifier.py +++ b/system/hardware/tici/amplifier.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python from smbus2 import SMBus from collections import namedtuple @@ -63,11 +62,43 @@ BASE_CONFIG = [ AmpConfig("Zero-crossing detection disabled", 0b0, 0x49, 5, 0b00100000), ] -BASE_CONFIG += configs_from_eq_params(0x84, EQParams(0x274F, 0xC0FF, 0x3BF9, 0x0B3C, 0x1656)) -BASE_CONFIG += configs_from_eq_params(0x8E, EQParams(0x1009, 0xC6BF, 0x2952, 0x1C97, 0x30DF)) -BASE_CONFIG += configs_from_eq_params(0x98, EQParams(0x0F75, 0xCBE5, 0x0ED2, 0x2528, 0x3E42)) -BASE_CONFIG += configs_from_eq_params(0xA2, EQParams(0x091F, 0x3D4C, 0xCE11, 0x1266, 0x2807)) -BASE_CONFIG += configs_from_eq_params(0xAC, EQParams(0x0A9E, 0x3F20, 0xE573, 0x0A8B, 0x3A3B)) +CONFIGS = { + "tici": [ + *configs_from_eq_params(0x84, EQParams(0x274F, 0xC0FF, 0x3BF9, 0x0B3C, 0x1656)), + *configs_from_eq_params(0x8E, EQParams(0x1009, 0xC6BF, 0x2952, 0x1C97, 0x30DF)), + *configs_from_eq_params(0x98, EQParams(0x0F75, 0xCBE5, 0x0ED2, 0x2528, 0x3E42)), + *configs_from_eq_params(0xA2, EQParams(0x091F, 0x3D4C, 0xCE11, 0x1266, 0x2807)), + *configs_from_eq_params(0xAC, EQParams(0x0A9E, 0x3F20, 0xE573, 0x0A8B, 0x3A3B)), + ], + "tizi": [ + AmpConfig("Left speaker output from left DAC", 0b1, 0x2B, 0, 0b11111111), + AmpConfig("Left Speaker Mixer Gain", 0b00, 0x2D, 0, 0b00000011), + AmpConfig("Left speaker output volume", 0x1F, 0x3D, 0, 0b00011111), + AmpConfig("Right speaker output volume", 0x1F, 0x3E, 0, 0b00011111), + AmpConfig("DAI1 attenuation (DV1)", 0x4, 0x2F, 0, 0b00001111), + AmpConfig("DAI2 attenuation (DV2)", 0x4, 0x31, 0, 0b00001111), + AmpConfig("DAI2: DC blocking", 0b0, 0x20, 0, 0b00000001), + AmpConfig("ALC enable", 0b0, 0x43, 7, 0b10000000), + AmpConfig("DAI2 EQ attenuation", 0x2, 0x32, 0, 0b00001111), + AmpConfig("Excursion limiter upper corner freq", 0b001, 0x41, 4, 0b01110000), + AmpConfig("Excursion limiter threshold", 0b100, 0x42, 0, 0b00001111), + AmpConfig("Distortion limit (THDCLP)", 0x0, 0x46, 4, 0b11110000), + AmpConfig("Distortion limiter release time constant", 0b1, 0x46, 0, 0b00000001), + AmpConfig("Left DAC input mixer: DAI1 left", 0b0, 0x22, 7, 0b10000000), + AmpConfig("Left DAC input mixer: DAI1 right", 0b0, 0x22, 6, 0b01000000), + AmpConfig("Left DAC input mixer: DAI2 left", 0b1, 0x22, 5, 0b00100000), + AmpConfig("Left DAC input mixer: DAI2 right", 0b0, 0x22, 4, 0b00010000), + AmpConfig("Right DAC input mixer: DAI2 left", 0b0, 0x22, 1, 0b00000010), + AmpConfig("Right DAC input mixer: DAI2 right", 0b1, 0x22, 0, 0b00000001), + AmpConfig("Volume adjustment smoothing disabled", 0b1, 0x49, 6, 0b01000000), + + *configs_from_eq_params(0x84, EQParams(0x3084, 0xC023, 0x3D60, 0x042B, 0x1222)), + *configs_from_eq_params(0x8E, EQParams(0x2FB2, 0xC05C, 0x3BD3, 0x06C5, 0x16BB)), + *configs_from_eq_params(0x98, EQParams(0x21F5, 0xDF73, 0x2DFE, 0x371A, 0x2C80)), + *configs_from_eq_params(0xA2, EQParams(0x2A5A, 0x0AD0, 0x14FA, 0x3F14, 0x3C76)), + *configs_from_eq_params(0xAC, EQParams(0x1577, 0x3FAE, 0xEE60, 0x0664, 0x3D86)), + ], +} class Amplifier: AMP_I2C_BUS = 0 @@ -91,14 +122,13 @@ class Amplifier: def set_global_shutdown(self, amp_disabled): self.set_config(AmpConfig("Global shutdown", 0b0 if amp_disabled else 0b1, 0x51, 7, 0b10000000)) - def initialize_configuration(self): + def initialize_configuration(self, model): self.set_global_shutdown(amp_disabled=True) for config in BASE_CONFIG: self.set_config(config) + for config in CONFIGS[model]: + self.set_config(config) + self.set_global_shutdown(amp_disabled=False) - - -if __name__ == "__main__": - Amplifier(debug=True).initialize_configuration() diff --git a/system/hardware/tici/hardware.h b/system/hardware/tici/hardware.h index d388f9c48..5f6fb2dc5 100644 --- a/system/hardware/tici/hardware.h +++ b/system/hardware/tici/hardware.h @@ -21,13 +21,32 @@ public: static int get_voltage() { return std::atoi(util::read_file("/sys/class/hwmon/hwmon1/in1_input").c_str()); }; static int get_current() { return std::atoi(util::read_file("/sys/class/hwmon/hwmon1/curr1_input").c_str()); }; + static std::string get_serial() { + static std::string serial(""); + if (serial.empty()) { + std::ifstream stream("/proc/cmdline"); + std::string cmdline; + std::getline(stream, cmdline); + + auto start = cmdline.find("serialno="); + if (start == std::string::npos) { + serial = "cccccc"; + } else { + auto end = cmdline.find(" ", start + 9); + serial = cmdline.substr(start + 9, end - start - 9); + } + } + return serial; + } static void reboot() { std::system("sudo reboot"); }; static void poweroff() { std::system("sudo poweroff"); }; static void set_brightness(int percent) { + std::string max = util::read_file("/sys/class/backlight/panel0-backlight/max_brightness"); + std::ofstream brightness_control("/sys/class/backlight/panel0-backlight/brightness"); if (brightness_control.is_open()) { - brightness_control << (percent * (int)(1023/100.)) << "\n"; + brightness_control << (int)(percent * (std::stof(max)/100.)) << "\n"; brightness_control.close(); } }; diff --git a/system/hardware/tici/hardware.py b/system/hardware/tici/hardware.py index a1ec1eaaf..81be0970b 100644 --- a/system/hardware/tici/hardware.py +++ b/system/hardware/tici/hardware.py @@ -85,6 +85,16 @@ class Tici(HardwareBase): def amplifier(self): return Amplifier() + @cached_property + def model(self): + with open("/sys/firmware/devicetree/base/model") as f: + model = f.read().strip('\x00') + model = model.split('comma ')[-1] + # TODO: remove this with AGNOS 7+ + if model.startswith('Qualcomm'): + model = 'tici' + return model + def get_os_version(self): with open("/VERSION") as f: return f.read().strip() @@ -386,15 +396,22 @@ class Tici(HardwareBase): def set_screen_brightness(self, percentage): try: + with open("/sys/class/backlight/panel0-backlight/max_brightness") as f: + max_brightness = float(f.read().strip()) + + val = int(percentage * (max_brightness / 100.)) with open("/sys/class/backlight/panel0-backlight/brightness", "w") as f: - f.write(str(int(percentage * 10.23))) + f.write(str(val)) except Exception: pass def get_screen_brightness(self): try: + with open("/sys/class/backlight/panel0-backlight/max_brightness") as f: + max_brightness = float(f.read().strip()) + with open("/sys/class/backlight/panel0-backlight/brightness") as f: - return int(float(f.read()) / 10.23) + return int(float(f.read()) / (max_brightness / 100.)) except Exception: return 0 @@ -402,7 +419,7 @@ class Tici(HardwareBase): # amplifier, 100mW at idle self.amplifier.set_global_shutdown(amp_disabled=powersave_enabled) if not powersave_enabled: - self.amplifier.initialize_configuration() + self.amplifier.initialize_configuration(self.model) # *** CPU config *** @@ -431,7 +448,7 @@ class Tici(HardwareBase): return 0 def initialize_hardware(self): - self.amplifier.initialize_configuration() + self.amplifier.initialize_configuration(self.model) # Allow thermald to write engagement status to kmsg os.system("sudo chmod a+w /dev/kmsg") diff --git a/selfdrive/loggerd/.gitignore b/system/loggerd/.gitignore similarity index 100% rename from selfdrive/loggerd/.gitignore rename to system/loggerd/.gitignore diff --git a/selfdrive/controls/lib/cluster/__init__.py b/system/loggerd/__init__.py similarity index 100% rename from selfdrive/controls/lib/cluster/__init__.py rename to system/loggerd/__init__.py diff --git a/system/loggerd/config.py b/system/loggerd/config.py new file mode 100644 index 000000000..168c9fba9 --- /dev/null +++ b/system/loggerd/config.py @@ -0,0 +1,41 @@ +import os +from pathlib import Path +from system.hardware import PC + +if os.environ.get('LOG_ROOT', False): + ROOT = os.environ['LOG_ROOT'] +elif PC: + ROOT = os.path.join(str(Path.home()), ".comma", "media", "0", "realdata") +else: + ROOT = '/data/media/0/realdata/' + + +CAMERA_FPS = 20 +SEGMENT_LENGTH = 60 + +STATS_DIR_FILE_LIMIT = 10000 +STATS_SOCKET = "ipc:///tmp/stats" +if PC: + STATS_DIR = os.path.join(str(Path.home()), ".comma", "stats") +else: + STATS_DIR = "/data/stats/" +STATS_FLUSH_TIME_S = 60 + +def get_available_percent(default=None): + try: + statvfs = os.statvfs(ROOT) + available_percent = 100.0 * statvfs.f_bavail / statvfs.f_blocks + except OSError: + available_percent = default + + return available_percent + + +def get_available_bytes(default=None): + try: + statvfs = os.statvfs(ROOT) + available_bytes = statvfs.f_bavail * statvfs.f_frsize + except OSError: + available_bytes = default + + return available_bytes diff --git a/system/loggerd/deleter.py b/system/loggerd/deleter.py new file mode 100644 index 000000000..5fb2b9eb4 --- /dev/null +++ b/system/loggerd/deleter.py @@ -0,0 +1,48 @@ +#!/usr/bin/env python3 +import os +import shutil +import threading +from system.swaglog import cloudlog +from system.loggerd.config import ROOT, get_available_bytes, get_available_percent +from system.loggerd.uploader import listdir_by_creation + +MIN_BYTES = 5 * 1024 * 1024 * 1024 +MIN_PERCENT = 10 + +DELETE_LAST = ['boot', 'crash'] + + +def deleter_thread(exit_event): + while not exit_event.is_set(): + out_of_bytes = get_available_bytes(default=MIN_BYTES + 1) < MIN_BYTES + out_of_percent = get_available_percent(default=MIN_PERCENT + 1) < MIN_PERCENT + + if out_of_percent or out_of_bytes: + # remove the earliest directory we can + dirs = sorted(listdir_by_creation(ROOT), key=lambda x: x in DELETE_LAST) + for delete_dir in dirs: + delete_path = os.path.join(ROOT, delete_dir) + + if any(name.endswith(".lock") for name in os.listdir(delete_path)): + continue + + try: + cloudlog.info(f"deleting {delete_path}") + if os.path.isfile(delete_path): + os.remove(delete_path) + else: + shutil.rmtree(delete_path) + break + except OSError: + cloudlog.exception(f"issue deleting {delete_path}") + exit_event.wait(.1) + else: + exit_event.wait(30) + + +def main(): + deleter_thread(threading.Event()) + + +if __name__ == "__main__": + main() diff --git a/selfdrive/loggerd/encoder/encoder.h b/system/loggerd/encoder/encoder.h similarity index 97% rename from selfdrive/loggerd/encoder/encoder.h rename to system/loggerd/encoder/encoder.h index 21ef65cf1..88dd5cee2 100644 --- a/selfdrive/loggerd/encoder/encoder.h +++ b/system/loggerd/encoder/encoder.h @@ -7,7 +7,7 @@ #include "cereal/messaging/messaging.h" #include "cereal/visionipc/visionipc.h" #include "common/queue.h" -#include "selfdrive/loggerd/video_writer.h" +#include "system/loggerd/video_writer.h" #include "system/camerad/cameras/camera_common.h" #define V4L2_BUF_FLAG_KEYFRAME 8 diff --git a/selfdrive/loggerd/encoder/ffmpeg_encoder.h b/system/loggerd/encoder/ffmpeg_encoder.h similarity index 92% rename from selfdrive/loggerd/encoder/ffmpeg_encoder.h rename to system/loggerd/encoder/ffmpeg_encoder.h index 497a28b65..9095a6e81 100644 --- a/selfdrive/loggerd/encoder/ffmpeg_encoder.h +++ b/system/loggerd/encoder/ffmpeg_encoder.h @@ -11,8 +11,8 @@ extern "C" { #include } -#include "selfdrive/loggerd/encoder/encoder.h" -#include "selfdrive/loggerd/loggerd.h" +#include "system/loggerd/encoder/encoder.h" +#include "system/loggerd/loggerd.h" class FfmpegEncoder : public VideoEncoder { public: diff --git a/selfdrive/loggerd/encoder/v4l_encoder.h b/system/loggerd/encoder/v4l_encoder.h similarity index 95% rename from selfdrive/loggerd/encoder/v4l_encoder.h rename to system/loggerd/encoder/v4l_encoder.h index c2a53dd6e..d4b0a1211 100644 --- a/selfdrive/loggerd/encoder/v4l_encoder.h +++ b/system/loggerd/encoder/v4l_encoder.h @@ -1,7 +1,7 @@ #pragma once #include "common/queue.h" -#include "selfdrive/loggerd/encoder/encoder.h" +#include "system/loggerd/encoder/encoder.h" #define BUF_IN_COUNT 7 #define BUF_OUT_COUNT 6 diff --git a/system/loggerd/logger.h b/system/loggerd/logger.h new file mode 100644 index 000000000..e7594cee8 --- /dev/null +++ b/system/loggerd/logger.h @@ -0,0 +1,80 @@ +#pragma once + +#include +#include + +#include +#include +#include + +#include +#include + +#include "cereal/messaging/messaging.h" +#include "common/util.h" +#include "common/swaglog.h" +#include "system/hardware/hw.h" + +const std::string LOG_ROOT = Path::log_root(); + +#define LOGGER_MAX_HANDLES 16 + +class RawFile { + public: + RawFile(const char* path) { + file = util::safe_fopen(path, "wb"); + assert(file != nullptr); + } + ~RawFile() { + util::safe_fflush(file); + int err = fclose(file); + assert(err == 0); + } + inline void write(void* data, size_t size) { + int written = util::safe_fwrite(data, 1, size, file); + assert(written == size); + } + inline void write(kj::ArrayPtr array) { write(array.begin(), array.size()); } + + private: + FILE* file = nullptr; +}; + +typedef cereal::Sentinel::SentinelType SentinelType; + +typedef struct LoggerHandle { + pthread_mutex_t lock; + SentinelType end_sentinel_type; + int exit_signal; + int refcnt; + char segment_path[4096]; + char log_path[4096]; + char qlog_path[4096]; + char lock_path[4096]; + std::unique_ptr log, q_log; +} LoggerHandle; + +typedef struct LoggerState { + pthread_mutex_t lock; + int part; + kj::Array init_data; + std::string route_name; + char log_name[64]; + bool has_qlog; + + LoggerHandle handles[LOGGER_MAX_HANDLES]; + LoggerHandle* cur_handle; +} LoggerState; + +kj::Array logger_build_init_data(); +std::string logger_get_route_name(); +void logger_init(LoggerState *s, bool has_qlog); +int logger_next(LoggerState *s, const char* root_path, + char* out_segment_path, size_t out_segment_path_len, + int* out_part); +LoggerHandle* logger_get_handle(LoggerState *s); +void logger_close(LoggerState *s, ExitHandler *exit_handler=nullptr); +void logger_log(LoggerState *s, uint8_t* data, size_t data_size, bool in_qlog); + +void lh_log(LoggerHandle* h, uint8_t* data, size_t data_size, bool in_qlog); +void lh_close(LoggerHandle* h); diff --git a/system/loggerd/loggerd.h b/system/loggerd/loggerd.h new file mode 100644 index 000000000..1b8f9e0d2 --- /dev/null +++ b/system/loggerd/loggerd.h @@ -0,0 +1,103 @@ +#pragma once + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "cereal/messaging/messaging.h" +#include "cereal/services.h" +#include "cereal/visionipc/visionipc.h" +#include "cereal/visionipc/visionipc_client.h" +#include "system/camerad/cameras/camera_common.h" +#include "common/params.h" +#include "common/swaglog.h" +#include "common/timing.h" +#include "common/util.h" +#include "system/hardware/hw.h" + +#include "system/loggerd/encoder/encoder.h" +#include "system/loggerd/logger.h" +#ifdef QCOM2 +#include "system/loggerd/encoder/v4l_encoder.h" +#define Encoder V4LEncoder +#else +#include "system/loggerd/encoder/ffmpeg_encoder.h" +#define Encoder FfmpegEncoder +#endif + +constexpr int MAIN_FPS = 20; +const int MAIN_BITRATE = 10000000; +const int DCAM_BITRATE = MAIN_BITRATE; + +#define NO_CAMERA_PATIENCE 500 // fall back to time-based rotation if all cameras are dead + +const bool LOGGERD_TEST = getenv("LOGGERD_TEST"); +const int SEGMENT_LENGTH = LOGGERD_TEST ? atoi(getenv("LOGGERD_SEGMENT_LENGTH")) : 60; + +struct LogCameraInfo { + CameraType type; + const char *filename; + VisionStreamType stream_type; + int frame_width, frame_height; + int fps; + int bitrate; + bool is_h265; + bool has_qcamera; + bool record; +}; + +const LogCameraInfo cameras_logged[] = { + { + .type = RoadCam, + .stream_type = VISION_STREAM_ROAD, + .filename = "fcamera.hevc", + .fps = MAIN_FPS, + .bitrate = MAIN_BITRATE, + .is_h265 = true, + .has_qcamera = true, + .record = true, + .frame_width = 1928, + .frame_height = 1208, + }, + { + .type = DriverCam, + .stream_type = VISION_STREAM_DRIVER, + .filename = "dcamera.hevc", + .fps = MAIN_FPS, + .bitrate = DCAM_BITRATE, + .is_h265 = true, + .has_qcamera = false, + .record = Params().getBool("RecordFront"), + .frame_width = 1928, + .frame_height = 1208, + }, + { + .type = WideRoadCam, + .stream_type = VISION_STREAM_WIDE_ROAD, + .filename = "ecamera.hevc", + .fps = MAIN_FPS, + .bitrate = MAIN_BITRATE, + .is_h265 = true, + .has_qcamera = false, + .record = true, + .frame_width = 1928, + .frame_height = 1208, + }, +}; +const LogCameraInfo qcam_info = { + .filename = "qcamera.ts", + .fps = MAIN_FPS, + .bitrate = 256000, + .is_h265 = false, + .record = true, + .frame_width = 526, + .frame_height = 330, +}; diff --git a/system/loggerd/uploader.py b/system/loggerd/uploader.py new file mode 100644 index 000000000..d4ed6dca2 --- /dev/null +++ b/system/loggerd/uploader.py @@ -0,0 +1,287 @@ +#!/usr/bin/env python3 +import bz2 +import io +import json +import os +import random +import requests +import threading +import time +import traceback +from pathlib import Path + +from cereal import log +import cereal.messaging as messaging +from common.api import Api +from common.params import Params +from common.realtime import set_core_affinity +from system.hardware import TICI +from system.loggerd.xattr_cache import getxattr, setxattr +from system.loggerd.config import ROOT +from system.swaglog import cloudlog + +NetworkType = log.DeviceState.NetworkType +UPLOAD_ATTR_NAME = 'user.upload' +UPLOAD_ATTR_VALUE = b'1' + +UPLOAD_QLOG_QCAM_MAX_SIZE = 100 * 1e6 # MB + +allow_sleep = bool(os.getenv("UPLOADER_SLEEP", "1")) +force_wifi = os.getenv("FORCEWIFI") is not None +fake_upload = os.getenv("FAKEUPLOAD") is not None + + +def get_directory_sort(d): + return list(map(lambda s: s.rjust(10, '0'), d.rsplit('--', 1))) + +def listdir_by_creation(d): + try: + paths = os.listdir(d) + paths = sorted(paths, key=get_directory_sort) + return paths + except OSError: + cloudlog.exception("listdir_by_creation failed") + return list() + +def clear_locks(root): + for logname in os.listdir(root): + path = os.path.join(root, logname) + try: + for fname in os.listdir(path): + if fname.endswith(".lock"): + os.unlink(os.path.join(path, fname)) + except OSError: + cloudlog.exception("clear_locks failed") + + +class Uploader(): + def __init__(self, dongle_id, root): + self.dongle_id = dongle_id + self.api = Api(dongle_id) + self.root = root + + self.upload_thread = None + + self.last_resp = None + self.last_exc = None + + self.immediate_size = 0 + self.immediate_count = 0 + + # stats for last successfully uploaded file + self.last_time = 0.0 + self.last_speed = 0.0 + self.last_filename = "" + + self.immediate_folders = ["crash/", "boot/"] + self.immediate_priority = {"qlog": 0, "qlog.bz2": 0, "qcamera.ts": 1} + + def get_upload_sort(self, name): + if name in self.immediate_priority: + return self.immediate_priority[name] + return 1000 + + def list_upload_files(self): + if not os.path.isdir(self.root): + return + + self.immediate_size = 0 + self.immediate_count = 0 + + for logname in listdir_by_creation(self.root): + path = os.path.join(self.root, logname) + try: + names = os.listdir(path) + except OSError: + continue + + if any(name.endswith(".lock") for name in names): + continue + + for name in sorted(names, key=self.get_upload_sort): + key = os.path.join(logname, name) + fn = os.path.join(path, name) + # skip files already uploaded + try: + is_uploaded = getxattr(fn, UPLOAD_ATTR_NAME) + except OSError: + cloudlog.event("uploader_getxattr_failed", exc=self.last_exc, key=key, fn=fn) + is_uploaded = True # deleter could have deleted + if is_uploaded: + continue + + try: + if name in self.immediate_priority: + self.immediate_count += 1 + self.immediate_size += os.path.getsize(fn) + except OSError: + pass + + yield (name, key, fn) + + def next_file_to_upload(self): + upload_files = list(self.list_upload_files()) + + for name, key, fn in upload_files: + if any(f in fn for f in self.immediate_folders): + return (name, key, fn) + + for name, key, fn in upload_files: + if name in self.immediate_priority: + return (name, key, fn) + + return None + + def do_upload(self, key, fn): + try: + url_resp = self.api.get("v1.4/" + self.dongle_id + "/upload_url/", timeout=10, path=key, access_token=self.api.get_token()) + if url_resp.status_code == 412: + self.last_resp = url_resp + return + + url_resp_json = json.loads(url_resp.text) + url = url_resp_json['url'] + headers = url_resp_json['headers'] + cloudlog.debug("upload_url v1.4 %s %s", url, str(headers)) + + if fake_upload: + cloudlog.debug(f"*** WARNING, THIS IS A FAKE UPLOAD TO {url} ***") + + class FakeResponse(): + def __init__(self): + self.status_code = 200 + + self.last_resp = FakeResponse() + else: + with open(fn, "rb") as f: + if key.endswith('.bz2') and not fn.endswith('.bz2'): + data = bz2.compress(f.read()) + data = io.BytesIO(data) + else: + data = f + + self.last_resp = requests.put(url, data=data, headers=headers, timeout=10) + except Exception as e: + self.last_exc = (e, traceback.format_exc()) + raise + + def normal_upload(self, key, fn): + self.last_resp = None + self.last_exc = None + + try: + self.do_upload(key, fn) + except Exception: + pass + + return self.last_resp + + def upload(self, name, key, fn, network_type, metered): + try: + sz = os.path.getsize(fn) + except OSError: + cloudlog.exception("upload: getsize failed") + return False + + cloudlog.event("upload_start", key=key, fn=fn, sz=sz, network_type=network_type, metered=metered) + + if sz == 0: + # tag files of 0 size as uploaded + success = True + elif name in self.immediate_priority and sz > UPLOAD_QLOG_QCAM_MAX_SIZE: + cloudlog.event("uploader_too_large", key=key, fn=fn, sz=sz) + success = True + else: + start_time = time.monotonic() + stat = self.normal_upload(key, fn) + if stat is not None and stat.status_code in (200, 201, 401, 403, 412): + self.last_filename = fn + self.last_time = time.monotonic() - start_time + self.last_speed = (sz / 1e6) / self.last_time + success = True + cloudlog.event("upload_success" if stat.status_code != 412 else "upload_ignored", key=key, fn=fn, sz=sz, network_type=network_type, metered=metered) + else: + success = False + cloudlog.event("upload_failed", stat=stat, exc=self.last_exc, key=key, fn=fn, sz=sz, network_type=network_type, metered=metered) + + if success: + # tag file as uploaded + try: + setxattr(fn, UPLOAD_ATTR_NAME, UPLOAD_ATTR_VALUE) + except OSError: + cloudlog.event("uploader_setxattr_failed", exc=self.last_exc, key=key, fn=fn, sz=sz) + + return success + + def get_msg(self): + msg = messaging.new_message("uploaderState") + us = msg.uploaderState + us.immediateQueueSize = int(self.immediate_size / 1e6) + us.immediateQueueCount = self.immediate_count + us.lastTime = self.last_time + us.lastSpeed = self.last_speed + us.lastFilename = self.last_filename + return msg + + +def uploader_fn(exit_event): + try: + set_core_affinity([0, 1, 2, 3]) + except Exception: + cloudlog.exception("failed to set core affinity") + + clear_locks(ROOT) + + params = Params() + dongle_id = params.get("DongleId", encoding='utf8') + + if dongle_id is None: + cloudlog.info("uploader missing dongle_id") + raise Exception("uploader can't start without dongle id") + + if TICI and not Path("/data/media").is_mount(): + cloudlog.warning("NVME not mounted") + + sm = messaging.SubMaster(['deviceState']) + pm = messaging.PubMaster(['uploaderState']) + uploader = Uploader(dongle_id, ROOT) + + backoff = 0.1 + while not exit_event.is_set(): + sm.update(0) + offroad = params.get_bool("IsOffroad") + network_type = sm['deviceState'].networkType if not force_wifi else NetworkType.wifi + if network_type == NetworkType.none: + if allow_sleep: + time.sleep(60 if offroad else 5) + continue + + d = uploader.next_file_to_upload() + if d is None: # Nothing to upload + if allow_sleep: + time.sleep(60 if offroad else 5) + continue + + name, key, fn = d + + # qlogs and bootlogs need to be compressed before uploading + if key.endswith(('qlog', 'rlog')) or (key.startswith('boot/') and not key.endswith('.bz2')): + key += ".bz2" + + success = uploader.upload(name, key, fn, sm['deviceState'].networkType.raw, sm['deviceState'].networkMetered) + if success: + backoff = 0.1 + elif allow_sleep: + cloudlog.info("upload backoff %r", backoff) + time.sleep(backoff + random.uniform(0, backoff)) + backoff = min(backoff*2, 120) + + pm.send("uploaderState", uploader.get_msg()) + + +def main(): + uploader_fn(threading.Event()) + + +if __name__ == "__main__": + main() diff --git a/selfdrive/loggerd/video_writer.h b/system/loggerd/video_writer.h similarity index 100% rename from selfdrive/loggerd/video_writer.h rename to system/loggerd/video_writer.h diff --git a/system/loggerd/xattr_cache.py b/system/loggerd/xattr_cache.py new file mode 100644 index 000000000..95e39f203 --- /dev/null +++ b/system/loggerd/xattr_cache.py @@ -0,0 +1,23 @@ +import os +import errno +from typing import Dict, Tuple, Optional + +_cached_attributes: Dict[Tuple, Optional[bytes]] = {} + +def getxattr(path: str, attr_name: str) -> Optional[bytes]: + key = (path, attr_name) + if key not in _cached_attributes: + try: + response = os.getxattr(path, attr_name) + except OSError as e: + # ENODATA means attribute hasn't been set + if e.errno == errno.ENODATA: + response = None + else: + raise + _cached_attributes[key] = response + return _cached_attributes[key] + +def setxattr(path: str, attr_name: str, attr_value: bytes) -> None: + _cached_attributes.pop((path, attr_name), None) + return os.setxattr(path, attr_name, attr_value) diff --git a/system/micd.py b/system/micd.py index a56140e3b..97ba0c262 100755 --- a/system/micd.py +++ b/system/micd.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -import sounddevice as sd import numpy as np from cereal import messaging @@ -84,11 +83,11 @@ class Mic: self.measurements = self.measurements[FFT_SAMPLES:] - def micd_thread(self, device=None): - if device is None: - device = "sysdefault" + def micd_thread(self): + # sounddevice must be imported after forking processes + import sounddevice as sd # pylint: disable=import-outside-toplevel - with sd.InputStream(device=device, channels=1, samplerate=SAMPLE_RATE, callback=self.callback) as stream: + with sd.InputStream(channels=1, samplerate=SAMPLE_RATE, callback=self.callback) as stream: cloudlog.info(f"micd stream started: {stream.samplerate=} {stream.channels=} {stream.dtype=} {stream.device=}") while True: self.update() diff --git a/system/sensord/.gitignore b/system/sensord/.gitignore new file mode 100644 index 000000000..e9b8071b4 --- /dev/null +++ b/system/sensord/.gitignore @@ -0,0 +1 @@ +_sensord diff --git a/system/sensord/_sensord b/system/sensord/_sensord new file mode 100755 index 000000000..f07f079a3 Binary files /dev/null and b/system/sensord/_sensord differ diff --git a/selfdrive/sensord/pigeond.py b/system/sensord/pigeond.py similarity index 97% rename from selfdrive/sensord/pigeond.py rename to system/sensord/pigeond.py index f56af1c70..c9ad7ff22 100755 --- a/selfdrive/sensord/pigeond.py +++ b/system/sensord/pigeond.py @@ -123,7 +123,7 @@ class TTYPigeon(): init_baudrate(self) # clear configuration - self.send_with_ack(b"\xb5\x62\x06\x09\x0d\x00\x00\x00\x1f\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x17\x71\x5b") + self.send_with_ack(b"\xb5\x62\x06\x09\x0d\x00\x1f\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x17\x71\xd7") # clear flash memory (almanac backup) self.send_with_ack(b"\xB5\x62\x09\x14\x04\x00\x01\x00\x00\x00\x22\xf0") @@ -183,6 +183,7 @@ def initialize_pigeon(pigeon: TTYPigeon) -> bool: pigeon.send_with_ack(b"\xB5\x62\x06\x01\x03\x00\x02\x13\x01\x20\x6C") pigeon.send_with_ack(b"\xB5\x62\x06\x01\x03\x00\x0A\x09\x01\x1E\x70") pigeon.send_with_ack(b"\xB5\x62\x06\x01\x03\x00\x0A\x0B\x01\x20\x74") + pigeon.send_with_ack(b"\xB5\x62\x06\x01\x03\x00\x01\x35\x01\x41\xAD") cloudlog.debug("pigeon configured") # try restoring almanac backup @@ -303,8 +304,7 @@ def main(): pigeon, pm = create_pigeon() init_baudrate(pigeon) - r = initialize_pigeon(pigeon) - Params().put_bool("UbloxAvailable", r) + initialize_pigeon(pigeon) # start receiving data run_receiving(pigeon, pm) diff --git a/selfdrive/sensord/sensord b/system/sensord/sensord similarity index 100% rename from selfdrive/sensord/sensord rename to system/sensord/sensord diff --git a/selfdrive/sensord/sensors/bmx055_accel.h b/system/sensord/sensors/bmx055_accel.h similarity index 96% rename from selfdrive/sensord/sensors/bmx055_accel.h rename to system/sensord/sensors/bmx055_accel.h index 8ef660a99..2cc316e99 100644 --- a/selfdrive/sensord/sensors/bmx055_accel.h +++ b/system/sensord/sensors/bmx055_accel.h @@ -1,6 +1,6 @@ #pragma once -#include "selfdrive/sensord/sensors/i2c_sensor.h" +#include "system/sensord/sensors/i2c_sensor.h" // Address of the chip on the bus #define BMX055_ACCEL_I2C_ADDR 0x18 diff --git a/selfdrive/sensord/sensors/bmx055_gyro.h b/system/sensord/sensors/bmx055_gyro.h similarity index 95% rename from selfdrive/sensord/sensors/bmx055_gyro.h rename to system/sensord/sensors/bmx055_gyro.h index 80b93f128..7be3e5656 100644 --- a/selfdrive/sensord/sensors/bmx055_gyro.h +++ b/system/sensord/sensors/bmx055_gyro.h @@ -1,6 +1,6 @@ #pragma once -#include "selfdrive/sensord/sensors/i2c_sensor.h" +#include "system/sensord/sensors/i2c_sensor.h" // Address of the chip on the bus #define BMX055_GYRO_I2C_ADDR 0x68 diff --git a/selfdrive/sensord/sensors/bmx055_magn.h b/system/sensord/sensors/bmx055_magn.h similarity index 97% rename from selfdrive/sensord/sensors/bmx055_magn.h rename to system/sensord/sensors/bmx055_magn.h index e4a79bc7e..15c4e734b 100644 --- a/selfdrive/sensord/sensors/bmx055_magn.h +++ b/system/sensord/sensors/bmx055_magn.h @@ -1,7 +1,7 @@ #pragma once #include -#include "selfdrive/sensord/sensors/i2c_sensor.h" +#include "system/sensord/sensors/i2c_sensor.h" // Address of the chip on the bus #define BMX055_MAGN_I2C_ADDR 0x10 diff --git a/selfdrive/sensord/sensors/bmx055_temp.h b/system/sensord/sensors/bmx055_temp.h similarity index 71% rename from selfdrive/sensord/sensors/bmx055_temp.h rename to system/sensord/sensors/bmx055_temp.h index 0b6802dea..a2eabae39 100644 --- a/selfdrive/sensord/sensors/bmx055_temp.h +++ b/system/sensord/sensors/bmx055_temp.h @@ -1,7 +1,7 @@ #pragma once -#include "selfdrive/sensord/sensors/bmx055_accel.h" -#include "selfdrive/sensord/sensors/i2c_sensor.h" +#include "system/sensord/sensors/bmx055_accel.h" +#include "system/sensord/sensors/i2c_sensor.h" class BMX055_Temp : public I2CSensor { uint8_t get_device_address() {return BMX055_ACCEL_I2C_ADDR;} diff --git a/selfdrive/sensord/sensors/constants.h b/system/sensord/sensors/constants.h similarity index 100% rename from selfdrive/sensord/sensors/constants.h rename to system/sensord/sensors/constants.h diff --git a/selfdrive/sensord/sensors/file_sensor.h b/system/sensord/sensors/file_sensor.h similarity index 88% rename from selfdrive/sensord/sensors/file_sensor.h rename to system/sensord/sensors/file_sensor.h index 39d695167..07d7e8f94 100644 --- a/selfdrive/sensord/sensors/file_sensor.h +++ b/system/sensord/sensors/file_sensor.h @@ -4,7 +4,7 @@ #include #include "cereal/gen/cpp/log.capnp.h" -#include "selfdrive/sensord/sensors/sensor.h" +#include "system/sensord/sensors/sensor.h" class FileSensor : public Sensor { protected: diff --git a/selfdrive/sensord/sensors/i2c_sensor.h b/system/sensord/sensors/i2c_sensor.h similarity index 93% rename from selfdrive/sensord/sensors/i2c_sensor.h rename to system/sensord/sensors/i2c_sensor.h index 08ca6f09c..ccac526c1 100644 --- a/selfdrive/sensord/sensors/i2c_sensor.h +++ b/system/sensord/sensors/i2c_sensor.h @@ -8,8 +8,8 @@ #include "common/gpio.h" #include "common/swaglog.h" -#include "selfdrive/sensord/sensors/constants.h" -#include "selfdrive/sensord/sensors/sensor.h" +#include "system/sensord/sensors/constants.h" +#include "system/sensord/sensors/sensor.h" int16_t read_12_bit(uint8_t lsb, uint8_t msb); int16_t read_16_bit(uint8_t lsb, uint8_t msb); diff --git a/selfdrive/sensord/sensors/light_sensor.h b/system/sensord/sensors/light_sensor.h similarity index 100% rename from selfdrive/sensord/sensors/light_sensor.h rename to system/sensord/sensors/light_sensor.h diff --git a/selfdrive/sensord/sensors/lsm6ds3_accel.h b/system/sensord/sensors/lsm6ds3_accel.h similarity index 97% rename from selfdrive/sensord/sensors/lsm6ds3_accel.h rename to system/sensord/sensors/lsm6ds3_accel.h index c3f66f580..69667cb75 100644 --- a/selfdrive/sensord/sensors/lsm6ds3_accel.h +++ b/system/sensord/sensors/lsm6ds3_accel.h @@ -1,6 +1,6 @@ #pragma once -#include "selfdrive/sensord/sensors/i2c_sensor.h" +#include "system/sensord/sensors/i2c_sensor.h" // Address of the chip on the bus #define LSM6DS3_ACCEL_I2C_ADDR 0x6A diff --git a/selfdrive/sensord/sensors/lsm6ds3_gyro.h b/system/sensord/sensors/lsm6ds3_gyro.h similarity index 96% rename from selfdrive/sensord/sensors/lsm6ds3_gyro.h rename to system/sensord/sensors/lsm6ds3_gyro.h index 220e6b0ce..adaae62dd 100644 --- a/selfdrive/sensord/sensors/lsm6ds3_gyro.h +++ b/system/sensord/sensors/lsm6ds3_gyro.h @@ -1,6 +1,6 @@ #pragma once -#include "selfdrive/sensord/sensors/i2c_sensor.h" +#include "system/sensord/sensors/i2c_sensor.h" // Address of the chip on the bus #define LSM6DS3_GYRO_I2C_ADDR 0x6A diff --git a/selfdrive/sensord/sensors/lsm6ds3_temp.h b/system/sensord/sensors/lsm6ds3_temp.h similarity index 92% rename from selfdrive/sensord/sensors/lsm6ds3_temp.h rename to system/sensord/sensors/lsm6ds3_temp.h index 1d6bcc228..1b5b62181 100644 --- a/selfdrive/sensord/sensors/lsm6ds3_temp.h +++ b/system/sensord/sensors/lsm6ds3_temp.h @@ -1,6 +1,6 @@ #pragma once -#include "selfdrive/sensord/sensors/i2c_sensor.h" +#include "system/sensord/sensors/i2c_sensor.h" // Address of the chip on the bus #define LSM6DS3_TEMP_I2C_ADDR 0x6A diff --git a/selfdrive/sensord/sensors/mmc5603nj_magn.h b/system/sensord/sensors/mmc5603nj_magn.h similarity index 94% rename from selfdrive/sensord/sensors/mmc5603nj_magn.h rename to system/sensord/sensors/mmc5603nj_magn.h index a364c7c37..fce3f3fec 100644 --- a/selfdrive/sensord/sensors/mmc5603nj_magn.h +++ b/system/sensord/sensors/mmc5603nj_magn.h @@ -1,6 +1,6 @@ #pragma once -#include "selfdrive/sensord/sensors/i2c_sensor.h" +#include "system/sensord/sensors/i2c_sensor.h" // Address of the chip on the bus #define MMC5603NJ_I2C_ADDR 0x30 diff --git a/selfdrive/sensord/sensors/sensor.h b/system/sensord/sensors/sensor.h similarity index 100% rename from selfdrive/sensord/sensors/sensor.h rename to system/sensord/sensors/sensor.h diff --git a/system/ubloxd/.gitignore b/system/ubloxd/.gitignore new file mode 100644 index 000000000..05263ff67 --- /dev/null +++ b/system/ubloxd/.gitignore @@ -0,0 +1,2 @@ +ubloxd +tests/test_glonass_runner diff --git a/system/ubloxd/generated/glonass.cpp b/system/ubloxd/generated/glonass.cpp new file mode 100644 index 000000000..cd0f96ab6 --- /dev/null +++ b/system/ubloxd/generated/glonass.cpp @@ -0,0 +1,353 @@ +// This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild + +#include "glonass.h" + +glonass_t::glonass_t(kaitai::kstream* p__io, kaitai::kstruct* p__parent, glonass_t* p__root) : kaitai::kstruct(p__io) { + m__parent = p__parent; + m__root = this; + + try { + _read(); + } catch(...) { + _clean_up(); + throw; + } +} + +void glonass_t::_read() { + m_idle_chip = m__io->read_bits_int_be(1); + m_string_number = m__io->read_bits_int_be(4); + //m__io->align_to_byte(); + switch (string_number()) { + case 4: { + m_data = new string_4_t(m__io, this, m__root); + break; + } + case 1: { + m_data = new string_1_t(m__io, this, m__root); + break; + } + case 3: { + m_data = new string_3_t(m__io, this, m__root); + break; + } + case 5: { + m_data = new string_5_t(m__io, this, m__root); + break; + } + case 2: { + m_data = new string_2_t(m__io, this, m__root); + break; + } + default: { + m_data = new string_non_immediate_t(m__io, this, m__root); + break; + } + } + m_hamming_code = m__io->read_bits_int_be(8); + m_pad_1 = m__io->read_bits_int_be(11); + m_superframe_number = m__io->read_bits_int_be(16); + m_pad_2 = m__io->read_bits_int_be(8); + m_frame_number = m__io->read_bits_int_be(8); +} + +glonass_t::~glonass_t() { + _clean_up(); +} + +void glonass_t::_clean_up() { + if (m_data) { + delete m_data; m_data = 0; + } +} + +glonass_t::string_4_t::string_4_t(kaitai::kstream* p__io, glonass_t* p__parent, glonass_t* p__root) : kaitai::kstruct(p__io) { + m__parent = p__parent; + m__root = p__root; + f_tau_n = false; + f_delta_tau_n = false; + + try { + _read(); + } catch(...) { + _clean_up(); + throw; + } +} + +void glonass_t::string_4_t::_read() { + m_tau_n_sign = m__io->read_bits_int_be(1); + m_tau_n_value = m__io->read_bits_int_be(21); + m_delta_tau_n_sign = m__io->read_bits_int_be(1); + m_delta_tau_n_value = m__io->read_bits_int_be(4); + m_e_n = m__io->read_bits_int_be(5); + m_not_used_1 = m__io->read_bits_int_be(14); + m_p4 = m__io->read_bits_int_be(1); + m_f_t = m__io->read_bits_int_be(4); + m_not_used_2 = m__io->read_bits_int_be(3); + m_n_t = m__io->read_bits_int_be(11); + m_n = m__io->read_bits_int_be(5); + m_m = m__io->read_bits_int_be(2); +} + +glonass_t::string_4_t::~string_4_t() { + _clean_up(); +} + +void glonass_t::string_4_t::_clean_up() { +} + +int32_t glonass_t::string_4_t::tau_n() { + if (f_tau_n) + return m_tau_n; + m_tau_n = ((tau_n_sign()) ? ((tau_n_value() * -1)) : (tau_n_value())); + f_tau_n = true; + return m_tau_n; +} + +int32_t glonass_t::string_4_t::delta_tau_n() { + if (f_delta_tau_n) + return m_delta_tau_n; + m_delta_tau_n = ((delta_tau_n_sign()) ? ((delta_tau_n_value() * -1)) : (delta_tau_n_value())); + f_delta_tau_n = true; + return m_delta_tau_n; +} + +glonass_t::string_non_immediate_t::string_non_immediate_t(kaitai::kstream* p__io, glonass_t* p__parent, glonass_t* p__root) : kaitai::kstruct(p__io) { + m__parent = p__parent; + m__root = p__root; + + try { + _read(); + } catch(...) { + _clean_up(); + throw; + } +} + +void glonass_t::string_non_immediate_t::_read() { + m_data_1 = m__io->read_bits_int_be(64); + m_data_2 = m__io->read_bits_int_be(8); +} + +glonass_t::string_non_immediate_t::~string_non_immediate_t() { + _clean_up(); +} + +void glonass_t::string_non_immediate_t::_clean_up() { +} + +glonass_t::string_5_t::string_5_t(kaitai::kstream* p__io, glonass_t* p__parent, glonass_t* p__root) : kaitai::kstruct(p__io) { + m__parent = p__parent; + m__root = p__root; + + try { + _read(); + } catch(...) { + _clean_up(); + throw; + } +} + +void glonass_t::string_5_t::_read() { + m_n_a = m__io->read_bits_int_be(11); + m_tau_c = m__io->read_bits_int_be(32); + m_not_used = m__io->read_bits_int_be(1); + m_n_4 = m__io->read_bits_int_be(5); + m_tau_gps = m__io->read_bits_int_be(22); + m_l_n = m__io->read_bits_int_be(1); +} + +glonass_t::string_5_t::~string_5_t() { + _clean_up(); +} + +void glonass_t::string_5_t::_clean_up() { +} + +glonass_t::string_1_t::string_1_t(kaitai::kstream* p__io, glonass_t* p__parent, glonass_t* p__root) : kaitai::kstruct(p__io) { + m__parent = p__parent; + m__root = p__root; + f_x_vel = false; + f_x_accel = false; + f_x = false; + + try { + _read(); + } catch(...) { + _clean_up(); + throw; + } +} + +void glonass_t::string_1_t::_read() { + m_not_used = m__io->read_bits_int_be(2); + m_p1 = m__io->read_bits_int_be(2); + m_t_k = m__io->read_bits_int_be(12); + m_x_vel_sign = m__io->read_bits_int_be(1); + m_x_vel_value = m__io->read_bits_int_be(23); + m_x_accel_sign = m__io->read_bits_int_be(1); + m_x_accel_value = m__io->read_bits_int_be(4); + m_x_sign = m__io->read_bits_int_be(1); + m_x_value = m__io->read_bits_int_be(26); +} + +glonass_t::string_1_t::~string_1_t() { + _clean_up(); +} + +void glonass_t::string_1_t::_clean_up() { +} + +int32_t glonass_t::string_1_t::x_vel() { + if (f_x_vel) + return m_x_vel; + m_x_vel = ((x_vel_sign()) ? ((x_vel_value() * -1)) : (x_vel_value())); + f_x_vel = true; + return m_x_vel; +} + +int32_t glonass_t::string_1_t::x_accel() { + if (f_x_accel) + return m_x_accel; + m_x_accel = ((x_accel_sign()) ? ((x_accel_value() * -1)) : (x_accel_value())); + f_x_accel = true; + return m_x_accel; +} + +int32_t glonass_t::string_1_t::x() { + if (f_x) + return m_x; + m_x = ((x_sign()) ? ((x_value() * -1)) : (x_value())); + f_x = true; + return m_x; +} + +glonass_t::string_2_t::string_2_t(kaitai::kstream* p__io, glonass_t* p__parent, glonass_t* p__root) : kaitai::kstruct(p__io) { + m__parent = p__parent; + m__root = p__root; + f_y_vel = false; + f_y_accel = false; + f_y = false; + + try { + _read(); + } catch(...) { + _clean_up(); + throw; + } +} + +void glonass_t::string_2_t::_read() { + m_b_n = m__io->read_bits_int_be(3); + m_p2 = m__io->read_bits_int_be(1); + m_t_b = m__io->read_bits_int_be(7); + m_not_used = m__io->read_bits_int_be(5); + m_y_vel_sign = m__io->read_bits_int_be(1); + m_y_vel_value = m__io->read_bits_int_be(23); + m_y_accel_sign = m__io->read_bits_int_be(1); + m_y_accel_value = m__io->read_bits_int_be(4); + m_y_sign = m__io->read_bits_int_be(1); + m_y_value = m__io->read_bits_int_be(26); +} + +glonass_t::string_2_t::~string_2_t() { + _clean_up(); +} + +void glonass_t::string_2_t::_clean_up() { +} + +int32_t glonass_t::string_2_t::y_vel() { + if (f_y_vel) + return m_y_vel; + m_y_vel = ((y_vel_sign()) ? ((y_vel_value() * -1)) : (y_vel_value())); + f_y_vel = true; + return m_y_vel; +} + +int32_t glonass_t::string_2_t::y_accel() { + if (f_y_accel) + return m_y_accel; + m_y_accel = ((y_accel_sign()) ? ((y_accel_value() * -1)) : (y_accel_value())); + f_y_accel = true; + return m_y_accel; +} + +int32_t glonass_t::string_2_t::y() { + if (f_y) + return m_y; + m_y = ((y_sign()) ? ((y_value() * -1)) : (y_value())); + f_y = true; + return m_y; +} + +glonass_t::string_3_t::string_3_t(kaitai::kstream* p__io, glonass_t* p__parent, glonass_t* p__root) : kaitai::kstruct(p__io) { + m__parent = p__parent; + m__root = p__root; + f_gamma_n = false; + f_z_vel = false; + f_z_accel = false; + f_z = false; + + try { + _read(); + } catch(...) { + _clean_up(); + throw; + } +} + +void glonass_t::string_3_t::_read() { + m_p3 = m__io->read_bits_int_be(1); + m_gamma_n_sign = m__io->read_bits_int_be(1); + m_gamma_n_value = m__io->read_bits_int_be(10); + m_not_used = m__io->read_bits_int_be(1); + m_p = m__io->read_bits_int_be(2); + m_l_n = m__io->read_bits_int_be(1); + m_z_vel_sign = m__io->read_bits_int_be(1); + m_z_vel_value = m__io->read_bits_int_be(23); + m_z_accel_sign = m__io->read_bits_int_be(1); + m_z_accel_value = m__io->read_bits_int_be(4); + m_z_sign = m__io->read_bits_int_be(1); + m_z_value = m__io->read_bits_int_be(26); +} + +glonass_t::string_3_t::~string_3_t() { + _clean_up(); +} + +void glonass_t::string_3_t::_clean_up() { +} + +int32_t glonass_t::string_3_t::gamma_n() { + if (f_gamma_n) + return m_gamma_n; + m_gamma_n = ((gamma_n_sign()) ? ((gamma_n_value() * -1)) : (gamma_n_value())); + f_gamma_n = true; + return m_gamma_n; +} + +int32_t glonass_t::string_3_t::z_vel() { + if (f_z_vel) + return m_z_vel; + m_z_vel = ((z_vel_sign()) ? ((z_vel_value() * -1)) : (z_vel_value())); + f_z_vel = true; + return m_z_vel; +} + +int32_t glonass_t::string_3_t::z_accel() { + if (f_z_accel) + return m_z_accel; + m_z_accel = ((z_accel_sign()) ? ((z_accel_value() * -1)) : (z_accel_value())); + f_z_accel = true; + return m_z_accel; +} + +int32_t glonass_t::string_3_t::z() { + if (f_z) + return m_z; + m_z = ((z_sign()) ? ((z_value() * -1)) : (z_value())); + f_z = true; + return m_z; +} diff --git a/system/ubloxd/generated/glonass.h b/system/ubloxd/generated/glonass.h new file mode 100644 index 000000000..19867ba22 --- /dev/null +++ b/system/ubloxd/generated/glonass.h @@ -0,0 +1,375 @@ +#ifndef GLONASS_H_ +#define GLONASS_H_ + +// This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild + +#include "kaitai/kaitaistruct.h" +#include + +#if KAITAI_STRUCT_VERSION < 9000L +#error "Incompatible Kaitai Struct C++/STL API: version 0.9 or later is required" +#endif + +class glonass_t : public kaitai::kstruct { + +public: + class string_4_t; + class string_non_immediate_t; + class string_5_t; + class string_1_t; + class string_2_t; + class string_3_t; + + glonass_t(kaitai::kstream* p__io, kaitai::kstruct* p__parent = 0, glonass_t* p__root = 0); + +private: + void _read(); + void _clean_up(); + +public: + ~glonass_t(); + + class string_4_t : public kaitai::kstruct { + + public: + + string_4_t(kaitai::kstream* p__io, glonass_t* p__parent = 0, glonass_t* p__root = 0); + + private: + void _read(); + void _clean_up(); + + public: + ~string_4_t(); + + private: + bool f_tau_n; + int32_t m_tau_n; + + public: + int32_t tau_n(); + + private: + bool f_delta_tau_n; + int32_t m_delta_tau_n; + + public: + int32_t delta_tau_n(); + + private: + bool m_tau_n_sign; + uint64_t m_tau_n_value; + bool m_delta_tau_n_sign; + uint64_t m_delta_tau_n_value; + uint64_t m_e_n; + uint64_t m_not_used_1; + bool m_p4; + uint64_t m_f_t; + uint64_t m_not_used_2; + uint64_t m_n_t; + uint64_t m_n; + uint64_t m_m; + glonass_t* m__root; + glonass_t* m__parent; + + public: + bool tau_n_sign() const { return m_tau_n_sign; } + uint64_t tau_n_value() const { return m_tau_n_value; } + bool delta_tau_n_sign() const { return m_delta_tau_n_sign; } + uint64_t delta_tau_n_value() const { return m_delta_tau_n_value; } + uint64_t e_n() const { return m_e_n; } + uint64_t not_used_1() const { return m_not_used_1; } + bool p4() const { return m_p4; } + uint64_t f_t() const { return m_f_t; } + uint64_t not_used_2() const { return m_not_used_2; } + uint64_t n_t() const { return m_n_t; } + uint64_t n() const { return m_n; } + uint64_t m() const { return m_m; } + glonass_t* _root() const { return m__root; } + glonass_t* _parent() const { return m__parent; } + }; + + class string_non_immediate_t : public kaitai::kstruct { + + public: + + string_non_immediate_t(kaitai::kstream* p__io, glonass_t* p__parent = 0, glonass_t* p__root = 0); + + private: + void _read(); + void _clean_up(); + + public: + ~string_non_immediate_t(); + + private: + uint64_t m_data_1; + uint64_t m_data_2; + glonass_t* m__root; + glonass_t* m__parent; + + public: + uint64_t data_1() const { return m_data_1; } + uint64_t data_2() const { return m_data_2; } + glonass_t* _root() const { return m__root; } + glonass_t* _parent() const { return m__parent; } + }; + + class string_5_t : public kaitai::kstruct { + + public: + + string_5_t(kaitai::kstream* p__io, glonass_t* p__parent = 0, glonass_t* p__root = 0); + + private: + void _read(); + void _clean_up(); + + public: + ~string_5_t(); + + private: + uint64_t m_n_a; + uint64_t m_tau_c; + bool m_not_used; + uint64_t m_n_4; + uint64_t m_tau_gps; + bool m_l_n; + glonass_t* m__root; + glonass_t* m__parent; + + public: + uint64_t n_a() const { return m_n_a; } + uint64_t tau_c() const { return m_tau_c; } + bool not_used() const { return m_not_used; } + uint64_t n_4() const { return m_n_4; } + uint64_t tau_gps() const { return m_tau_gps; } + bool l_n() const { return m_l_n; } + glonass_t* _root() const { return m__root; } + glonass_t* _parent() const { return m__parent; } + }; + + class string_1_t : public kaitai::kstruct { + + public: + + string_1_t(kaitai::kstream* p__io, glonass_t* p__parent = 0, glonass_t* p__root = 0); + + private: + void _read(); + void _clean_up(); + + public: + ~string_1_t(); + + private: + bool f_x_vel; + int32_t m_x_vel; + + public: + int32_t x_vel(); + + private: + bool f_x_accel; + int32_t m_x_accel; + + public: + int32_t x_accel(); + + private: + bool f_x; + int32_t m_x; + + public: + int32_t x(); + + private: + uint64_t m_not_used; + uint64_t m_p1; + uint64_t m_t_k; + bool m_x_vel_sign; + uint64_t m_x_vel_value; + bool m_x_accel_sign; + uint64_t m_x_accel_value; + bool m_x_sign; + uint64_t m_x_value; + glonass_t* m__root; + glonass_t* m__parent; + + public: + uint64_t not_used() const { return m_not_used; } + uint64_t p1() const { return m_p1; } + uint64_t t_k() const { return m_t_k; } + bool x_vel_sign() const { return m_x_vel_sign; } + uint64_t x_vel_value() const { return m_x_vel_value; } + bool x_accel_sign() const { return m_x_accel_sign; } + uint64_t x_accel_value() const { return m_x_accel_value; } + bool x_sign() const { return m_x_sign; } + uint64_t x_value() const { return m_x_value; } + glonass_t* _root() const { return m__root; } + glonass_t* _parent() const { return m__parent; } + }; + + class string_2_t : public kaitai::kstruct { + + public: + + string_2_t(kaitai::kstream* p__io, glonass_t* p__parent = 0, glonass_t* p__root = 0); + + private: + void _read(); + void _clean_up(); + + public: + ~string_2_t(); + + private: + bool f_y_vel; + int32_t m_y_vel; + + public: + int32_t y_vel(); + + private: + bool f_y_accel; + int32_t m_y_accel; + + public: + int32_t y_accel(); + + private: + bool f_y; + int32_t m_y; + + public: + int32_t y(); + + private: + uint64_t m_b_n; + bool m_p2; + uint64_t m_t_b; + uint64_t m_not_used; + bool m_y_vel_sign; + uint64_t m_y_vel_value; + bool m_y_accel_sign; + uint64_t m_y_accel_value; + bool m_y_sign; + uint64_t m_y_value; + glonass_t* m__root; + glonass_t* m__parent; + + public: + uint64_t b_n() const { return m_b_n; } + bool p2() const { return m_p2; } + uint64_t t_b() const { return m_t_b; } + uint64_t not_used() const { return m_not_used; } + bool y_vel_sign() const { return m_y_vel_sign; } + uint64_t y_vel_value() const { return m_y_vel_value; } + bool y_accel_sign() const { return m_y_accel_sign; } + uint64_t y_accel_value() const { return m_y_accel_value; } + bool y_sign() const { return m_y_sign; } + uint64_t y_value() const { return m_y_value; } + glonass_t* _root() const { return m__root; } + glonass_t* _parent() const { return m__parent; } + }; + + class string_3_t : public kaitai::kstruct { + + public: + + string_3_t(kaitai::kstream* p__io, glonass_t* p__parent = 0, glonass_t* p__root = 0); + + private: + void _read(); + void _clean_up(); + + public: + ~string_3_t(); + + private: + bool f_gamma_n; + int32_t m_gamma_n; + + public: + int32_t gamma_n(); + + private: + bool f_z_vel; + int32_t m_z_vel; + + public: + int32_t z_vel(); + + private: + bool f_z_accel; + int32_t m_z_accel; + + public: + int32_t z_accel(); + + private: + bool f_z; + int32_t m_z; + + public: + int32_t z(); + + private: + bool m_p3; + bool m_gamma_n_sign; + uint64_t m_gamma_n_value; + bool m_not_used; + uint64_t m_p; + bool m_l_n; + bool m_z_vel_sign; + uint64_t m_z_vel_value; + bool m_z_accel_sign; + uint64_t m_z_accel_value; + bool m_z_sign; + uint64_t m_z_value; + glonass_t* m__root; + glonass_t* m__parent; + + public: + bool p3() const { return m_p3; } + bool gamma_n_sign() const { return m_gamma_n_sign; } + uint64_t gamma_n_value() const { return m_gamma_n_value; } + bool not_used() const { return m_not_used; } + uint64_t p() const { return m_p; } + bool l_n() const { return m_l_n; } + bool z_vel_sign() const { return m_z_vel_sign; } + uint64_t z_vel_value() const { return m_z_vel_value; } + bool z_accel_sign() const { return m_z_accel_sign; } + uint64_t z_accel_value() const { return m_z_accel_value; } + bool z_sign() const { return m_z_sign; } + uint64_t z_value() const { return m_z_value; } + glonass_t* _root() const { return m__root; } + glonass_t* _parent() const { return m__parent; } + }; + +private: + bool m_idle_chip; + uint64_t m_string_number; + kaitai::kstruct* m_data; + uint64_t m_hamming_code; + uint64_t m_pad_1; + uint64_t m_superframe_number; + uint64_t m_pad_2; + uint64_t m_frame_number; + glonass_t* m__root; + kaitai::kstruct* m__parent; + +public: + bool idle_chip() const { return m_idle_chip; } + uint64_t string_number() const { return m_string_number; } + kaitai::kstruct* data() const { return m_data; } + uint64_t hamming_code() const { return m_hamming_code; } + uint64_t pad_1() const { return m_pad_1; } + uint64_t superframe_number() const { return m_superframe_number; } + uint64_t pad_2() const { return m_pad_2; } + uint64_t frame_number() const { return m_frame_number; } + glonass_t* _root() const { return m__root; } + kaitai::kstruct* _parent() const { return m__parent; } +}; + +#endif // GLONASS_H_ diff --git a/selfdrive/locationd/generated/gps.cpp b/system/ubloxd/generated/gps.cpp similarity index 97% rename from selfdrive/locationd/generated/gps.cpp rename to system/ubloxd/generated/gps.cpp index 9b020735b..8e1cb85b9 100644 --- a/selfdrive/locationd/generated/gps.cpp +++ b/system/ubloxd/generated/gps.cpp @@ -274,9 +274,9 @@ gps_t::tlm_t::tlm_t(kaitai::kstream* p__io, gps_t* p__parent, gps_t* p__root) : } void gps_t::tlm_t::_read() { - m_magic = m__io->read_bytes(1); - if (!(magic() == std::string("\x8B", 1))) { - throw kaitai::validation_not_equal_error(std::string("\x8B", 1), magic(), _io(), std::string("/types/tlm/seq/0")); + m_preamble = m__io->read_bytes(1); + if (!(preamble() == std::string("\x8B", 1))) { + throw kaitai::validation_not_equal_error(std::string("\x8B", 1), preamble(), _io(), std::string("/types/tlm/seq/0")); } m_tlm = m__io->read_bits_int_be(14); m_integrity_status = m__io->read_bits_int_be(1); diff --git a/selfdrive/locationd/generated/gps.h b/system/ubloxd/generated/gps.h similarity index 99% rename from selfdrive/locationd/generated/gps.h rename to system/ubloxd/generated/gps.h index 293e2e4a0..9dfc5031f 100644 --- a/selfdrive/locationd/generated/gps.h +++ b/system/ubloxd/generated/gps.h @@ -273,7 +273,7 @@ public: ~tlm_t(); private: - std::string m_magic; + std::string m_preamble; uint64_t m_tlm; bool m_integrity_status; bool m_reserved; @@ -281,7 +281,7 @@ public: gps_t* m__parent; public: - std::string magic() const { return m_magic; } + std::string preamble() const { return m_preamble; } uint64_t tlm() const { return m_tlm; } bool integrity_status() const { return m_integrity_status; } bool reserved() const { return m_reserved; } diff --git a/selfdrive/locationd/generated/ubx.cpp b/system/ubloxd/generated/ubx.cpp similarity index 97% rename from selfdrive/locationd/generated/ubx.cpp rename to system/ubloxd/generated/ubx.cpp index 5e743e1ee..34fe1e52c 100644 --- a/selfdrive/locationd/generated/ubx.cpp +++ b/system/ubloxd/generated/ubx.cpp @@ -89,13 +89,10 @@ void ubx_t::rxm_rawx_t::_read() { m_num_meas = m__io->read_u1(); m_rec_stat = m__io->read_u1(); m_reserved1 = m__io->read_bytes(3); - int l_measurements = num_meas(); m__raw_measurements = new std::vector(); - m__raw_measurements->reserve(l_measurements); m__io__raw_measurements = new std::vector(); - m__io__raw_measurements->reserve(l_measurements); m_measurements = new std::vector(); - m_measurements->reserve(l_measurements); + const int l_measurements = num_meas(); for (int i = 0; i < l_measurements; i++) { m__raw_measurements->push_back(m__io->read_bytes(32)); kaitai::kstream* io__raw_measurements = new kaitai::kstream(m__raw_measurements->at(m__raw_measurements->size() - 1)); @@ -184,9 +181,8 @@ void ubx_t::rxm_sfrbx_t::_read() { m_reserved2 = m__io->read_bytes(1); m_version = m__io->read_u1(); m_reserved3 = m__io->read_bytes(1); - int l_body = num_words(); m_body = new std::vector(); - m_body->reserve(l_body); + const int l_body = num_words(); for (int i = 0; i < l_body; i++) { m_body->push_back(m__io->read_u4le()); } diff --git a/selfdrive/locationd/generated/ubx.h b/system/ubloxd/generated/ubx.h similarity index 100% rename from selfdrive/locationd/generated/ubx.h rename to system/ubloxd/generated/ubx.h diff --git a/selfdrive/locationd/ublox_msg.h b/system/ubloxd/ublox_msg.h similarity index 78% rename from selfdrive/locationd/ublox_msg.h rename to system/ubloxd/ublox_msg.h index 542e72816..3989bbf85 100644 --- a/selfdrive/locationd/ublox_msg.h +++ b/system/ubloxd/ublox_msg.h @@ -9,8 +9,9 @@ #include "cereal/messaging/messaging.h" #include "common/util.h" -#include "selfdrive/locationd/generated/gps.h" -#include "selfdrive/locationd/generated/ubx.h" +#include "system/ubloxd/generated/gps.h" +#include "system/ubloxd/generated/glonass.h" +#include "system/ubloxd/generated/ubx.h" using namespace std::string_literals; @@ -101,11 +102,22 @@ class UbloxMsgParser { inline bool valid_cheksum(); inline bool valid(); inline bool valid_so_far(); + inline uint16_t get_glonass_year(uint8_t N4, uint16_t Nt); + + kj::Array parse_gps_ephemeris(ubx_t::rxm_sfrbx_t *msg); + kj::Array parse_glonass_ephemeris(ubx_t::rxm_sfrbx_t *msg); std::unordered_map> gps_subframes; size_t bytes_in_parse_buf = 0; uint8_t msg_parse_buf[ublox::UBLOX_HEADER_SIZE + ublox::UBLOX_MAX_MSG_SIZE]; -}; + // user range accuracy in meters + const std::unordered_map glonass_URA_lookup = + {{ 0, 1}, { 1, 2}, { 2, 2.5}, { 3, 4}, { 4, 5}, {5, 7}, + { 6, 10}, { 7, 12}, { 8, 14}, { 9, 16}, {10, 32}, + {11, 64}, {12, 128}, {13, 256}, {14, 512}, {15, 1024}}; + std::unordered_map> glonass_strings; + std::unordered_map glonass_superframes; +}; diff --git a/system/ubloxd/ubloxd b/system/ubloxd/ubloxd new file mode 100755 index 000000000..adb2875d2 Binary files /dev/null and b/system/ubloxd/ubloxd differ diff --git a/system/version.py b/system/version.py index 2fbddb960..cefad6b85 100644 --- a/system/version.py +++ b/system/version.py @@ -7,7 +7,7 @@ from functools import lru_cache from common.basedir import BASEDIR from system.swaglog import cloudlog -RELEASE_BRANCHES = ['release3-staging', 'dashcam3-staging', 'release3', 'dashcam3'] +RELEASE_BRANCHES = ['release3-staging', 'dashcam3-staging', 'dashcam3', 'nightly'] TESTED_BRANCHES = RELEASE_BRANCHES + ['devel', 'devel-staging'] training_version: bytes = b"0.2.0" diff --git a/pyextra/.gitignore b/third_party/.gitignore similarity index 100% rename from pyextra/.gitignore rename to third_party/.gitignore diff --git a/pyextra/acados_template/__init__.py b/third_party/acados/acados_template/__init__.py similarity index 100% rename from pyextra/acados_template/__init__.py rename to third_party/acados/acados_template/__init__.py diff --git a/pyextra/acados_template/acados_layout.json b/third_party/acados/acados_template/acados_layout.json similarity index 100% rename from pyextra/acados_template/acados_layout.json rename to third_party/acados/acados_template/acados_layout.json diff --git a/pyextra/acados_template/acados_model.py b/third_party/acados/acados_template/acados_model.py similarity index 100% rename from pyextra/acados_template/acados_model.py rename to third_party/acados/acados_template/acados_model.py diff --git a/pyextra/acados_template/acados_ocp.py b/third_party/acados/acados_template/acados_ocp.py similarity index 100% rename from pyextra/acados_template/acados_ocp.py rename to third_party/acados/acados_template/acados_ocp.py diff --git a/pyextra/acados_template/acados_ocp_solver.py b/third_party/acados/acados_template/acados_ocp_solver.py similarity index 100% rename from pyextra/acados_template/acados_ocp_solver.py rename to third_party/acados/acados_template/acados_ocp_solver.py diff --git a/pyextra/acados_template/acados_ocp_solver_pyx.pyx b/third_party/acados/acados_template/acados_ocp_solver_pyx.pyx similarity index 100% rename from pyextra/acados_template/acados_ocp_solver_pyx.pyx rename to third_party/acados/acados_template/acados_ocp_solver_pyx.pyx diff --git a/pyextra/acados_template/acados_sim.py b/third_party/acados/acados_template/acados_sim.py similarity index 100% rename from pyextra/acados_template/acados_sim.py rename to third_party/acados/acados_template/acados_sim.py diff --git a/pyextra/acados_template/acados_sim_layout.json b/third_party/acados/acados_template/acados_sim_layout.json similarity index 100% rename from pyextra/acados_template/acados_sim_layout.json rename to third_party/acados/acados_template/acados_sim_layout.json diff --git a/pyextra/acados_template/acados_sim_solver.py b/third_party/acados/acados_template/acados_sim_solver.py similarity index 100% rename from pyextra/acados_template/acados_sim_solver.py rename to third_party/acados/acados_template/acados_sim_solver.py diff --git a/pyextra/acados_template/acados_solver_common.pxd b/third_party/acados/acados_template/acados_solver_common.pxd similarity index 100% rename from pyextra/acados_template/acados_solver_common.pxd rename to third_party/acados/acados_template/acados_solver_common.pxd diff --git a/pyextra/acados_template/builders.py b/third_party/acados/acados_template/builders.py similarity index 100% rename from pyextra/acados_template/builders.py rename to third_party/acados/acados_template/builders.py diff --git a/pyextra/acados_template/c_templates_tera/CMakeLists.in.txt b/third_party/acados/acados_template/c_templates_tera/CMakeLists.in.txt similarity index 100% rename from pyextra/acados_template/c_templates_tera/CMakeLists.in.txt rename to third_party/acados/acados_template/c_templates_tera/CMakeLists.in.txt diff --git a/pyextra/acados_template/c_templates_tera/CPPLINT.cfg b/third_party/acados/acados_template/c_templates_tera/CPPLINT.cfg similarity index 100% rename from pyextra/acados_template/c_templates_tera/CPPLINT.cfg rename to third_party/acados/acados_template/c_templates_tera/CPPLINT.cfg diff --git a/pyextra/acados_template/c_templates_tera/Makefile.in b/third_party/acados/acados_template/c_templates_tera/Makefile.in similarity index 100% rename from pyextra/acados_template/c_templates_tera/Makefile.in rename to third_party/acados/acados_template/c_templates_tera/Makefile.in diff --git a/pyextra/acados_template/c_templates_tera/acados_mex_create.in.c b/third_party/acados/acados_template/c_templates_tera/acados_mex_create.in.c similarity index 100% rename from pyextra/acados_template/c_templates_tera/acados_mex_create.in.c rename to third_party/acados/acados_template/c_templates_tera/acados_mex_create.in.c diff --git a/pyextra/acados_template/c_templates_tera/acados_mex_free.in.c b/third_party/acados/acados_template/c_templates_tera/acados_mex_free.in.c similarity index 100% rename from pyextra/acados_template/c_templates_tera/acados_mex_free.in.c rename to third_party/acados/acados_template/c_templates_tera/acados_mex_free.in.c diff --git a/pyextra/acados_template/c_templates_tera/acados_mex_set.in.c b/third_party/acados/acados_template/c_templates_tera/acados_mex_set.in.c similarity index 100% rename from pyextra/acados_template/c_templates_tera/acados_mex_set.in.c rename to third_party/acados/acados_template/c_templates_tera/acados_mex_set.in.c diff --git a/pyextra/acados_template/c_templates_tera/acados_mex_solve.in.c b/third_party/acados/acados_template/c_templates_tera/acados_mex_solve.in.c similarity index 100% rename from pyextra/acados_template/c_templates_tera/acados_mex_solve.in.c rename to third_party/acados/acados_template/c_templates_tera/acados_mex_solve.in.c diff --git a/pyextra/acados_template/c_templates_tera/acados_sim_solver.in.c b/third_party/acados/acados_template/c_templates_tera/acados_sim_solver.in.c similarity index 100% rename from pyextra/acados_template/c_templates_tera/acados_sim_solver.in.c rename to third_party/acados/acados_template/c_templates_tera/acados_sim_solver.in.c diff --git a/pyextra/acados_template/c_templates_tera/acados_sim_solver.in.h b/third_party/acados/acados_template/c_templates_tera/acados_sim_solver.in.h similarity index 100% rename from pyextra/acados_template/c_templates_tera/acados_sim_solver.in.h rename to third_party/acados/acados_template/c_templates_tera/acados_sim_solver.in.h diff --git a/pyextra/acados_template/c_templates_tera/acados_sim_solver_sfun.in.c b/third_party/acados/acados_template/c_templates_tera/acados_sim_solver_sfun.in.c similarity index 100% rename from pyextra/acados_template/c_templates_tera/acados_sim_solver_sfun.in.c rename to third_party/acados/acados_template/c_templates_tera/acados_sim_solver_sfun.in.c diff --git a/pyextra/acados_template/c_templates_tera/acados_solver.in.c b/third_party/acados/acados_template/c_templates_tera/acados_solver.in.c similarity index 100% rename from pyextra/acados_template/c_templates_tera/acados_solver.in.c rename to third_party/acados/acados_template/c_templates_tera/acados_solver.in.c diff --git a/pyextra/acados_template/c_templates_tera/acados_solver.in.h b/third_party/acados/acados_template/c_templates_tera/acados_solver.in.h similarity index 100% rename from pyextra/acados_template/c_templates_tera/acados_solver.in.h rename to third_party/acados/acados_template/c_templates_tera/acados_solver.in.h diff --git a/pyextra/acados_template/c_templates_tera/acados_solver.in.pxd b/third_party/acados/acados_template/c_templates_tera/acados_solver.in.pxd similarity index 100% rename from pyextra/acados_template/c_templates_tera/acados_solver.in.pxd rename to third_party/acados/acados_template/c_templates_tera/acados_solver.in.pxd diff --git a/pyextra/acados_template/c_templates_tera/acados_solver_sfun.in.c b/third_party/acados/acados_template/c_templates_tera/acados_solver_sfun.in.c similarity index 100% rename from pyextra/acados_template/c_templates_tera/acados_solver_sfun.in.c rename to third_party/acados/acados_template/c_templates_tera/acados_solver_sfun.in.c diff --git a/pyextra/acados_template/c_templates_tera/cost_y_0_fun.in.h b/third_party/acados/acados_template/c_templates_tera/cost_y_0_fun.in.h similarity index 100% rename from pyextra/acados_template/c_templates_tera/cost_y_0_fun.in.h rename to third_party/acados/acados_template/c_templates_tera/cost_y_0_fun.in.h diff --git a/pyextra/acados_template/c_templates_tera/cost_y_e_fun.in.h b/third_party/acados/acados_template/c_templates_tera/cost_y_e_fun.in.h similarity index 100% rename from pyextra/acados_template/c_templates_tera/cost_y_e_fun.in.h rename to third_party/acados/acados_template/c_templates_tera/cost_y_e_fun.in.h diff --git a/pyextra/acados_template/c_templates_tera/cost_y_fun.in.h b/third_party/acados/acados_template/c_templates_tera/cost_y_fun.in.h similarity index 100% rename from pyextra/acados_template/c_templates_tera/cost_y_fun.in.h rename to third_party/acados/acados_template/c_templates_tera/cost_y_fun.in.h diff --git a/pyextra/acados_template/c_templates_tera/external_cost.in.h b/third_party/acados/acados_template/c_templates_tera/external_cost.in.h similarity index 100% rename from pyextra/acados_template/c_templates_tera/external_cost.in.h rename to third_party/acados/acados_template/c_templates_tera/external_cost.in.h diff --git a/pyextra/acados_template/c_templates_tera/external_cost_0.in.h b/third_party/acados/acados_template/c_templates_tera/external_cost_0.in.h similarity index 100% rename from pyextra/acados_template/c_templates_tera/external_cost_0.in.h rename to third_party/acados/acados_template/c_templates_tera/external_cost_0.in.h diff --git a/pyextra/acados_template/c_templates_tera/external_cost_e.in.h b/third_party/acados/acados_template/c_templates_tera/external_cost_e.in.h similarity index 100% rename from pyextra/acados_template/c_templates_tera/external_cost_e.in.h rename to third_party/acados/acados_template/c_templates_tera/external_cost_e.in.h diff --git a/pyextra/acados_template/c_templates_tera/h_constraint.in.h b/third_party/acados/acados_template/c_templates_tera/h_constraint.in.h similarity index 100% rename from pyextra/acados_template/c_templates_tera/h_constraint.in.h rename to third_party/acados/acados_template/c_templates_tera/h_constraint.in.h diff --git a/pyextra/acados_template/c_templates_tera/h_e_constraint.in.h b/third_party/acados/acados_template/c_templates_tera/h_e_constraint.in.h similarity index 100% rename from pyextra/acados_template/c_templates_tera/h_e_constraint.in.h rename to third_party/acados/acados_template/c_templates_tera/h_e_constraint.in.h diff --git a/pyextra/acados_template/c_templates_tera/main.in.c b/third_party/acados/acados_template/c_templates_tera/main.in.c similarity index 100% rename from pyextra/acados_template/c_templates_tera/main.in.c rename to third_party/acados/acados_template/c_templates_tera/main.in.c diff --git a/pyextra/acados_template/c_templates_tera/main_mex.in.c b/third_party/acados/acados_template/c_templates_tera/main_mex.in.c similarity index 100% rename from pyextra/acados_template/c_templates_tera/main_mex.in.c rename to third_party/acados/acados_template/c_templates_tera/main_mex.in.c diff --git a/pyextra/acados_template/c_templates_tera/main_sim.in.c b/third_party/acados/acados_template/c_templates_tera/main_sim.in.c similarity index 100% rename from pyextra/acados_template/c_templates_tera/main_sim.in.c rename to third_party/acados/acados_template/c_templates_tera/main_sim.in.c diff --git a/pyextra/acados_template/c_templates_tera/make_main_mex.in.m b/third_party/acados/acados_template/c_templates_tera/make_main_mex.in.m similarity index 100% rename from pyextra/acados_template/c_templates_tera/make_main_mex.in.m rename to third_party/acados/acados_template/c_templates_tera/make_main_mex.in.m diff --git a/pyextra/acados_template/c_templates_tera/make_mex.in.m b/third_party/acados/acados_template/c_templates_tera/make_mex.in.m similarity index 100% rename from pyextra/acados_template/c_templates_tera/make_mex.in.m rename to third_party/acados/acados_template/c_templates_tera/make_mex.in.m diff --git a/pyextra/acados_template/c_templates_tera/make_sfun.in.m b/third_party/acados/acados_template/c_templates_tera/make_sfun.in.m similarity index 100% rename from pyextra/acados_template/c_templates_tera/make_sfun.in.m rename to third_party/acados/acados_template/c_templates_tera/make_sfun.in.m diff --git a/pyextra/acados_template/c_templates_tera/make_sfun_sim.in.m b/third_party/acados/acados_template/c_templates_tera/make_sfun_sim.in.m similarity index 100% rename from pyextra/acados_template/c_templates_tera/make_sfun_sim.in.m rename to third_party/acados/acados_template/c_templates_tera/make_sfun_sim.in.m diff --git a/pyextra/acados_template/c_templates_tera/mex_solver.in.m b/third_party/acados/acados_template/c_templates_tera/mex_solver.in.m similarity index 100% rename from pyextra/acados_template/c_templates_tera/mex_solver.in.m rename to third_party/acados/acados_template/c_templates_tera/mex_solver.in.m diff --git a/pyextra/acados_template/c_templates_tera/model.in.h b/third_party/acados/acados_template/c_templates_tera/model.in.h similarity index 100% rename from pyextra/acados_template/c_templates_tera/model.in.h rename to third_party/acados/acados_template/c_templates_tera/model.in.h diff --git a/pyextra/acados_template/c_templates_tera/phi_constraint.in.h b/third_party/acados/acados_template/c_templates_tera/phi_constraint.in.h similarity index 100% rename from pyextra/acados_template/c_templates_tera/phi_constraint.in.h rename to third_party/acados/acados_template/c_templates_tera/phi_constraint.in.h diff --git a/pyextra/acados_template/c_templates_tera/phi_e_constraint.in.h b/third_party/acados/acados_template/c_templates_tera/phi_e_constraint.in.h similarity index 100% rename from pyextra/acados_template/c_templates_tera/phi_e_constraint.in.h rename to third_party/acados/acados_template/c_templates_tera/phi_e_constraint.in.h diff --git a/pyextra/acados_template/generate_c_code_constraint.py b/third_party/acados/acados_template/generate_c_code_constraint.py similarity index 100% rename from pyextra/acados_template/generate_c_code_constraint.py rename to third_party/acados/acados_template/generate_c_code_constraint.py diff --git a/pyextra/acados_template/generate_c_code_discrete_dynamics.py b/third_party/acados/acados_template/generate_c_code_discrete_dynamics.py similarity index 100% rename from pyextra/acados_template/generate_c_code_discrete_dynamics.py rename to third_party/acados/acados_template/generate_c_code_discrete_dynamics.py diff --git a/pyextra/acados_template/generate_c_code_explicit_ode.py b/third_party/acados/acados_template/generate_c_code_explicit_ode.py similarity index 100% rename from pyextra/acados_template/generate_c_code_explicit_ode.py rename to third_party/acados/acados_template/generate_c_code_explicit_ode.py diff --git a/pyextra/acados_template/generate_c_code_external_cost.py b/third_party/acados/acados_template/generate_c_code_external_cost.py similarity index 100% rename from pyextra/acados_template/generate_c_code_external_cost.py rename to third_party/acados/acados_template/generate_c_code_external_cost.py diff --git a/pyextra/acados_template/generate_c_code_gnsf.py b/third_party/acados/acados_template/generate_c_code_gnsf.py similarity index 100% rename from pyextra/acados_template/generate_c_code_gnsf.py rename to third_party/acados/acados_template/generate_c_code_gnsf.py diff --git a/pyextra/acados_template/generate_c_code_implicit_ode.py b/third_party/acados/acados_template/generate_c_code_implicit_ode.py similarity index 100% rename from pyextra/acados_template/generate_c_code_implicit_ode.py rename to third_party/acados/acados_template/generate_c_code_implicit_ode.py diff --git a/pyextra/acados_template/generate_c_code_nls_cost.py b/third_party/acados/acados_template/generate_c_code_nls_cost.py similarity index 100% rename from pyextra/acados_template/generate_c_code_nls_cost.py rename to third_party/acados/acados_template/generate_c_code_nls_cost.py diff --git a/pyextra/acados_template/simulink_default_opts.json b/third_party/acados/acados_template/simulink_default_opts.json similarity index 100% rename from pyextra/acados_template/simulink_default_opts.json rename to third_party/acados/acados_template/simulink_default_opts.json diff --git a/pyextra/acados_template/utils.py b/third_party/acados/acados_template/utils.py similarity index 100% rename from pyextra/acados_template/utils.py rename to third_party/acados/acados_template/utils.py diff --git a/third_party/bootstrap/bootstrap-icons.svg b/third_party/bootstrap/bootstrap-icons.svg new file mode 100644 index 000000000..61f2720db --- /dev/null +++ b/third_party/bootstrap/bootstrap-icons.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/third_party/bootstrap/pull.sh b/third_party/bootstrap/pull.sh new file mode 100755 index 000000000..0b03b4db9 --- /dev/null +++ b/third_party/bootstrap/pull.sh @@ -0,0 +1,14 @@ +#!/bin/bash +set -e + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" +cd $DIR + +if [ ! -d icons/ ]; then + git clone https://github.com/twbs/icons/ +fi + +cd icons +git fetch --all +git checkout d5aa187483a1b0b186f87adcfa8576350d970d98 +cp bootstrap-icons.svg ../ diff --git a/selfdrive/controls/lib/cluster/LICENSE b/third_party/cluster/LICENSE similarity index 100% rename from selfdrive/controls/lib/cluster/LICENSE rename to third_party/cluster/LICENSE diff --git a/selfdrive/controls/lib/cluster/README b/third_party/cluster/README similarity index 100% rename from selfdrive/controls/lib/cluster/README rename to third_party/cluster/README diff --git a/third_party/cluster/__init__.py b/third_party/cluster/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/third_party/cluster/__pycache__/__init__.cpython-38.pyc b/third_party/cluster/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 000000000..5986cb12f Binary files /dev/null and b/third_party/cluster/__pycache__/__init__.cpython-38.pyc differ diff --git a/third_party/cluster/__pycache__/fastcluster_py.cpython-38.pyc b/third_party/cluster/__pycache__/fastcluster_py.cpython-38.pyc new file mode 100644 index 000000000..ac2abe002 Binary files /dev/null and b/third_party/cluster/__pycache__/fastcluster_py.cpython-38.pyc differ diff --git a/selfdrive/controls/lib/cluster/fastcluster.cpp b/third_party/cluster/fastcluster.cpp similarity index 100% rename from selfdrive/controls/lib/cluster/fastcluster.cpp rename to third_party/cluster/fastcluster.cpp diff --git a/selfdrive/controls/lib/cluster/fastcluster.h b/third_party/cluster/fastcluster.h similarity index 100% rename from selfdrive/controls/lib/cluster/fastcluster.h rename to third_party/cluster/fastcluster.h diff --git a/third_party/cluster/fastcluster.os b/third_party/cluster/fastcluster.os new file mode 100644 index 000000000..cb0dd99a3 Binary files /dev/null and b/third_party/cluster/fastcluster.os differ diff --git a/selfdrive/controls/lib/cluster/fastcluster_R_dm.cpp b/third_party/cluster/fastcluster_R_dm.cpp similarity index 100% rename from selfdrive/controls/lib/cluster/fastcluster_R_dm.cpp rename to third_party/cluster/fastcluster_R_dm.cpp diff --git a/selfdrive/controls/lib/cluster/fastcluster_dm.cpp b/third_party/cluster/fastcluster_dm.cpp similarity index 100% rename from selfdrive/controls/lib/cluster/fastcluster_dm.cpp rename to third_party/cluster/fastcluster_dm.cpp diff --git a/selfdrive/controls/lib/cluster/fastcluster_py.py b/third_party/cluster/fastcluster_py.py similarity index 100% rename from selfdrive/controls/lib/cluster/fastcluster_py.py rename to third_party/cluster/fastcluster_py.py diff --git a/selfdrive/controls/lib/cluster/libfastcluster.so b/third_party/cluster/libfastcluster.so similarity index 53% rename from selfdrive/controls/lib/cluster/libfastcluster.so rename to third_party/cluster/libfastcluster.so index 26b7edea8..6a90ec4a4 100755 Binary files a/selfdrive/controls/lib/cluster/libfastcluster.so and b/third_party/cluster/libfastcluster.so differ diff --git a/selfdrive/controls/lib/cluster/test.cpp b/third_party/cluster/test.cpp similarity index 100% rename from selfdrive/controls/lib/cluster/test.cpp rename to third_party/cluster/test.cpp diff --git a/system/camerad/include/media/cam_cpas.h b/third_party/linux/include/media/cam_cpas.h similarity index 100% rename from system/camerad/include/media/cam_cpas.h rename to third_party/linux/include/media/cam_cpas.h diff --git a/system/camerad/include/media/cam_defs.h b/third_party/linux/include/media/cam_defs.h similarity index 100% rename from system/camerad/include/media/cam_defs.h rename to third_party/linux/include/media/cam_defs.h diff --git a/system/camerad/include/media/cam_fd.h b/third_party/linux/include/media/cam_fd.h similarity index 100% rename from system/camerad/include/media/cam_fd.h rename to third_party/linux/include/media/cam_fd.h diff --git a/system/camerad/include/media/cam_icp.h b/third_party/linux/include/media/cam_icp.h similarity index 100% rename from system/camerad/include/media/cam_icp.h rename to third_party/linux/include/media/cam_icp.h diff --git a/system/camerad/include/media/cam_isp.h b/third_party/linux/include/media/cam_isp.h similarity index 100% rename from system/camerad/include/media/cam_isp.h rename to third_party/linux/include/media/cam_isp.h diff --git a/system/camerad/include/media/cam_isp_ife.h b/third_party/linux/include/media/cam_isp_ife.h similarity index 100% rename from system/camerad/include/media/cam_isp_ife.h rename to third_party/linux/include/media/cam_isp_ife.h diff --git a/system/camerad/include/media/cam_isp_vfe.h b/third_party/linux/include/media/cam_isp_vfe.h similarity index 100% rename from system/camerad/include/media/cam_isp_vfe.h rename to third_party/linux/include/media/cam_isp_vfe.h diff --git a/system/camerad/include/media/cam_jpeg.h b/third_party/linux/include/media/cam_jpeg.h similarity index 100% rename from system/camerad/include/media/cam_jpeg.h rename to third_party/linux/include/media/cam_jpeg.h diff --git a/system/camerad/include/media/cam_lrme.h b/third_party/linux/include/media/cam_lrme.h similarity index 100% rename from system/camerad/include/media/cam_lrme.h rename to third_party/linux/include/media/cam_lrme.h diff --git a/system/camerad/include/media/cam_req_mgr.h b/third_party/linux/include/media/cam_req_mgr.h similarity index 100% rename from system/camerad/include/media/cam_req_mgr.h rename to third_party/linux/include/media/cam_req_mgr.h diff --git a/system/camerad/include/media/cam_sensor.h b/third_party/linux/include/media/cam_sensor.h similarity index 100% rename from system/camerad/include/media/cam_sensor.h rename to third_party/linux/include/media/cam_sensor.h diff --git a/system/camerad/include/media/cam_sensor_cmn_header.h b/third_party/linux/include/media/cam_sensor_cmn_header.h similarity index 100% rename from system/camerad/include/media/cam_sensor_cmn_header.h rename to third_party/linux/include/media/cam_sensor_cmn_header.h diff --git a/system/camerad/include/media/cam_sync.h b/third_party/linux/include/media/cam_sync.h similarity index 100% rename from system/camerad/include/media/cam_sync.h rename to third_party/linux/include/media/cam_sync.h diff --git a/system/camerad/include/msm_cam_sensor.h b/third_party/linux/include/msm_cam_sensor.h similarity index 100% rename from system/camerad/include/msm_cam_sensor.h rename to third_party/linux/include/msm_cam_sensor.h diff --git a/system/camerad/include/msm_camsensor_sdk.h b/third_party/linux/include/msm_camsensor_sdk.h similarity index 100% rename from system/camerad/include/msm_camsensor_sdk.h rename to third_party/linux/include/msm_camsensor_sdk.h diff --git a/selfdrive/modeld/thneed/include/msm_kgsl.h b/third_party/linux/include/msm_kgsl.h similarity index 100% rename from selfdrive/modeld/thneed/include/msm_kgsl.h rename to third_party/linux/include/msm_kgsl.h diff --git a/system/camerad/include/msmb_camera.h b/third_party/linux/include/msmb_camera.h similarity index 100% rename from system/camerad/include/msmb_camera.h rename to third_party/linux/include/msmb_camera.h diff --git a/system/camerad/include/msmb_isp.h b/third_party/linux/include/msmb_isp.h similarity index 100% rename from system/camerad/include/msmb_isp.h rename to third_party/linux/include/msmb_isp.h diff --git a/system/camerad/include/msmb_ispif.h b/third_party/linux/include/msmb_ispif.h similarity index 100% rename from system/camerad/include/msmb_ispif.h rename to third_party/linux/include/msmb_ispif.h diff --git a/third_party/openmax/include/OMX_Audio.h b/third_party/openmax/include/OMX_Audio.h new file mode 100644 index 000000000..0d455766c --- /dev/null +++ b/third_party/openmax/include/OMX_Audio.h @@ -0,0 +1,1312 @@ +/* + * Copyright (c) 2008 The Khronos Group Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject + * to the following conditions: + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +/** @file OMX_Audio.h - OpenMax IL version 1.1.2 + * The structures needed by Audio components to exchange + * parameters and configuration data with the componenmilts. + */ + +#ifndef OMX_Audio_h +#define OMX_Audio_h + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + +/* Each OMX header must include all required header files to allow the + * header to compile without errors. The includes below are required + * for this header file to compile successfully + */ + +#include + +/** @defgroup midi MIDI + * @ingroup audio + */ + +/** @defgroup effects Audio effects + * @ingroup audio + */ + +/** @defgroup audio OpenMAX IL Audio Domain + * Structures for OpenMAX IL Audio domain + * @{ + */ + +/** Enumeration used to define the possible audio codings. + * If "OMX_AUDIO_CodingUnused" is selected, the coding selection must + * be done in a vendor specific way. Since this is for an audio + * processing element this enum is relevant. However, for another + * type of component other enums would be in this area. + */ +typedef enum OMX_AUDIO_CODINGTYPE { + OMX_AUDIO_CodingUnused = 0, /**< Placeholder value when coding is N/A */ + OMX_AUDIO_CodingAutoDetect, /**< auto detection of audio format */ + OMX_AUDIO_CodingPCM, /**< Any variant of PCM coding */ + OMX_AUDIO_CodingADPCM, /**< Any variant of ADPCM encoded data */ + OMX_AUDIO_CodingAMR, /**< Any variant of AMR encoded data */ + OMX_AUDIO_CodingGSMFR, /**< Any variant of GSM fullrate (i.e. GSM610) */ + OMX_AUDIO_CodingGSMEFR, /**< Any variant of GSM Enhanced Fullrate encoded data*/ + OMX_AUDIO_CodingGSMHR, /**< Any variant of GSM Halfrate encoded data */ + OMX_AUDIO_CodingPDCFR, /**< Any variant of PDC Fullrate encoded data */ + OMX_AUDIO_CodingPDCEFR, /**< Any variant of PDC Enhanced Fullrate encoded data */ + OMX_AUDIO_CodingPDCHR, /**< Any variant of PDC Halfrate encoded data */ + OMX_AUDIO_CodingTDMAFR, /**< Any variant of TDMA Fullrate encoded data (TIA/EIA-136-420) */ + OMX_AUDIO_CodingTDMAEFR, /**< Any variant of TDMA Enhanced Fullrate encoded data (TIA/EIA-136-410) */ + OMX_AUDIO_CodingQCELP8, /**< Any variant of QCELP 8kbps encoded data */ + OMX_AUDIO_CodingQCELP13, /**< Any variant of QCELP 13kbps encoded data */ + OMX_AUDIO_CodingEVRC, /**< Any variant of EVRC encoded data */ + OMX_AUDIO_CodingSMV, /**< Any variant of SMV encoded data */ + OMX_AUDIO_CodingG711, /**< Any variant of G.711 encoded data */ + OMX_AUDIO_CodingG723, /**< Any variant of G.723 dot 1 encoded data */ + OMX_AUDIO_CodingG726, /**< Any variant of G.726 encoded data */ + OMX_AUDIO_CodingG729, /**< Any variant of G.729 encoded data */ + OMX_AUDIO_CodingAAC, /**< Any variant of AAC encoded data */ + OMX_AUDIO_CodingMP3, /**< Any variant of MP3 encoded data */ + OMX_AUDIO_CodingSBC, /**< Any variant of SBC encoded data */ + OMX_AUDIO_CodingVORBIS, /**< Any variant of VORBIS encoded data */ + OMX_AUDIO_CodingWMA, /**< Any variant of WMA encoded data */ + OMX_AUDIO_CodingRA, /**< Any variant of RA encoded data */ + OMX_AUDIO_CodingMIDI, /**< Any variant of MIDI encoded data */ + OMX_AUDIO_CodingAC3, /**< Any variant of AC3 encoded data */ + OMX_AUDIO_CodingKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_AUDIO_CodingVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + OMX_AUDIO_CodingMax = 0x7FFFFFFF +} OMX_AUDIO_CODINGTYPE; + + +/** The PortDefinition structure is used to define all of the parameters + * necessary for the compliant component to setup an input or an output audio + * path. If additional information is needed to define the parameters of the + * port (such as frequency), additional structures must be sent such as the + * OMX_AUDIO_PARAM_PCMMODETYPE structure to supply the extra parameters for the port. + */ +typedef struct OMX_AUDIO_PORTDEFINITIONTYPE { + OMX_STRING cMIMEType; /**< MIME type of data for the port */ + OMX_NATIVE_DEVICETYPE pNativeRender; /** < platform specific reference + for an output device, + otherwise this field is 0 */ + OMX_BOOL bFlagErrorConcealment; /**< Turns on error concealment if it is + supported by the OMX component */ + OMX_AUDIO_CODINGTYPE eEncoding; /**< Type of data expected for this + port (e.g. PCM, AMR, MP3, etc) */ +} OMX_AUDIO_PORTDEFINITIONTYPE; + + +/** Port format parameter. This structure is used to enumerate + * the various data input/output format supported by the port. + */ +typedef struct OMX_AUDIO_PARAM_PORTFORMATTYPE { + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nPortIndex; /**< Indicates which port to set */ + OMX_U32 nIndex; /**< Indicates the enumeration index for the format from 0x0 to N-1 */ + OMX_AUDIO_CODINGTYPE eEncoding; /**< Type of data expected for this port (e.g. PCM, AMR, MP3, etc) */ +} OMX_AUDIO_PARAM_PORTFORMATTYPE; + + +/** PCM mode type */ +typedef enum OMX_AUDIO_PCMMODETYPE { + OMX_AUDIO_PCMModeLinear = 0, /**< Linear PCM encoded data */ + OMX_AUDIO_PCMModeALaw, /**< A law PCM encoded data (G.711) */ + OMX_AUDIO_PCMModeMULaw, /**< Mu law PCM encoded data (G.711) */ + OMX_AUDIO_PCMModeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_AUDIO_PCMModeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + OMX_AUDIO_PCMModeMax = 0x7FFFFFFF +} OMX_AUDIO_PCMMODETYPE; + + +typedef enum OMX_AUDIO_CHANNELTYPE { + OMX_AUDIO_ChannelNone = 0x0, /**< Unused or empty */ + OMX_AUDIO_ChannelLF = 0x1, /**< Left front */ + OMX_AUDIO_ChannelRF = 0x2, /**< Right front */ + OMX_AUDIO_ChannelCF = 0x3, /**< Center front */ + OMX_AUDIO_ChannelLS = 0x4, /**< Left surround */ + OMX_AUDIO_ChannelRS = 0x5, /**< Right surround */ + OMX_AUDIO_ChannelLFE = 0x6, /**< Low frequency effects */ + OMX_AUDIO_ChannelCS = 0x7, /**< Back surround */ + OMX_AUDIO_ChannelLR = 0x8, /**< Left rear. */ + OMX_AUDIO_ChannelRR = 0x9, /**< Right rear. */ + OMX_AUDIO_ChannelKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_AUDIO_ChannelVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + OMX_AUDIO_ChannelMax = 0x7FFFFFFF +} OMX_AUDIO_CHANNELTYPE; + +#define OMX_AUDIO_MAXCHANNELS 16 /**< maximum number distinct audio channels that a buffer may contain */ +#define OMX_MIN_PCMPAYLOAD_MSEC 5 /**< Minimum audio buffer payload size for uncompressed (PCM) audio */ + +/** PCM format description */ +typedef struct OMX_AUDIO_PARAM_PCMMODETYPE { + OMX_U32 nSize; /**< Size of this structure, in Bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nPortIndex; /**< port that this structure applies to */ + OMX_U32 nChannels; /**< Number of channels (e.g. 2 for stereo) */ + OMX_NUMERICALDATATYPE eNumData; /**< indicates PCM data as signed or unsigned */ + OMX_ENDIANTYPE eEndian; /**< indicates PCM data as little or big endian */ + OMX_BOOL bInterleaved; /**< True for normal interleaved data; false for + non-interleaved data (e.g. block data) */ + OMX_U32 nBitPerSample; /**< Bit per sample */ + OMX_U32 nSamplingRate; /**< Sampling rate of the source data. Use 0 for + variable or unknown sampling rate. */ + OMX_AUDIO_PCMMODETYPE ePCMMode; /**< PCM mode enumeration */ + OMX_AUDIO_CHANNELTYPE eChannelMapping[OMX_AUDIO_MAXCHANNELS]; /**< Slot i contains channel defined by eChannelMap[i] */ + +} OMX_AUDIO_PARAM_PCMMODETYPE; + + +/** Audio channel mode. This is used by both AAC and MP3, although the names are more appropriate + * for the MP3. For example, JointStereo for MP3 is CouplingChannels for AAC. + */ +typedef enum OMX_AUDIO_CHANNELMODETYPE { + OMX_AUDIO_ChannelModeStereo = 0, /**< 2 channels, the bitrate allocation between those + two channels changes accordingly to each channel information */ + OMX_AUDIO_ChannelModeJointStereo, /**< mode that takes advantage of what is common between + 2 channels for higher compression gain */ + OMX_AUDIO_ChannelModeDual, /**< 2 mono-channels, each channel is encoded with half + the bitrate of the overall bitrate */ + OMX_AUDIO_ChannelModeMono, /**< Mono channel mode */ + OMX_AUDIO_ChannelModeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_AUDIO_ChannelModeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + OMX_AUDIO_ChannelModeMax = 0x7FFFFFFF +} OMX_AUDIO_CHANNELMODETYPE; + + +typedef enum OMX_AUDIO_MP3STREAMFORMATTYPE { + OMX_AUDIO_MP3StreamFormatMP1Layer3 = 0, /**< MP3 Audio MPEG 1 Layer 3 Stream format */ + OMX_AUDIO_MP3StreamFormatMP2Layer3, /**< MP3 Audio MPEG 2 Layer 3 Stream format */ + OMX_AUDIO_MP3StreamFormatMP2_5Layer3, /**< MP3 Audio MPEG2.5 Layer 3 Stream format */ + OMX_AUDIO_MP3StreamFormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_AUDIO_MP3StreamFormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + OMX_AUDIO_MP3StreamFormatMax = 0x7FFFFFFF +} OMX_AUDIO_MP3STREAMFORMATTYPE; + +/** MP3 params */ +typedef struct OMX_AUDIO_PARAM_MP3TYPE { + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nPortIndex; /**< port that this structure applies to */ + OMX_U32 nChannels; /**< Number of channels */ + OMX_U32 nBitRate; /**< Bit rate of the input data. Use 0 for variable + rate or unknown bit rates */ + OMX_U32 nSampleRate; /**< Sampling rate of the source data. Use 0 for + variable or unknown sampling rate. */ + OMX_U32 nAudioBandWidth; /**< Audio band width (in Hz) to which an encoder should + limit the audio signal. Use 0 to let encoder decide */ + OMX_AUDIO_CHANNELMODETYPE eChannelMode; /**< Channel mode enumeration */ + OMX_AUDIO_MP3STREAMFORMATTYPE eFormat; /**< MP3 stream format */ +} OMX_AUDIO_PARAM_MP3TYPE; + + +typedef enum OMX_AUDIO_AACSTREAMFORMATTYPE { + OMX_AUDIO_AACStreamFormatMP2ADTS = 0, /**< AAC Audio Data Transport Stream 2 format */ + OMX_AUDIO_AACStreamFormatMP4ADTS, /**< AAC Audio Data Transport Stream 4 format */ + OMX_AUDIO_AACStreamFormatMP4LOAS, /**< AAC Low Overhead Audio Stream format */ + OMX_AUDIO_AACStreamFormatMP4LATM, /**< AAC Low overhead Audio Transport Multiplex */ + OMX_AUDIO_AACStreamFormatADIF, /**< AAC Audio Data Interchange Format */ + OMX_AUDIO_AACStreamFormatMP4FF, /**< AAC inside MPEG-4/ISO File Format */ + OMX_AUDIO_AACStreamFormatRAW, /**< AAC Raw Format */ + OMX_AUDIO_AACStreamFormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_AUDIO_AACStreamFormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + OMX_AUDIO_AACStreamFormatMax = 0x7FFFFFFF +} OMX_AUDIO_AACSTREAMFORMATTYPE; + + +/** AAC mode type. Note that the term profile is used with the MPEG-2 + * standard and the term object type and profile is used with MPEG-4 */ +typedef enum OMX_AUDIO_AACPROFILETYPE{ + OMX_AUDIO_AACObjectNull = 0, /**< Null, not used */ + OMX_AUDIO_AACObjectMain = 1, /**< AAC Main object */ + OMX_AUDIO_AACObjectLC, /**< AAC Low Complexity object (AAC profile) */ + OMX_AUDIO_AACObjectSSR, /**< AAC Scalable Sample Rate object */ + OMX_AUDIO_AACObjectLTP, /**< AAC Long Term Prediction object */ + OMX_AUDIO_AACObjectHE, /**< AAC High Efficiency (object type SBR, HE-AAC profile) */ + OMX_AUDIO_AACObjectScalable, /**< AAC Scalable object */ + OMX_AUDIO_AACObjectERLC = 17, /**< ER AAC Low Complexity object (Error Resilient AAC-LC) */ + OMX_AUDIO_AACObjectLD = 23, /**< AAC Low Delay object (Error Resilient) */ + OMX_AUDIO_AACObjectHE_PS = 29, /**< AAC High Efficiency with Parametric Stereo coding (HE-AAC v2, object type PS) */ + OMX_AUDIO_AACObjectKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_AUDIO_AACObjectVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + OMX_AUDIO_AACObjectMax = 0x7FFFFFFF +} OMX_AUDIO_AACPROFILETYPE; + + +/** AAC tool usage (for nAACtools in OMX_AUDIO_PARAM_AACPROFILETYPE). + * Required for encoder configuration and optional as decoder info output. + * For MP3, OMX_AUDIO_CHANNELMODETYPE is sufficient. */ +#define OMX_AUDIO_AACToolNone 0x00000000 /**< no AAC tools allowed (encoder config) or active (decoder info output) */ +#define OMX_AUDIO_AACToolMS 0x00000001 /**< MS: Mid/side joint coding tool allowed or active */ +#define OMX_AUDIO_AACToolIS 0x00000002 /**< IS: Intensity stereo tool allowed or active */ +#define OMX_AUDIO_AACToolTNS 0x00000004 /**< TNS: Temporal Noise Shaping tool allowed or active */ +#define OMX_AUDIO_AACToolPNS 0x00000008 /**< PNS: MPEG-4 Perceptual Noise substitution tool allowed or active */ +#define OMX_AUDIO_AACToolLTP 0x00000010 /**< LTP: MPEG-4 Long Term Prediction tool allowed or active */ +#define OMX_AUDIO_AACToolAll 0x7FFFFFFF /**< all AAC tools allowed or active (*/ + +/** MPEG-4 AAC error resilience (ER) tool usage (for nAACERtools in OMX_AUDIO_PARAM_AACPROFILETYPE). + * Required for ER encoder configuration and optional as decoder info output */ +#define OMX_AUDIO_AACERNone 0x00000000 /**< no AAC ER tools allowed/used */ +#define OMX_AUDIO_AACERVCB11 0x00000001 /**< VCB11: Virtual Code Books for AAC section data */ +#define OMX_AUDIO_AACERRVLC 0x00000002 /**< RVLC: Reversible Variable Length Coding */ +#define OMX_AUDIO_AACERHCR 0x00000004 /**< HCR: Huffman Codeword Reordering */ +#define OMX_AUDIO_AACERAll 0x7FFFFFFF /**< all AAC ER tools allowed/used */ + + +/** AAC params */ +typedef struct OMX_AUDIO_PARAM_AACPROFILETYPE { + OMX_U32 nSize; /**< Size of this structure, in Bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nPortIndex; /**< Port that this structure applies to */ + OMX_U32 nChannels; /**< Number of channels */ + OMX_U32 nSampleRate; /**< Sampling rate of the source data. Use 0 for + variable or unknown sampling rate. */ + OMX_U32 nBitRate; /**< Bit rate of the input data. Use 0 for variable + rate or unknown bit rates */ + OMX_U32 nAudioBandWidth; /**< Audio band width (in Hz) to which an encoder should + limit the audio signal. Use 0 to let encoder decide */ + OMX_U32 nFrameLength; /**< Frame length (in audio samples per channel) of the codec. + Can be 1024 or 960 (AAC-LC), 2048 (HE-AAC), 480 or 512 (AAC-LD). + Use 0 to let encoder decide */ + OMX_U32 nAACtools; /**< AAC tool usage */ + OMX_U32 nAACERtools; /**< MPEG-4 AAC error resilience tool usage */ + OMX_AUDIO_AACPROFILETYPE eAACProfile; /**< AAC profile enumeration */ + OMX_AUDIO_AACSTREAMFORMATTYPE eAACStreamFormat; /**< AAC stream format enumeration */ + OMX_AUDIO_CHANNELMODETYPE eChannelMode; /**< Channel mode enumeration */ +} OMX_AUDIO_PARAM_AACPROFILETYPE; + + +/** VORBIS params */ +typedef struct OMX_AUDIO_PARAM_VORBISTYPE { + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nPortIndex; /**< port that this structure applies to */ + OMX_U32 nChannels; /**< Number of channels */ + OMX_U32 nBitRate; /**< Bit rate of the encoded data data. Use 0 for variable + rate or unknown bit rates. Encoding is set to the + bitrate closest to specified value (in bps) */ + OMX_U32 nMinBitRate; /**< Sets minimum bitrate (in bps). */ + OMX_U32 nMaxBitRate; /**< Sets maximum bitrate (in bps). */ + + OMX_U32 nSampleRate; /**< Sampling rate of the source data. Use 0 for + variable or unknown sampling rate. */ + OMX_U32 nAudioBandWidth; /**< Audio band width (in Hz) to which an encoder should + limit the audio signal. Use 0 to let encoder decide */ + OMX_S32 nQuality; /**< Sets encoding quality to n, between -1 (low) and 10 (high). + In the default mode of operation, teh quality level is 3. + Normal quality range is 0 - 10. */ + OMX_BOOL bManaged; /**< Set bitrate management mode. This turns off the + normal VBR encoding, but allows hard or soft bitrate + constraints to be enforced by the encoder. This mode can + be slower, and may also be lower quality. It is + primarily useful for streaming. */ + OMX_BOOL bDownmix; /**< Downmix input from stereo to mono (has no effect on + non-stereo streams). Useful for lower-bitrate encoding. */ +} OMX_AUDIO_PARAM_VORBISTYPE; + + +/** WMA Version */ +typedef enum OMX_AUDIO_WMAFORMATTYPE { + OMX_AUDIO_WMAFormatUnused = 0, /**< format unused or unknown */ + OMX_AUDIO_WMAFormat7, /**< Windows Media Audio format 7 */ + OMX_AUDIO_WMAFormat8, /**< Windows Media Audio format 8 */ + OMX_AUDIO_WMAFormat9, /**< Windows Media Audio format 9 */ + OMX_AUDIO_WMAFormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_AUDIO_WMAFormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + OMX_AUDIO_WMAFormatMax = 0x7FFFFFFF +} OMX_AUDIO_WMAFORMATTYPE; + + +/** WMA Profile */ +typedef enum OMX_AUDIO_WMAPROFILETYPE { + OMX_AUDIO_WMAProfileUnused = 0, /**< profile unused or unknown */ + OMX_AUDIO_WMAProfileL1, /**< Windows Media audio version 9 profile L1 */ + OMX_AUDIO_WMAProfileL2, /**< Windows Media audio version 9 profile L2 */ + OMX_AUDIO_WMAProfileL3, /**< Windows Media audio version 9 profile L3 */ + OMX_AUDIO_WMAProfileKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_AUDIO_WMAProfileVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + OMX_AUDIO_WMAProfileMax = 0x7FFFFFFF +} OMX_AUDIO_WMAPROFILETYPE; + + +/** WMA params */ +typedef struct OMX_AUDIO_PARAM_WMATYPE { + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nPortIndex; /**< port that this structure applies to */ + OMX_U16 nChannels; /**< Number of channels */ + OMX_U32 nBitRate; /**< Bit rate of the input data. Use 0 for variable + rate or unknown bit rates */ + OMX_AUDIO_WMAFORMATTYPE eFormat; /**< Version of WMA stream / data */ + OMX_AUDIO_WMAPROFILETYPE eProfile; /**< Profile of WMA stream / data */ + OMX_U32 nSamplingRate; /**< Sampling rate of the source data */ + OMX_U16 nBlockAlign; /**< is the block alignment, or block size, in bytes of the audio codec */ + OMX_U16 nEncodeOptions; /**< WMA Type-specific data */ + OMX_U32 nSuperBlockAlign; /**< WMA Type-specific data */ +} OMX_AUDIO_PARAM_WMATYPE; + +/** + * RealAudio format + */ +typedef enum OMX_AUDIO_RAFORMATTYPE { + OMX_AUDIO_RAFormatUnused = 0, /**< Format unused or unknown */ + OMX_AUDIO_RA8, /**< RealAudio 8 codec */ + OMX_AUDIO_RA9, /**< RealAudio 9 codec */ + OMX_AUDIO_RA10_AAC, /**< MPEG-4 AAC codec for bitrates of more than 128kbps */ + OMX_AUDIO_RA10_CODEC, /**< RealAudio codec for bitrates less than 128 kbps */ + OMX_AUDIO_RA10_LOSSLESS, /**< RealAudio Lossless */ + OMX_AUDIO_RA10_MULTICHANNEL, /**< RealAudio Multichannel */ + OMX_AUDIO_RA10_VOICE, /**< RealAudio Voice for bitrates below 15 kbps */ + OMX_AUDIO_RAFormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_AUDIO_RAFormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + OMX_VIDEO_RAFormatMax = 0x7FFFFFFF +} OMX_AUDIO_RAFORMATTYPE; + +/** RA (Real Audio) params */ +typedef struct OMX_AUDIO_PARAM_RATYPE { + OMX_U32 nSize; /**< Size of this structure, in Bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nPortIndex; /**< Port that this structure applies to */ + OMX_U32 nChannels; /**< Number of channels */ + OMX_U32 nSamplingRate; /**< is the sampling rate of the source data */ + OMX_U32 nBitsPerFrame; /**< is the value for bits per frame */ + OMX_U32 nSamplePerFrame; /**< is the value for samples per frame */ + OMX_U32 nCouplingQuantBits; /**< is the number of coupling quantization bits in the stream */ + OMX_U32 nCouplingStartRegion; /**< is the coupling start region in the stream */ + OMX_U32 nNumRegions; /**< is the number of regions value */ + OMX_AUDIO_RAFORMATTYPE eFormat; /**< is the RealAudio audio format */ +} OMX_AUDIO_PARAM_RATYPE; + + +/** SBC Allocation Method Type */ +typedef enum OMX_AUDIO_SBCALLOCMETHODTYPE { + OMX_AUDIO_SBCAllocMethodLoudness, /**< Loudness allocation method */ + OMX_AUDIO_SBCAllocMethodSNR, /**< SNR allocation method */ + OMX_AUDIO_SBCAllocMethodKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_AUDIO_SBCAllocMethodVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + OMX_AUDIO_SBCAllocMethodMax = 0x7FFFFFFF +} OMX_AUDIO_SBCALLOCMETHODTYPE; + + +/** SBC params */ +typedef struct OMX_AUDIO_PARAM_SBCTYPE { + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nPortIndex; /**< port that this structure applies to */ + OMX_U32 nChannels; /**< Number of channels */ + OMX_U32 nBitRate; /**< Bit rate of the input data. Use 0 for variable + rate or unknown bit rates */ + OMX_U32 nSampleRate; /**< Sampling rate of the source data. Use 0 for + variable or unknown sampling rate. */ + OMX_U32 nBlocks; /**< Number of blocks */ + OMX_U32 nSubbands; /**< Number of subbands */ + OMX_U32 nBitPool; /**< Bitpool value */ + OMX_BOOL bEnableBitrate; /**< Use bitrate value instead of bitpool */ + OMX_AUDIO_CHANNELMODETYPE eChannelMode; /**< Channel mode enumeration */ + OMX_AUDIO_SBCALLOCMETHODTYPE eSBCAllocType; /**< SBC Allocation method type */ +} OMX_AUDIO_PARAM_SBCTYPE; + + +/** ADPCM stream format parameters */ +typedef struct OMX_AUDIO_PARAM_ADPCMTYPE { + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nPortIndex; /**< port that this structure applies to */ + OMX_U32 nChannels; /**< Number of channels in the data stream (not + necessarily the same as the number of channels + to be rendered. */ + OMX_U32 nBitsPerSample; /**< Number of bits in each sample */ + OMX_U32 nSampleRate; /**< Sampling rate of the source data. Use 0 for + variable or unknown sampling rate. */ +} OMX_AUDIO_PARAM_ADPCMTYPE; + + +/** G723 rate */ +typedef enum OMX_AUDIO_G723RATE { + OMX_AUDIO_G723ModeUnused = 0, /**< AMRNB Mode unused / unknown */ + OMX_AUDIO_G723ModeLow, /**< 5300 bps */ + OMX_AUDIO_G723ModeHigh, /**< 6300 bps */ + OMX_AUDIO_G723ModeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_AUDIO_G723ModeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + OMX_AUDIO_G723ModeMax = 0x7FFFFFFF +} OMX_AUDIO_G723RATE; + + +/** G723 - Sample rate must be 8 KHz */ +typedef struct OMX_AUDIO_PARAM_G723TYPE { + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nPortIndex; /**< port that this structure applies to */ + OMX_U32 nChannels; /**< Number of channels in the data stream (not + necessarily the same as the number of channels + to be rendered. */ + OMX_BOOL bDTX; /**< Enable Discontinuous Transmisssion */ + OMX_AUDIO_G723RATE eBitRate; /**< todo: Should this be moved to a config? */ + OMX_BOOL bHiPassFilter; /**< Enable High Pass Filter */ + OMX_BOOL bPostFilter; /**< Enable Post Filter */ +} OMX_AUDIO_PARAM_G723TYPE; + + +/** ITU G726 (ADPCM) rate */ +typedef enum OMX_AUDIO_G726MODE { + OMX_AUDIO_G726ModeUnused = 0, /**< G726 Mode unused / unknown */ + OMX_AUDIO_G726Mode16, /**< 16 kbps */ + OMX_AUDIO_G726Mode24, /**< 24 kbps */ + OMX_AUDIO_G726Mode32, /**< 32 kbps, most common rate, also G721 */ + OMX_AUDIO_G726Mode40, /**< 40 kbps */ + OMX_AUDIO_G726ModeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_AUDIO_G726ModeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + OMX_AUDIO_G726ModeMax = 0x7FFFFFFF +} OMX_AUDIO_G726MODE; + + +/** G.726 stream format parameters - must be at 8KHz */ +typedef struct OMX_AUDIO_PARAM_G726TYPE { + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nPortIndex; /**< port that this structure applies to */ + OMX_U32 nChannels; /**< Number of channels in the data stream (not + necessarily the same as the number of channels + to be rendered. */ + OMX_AUDIO_G726MODE eG726Mode; +} OMX_AUDIO_PARAM_G726TYPE; + + +/** G729 coder type */ +typedef enum OMX_AUDIO_G729TYPE { + OMX_AUDIO_G729 = 0, /**< ITU G.729 encoded data */ + OMX_AUDIO_G729A, /**< ITU G.729 annex A encoded data */ + OMX_AUDIO_G729B, /**< ITU G.729 with annex B encoded data */ + OMX_AUDIO_G729AB, /**< ITU G.729 annexes A and B encoded data */ + OMX_AUDIO_G729KhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_AUDIO_G729VendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + OMX_AUDIO_G729Max = 0x7FFFFFFF +} OMX_AUDIO_G729TYPE; + + +/** G729 stream format parameters - fixed 6KHz sample rate */ +typedef struct OMX_AUDIO_PARAM_G729TYPE { + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nPortIndex; /**< port that this structure applies to */ + OMX_U32 nChannels; /**< Number of channels in the data stream (not + necessarily the same as the number of channels + to be rendered. */ + OMX_BOOL bDTX; /**< Enable Discontinuous Transmisssion */ + OMX_AUDIO_G729TYPE eBitType; +} OMX_AUDIO_PARAM_G729TYPE; + + +/** AMR Frame format */ +typedef enum OMX_AUDIO_AMRFRAMEFORMATTYPE { + OMX_AUDIO_AMRFrameFormatConformance = 0, /**< Frame Format is AMR Conformance + (Standard) Format */ + OMX_AUDIO_AMRFrameFormatIF1, /**< Frame Format is AMR Interface + Format 1 */ + OMX_AUDIO_AMRFrameFormatIF2, /**< Frame Format is AMR Interface + Format 2*/ + OMX_AUDIO_AMRFrameFormatFSF, /**< Frame Format is AMR File Storage + Format */ + OMX_AUDIO_AMRFrameFormatRTPPayload, /**< Frame Format is AMR Real-Time + Transport Protocol Payload Format */ + OMX_AUDIO_AMRFrameFormatITU, /**< Frame Format is ITU Format (added at Motorola request) */ + OMX_AUDIO_AMRFrameFormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_AUDIO_AMRFrameFormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + OMX_AUDIO_AMRFrameFormatMax = 0x7FFFFFFF +} OMX_AUDIO_AMRFRAMEFORMATTYPE; + + +/** AMR band mode */ +typedef enum OMX_AUDIO_AMRBANDMODETYPE { + OMX_AUDIO_AMRBandModeUnused = 0, /**< AMRNB Mode unused / unknown */ + OMX_AUDIO_AMRBandModeNB0, /**< AMRNB Mode 0 = 4750 bps */ + OMX_AUDIO_AMRBandModeNB1, /**< AMRNB Mode 1 = 5150 bps */ + OMX_AUDIO_AMRBandModeNB2, /**< AMRNB Mode 2 = 5900 bps */ + OMX_AUDIO_AMRBandModeNB3, /**< AMRNB Mode 3 = 6700 bps */ + OMX_AUDIO_AMRBandModeNB4, /**< AMRNB Mode 4 = 7400 bps */ + OMX_AUDIO_AMRBandModeNB5, /**< AMRNB Mode 5 = 7950 bps */ + OMX_AUDIO_AMRBandModeNB6, /**< AMRNB Mode 6 = 10200 bps */ + OMX_AUDIO_AMRBandModeNB7, /**< AMRNB Mode 7 = 12200 bps */ + OMX_AUDIO_AMRBandModeWB0, /**< AMRWB Mode 0 = 6600 bps */ + OMX_AUDIO_AMRBandModeWB1, /**< AMRWB Mode 1 = 8850 bps */ + OMX_AUDIO_AMRBandModeWB2, /**< AMRWB Mode 2 = 12650 bps */ + OMX_AUDIO_AMRBandModeWB3, /**< AMRWB Mode 3 = 14250 bps */ + OMX_AUDIO_AMRBandModeWB4, /**< AMRWB Mode 4 = 15850 bps */ + OMX_AUDIO_AMRBandModeWB5, /**< AMRWB Mode 5 = 18250 bps */ + OMX_AUDIO_AMRBandModeWB6, /**< AMRWB Mode 6 = 19850 bps */ + OMX_AUDIO_AMRBandModeWB7, /**< AMRWB Mode 7 = 23050 bps */ + OMX_AUDIO_AMRBandModeWB8, /**< AMRWB Mode 8 = 23850 bps */ + OMX_AUDIO_AMRBandModeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_AUDIO_AMRBandModeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + OMX_AUDIO_AMRBandModeMax = 0x7FFFFFFF +} OMX_AUDIO_AMRBANDMODETYPE; + + +/** AMR Discontinuous Transmission mode */ +typedef enum OMX_AUDIO_AMRDTXMODETYPE { + OMX_AUDIO_AMRDTXModeOff = 0, /**< AMR Discontinuous Transmission Mode is disabled */ + OMX_AUDIO_AMRDTXModeOnVAD1, /**< AMR Discontinuous Transmission Mode using + Voice Activity Detector 1 (VAD1) is enabled */ + OMX_AUDIO_AMRDTXModeOnVAD2, /**< AMR Discontinuous Transmission Mode using + Voice Activity Detector 2 (VAD2) is enabled */ + OMX_AUDIO_AMRDTXModeOnAuto, /**< The codec will automatically select between + Off, VAD1 or VAD2 modes */ + + OMX_AUDIO_AMRDTXasEFR, /**< DTX as EFR instead of AMR standard (3GPP 26.101, frame type =8,9,10) */ + + OMX_AUDIO_AMRDTXModeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_AUDIO_AMRDTXModeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + OMX_AUDIO_AMRDTXModeMax = 0x7FFFFFFF +} OMX_AUDIO_AMRDTXMODETYPE; + + +/** AMR params */ +typedef struct OMX_AUDIO_PARAM_AMRTYPE { + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nPortIndex; /**< port that this structure applies to */ + OMX_U32 nChannels; /**< Number of channels */ + OMX_U32 nBitRate; /**< Bit rate read only field */ + OMX_AUDIO_AMRBANDMODETYPE eAMRBandMode; /**< AMR Band Mode enumeration */ + OMX_AUDIO_AMRDTXMODETYPE eAMRDTXMode; /**< AMR DTX Mode enumeration */ + OMX_AUDIO_AMRFRAMEFORMATTYPE eAMRFrameFormat; /**< AMR frame format enumeration */ +} OMX_AUDIO_PARAM_AMRTYPE; + + +/** GSM_FR (ETSI 06.10, 3GPP 46.010) stream format parameters */ +typedef struct OMX_AUDIO_PARAM_GSMFRTYPE { + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nPortIndex; /**< port that this structure applies to */ + OMX_BOOL bDTX; /**< Enable Discontinuous Transmisssion */ + OMX_BOOL bHiPassFilter; /**< Enable High Pass Filter */ +} OMX_AUDIO_PARAM_GSMFRTYPE; + + +/** GSM-HR (ETSI 06.20, 3GPP 46.020) stream format parameters */ +typedef struct OMX_AUDIO_PARAM_GSMHRTYPE { + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nPortIndex; /**< port that this structure applies to */ + OMX_BOOL bDTX; /**< Enable Discontinuous Transmisssion */ + OMX_BOOL bHiPassFilter; /**< Enable High Pass Filter */ +} OMX_AUDIO_PARAM_GSMHRTYPE; + + +/** GSM-EFR (ETSI 06.60, 3GPP 46.060) stream format parameters */ +typedef struct OMX_AUDIO_PARAM_GSMEFRTYPE { + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nPortIndex; /**< port that this structure applies to */ + OMX_BOOL bDTX; /**< Enable Discontinuous Transmisssion */ + OMX_BOOL bHiPassFilter; /**< Enable High Pass Filter */ +} OMX_AUDIO_PARAM_GSMEFRTYPE; + + +/** TDMA FR (TIA/EIA-136-420, VSELP 7.95kbps coder) stream format parameters */ +typedef struct OMX_AUDIO_PARAM_TDMAFRTYPE { + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nPortIndex; /**< port that this structure applies to */ + OMX_U32 nChannels; /**< Number of channels in the data stream (not + necessarily the same as the number of channels + to be rendered. */ + OMX_BOOL bDTX; /**< Enable Discontinuous Transmisssion */ + OMX_BOOL bHiPassFilter; /**< Enable High Pass Filter */ +} OMX_AUDIO_PARAM_TDMAFRTYPE; + + +/** TDMA EFR (TIA/EIA-136-410, ACELP 7.4kbps coder) stream format parameters */ +typedef struct OMX_AUDIO_PARAM_TDMAEFRTYPE { + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nPortIndex; /**< port that this structure applies to */ + OMX_U32 nChannels; /**< Number of channels in the data stream (not + necessarily the same as the number of channels + to be rendered. */ + OMX_BOOL bDTX; /**< Enable Discontinuous Transmisssion */ + OMX_BOOL bHiPassFilter; /**< Enable High Pass Filter */ +} OMX_AUDIO_PARAM_TDMAEFRTYPE; + + +/** PDC FR ( RCR-27, VSELP 6.7kbps coder) stream format parameters */ +typedef struct OMX_AUDIO_PARAM_PDCFRTYPE { + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nPortIndex; /**< port that this structure applies to */ + OMX_U32 nChannels; /**< Number of channels in the data stream (not + necessarily the same as the number of channels + to be rendered. */ + OMX_BOOL bDTX; /**< Enable Discontinuous Transmisssion */ + OMX_BOOL bHiPassFilter; /**< Enable High Pass Filter */ +} OMX_AUDIO_PARAM_PDCFRTYPE; + + +/** PDC EFR ( RCR-27, ACELP 6.7kbps coder) stream format parameters */ +typedef struct OMX_AUDIO_PARAM_PDCEFRTYPE { + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nPortIndex; /**< port that this structure applies to */ + OMX_U32 nChannels; /**< Number of channels in the data stream (not + necessarily the same as the number of channels + to be rendered. */ + OMX_BOOL bDTX; /**< Enable Discontinuous Transmisssion */ + OMX_BOOL bHiPassFilter; /**< Enable High Pass Filter */ +} OMX_AUDIO_PARAM_PDCEFRTYPE; + +/** PDC HR ( RCR-27, PSI-CELP 3.45kbps coder) stream format parameters */ +typedef struct OMX_AUDIO_PARAM_PDCHRTYPE { + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nPortIndex; /**< port that this structure applies to */ + OMX_U32 nChannels; /**< Number of channels in the data stream (not + necessarily the same as the number of channels + to be rendered. */ + OMX_BOOL bDTX; /**< Enable Discontinuous Transmisssion */ + OMX_BOOL bHiPassFilter; /**< Enable High Pass Filter */ +} OMX_AUDIO_PARAM_PDCHRTYPE; + + +/** CDMA Rate types */ +typedef enum OMX_AUDIO_CDMARATETYPE { + OMX_AUDIO_CDMARateBlank = 0, /**< CDMA encoded frame is blank */ + OMX_AUDIO_CDMARateFull, /**< CDMA encoded frame in full rate */ + OMX_AUDIO_CDMARateHalf, /**< CDMA encoded frame in half rate */ + OMX_AUDIO_CDMARateQuarter, /**< CDMA encoded frame in quarter rate */ + OMX_AUDIO_CDMARateEighth, /**< CDMA encoded frame in eighth rate (DTX)*/ + OMX_AUDIO_CDMARateErasure, /**< CDMA erasure frame */ + OMX_AUDIO_CDMARateKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_AUDIO_CDMARateVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + OMX_AUDIO_CDMARateMax = 0x7FFFFFFF +} OMX_AUDIO_CDMARATETYPE; + + +/** QCELP8 (TIA/EIA-96, up to 8kbps coder) stream format parameters */ +typedef struct OMX_AUDIO_PARAM_QCELP8TYPE { + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nPortIndex; /**< port that this structure applies to */ + OMX_U32 nChannels; /**< Number of channels in the data stream (not + necessarily the same as the number of channels + to be rendered. */ + OMX_U32 nBitRate; /**< Bit rate of the input data. Use 0 for variable + rate or unknown bit rates */ + OMX_AUDIO_CDMARATETYPE eCDMARate; /**< Frame rate */ + OMX_U32 nMinBitRate; /**< minmal rate for the encoder = 1,2,3,4, default = 1 */ + OMX_U32 nMaxBitRate; /**< maximal rate for the encoder = 1,2,3,4, default = 4 */ +} OMX_AUDIO_PARAM_QCELP8TYPE; + + +/** QCELP13 ( CDMA, EIA/TIA-733, 13.3kbps coder) stream format parameters */ +typedef struct OMX_AUDIO_PARAM_QCELP13TYPE { + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nPortIndex; /**< port that this structure applies to */ + OMX_U32 nChannels; /**< Number of channels in the data stream (not + necessarily the same as the number of channels + to be rendered. */ + OMX_AUDIO_CDMARATETYPE eCDMARate; /**< Frame rate */ + OMX_U32 nMinBitRate; /**< minmal rate for the encoder = 1,2,3,4, default = 1 */ + OMX_U32 nMaxBitRate; /**< maximal rate for the encoder = 1,2,3,4, default = 4 */ +} OMX_AUDIO_PARAM_QCELP13TYPE; + + +/** EVRC ( CDMA, EIA/TIA-127, RCELP up to 8.55kbps coder) stream format parameters */ +typedef struct OMX_AUDIO_PARAM_EVRCTYPE { + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nPortIndex; /**< port that this structure applies to */ + OMX_U32 nChannels; /**< Number of channels in the data stream (not + necessarily the same as the number of channels + to be rendered. */ + OMX_AUDIO_CDMARATETYPE eCDMARate; /**< actual Frame rate */ + OMX_BOOL bRATE_REDUCon; /**< RATE_REDUCtion is requested for this frame */ + OMX_U32 nMinBitRate; /**< minmal rate for the encoder = 1,2,3,4, default = 1 */ + OMX_U32 nMaxBitRate; /**< maximal rate for the encoder = 1,2,3,4, default = 4 */ + OMX_BOOL bHiPassFilter; /**< Enable encoder's High Pass Filter */ + OMX_BOOL bNoiseSuppressor; /**< Enable encoder's noise suppressor pre-processing */ + OMX_BOOL bPostFilter; /**< Enable decoder's post Filter */ +} OMX_AUDIO_PARAM_EVRCTYPE; + + +/** SMV ( up to 8.55kbps coder) stream format parameters */ +typedef struct OMX_AUDIO_PARAM_SMVTYPE { + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nPortIndex; /**< port that this structure applies to */ + OMX_U32 nChannels; /**< Number of channels in the data stream (not + necessarily the same as the number of channels + to be rendered. */ + OMX_AUDIO_CDMARATETYPE eCDMARate; /**< Frame rate */ + OMX_BOOL bRATE_REDUCon; /**< RATE_REDUCtion is requested for this frame */ + OMX_U32 nMinBitRate; /**< minmal rate for the encoder = 1,2,3,4, default = 1 ??*/ + OMX_U32 nMaxBitRate; /**< maximal rate for the encoder = 1,2,3,4, default = 4 ??*/ + OMX_BOOL bHiPassFilter; /**< Enable encoder's High Pass Filter ??*/ + OMX_BOOL bNoiseSuppressor; /**< Enable encoder's noise suppressor pre-processing */ + OMX_BOOL bPostFilter; /**< Enable decoder's post Filter ??*/ +} OMX_AUDIO_PARAM_SMVTYPE; + + +/** MIDI Format + * @ingroup midi + */ +typedef enum OMX_AUDIO_MIDIFORMATTYPE +{ + OMX_AUDIO_MIDIFormatUnknown = 0, /**< MIDI Format unknown or don't care */ + OMX_AUDIO_MIDIFormatSMF0, /**< Standard MIDI File Type 0 */ + OMX_AUDIO_MIDIFormatSMF1, /**< Standard MIDI File Type 1 */ + OMX_AUDIO_MIDIFormatSMF2, /**< Standard MIDI File Type 2 */ + OMX_AUDIO_MIDIFormatSPMIDI, /**< SP-MIDI */ + OMX_AUDIO_MIDIFormatXMF0, /**< eXtensible Music Format type 0 */ + OMX_AUDIO_MIDIFormatXMF1, /**< eXtensible Music Format type 1 */ + OMX_AUDIO_MIDIFormatMobileXMF, /**< Mobile XMF (eXtensible Music Format type 2) */ + OMX_AUDIO_MIDIFormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_AUDIO_MIDIFormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + OMX_AUDIO_MIDIFormatMax = 0x7FFFFFFF +} OMX_AUDIO_MIDIFORMATTYPE; + + +/** MIDI params + * @ingroup midi + */ +typedef struct OMX_AUDIO_PARAM_MIDITYPE { + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nPortIndex; /**< port that this structure applies to */ + OMX_U32 nFileSize; /**< size of the MIDI file in bytes, where the entire + MIDI file passed in, otherwise if 0x0, the MIDI data + is merged and streamed (instead of passed as an + entire MIDI file) */ + OMX_BU32 sMaxPolyphony; /**< Specifies the maximum simultaneous polyphonic + voices. A value of zero indicates that the default + polyphony of the device is used */ + OMX_BOOL bLoadDefaultSound; /**< Whether to load default sound + bank at initialization */ + OMX_AUDIO_MIDIFORMATTYPE eMidiFormat; /**< Version of the MIDI file */ +} OMX_AUDIO_PARAM_MIDITYPE; + + +/** Type of the MIDI sound bank + * @ingroup midi + */ +typedef enum OMX_AUDIO_MIDISOUNDBANKTYPE { + OMX_AUDIO_MIDISoundBankUnused = 0, /**< unused/unknown soundbank type */ + OMX_AUDIO_MIDISoundBankDLS1, /**< DLS version 1 */ + OMX_AUDIO_MIDISoundBankDLS2, /**< DLS version 2 */ + OMX_AUDIO_MIDISoundBankMobileDLSBase, /**< Mobile DLS, using the base functionality */ + OMX_AUDIO_MIDISoundBankMobileDLSPlusOptions, /**< Mobile DLS, using the specification-defined optional feature set */ + OMX_AUDIO_MIDISoundBankKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_AUDIO_MIDISoundBankVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + OMX_AUDIO_MIDISoundBankMax = 0x7FFFFFFF +} OMX_AUDIO_MIDISOUNDBANKTYPE; + + +/** Bank Layout describes how bank MSB & LSB are used in the DLS instrument definitions sound bank + * @ingroup midi + */ +typedef enum OMX_AUDIO_MIDISOUNDBANKLAYOUTTYPE { + OMX_AUDIO_MIDISoundBankLayoutUnused = 0, /**< unused/unknown soundbank type */ + OMX_AUDIO_MIDISoundBankLayoutGM, /**< GS layout (based on bank MSB 0x00) */ + OMX_AUDIO_MIDISoundBankLayoutGM2, /**< General MIDI 2 layout (using MSB 0x78/0x79, LSB 0x00) */ + OMX_AUDIO_MIDISoundBankLayoutUser, /**< Does not conform to any bank numbering standards */ + OMX_AUDIO_MIDISoundBankLayoutKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_AUDIO_MIDISoundBankLayoutVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + OMX_AUDIO_MIDISoundBankLayoutMax = 0x7FFFFFFF +} OMX_AUDIO_MIDISOUNDBANKLAYOUTTYPE; + + +/** MIDI params to load/unload user soundbank + * @ingroup midi + */ +typedef struct OMX_AUDIO_PARAM_MIDILOADUSERSOUNDTYPE { + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nPortIndex; /**< port that this structure applies to */ + OMX_U32 nDLSIndex; /**< DLS file index to be loaded */ + OMX_U32 nDLSSize; /**< Size in bytes */ + OMX_PTR pDLSData; /**< Pointer to DLS file data */ + OMX_AUDIO_MIDISOUNDBANKTYPE eMidiSoundBank; /**< Midi sound bank type enumeration */ + OMX_AUDIO_MIDISOUNDBANKLAYOUTTYPE eMidiSoundBankLayout; /**< Midi sound bank layout enumeration */ +} OMX_AUDIO_PARAM_MIDILOADUSERSOUNDTYPE; + + +/** Structure for Live MIDI events and MIP messages. + * (MIP = Maximum Instantaneous Polyphony; part of the SP-MIDI standard.) + * @ingroup midi + */ +typedef struct OMX_AUDIO_CONFIG_MIDIIMMEDIATEEVENTTYPE { + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nPortIndex; /**< Port that this structure applies to */ + OMX_U32 nMidiEventSize; /**< Size of immediate MIDI events or MIP message in bytes */ + OMX_U8 nMidiEvents[1]; /**< MIDI event array to be rendered immediately, or an + array for the MIP message buffer, where the size is + indicated by nMidiEventSize */ +} OMX_AUDIO_CONFIG_MIDIIMMEDIATEEVENTTYPE; + + +/** MIDI sound bank/ program pair in a given channel + * @ingroup midi + */ +typedef struct OMX_AUDIO_CONFIG_MIDISOUNDBANKPROGRAMTYPE { + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nPortIndex; /**< Port that this structure applies to */ + OMX_U32 nChannel; /**< Valid channel values range from 1 to 16 */ + OMX_U16 nIDProgram; /**< Valid program ID range is 1 to 128 */ + OMX_U16 nIDSoundBank; /**< Sound bank ID */ + OMX_U32 nUserSoundBankIndex;/**< User soundbank index, easier to access soundbanks + by index if multiple banks are present */ +} OMX_AUDIO_CONFIG_MIDISOUNDBANKPROGRAMTYPE; + + +/** MIDI control + * @ingroup midi + */ +typedef struct OMX_AUDIO_CONFIG_MIDICONTROLTYPE { + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nPortIndex; /**< port that this structure applies to */ + OMX_BS32 sPitchTransposition; /**< Pitch transposition in semitones, stored as Q22.10 + format based on JAVA MMAPI (JSR-135) requirement */ + OMX_BU32 sPlayBackRate; /**< Relative playback rate, stored as Q14.17 fixed-point + number based on JSR-135 requirement */ + OMX_BU32 sTempo ; /**< Tempo in beats per minute (BPM), stored as Q22.10 + fixed-point number based on JSR-135 requirement */ + OMX_U32 nMaxPolyphony; /**< Specifies the maximum simultaneous polyphonic + voices. A value of zero indicates that the default + polyphony of the device is used */ + OMX_U32 nNumRepeat; /**< Number of times to repeat playback */ + OMX_U32 nStopTime; /**< Time in milliseconds to indicate when playback + will stop automatically. Set to zero if not used */ + OMX_U16 nChannelMuteMask; /**< 16 bit mask for channel mute status */ + OMX_U16 nChannelSoloMask; /**< 16 bit mask for channel solo status */ + OMX_U32 nTrack0031MuteMask; /**< 32 bit mask for track mute status. Note: This is for tracks 0-31 */ + OMX_U32 nTrack3263MuteMask; /**< 32 bit mask for track mute status. Note: This is for tracks 32-63 */ + OMX_U32 nTrack0031SoloMask; /**< 32 bit mask for track solo status. Note: This is for tracks 0-31 */ + OMX_U32 nTrack3263SoloMask; /**< 32 bit mask for track solo status. Note: This is for tracks 32-63 */ + +} OMX_AUDIO_CONFIG_MIDICONTROLTYPE; + + +/** MIDI Playback States + * @ingroup midi + */ +typedef enum OMX_AUDIO_MIDIPLAYBACKSTATETYPE { + OMX_AUDIO_MIDIPlayBackStateUnknown = 0, /**< Unknown state or state does not map to + other defined states */ + OMX_AUDIO_MIDIPlayBackStateClosedEngaged, /**< No MIDI resource is currently open. + The MIDI engine is currently processing + MIDI events. */ + OMX_AUDIO_MIDIPlayBackStateParsing, /**< A MIDI resource is open and is being + primed. The MIDI engine is currently + processing MIDI events. */ + OMX_AUDIO_MIDIPlayBackStateOpenEngaged, /**< A MIDI resource is open and primed but + not playing. The MIDI engine is currently + processing MIDI events. The transition to + this state is only possible from the + OMX_AUDIO_MIDIPlayBackStatePlaying state, + when the 'playback head' reaches the end + of media data or the playback stops due + to stop time set.*/ + OMX_AUDIO_MIDIPlayBackStatePlaying, /**< A MIDI resource is open and currently + playing. The MIDI engine is currently + processing MIDI events.*/ + OMX_AUDIO_MIDIPlayBackStatePlayingPartially, /**< Best-effort playback due to SP-MIDI/DLS + resource constraints */ + OMX_AUDIO_MIDIPlayBackStatePlayingSilently, /**< Due to system resource constraints and + SP-MIDI content constraints, there is + no audible MIDI content during playback + currently. The situation may change if + resources are freed later.*/ + OMX_AUDIO_MIDIPlayBackStateKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_AUDIO_MIDIPlayBackStateVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + OMX_AUDIO_MIDIPlayBackStateMax = 0x7FFFFFFF +} OMX_AUDIO_MIDIPLAYBACKSTATETYPE; + + +/** MIDI status + * @ingroup midi + */ +typedef struct OMX_AUDIO_CONFIG_MIDISTATUSTYPE { + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nPortIndex; /**< port that this structure applies to */ + OMX_U16 nNumTracks; /**< Number of MIDI tracks in the file, read only field. + NOTE: May not return a meaningful value until the entire + file is parsed and buffered. */ + OMX_U32 nDuration; /**< The length of the currently open MIDI resource + in milliseconds. NOTE: May not return a meaningful value + until the entire file is parsed and buffered. */ + OMX_U32 nPosition; /**< Current Position of the MIDI resource being played + in milliseconds */ + OMX_BOOL bVibra; /**< Does Vibra track exist? NOTE: May not return a meaningful + value until the entire file is parsed and buffered. */ + OMX_U32 nNumMetaEvents; /**< Total number of MIDI Meta Events in the currently + open MIDI resource. NOTE: May not return a meaningful value + until the entire file is parsed and buffered. */ + OMX_U32 nNumActiveVoices; /**< Number of active voices in the currently playing + MIDI resource. NOTE: May not return a meaningful value until + the entire file is parsed and buffered. */ + OMX_AUDIO_MIDIPLAYBACKSTATETYPE eMIDIPlayBackState; /**< MIDI playback state enumeration, read only field */ +} OMX_AUDIO_CONFIG_MIDISTATUSTYPE; + + +/** MIDI Meta Event structure one per Meta Event. + * MIDI Meta Events are like audio metadata, except that they are interspersed + * with the MIDI content throughout the file and are not localized in the header. + * As such, it is necessary to retrieve information about these Meta Events from + * the engine, as it encounters these Meta Events within the MIDI content. + * For example, SMF files can have up to 14 types of MIDI Meta Events (copyright, + * author, default tempo, etc.) scattered throughout the file. + * @ingroup midi + */ +typedef struct OMX_AUDIO_CONFIG_MIDIMETAEVENTTYPE{ + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nPortIndex; /**< port that this structure applies to */ + OMX_U32 nIndex; /**< Index of Meta Event */ + OMX_U8 nMetaEventType; /**< Meta Event Type, 7bits (i.e. 0 - 127) */ + OMX_U32 nMetaEventSize; /**< size of the Meta Event in bytes */ + OMX_U32 nTrack; /**< track number for the meta event */ + OMX_U32 nPosition; /**< Position of the meta-event in milliseconds */ +} OMX_AUDIO_CONFIG_MIDIMETAEVENTTYPE; + + +/** MIDI Meta Event Data structure - one per Meta Event. + * @ingroup midi + */ +typedef struct OMX_AUDIO_CONFIG_MIDIMETAEVENTDATATYPE{ + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nPortIndex; /**< port that this structure applies to */ + OMX_U32 nIndex; /**< Index of Meta Event */ + OMX_U32 nMetaEventSize; /**< size of the Meta Event in bytes */ + OMX_U8 nData[1]; /**< array of one or more bytes of meta data + as indicated by the nMetaEventSize field */ +} OMX_AUDIO_CONFIG__MIDIMETAEVENTDATATYPE; + + +/** Audio Volume adjustment for a port */ +typedef struct OMX_AUDIO_CONFIG_VOLUMETYPE { + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nPortIndex; /**< Port index indicating which port to + set. Select the input port to set + just that port's volume. Select the + output port to adjust the master + volume. */ + OMX_BOOL bLinear; /**< Is the volume to be set in linear (0.100) + or logarithmic scale (mB) */ + OMX_BS32 sVolume; /**< Volume linear setting in the 0..100 range, OR + Volume logarithmic setting for this port. The values + for volume are in mB (millibels = 1/100 dB) relative + to a gain of 1 (e.g. the output is the same as the + input level). Values are in mB from nMax + (maximum volume) to nMin mB (typically negative). + Since the volume is "voltage" + and not a "power", it takes a setting of + -600 mB to decrease the volume by 1/2. If + a component cannot accurately set the + volume to the requested value, it must + set the volume to the closest value BELOW + the requested value. When getting the + volume setting, the current actual volume + must be returned. */ +} OMX_AUDIO_CONFIG_VOLUMETYPE; + + +/** Audio Volume adjustment for a channel */ +typedef struct OMX_AUDIO_CONFIG_CHANNELVOLUMETYPE { + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nPortIndex; /**< Port index indicating which port to + set. Select the input port to set + just that port's volume. Select the + output port to adjust the master + volume. */ + OMX_U32 nChannel; /**< channel to select from 0 to N-1, + using OMX_ALL to apply volume settings + to all channels */ + OMX_BOOL bLinear; /**< Is the volume to be set in linear (0.100) or + logarithmic scale (mB) */ + OMX_BS32 sVolume; /**< Volume linear setting in the 0..100 range, OR + Volume logarithmic setting for this port. + The values for volume are in mB + (millibels = 1/100 dB) relative to a gain + of 1 (e.g. the output is the same as the + input level). Values are in mB from nMax + (maximum volume) to nMin mB (typically negative). + Since the volume is "voltage" + and not a "power", it takes a setting of + -600 mB to decrease the volume by 1/2. If + a component cannot accurately set the + volume to the requested value, it must + set the volume to the closest value BELOW + the requested value. When getting the + volume setting, the current actual volume + must be returned. */ + OMX_BOOL bIsMIDI; /**< TRUE if nChannel refers to a MIDI channel, + FALSE otherwise */ +} OMX_AUDIO_CONFIG_CHANNELVOLUMETYPE; + + +/** Audio balance setting */ +typedef struct OMX_AUDIO_CONFIG_BALANCETYPE { + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nPortIndex; /**< Port index indicating which port to + set. Select the input port to set + just that port's balance. Select the + output port to adjust the master + balance. */ + OMX_S32 nBalance; /**< balance setting for this port + (-100 to 100, where -100 indicates + all left, and no right */ +} OMX_AUDIO_CONFIG_BALANCETYPE; + + +/** Audio Port mute */ +typedef struct OMX_AUDIO_CONFIG_MUTETYPE { + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nPortIndex; /**< Port index indicating which port to + set. Select the input port to set + just that port's mute. Select the + output port to adjust the master + mute. */ + OMX_BOOL bMute; /**< Mute setting for this port */ +} OMX_AUDIO_CONFIG_MUTETYPE; + + +/** Audio Channel mute */ +typedef struct OMX_AUDIO_CONFIG_CHANNELMUTETYPE { + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nPortIndex; /**< port that this structure applies to */ + OMX_U32 nChannel; /**< channel to select from 0 to N-1, + using OMX_ALL to apply mute settings + to all channels */ + OMX_BOOL bMute; /**< Mute setting for this channel */ + OMX_BOOL bIsMIDI; /**< TRUE if nChannel refers to a MIDI channel, + FALSE otherwise */ +} OMX_AUDIO_CONFIG_CHANNELMUTETYPE; + + + +/** Enable / Disable for loudness control, which boosts bass and to a + * smaller extent high end frequencies to compensate for hearing + * ability at the extreme ends of the audio spectrum + */ +typedef struct OMX_AUDIO_CONFIG_LOUDNESSTYPE { + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nPortIndex; /**< port that this structure applies to */ + OMX_BOOL bLoudness; /**< Enable/disable for loudness */ +} OMX_AUDIO_CONFIG_LOUDNESSTYPE; + + +/** Enable / Disable for bass, which controls low frequencies + */ +typedef struct OMX_AUDIO_CONFIG_BASSTYPE { + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nPortIndex; /**< port that this structure applies to */ + OMX_BOOL bEnable; /**< Enable/disable for bass control */ + OMX_S32 nBass; /**< bass setting for the port, as a + continuous value from -100 to 100 + (0 means no change in bass level)*/ +} OMX_AUDIO_CONFIG_BASSTYPE; + + +/** Enable / Disable for treble, which controls high frequencies tones + */ +typedef struct OMX_AUDIO_CONFIG_TREBLETYPE { + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nPortIndex; /**< port that this structure applies to */ + OMX_BOOL bEnable; /**< Enable/disable for treble control */ + OMX_S32 nTreble; /**< treble setting for the port, as a + continuous value from -100 to 100 + (0 means no change in treble level) */ +} OMX_AUDIO_CONFIG_TREBLETYPE; + + +/** An equalizer is typically used for two reasons: to compensate for an + * sub-optimal frequency response of a system to make it sound more natural + * or to create intentionally some unnatural coloring to the sound to create + * an effect. + * @ingroup effects + */ +typedef struct OMX_AUDIO_CONFIG_EQUALIZERTYPE { + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nPortIndex; /**< port that this structure applies to */ + OMX_BOOL bEnable; /**< Enable/disable for equalizer */ + OMX_BU32 sBandIndex; /**< Band number to be set. Upper Limit is + N-1, where N is the number of bands, lower limit is 0 */ + OMX_BU32 sCenterFreq; /**< Center frequecies in Hz. This is a + read only element and is used to determine + the lower, center and upper frequency of + this band. */ + OMX_BS32 sBandLevel; /**< band level in millibels */ +} OMX_AUDIO_CONFIG_EQUALIZERTYPE; + + +/** Stereo widening mode type + * @ingroup effects + */ +typedef enum OMX_AUDIO_STEREOWIDENINGTYPE { + OMX_AUDIO_StereoWideningHeadphones, /**< Stereo widening for loudspeakers */ + OMX_AUDIO_StereoWideningLoudspeakers, /**< Stereo widening for closely spaced loudspeakers */ + OMX_AUDIO_StereoWideningKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_AUDIO_StereoWideningVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + OMX_AUDIO_StereoWideningMax = 0x7FFFFFFF +} OMX_AUDIO_STEREOWIDENINGTYPE; + + +/** Control for stereo widening, which is a special 2-channel + * case of the audio virtualizer effect. For example, for 5.1-channel + * output, it translates to virtual surround sound. + * @ingroup effects + */ +typedef struct OMX_AUDIO_CONFIG_STEREOWIDENINGTYPE { + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nPortIndex; /**< port that this structure applies to */ + OMX_BOOL bEnable; /**< Enable/disable for stereo widening control */ + OMX_AUDIO_STEREOWIDENINGTYPE eWideningType; /**< Stereo widening algorithm type */ + OMX_U32 nStereoWidening; /**< stereo widening setting for the port, + as a continuous value from 0 to 100 */ +} OMX_AUDIO_CONFIG_STEREOWIDENINGTYPE; + + +/** The chorus effect (or ``choralizer'') is any signal processor which makes + * one sound source (such as a voice) sound like many such sources singing + * (or playing) in unison. Since performance in unison is never exact, chorus + * effects simulate this by making independently modified copies of the input + * signal. Modifications may include (1) delay, (2) frequency shift, and + * (3) amplitude modulation. + * @ingroup effects + */ +typedef struct OMX_AUDIO_CONFIG_CHORUSTYPE { + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nPortIndex; /**< port that this structure applies to */ + OMX_BOOL bEnable; /**< Enable/disable for chorus */ + OMX_BU32 sDelay; /**< average delay in milliseconds */ + OMX_BU32 sModulationRate; /**< rate of modulation in millihertz */ + OMX_U32 nModulationDepth; /**< depth of modulation as a percentage of + delay (i.e. 0 to 100) */ + OMX_BU32 nFeedback; /**< Feedback from chorus output to input in percentage */ +} OMX_AUDIO_CONFIG_CHORUSTYPE; + + +/** Reverberation is part of the reflected sound that follows the early + * reflections. In a typical room, this consists of a dense succession of + * echoes whose energy decays exponentially. The reverberation effect structure + * as defined here includes both (early) reflections as well as (late) reverberations. + * @ingroup effects + */ +typedef struct OMX_AUDIO_CONFIG_REVERBERATIONTYPE { + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nPortIndex; /**< port that this structure applies to */ + OMX_BOOL bEnable; /**< Enable/disable for reverberation control */ + OMX_BS32 sRoomLevel; /**< Intensity level for the whole room effect + (i.e. both early reflections and late + reverberation) in millibels */ + OMX_BS32 sRoomHighFreqLevel; /**< Attenuation at high frequencies + relative to the intensity at low + frequencies in millibels */ + OMX_BS32 sReflectionsLevel; /**< Intensity level of early reflections + (relative to room value), in millibels */ + OMX_BU32 sReflectionsDelay; /**< Delay time of the first reflection relative + to the direct path, in milliseconds */ + OMX_BS32 sReverbLevel; /**< Intensity level of late reverberation + relative to room level, in millibels */ + OMX_BU32 sReverbDelay; /**< Time delay from the first early reflection + to the beginning of the late reverberation + section, in milliseconds */ + OMX_BU32 sDecayTime; /**< Late reverberation decay time at low + frequencies, in milliseconds */ + OMX_BU32 nDecayHighFreqRatio; /**< Ratio of high frequency decay time relative + to low frequency decay time in percent */ + OMX_U32 nDensity; /**< Modal density in the late reverberation decay, + in percent (i.e. 0 - 100) */ + OMX_U32 nDiffusion; /**< Echo density in the late reverberation decay, + in percent (i.e. 0 - 100) */ + OMX_BU32 sReferenceHighFreq; /**< Reference high frequency in Hertz. This is + the frequency used as the reference for all + the high-frequency settings above */ + +} OMX_AUDIO_CONFIG_REVERBERATIONTYPE; + + +/** Possible settings for the Echo Cancelation structure to use + * @ingroup effects + */ +typedef enum OMX_AUDIO_ECHOCANTYPE { + OMX_AUDIO_EchoCanOff = 0, /**< Echo Cancellation is disabled */ + OMX_AUDIO_EchoCanNormal, /**< Echo Cancellation normal operation - + echo from plastics and face */ + OMX_AUDIO_EchoCanHFree, /**< Echo Cancellation optimized for + Hands Free operation */ + OMX_AUDIO_EchoCanCarKit, /**< Echo Cancellation optimized for + Car Kit (longer echo) */ + OMX_AUDIO_EchoCanKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_AUDIO_EchoCanVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + OMX_AUDIO_EchoCanMax = 0x7FFFFFFF +} OMX_AUDIO_ECHOCANTYPE; + + +/** Enable / Disable for echo cancelation, which removes undesired echo's + * from the audio + * @ingroup effects + */ +typedef struct OMX_AUDIO_CONFIG_ECHOCANCELATIONTYPE { + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nPortIndex; /**< port that this structure applies to */ + OMX_AUDIO_ECHOCANTYPE eEchoCancelation; /**< Echo cancelation settings */ +} OMX_AUDIO_CONFIG_ECHOCANCELATIONTYPE; + + +/** Enable / Disable for noise reduction, which undesired noise from + * the audio + * @ingroup effects + */ +typedef struct OMX_AUDIO_CONFIG_NOISEREDUCTIONTYPE { + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nPortIndex; /**< port that this structure applies to */ + OMX_BOOL bNoiseReduction; /**< Enable/disable for noise reduction */ +} OMX_AUDIO_CONFIG_NOISEREDUCTIONTYPE; + +/** @} */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif +/* File EOF */ + diff --git a/third_party/openmax/include/OMX_Component.h b/third_party/openmax/include/OMX_Component.h new file mode 100644 index 000000000..d5956405e --- /dev/null +++ b/third_party/openmax/include/OMX_Component.h @@ -0,0 +1,579 @@ +/* + * Copyright (c) 2008 The Khronos Group Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject + * to the following conditions: + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +/** OMX_Component.h - OpenMax IL version 1.1.2 + * The OMX_Component header file contains the definitions used to define + * the public interface of a component. This header file is intended to + * be used by both the application and the component. + */ + +#ifndef OMX_Component_h +#define OMX_Component_h + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + + +/* Each OMX header must include all required header files to allow the + * header to compile without errors. The includes below are required + * for this header file to compile successfully + */ + +#include +#include +#include +#include + +/** @ingroup comp */ +typedef enum OMX_PORTDOMAINTYPE { + OMX_PortDomainAudio, + OMX_PortDomainVideo, + OMX_PortDomainImage, + OMX_PortDomainOther, + OMX_PortDomainKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_PortDomainVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + OMX_PortDomainMax = 0x7ffffff +} OMX_PORTDOMAINTYPE; + +/** @ingroup comp */ +typedef struct OMX_PARAM_PORTDEFINITIONTYPE { + OMX_U32 nSize; /**< Size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nPortIndex; /**< Port number the structure applies to */ + OMX_DIRTYPE eDir; /**< Direction (input or output) of this port */ + OMX_U32 nBufferCountActual; /**< The actual number of buffers allocated on this port */ + OMX_U32 nBufferCountMin; /**< The minimum number of buffers this port requires */ + OMX_U32 nBufferSize; /**< Size, in bytes, for buffers to be used for this channel */ + OMX_BOOL bEnabled; /**< Ports default to enabled and are enabled/disabled by + OMX_CommandPortEnable/OMX_CommandPortDisable. + When disabled a port is unpopulated. A disabled port + is not populated with buffers on a transition to IDLE. */ + OMX_BOOL bPopulated; /**< Port is populated with all of its buffers as indicated by + nBufferCountActual. A disabled port is always unpopulated. + An enabled port is populated on a transition to OMX_StateIdle + and unpopulated on a transition to loaded. */ + OMX_PORTDOMAINTYPE eDomain; /**< Domain of the port. Determines the contents of metadata below. */ + union { + OMX_AUDIO_PORTDEFINITIONTYPE audio; + OMX_VIDEO_PORTDEFINITIONTYPE video; + OMX_IMAGE_PORTDEFINITIONTYPE image; + OMX_OTHER_PORTDEFINITIONTYPE other; + } format; + OMX_BOOL bBuffersContiguous; + OMX_U32 nBufferAlignment; +} OMX_PARAM_PORTDEFINITIONTYPE; + +/** @ingroup comp */ +typedef struct OMX_PARAM_U32TYPE { + OMX_U32 nSize; /**< Size of this structure, in Bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nPortIndex; /**< port that this structure applies to */ + OMX_U32 nU32; /**< U32 value */ +} OMX_PARAM_U32TYPE; + +/** @ingroup rpm */ +typedef enum OMX_SUSPENSIONPOLICYTYPE { + OMX_SuspensionDisabled, /**< No suspension; v1.0 behavior */ + OMX_SuspensionEnabled, /**< Suspension allowed */ + OMX_SuspensionPolicyKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_SuspensionPolicyStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + OMX_SuspensionPolicyMax = 0x7fffffff +} OMX_SUSPENSIONPOLICYTYPE; + +/** @ingroup rpm */ +typedef struct OMX_PARAM_SUSPENSIONPOLICYTYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_SUSPENSIONPOLICYTYPE ePolicy; +} OMX_PARAM_SUSPENSIONPOLICYTYPE; + +/** @ingroup rpm */ +typedef enum OMX_SUSPENSIONTYPE { + OMX_NotSuspended, /**< component is not suspended */ + OMX_Suspended, /**< component is suspended */ + OMX_SuspensionKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_SuspensionVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + OMX_SuspendMax = 0x7FFFFFFF +} OMX_SUSPENSIONTYPE; + +/** @ingroup rpm */ +typedef struct OMX_PARAM_SUSPENSIONTYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_SUSPENSIONTYPE eType; +} OMX_PARAM_SUSPENSIONTYPE ; + +typedef struct OMX_CONFIG_BOOLEANTYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_BOOL bEnabled; +} OMX_CONFIG_BOOLEANTYPE; + +/* Parameter specifying the content uri to use. */ +/** @ingroup cp */ +typedef struct OMX_PARAM_CONTENTURITYPE +{ + OMX_U32 nSize; /**< size of the structure in bytes, including + actual URI name */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U8 contentURI[1]; /**< The URI name */ +} OMX_PARAM_CONTENTURITYPE; + +/* Parameter specifying the pipe to use. */ +/** @ingroup cp */ +typedef struct OMX_PARAM_CONTENTPIPETYPE +{ + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_HANDLETYPE hPipe; /**< The pipe handle*/ +} OMX_PARAM_CONTENTPIPETYPE; + +/** @ingroup rpm */ +typedef struct OMX_RESOURCECONCEALMENTTYPE { + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_BOOL bResourceConcealmentForbidden; /**< disallow the use of resource concealment + methods (like degrading algorithm quality to + lower resource consumption or functional bypass) + on a component as a resolution to resource conflicts. */ +} OMX_RESOURCECONCEALMENTTYPE; + + +/** @ingroup metadata */ +typedef enum OMX_METADATACHARSETTYPE { + OMX_MetadataCharsetUnknown = 0, + OMX_MetadataCharsetASCII, + OMX_MetadataCharsetBinary, + OMX_MetadataCharsetCodePage1252, + OMX_MetadataCharsetUTF8, + OMX_MetadataCharsetJavaConformantUTF8, + OMX_MetadataCharsetUTF7, + OMX_MetadataCharsetImapUTF7, + OMX_MetadataCharsetUTF16LE, + OMX_MetadataCharsetUTF16BE, + OMX_MetadataCharsetGB12345, + OMX_MetadataCharsetHZGB2312, + OMX_MetadataCharsetGB2312, + OMX_MetadataCharsetGB18030, + OMX_MetadataCharsetGBK, + OMX_MetadataCharsetBig5, + OMX_MetadataCharsetISO88591, + OMX_MetadataCharsetISO88592, + OMX_MetadataCharsetISO88593, + OMX_MetadataCharsetISO88594, + OMX_MetadataCharsetISO88595, + OMX_MetadataCharsetISO88596, + OMX_MetadataCharsetISO88597, + OMX_MetadataCharsetISO88598, + OMX_MetadataCharsetISO88599, + OMX_MetadataCharsetISO885910, + OMX_MetadataCharsetISO885913, + OMX_MetadataCharsetISO885914, + OMX_MetadataCharsetISO885915, + OMX_MetadataCharsetShiftJIS, + OMX_MetadataCharsetISO2022JP, + OMX_MetadataCharsetISO2022JP1, + OMX_MetadataCharsetISOEUCJP, + OMX_MetadataCharsetSMS7Bit, + OMX_MetadataCharsetKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_MetadataCharsetVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + OMX_MetadataCharsetTypeMax= 0x7FFFFFFF +} OMX_METADATACHARSETTYPE; + +/** @ingroup metadata */ +typedef enum OMX_METADATASCOPETYPE +{ + OMX_MetadataScopeAllLevels, + OMX_MetadataScopeTopLevel, + OMX_MetadataScopePortLevel, + OMX_MetadataScopeNodeLevel, + OMX_MetadataScopeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_MetadataScopeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + OMX_MetadataScopeTypeMax = 0x7fffffff +} OMX_METADATASCOPETYPE; + +/** @ingroup metadata */ +typedef enum OMX_METADATASEARCHMODETYPE +{ + OMX_MetadataSearchValueSizeByIndex, + OMX_MetadataSearchItemByIndex, + OMX_MetadataSearchNextItemByKey, + OMX_MetadataSearchKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_MetadataSearchVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + OMX_MetadataSearchTypeMax = 0x7fffffff +} OMX_METADATASEARCHMODETYPE; +/** @ingroup metadata */ +typedef struct OMX_CONFIG_METADATAITEMCOUNTTYPE +{ + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_METADATASCOPETYPE eScopeMode; + OMX_U32 nScopeSpecifier; + OMX_U32 nMetadataItemCount; +} OMX_CONFIG_METADATAITEMCOUNTTYPE; + +/** @ingroup metadata */ +typedef struct OMX_CONFIG_METADATAITEMTYPE +{ + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_METADATASCOPETYPE eScopeMode; + OMX_U32 nScopeSpecifier; + OMX_U32 nMetadataItemIndex; + OMX_METADATASEARCHMODETYPE eSearchMode; + OMX_METADATACHARSETTYPE eKeyCharset; + OMX_U8 nKeySizeUsed; + OMX_U8 nKey[128]; + OMX_METADATACHARSETTYPE eValueCharset; + OMX_STRING sLanguageCountry; + OMX_U32 nValueMaxSize; + OMX_U32 nValueSizeUsed; + OMX_U8 nValue[1]; +} OMX_CONFIG_METADATAITEMTYPE; + +/* @ingroup metadata */ +typedef struct OMX_CONFIG_CONTAINERNODECOUNTTYPE +{ + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_BOOL bAllKeys; + OMX_U32 nParentNodeID; + OMX_U32 nNumNodes; +} OMX_CONFIG_CONTAINERNODECOUNTTYPE; + +/** @ingroup metadata */ +typedef struct OMX_CONFIG_CONTAINERNODEIDTYPE +{ + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_BOOL bAllKeys; + OMX_U32 nParentNodeID; + OMX_U32 nNodeIndex; + OMX_U32 nNodeID; + OMX_STRING cNodeName; + OMX_BOOL bIsLeafType; +} OMX_CONFIG_CONTAINERNODEIDTYPE; + +/** @ingroup metadata */ +typedef struct OMX_PARAM_METADATAFILTERTYPE +{ + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_BOOL bAllKeys; /* if true then this structure refers to all keys and + * the three key fields below are ignored */ + OMX_METADATACHARSETTYPE eKeyCharset; + OMX_U32 nKeySizeUsed; + OMX_U8 nKey [128]; + OMX_U32 nLanguageCountrySizeUsed; + OMX_U8 nLanguageCountry[128]; + OMX_BOOL bEnabled; /* if true then key is part of filter (e.g. + * retained for query later). If false then + * key is not part of filter */ +} OMX_PARAM_METADATAFILTERTYPE; + +/** The OMX_HANDLETYPE structure defines the component handle. The component + * handle is used to access all of the component's public methods and also + * contains pointers to the component's private data area. The component + * handle is initialized by the OMX core (with help from the component) + * during the process of loading the component. After the component is + * successfully loaded, the application can safely access any of the + * component's public functions (although some may return an error because + * the state is inappropriate for the access). + * + * @ingroup comp + */ +typedef struct OMX_COMPONENTTYPE +{ + /** The size of this structure, in bytes. It is the responsibility + of the allocator of this structure to fill in this value. Since + this structure is allocated by the GetHandle function, this + function will fill in this value. */ + OMX_U32 nSize; + + /** nVersion is the version of the OMX specification that the structure + is built against. It is the responsibility of the creator of this + structure to initialize this value and every user of this structure + should verify that it knows how to use the exact version of + this structure found herein. */ + OMX_VERSIONTYPE nVersion; + + /** pComponentPrivate is a pointer to the component private data area. + This member is allocated and initialized by the component when the + component is first loaded. The application should not access this + data area. */ + OMX_PTR pComponentPrivate; + + /** pApplicationPrivate is a pointer that is a parameter to the + OMX_GetHandle method, and contains an application private value + provided by the IL client. This application private data is + returned to the IL Client by OMX in all callbacks */ + OMX_PTR pApplicationPrivate; + + /** refer to OMX_GetComponentVersion in OMX_core.h or the OMX IL + specification for details on the GetComponentVersion method. + */ + OMX_ERRORTYPE (*GetComponentVersion)( + OMX_IN OMX_HANDLETYPE hComponent, + OMX_OUT OMX_STRING pComponentName, + OMX_OUT OMX_VERSIONTYPE* pComponentVersion, + OMX_OUT OMX_VERSIONTYPE* pSpecVersion, + OMX_OUT OMX_UUIDTYPE* pComponentUUID); + + /** refer to OMX_SendCommand in OMX_core.h or the OMX IL + specification for details on the SendCommand method. + */ + OMX_ERRORTYPE (*SendCommand)( + OMX_IN OMX_HANDLETYPE hComponent, + OMX_IN OMX_COMMANDTYPE Cmd, + OMX_IN OMX_U32 nParam1, + OMX_IN OMX_PTR pCmdData); + + /** refer to OMX_GetParameter in OMX_core.h or the OMX IL + specification for details on the GetParameter method. + */ + OMX_ERRORTYPE (*GetParameter)( + OMX_IN OMX_HANDLETYPE hComponent, + OMX_IN OMX_INDEXTYPE nParamIndex, + OMX_INOUT OMX_PTR pComponentParameterStructure); + + + /** refer to OMX_SetParameter in OMX_core.h or the OMX IL + specification for details on the SetParameter method. + */ + OMX_ERRORTYPE (*SetParameter)( + OMX_IN OMX_HANDLETYPE hComponent, + OMX_IN OMX_INDEXTYPE nIndex, + OMX_IN OMX_PTR pComponentParameterStructure); + + + /** refer to OMX_GetConfig in OMX_core.h or the OMX IL + specification for details on the GetConfig method. + */ + OMX_ERRORTYPE (*GetConfig)( + OMX_IN OMX_HANDLETYPE hComponent, + OMX_IN OMX_INDEXTYPE nIndex, + OMX_INOUT OMX_PTR pComponentConfigStructure); + + + /** refer to OMX_SetConfig in OMX_core.h or the OMX IL + specification for details on the SetConfig method. + */ + OMX_ERRORTYPE (*SetConfig)( + OMX_IN OMX_HANDLETYPE hComponent, + OMX_IN OMX_INDEXTYPE nIndex, + OMX_IN OMX_PTR pComponentConfigStructure); + + + /** refer to OMX_GetExtensionIndex in OMX_core.h or the OMX IL + specification for details on the GetExtensionIndex method. + */ + OMX_ERRORTYPE (*GetExtensionIndex)( + OMX_IN OMX_HANDLETYPE hComponent, + OMX_IN OMX_STRING cParameterName, + OMX_OUT OMX_INDEXTYPE* pIndexType); + + + /** refer to OMX_GetState in OMX_core.h or the OMX IL + specification for details on the GetState method. + */ + OMX_ERRORTYPE (*GetState)( + OMX_IN OMX_HANDLETYPE hComponent, + OMX_OUT OMX_STATETYPE* pState); + + + /** The ComponentTunnelRequest method will interact with another OMX + component to determine if tunneling is possible and to setup the + tunneling. The return codes for this method can be used to + determine if tunneling is not possible, or if tunneling is not + supported. + + Base profile components (i.e. non-interop) do not support this + method and should return OMX_ErrorNotImplemented + + The interop profile component MUST support tunneling to another + interop profile component with a compatible port parameters. + A component may also support proprietary communication. + + If proprietary communication is supported the negotiation of + proprietary communication is done outside of OMX in a vendor + specific way. It is only required that the proper result be + returned and the details of how the setup is done is left + to the component implementation. + + When this method is invoked when nPort in an output port, the + component will: + 1. Populate the pTunnelSetup structure with the output port's + requirements and constraints for the tunnel. + + When this method is invoked when nPort in an input port, the + component will: + 1. Query the necessary parameters from the output port to + determine if the ports are compatible for tunneling + 2. If the ports are compatible, the component should store + the tunnel step provided by the output port + 3. Determine which port (either input or output) is the buffer + supplier, and call OMX_SetParameter on the output port to + indicate this selection. + + The component will return from this call within 5 msec. + + @param [in] hComp + Handle of the component to be accessed. This is the component + handle returned by the call to the OMX_GetHandle method. + @param [in] nPort + nPort is used to select the port on the component to be used + for tunneling. + @param [in] hTunneledComp + Handle of the component to tunnel with. This is the component + handle returned by the call to the OMX_GetHandle method. When + this parameter is 0x0 the component should setup the port for + communication with the application / IL Client. + @param [in] nPortOutput + nPortOutput is used indicate the port the component should + tunnel with. + @param [in] pTunnelSetup + Pointer to the tunnel setup structure. When nPort is an output port + the component should populate the fields of this structure. When + When nPort is an input port the component should review the setup + provided by the component with the output port. + @return OMX_ERRORTYPE + If the command successfully executes, the return code will be + OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. + @ingroup tun + */ + + OMX_ERRORTYPE (*ComponentTunnelRequest)( + OMX_IN OMX_HANDLETYPE hComp, + OMX_IN OMX_U32 nPort, + OMX_IN OMX_HANDLETYPE hTunneledComp, + OMX_IN OMX_U32 nTunneledPort, + OMX_INOUT OMX_TUNNELSETUPTYPE* pTunnelSetup); + + /** refer to OMX_UseBuffer in OMX_core.h or the OMX IL + specification for details on the UseBuffer method. + @ingroup buf + */ + OMX_ERRORTYPE (*UseBuffer)( + OMX_IN OMX_HANDLETYPE hComponent, + OMX_INOUT OMX_BUFFERHEADERTYPE** ppBufferHdr, + OMX_IN OMX_U32 nPortIndex, + OMX_IN OMX_PTR pAppPrivate, + OMX_IN OMX_U32 nSizeBytes, + OMX_IN OMX_U8* pBuffer); + + /** refer to OMX_AllocateBuffer in OMX_core.h or the OMX IL + specification for details on the AllocateBuffer method. + @ingroup buf + */ + OMX_ERRORTYPE (*AllocateBuffer)( + OMX_IN OMX_HANDLETYPE hComponent, + OMX_INOUT OMX_BUFFERHEADERTYPE** ppBuffer, + OMX_IN OMX_U32 nPortIndex, + OMX_IN OMX_PTR pAppPrivate, + OMX_IN OMX_U32 nSizeBytes); + + /** refer to OMX_FreeBuffer in OMX_core.h or the OMX IL + specification for details on the FreeBuffer method. + @ingroup buf + */ + OMX_ERRORTYPE (*FreeBuffer)( + OMX_IN OMX_HANDLETYPE hComponent, + OMX_IN OMX_U32 nPortIndex, + OMX_IN OMX_BUFFERHEADERTYPE* pBuffer); + + /** refer to OMX_EmptyThisBuffer in OMX_core.h or the OMX IL + specification for details on the EmptyThisBuffer method. + @ingroup buf + */ + OMX_ERRORTYPE (*EmptyThisBuffer)( + OMX_IN OMX_HANDLETYPE hComponent, + OMX_IN OMX_BUFFERHEADERTYPE* pBuffer); + + /** refer to OMX_FillThisBuffer in OMX_core.h or the OMX IL + specification for details on the FillThisBuffer method. + @ingroup buf + */ + OMX_ERRORTYPE (*FillThisBuffer)( + OMX_IN OMX_HANDLETYPE hComponent, + OMX_IN OMX_BUFFERHEADERTYPE* pBuffer); + + /** The SetCallbacks method is used by the core to specify the callback + structure from the application to the component. This is a blocking + call. The component will return from this call within 5 msec. + @param [in] hComponent + Handle of the component to be accessed. This is the component + handle returned by the call to the GetHandle function. + @param [in] pCallbacks + pointer to an OMX_CALLBACKTYPE structure used to provide the + callback information to the component + @param [in] pAppData + pointer to an application defined value. It is anticipated that + the application will pass a pointer to a data structure or a "this + pointer" in this area to allow the callback (in the application) + to determine the context of the call + @return OMX_ERRORTYPE + If the command successfully executes, the return code will be + OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. + */ + OMX_ERRORTYPE (*SetCallbacks)( + OMX_IN OMX_HANDLETYPE hComponent, + OMX_IN OMX_CALLBACKTYPE* pCallbacks, + OMX_IN OMX_PTR pAppData); + + /** ComponentDeInit method is used to deinitialize the component + providing a means to free any resources allocated at component + initialization. NOTE: After this call the component handle is + not valid for further use. + @param [in] hComponent + Handle of the component to be accessed. This is the component + handle returned by the call to the GetHandle function. + @return OMX_ERRORTYPE + If the command successfully executes, the return code will be + OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. + */ + OMX_ERRORTYPE (*ComponentDeInit)( + OMX_IN OMX_HANDLETYPE hComponent); + + /** @ingroup buf */ + OMX_ERRORTYPE (*UseEGLImage)( + OMX_IN OMX_HANDLETYPE hComponent, + OMX_INOUT OMX_BUFFERHEADERTYPE** ppBufferHdr, + OMX_IN OMX_U32 nPortIndex, + OMX_IN OMX_PTR pAppPrivate, + OMX_IN void* eglImage); + + OMX_ERRORTYPE (*ComponentRoleEnum)( + OMX_IN OMX_HANDLETYPE hComponent, + OMX_OUT OMX_U8 *cRole, + OMX_IN OMX_U32 nIndex); + +} OMX_COMPONENTTYPE; + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif +/* File EOF */ diff --git a/third_party/openmax/include/OMX_ContentPipe.h b/third_party/openmax/include/OMX_ContentPipe.h new file mode 100644 index 000000000..5f6310c28 --- /dev/null +++ b/third_party/openmax/include/OMX_ContentPipe.h @@ -0,0 +1,195 @@ +/* + * Copyright (c) 2008 The Khronos Group Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject + * to the following conditions: + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +/** OMX_ContentPipe.h - OpenMax IL version 1.1.2 + * The OMX_ContentPipe header file contains the definitions used to define + * the public interface for content piples. This header file is intended to + * be used by the component. + */ + +#ifndef OMX_CONTENTPIPE_H +#define OMX_CONTENTPIPE_H + +#ifndef KD_EACCES +/* OpenKODE error codes. CPResult values may be zero (indicating success + or one of the following values) */ +#define KD_EACCES (1) +#define KD_EADDRINUSE (2) +#define KD_EAGAIN (5) +#define KD_EBADF (7) +#define KD_EBUSY (8) +#define KD_ECONNREFUSED (9) +#define KD_ECONNRESET (10) +#define KD_EDEADLK (11) +#define KD_EDESTADDRREQ (12) +#define KD_ERANGE (35) +#define KD_EEXIST (13) +#define KD_EFBIG (14) +#define KD_EHOSTUNREACH (15) +#define KD_EINVAL (17) +#define KD_EIO (18) +#define KD_EISCONN (20) +#define KD_EISDIR (21) +#define KD_EMFILE (22) +#define KD_ENAMETOOLONG (23) +#define KD_ENOENT (24) +#define KD_ENOMEM (25) +#define KD_ENOSPC (26) +#define KD_ENOSYS (27) +#define KD_ENOTCONN (28) +#define KD_EPERM (33) +#define KD_ETIMEDOUT (36) +#define KD_EILSEQ (19) +#endif + +/** Map types from OMX standard types only here so interface is as generic as possible. */ +typedef OMX_U32 CPresult; +typedef char * CPstring; +typedef void * CPhandle; +typedef OMX_U32 CPuint; +typedef OMX_S32 CPint; +typedef char CPbyte; +typedef OMX_BOOL CPbool; + +/** enumeration of origin types used in the CP_PIPETYPE's Seek function + * @ingroup cp + */ +typedef enum CP_ORIGINTYPE { + CP_OriginBegin, + CP_OriginCur, + CP_OriginEnd, + CP_OriginKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + CP_OriginVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + CP_OriginMax = 0X7FFFFFFF +} CP_ORIGINTYPE; + +/** enumeration of contact access types used in the CP_PIPETYPE's Open function + * @ingroup cp + */ +typedef enum CP_ACCESSTYPE { + CP_AccessRead, + CP_AccessWrite, + CP_AccessReadWrite , + CP_AccessKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + CP_AccessVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + CP_AccessMax = 0X7FFFFFFF +} CP_ACCESSTYPE; + +/** enumeration of results returned by the CP_PIPETYPE's CheckAvailableBytes function + * @ingroup cp + */ +typedef enum CP_CHECKBYTESRESULTTYPE +{ + CP_CheckBytesOk, /**< There are at least the request number + of bytes available */ + CP_CheckBytesNotReady, /**< The pipe is still retrieving bytes + and presently lacks sufficient bytes. + Client will be called when they are + sufficient bytes are available. */ + CP_CheckBytesInsufficientBytes , /**< The pipe has retrieved all bytes + but those available are less than those + requested */ + CP_CheckBytesAtEndOfStream, /**< The pipe has reached the end of stream + and no more bytes are available. */ + CP_CheckBytesOutOfBuffers, /**< All read/write buffers are currently in use. */ + CP_CheckBytesKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + CP_CheckBytesVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + CP_CheckBytesMax = 0X7FFFFFFF +} CP_CHECKBYTESRESULTTYPE; + +/** enumeration of content pipe events sent to the client callback. + * @ingroup cp + */ +typedef enum CP_EVENTTYPE{ + CP_BytesAvailable, /** bytes requested in a CheckAvailableBytes call are now available*/ + CP_Overflow, /** enumeration of content pipe events sent to the client callback*/ + CP_PipeDisconnected , /** enumeration of content pipe events sent to the client callback*/ + CP_EventKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + CP_EventVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + CP_EventMax = 0X7FFFFFFF +} CP_EVENTTYPE; + +/** content pipe definition + * @ingroup cp + */ +typedef struct CP_PIPETYPE +{ + /** Open a content stream for reading or writing. */ + CPresult (*Open)( CPhandle* hContent, CPstring szURI, CP_ACCESSTYPE eAccess ); + + /** Close a content stream. */ + CPresult (*Close)( CPhandle hContent ); + + /** Create a content source and open it for writing. */ + CPresult (*Create)( CPhandle *hContent, CPstring szURI ); + + /** Check the that specified number of bytes are available for reading or writing (depending on access type).*/ + CPresult (*CheckAvailableBytes)( CPhandle hContent, CPuint nBytesRequested, CP_CHECKBYTESRESULTTYPE *eResult ); + + /** Seek to certain position in the content relative to the specified origin. */ + CPresult (*SetPosition)( CPhandle hContent, CPint nOffset, CP_ORIGINTYPE eOrigin); + + /** Retrieve the current position relative to the start of the content. */ + CPresult (*GetPosition)( CPhandle hContent, CPuint *pPosition); + + /** Retrieve data of the specified size from the content stream (advance content pointer by size of data). + Note: pipe client provides pointer. This function is appropriate for small high frequency reads. */ + CPresult (*Read)( CPhandle hContent, CPbyte *pData, CPuint nSize); + + /** Retrieve a buffer allocated by the pipe that contains the requested number of bytes. + Buffer contains the next block of bytes, as specified by nSize, of the content. nSize also + returns the size of the block actually read. Content pointer advances the by the returned size. + Note: pipe provides pointer. This function is appropriate for large reads. The client must call + ReleaseReadBuffer when done with buffer. + + In some cases the requested block may not reside in contiguous memory within the + pipe implementation. For instance if the pipe leverages a circular buffer then the requested + block may straddle the boundary of the circular buffer. By default a pipe implementation + performs a copy in this case to provide the block to the pipe client in one contiguous buffer. + If, however, the client sets bForbidCopy, then the pipe returns only those bytes preceding the memory + boundary. Here the client may retrieve the data in segments over successive calls. */ + CPresult (*ReadBuffer)( CPhandle hContent, CPbyte **ppBuffer, CPuint *nSize, CPbool bForbidCopy); + + /** Release a buffer obtained by ReadBuffer back to the pipe. */ + CPresult (*ReleaseReadBuffer)(CPhandle hContent, CPbyte *pBuffer); + + /** Write data of the specified size to the content (advance content pointer by size of data). + Note: pipe client provides pointer. This function is appropriate for small high frequency writes. */ + CPresult (*Write)( CPhandle hContent, CPbyte *data, CPuint nSize); + + /** Retrieve a buffer allocated by the pipe used to write data to the content. + Client will fill buffer with output data. Note: pipe provides pointer. This function is appropriate + for large writes. The client must call WriteBuffer when done it has filled the buffer with data.*/ + CPresult (*GetWriteBuffer)( CPhandle hContent, CPbyte **ppBuffer, CPuint nSize); + + /** Deliver a buffer obtained via GetWriteBuffer to the pipe. Pipe will write the + the contents of the buffer to content and advance content pointer by the size of the buffer */ + CPresult (*WriteBuffer)( CPhandle hContent, CPbyte *pBuffer, CPuint nFilledSize); + + /** Register a per-handle client callback with the content pipe. */ + CPresult (*RegisterCallback)( CPhandle hContent, CPresult (*ClientCallback)(CP_EVENTTYPE eEvent, CPuint iParam)); + +} CP_PIPETYPE; + +#endif + diff --git a/third_party/openmax/include/OMX_Core.h b/third_party/openmax/include/OMX_Core.h new file mode 100644 index 000000000..52d211f0d --- /dev/null +++ b/third_party/openmax/include/OMX_Core.h @@ -0,0 +1,1440 @@ +/* + * Copyright (c) 2008 The Khronos Group Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject + * to the following conditions: + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +/** OMX_Core.h - OpenMax IL version 1.1.2 + * The OMX_Core header file contains the definitions used by both the + * application and the component to access common items. + */ + +#ifndef OMX_Core_h +#define OMX_Core_h + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + +/* Each OMX header shall include all required header files to allow the + * header to compile without errors. The includes below are required + * for this header file to compile successfully + */ + +#include + + +/** The OMX_COMMANDTYPE enumeration is used to specify the action in the + * OMX_SendCommand macro. + * @ingroup core + */ +typedef enum OMX_COMMANDTYPE +{ + OMX_CommandStateSet, /**< Change the component state */ + OMX_CommandFlush, /**< Flush the data queue(s) of a component */ + OMX_CommandPortDisable, /**< Disable a port on a component. */ + OMX_CommandPortEnable, /**< Enable a port on a component. */ + OMX_CommandMarkBuffer, /**< Mark a component/buffer for observation */ + OMX_CommandKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_CommandVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + OMX_CommandMax = 0X7FFFFFFF +} OMX_COMMANDTYPE; + + + +/** The OMX_STATETYPE enumeration is used to indicate or change the component + * state. This enumeration reflects the current state of the component when + * used with the OMX_GetState macro or becomes the parameter in a state change + * command when used with the OMX_SendCommand macro. + * + * The component will be in the Loaded state after the component is initially + * loaded into memory. In the Loaded state, the component is not allowed to + * allocate or hold resources other than to build it's internal parameter + * and configuration tables. The application will send one or more + * SetParameters/GetParameters and SetConfig/GetConfig commands to the + * component and the component will record each of these parameter and + * configuration changes for use later. When the application sends the + * Idle command, the component will acquire the resources needed for the + * specified configuration and will transition to the idle state if the + * allocation is successful. If the component cannot successfully + * transition to the idle state for any reason, the state of the component + * shall be fully rolled back to the Loaded state (e.g. all allocated + * resources shall be released). When the component receives the command + * to go to the Executing state, it shall begin processing buffers by + * sending all input buffers it holds to the application. While + * the component is in the Idle state, the application may also send the + * Pause command. If the component receives the pause command while in the + * Idle state, the component shall send all input buffers it holds to the + * application, but shall not begin processing buffers. This will allow the + * application to prefill buffers. + * + * @ingroup comp + */ + +typedef enum OMX_STATETYPE +{ + OMX_StateInvalid, /**< component has detected that it's internal data + structures are corrupted to the point that + it cannot determine it's state properly */ + OMX_StateLoaded, /**< component has been loaded but has not completed + initialization. The OMX_SetParameter macro + and the OMX_GetParameter macro are the only + valid macros allowed to be sent to the + component in this state. */ + OMX_StateIdle, /**< component initialization has been completed + successfully and the component is ready to + to start. */ + OMX_StateExecuting, /**< component has accepted the start command and + is processing data (if data is available) */ + OMX_StatePause, /**< component has received pause command */ + OMX_StateWaitForResources, /**< component is waiting for resources, either after + preemption or before it gets the resources requested. + See specification for complete details. */ + OMX_StateKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_StateVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + OMX_StateMax = 0X7FFFFFFF +} OMX_STATETYPE; + +/** The OMX_ERRORTYPE enumeration defines the standard OMX Errors. These + * errors should cover most of the common failure cases. However, + * vendors are free to add additional error messages of their own as + * long as they follow these rules: + * 1. Vendor error messages shall be in the range of 0x90000000 to + * 0x9000FFFF. + * 2. Vendor error messages shall be defined in a header file provided + * with the component. No error messages are allowed that are + * not defined. + */ +typedef enum OMX_ERRORTYPE +{ + OMX_ErrorNone = 0, + + /** There were insufficient resources to perform the requested operation */ + OMX_ErrorInsufficientResources = (OMX_S32) 0x80001000, + + /** There was an error, but the cause of the error could not be determined */ + OMX_ErrorUndefined = (OMX_S32) 0x80001001, + + /** The component name string was not valid */ + OMX_ErrorInvalidComponentName = (OMX_S32) 0x80001002, + + /** No component with the specified name string was found */ + OMX_ErrorComponentNotFound = (OMX_S32) 0x80001003, + + /** The component specified did not have a "OMX_ComponentInit" or + "OMX_ComponentDeInit entry point */ + OMX_ErrorInvalidComponent = (OMX_S32) 0x80001004, + + /** One or more parameters were not valid */ + OMX_ErrorBadParameter = (OMX_S32) 0x80001005, + + /** The requested function is not implemented */ + OMX_ErrorNotImplemented = (OMX_S32) 0x80001006, + + /** The buffer was emptied before the next buffer was ready */ + OMX_ErrorUnderflow = (OMX_S32) 0x80001007, + + /** The buffer was not available when it was needed */ + OMX_ErrorOverflow = (OMX_S32) 0x80001008, + + /** The hardware failed to respond as expected */ + OMX_ErrorHardware = (OMX_S32) 0x80001009, + + /** The component is in the state OMX_StateInvalid */ + OMX_ErrorInvalidState = (OMX_S32) 0x8000100A, + + /** Stream is found to be corrupt */ + OMX_ErrorStreamCorrupt = (OMX_S32) 0x8000100B, + + /** Ports being connected are not compatible */ + OMX_ErrorPortsNotCompatible = (OMX_S32) 0x8000100C, + + /** Resources allocated to an idle component have been + lost resulting in the component returning to the loaded state */ + OMX_ErrorResourcesLost = (OMX_S32) 0x8000100D, + + /** No more indicies can be enumerated */ + OMX_ErrorNoMore = (OMX_S32) 0x8000100E, + + /** The component detected a version mismatch */ + OMX_ErrorVersionMismatch = (OMX_S32) 0x8000100F, + + /** The component is not ready to return data at this time */ + OMX_ErrorNotReady = (OMX_S32) 0x80001010, + + /** There was a timeout that occurred */ + OMX_ErrorTimeout = (OMX_S32) 0x80001011, + + /** This error occurs when trying to transition into the state you are already in */ + OMX_ErrorSameState = (OMX_S32) 0x80001012, + + /** Resources allocated to an executing or paused component have been + preempted, causing the component to return to the idle state */ + OMX_ErrorResourcesPreempted = (OMX_S32) 0x80001013, + + /** A non-supplier port sends this error to the IL client (via the EventHandler callback) + during the allocation of buffers (on a transition from the LOADED to the IDLE state or + on a port restart) when it deems that it has waited an unusually long time for the supplier + to send it an allocated buffer via a UseBuffer call. */ + OMX_ErrorPortUnresponsiveDuringAllocation = (OMX_S32) 0x80001014, + + /** A non-supplier port sends this error to the IL client (via the EventHandler callback) + during the deallocation of buffers (on a transition from the IDLE to LOADED state or + on a port stop) when it deems that it has waited an unusually long time for the supplier + to request the deallocation of a buffer header via a FreeBuffer call. */ + OMX_ErrorPortUnresponsiveDuringDeallocation = (OMX_S32) 0x80001015, + + /** A supplier port sends this error to the IL client (via the EventHandler callback) + during the stopping of a port (either on a transition from the IDLE to LOADED + state or a port stop) when it deems that it has waited an unusually long time for + the non-supplier to return a buffer via an EmptyThisBuffer or FillThisBuffer call. */ + OMX_ErrorPortUnresponsiveDuringStop = (OMX_S32) 0x80001016, + + /** Attempting a state transtion that is not allowed */ + OMX_ErrorIncorrectStateTransition = (OMX_S32) 0x80001017, + + /* Attempting a command that is not allowed during the present state. */ + OMX_ErrorIncorrectStateOperation = (OMX_S32) 0x80001018, + + /** The values encapsulated in the parameter or config structure are not supported. */ + OMX_ErrorUnsupportedSetting = (OMX_S32) 0x80001019, + + /** The parameter or config indicated by the given index is not supported. */ + OMX_ErrorUnsupportedIndex = (OMX_S32) 0x8000101A, + + /** The port index supplied is incorrect. */ + OMX_ErrorBadPortIndex = (OMX_S32) 0x8000101B, + + /** The port has lost one or more of its buffers and it thus unpopulated. */ + OMX_ErrorPortUnpopulated = (OMX_S32) 0x8000101C, + + /** Component suspended due to temporary loss of resources */ + OMX_ErrorComponentSuspended = (OMX_S32) 0x8000101D, + + /** Component suspended due to an inability to acquire dynamic resources */ + OMX_ErrorDynamicResourcesUnavailable = (OMX_S32) 0x8000101E, + + /** When the macroblock error reporting is enabled the component returns new error + for every frame that has errors */ + OMX_ErrorMbErrorsInFrame = (OMX_S32) 0x8000101F, + + /** A component reports this error when it cannot parse or determine the format of an input stream. */ + OMX_ErrorFormatNotDetected = (OMX_S32) 0x80001020, + + /** The content open operation failed. */ + OMX_ErrorContentPipeOpenFailed = (OMX_S32) 0x80001021, + + /** The content creation operation failed. */ + OMX_ErrorContentPipeCreationFailed = (OMX_S32) 0x80001022, + + /** Separate table information is being used */ + OMX_ErrorSeperateTablesUsed = (OMX_S32) 0x80001023, + + /** Tunneling is unsupported by the component*/ + OMX_ErrorTunnelingUnsupported = (OMX_S32) 0x80001024, + + OMX_ErrorKhronosExtensions = (OMX_S32)0x8F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_ErrorVendorStartUnused = (OMX_S32)0x90000000, /**< Reserved region for introducing Vendor Extensions */ + OMX_ErrorMax = 0x7FFFFFFF +} OMX_ERRORTYPE; + +/** @ingroup core */ +typedef OMX_ERRORTYPE (* OMX_COMPONENTINITTYPE)(OMX_IN OMX_HANDLETYPE hComponent); + +/** @ingroup core */ +typedef struct OMX_COMPONENTREGISTERTYPE +{ + const char * pName; /* Component name, 128 byte limit (including '\0') applies */ + OMX_COMPONENTINITTYPE pInitialize; /* Component instance initialization function */ +} OMX_COMPONENTREGISTERTYPE; + +/** @ingroup core */ +extern OMX_COMPONENTREGISTERTYPE OMX_ComponentRegistered[]; + +/** @ingroup rpm */ +typedef struct OMX_PRIORITYMGMTTYPE { + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nGroupPriority; /**< Priority of the component group */ + OMX_U32 nGroupID; /**< ID of the component group */ +} OMX_PRIORITYMGMTTYPE; + +/* Component name and Role names are limited to 128 characters including the terminating '\0'. */ +#define OMX_MAX_STRINGNAME_SIZE 128 + +/** @ingroup comp */ +typedef struct OMX_PARAM_COMPONENTROLETYPE { + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U8 cRole[OMX_MAX_STRINGNAME_SIZE]; /**< name of standard component which defines component role */ +} OMX_PARAM_COMPONENTROLETYPE; + +/** End of Stream Buffer Flag: + * + * A component sets EOS when it has no more data to emit on a particular + * output port. Thus an output port shall set EOS on the last buffer it + * emits. A component's determination of when an output port should + * cease sending data is implemenation specific. + * @ingroup buf + */ + +#define OMX_BUFFERFLAG_EOS 0x00000001 + +/** Start Time Buffer Flag: + * + * The source of a stream (e.g. a demux component) sets the STARTTIME + * flag on the buffer that contains the starting timestamp for the + * stream. The starting timestamp corresponds to the first data that + * should be displayed at startup or after a seek. + * The first timestamp of the stream is not necessarily the start time. + * For instance, in the case of a seek to a particular video frame, + * the target frame may be an interframe. Thus the first buffer of + * the stream will be the intra-frame preceding the target frame and + * the starttime will occur with the target frame (with any other + * required frames required to reconstruct the target intervening). + * + * The STARTTIME flag is directly associated with the buffer's + * timestamp ' thus its association to buffer data and its + * propagation is identical to the timestamp's. + * + * When a Sync Component client receives a buffer with the + * STARTTIME flag it shall perform a SetConfig on its sync port + * using OMX_ConfigTimeClientStartTime and passing the buffer's + * timestamp. + * + * @ingroup buf + */ + +#define OMX_BUFFERFLAG_STARTTIME 0x00000002 + + + +/** Decode Only Buffer Flag: + * + * The source of a stream (e.g. a demux component) sets the DECODEONLY + * flag on any buffer that should shall be decoded but should not be + * displayed. This flag is used, for instance, when a source seeks to + * a target interframe that requires the decode of frames preceding the + * target to facilitate the target's reconstruction. In this case the + * source would emit the frames preceding the target downstream + * but mark them as decode only. + * + * The DECODEONLY is associated with buffer data and propagated in a + * manner identical to the buffer timestamp. + * + * A component that renders data should ignore all buffers with + * the DECODEONLY flag set. + * + * @ingroup buf + */ + +#define OMX_BUFFERFLAG_DECODEONLY 0x00000004 + + +/* Data Corrupt Flag: This flag is set when the IL client believes the data in the associated buffer is corrupt + * @ingroup buf + */ + +#define OMX_BUFFERFLAG_DATACORRUPT 0x00000008 + +/* End of Frame: The buffer contains exactly one end of frame and no data + * occurs after the end of frame. This flag is an optional hint. The absence + * of this flag does not imply the absence of an end of frame within the buffer. + * @ingroup buf +*/ +#define OMX_BUFFERFLAG_ENDOFFRAME 0x00000010 + +/* Sync Frame Flag: This flag is set when the buffer content contains a coded sync frame ' + * a frame that has no dependency on any other frame information + * @ingroup buf + */ +#define OMX_BUFFERFLAG_SYNCFRAME 0x00000020 + +/* Extra data present flag: there is extra data appended to the data stream + * residing in the buffer + * @ingroup buf + */ +#define OMX_BUFFERFLAG_EXTRADATA 0x00000040 + +/** Codec Config Buffer Flag: +* OMX_BUFFERFLAG_CODECCONFIG is an optional flag that is set by an +* output port when all bytes in the buffer form part or all of a set of +* codec specific configuration data. Examples include SPS/PPS nal units +* for OMX_VIDEO_CodingAVC or AudioSpecificConfig data for +* OMX_AUDIO_CodingAAC. Any component that for a given stream sets +* OMX_BUFFERFLAG_CODECCONFIG shall not mix codec configuration bytes +* with frame data in the same buffer, and shall send all buffers +* containing codec configuration bytes before any buffers containing +* frame data that those configurations bytes describe. +* If the stream format for a particular codec has a frame specific +* header at the start of each frame, for example OMX_AUDIO_CodingMP3 or +* OMX_AUDIO_CodingAAC in ADTS mode, then these shall be presented as +* normal without setting OMX_BUFFERFLAG_CODECCONFIG. + * @ingroup buf + */ +#define OMX_BUFFERFLAG_CODECCONFIG 0x00000080 + +/* +* OMX_BUFFERFLAG_READONLY: This flag is set when a component emitting the +* buffer on an output port or the IL client wishes to identify the buffer +* payload contents to be read-only. An IL client or an input port +* shall not alter the contents of the buffer. This flag shall only be +* cleared by the originator of the buffer when the buffer is returned. +* For tunneled ports, the usage of this flag shall be allowed only if the +* components negotiated a read-only tunnel +*/ +#define OMX_BUFFERFLAG_READONLY 0x00000200 + +/** @ingroup buf */ +typedef struct OMX_BUFFERHEADERTYPE +{ + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U8* pBuffer; /**< Pointer to actual block of memory + that is acting as the buffer */ + OMX_U32 nAllocLen; /**< size of the buffer allocated, in bytes */ + OMX_U32 nFilledLen; /**< number of bytes currently in the + buffer */ + OMX_U32 nOffset; /**< start offset of valid data in bytes from + the start of the buffer */ + OMX_PTR pAppPrivate; /**< pointer to any data the application + wants to associate with this buffer */ + OMX_PTR pPlatformPrivate; /**< pointer to any data the platform + wants to associate with this buffer */ + OMX_PTR pInputPortPrivate; /**< pointer to any data the input port + wants to associate with this buffer */ + OMX_PTR pOutputPortPrivate; /**< pointer to any data the output port + wants to associate with this buffer */ + OMX_HANDLETYPE hMarkTargetComponent; /**< The component that will generate a + mark event upon processing this buffer. */ + OMX_PTR pMarkData; /**< Application specific data associated with + the mark sent on a mark event to disambiguate + this mark from others. */ + OMX_U32 nTickCount; /**< Optional entry that the component and + application can update with a tick count + when they access the component. This + value should be in microseconds. Since + this is a value relative to an arbitrary + starting point, this value cannot be used + to determine absolute time. This is an + optional entry and not all components + will update it.*/ + OMX_TICKS nTimeStamp; /**< Timestamp corresponding to the sample + starting at the first logical sample + boundary in the buffer. Timestamps of + successive samples within the buffer may + be inferred by adding the duration of the + of the preceding buffer to the timestamp + of the preceding buffer.*/ + OMX_U32 nFlags; /**< buffer specific flags */ + OMX_U32 nOutputPortIndex; /**< The index of the output port (if any) using + this buffer */ + OMX_U32 nInputPortIndex; /**< The index of the input port (if any) using + this buffer */ +} OMX_BUFFERHEADERTYPE; + +/** The OMX_EXTRADATATYPE enumeration is used to define the + * possible extra data payload types. + * NB: this enum is binary backwards compatible with the previous + * OMX_EXTRADATA_QUANT define. This should be replaced with + * OMX_ExtraDataQuantization. + */ +typedef enum OMX_EXTRADATATYPE +{ + OMX_ExtraDataNone = 0, /**< Indicates that no more extra data sections follow */ + OMX_ExtraDataQuantization, /**< The data payload contains quantization data */ + OMX_ExtraDataKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_ExtraDataVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + OMX_ExtraDataMax = 0x7FFFFFFF +} OMX_EXTRADATATYPE; + + +typedef struct OMX_OTHER_EXTRADATATYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_EXTRADATATYPE eType; /* Extra Data type */ + OMX_U32 nDataSize; /* Size of the supporting data to follow */ + OMX_U8 data[1]; /* Supporting data hint */ +} OMX_OTHER_EXTRADATATYPE; + +/** @ingroup comp */ +typedef struct OMX_PORT_PARAM_TYPE { + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nPorts; /**< The number of ports for this component */ + OMX_U32 nStartPortNumber; /** first port number for this type of port */ +} OMX_PORT_PARAM_TYPE; + +/** @ingroup comp */ +typedef enum OMX_EVENTTYPE +{ + OMX_EventCmdComplete, /**< component has sucessfully completed a command */ + OMX_EventError, /**< component has detected an error condition */ + OMX_EventMark, /**< component has detected a buffer mark */ + OMX_EventPortSettingsChanged, /**< component is reported a port settings change */ + OMX_EventBufferFlag, /**< component has detected an EOS */ + OMX_EventResourcesAcquired, /**< component has been granted resources and is + automatically starting the state change from + OMX_StateWaitForResources to OMX_StateIdle. */ + OMX_EventComponentResumed, /**< Component resumed due to reacquisition of resources */ + OMX_EventDynamicResourcesAvailable, /**< Component has acquired previously unavailable dynamic resources */ + OMX_EventPortFormatDetected, /**< Component has detected a supported format. */ + OMX_EventKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_EventVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + OMX_EventMax = 0x7FFFFFFF +} OMX_EVENTTYPE; + +typedef struct OMX_CALLBACKTYPE +{ + /** The EventHandler method is used to notify the application when an + event of interest occurs. Events are defined in the OMX_EVENTTYPE + enumeration. Please see that enumeration for details of what will + be returned for each type of event. Callbacks should not return + an error to the component, so if an error occurs, the application + shall handle it internally. This is a blocking call. + + The application should return from this call within 5 msec to avoid + blocking the component for an excessively long period of time. + + @param hComponent + handle of the component to access. This is the component + handle returned by the call to the GetHandle function. + @param pAppData + pointer to an application defined value that was provided in the + pAppData parameter to the OMX_GetHandle method for the component. + This application defined value is provided so that the application + can have a component specific context when receiving the callback. + @param eEvent + Event that the component wants to notify the application about. + @param nData1 + nData will be the OMX_ERRORTYPE for an error event and will be + an OMX_COMMANDTYPE for a command complete event and OMX_INDEXTYPE for a OMX_PortSettingsChanged event. + @param nData2 + nData2 will hold further information related to the event. Can be OMX_STATETYPE for + a OMX_CommandStateSet command or port index for a OMX_PortSettingsChanged event. + Default value is 0 if not used. ) + @param pEventData + Pointer to additional event-specific data (see spec for meaning). + */ + + OMX_ERRORTYPE (*EventHandler)( + OMX_IN OMX_HANDLETYPE hComponent, + OMX_IN OMX_PTR pAppData, + OMX_IN OMX_EVENTTYPE eEvent, + OMX_IN OMX_U32 nData1, + OMX_IN OMX_U32 nData2, + OMX_IN OMX_PTR pEventData); + + /** The EmptyBufferDone method is used to return emptied buffers from an + input port back to the application for reuse. This is a blocking call + so the application should not attempt to refill the buffers during this + call, but should queue them and refill them in another thread. There + is no error return, so the application shall handle any errors generated + internally. + + The application should return from this call within 5 msec. + + @param hComponent + handle of the component to access. This is the component + handle returned by the call to the GetHandle function. + @param pAppData + pointer to an application defined value that was provided in the + pAppData parameter to the OMX_GetHandle method for the component. + This application defined value is provided so that the application + can have a component specific context when receiving the callback. + @param pBuffer + pointer to an OMX_BUFFERHEADERTYPE structure allocated with UseBuffer + or AllocateBuffer indicating the buffer that was emptied. + @ingroup buf + */ + OMX_ERRORTYPE (*EmptyBufferDone)( + OMX_IN OMX_HANDLETYPE hComponent, + OMX_IN OMX_PTR pAppData, + OMX_IN OMX_BUFFERHEADERTYPE* pBuffer); + + /** The FillBufferDone method is used to return filled buffers from an + output port back to the application for emptying and then reuse. + This is a blocking call so the application should not attempt to + empty the buffers during this call, but should queue the buffers + and empty them in another thread. There is no error return, so + the application shall handle any errors generated internally. The + application shall also update the buffer header to indicate the + number of bytes placed into the buffer. + + The application should return from this call within 5 msec. + + @param hComponent + handle of the component to access. This is the component + handle returned by the call to the GetHandle function. + @param pAppData + pointer to an application defined value that was provided in the + pAppData parameter to the OMX_GetHandle method for the component. + This application defined value is provided so that the application + can have a component specific context when receiving the callback. + @param pBuffer + pointer to an OMX_BUFFERHEADERTYPE structure allocated with UseBuffer + or AllocateBuffer indicating the buffer that was filled. + @ingroup buf + */ + OMX_ERRORTYPE (*FillBufferDone)( + OMX_OUT OMX_HANDLETYPE hComponent, + OMX_OUT OMX_PTR pAppData, + OMX_OUT OMX_BUFFERHEADERTYPE* pBuffer); + +} OMX_CALLBACKTYPE; + +/** The OMX_BUFFERSUPPLIERTYPE enumeration is used to dictate port supplier + preference when tunneling between two ports. + @ingroup tun buf +*/ +typedef enum OMX_BUFFERSUPPLIERTYPE +{ + OMX_BufferSupplyUnspecified = 0x0, /**< port supplying the buffers is unspecified, + or don't care */ + OMX_BufferSupplyInput, /**< input port supplies the buffers */ + OMX_BufferSupplyOutput, /**< output port supplies the buffers */ + OMX_BufferSupplyKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_BufferSupplyVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + OMX_BufferSupplyMax = 0x7FFFFFFF +} OMX_BUFFERSUPPLIERTYPE; + + +/** buffer supplier parameter + * @ingroup tun + */ +typedef struct OMX_PARAM_BUFFERSUPPLIERTYPE { + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nPortIndex; /**< port that this structure applies to */ + OMX_BUFFERSUPPLIERTYPE eBufferSupplier; /**< buffer supplier */ +} OMX_PARAM_BUFFERSUPPLIERTYPE; + + +/**< indicates that buffers received by an input port of a tunnel + may not modify the data in the buffers + @ingroup tun + */ +#define OMX_PORTTUNNELFLAG_READONLY 0x00000001 + + +/** The OMX_TUNNELSETUPTYPE structure is used to pass data from an output + port to an input port as part the two ComponentTunnelRequest calls + resulting from a OMX_SetupTunnel call from the IL Client. + @ingroup tun + */ +typedef struct OMX_TUNNELSETUPTYPE +{ + OMX_U32 nTunnelFlags; /**< bit flags for tunneling */ + OMX_BUFFERSUPPLIERTYPE eSupplier; /**< supplier preference */ +} OMX_TUNNELSETUPTYPE; + +/* OMX Component headers is included to enable the core to use + macros for functions into the component for OMX release 1.0. + Developers should not access any structures or data from within + the component header directly */ +/* TO BE REMOVED - #include */ + +/** GetComponentVersion will return information about the component. + This is a blocking call. This macro will go directly from the + application to the component (via a core macro). The + component will return from this call within 5 msec. + @param [in] hComponent + handle of component to execute the command + @param [out] pComponentName + pointer to an empty string of length 128 bytes. The component + will write its name into this string. The name will be + terminated by a single zero byte. The name of a component will + be 127 bytes or less to leave room for the trailing zero byte. + An example of a valid component name is "OMX.ABC.ChannelMixer\0". + @param [out] pComponentVersion + pointer to an OMX Version structure that the component will fill + in. The component will fill in a value that indicates the + component version. NOTE: the component version is NOT the same + as the OMX Specification version (found in all structures). The + component version is defined by the vendor of the component and + its value is entirely up to the component vendor. + @param [out] pSpecVersion + pointer to an OMX Version structure that the component will fill + in. The SpecVersion is the version of the specification that the + component was built against. Please note that this value may or + may not match the structure's version. For example, if the + component was built against the 2.0 specification, but the + application (which creates the structure is built against the + 1.0 specification the versions would be different. + @param [out] pComponentUUID + pointer to the UUID of the component which will be filled in by + the component. The UUID is a unique identifier that is set at + RUN time for the component and is unique to each instantion of + the component. + @return OMX_ERRORTYPE + If the command successfully executes, the return code will be + OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. + @ingroup comp + */ +#define OMX_GetComponentVersion( \ + hComponent, \ + pComponentName, \ + pComponentVersion, \ + pSpecVersion, \ + pComponentUUID) \ + ((OMX_COMPONENTTYPE*)hComponent)->GetComponentVersion( \ + hComponent, \ + pComponentName, \ + pComponentVersion, \ + pSpecVersion, \ + pComponentUUID) /* Macro End */ + + +/** Send a command to the component. This call is a non-blocking call. + The component should check the parameters and then queue the command + to the component thread to be executed. The component thread shall + send the EventHandler() callback at the conclusion of the command. + This macro will go directly from the application to the component (via + a core macro). The component will return from this call within 5 msec. + + When the command is "OMX_CommandStateSet" the component will queue a + state transition to the new state idenfied in nParam. + + When the command is "OMX_CommandFlush", to flush a port's buffer queues, + the command will force the component to return all buffers NOT CURRENTLY + BEING PROCESSED to the application, in the order in which the buffers + were received. + + When the command is "OMX_CommandPortDisable" or + "OMX_CommandPortEnable", the component's port (given by the value of + nParam) will be stopped or restarted. + + When the command "OMX_CommandMarkBuffer" is used to mark a buffer, the + pCmdData will point to a OMX_MARKTYPE structure containing the component + handle of the component to examine the buffer chain for the mark. nParam1 + contains the index of the port on which the buffer mark is applied. + + Specification text for more details. + + @param [in] hComponent + handle of component to execute the command + @param [in] Cmd + Command for the component to execute + @param [in] nParam + Parameter for the command to be executed. When Cmd has the value + OMX_CommandStateSet, value is a member of OMX_STATETYPE. When Cmd has + the value OMX_CommandFlush, value of nParam indicates which port(s) + to flush. -1 is used to flush all ports a single port index will + only flush that port. When Cmd has the value "OMX_CommandPortDisable" + or "OMX_CommandPortEnable", the component's port is given by + the value of nParam. When Cmd has the value "OMX_CommandMarkBuffer" + the components pot is given by the value of nParam. + @param [in] pCmdData + Parameter pointing to the OMX_MARKTYPE structure when Cmd has the value + "OMX_CommandMarkBuffer". + @return OMX_ERRORTYPE + If the command successfully executes, the return code will be + OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. + @ingroup comp + */ +#define OMX_SendCommand( \ + hComponent, \ + Cmd, \ + nParam, \ + pCmdData) \ + ((OMX_COMPONENTTYPE*)hComponent)->SendCommand( \ + hComponent, \ + Cmd, \ + nParam, \ + pCmdData) /* Macro End */ + + +/** The OMX_GetParameter macro will get one of the current parameter + settings from the component. This macro cannot only be invoked when + the component is in the OMX_StateInvalid state. The nParamIndex + parameter is used to indicate which structure is being requested from + the component. The application shall allocate the correct structure + and shall fill in the structure size and version information before + invoking this macro. When the parameter applies to a port, the + caller shall fill in the appropriate nPortIndex value indicating the + port on which the parameter applies. If the component has not had + any settings changed, then the component should return a set of + valid DEFAULT parameters for the component. This is a blocking + call. + + The component should return from this call within 20 msec. + + @param [in] hComponent + Handle of the component to be accessed. This is the component + handle returned by the call to the OMX_GetHandle function. + @param [in] nParamIndex + Index of the structure to be filled. This value is from the + OMX_INDEXTYPE enumeration. + @param [in,out] pComponentParameterStructure + Pointer to application allocated structure to be filled by the + component. + @return OMX_ERRORTYPE + If the command successfully executes, the return code will be + OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. + @ingroup comp + */ +#define OMX_GetParameter( \ + hComponent, \ + nParamIndex, \ + pComponentParameterStructure) \ + ((OMX_COMPONENTTYPE*)hComponent)->GetParameter( \ + hComponent, \ + nParamIndex, \ + pComponentParameterStructure) /* Macro End */ + + +/** The OMX_SetParameter macro will send an initialization parameter + structure to a component. Each structure shall be sent one at a time, + in a separate invocation of the macro. This macro can only be + invoked when the component is in the OMX_StateLoaded state, or the + port is disabled (when the parameter applies to a port). The + nParamIndex parameter is used to indicate which structure is being + passed to the component. The application shall allocate the + correct structure and shall fill in the structure size and version + information (as well as the actual data) before invoking this macro. + The application is free to dispose of this structure after the call + as the component is required to copy any data it shall retain. This + is a blocking call. + + The component should return from this call within 20 msec. + + @param [in] hComponent + Handle of the component to be accessed. This is the component + handle returned by the call to the OMX_GetHandle function. + @param [in] nIndex + Index of the structure to be sent. This value is from the + OMX_INDEXTYPE enumeration. + @param [in] pComponentParameterStructure + pointer to application allocated structure to be used for + initialization by the component. + @return OMX_ERRORTYPE + If the command successfully executes, the return code will be + OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. + @ingroup comp + */ +#define OMX_SetParameter( \ + hComponent, \ + nParamIndex, \ + pComponentParameterStructure) \ + ((OMX_COMPONENTTYPE*)hComponent)->SetParameter( \ + hComponent, \ + nParamIndex, \ + pComponentParameterStructure) /* Macro End */ + + +/** The OMX_GetConfig macro will get one of the configuration structures + from a component. This macro can be invoked anytime after the + component has been loaded. The nParamIndex call parameter is used to + indicate which structure is being requested from the component. The + application shall allocate the correct structure and shall fill in the + structure size and version information before invoking this macro. + If the component has not had this configuration parameter sent before, + then the component should return a set of valid DEFAULT values for the + component. This is a blocking call. + + The component should return from this call within 5 msec. + + @param [in] hComponent + Handle of the component to be accessed. This is the component + handle returned by the call to the OMX_GetHandle function. + @param [in] nIndex + Index of the structure to be filled. This value is from the + OMX_INDEXTYPE enumeration. + @param [in,out] pComponentConfigStructure + pointer to application allocated structure to be filled by the + component. + @return OMX_ERRORTYPE + If the command successfully executes, the return code will be + OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. + @ingroup comp +*/ +#define OMX_GetConfig( \ + hComponent, \ + nConfigIndex, \ + pComponentConfigStructure) \ + ((OMX_COMPONENTTYPE*)hComponent)->GetConfig( \ + hComponent, \ + nConfigIndex, \ + pComponentConfigStructure) /* Macro End */ + + +/** The OMX_SetConfig macro will send one of the configuration + structures to a component. Each structure shall be sent one at a time, + each in a separate invocation of the macro. This macro can be invoked + anytime after the component has been loaded. The application shall + allocate the correct structure and shall fill in the structure size + and version information (as well as the actual data) before invoking + this macro. The application is free to dispose of this structure after + the call as the component is required to copy any data it shall retain. + This is a blocking call. + + The component should return from this call within 5 msec. + + @param [in] hComponent + Handle of the component to be accessed. This is the component + handle returned by the call to the OMX_GetHandle function. + @param [in] nConfigIndex + Index of the structure to be sent. This value is from the + OMX_INDEXTYPE enumeration above. + @param [in] pComponentConfigStructure + pointer to application allocated structure to be used for + initialization by the component. + @return OMX_ERRORTYPE + If the command successfully executes, the return code will be + OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. + @ingroup comp + */ +#define OMX_SetConfig( \ + hComponent, \ + nConfigIndex, \ + pComponentConfigStructure) \ + ((OMX_COMPONENTTYPE*)hComponent)->SetConfig( \ + hComponent, \ + nConfigIndex, \ + pComponentConfigStructure) /* Macro End */ + + +/** The OMX_GetExtensionIndex macro will invoke a component to translate + a vendor specific configuration or parameter string into an OMX + structure index. There is no requirement for the vendor to support + this command for the indexes already found in the OMX_INDEXTYPE + enumeration (this is done to save space in small components). The + component shall support all vendor supplied extension indexes not found + in the master OMX_INDEXTYPE enumeration. This is a blocking call. + + The component should return from this call within 5 msec. + + @param [in] hComponent + Handle of the component to be accessed. This is the component + handle returned by the call to the GetHandle function. + @param [in] cParameterName + OMX_STRING that shall be less than 128 characters long including + the trailing null byte. This is the string that will get + translated by the component into a configuration index. + @param [out] pIndexType + a pointer to a OMX_INDEXTYPE to receive the index value. + @return OMX_ERRORTYPE + If the command successfully executes, the return code will be + OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. + @ingroup comp + */ +#define OMX_GetExtensionIndex( \ + hComponent, \ + cParameterName, \ + pIndexType) \ + ((OMX_COMPONENTTYPE*)hComponent)->GetExtensionIndex( \ + hComponent, \ + cParameterName, \ + pIndexType) /* Macro End */ + + +/** The OMX_GetState macro will invoke the component to get the current + state of the component and place the state value into the location + pointed to by pState. + + The component should return from this call within 5 msec. + + @param [in] hComponent + Handle of the component to be accessed. This is the component + handle returned by the call to the OMX_GetHandle function. + @param [out] pState + pointer to the location to receive the state. The value returned + is one of the OMX_STATETYPE members + @return OMX_ERRORTYPE + If the command successfully executes, the return code will be + OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. + @ingroup comp + */ +#define OMX_GetState( \ + hComponent, \ + pState) \ + ((OMX_COMPONENTTYPE*)hComponent)->GetState( \ + hComponent, \ + pState) /* Macro End */ + + +/** The OMX_UseBuffer macro will request that the component use + a buffer (and allocate its own buffer header) already allocated + by another component, or by the IL Client. This is a blocking + call. + + The component should return from this call within 20 msec. + + @param [in] hComponent + Handle of the component to be accessed. This is the component + handle returned by the call to the OMX_GetHandle function. + @param [out] ppBuffer + pointer to an OMX_BUFFERHEADERTYPE structure used to receive the + pointer to the buffer header + @return OMX_ERRORTYPE + If the command successfully executes, the return code will be + OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. + @ingroup comp buf + */ + +#define OMX_UseBuffer( \ + hComponent, \ + ppBufferHdr, \ + nPortIndex, \ + pAppPrivate, \ + nSizeBytes, \ + pBuffer) \ + ((OMX_COMPONENTTYPE*)hComponent)->UseBuffer( \ + hComponent, \ + ppBufferHdr, \ + nPortIndex, \ + pAppPrivate, \ + nSizeBytes, \ + pBuffer) + + +/** The OMX_AllocateBuffer macro will request that the component allocate + a new buffer and buffer header. The component will allocate the + buffer and the buffer header and return a pointer to the buffer + header. This is a blocking call. + + The component should return from this call within 5 msec. + + @param [in] hComponent + Handle of the component to be accessed. This is the component + handle returned by the call to the OMX_GetHandle function. + @param [out] ppBuffer + pointer to an OMX_BUFFERHEADERTYPE structure used to receive + the pointer to the buffer header + @param [in] nPortIndex + nPortIndex is used to select the port on the component the buffer will + be used with. The port can be found by using the nPortIndex + value as an index into the Port Definition array of the component. + @param [in] pAppPrivate + pAppPrivate is used to initialize the pAppPrivate member of the + buffer header structure. + @param [in] nSizeBytes + size of the buffer to allocate. Used when bAllocateNew is true. + @return OMX_ERRORTYPE + If the command successfully executes, the return code will be + OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. + @ingroup comp buf + */ +#define OMX_AllocateBuffer( \ + hComponent, \ + ppBuffer, \ + nPortIndex, \ + pAppPrivate, \ + nSizeBytes) \ + ((OMX_COMPONENTTYPE*)hComponent)->AllocateBuffer( \ + hComponent, \ + ppBuffer, \ + nPortIndex, \ + pAppPrivate, \ + nSizeBytes) /* Macro End */ + + +/** The OMX_FreeBuffer macro will release a buffer header from the component + which was allocated using either OMX_AllocateBuffer or OMX_UseBuffer. If + the component allocated the buffer (see the OMX_UseBuffer macro) then + the component shall free the buffer and buffer header. This is a + blocking call. + + The component should return from this call within 20 msec. + + @param [in] hComponent + Handle of the component to be accessed. This is the component + handle returned by the call to the OMX_GetHandle function. + @param [in] nPortIndex + nPortIndex is used to select the port on the component the buffer will + be used with. + @param [in] pBuffer + pointer to an OMX_BUFFERHEADERTYPE structure allocated with UseBuffer + or AllocateBuffer. + @return OMX_ERRORTYPE + If the command successfully executes, the return code will be + OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. + @ingroup comp buf + */ +#define OMX_FreeBuffer( \ + hComponent, \ + nPortIndex, \ + pBuffer) \ + ((OMX_COMPONENTTYPE*)hComponent)->FreeBuffer( \ + hComponent, \ + nPortIndex, \ + pBuffer) /* Macro End */ + + +/** The OMX_EmptyThisBuffer macro will send a buffer full of data to an + input port of a component. The buffer will be emptied by the component + and returned to the application via the EmptyBufferDone call back. + This is a non-blocking call in that the component will record the buffer + and return immediately and then empty the buffer, later, at the proper + time. As expected, this macro may be invoked only while the component + is in the OMX_StateExecuting. If nPortIndex does not specify an input + port, the component shall return an error. + + The component should return from this call within 5 msec. + + @param [in] hComponent + Handle of the component to be accessed. This is the component + handle returned by the call to the OMX_GetHandle function. + @param [in] pBuffer + pointer to an OMX_BUFFERHEADERTYPE structure allocated with UseBuffer + or AllocateBuffer. + @return OMX_ERRORTYPE + If the command successfully executes, the return code will be + OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. + @ingroup comp buf + */ +#define OMX_EmptyThisBuffer( \ + hComponent, \ + pBuffer) \ + ((OMX_COMPONENTTYPE*)hComponent)->EmptyThisBuffer( \ + hComponent, \ + pBuffer) /* Macro End */ + + +/** The OMX_FillThisBuffer macro will send an empty buffer to an + output port of a component. The buffer will be filled by the component + and returned to the application via the FillBufferDone call back. + This is a non-blocking call in that the component will record the buffer + and return immediately and then fill the buffer, later, at the proper + time. As expected, this macro may be invoked only while the component + is in the OMX_ExecutingState. If nPortIndex does not specify an output + port, the component shall return an error. + + The component should return from this call within 5 msec. + + @param [in] hComponent + Handle of the component to be accessed. This is the component + handle returned by the call to the OMX_GetHandle function. + @param [in] pBuffer + pointer to an OMX_BUFFERHEADERTYPE structure allocated with UseBuffer + or AllocateBuffer. + @return OMX_ERRORTYPE + If the command successfully executes, the return code will be + OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. + @ingroup comp buf + */ +#define OMX_FillThisBuffer( \ + hComponent, \ + pBuffer) \ + ((OMX_COMPONENTTYPE*)hComponent)->FillThisBuffer( \ + hComponent, \ + pBuffer) /* Macro End */ + + + +/** The OMX_UseEGLImage macro will request that the component use + a EGLImage provided by EGL (and allocate its own buffer header) + This is a blocking call. + + The component should return from this call within 20 msec. + + @param [in] hComponent + Handle of the component to be accessed. This is the component + handle returned by the call to the OMX_GetHandle function. + @param [out] ppBuffer + pointer to an OMX_BUFFERHEADERTYPE structure used to receive the + pointer to the buffer header. Note that the memory location used + for this buffer is NOT visible to the IL Client. + @param [in] nPortIndex + nPortIndex is used to select the port on the component the buffer will + be used with. The port can be found by using the nPortIndex + value as an index into the Port Definition array of the component. + @param [in] pAppPrivate + pAppPrivate is used to initialize the pAppPrivate member of the + buffer header structure. + @param [in] eglImage + eglImage contains the handle of the EGLImage to use as a buffer on the + specified port. The component is expected to validate properties of + the EGLImage against the configuration of the port to ensure the component + can use the EGLImage as a buffer. + @return OMX_ERRORTYPE + If the command successfully executes, the return code will be + OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. + @ingroup comp buf + */ +#define OMX_UseEGLImage( \ + hComponent, \ + ppBufferHdr, \ + nPortIndex, \ + pAppPrivate, \ + eglImage) \ + ((OMX_COMPONENTTYPE*)hComponent)->UseEGLImage( \ + hComponent, \ + ppBufferHdr, \ + nPortIndex, \ + pAppPrivate, \ + eglImage) + +/** The OMX_Init method is used to initialize the OMX core. It shall be the + first call made into OMX and it should only be executed one time without + an interviening OMX_Deinit call. + + The core should return from this call within 20 msec. + + @return OMX_ERRORTYPE + If the command successfully executes, the return code will be + OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. + @ingroup core + */ +OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_Init(void); + + +/** The OMX_Deinit method is used to deinitialize the OMX core. It shall be + the last call made into OMX. In the event that the core determines that + thare are components loaded when this call is made, the core may return + with an error rather than try to unload the components. + + The core should return from this call within 20 msec. + + @return OMX_ERRORTYPE + If the command successfully executes, the return code will be + OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. + @ingroup core + */ +OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_Deinit(void); + + +/** The OMX_ComponentNameEnum method will enumerate through all the names of + recognised valid components in the system. This function is provided + as a means to detect all the components in the system run-time. There is + no strict ordering to the enumeration order of component names, although + each name will only be enumerated once. If the OMX core supports run-time + installation of new components, it is only requried to detect newly + installed components when the first call to enumerate component names + is made (i.e. when nIndex is 0x0). + + The core should return from this call in 20 msec. + + @param [out] cComponentName + pointer to a null terminated string with the component name. The + names of the components are strings less than 127 bytes in length + plus the trailing null for a maximum size of 128 bytes. An example + of a valid component name is "OMX.TI.AUDIO.DSP.MIXER\0". Names are + assigned by the vendor, but shall start with "OMX." and then have + the Vendor designation next. + @param [in] nNameLength + number of characters in the cComponentName string. With all + component name strings restricted to less than 128 characters + (including the trailing null) it is recomended that the caller + provide a input string for the cComponentName of 128 characters. + @param [in] nIndex + number containing the enumeration index for the component. + Multiple calls to OMX_ComponentNameEnum with increasing values + of nIndex will enumerate through the component names in the + system until OMX_ErrorNoMore is returned. The value of nIndex + is 0 to (N-1), where N is the number of valid installed components + in the system. + @return OMX_ERRORTYPE + If the command successfully executes, the return code will be + OMX_ErrorNone. When the value of nIndex exceeds the number of + components in the system minus 1, OMX_ErrorNoMore will be + returned. Otherwise the appropriate OMX error will be returned. + @ingroup core + */ +OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_ComponentNameEnum( + OMX_OUT OMX_STRING cComponentName, + OMX_IN OMX_U32 nNameLength, + OMX_IN OMX_U32 nIndex); + + +/** The OMX_GetHandle method will locate the component specified by the + component name given, load that component into memory and then invoke + the component's methods to create an instance of the component. + + The core should return from this call within 20 msec. + + @param [out] pHandle + pointer to an OMX_HANDLETYPE pointer to be filled in by this method. + @param [in] cComponentName + pointer to a null terminated string with the component name. The + names of the components are strings less than 127 bytes in length + plus the trailing null for a maximum size of 128 bytes. An example + of a valid component name is "OMX.TI.AUDIO.DSP.MIXER\0". Names are + assigned by the vendor, but shall start with "OMX." and then have + the Vendor designation next. + @param [in] pAppData + pointer to an application defined value that will be returned + during callbacks so that the application can identify the source + of the callback. + @param [in] pCallBacks + pointer to a OMX_CALLBACKTYPE structure that will be passed to the + component to initialize it with. + @return OMX_ERRORTYPE + If the command successfully executes, the return code will be + OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. + @ingroup core + */ +OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_GetHandle( + OMX_OUT OMX_HANDLETYPE* pHandle, + OMX_IN OMX_STRING cComponentName, + OMX_IN OMX_PTR pAppData, + OMX_IN OMX_CALLBACKTYPE* pCallBacks); + + +/** The OMX_FreeHandle method will free a handle allocated by the OMX_GetHandle + method. If the component reference count goes to zero, the component will + be unloaded from memory. + + The core should return from this call within 20 msec when the component is + in the OMX_StateLoaded state. + + @param [in] hComponent + Handle of the component to be accessed. This is the component + handle returned by the call to the GetHandle function. + @return OMX_ERRORTYPE + If the command successfully executes, the return code will be + OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. + @ingroup core + */ +OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_FreeHandle( + OMX_IN OMX_HANDLETYPE hComponent); + + + +/** The OMX_SetupTunnel method will handle the necessary calls to the components + to setup the specified tunnel the two components. NOTE: This is + an actual method (not a #define macro). This method will make calls into + the component ComponentTunnelRequest method to do the actual tunnel + connection. + + The ComponentTunnelRequest method on both components will be called. + This method shall not be called unless the component is in the + OMX_StateLoaded state except when the ports used for the tunnel are + disabled. In this case, the component may be in the OMX_StateExecuting, + OMX_StatePause, or OMX_StateIdle states. + + The core should return from this call within 20 msec. + + @param [in] hOutput + Handle of the component to be accessed. Also this is the handle + of the component whose port, specified in the nPortOutput parameter + will be used the source for the tunnel. This is the component handle + returned by the call to the OMX_GetHandle function. There is a + requirement that hOutput be the source for the data when + tunelling (i.e. nPortOutput is an output port). If 0x0, the component + specified in hInput will have it's port specified in nPortInput + setup for communication with the application / IL client. + @param [in] nPortOutput + nPortOutput is used to select the source port on component to be + used in the tunnel. + @param [in] hInput + This is the component to setup the tunnel with. This is the handle + of the component whose port, specified in the nPortInput parameter + will be used the destination for the tunnel. This is the component handle + returned by the call to the OMX_GetHandle function. There is a + requirement that hInput be the destination for the data when + tunelling (i.e. nPortInut is an input port). If 0x0, the component + specified in hOutput will have it's port specified in nPortPOutput + setup for communication with the application / IL client. + @param [in] nPortInput + nPortInput is used to select the destination port on component to be + used in the tunnel. + @return OMX_ERRORTYPE + If the command successfully executes, the return code will be + OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. + When OMX_ErrorNotImplemented is returned, one or both components is + a non-interop component and does not support tunneling. + + On failure, the ports of both components are setup for communication + with the application / IL Client. + @ingroup core tun + */ +OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_SetupTunnel( + OMX_IN OMX_HANDLETYPE hOutput, + OMX_IN OMX_U32 nPortOutput, + OMX_IN OMX_HANDLETYPE hInput, + OMX_IN OMX_U32 nPortInput); + +/** @ingroup cp */ +OMX_API OMX_ERRORTYPE OMX_GetContentPipe( + OMX_OUT OMX_HANDLETYPE *hPipe, + OMX_IN OMX_STRING szURI); + +/** The OMX_GetComponentsOfRole method will return the number of components that support the given + role and (if the compNames field is non-NULL) the names of those components. The call will fail if + an insufficiently sized array of names is supplied. To ensure the array is sufficiently sized the + client should: + * first call this function with the compNames field NULL to determine the number of component names + * second call this function with the compNames field pointing to an array of names allocated + according to the number returned by the first call. + + The core should return from this call within 5 msec. + + @param [in] role + This is generic standard component name consisting only of component class + name and the type within that class (e.g. 'audio_decoder.aac'). + @param [inout] pNumComps + This is used both as input and output. + + If compNames is NULL, the input is ignored and the output specifies how many components support + the given role. + + If compNames is not NULL, on input it bounds the size of the input structure and + on output, it specifies the number of components string names listed within the compNames parameter. + @param [inout] compNames + If NULL this field is ignored. If non-NULL this points to an array of 128-byte strings which accepts + a list of the names of all physical components that implement the specified standard component name. + Each name is NULL terminated. numComps indicates the number of names. + @ingroup core + */ +OMX_API OMX_ERRORTYPE OMX_GetComponentsOfRole ( + OMX_IN OMX_STRING role, + OMX_INOUT OMX_U32 *pNumComps, + OMX_INOUT OMX_U8 **compNames); + +/** The OMX_GetRolesOfComponent method will return the number of roles supported by the given + component and (if the roles field is non-NULL) the names of those roles. The call will fail if + an insufficiently sized array of names is supplied. To ensure the array is sufficiently sized the + client should: + * first call this function with the roles field NULL to determine the number of role names + * second call this function with the roles field pointing to an array of names allocated + according to the number returned by the first call. + + The core should return from this call within 5 msec. + + @param [in] compName + This is the name of the component being queried about. + @param [inout] pNumRoles + This is used both as input and output. + + If roles is NULL, the input is ignored and the output specifies how many roles the component supports. + + If compNames is not NULL, on input it bounds the size of the input structure and + on output, it specifies the number of roles string names listed within the roles parameter. + @param [out] roles + If NULL this field is ignored. If non-NULL this points to an array of 128-byte strings + which accepts a list of the names of all standard components roles implemented on the + specified component name. numComps indicates the number of names. + @ingroup core + */ +OMX_API OMX_ERRORTYPE OMX_GetRolesOfComponent ( + OMX_IN OMX_STRING compName, + OMX_INOUT OMX_U32 *pNumRoles, + OMX_OUT OMX_U8 **roles); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif +/* File EOF */ + diff --git a/third_party/openmax/include/OMX_CoreExt.h b/third_party/openmax/include/OMX_CoreExt.h new file mode 100644 index 000000000..3ec14b05f --- /dev/null +++ b/third_party/openmax/include/OMX_CoreExt.h @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2009 The Khronos Group Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject + * to the following conditions: + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +/** OMX_CoreExt.h - OpenMax IL version 1.1.2 + * The OMX_CoreExt header file contains extensions to the definitions used + * by both the application and the component to access common items. + */ + +#ifndef OMX_CoreExt_h +#define OMX_CoreExt_h + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* Each OMX header shall include all required header files to allow the + * header to compile without errors. The includes below are required + * for this header file to compile successfully + */ +#include + + +/** Event type extensions. */ +typedef enum OMX_EVENTEXTTYPE +{ + OMX_EventIndexSettingChanged = OMX_EventKhronosExtensions, /**< component signals the IL client of a change + in a param, config, or extension */ + OMX_EventExtMax = 0x7FFFFFFF +} OMX_EVENTEXTTYPE; + + +/** Enable or disable a callback event. */ +typedef struct OMX_CONFIG_CALLBACKREQUESTTYPE { + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nPortIndex; /**< port that this structure applies to */ + OMX_INDEXTYPE nIndex; /**< the index the callback is requested for */ + OMX_BOOL bEnable; /**< enable (OMX_TRUE) or disable (OMX_FALSE) the callback */ +} OMX_CONFIG_CALLBACKREQUESTTYPE; + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* OMX_CoreExt_h */ +/* File EOF */ diff --git a/third_party/openmax/include/OMX_IVCommon.h b/third_party/openmax/include/OMX_IVCommon.h new file mode 100644 index 000000000..ec717565a --- /dev/null +++ b/third_party/openmax/include/OMX_IVCommon.h @@ -0,0 +1,933 @@ +/** + * Copyright (c) 2008 The Khronos Group Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject + * to the following conditions: + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +/** + * @file OMX_IVCommon.h - OpenMax IL version 1.1.2 + * The structures needed by Video and Image components to exchange + * parameters and configuration data with the components. + */ +#ifndef OMX_IVCommon_h +#define OMX_IVCommon_h + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/** + * Each OMX header must include all required header files to allow the header + * to compile without errors. The includes below are required for this header + * file to compile successfully + */ + +#include + +/** @defgroup iv OpenMAX IL Imaging and Video Domain + * Common structures for OpenMAX IL Imaging and Video domains + * @{ + */ + + +/** + * Enumeration defining possible uncompressed image/video formats. + * + * ENUMS: + * Unused : Placeholder value when format is N/A + * Monochrome : black and white + * 8bitRGB332 : Red 7:5, Green 4:2, Blue 1:0 + * 12bitRGB444 : Red 11:8, Green 7:4, Blue 3:0 + * 16bitARGB4444 : Alpha 15:12, Red 11:8, Green 7:4, Blue 3:0 + * 16bitARGB1555 : Alpha 15, Red 14:10, Green 9:5, Blue 4:0 + * 16bitRGB565 : Red 15:11, Green 10:5, Blue 4:0 + * 16bitBGR565 : Blue 15:11, Green 10:5, Red 4:0 + * 18bitRGB666 : Red 17:12, Green 11:6, Blue 5:0 + * 18bitARGB1665 : Alpha 17, Red 16:11, Green 10:5, Blue 4:0 + * 19bitARGB1666 : Alpha 18, Red 17:12, Green 11:6, Blue 5:0 + * 24bitRGB888 : Red 24:16, Green 15:8, Blue 7:0 + * 24bitBGR888 : Blue 24:16, Green 15:8, Red 7:0 + * 24bitARGB1887 : Alpha 23, Red 22:15, Green 14:7, Blue 6:0 + * 25bitARGB1888 : Alpha 24, Red 23:16, Green 15:8, Blue 7:0 + * 32bitBGRA8888 : Blue 31:24, Green 23:16, Red 15:8, Alpha 7:0 + * 32bitARGB8888 : Alpha 31:24, Red 23:16, Green 15:8, Blue 7:0 + * YUV411Planar : U,Y are subsampled by a factor of 4 horizontally + * YUV411PackedPlanar : packed per payload in planar slices + * YUV420Planar : Three arrays Y,U,V. + * YUV420PackedPlanar : packed per payload in planar slices + * YUV420SemiPlanar : Two arrays, one is all Y, the other is U and V + * YUV422Planar : Three arrays Y,U,V. + * YUV422PackedPlanar : packed per payload in planar slices + * YUV422SemiPlanar : Two arrays, one is all Y, the other is U and V + * YCbYCr : Organized as 16bit YUYV (i.e. YCbYCr) + * YCrYCb : Organized as 16bit YVYU (i.e. YCrYCb) + * CbYCrY : Organized as 16bit UYVY (i.e. CbYCrY) + * CrYCbY : Organized as 16bit VYUY (i.e. CrYCbY) + * YUV444Interleaved : Each pixel contains equal parts YUV + * RawBayer8bit : SMIA camera output format + * RawBayer10bit : SMIA camera output format + * RawBayer8bitcompressed : SMIA camera output format + */ +typedef enum OMX_COLOR_FORMATTYPE { + OMX_COLOR_FormatUnused, + OMX_COLOR_FormatMonochrome, + OMX_COLOR_Format8bitRGB332, + OMX_COLOR_Format12bitRGB444, + OMX_COLOR_Format16bitARGB4444, + OMX_COLOR_Format16bitARGB1555, + OMX_COLOR_Format16bitRGB565, + OMX_COLOR_Format16bitBGR565, + OMX_COLOR_Format18bitRGB666, + OMX_COLOR_Format18bitARGB1665, + OMX_COLOR_Format19bitARGB1666, + OMX_COLOR_Format24bitRGB888, + OMX_COLOR_Format24bitBGR888, + OMX_COLOR_Format24bitARGB1887, + OMX_COLOR_Format25bitARGB1888, + OMX_COLOR_Format32bitBGRA8888, + OMX_COLOR_Format32bitARGB8888, + OMX_COLOR_FormatYUV411Planar, + OMX_COLOR_FormatYUV411PackedPlanar, + OMX_COLOR_FormatYUV420Planar, + OMX_COLOR_FormatYUV420PackedPlanar, + OMX_COLOR_FormatYUV420SemiPlanar, + OMX_COLOR_FormatYUV422Planar, + OMX_COLOR_FormatYUV422PackedPlanar, + OMX_COLOR_FormatYUV422SemiPlanar, + OMX_COLOR_FormatYCbYCr, + OMX_COLOR_FormatYCrYCb, + OMX_COLOR_FormatCbYCrY, + OMX_COLOR_FormatCrYCbY, + OMX_COLOR_FormatYUV444Interleaved, + OMX_COLOR_FormatRawBayer8bit, + OMX_COLOR_FormatRawBayer10bit, + OMX_COLOR_FormatRawBayer8bitcompressed, + OMX_COLOR_FormatL2, + OMX_COLOR_FormatL4, + OMX_COLOR_FormatL8, + OMX_COLOR_FormatL16, + OMX_COLOR_FormatL24, + OMX_COLOR_FormatL32, + OMX_COLOR_FormatYUV420PackedSemiPlanar, + OMX_COLOR_FormatYUV422PackedSemiPlanar, + OMX_COLOR_Format18BitBGR666, + OMX_COLOR_Format24BitARGB6666, + OMX_COLOR_Format24BitABGR6666, + OMX_COLOR_FormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_COLOR_FormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + /** + +/** @defgroup imaging OpenMAX IL Imaging Domain + * @ingroup iv + * Structures for OpenMAX IL Imaging domain + * @{ + */ + +/** + * Enumeration used to define the possible image compression coding. + */ +typedef enum OMX_IMAGE_CODINGTYPE { + OMX_IMAGE_CodingUnused, /**< Value when format is N/A */ + OMX_IMAGE_CodingAutoDetect, /**< Auto detection of image format */ + OMX_IMAGE_CodingJPEG, /**< JPEG/JFIF image format */ + OMX_IMAGE_CodingJPEG2K, /**< JPEG 2000 image format */ + OMX_IMAGE_CodingEXIF, /**< EXIF image format */ + OMX_IMAGE_CodingTIFF, /**< TIFF image format */ + OMX_IMAGE_CodingGIF, /**< Graphics image format */ + OMX_IMAGE_CodingPNG, /**< PNG image format */ + OMX_IMAGE_CodingLZW, /**< LZW image format */ + OMX_IMAGE_CodingBMP, /**< Windows Bitmap format */ + OMX_IMAGE_CodingKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_IMAGE_CodingVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + OMX_IMAGE_CodingMax = 0x7FFFFFFF +} OMX_IMAGE_CODINGTYPE; + + +/** + * Data structure used to define an image path. The number of image paths + * for input and output will vary by type of the image component. + * + * Input (aka Source) : Zero Inputs, one Output, + * Splitter : One Input, 2 or more Outputs, + * Processing Element : One Input, one output, + * Mixer : 2 or more inputs, one output, + * Output (aka Sink) : One Input, zero outputs. + * + * The PortDefinition structure is used to define all of the parameters + * necessary for the compliant component to setup an input or an output + * image path. If additional vendor specific data is required, it should + * be transmitted to the component using the CustomCommand function. + * Compliant components will prepopulate this structure with optimal + * values during the OMX_GetParameter() command. + * + * STRUCT MEMBERS: + * cMIMEType : MIME type of data for the port + * pNativeRender : Platform specific reference for a display if a + * sync, otherwise this field is 0 + * nFrameWidth : Width of frame to be used on port if + * uncompressed format is used. Use 0 for + * unknown, don't care or variable + * nFrameHeight : Height of frame to be used on port if + * uncompressed format is used. Use 0 for + * unknown, don't care or variable + * nStride : Number of bytes per span of an image (i.e. + * indicates the number of bytes to get from + * span N to span N+1, where negative stride + * indicates the image is bottom up + * nSliceHeight : Height used when encoding in slices + * bFlagErrorConcealment : Turns on error concealment if it is supported by + * the OMX component + * eCompressionFormat : Compression format used in this instance of + * the component. When OMX_IMAGE_CodingUnused is + * specified, eColorFormat is valid + * eColorFormat : Decompressed format used by this component + * pNativeWindow : Platform specific reference for a window object if a + * display sink , otherwise this field is 0x0. + */ +typedef struct OMX_IMAGE_PORTDEFINITIONTYPE { + OMX_STRING cMIMEType; + OMX_NATIVE_DEVICETYPE pNativeRender; + OMX_U32 nFrameWidth; + OMX_U32 nFrameHeight; + OMX_S32 nStride; + OMX_U32 nSliceHeight; + OMX_BOOL bFlagErrorConcealment; + OMX_IMAGE_CODINGTYPE eCompressionFormat; + OMX_COLOR_FORMATTYPE eColorFormat; + OMX_NATIVE_WINDOWTYPE pNativeWindow; +} OMX_IMAGE_PORTDEFINITIONTYPE; + + +/** + * Port format parameter. This structure is used to enumerate the various + * data input/output format supported by the port. + * + * STRUCT MEMBERS: + * nSize : Size of the structure in bytes + * nVersion : OMX specification version information + * nPortIndex : Indicates which port to set + * nIndex : Indicates the enumeration index for the format from + * 0x0 to N-1 + * eCompressionFormat : Compression format used in this instance of the + * component. When OMX_IMAGE_CodingUnused is specified, + * eColorFormat is valid + * eColorFormat : Decompressed format used by this component + */ +typedef struct OMX_IMAGE_PARAM_PORTFORMATTYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_U32 nIndex; + OMX_IMAGE_CODINGTYPE eCompressionFormat; + OMX_COLOR_FORMATTYPE eColorFormat; +} OMX_IMAGE_PARAM_PORTFORMATTYPE; + + +/** + * Flash control type + * + * ENUMS + * Torch : Flash forced constantly on + */ +typedef enum OMX_IMAGE_FLASHCONTROLTYPE { + OMX_IMAGE_FlashControlOn = 0, + OMX_IMAGE_FlashControlOff, + OMX_IMAGE_FlashControlAuto, + OMX_IMAGE_FlashControlRedEyeReduction, + OMX_IMAGE_FlashControlFillin, + OMX_IMAGE_FlashControlTorch, + OMX_IMAGE_FlashControlKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_IMAGE_FlashControlVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + OMX_IMAGE_FlashControlMax = 0x7FFFFFFF +} OMX_IMAGE_FLASHCONTROLTYPE; + + +/** + * Flash control configuration + * + * STRUCT MEMBERS: + * nSize : Size of the structure in bytes + * nVersion : OMX specification version information + * nPortIndex : Port that this structure applies to + * eFlashControl : Flash control type + */ +typedef struct OMX_IMAGE_PARAM_FLASHCONTROLTYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_IMAGE_FLASHCONTROLTYPE eFlashControl; +} OMX_IMAGE_PARAM_FLASHCONTROLTYPE; + + +/** + * Focus control type + */ +typedef enum OMX_IMAGE_FOCUSCONTROLTYPE { + OMX_IMAGE_FocusControlOn = 0, + OMX_IMAGE_FocusControlOff, + OMX_IMAGE_FocusControlAuto, + OMX_IMAGE_FocusControlAutoLock, + OMX_IMAGE_FocusControlKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_IMAGE_FocusControlVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + OMX_IMAGE_FocusControlMax = 0x7FFFFFFF +} OMX_IMAGE_FOCUSCONTROLTYPE; + + +/** + * Focus control configuration + * + * STRUCT MEMBERS: + * nSize : Size of the structure in bytes + * nVersion : OMX specification version information + * nPortIndex : Port that this structure applies to + * eFocusControl : Focus control + * nFocusSteps : Focus can take on values from 0 mm to infinity. + * Interest is only in number of steps over this range. + * nFocusStepIndex : Current focus step index + */ +typedef struct OMX_IMAGE_CONFIG_FOCUSCONTROLTYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_IMAGE_FOCUSCONTROLTYPE eFocusControl; + OMX_U32 nFocusSteps; + OMX_U32 nFocusStepIndex; +} OMX_IMAGE_CONFIG_FOCUSCONTROLTYPE; + + +/** + * Q Factor for JPEG compression, which controls the tradeoff between image + * quality and size. Q Factor provides a more simple means of controlling + * JPEG compression quality, without directly programming Quantization + * tables for chroma and luma + * + * STRUCT MEMBERS: + * nSize : Size of the structure in bytes + * nVersion : OMX specification version information + * nPortIndex : Port that this structure applies to + * nQFactor : JPEG Q factor value in the range of 1-100. A factor of 1 + * produces the smallest, worst quality images, and a factor + * of 100 produces the largest, best quality images. A + * typical default is 75 for small good quality images + */ +typedef struct OMX_IMAGE_PARAM_QFACTORTYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_U32 nQFactor; +} OMX_IMAGE_PARAM_QFACTORTYPE; + +/** + * Quantization table type + */ + +typedef enum OMX_IMAGE_QUANTIZATIONTABLETYPE { + OMX_IMAGE_QuantizationTableLuma = 0, + OMX_IMAGE_QuantizationTableChroma, + OMX_IMAGE_QuantizationTableChromaCb, + OMX_IMAGE_QuantizationTableChromaCr, + OMX_IMAGE_QuantizationTableKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_IMAGE_QuantizationTableVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + OMX_IMAGE_QuantizationTableMax = 0x7FFFFFFF +} OMX_IMAGE_QUANTIZATIONTABLETYPE; + +/** + * JPEG quantization tables are used to determine DCT compression for + * YUV data, as an alternative to specifying Q factor, providing exact + * control of compression + * + * STRUCT MEMBERS: + * nSize : Size of the structure in bytes + * nVersion : OMX specification version information + * nPortIndex : Port that this structure applies to + * eQuantizationTable : Quantization table type + * nQuantizationMatrix[64] : JPEG quantization table of coefficients stored + * in increasing columns then by rows of data (i.e. + * row 1, ... row 8). Quantization values are in + * the range 0-255 and stored in linear order + * (i.e. the component will zig-zag the + * quantization table data if required internally) + */ +typedef struct OMX_IMAGE_PARAM_QUANTIZATIONTABLETYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_IMAGE_QUANTIZATIONTABLETYPE eQuantizationTable; + OMX_U8 nQuantizationMatrix[64]; +} OMX_IMAGE_PARAM_QUANTIZATIONTABLETYPE; + + +/** + * Huffman table type, the same Huffman table is applied for chroma and + * luma component + */ +typedef enum OMX_IMAGE_HUFFMANTABLETYPE { + OMX_IMAGE_HuffmanTableAC = 0, + OMX_IMAGE_HuffmanTableDC, + OMX_IMAGE_HuffmanTableACLuma, + OMX_IMAGE_HuffmanTableACChroma, + OMX_IMAGE_HuffmanTableDCLuma, + OMX_IMAGE_HuffmanTableDCChroma, + OMX_IMAGE_HuffmanTableKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_IMAGE_HuffmanTableVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + OMX_IMAGE_HuffmanTableMax = 0x7FFFFFFF +} OMX_IMAGE_HUFFMANTABLETYPE; + +/** + * JPEG Huffman table + * + * STRUCT MEMBERS: + * nSize : Size of the structure in bytes + * nVersion : OMX specification version information + * nPortIndex : Port that this structure applies to + * eHuffmanTable : Huffman table type + * nNumberOfHuffmanCodeOfLength[16] : 0-16, number of Huffman codes of each + * possible length + * nHuffmanTable[256] : 0-255, the size used for AC and DC + * HuffmanTable are 16 and 162 + */ +typedef struct OMX_IMAGE_PARAM_HUFFMANTTABLETYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_IMAGE_HUFFMANTABLETYPE eHuffmanTable; + OMX_U8 nNumberOfHuffmanCodeOfLength[16]; + OMX_U8 nHuffmanTable[256]; +}OMX_IMAGE_PARAM_HUFFMANTTABLETYPE; + +/** @} */ +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif +/* File EOF */ diff --git a/third_party/openmax/include/OMX_Index.h b/third_party/openmax/include/OMX_Index.h new file mode 100644 index 000000000..a1f17487d --- /dev/null +++ b/third_party/openmax/include/OMX_Index.h @@ -0,0 +1,259 @@ +/* + * Copyright (c) 2008 The Khronos Group Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject + * to the following conditions: + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +/** @file OMX_Index.h - OpenMax IL version 1.1.2 + * The OMX_Index header file contains the definitions for both applications + * and components . + */ + + +#ifndef OMX_Index_h +#define OMX_Index_h + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + +/* Each OMX header must include all required header files to allow the + * header to compile without errors. The includes below are required + * for this header file to compile successfully + */ +#include + + +/** The OMX_INDEXTYPE enumeration is used to select a structure when either + * getting or setting parameters and/or configuration data. Each entry in + * this enumeration maps to an OMX specified structure. When the + * OMX_GetParameter, OMX_SetParameter, OMX_GetConfig or OMX_SetConfig methods + * are used, the second parameter will always be an entry from this enumeration + * and the third entry will be the structure shown in the comments for the entry. + * For example, if the application is initializing a cropping function, the + * OMX_SetConfig command would have OMX_IndexConfigCommonInputCrop as the second parameter + * and would send a pointer to an initialized OMX_RECTTYPE structure as the + * third parameter. + * + * The enumeration entries named with the OMX_Config prefix are sent using + * the OMX_SetConfig command and the enumeration entries named with the + * OMX_PARAM_ prefix are sent using the OMX_SetParameter command. + */ +typedef enum OMX_INDEXTYPE { + + OMX_IndexComponentStartUnused = 0x01000000, + OMX_IndexParamPriorityMgmt, /**< reference: OMX_PRIORITYMGMTTYPE */ + OMX_IndexParamAudioInit, /**< reference: OMX_PORT_PARAM_TYPE */ + OMX_IndexParamImageInit, /**< reference: OMX_PORT_PARAM_TYPE */ + OMX_IndexParamVideoInit, /**< reference: OMX_PORT_PARAM_TYPE */ + OMX_IndexParamOtherInit, /**< reference: OMX_PORT_PARAM_TYPE */ + OMX_IndexParamNumAvailableStreams, /**< reference: OMX_PARAM_U32TYPE */ + OMX_IndexParamActiveStream, /**< reference: OMX_PARAM_U32TYPE */ + OMX_IndexParamSuspensionPolicy, /**< reference: OMX_PARAM_SUSPENSIONPOLICYTYPE */ + OMX_IndexParamComponentSuspended, /**< reference: OMX_PARAM_SUSPENSIONTYPE */ + OMX_IndexConfigCapturing, /**< reference: OMX_CONFIG_BOOLEANTYPE */ + OMX_IndexConfigCaptureMode, /**< reference: OMX_CONFIG_CAPTUREMODETYPE */ + OMX_IndexAutoPauseAfterCapture, /**< reference: OMX_CONFIG_BOOLEANTYPE */ + OMX_IndexParamContentURI, /**< reference: OMX_PARAM_CONTENTURITYPE */ + OMX_IndexParamCustomContentPipe, /**< reference: OMX_PARAM_CONTENTPIPETYPE */ + OMX_IndexParamDisableResourceConcealment, /**< reference: OMX_RESOURCECONCEALMENTTYPE */ + OMX_IndexConfigMetadataItemCount, /**< reference: OMX_CONFIG_METADATAITEMCOUNTTYPE */ + OMX_IndexConfigContainerNodeCount, /**< reference: OMX_CONFIG_CONTAINERNODECOUNTTYPE */ + OMX_IndexConfigMetadataItem, /**< reference: OMX_CONFIG_METADATAITEMTYPE */ + OMX_IndexConfigCounterNodeID, /**< reference: OMX_CONFIG_CONTAINERNODEIDTYPE */ + OMX_IndexParamMetadataFilterType, /**< reference: OMX_PARAM_METADATAFILTERTYPE */ + OMX_IndexParamMetadataKeyFilter, /**< reference: OMX_PARAM_METADATAFILTERTYPE */ + OMX_IndexConfigPriorityMgmt, /**< reference: OMX_PRIORITYMGMTTYPE */ + OMX_IndexParamStandardComponentRole, /**< reference: OMX_PARAM_COMPONENTROLETYPE */ + + OMX_IndexPortStartUnused = 0x02000000, + OMX_IndexParamPortDefinition, /**< reference: OMX_PARAM_PORTDEFINITIONTYPE */ + OMX_IndexParamCompBufferSupplier, /**< reference: OMX_PARAM_BUFFERSUPPLIERTYPE */ + OMX_IndexReservedStartUnused = 0x03000000, + + /* Audio parameters and configurations */ + OMX_IndexAudioStartUnused = 0x04000000, + OMX_IndexParamAudioPortFormat, /**< reference: OMX_AUDIO_PARAM_PORTFORMATTYPE */ + OMX_IndexParamAudioPcm, /**< reference: OMX_AUDIO_PARAM_PCMMODETYPE */ + OMX_IndexParamAudioAac, /**< reference: OMX_AUDIO_PARAM_AACPROFILETYPE */ + OMX_IndexParamAudioRa, /**< reference: OMX_AUDIO_PARAM_RATYPE */ + OMX_IndexParamAudioMp3, /**< reference: OMX_AUDIO_PARAM_MP3TYPE */ + OMX_IndexParamAudioAdpcm, /**< reference: OMX_AUDIO_PARAM_ADPCMTYPE */ + OMX_IndexParamAudioG723, /**< reference: OMX_AUDIO_PARAM_G723TYPE */ + OMX_IndexParamAudioG729, /**< reference: OMX_AUDIO_PARAM_G729TYPE */ + OMX_IndexParamAudioAmr, /**< reference: OMX_AUDIO_PARAM_AMRTYPE */ + OMX_IndexParamAudioWma, /**< reference: OMX_AUDIO_PARAM_WMATYPE */ + OMX_IndexParamAudioSbc, /**< reference: OMX_AUDIO_PARAM_SBCTYPE */ + OMX_IndexParamAudioMidi, /**< reference: OMX_AUDIO_PARAM_MIDITYPE */ + OMX_IndexParamAudioGsm_FR, /**< reference: OMX_AUDIO_PARAM_GSMFRTYPE */ + OMX_IndexParamAudioMidiLoadUserSound, /**< reference: OMX_AUDIO_PARAM_MIDILOADUSERSOUNDTYPE */ + OMX_IndexParamAudioG726, /**< reference: OMX_AUDIO_PARAM_G726TYPE */ + OMX_IndexParamAudioGsm_EFR, /**< reference: OMX_AUDIO_PARAM_GSMEFRTYPE */ + OMX_IndexParamAudioGsm_HR, /**< reference: OMX_AUDIO_PARAM_GSMHRTYPE */ + OMX_IndexParamAudioPdc_FR, /**< reference: OMX_AUDIO_PARAM_PDCFRTYPE */ + OMX_IndexParamAudioPdc_EFR, /**< reference: OMX_AUDIO_PARAM_PDCEFRTYPE */ + OMX_IndexParamAudioPdc_HR, /**< reference: OMX_AUDIO_PARAM_PDCHRTYPE */ + OMX_IndexParamAudioTdma_FR, /**< reference: OMX_AUDIO_PARAM_TDMAFRTYPE */ + OMX_IndexParamAudioTdma_EFR, /**< reference: OMX_AUDIO_PARAM_TDMAEFRTYPE */ + OMX_IndexParamAudioQcelp8, /**< reference: OMX_AUDIO_PARAM_QCELP8TYPE */ + OMX_IndexParamAudioQcelp13, /**< reference: OMX_AUDIO_PARAM_QCELP13TYPE */ + OMX_IndexParamAudioEvrc, /**< reference: OMX_AUDIO_PARAM_EVRCTYPE */ + OMX_IndexParamAudioSmv, /**< reference: OMX_AUDIO_PARAM_SMVTYPE */ + OMX_IndexParamAudioVorbis, /**< reference: OMX_AUDIO_PARAM_VORBISTYPE */ + + OMX_IndexConfigAudioMidiImmediateEvent, /**< reference: OMX_AUDIO_CONFIG_MIDIIMMEDIATEEVENTTYPE */ + OMX_IndexConfigAudioMidiControl, /**< reference: OMX_AUDIO_CONFIG_MIDICONTROLTYPE */ + OMX_IndexConfigAudioMidiSoundBankProgram, /**< reference: OMX_AUDIO_CONFIG_MIDISOUNDBANKPROGRAMTYPE */ + OMX_IndexConfigAudioMidiStatus, /**< reference: OMX_AUDIO_CONFIG_MIDISTATUSTYPE */ + OMX_IndexConfigAudioMidiMetaEvent, /**< reference: OMX_AUDIO_CONFIG_MIDIMETAEVENTTYPE */ + OMX_IndexConfigAudioMidiMetaEventData, /**< reference: OMX_AUDIO_CONFIG_MIDIMETAEVENTDATATYPE */ + OMX_IndexConfigAudioVolume, /**< reference: OMX_AUDIO_CONFIG_VOLUMETYPE */ + OMX_IndexConfigAudioBalance, /**< reference: OMX_AUDIO_CONFIG_BALANCETYPE */ + OMX_IndexConfigAudioChannelMute, /**< reference: OMX_AUDIO_CONFIG_CHANNELMUTETYPE */ + OMX_IndexConfigAudioMute, /**< reference: OMX_AUDIO_CONFIG_MUTETYPE */ + OMX_IndexConfigAudioLoudness, /**< reference: OMX_AUDIO_CONFIG_LOUDNESSTYPE */ + OMX_IndexConfigAudioEchoCancelation, /**< reference: OMX_AUDIO_CONFIG_ECHOCANCELATIONTYPE */ + OMX_IndexConfigAudioNoiseReduction, /**< reference: OMX_AUDIO_CONFIG_NOISEREDUCTIONTYPE */ + OMX_IndexConfigAudioBass, /**< reference: OMX_AUDIO_CONFIG_BASSTYPE */ + OMX_IndexConfigAudioTreble, /**< reference: OMX_AUDIO_CONFIG_TREBLETYPE */ + OMX_IndexConfigAudioStereoWidening, /**< reference: OMX_AUDIO_CONFIG_STEREOWIDENINGTYPE */ + OMX_IndexConfigAudioChorus, /**< reference: OMX_AUDIO_CONFIG_CHORUSTYPE */ + OMX_IndexConfigAudioEqualizer, /**< reference: OMX_AUDIO_CONFIG_EQUALIZERTYPE */ + OMX_IndexConfigAudioReverberation, /**< reference: OMX_AUDIO_CONFIG_REVERBERATIONTYPE */ + OMX_IndexConfigAudioChannelVolume, /**< reference: OMX_AUDIO_CONFIG_CHANNELVOLUMETYPE */ + + /* Image specific parameters and configurations */ + OMX_IndexImageStartUnused = 0x05000000, + OMX_IndexParamImagePortFormat, /**< reference: OMX_IMAGE_PARAM_PORTFORMATTYPE */ + OMX_IndexParamFlashControl, /**< reference: OMX_IMAGE_PARAM_FLASHCONTROLTYPE */ + OMX_IndexConfigFocusControl, /**< reference: OMX_IMAGE_CONFIG_FOCUSCONTROLTYPE */ + OMX_IndexParamQFactor, /**< reference: OMX_IMAGE_PARAM_QFACTORTYPE */ + OMX_IndexParamQuantizationTable, /**< reference: OMX_IMAGE_PARAM_QUANTIZATIONTABLETYPE */ + OMX_IndexParamHuffmanTable, /**< reference: OMX_IMAGE_PARAM_HUFFMANTTABLETYPE */ + OMX_IndexConfigFlashControl, /**< reference: OMX_IMAGE_PARAM_FLASHCONTROLTYPE */ + + /* Video specific parameters and configurations */ + OMX_IndexVideoStartUnused = 0x06000000, + OMX_IndexParamVideoPortFormat, /**< reference: OMX_VIDEO_PARAM_PORTFORMATTYPE */ + OMX_IndexParamVideoQuantization, /**< reference: OMX_VIDEO_PARAM_QUANTIZATIONTYPE */ + OMX_IndexParamVideoFastUpdate, /**< reference: OMX_VIDEO_PARAM_VIDEOFASTUPDATETYPE */ + OMX_IndexParamVideoBitrate, /**< reference: OMX_VIDEO_PARAM_BITRATETYPE */ + OMX_IndexParamVideoMotionVector, /**< reference: OMX_VIDEO_PARAM_MOTIONVECTORTYPE */ + OMX_IndexParamVideoIntraRefresh, /**< reference: OMX_VIDEO_PARAM_INTRAREFRESHTYPE */ + OMX_IndexParamVideoErrorCorrection, /**< reference: OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE */ + OMX_IndexParamVideoVBSMC, /**< reference: OMX_VIDEO_PARAM_VBSMCTYPE */ + OMX_IndexParamVideoMpeg2, /**< reference: OMX_VIDEO_PARAM_MPEG2TYPE */ + OMX_IndexParamVideoMpeg4, /**< reference: OMX_VIDEO_PARAM_MPEG4TYPE */ + OMX_IndexParamVideoWmv, /**< reference: OMX_VIDEO_PARAM_WMVTYPE */ + OMX_IndexParamVideoRv, /**< reference: OMX_VIDEO_PARAM_RVTYPE */ + OMX_IndexParamVideoAvc, /**< reference: OMX_VIDEO_PARAM_AVCTYPE */ + OMX_IndexParamVideoH263, /**< reference: OMX_VIDEO_PARAM_H263TYPE */ + OMX_IndexParamVideoProfileLevelQuerySupported, /**< reference: OMX_VIDEO_PARAM_PROFILELEVELTYPE */ + OMX_IndexParamVideoProfileLevelCurrent, /**< reference: OMX_VIDEO_PARAM_PROFILELEVELTYPE */ + OMX_IndexConfigVideoBitrate, /**< reference: OMX_VIDEO_CONFIG_BITRATETYPE */ + OMX_IndexConfigVideoFramerate, /**< reference: OMX_CONFIG_FRAMERATETYPE */ + OMX_IndexConfigVideoIntraVOPRefresh, /**< reference: OMX_CONFIG_INTRAREFRESHVOPTYPE */ + OMX_IndexConfigVideoIntraMBRefresh, /**< reference: OMX_CONFIG_MACROBLOCKERRORMAPTYPE */ + OMX_IndexConfigVideoMBErrorReporting, /**< reference: OMX_CONFIG_MBERRORREPORTINGTYPE */ + OMX_IndexParamVideoMacroblocksPerFrame, /**< reference: OMX_PARAM_MACROBLOCKSTYPE */ + OMX_IndexConfigVideoMacroBlockErrorMap, /**< reference: OMX_CONFIG_MACROBLOCKERRORMAPTYPE */ + OMX_IndexParamVideoSliceFMO, /**< reference: OMX_VIDEO_PARAM_AVCSLICEFMO */ + OMX_IndexConfigVideoAVCIntraPeriod, /**< reference: OMX_VIDEO_CONFIG_AVCINTRAPERIOD */ + OMX_IndexConfigVideoNalSize, /**< reference: OMX_VIDEO_CONFIG_NALSIZE */ + OMX_IndexConfigCommonDeinterlace, /**< reference: OMX_VIDEO_CONFIG_DEINTERLACE */ + + /* Image & Video common Configurations */ + OMX_IndexCommonStartUnused = 0x07000000, + OMX_IndexParamCommonDeblocking, /**< reference: OMX_PARAM_DEBLOCKINGTYPE */ + OMX_IndexParamCommonSensorMode, /**< reference: OMX_PARAM_SENSORMODETYPE */ + OMX_IndexParamCommonInterleave, /**< reference: OMX_PARAM_INTERLEAVETYPE */ + OMX_IndexConfigCommonColorFormatConversion, /**< reference: OMX_CONFIG_COLORCONVERSIONTYPE */ + OMX_IndexConfigCommonScale, /**< reference: OMX_CONFIG_SCALEFACTORTYPE */ + OMX_IndexConfigCommonImageFilter, /**< reference: OMX_CONFIG_IMAGEFILTERTYPE */ + OMX_IndexConfigCommonColorEnhancement, /**< reference: OMX_CONFIG_COLORENHANCEMENTTYPE */ + OMX_IndexConfigCommonColorKey, /**< reference: OMX_CONFIG_COLORKEYTYPE */ + OMX_IndexConfigCommonColorBlend, /**< reference: OMX_CONFIG_COLORBLENDTYPE */ + OMX_IndexConfigCommonFrameStabilisation,/**< reference: OMX_CONFIG_FRAMESTABTYPE */ + OMX_IndexConfigCommonRotate, /**< reference: OMX_CONFIG_ROTATIONTYPE */ + OMX_IndexConfigCommonMirror, /**< reference: OMX_CONFIG_MIRRORTYPE */ + OMX_IndexConfigCommonOutputPosition, /**< reference: OMX_CONFIG_POINTTYPE */ + OMX_IndexConfigCommonInputCrop, /**< reference: OMX_CONFIG_RECTTYPE */ + OMX_IndexConfigCommonOutputCrop, /**< reference: OMX_CONFIG_RECTTYPE */ + OMX_IndexConfigCommonDigitalZoom, /**< reference: OMX_CONFIG_SCALEFACTORTYPE */ + OMX_IndexConfigCommonOpticalZoom, /**< reference: OMX_CONFIG_SCALEFACTORTYPE*/ + OMX_IndexConfigCommonWhiteBalance, /**< reference: OMX_CONFIG_WHITEBALCONTROLTYPE */ + OMX_IndexConfigCommonExposure, /**< reference: OMX_CONFIG_EXPOSURECONTROLTYPE */ + OMX_IndexConfigCommonContrast, /**< reference: OMX_CONFIG_CONTRASTTYPE */ + OMX_IndexConfigCommonBrightness, /**< reference: OMX_CONFIG_BRIGHTNESSTYPE */ + OMX_IndexConfigCommonBacklight, /**< reference: OMX_CONFIG_BACKLIGHTTYPE */ + OMX_IndexConfigCommonGamma, /**< reference: OMX_CONFIG_GAMMATYPE */ + OMX_IndexConfigCommonSaturation, /**< reference: OMX_CONFIG_SATURATIONTYPE */ + OMX_IndexConfigCommonLightness, /**< reference: OMX_CONFIG_LIGHTNESSTYPE */ + OMX_IndexConfigCommonExclusionRect, /**< reference: OMX_CONFIG_RECTTYPE */ + OMX_IndexConfigCommonDithering, /**< reference: OMX_CONFIG_DITHERTYPE */ + OMX_IndexConfigCommonPlaneBlend, /**< reference: OMX_CONFIG_PLANEBLENDTYPE */ + OMX_IndexConfigCommonExposureValue, /**< reference: OMX_CONFIG_EXPOSUREVALUETYPE */ + OMX_IndexConfigCommonOutputSize, /**< reference: OMX_FRAMESIZETYPE */ + OMX_IndexParamCommonExtraQuantData, /**< reference: OMX_OTHER_EXTRADATATYPE */ + OMX_IndexConfigCommonFocusRegion, /**< reference: OMX_CONFIG_FOCUSREGIONTYPE */ + OMX_IndexConfigCommonFocusStatus, /**< reference: OMX_PARAM_FOCUSSTATUSTYPE */ + OMX_IndexConfigCommonTransitionEffect, /**< reference: OMX_CONFIG_TRANSITIONEFFECTTYPE */ + + /* Reserved Configuration range */ + OMX_IndexOtherStartUnused = 0x08000000, + OMX_IndexParamOtherPortFormat, /**< reference: OMX_OTHER_PARAM_PORTFORMATTYPE */ + OMX_IndexConfigOtherPower, /**< reference: OMX_OTHER_CONFIG_POWERTYPE */ + OMX_IndexConfigOtherStats, /**< reference: OMX_OTHER_CONFIG_STATSTYPE */ + + + /* Reserved Time range */ + OMX_IndexTimeStartUnused = 0x09000000, + OMX_IndexConfigTimeScale, /**< reference: OMX_TIME_CONFIG_SCALETYPE */ + OMX_IndexConfigTimeClockState, /**< reference: OMX_TIME_CONFIG_CLOCKSTATETYPE */ + OMX_IndexConfigTimeActiveRefClock, /**< reference: OMX_TIME_CONFIG_ACTIVEREFCLOCKTYPE */ + OMX_IndexConfigTimeCurrentMediaTime, /**< reference: OMX_TIME_CONFIG_TIMESTAMPTYPE (read only) */ + OMX_IndexConfigTimeCurrentWallTime, /**< reference: OMX_TIME_CONFIG_TIMESTAMPTYPE (read only) */ + OMX_IndexConfigTimeCurrentAudioReference, /**< reference: OMX_TIME_CONFIG_TIMESTAMPTYPE (write only) */ + OMX_IndexConfigTimeCurrentVideoReference, /**< reference: OMX_TIME_CONFIG_TIMESTAMPTYPE (write only) */ + OMX_IndexConfigTimeMediaTimeRequest, /**< reference: OMX_TIME_CONFIG_MEDIATIMEREQUESTTYPE (write only) */ + OMX_IndexConfigTimeClientStartTime, /** + + +/** Khronos standard extension indices. + +This enum lists the current Khronos extension indices to OpenMAX IL. +*/ +typedef enum OMX_INDEXEXTTYPE { + + /* Component parameters and configurations */ + OMX_IndexExtComponentStartUnused = OMX_IndexKhronosExtensions + 0x00100000, + OMX_IndexConfigCallbackRequest, /**< reference: OMX_CONFIG_CALLBACKREQUESTTYPE */ + OMX_IndexConfigCommitMode, /**< reference: OMX_CONFIG_COMMITMODETYPE */ + OMX_IndexConfigCommit, /**< reference: OMX_CONFIG_COMMITTYPE */ + + /* Port parameters and configurations */ + OMX_IndexExtPortStartUnused = OMX_IndexKhronosExtensions + 0x00200000, + + /* Audio parameters and configurations */ + OMX_IndexExtAudioStartUnused = OMX_IndexKhronosExtensions + 0x00400000, + + /* Image parameters and configurations */ + OMX_IndexExtImageStartUnused = OMX_IndexKhronosExtensions + 0x00500000, + + /* Video parameters and configurations */ + OMX_IndexExtVideoStartUnused = OMX_IndexKhronosExtensions + 0x00600000, + OMX_IndexParamNalStreamFormatSupported, /**< reference: OMX_NALSTREAMFORMATTYPE */ + OMX_IndexParamNalStreamFormat, /**< reference: OMX_NALSTREAMFORMATTYPE */ + OMX_IndexParamNalStreamFormatSelect, /**< reference: OMX_NALSTREAMFORMATTYPE */ + OMX_IndexParamVideoVp8, /**< reference: OMX_VIDEO_PARAM_VP8TYPE */ + OMX_IndexConfigVideoVp8ReferenceFrame, /**< reference: OMX_VIDEO_VP8REFERENCEFRAMETYPE */ + OMX_IndexConfigVideoVp8ReferenceFrameType, /**< reference: OMX_VIDEO_VP8REFERENCEFRAMEINFOTYPE */ + OMX_IndexParamVideoReserved, /**< Reserved for future index */ + OMX_IndexParamVideoHevc, /**< reference: OMX_VIDEO_PARAM_HEVCTYPE */ + + /* Image & Video common configurations */ + OMX_IndexExtCommonStartUnused = OMX_IndexKhronosExtensions + 0x00700000, + + /* Other configurations */ + OMX_IndexExtOtherStartUnused = OMX_IndexKhronosExtensions + 0x00800000, + OMX_IndexConfigAutoFramerateConversion, /**< reference: OMX_CONFIG_BOOLEANTYPE */ + OMX_IndexConfigPriority, /**< reference: OMX_PARAM_U32TYPE */ + OMX_IndexConfigOperatingRate, /**< reference: OMX_PARAM_U32TYPE in Q16 format for video and in Hz for audio */ + + /* Time configurations */ + OMX_IndexExtTimeStartUnused = OMX_IndexKhronosExtensions + 0x00900000, + + OMX_IndexExtMax = 0x7FFFFFFF +} OMX_INDEXEXTTYPE; + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* OMX_IndexExt_h */ +/* File EOF */ diff --git a/third_party/openmax/include/OMX_Other.h b/third_party/openmax/include/OMX_Other.h new file mode 100644 index 000000000..caf7f3844 --- /dev/null +++ b/third_party/openmax/include/OMX_Other.h @@ -0,0 +1,337 @@ +/* + * Copyright (c) 2008 The Khronos Group Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject + * to the following conditions: + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +/** @file OMX_Other.h - OpenMax IL version 1.1.2 + * The structures needed by Other components to exchange + * parameters and configuration data with the components. + */ + +#ifndef OMX_Other_h +#define OMX_Other_h + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + +/* Each OMX header must include all required header files to allow the + * header to compile without errors. The includes below are required + * for this header file to compile successfully + */ + +#include + + +/** + * Enumeration of possible data types which match to multiple domains or no + * domain at all. For types which are vendor specific, a value above + * OMX_OTHER_VENDORTSTART should be used. + */ +typedef enum OMX_OTHER_FORMATTYPE { + OMX_OTHER_FormatTime = 0, /**< Transmission of various timestamps, elapsed time, + time deltas, etc */ + OMX_OTHER_FormatPower, /**< Perhaps used for enabling/disabling power + management, setting clocks? */ + OMX_OTHER_FormatStats, /**< Could be things such as frame rate, frames + dropped, etc */ + OMX_OTHER_FormatBinary, /**< Arbitrary binary data */ + OMX_OTHER_FormatVendorReserved = 1000, /**< Starting value for vendor specific + formats */ + + OMX_OTHER_FormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_OTHER_FormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + OMX_OTHER_FormatMax = 0x7FFFFFFF +} OMX_OTHER_FORMATTYPE; + +/** + * Enumeration of seek modes. + */ +typedef enum OMX_TIME_SEEKMODETYPE { + OMX_TIME_SeekModeFast = 0, /**< Prefer seeking to an approximation + * of the requested seek position over + * the actual seek position if it + * results in a faster seek. */ + OMX_TIME_SeekModeAccurate, /**< Prefer seeking to the actual seek + * position over an approximation + * of the requested seek position even + * if it results in a slower seek. */ + OMX_TIME_SeekModeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_TIME_SeekModeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + OMX_TIME_SeekModeMax = 0x7FFFFFFF +} OMX_TIME_SEEKMODETYPE; + +/* Structure representing the seekmode of the component */ +typedef struct OMX_TIME_CONFIG_SEEKMODETYPE { + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_TIME_SEEKMODETYPE eType; /**< The seek mode */ +} OMX_TIME_CONFIG_SEEKMODETYPE; + +/** Structure representing a time stamp used with the following configs + * on the Clock Component (CC): + * + * OMX_IndexConfigTimeCurrentWallTime: query of the CCs current wall + * time + * OMX_IndexConfigTimeCurrentMediaTime: query of the CCs current media + * time + * OMX_IndexConfigTimeCurrentAudioReference and + * OMX_IndexConfigTimeCurrentVideoReference: audio/video reference + * clock sending SC its reference time + * OMX_IndexConfigTimeClientStartTime: a Clock Component client sends + * this structure to the Clock Component via a SetConfig on its + * client port when it receives a buffer with + * OMX_BUFFERFLAG_STARTTIME set. It must use the timestamp + * specified by that buffer for nStartTimestamp. + * + * Its also used with the following config on components in general: + * + * OMX_IndexConfigTimePosition: IL client querying component position + * (GetConfig) or commanding a component to seek to the given location + * (SetConfig) + */ +typedef struct OMX_TIME_CONFIG_TIMESTAMPTYPE { + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version + * information */ + OMX_U32 nPortIndex; /**< port that this structure applies to */ + OMX_TICKS nTimestamp; /**< timestamp .*/ +} OMX_TIME_CONFIG_TIMESTAMPTYPE; + +/** Enumeration of possible reference clocks to the media time. */ +typedef enum OMX_TIME_UPDATETYPE { + OMX_TIME_UpdateRequestFulfillment, /**< Update is the fulfillment of a media time request. */ + OMX_TIME_UpdateScaleChanged, /**< Update was generated because the scale chagned. */ + OMX_TIME_UpdateClockStateChanged, /**< Update was generated because the clock state changed. */ + OMX_TIME_UpdateKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_TIME_UpdateVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + OMX_TIME_UpdateMax = 0x7FFFFFFF +} OMX_TIME_UPDATETYPE; + +/** Enumeration of possible reference clocks to the media time. */ +typedef enum OMX_TIME_REFCLOCKTYPE { + OMX_TIME_RefClockNone, /**< Use no references. */ + OMX_TIME_RefClockAudio, /**< Use references sent through OMX_IndexConfigTimeCurrentAudioReference */ + OMX_TIME_RefClockVideo, /**< Use references sent through OMX_IndexConfigTimeCurrentVideoReference */ + OMX_TIME_RefClockKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_TIME_RefClockVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + OMX_TIME_RefClockMax = 0x7FFFFFFF +} OMX_TIME_REFCLOCKTYPE; + +/** Enumeration of clock states. */ +typedef enum OMX_TIME_CLOCKSTATE { + OMX_TIME_ClockStateRunning, /**< Clock running. */ + OMX_TIME_ClockStateWaitingForStartTime, /**< Clock waiting until the + * prescribed clients emit their + * start time. */ + OMX_TIME_ClockStateStopped, /**< Clock stopped. */ + OMX_TIME_ClockStateKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_TIME_ClockStateVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + OMX_TIME_ClockStateMax = 0x7FFFFFFF +} OMX_TIME_CLOCKSTATE; + +/** Structure representing a media time request to the clock component. + * + * A client component sends this structure to the Clock Component via a SetConfig + * on its client port to specify a media timestamp the Clock Component + * should emit. The Clock Component should fulfill the request by sending a + * OMX_TIME_MEDIATIMETYPE when its media clock matches the requested + * timestamp. + * + * The client may require a media time request be fulfilled slightly + * earlier than the media time specified. In this case the client specifies + * an offset which is equal to the difference between wall time corresponding + * to the requested media time and the wall time when it will be + * fulfilled. + * + * A client component may uses these requests and the OMX_TIME_MEDIATIMETYPE to + * time events according to timestamps. If a client must perform an operation O at + * a time T (e.g. deliver a video frame at its corresponding timestamp), it makes a + * media time request at T (perhaps specifying an offset to ensure the request fulfillment + * is a little early). When the clock component passes the resulting OMX_TIME_MEDIATIMETYPE + * structure back to the client component, the client may perform operation O (perhaps having + * to wait a slight amount more time itself as specified by the return values). + */ + +typedef struct OMX_TIME_CONFIG_MEDIATIMEREQUESTTYPE { + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nPortIndex; /**< port that this structure applies to */ + OMX_PTR pClientPrivate; /**< Client private data to disabiguate this media time + * from others (e.g. the number of the frame to deliver). + * Duplicated in the media time structure that fulfills + * this request. A value of zero is reserved for time scale + * updates. */ + OMX_TICKS nMediaTimestamp; /**< Media timestamp requested.*/ + OMX_TICKS nOffset; /**< Amount of wall clock time by which this + * request should be fulfilled early */ +} OMX_TIME_CONFIG_MEDIATIMEREQUESTTYPE; + +/**< Structure sent from the clock component client either when fulfilling + * a media time request or when the time scale has changed. + * + * In the former case the Clock Component fills this structure and times its emission + * to a client component (via the client port) according to the corresponding media + * time request sent by the client. The Clock Component should time the emission to occur + * when the requested timestamp matches the Clock Component's media time but also the + * prescribed offset early. + * + * Upon scale changes the clock component clears the nClientPrivate data, sends the current + * media time and sets the nScale to the new scale via the client port. It emits a + * OMX_TIME_MEDIATIMETYPE to all clients independent of any requests. This allows clients to + * alter processing to accomodate scaling. For instance a video component might skip inter-frames + * in the case of extreme fastforward. Likewise an audio component might add or remove samples + * from an audio frame to scale audio data. + * + * It is expected that some clock components may not be able to fulfill requests + * at exactly the prescribed time. This is acceptable so long as the request is + * fulfilled at least as early as described and not later. This structure provides + * fields the client may use to wait for the remaining time. + * + * The client may use either the nOffset or nWallTimeAtMedia fields to determine the + * wall time until the nMediaTimestamp actually occurs. In the latter case the + * client can get a more accurate value for offset by getting the current wall + * from the cloc component and subtracting it from nWallTimeAtMedia. + */ + +typedef struct OMX_TIME_MEDIATIMETYPE { + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nClientPrivate; /**< Client private data to disabiguate this media time + * from others. Copied from the media time request. + * A value of zero is reserved for time scale updates. */ + OMX_TIME_UPDATETYPE eUpdateType; /**< Reason for the update */ + OMX_TICKS nMediaTimestamp; /**< Media time requested. If no media time was + * requested then this is the current media time. */ + OMX_TICKS nOffset; /**< Amount of wall clock time by which this + * request was actually fulfilled early */ + + OMX_TICKS nWallTimeAtMediaTime; /**< Wall time corresponding to nMediaTimeStamp. + * A client may compare this value to current + * media time obtained from the Clock Component to determine + * the wall time until the media timestamp is really + * current. */ + OMX_S32 xScale; /**< Current media time scale in Q16 format. */ + OMX_TIME_CLOCKSTATE eState; /* Seeking Change. Added 7/12.*/ + /**< State of the media time. */ +} OMX_TIME_MEDIATIMETYPE; + +/** Structure representing the current media time scale factor. Applicable only to clock + * component, other components see scale changes via OMX_TIME_MEDIATIMETYPE buffers sent via + * the clock component client ports. Upon recieving this config the clock component changes + * the rate by which the media time increases or decreases effectively implementing trick modes. + */ +typedef struct OMX_TIME_CONFIG_SCALETYPE { + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_S32 xScale; /**< This is a value in Q16 format which is used for + * scaling the media time */ +} OMX_TIME_CONFIG_SCALETYPE; + +/** Bits used to identify a clock port. Used in OMX_TIME_CONFIG_CLOCKSTATETYPEs nWaitMask field */ +#define OMX_CLOCKPORT0 0x00000001 +#define OMX_CLOCKPORT1 0x00000002 +#define OMX_CLOCKPORT2 0x00000004 +#define OMX_CLOCKPORT3 0x00000008 +#define OMX_CLOCKPORT4 0x00000010 +#define OMX_CLOCKPORT5 0x00000020 +#define OMX_CLOCKPORT6 0x00000040 +#define OMX_CLOCKPORT7 0x00000080 + +/** Structure representing the current mode of the media clock. + * IL Client uses this config to change or query the mode of the + * media clock of the clock component. Applicable only to clock + * component. + * + * On a SetConfig if eState is OMX_TIME_ClockStateRunning media time + * starts immediately at the prescribed start time. If + * OMX_TIME_ClockStateWaitingForStartTime the Clock Component ignores + * the given nStartTime and waits for all clients specified in the + * nWaitMask to send starttimes (via + * OMX_IndexConfigTimeClientStartTime). The Clock Component then starts + * the media clock using the earliest start time supplied. */ +typedef struct OMX_TIME_CONFIG_CLOCKSTATETYPE { + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version + * information */ + OMX_TIME_CLOCKSTATE eState; /**< State of the media time. */ + OMX_TICKS nStartTime; /**< Start time of the media time. */ + OMX_TICKS nOffset; /**< Time to offset the media time by + * (e.g. preroll). Media time will be + * reported to be nOffset ticks earlier. + */ + OMX_U32 nWaitMask; /**< Mask of OMX_CLOCKPORT values. */ +} OMX_TIME_CONFIG_CLOCKSTATETYPE; + +/** Structure representing the reference clock currently being used to + * compute media time. IL client uses this config to change or query the + * clock component's active reference clock */ +typedef struct OMX_TIME_CONFIG_ACTIVEREFCLOCKTYPE { + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_TIME_REFCLOCKTYPE eClock; /**< Reference clock used to compute media time */ +} OMX_TIME_CONFIG_ACTIVEREFCLOCKTYPE; + +/** Descriptor for setting specifics of power type. + * Note: this structure is listed for backwards compatibility. */ +typedef struct OMX_OTHER_CONFIG_POWERTYPE { + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_BOOL bEnablePM; /**< Flag to enable Power Management */ +} OMX_OTHER_CONFIG_POWERTYPE; + + +/** Descriptor for setting specifics of stats type. + * Note: this structure is listed for backwards compatibility. */ +typedef struct OMX_OTHER_CONFIG_STATSTYPE { + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + /* what goes here */ +} OMX_OTHER_CONFIG_STATSTYPE; + + +/** + * The PortDefinition structure is used to define all of the parameters + * necessary for the compliant component to setup an input or an output other + * path. + */ +typedef struct OMX_OTHER_PORTDEFINITIONTYPE { + OMX_OTHER_FORMATTYPE eFormat; /**< Type of data expected for this channel */ +} OMX_OTHER_PORTDEFINITIONTYPE; + +/** Port format parameter. This structure is used to enumerate + * the various data input/output format supported by the port. + */ +typedef struct OMX_OTHER_PARAM_PORTFORMATTYPE { + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nPortIndex; /**< Indicates which port to set */ + OMX_U32 nIndex; /**< Indicates the enumeration index for the format from 0x0 to N-1 */ + OMX_OTHER_FORMATTYPE eFormat; /**< Type of data expected for this channel */ +} OMX_OTHER_PARAM_PORTFORMATTYPE; + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif +/* File EOF */ diff --git a/third_party/openmax/include/OMX_QCOMExtns.h b/third_party/openmax/include/OMX_QCOMExtns.h new file mode 100644 index 000000000..20917932b --- /dev/null +++ b/third_party/openmax/include/OMX_QCOMExtns.h @@ -0,0 +1,1888 @@ +/*-------------------------------------------------------------------------- +Copyright (c) 2009-2015, The Linux Foundation. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of The Linux Foundation nor + the names of its contributors may be used to endorse or promote + products derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +--------------------------------------------------------------------------*/ +#ifndef __OMX_QCOM_EXTENSIONS_H__ +#define __OMX_QCOM_EXTENSIONS_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/*============================================================================ +*//** @file OMX_QCOMExtns.h + This header contains constants and type definitions that specify the + extensions added to the OpenMAX Vendor specific APIs. + +*//*========================================================================*/ + + +/////////////////////////////////////////////////////////////////////////////// +// Include Files +/////////////////////////////////////////////////////////////////////////////// +#include "OMX_Core.h" +#include "OMX_Video.h" + +#define OMX_VIDEO_MAX_HP_LAYERS 6 +/** + * This extension is used to register mapping of a virtual + * address to a physical address. This extension is a parameter + * which can be set using the OMX_SetParameter macro. The data + * pointer corresponding to this extension is + * OMX_QCOM_MemMapEntry. This parameter is a 'write only' + * parameter (Current value cannot be queried using + * OMX_GetParameter macro). + */ +#define OMX_QCOM_EXTN_REGISTER_MMAP "OMX.QCOM.index.param.register_mmap" + +/** + * This structure describes the data pointer corresponding to + * the OMX_QCOM_MMAP_REGISTER_EXTN extension. This parameter + * must be set only 'after' populating a port with a buffer + * using OMX_UseBuffer, wherein the data pointer of the buffer + * corresponds to the virtual address as specified in this + * structure. + */ +struct OMX_QCOM_PARAM_MEMMAPENTRYTYPE +{ + OMX_U32 nSize; /** Size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nPortIndex; /**< Port number the structure applies to */ + + /** + * The virtual address of memory block + */ + OMX_U64 nVirtualAddress; + + /** + * The physical address corresponding to the virtual address. The physical + * address is contiguous for the entire valid range of the virtual + * address. + */ + OMX_U64 nPhysicalAddress; +}; + +#define QOMX_VIDEO_IntraRefreshRandom (OMX_VIDEO_IntraRefreshVendorStartUnused + 0) + +/* This error event is used for H.264 long-term reference (LTR) encoding. + * When IL client specifies an LTR frame with its identifier via + * OMX_QCOM_INDEX_CONFIG_VIDEO_LTRUSE to the encoder, if the specified + * LTR frame can not be located by the encoder in its LTR list, the encoder + * issues this error event to IL client to notify the failure of LTRUse config. + */ +#define QOMX_ErrorLTRUseFailed (OMX_ErrorVendorStartUnused + 1) + +#define QOMX_VIDEO_BUFFERFLAG_BFRAME 0x00100000 + +#define QOMX_VIDEO_BUFFERFLAG_EOSEQ 0x00200000 + +#define QOMX_VIDEO_BUFFERFLAG_MBAFF 0x00400000 + +#define QOMX_VIDEO_BUFFERFLAG_CANCEL 0x00800000 + +#define OMX_QCOM_PORTDEFN_EXTN "OMX.QCOM.index.param.portdefn" +/* Allowed APIs on the above Index: OMX_GetParameter() and OMX_SetParameter() */ + +typedef enum OMX_QCOMMemoryRegion +{ + OMX_QCOM_MemRegionInvalid, + OMX_QCOM_MemRegionEBI1, + OMX_QCOM_MemRegionSMI, + OMX_QCOM_MemRegionMax = 0X7FFFFFFF +} OMX_QCOMMemoryRegion; + +typedef enum OMX_QCOMCacheAttr +{ + OMX_QCOM_CacheAttrNone, + OMX_QCOM_CacheAttrWriteBack, + OMX_QCOM_CacheAttrWriteThrough, + OMX_QCOM_CacheAttrMAX = 0X7FFFFFFF +} OMX_QCOMCacheAttr; + +typedef struct OMX_QCOMRectangle +{ + OMX_S32 x; + OMX_S32 y; + OMX_S32 dx; + OMX_S32 dy; +} OMX_QCOMRectangle; + +/** OMX_QCOMFramePackingFormat + * Input or output buffer format + */ +typedef enum OMX_QCOMFramePackingFormat +{ + /* 0 - unspecified + */ + OMX_QCOM_FramePacking_Unspecified, + + /* 1 - Partial frames may be present OMX IL 1.1.1 Figure 2-10: + * Case 1??Each Buffer Filled In Whole or In Part + */ + OMX_QCOM_FramePacking_Arbitrary, + + /* 2 - Multiple complete frames per buffer (integer number) + * OMX IL 1.1.1 Figure 2-11: Case 2Each Buffer Filled with + * Only Complete Frames of Data + */ + OMX_QCOM_FramePacking_CompleteFrames, + + /* 3 - Only one complete frame per buffer, no partial frame + * OMX IL 1.1.1 Figure 2-12: Case 3Each Buffer Filled with + * Only One Frame of Compressed Data. Usually at least one + * complete unit of data will be delivered in a buffer for + * uncompressed data formats. + */ + OMX_QCOM_FramePacking_OnlyOneCompleteFrame, + + /* 4 - Only one complete subframe per buffer, no partial subframe + * Example: In H264, one complete NAL per buffer, where one frame + * can contatin multiple NAL + */ + OMX_QCOM_FramePacking_OnlyOneCompleteSubFrame, + + OMX_QCOM_FramePacking_MAX = 0X7FFFFFFF +} OMX_QCOMFramePackingFormat; + +typedef struct OMX_QCOM_PARAM_PORTDEFINITIONTYPE { + OMX_U32 nSize; /** Size of the structure in bytes */ + OMX_VERSIONTYPE nVersion;/** OMX specification version information */ + OMX_U32 nPortIndex; /** Portindex which is extended by this structure */ + + /** Platform specific memory region EBI1, SMI, etc.,*/ + OMX_QCOMMemoryRegion nMemRegion; + + OMX_QCOMCacheAttr nCacheAttr; /** Cache attributes */ + + /** Input or output buffer format */ + OMX_U32 nFramePackingFormat; + +} OMX_QCOM_PARAM_PORTDEFINITIONTYPE; + +typedef struct OMX_QCOM_VIDEO_PARAM_QPRANGETYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_U32 minQP; + OMX_U32 maxQP; +} OMX_QCOM_VIDEO_PARAM_QPRANGETYPE; + +#define OMX_QCOM_PLATFORMPVT_EXTN "OMX.QCOM.index.param.platformprivate" +/** Allowed APIs on the above Index: OMX_SetParameter() */ + +typedef enum OMX_QCOM_PLATFORM_PRIVATE_ENTRY_TYPE +{ + /** Enum for PMEM information */ + OMX_QCOM_PLATFORM_PRIVATE_PMEM = 0x1 +} OMX_QCOM_PLATFORM_PRIVATE_ENTRY_TYPE; + +/** IL client will set the following structure. A failure + * code will be returned if component does not support the + * value provided for 'type'. + */ +struct OMX_QCOM_PLATFORMPRIVATE_EXTN +{ + OMX_U32 nSize; /** Size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /** OMX spec version information */ + OMX_U32 nPortIndex; /** Port number on which usebuffer extn is applied */ + + /** Type of extensions should match an entry from + OMX_QCOM_PLATFORM_PRIVATE_ENTRY_TYPE + */ + OMX_QCOM_PLATFORM_PRIVATE_ENTRY_TYPE type; +}; + +typedef struct OMX_QCOM_PLATFORM_PRIVATE_PMEM_INFO +{ + /** pmem file descriptor */ + unsigned long pmem_fd; + /** Offset from pmem device base address */ + OMX_U32 offset; + OMX_U32 size; + OMX_U32 mapped_size; + OMX_PTR buffer; +}OMX_QCOM_PLATFORM_PRIVATE_PMEM_INFO; + +typedef struct OMX_QCOM_PLATFORM_PRIVATE_ENTRY +{ + /** Entry type */ + OMX_QCOM_PLATFORM_PRIVATE_ENTRY_TYPE type; + + /** Pointer to platform specific entry */ + OMX_PTR entry; +}OMX_QCOM_PLATFORM_PRIVATE_ENTRY; + +typedef struct OMX_QCOM_PLATFORM_PRIVATE_LIST +{ + /** Number of entries */ + OMX_U32 nEntries; + + /** Pointer to array of platform specific entries * + * Contiguous block of OMX_QCOM_PLATFORM_PRIVATE_ENTRY element + */ + OMX_QCOM_PLATFORM_PRIVATE_ENTRY* entryList; +}OMX_QCOM_PLATFORM_PRIVATE_LIST; + +#define OMX_QCOM_FRAME_PACKING_FORMAT "OMX.QCOM.index.param.framepackfmt" +/* Allowed API call: OMX_GetParameter() */ +/* IL client can use this index to rerieve the list of frame formats * + * supported by the component */ + +typedef struct OMX_QCOM_FRAME_PACKINGFORMAT_TYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_U32 nIndex; + OMX_QCOMFramePackingFormat eframePackingFormat; +} OMX_QCOM_FRAME_PACKINGFORMAT_TYPE; + + +/** + * Following is the enum for color formats supported on Qualcomm + * MSMs YVU420SemiPlanar color format is not defined in OpenMAX + * 1.1.1 and prior versions of OpenMAX specification. + */ + +enum OMX_QCOM_COLOR_FORMATTYPE +{ + +/** YVU420SemiPlanar: YVU planar format, organized with a first + * plane containing Y pixels, and a second plane containing + * interleaved V and U pixels. V and U pixels are sub-sampled + * by a factor of two both horizontally and vertically. + */ + QOMX_COLOR_FormatYVU420SemiPlanar = 0x7FA30C00, + QOMX_COLOR_FormatYVU420PackedSemiPlanar32m4ka, + QOMX_COLOR_FormatYUV420PackedSemiPlanar16m2ka, + QOMX_COLOR_FormatYUV420PackedSemiPlanar64x32Tile2m8ka, + QOMX_COLOR_FORMATYUV420PackedSemiPlanar32m, + QOMX_COLOR_FORMATYUV420PackedSemiPlanar32mMultiView, + QOMX_COLOR_FORMATYUV420PackedSemiPlanar32mCompressed, + QOMX_COLOR_Format32bitRGBA8888, + QOMX_COLOR_Format32bitRGBA8888Compressed, + QOMX_COLOR_FormatAndroidOpaque = (OMX_COLOR_FORMATTYPE) OMX_COLOR_FormatVendorStartUnused + 0x789, +}; + +enum OMX_QCOM_VIDEO_CODINGTYPE +{ +/** Codecs support by qualcomm which are not listed in OMX 1.1.x + * spec + * */ + OMX_QCOM_VIDEO_CodingVC1 = 0x7FA30C00 , + OMX_QCOM_VIDEO_CodingWMV9 = 0x7FA30C01, + QOMX_VIDEO_CodingDivx = 0x7FA30C02, /**< Value when coding is Divx */ + QOMX_VIDEO_CodingSpark = 0x7FA30C03, /**< Value when coding is Sorenson Spark */ + QOMX_VIDEO_CodingVp = 0x7FA30C04, + QOMX_VIDEO_CodingVp8 = OMX_VIDEO_CodingVP8, /**< keeping old enum for backwards compatibility*/ + QOMX_VIDEO_CodingHevc = OMX_VIDEO_CodingHEVC, /**< keeping old enum for backwards compatibility*/ + QOMX_VIDEO_CodingMVC = 0x7FA30C07, + QOMX_VIDEO_CodingVp9 = OMX_VIDEO_CodingVP9, /**< keeping old enum for backwards compatibility*/ +}; + +enum OMX_QCOM_EXTN_INDEXTYPE +{ + /** Qcom proprietary extension index list */ + + /* "OMX.QCOM.index.param.register_mmap" */ + OMX_QcomIndexRegmmap = 0x7F000000, + + /* "OMX.QCOM.index.param.platformprivate" */ + OMX_QcomIndexPlatformPvt = 0x7F000001, + + /* "OMX.QCOM.index.param.portdefn" */ + OMX_QcomIndexPortDefn = 0x7F000002, + + /* "OMX.QCOM.index.param.framepackingformat" */ + OMX_QcomIndexPortFramePackFmt = 0x7F000003, + + /*"OMX.QCOM.index.param.Interlaced */ + OMX_QcomIndexParamInterlaced = 0x7F000004, + + /*"OMX.QCOM.index.config.interlaceformat */ + OMX_QcomIndexConfigInterlaced = 0x7F000005, + + /*"OMX.QCOM.index.param.syntaxhdr" */ + QOMX_IndexParamVideoSyntaxHdr = 0x7F000006, + + /*"OMX.QCOM.index.config.intraperiod" */ + QOMX_IndexConfigVideoIntraperiod = 0x7F000007, + + /*"OMX.QCOM.index.config.randomIntrarefresh" */ + QOMX_IndexConfigVideoIntraRefresh = 0x7F000008, + + /*"OMX.QCOM.index.config.video.TemporalSpatialTradeOff" */ + QOMX_IndexConfigVideoTemporalSpatialTradeOff = 0x7F000009, + + /*"OMX.QCOM.index.param.video.EncoderMode" */ + QOMX_IndexParamVideoEncoderMode = 0x7F00000A, + + /*"OMX.QCOM.index.param.Divxtype */ + OMX_QcomIndexParamVideoDivx = 0x7F00000B, + + /*"OMX.QCOM.index.param.Sparktype */ + OMX_QcomIndexParamVideoSpark = 0x7F00000C, + + /*"OMX.QCOM.index.param.Vptype */ + OMX_QcomIndexParamVideoVp = 0x7F00000D, + + OMX_QcomIndexQueryNumberOfVideoDecInstance = 0x7F00000E, + + OMX_QcomIndexParamVideoSyncFrameDecodingMode = 0x7F00000F, + + OMX_QcomIndexParamVideoDecoderPictureOrder = 0x7F000010, + + /* "OMX.QCOM.index.config.video.FramePackingInfo" */ + OMX_QcomIndexConfigVideoFramePackingArrangement = 0x7F000011, + + OMX_QcomIndexParamConcealMBMapExtraData = 0x7F000012, + + OMX_QcomIndexParamFrameInfoExtraData = 0x7F000013, + + OMX_QcomIndexParamInterlaceExtraData = 0x7F000014, + + OMX_QcomIndexParamH264TimeInfo = 0x7F000015, + + OMX_QcomIndexParamIndexExtraDataType = 0x7F000016, + + OMX_GoogleAndroidIndexEnableAndroidNativeBuffers = 0x7F000017, + + OMX_GoogleAndroidIndexUseAndroidNativeBuffer = 0x7F000018, + + OMX_GoogleAndroidIndexGetAndroidNativeBufferUsage = 0x7F000019, + + /*"OMX.QCOM.index.config.video.QPRange" */ + OMX_QcomIndexConfigVideoQPRange = 0x7F00001A, + + /*"OMX.QCOM.index.param.EnableTimeStampReoder"*/ + OMX_QcomIndexParamEnableTimeStampReorder = 0x7F00001B, + + /*"OMX.google.android.index.storeMetaDataInBuffers"*/ + OMX_QcomIndexParamVideoMetaBufferMode = 0x7F00001C, + + /*"OMX.google.android.index.useAndroidNativeBuffer2"*/ + OMX_GoogleAndroidIndexUseAndroidNativeBuffer2 = 0x7F00001D, + + /*"OMX.QCOM.index.param.VideoMaxAllowedBitrateCheck"*/ + OMX_QcomIndexParamVideoMaxAllowedBitrateCheck = 0x7F00001E, + + OMX_QcomIndexEnableSliceDeliveryMode = 0x7F00001F, + + /* "OMX.QCOM.index.param.video.ExtnUserExtraData" */ + OMX_QcomIndexEnableExtnUserData = 0x7F000020, + + /*"OMX.QCOM.index.param.video.EnableSmoothStreaming"*/ + OMX_QcomIndexParamEnableSmoothStreaming = 0x7F000021, + + /*"OMX.QCOM.index.param.video.QPRange" */ + OMX_QcomIndexParamVideoQPRange = 0x7F000022, + + OMX_QcomIndexEnableH263PlusPType = 0x7F000023, + + /*"OMX.QCOM.index.param.video.LTRCountRangeSupported"*/ + QOMX_IndexParamVideoLTRCountRangeSupported = 0x7F000024, + + /*"OMX.QCOM.index.param.video.LTRMode"*/ + QOMX_IndexParamVideoLTRMode = 0x7F000025, + + /*"OMX.QCOM.index.param.video.LTRCount"*/ + QOMX_IndexParamVideoLTRCount = 0x7F000026, + + /*"OMX.QCOM.index.config.video.LTRPeriod"*/ + QOMX_IndexConfigVideoLTRPeriod = 0x7F000027, + + /*"OMX.QCOM.index.config.video.LTRUse"*/ + QOMX_IndexConfigVideoLTRUse = 0x7F000028, + + /*"OMX.QCOM.index.config.video.LTRMark"*/ + QOMX_IndexConfigVideoLTRMark = 0x7F000029, + + /* OMX.google.android.index.prependSPSPPSToIDRFrames */ + OMX_QcomIndexParamSequenceHeaderWithIDR = 0x7F00002A, + + OMX_QcomIndexParamH264AUDelimiter = 0x7F00002B, + + OMX_QcomIndexParamVideoDownScalar = 0x7F00002C, + + /* "OMX.QCOM.index.param.video.FramePackingExtradata" */ + OMX_QcomIndexParamVideoFramePackingExtradata = 0x7F00002D, + + /* "OMX.QCOM.index.config.activeregiondetection" */ + OMX_QcomIndexConfigActiveRegionDetection = 0x7F00002E, + + /* "OMX.QCOM.index.config.activeregiondetectionstatus" */ + OMX_QcomIndexConfigActiveRegionDetectionStatus = 0x7F00002F, + + /* "OMX.QCOM.index.config.scalingmode" */ + OMX_QcomIndexConfigScalingMode = 0x7F000030, + + /* "OMX.QCOM.index.config.noisereduction" */ + OMX_QcomIndexConfigNoiseReduction = 0x7F000031, + + /* "OMX.QCOM.index.config.imageenhancement" */ + OMX_QcomIndexConfigImageEnhancement = 0x7F000032, + + /* google smooth-streaming support */ + OMX_QcomIndexParamVideoAdaptivePlaybackMode = 0x7F000033, + + /* H.264 MVC codec index */ + QOMX_IndexParamVideoMvc = 0x7F000034, + + /* "OMX.QCOM.index.param.video.QPExtradata" */ + OMX_QcomIndexParamVideoQPExtraData = 0x7F000035, + + /* "OMX.QCOM.index.param.video.InputBitsInfoExtradata" */ + OMX_QcomIndexParamVideoInputBitsInfoExtraData = 0x7F000036, + + /* VP8 Hierarchical P support */ + OMX_QcomIndexHierarchicalStructure = 0x7F000037, + + OMX_QcomIndexParamPerfLevel = 0x7F000038, + + OMX_QcomIndexParamH264VUITimingInfo = 0x7F000039, + + OMX_QcomIndexParamPeakBitrate = 0x7F00003A, + + /* Enable InitialQP index */ + QOMX_IndexParamVideoInitialQp = 0x7F00003B, + + OMX_QcomIndexParamSetMVSearchrange = 0x7F00003C, + + OMX_QcomIndexConfigPerfLevel = 0x7F00003D, + + /*"OMX.QCOM.index.param.video.LTRCount"*/ + OMX_QcomIndexParamVideoLTRCount = QOMX_IndexParamVideoLTRCount, + + /*"OMX.QCOM.index.config.video.LTRUse"*/ + OMX_QcomIndexConfigVideoLTRUse = QOMX_IndexConfigVideoLTRUse, + + /*"OMX.QCOM.index.config.video.LTRMark"*/ + OMX_QcomIndexConfigVideoLTRMark = QOMX_IndexConfigVideoLTRMark, + + /*"OMX.QCOM.index.param.video.CustomBufferSize"*/ + OMX_QcomIndexParamVideoCustomBufferSize = 0x7F00003E, + + /* Max Hierarchical P layers */ + OMX_QcomIndexMaxHierarchicallayers = 0x7F000041, + + /* Set Encoder Performance Index */ + OMX_QcomIndexConfigVideoVencPerfMode = 0x7F000042, + + /* Set Hybrid Hier-p layers */ + OMX_QcomIndexParamVideoHybridHierpMode = 0x7F000043, + + OMX_QcomIndexFlexibleYUVDescription = 0x7F000044, + + /* Vpp Hqv Control Type */ + OMX_QcomIndexParamVppHqvControl = 0x7F000045, + + /* Enable VPP */ + OMX_QcomIndexParamEnableVpp = 0x7F000046, + + /* MBI statistics mode */ + OMX_QcomIndexParamMBIStatisticsMode = 0x7F000047, + + /* Set PictureTypeDecode */ + OMX_QcomIndexConfigPictureTypeDecode = 0x7F000048, + + OMX_QcomIndexConfigH264EntropyCodingCabac = 0x7F000049, + + /* "OMX.QCOM.index.param.video.InputBatch" */ + OMX_QcomIndexParamBatchSize = 0x7F00004A, + + OMX_QcomIndexConfigNumHierPLayers = 0x7F00004B, + + OMX_QcomIndexConfigRectType = 0x7F00004C, + + OMX_QcomIndexConfigBaseLayerId = 0x7F00004E, + + OMX_QcomIndexParamDriverVersion = 0x7F00004F, + + OMX_QcomIndexConfigQp = 0x7F000050, + + OMX_QcomIndexParamVencAspectRatio = 0x7F000051, + + OMX_QTIIndexParamVQZipSEIExtraData = 0x7F000052, + + /* Enable VQZIP SEI NAL type */ + OMX_QTIIndexParamVQZIPSEIType = 0x7F000053, + + OMX_QTIIndexParamPassInputBufferFd = 0x7F000054, + + /* Set Prefer-adaptive playback*/ + /* "OMX.QTI.index.param.video.PreferAdaptivePlayback" */ + OMX_QTIIndexParamVideoPreferAdaptivePlayback = 0x7F000055, + + /* Set time params */ + OMX_QTIIndexConfigSetTimeData = 0x7F000056, + /* Force Compressed format for DPB when resolution <=1080p + * and OPB is cpu_access */ + /* OMX.QTI.index.param.video.ForceCompressedForDPB */ + OMX_QTIIndexParamForceCompressedForDPB = 0x7F000057, + + /* Enable ROI info */ + OMX_QTIIndexParamVideoEnableRoiInfo = 0x7F000058, + + /* Configure ROI info */ + OMX_QTIIndexConfigVideoRoiInfo = 0x7F000059, + + /* Set Low Latency Mode */ + OMX_QTIIndexParamLowLatencyMode = 0x7F00005A, + + /* Force OPB to UnCompressed mode */ + OMX_QTIIndexParamForceUnCompressedForOPB = 0x7F00005B, + +}; + +/** +* This is custom extension to configure Low Latency Mode. +* +* STRUCT MEMBERS +* +* nSize : Size of Structure in bytes +* nVersion : OpenMAX IL specification version information +* bLowLatencyMode : Enable/Disable Low Latency mode +*/ + +typedef struct QOMX_EXTNINDEX_VIDEO_VENC_LOW_LATENCY_MODE +{ + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_BOOL bLowLatencyMode; +} QOMX_EXTNINDEX_VIDEO_VENC_LOW_LATENCY_MODE; + +/** +* This is custom extension to configure Encoder Aspect Ratio. +* +* STRUCT MEMBERS +* +* nSize : Size of Structure in bytes +* nVersion : OpenMAX IL specification version information +* nSARWidth : Horizontal aspect size +* nSARHeight : Vertical aspect size +*/ + +typedef struct QOMX_EXTNINDEX_VIDEO_VENC_SAR +{ + OMX_U32 nSize; + OMX_U32 nVersion; + OMX_U32 nSARWidth; + OMX_U32 nSARHeight; +} QOMX_EXTNINDEX_VIDEO_VENC_SAR; + +/** +* This is custom extension to configure Hier-p layers. +* This mode configures Hier-p layers dynamically. +* +* STRUCT MEMBERS +* +* nSize : Size of Structure in bytes +* nVersion : OpenMAX IL specification version information +* nNumHierLayers: Set the number of Hier-p layers for the session +* - This should be less than the MAX Hier-P +* layers set for the session. +*/ + +typedef struct QOMX_EXTNINDEX_VIDEO_HIER_P_LAYERS { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nNumHierLayers; +} QOMX_EXTNINDEX_VIDEO_HIER_P_LAYERS; + + +/** +* This is custom extension to configure Hybrid Hier-p settings. +* This mode is different from enabling Hier-p mode. This +* property enables Hier-p encoding with LTR referencing in each +* sub-GOP. +* +* STRUCT MEMBERS +* +* nSize : Size of Structure in bytes +* nVersion : OpenMAX IL specification version information +* nKeyFrameInterval : Indicates the I frame interval +* nHpLayers : Set the number of Hier-p layers for the session +* - This should be <= 6. (1 Base layer + +* 5 Enhancement layers) +* nTemporalLayerBitrateRatio[OMX_VIDEO_MAX_HP_LAYERS] : Bitrate to +* be set for each enhancement layer +* nMinQuantizer : minimum session QP +* nMaxQuantizer : Maximun session QP +*/ + +typedef struct QOMX_EXTNINDEX_VIDEO_HYBRID_HP_MODE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nKeyFrameInterval; + OMX_U32 nTemporalLayerBitrateRatio[OMX_VIDEO_MAX_HP_LAYERS]; + OMX_U32 nMinQuantizer; + OMX_U32 nMaxQuantizer; + OMX_U32 nHpLayers; +} QOMX_EXTNINDEX_VIDEO_HYBRID_HP_MODE; + +/** + * Encoder Performance Mode. This structure is used to set + * performance mode or power save mode when encoding. The search + * range is modified to save power or improve quality. + * + * STRUCT MEMBERS: + * OMX_U32 nPerfMode : Performance mode: + * 1: MAX_QUALITY + * 2: POWER_SAVE + */ + +typedef struct QOMX_EXTNINDEX_VIDEO_PERFMODE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPerfMode; +} QOMX_EXTNINDEX_VIDEO_PERFMODE; + +/** + * Initial QP parameter. This structure is used to enable + * vendor specific extension to let client enable setting + * initial QP values to I P B Frames + * + * STRUCT MEMBERS: + * nSize : Size of Structure in bytes + * nVersion : OpenMAX IL specification version information + * nPortIndex : Index of the port to which this structure applies + * OMX_U32 nQpI : First Iframe QP + * OMX_U32 nQpP : First Pframe QP + * OMX_U32 nQpB : First Bframe QP + * OMX_U32 bEnableInitQp : Bit field indicating which frame type(s) shall + * use the specified initial QP. + * Bit 0: Enable initial QP for I/IDR + * and use value specified in nInitQpI + * Bit 1: Enable initial QP for P + * and use value specified in nInitQpP + * Bit 2: Enable initial QP for B + * and use value specified in nInitQpB + */ + +typedef struct QOMX_EXTNINDEX_VIDEO_INITIALQP { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_U32 nQpI; + OMX_U32 nQpP; + OMX_U32 nQpB; + OMX_U32 bEnableInitQp; +} QOMX_EXTNINDEX_VIDEO_INITIALQP; + +/** + * Extension index parameter. This structure is used to enable + * vendor specific extension on input/output port and + * to pass the required flags and data, if any. + * The format of flags and data being passed is known to + * the client and component apriori. + * + * STRUCT MEMBERS: + * nSize : Size of Structure plus pData size + * nVersion : OMX specification version information + * nPortIndex : Indicates which port to set + * bEnable : Extension index enable (1) or disable (0) + * nFlags : Extension index flags, if any + * nDataSize : Size of the extension index data to follow + * pData : Extension index data, if present. + */ +typedef struct QOMX_EXTNINDEX_PARAMTYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_BOOL bEnable; + OMX_U32 nFlags; + OMX_U32 nDataSize; + OMX_PTR pData; +} QOMX_EXTNINDEX_PARAMTYPE; + +/** + * Range index parameter. This structure is used to enable + * vendor specific extension on input/output port and + * to pass the required minimum and maximum values + * + * STRUCT MEMBERS: + * nSize : Size of Structure in bytes + * nVersion : OpenMAX IL specification version information + * nPortIndex : Index of the port to which this structure applies + * nMin : Minimum value + * nMax : Maximum value + * nSteSize : Step size + */ +typedef struct QOMX_EXTNINDEX_RANGETYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_S32 nMin; + OMX_S32 nMax; + OMX_S32 nStepSize; +} QOMX_EXTNINDEX_RANGETYPE; + +/** + * Specifies LTR mode types. + */ +typedef enum QOMX_VIDEO_LTRMODETYPE +{ + QOMX_VIDEO_LTRMode_Disable = 0x0, /**< LTR encoding is disabled */ + QOMX_VIDEO_LTRMode_Manual = 0x1, /**< In this mode, IL client configures + ** the encoder the LTR count and manually + ** controls the marking and use of LTR + ** frames during video encoding. + */ + QOMX_VIDEO_LTRMode_Auto = 0x2, /**< In this mode, IL client configures + ** the encoder the LTR count and LTR + ** period. The encoder marks LTR frames + ** automatically based on the LTR period + ** during video encoding. IL client controls + ** the use of LTR frames. + */ + QOMX_VIDEO_LTRMode_MAX = 0x7FFFFFFF /** Maximum LTR Mode type */ +} QOMX_VIDEO_LTRMODETYPE; + +/** + * LTR mode index parameter. This structure is used + * to enable vendor specific extension on output port + * to pass the LTR mode information. + * + * STRUCT MEMBERS: + * nSize : Size of Structure in bytes + * nVersion : OpenMAX IL specification version information + * nPortIndex : Index of the port to which this structure applies + * eLTRMode : Specifies the LTR mode used in encoder + */ +typedef struct QOMX_VIDEO_PARAM_LTRMODE_TYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + QOMX_VIDEO_LTRMODETYPE eLTRMode; +} QOMX_VIDEO_PARAM_LTRMODE_TYPE; + +/** + * LTR count index parameter. This structure is used + * to enable vendor specific extension on output port + * to pass the LTR count information. + * + * STRUCT MEMBERS: + * nSize : Size of Structure in bytes + * nVersion : OpenMAX IL specification version information + * nPortIndex : Index of the port to which this structure applies + * nCount : Specifies the number of LTR frames stored in the + * encoder component + */ +typedef struct QOMX_VIDEO_PARAM_LTRCOUNT_TYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_U32 nCount; +} QOMX_VIDEO_PARAM_LTRCOUNT_TYPE; + + +/** + * This should be used with OMX_QcomIndexParamVideoLTRCount extension. + */ +typedef QOMX_VIDEO_PARAM_LTRCOUNT_TYPE OMX_QCOM_VIDEO_PARAM_LTRCOUNT_TYPE; + +/** + * LTR period index parameter. This structure is used + * to enable vendor specific extension on output port + * to pass the LTR period information. + * + * STRUCT MEMBERS: + * nSize : Size of Structure in bytes + * nVersion : OpenMAX IL specification version information + * nPortIndex : Index of the port to which this structure applies + * nFrames : Specifies the number of frames between two consecutive + * LTR frames. + */ +typedef struct QOMX_VIDEO_CONFIG_LTRPERIOD_TYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_U32 nFrames; +} QOMX_VIDEO_CONFIG_LTRPERIOD_TYPE; + +/** + * Marks the next encoded frame as an LTR frame. + * STRUCT MEMBERS: + * nSize : Size of Structure in bytes + * nVersion : OpenMAX IL specification version information + * nPortIndex : Index of the port to which this structure applies + * nID : Specifies the identifier of the LTR frame to be marked + * as reference frame for encoding subsequent frames. + */ +typedef struct QOMX_VIDEO_CONFIG_LTRMARK_TYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_U32 nID; +} QOMX_VIDEO_CONFIG_LTRMARK_TYPE; + +/** + * This should be used with OMX_QcomIndexConfigVideoLTRMark extension. + */ +typedef QOMX_VIDEO_CONFIG_LTRMARK_TYPE OMX_QCOM_VIDEO_CONFIG_LTRMARK_TYPE; + +/** + * Specifies an LTR frame to encode subsequent frames. + * STRUCT MEMBERS: + * nSize : Size of Structure in bytes + * nVersion : OpenMAX IL specification version information + * nPortIndex : Index of the port to which this structure applies + * nID : Specifies the identifier of the LTR frame to be used + as reference frame for encoding subsequent frames. + * nFrames : Specifies the number of subsequent frames to be + encoded using the LTR frame with its identifier + nID as reference frame. Short-term reference frames + will be used thereafter. The value of 0xFFFFFFFF + indicates that all subsequent frames will be + encodedusing this LTR frame as reference frame. + */ +typedef struct QOMX_VIDEO_CONFIG_LTRUSE_TYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_U32 nID; + OMX_U32 nFrames; +} QOMX_VIDEO_CONFIG_LTRUSE_TYPE; + +/** + * This should be used with OMX_QcomIndexConfigVideoLTRUse extension. + */ +typedef QOMX_VIDEO_CONFIG_LTRUSE_TYPE OMX_QCOM_VIDEO_CONFIG_LTRUSE_TYPE; + +/** + * Enumeration used to define the video encoder modes + * + * ENUMS: + * EncoderModeDefault : Default video recording mode. + * All encoder settings made through + * OMX_SetParameter/OMX_SetConfig are applied. No + * parameter is overridden. + * EncoderModeMMS : Video recording mode for MMS (Multimedia Messaging + * Service). This mode is similar to EncoderModeDefault + * except that here the Rate control mode is overridden + * internally and set as a variant of variable bitrate with + * variable frame rate. After this mode is set if the IL + * client tries to set OMX_VIDEO_CONTROLRATETYPE via + * OMX_IndexParamVideoBitrate that would be rejected. For + * this, client should set mode back to EncoderModeDefault + * first and then change OMX_VIDEO_CONTROLRATETYPE. + */ +typedef enum QOMX_VIDEO_ENCODERMODETYPE +{ + QOMX_VIDEO_EncoderModeDefault = 0x00, + QOMX_VIDEO_EncoderModeMMS = 0x01, + QOMX_VIDEO_EncoderModeMax = 0x7FFFFFFF +} QOMX_VIDEO_ENCODERMODETYPE; + +/** + * This structure is used to set the video encoder mode. + * + * STRUCT MEMBERS: + * nSize : Size of the structure in bytes + * nVersion : OMX specification version info + * nPortIndex : Port that this structure applies to + * nMode : defines the video encoder mode + */ +typedef struct QOMX_VIDEO_PARAM_ENCODERMODETYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + QOMX_VIDEO_ENCODERMODETYPE nMode; +} QOMX_VIDEO_PARAM_ENCODERMODETYPE; + +/** + * This structure describes the parameters corresponding to the + * QOMX_VIDEO_SYNTAXHDRTYPE extension. This parameter can be queried + * during the loaded state. + */ + +typedef struct QOMX_VIDEO_SYNTAXHDRTYPE +{ + OMX_U32 nSize; /** Size of the structure in bytes */ + OMX_VERSIONTYPE nVersion;/** OMX specification version information */ + OMX_U32 nPortIndex; /** Portindex which is extended by this structure */ + OMX_U32 nBytes; /** The number of bytes filled in to the buffer */ + OMX_U8 data[1]; /** Buffer to store the header information */ +} QOMX_VIDEO_SYNTAXHDRTYPE; + +/** + * This structure describes the parameters corresponding to the + * QOMX_VIDEO_TEMPORALSPATIALTYPE extension. This parameter can be set + * dynamically during any state except the state invalid. This is primarily + * used for setting MaxQP from the application. This is set on the out port. + */ + +typedef struct QOMX_VIDEO_TEMPORALSPATIALTYPE +{ + OMX_U32 nSize; /** Size of the structure in bytes */ + OMX_VERSIONTYPE nVersion;/** OMX specification version information */ + OMX_U32 nPortIndex; /** Portindex which is extended by this structure */ + OMX_U32 nTSFactor; /** Temoral spatial tradeoff factor value in 0-100 */ +} QOMX_VIDEO_TEMPORALSPATIALTYPE; + +/** + * This structure describes the parameters corresponding to the + * OMX_QCOM_VIDEO_CONFIG_INTRAPERIODTYPE extension. This parameter can be set + * dynamically during any state except the state invalid. This is set on the out port. + */ + +typedef struct QOMX_VIDEO_INTRAPERIODTYPE +{ + OMX_U32 nSize; /** Size of the structure in bytes */ + OMX_VERSIONTYPE nVersion;/** OMX specification version information */ + OMX_U32 nPortIndex; /** Portindex which is extended by this structure */ + OMX_U32 nIDRPeriod; /** This specifies coding a frame as IDR after every nPFrames + of intra frames. If this parameter is set to 0, only the + first frame of the encode session is an IDR frame. This + field is ignored for non-AVC codecs and is used only for + codecs that support IDR Period */ + OMX_U32 nPFrames; /** The number of "P" frames between two "I" frames */ + OMX_U32 nBFrames; /** The number of "B" frames between two "I" frames */ +} QOMX_VIDEO_INTRAPERIODTYPE; + +/** + * This structure describes the parameters corresponding to the + * OMX_QCOM_VIDEO_CONFIG_ULBUFFEROCCUPANCYTYPE extension. This parameter can be set + * dynamically during any state except the state invalid. This is used for the buffer negotiation + * with other clients. This is set on the out port. + */ +typedef struct OMX_QCOM_VIDEO_CONFIG_ULBUFFEROCCUPANCYTYPE +{ + OMX_U32 nSize; /** Size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /** OMX specification version information */ + OMX_U32 nPortIndex; /** Portindex which is extended by this structure */ + OMX_U32 nBufferOccupancy; /** The number of bytes to be set for the buffer occupancy */ +} OMX_QCOM_VIDEO_CONFIG_ULBUFFEROCCUPANCYTYPE; + +/** + * This structure describes the parameters corresponding to the + * OMX_QCOM_VIDEO_CONFIG_RANDOMINTRAREFRESHTYPE extension. This parameter can be set + * dynamically during any state except the state invalid. This is primarily used for the dynamic/random + * intrarefresh. This is set on the out port. + */ +typedef struct OMX_QCOM_VIDEO_CONFIG_RANDOMINTRAREFRESHTYPE +{ + OMX_U32 nSize; /** Size of the structure in bytes */ + OMX_VERSIONTYPE nVersion;/** OMX specification version information */ + OMX_U32 nPortIndex; /** Portindex which is extended by this structure */ + OMX_U32 nRirMBs; /** The number of MBs to be set for intrarefresh */ +} OMX_QCOM_VIDEO_CONFIG_RANDOMINTRAREFRESHTYPE; + + +/** + * This structure describes the parameters corresponding to the + * OMX_QCOM_VIDEO_CONFIG_QPRANGE extension. This parameter can be set + * dynamically during any state except the state invalid. This is primarily + * used for the min/max QP to be set from the application. This + * is set on the out port. + */ +typedef struct OMX_QCOM_VIDEO_CONFIG_QPRANGE +{ + OMX_U32 nSize; /** Size of the structure in bytes */ + OMX_VERSIONTYPE nVersion;/** OMX specification version information */ + OMX_U32 nPortIndex; /** Portindex which is extended by this structure */ + OMX_U32 nMinQP; /** The number for minimum quantization parameter */ + OMX_U32 nMaxQP; /** The number for maximum quantization parameter */ +} OMX_QCOM_VIDEO_CONFIG_QPRANGE; + +/** + * This structure describes the parameters for the + * OMX_QcomIndexParamH264AUDelimiter extension. It enables/disables + * the AU delimiters in the H264 stream, which is used by WFD. + */ +typedef struct OMX_QCOM_VIDEO_CONFIG_H264_AUD +{ + OMX_U32 nSize; /** Size of the structure in bytes */ + OMX_VERSIONTYPE nVersion;/** OMX specification version information */ + OMX_BOOL bEnable; /** Enable/disable the setting */ +} OMX_QCOM_VIDEO_CONFIG_H264_AUD; + +typedef enum QOMX_VIDEO_PERF_LEVEL +{ + OMX_QCOM_PerfLevelNominal, + OMX_QCOM_PerfLevelTurbo +} QOMX_VIDEO_PERF_LEVEL; + +/** + * This structure describes the parameters corresponding + * to OMX_QcomIndexParamPerfLevel extension. It will set + * the performance mode specified as QOMX_VIDEO_PERF_LEVEL. + */ +typedef struct OMX_QCOM_VIDEO_PARAM_PERF_LEVEL { + OMX_U32 nSize; /** Size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /** OMX specification version information */ + QOMX_VIDEO_PERF_LEVEL ePerfLevel; /** Performance level */ +} OMX_QCOM_VIDEO_PARAM_PERF_LEVEL; + +/** + * This structure describes the parameters corresponding + * to OMX_QcomIndexConfigPerfLevel extension. It will set + * the performance mode specified as QOMX_VIDEO_PERF_LEVEL. + */ +typedef struct OMX_QCOM_VIDEO_CONFIG_PERF_LEVEL { + OMX_U32 nSize; /** Size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /** OMX specification version information */ + QOMX_VIDEO_PERF_LEVEL ePerfLevel; /** Performance level */ +} OMX_QCOM_VIDEO_CONFIG_PERF_LEVEL; + +typedef enum QOMX_VIDEO_PICTURE_TYPE_DECODE +{ + OMX_QCOM_PictypeDecode_IPB, + OMX_QCOM_PictypeDecode_I +} QOMX_VIDEO_PICTURE_TYPE_DECODE; + +/** + * This structure describes the parameters corresponding + * to OMX_QcomIndexConfigPictureTypeDecode extension. It + * will set the picture type decode specified by eDecodeType. + */ +typedef struct OMX_QCOM_VIDEO_CONFIG_PICTURE_TYPE_DECODE { + OMX_U32 nSize; /** Size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /** OMX specification version information */ + QOMX_VIDEO_PICTURE_TYPE_DECODE eDecodeType; /** Decode type */ +} OMX_QCOM_VIDEO_CONFIG_PICTURE_TYPE_DECODE; + +/** + * This structure describes the parameters corresponding + * to OMX_QcomIndexParamH264VUITimingInfo extension. It + * will enable/disable the VUI timing info. + */ +typedef struct OMX_QCOM_VIDEO_PARAM_VUI_TIMING_INFO { + OMX_U32 nSize; /** Size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /** OMX specification version information */ + OMX_BOOL bEnable; /** Enable/disable the setting */ +} OMX_QCOM_VIDEO_PARAM_VUI_TIMING_INFO; + +/** + * This structure describes the parameters corresponding + * to OMX_QcomIndexParamVQZIPSEIType extension. It + * will enable/disable the VQZIP SEI info. + */ +typedef struct OMX_QTI_VIDEO_PARAM_VQZIP_SEI_TYPE { + OMX_U32 nSize; /** Size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /** OMX specification version information */ + OMX_BOOL bEnable; /** Enable/disable the setting */ +} OMX_QTI_VIDEO_PARAM_VQZIP_SEI_TYPE; + +/** + * This structure describes the parameters corresponding + * to OMX_QcomIndexParamPeakBitrate extension. It will + * set the peak bitrate specified by nPeakBitrate. + */ +typedef struct OMX_QCOM_VIDEO_PARAM_PEAK_BITRATE { + OMX_U32 nSize; /** Size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /** OMX specification version information */ + OMX_U32 nPeakBitrate; /** Peak bitrate value */ +} OMX_QCOM_VIDEO_PARAM_PEAK_BITRATE; + +/** + * This structure describes the parameters corresponding + * to OMX_QTIIndexParamForceCompressedForDPB extension. Enabling + * this extension will force the split mode DPB(compressed)/OPB(Linear) + * for all resolutions.On some chipsets preferred mode would be combined + * Linear for both DPB/OPB to save memory. For example on 8996 preferred mode + * would be combined linear for resolutions <= 1080p . + * Enabling this might save power but with the cost + * of increased memory i.e almost double the number on output YUV buffers. + */ +typedef struct OMX_QTI_VIDEO_PARAM_FORCE_COMPRESSED_FOR_DPB_TYPE { + OMX_U32 nSize; /** Size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /** OMX specification version information */ + OMX_BOOL bEnable; /** Enable/disable the setting */ +} OMX_QTI_VIDEO_PARAM_FORCE_COMPRESSED_FOR_DPB_TYPE; + +/** + * This structure describes the parameters corresponding + * to OMX_QTIIndexParamForceUnCompressedForOPB extension. Enabling this + * extension will force the OPB to be linear for the current video session. + * If this property is not set, then the OPB will be set to linear or compressed + * based on resolution selected and/or if cpu access is requested on the + * OPB buffer. + */ +typedef struct OMX_QTI_VIDEO_PARAM_FORCE_UNCOMPRESSED_FOR_OPB_TYPE { + OMX_U32 nSize; /** Sizeo f the structure in bytes */ + OMX_VERSIONTYPE nVersion; /** OMX specification version information */ + OMX_BOOL bEnable; /** Enable/disable the setting */ +} OMX_QTI_VIDEO_PARAM_FORCE_UNCOMPRESSED_FOR_OPB_TYPE; + +typedef struct OMX_VENDOR_EXTRADATATYPE { + OMX_U32 nPortIndex; + OMX_U32 nDataSize; + OMX_U8 *pData; // cdata (codec_data/extradata) +} OMX_VENDOR_EXTRADATATYPE; + +/** + * This structure describes the parameters corresponding to the + * OMX_VENDOR_VIDEOFRAMERATE extension. This parameter can be set + * dynamically during any state except the state invalid. This is + * used for frame rate to be set from the application. This + * is set on the in port. + */ +typedef struct OMX_VENDOR_VIDEOFRAMERATE { + OMX_U32 nSize; /** Size of the structure in bytes */ + OMX_VERSIONTYPE nVersion;/** OMX specification version information */ + OMX_U32 nPortIndex; /** Portindex which is extended by this structure */ + OMX_U32 nFps; /** Frame rate value */ + OMX_BOOL bEnabled; /** Flag to enable or disable client's frame rate value */ +} OMX_VENDOR_VIDEOFRAMERATE; + +typedef enum OMX_INDEXVENDORTYPE { + OMX_IndexVendorFileReadInputFilename = 0xFF000001, + OMX_IndexVendorParser3gpInputFilename = 0xFF000002, + OMX_IndexVendorVideoExtraData = 0xFF000003, + OMX_IndexVendorAudioExtraData = 0xFF000004, + OMX_IndexVendorVideoFrameRate = 0xFF000005, +} OMX_INDEXVENDORTYPE; + +typedef enum OMX_QCOM_VC1RESOLUTIONTYPE +{ + OMX_QCOM_VC1_PICTURE_RES_1x1, + OMX_QCOM_VC1_PICTURE_RES_2x1, + OMX_QCOM_VC1_PICTURE_RES_1x2, + OMX_QCOM_VC1_PICTURE_RES_2x2 +} OMX_QCOM_VC1RESOLUTIONTYPE; + +typedef enum OMX_QCOM_INTERLACETYPE +{ + OMX_QCOM_InterlaceFrameProgressive, + OMX_QCOM_InterlaceInterleaveFrameTopFieldFirst, + OMX_QCOM_InterlaceInterleaveFrameBottomFieldFirst, + OMX_QCOM_InterlaceFrameTopFieldFirst, + OMX_QCOM_InterlaceFrameBottomFieldFirst, + OMX_QCOM_InterlaceFieldTop, + OMX_QCOM_InterlaceFieldBottom +}OMX_QCOM_INTERLACETYPE; + +typedef struct OMX_QCOM_PARAM_VIDEO_INTERLACETYPE +{ + OMX_U32 nSize; /** Size of the structure in bytes */ + OMX_VERSIONTYPE nVersion;/** OMX specification version information */ + OMX_U32 nPortIndex; /** Portindex which is extended by this structure */ + OMX_BOOL bInterlace; /** Interlace content **/ +}OMX_QCOM_PARAM_VIDEO_INTERLACETYPE; + +typedef struct OMX_QCOM_CONFIG_INTERLACETYPE +{ + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_U32 nIndex; + OMX_QCOM_INTERLACETYPE eInterlaceType; +}OMX_QCOM_CONFIG_INTERLACETYPE; + +#define MAX_PAN_SCAN_WINDOWS 4 + +typedef struct OMX_QCOM_PANSCAN +{ + OMX_U32 numWindows; + OMX_QCOMRectangle window[MAX_PAN_SCAN_WINDOWS]; +} OMX_QCOM_PANSCAN; + +typedef struct OMX_QCOM_ASPECT_RATIO +{ + OMX_U32 aspectRatioX; + OMX_U32 aspectRatioY; +} OMX_QCOM_ASPECT_RATIO; + +typedef struct OMX_QCOM_DISPLAY_ASPECT_RATIO +{ + OMX_U32 displayVerticalSize; + OMX_U32 displayHorizontalSize; +} OMX_QCOM_DISPLAY_ASPECT_RATIO; + +typedef struct OMX_QCOM_FRAME_PACK_ARRANGEMENT +{ + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_U32 id; + OMX_U32 cancel_flag; + OMX_U32 type; + OMX_U32 quincunx_sampling_flag; + OMX_U32 content_interpretation_type; + OMX_U32 spatial_flipping_flag; + OMX_U32 frame0_flipped_flag; + OMX_U32 field_views_flag; + OMX_U32 current_frame_is_frame0_flag; + OMX_U32 frame0_self_contained_flag; + OMX_U32 frame1_self_contained_flag; + OMX_U32 frame0_grid_position_x; + OMX_U32 frame0_grid_position_y; + OMX_U32 frame1_grid_position_x; + OMX_U32 frame1_grid_position_y; + OMX_U32 reserved_byte; + OMX_U32 repetition_period; + OMX_U32 extension_flag; +} OMX_QCOM_FRAME_PACK_ARRANGEMENT; + +typedef struct OMX_QCOM_EXTRADATA_QP +{ + OMX_U32 nQP; +} OMX_QCOM_EXTRADATA_QP; + +typedef struct OMX_QCOM_EXTRADATA_BITS_INFO +{ + OMX_U32 header_bits; + OMX_U32 frame_bits; +} OMX_QCOM_EXTRADATA_BITS_INFO; + +typedef struct OMX_QCOM_EXTRADATA_USERDATA { + OMX_U32 type; + OMX_U32 data[1]; +} OMX_QCOM_EXTRADATA_USERDATA; + +typedef struct OMX_QCOM_EXTRADATA_FRAMEINFO +{ + // common frame meta data. interlace related info removed + OMX_VIDEO_PICTURETYPE ePicType; + OMX_QCOM_INTERLACETYPE interlaceType; + OMX_QCOM_PANSCAN panScan; + OMX_QCOM_ASPECT_RATIO aspectRatio; + OMX_QCOM_DISPLAY_ASPECT_RATIO displayAspectRatio; + OMX_U32 nConcealedMacroblocks; + OMX_U32 nFrameRate; + OMX_TICKS nTimeStamp; +} OMX_QCOM_EXTRADATA_FRAMEINFO; + +typedef struct OMX_QCOM_EXTRADATA_FRAMEDIMENSION +{ + /** Frame Dimensions added to each YUV buffer */ + OMX_U32 nDecWidth; /** Width rounded to multiple of 16 */ + OMX_U32 nDecHeight; /** Height rounded to multiple of 16 */ + OMX_U32 nActualWidth; /** Actual Frame Width */ + OMX_U32 nActualHeight; /** Actual Frame Height */ + +} OMX_QCOM_EXTRADATA_FRAMEDIMENSION; + +typedef struct OMX_QCOM_H264EXTRADATA +{ + OMX_U64 seiTimeStamp; +} OMX_QCOM_H264EXTRADATA; + +typedef struct OMX_QCOM_VC1EXTRADATA +{ + OMX_U32 nVC1RangeY; + OMX_U32 nVC1RangeUV; + OMX_QCOM_VC1RESOLUTIONTYPE eVC1PicResolution; +} OMX_QCOM_VC1EXTRADATA; + +typedef union OMX_QCOM_EXTRADATA_CODEC_DATA +{ + OMX_QCOM_H264EXTRADATA h264ExtraData; + OMX_QCOM_VC1EXTRADATA vc1ExtraData; +} OMX_QCOM_EXTRADATA_CODEC_DATA; + +typedef struct OMX_QCOM_EXTRADATA_MBINFO +{ + OMX_U32 nFormat; + OMX_U32 nDataSize; + OMX_U8 data[0]; +} OMX_QCOM_EXTRADATA_MBINFO; + +typedef struct OMX_QCOM_EXTRADATA_VQZIPSEI { + OMX_U32 nSize; + OMX_U8 data[0]; +} OMX_QCOM_EXTRADATA_VQZIPSEI; + +typedef struct OMX_QTI_VIDEO_PARAM_ENABLE_ROIINFO { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_BOOL bEnableRoiInfo; +} OMX_QTI_VIDEO_PARAM_ENABLE_ROIINFO; + +typedef struct OMX_QTI_VIDEO_CONFIG_ROIINFO { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_S32 nUpperQpOffset; + OMX_S32 nLowerQpOffset; + OMX_BOOL bUseRoiInfo; + OMX_S32 nRoiMBInfoSize; + OMX_PTR pRoiMBInfo; +} OMX_QTI_VIDEO_CONFIG_ROIINFO; + +typedef enum OMX_QCOM_EXTRADATATYPE +{ + OMX_ExtraDataFrameInfo = 0x7F000001, + OMX_ExtraDataH264 = 0x7F000002, + OMX_ExtraDataVC1 = 0x7F000003, + OMX_ExtraDataFrameDimension = 0x7F000004, + OMX_ExtraDataVideoEncoderSliceInfo = 0x7F000005, + OMX_ExtraDataConcealMB = 0x7F000006, + OMX_ExtraDataInterlaceFormat = 0x7F000007, + OMX_ExtraDataPortDef = 0x7F000008, + OMX_ExtraDataMP2ExtnData = 0x7F000009, + OMX_ExtraDataMP2UserData = 0x7F00000a, + OMX_ExtraDataVideoLTRInfo = 0x7F00000b, + OMX_ExtraDataFramePackingArrangement = 0x7F00000c, + OMX_ExtraDataQP = 0x7F00000d, + OMX_ExtraDataInputBitsInfo = 0x7F00000e, + OMX_ExtraDataVideoEncoderMBInfo = 0x7F00000f, + OMX_ExtraDataVQZipSEI = 0x7F000010, +} OMX_QCOM_EXTRADATATYPE; + +typedef struct OMX_STREAMINTERLACEFORMATTYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_BOOL bInterlaceFormat; + OMX_U32 nInterlaceFormats; +} OMX_STREAMINTERLACEFORMAT; + +typedef enum OMX_INTERLACETYPE +{ + OMX_InterlaceFrameProgressive, + OMX_InterlaceInterleaveFrameTopFieldFirst, + OMX_InterlaceInterleaveFrameBottomFieldFirst, + OMX_InterlaceFrameTopFieldFirst, + OMX_InterlaceFrameBottomFieldFirst +} OMX_INTERLACES; + + +#define OMX_EXTRADATA_HEADER_SIZE 20 + +/** + * AVC profile types, each profile indicates support for various + * performance bounds and different annexes. + */ +typedef enum QOMX_VIDEO_AVCPROFILETYPE { + QOMX_VIDEO_AVCProfileBaseline = OMX_VIDEO_AVCProfileBaseline, + QOMX_VIDEO_AVCProfileMain = OMX_VIDEO_AVCProfileMain, + QOMX_VIDEO_AVCProfileExtended = OMX_VIDEO_AVCProfileExtended, + QOMX_VIDEO_AVCProfileHigh = OMX_VIDEO_AVCProfileHigh, + QOMX_VIDEO_AVCProfileHigh10 = OMX_VIDEO_AVCProfileHigh10, + QOMX_VIDEO_AVCProfileHigh422 = OMX_VIDEO_AVCProfileHigh422, + QOMX_VIDEO_AVCProfileHigh444 = OMX_VIDEO_AVCProfileHigh444, + /* QCom specific profile indexes */ + QOMX_VIDEO_AVCProfileConstrained = OMX_VIDEO_AVCProfileVendorStartUnused, + QOMX_VIDEO_AVCProfileConstrainedBaseline, + QOMX_VIDEO_AVCProfileConstrainedHigh, +} QOMX_VIDEO_AVCPROFILETYPE; + + +/** + * H.264 MVC Profiles + */ +typedef enum QOMX_VIDEO_MVCPROFILETYPE { + QOMX_VIDEO_MVCProfileStereoHigh = 0x1, + QOMX_VIDEO_MVCProfileMultiViewHigh = 0x2, + QOMX_VIDEO_MVCProfileKhronosExtensions = 0x6F000000, + QOMX_VIDEO_MVCProfileVendorStartUnused = 0x7F000000, + QOMX_VIDEO_MVCProfileMax = 0x7FFFFFFF +} QOMX_VIDEO_MVCPROFILETYPE; + +/** + * H.264 MVC Levels + */ +typedef enum QOMX_VIDEO_MVCLEVELTYPE { + QOMX_VIDEO_MVCLevel1 = 0x01, /**< Level 1 */ + QOMX_VIDEO_MVCLevel1b = 0x02, /**< Level 1b */ + QOMX_VIDEO_MVCLevel11 = 0x04, /**< Level 1.1 */ + QOMX_VIDEO_MVCLevel12 = 0x08, /**< Level 1.2 */ + QOMX_VIDEO_MVCLevel13 = 0x10, /**< Level 1.3 */ + QOMX_VIDEO_MVCLevel2 = 0x20, /**< Level 2 */ + QOMX_VIDEO_MVCLevel21 = 0x40, /**< Level 2.1 */ + QOMX_VIDEO_MVCLevel22 = 0x80, /**< Level 2.2 */ + QOMX_VIDEO_MVCLevel3 = 0x100, /**< Level 3 */ + QOMX_VIDEO_MVCLevel31 = 0x200, /**< Level 3.1 */ + QOMX_VIDEO_MVCLevel32 = 0x400, /**< Level 3.2 */ + QOMX_VIDEO_MVCLevel4 = 0x800, /**< Level 4 */ + QOMX_VIDEO_MVCLevel41 = 0x1000, /**< Level 4.1 */ + QOMX_VIDEO_MVCLevel42 = 0x2000, /**< Level 4.2 */ + QOMX_VIDEO_MVCLevel5 = 0x4000, /**< Level 5 */ + QOMX_VIDEO_MVCLevel51 = 0x8000, /**< Level 5.1 */ + QOMX_VIDEO_MVCLevelKhronosExtensions = 0x6F000000, + QOMX_VIDEO_MVCLevelVendorStartUnused = 0x7F000000, + QOMX_VIDEO_MVCLevelMax = 0x7FFFFFFF +} QOMX_VIDEO_MVCLEVELTYPE; + +/** + * DivX Versions + */ +typedef enum QOMX_VIDEO_DIVXFORMATTYPE { + QOMX_VIDEO_DIVXFormatUnused = 0x01, /**< Format unused or unknown */ + QOMX_VIDEO_DIVXFormat311 = 0x02, /**< DivX 3.11 */ + QOMX_VIDEO_DIVXFormat4 = 0x04, /**< DivX 4 */ + QOMX_VIDEO_DIVXFormat5 = 0x08, /**< DivX 5 */ + QOMX_VIDEO_DIVXFormat6 = 0x10, /**< DivX 6 */ + QOMX_VIDEO_DIVXFormatKhronosExtensions = 0x6F000000, + QOMX_VIDEO_DIVXFormatVendorStartUnused = 0x7F000000, + QOMX_VIDEO_DIVXFormatMax = 0x7FFFFFFF +} QOMX_VIDEO_DIVXFORMATTYPE; + +/** + * DivX profile types, each profile indicates support for + * various performance bounds. + */ +typedef enum QOMX_VIDEO_DIVXPROFILETYPE { + QOMX_VIDEO_DivXProfileqMobile = 0x01, /**< qMobile Profile */ + QOMX_VIDEO_DivXProfileMobile = 0x02, /**< Mobile Profile */ + QOMX_VIDEO_DivXProfileMT = 0x04, /**< Mobile Theatre Profile */ + QOMX_VIDEO_DivXProfileHT = 0x08, /**< Home Theatre Profile */ + QOMX_VIDEO_DivXProfileHD = 0x10, /**< High Definition Profile */ + QOMX_VIDEO_DIVXProfileKhronosExtensions = 0x6F000000, + QOMX_VIDEO_DIVXProfileVendorStartUnused = 0x7F000000, + QOMX_VIDEO_DIVXProfileMax = 0x7FFFFFFF +} QOMX_VIDEO_DIVXPROFILETYPE; + +/** + * DivX Video Params + * + * STRUCT MEMBERS: + * nSize : Size of the structure in bytes + * nVersion : OMX specification version information + * nPortIndex : Port that this structure applies to + * eFormat : Version of DivX stream / data + * eProfile : Profile of DivX stream / data + */ +typedef struct QOMX_VIDEO_PARAM_DIVXTYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + QOMX_VIDEO_DIVXFORMATTYPE eFormat; + QOMX_VIDEO_DIVXPROFILETYPE eProfile; +} QOMX_VIDEO_PARAM_DIVXTYPE; + + + +/** + * VP Versions + */ +typedef enum QOMX_VIDEO_VPFORMATTYPE { + QOMX_VIDEO_VPFormatUnused = 0x01, /**< Format unused or unknown */ + QOMX_VIDEO_VPFormat6 = 0x02, /**< VP6 Video Format */ + QOMX_VIDEO_VPFormat7 = 0x04, /**< VP7 Video Format */ + QOMX_VIDEO_VPFormat8 = 0x08, /**< VP8 Video Format */ + QOMX_VIDEO_VPFormat9 = 0x10, /**< VP9 Video Format */ + QOMX_VIDEO_VPFormatKhronosExtensions = 0x6F000000, + QOMX_VIDEO_VPFormatVendorStartUnused = 0x7F000000, + QOMX_VIDEO_VPFormatMax = 0x7FFFFFFF +} QOMX_VIDEO_VPFORMATTYPE; + +/** + * VP profile types, each profile indicates support for various + * encoding tools. + */ +typedef enum QOMX_VIDEO_VPPROFILETYPE { + QOMX_VIDEO_VPProfileSimple = 0x01, /**< Simple Profile, applies to VP6 only */ + QOMX_VIDEO_VPProfileAdvanced = 0x02, /**< Advanced Profile, applies to VP6 only */ + QOMX_VIDEO_VPProfileVersion0 = 0x04, /**< Version 0, applies to VP7 and VP8 */ + QOMX_VIDEO_VPProfileVersion1 = 0x08, /**< Version 1, applies to VP7 and VP8 */ + QOMX_VIDEO_VPProfileVersion2 = 0x10, /**< Version 2, applies to VP8 only */ + QOMX_VIDEO_VPProfileVersion3 = 0x20, /**< Version 3, applies to VP8 only */ + QOMX_VIDEO_VPProfileKhronosExtensions = 0x6F000000, + QOMX_VIDEO_VPProfileVendorStartUnused = 0x7F000000, + QOMX_VIDEO_VPProfileMax = 0x7FFFFFFF +} QOMX_VIDEO_VPPROFILETYPE; + +/** + * VP Video Params + * + * STRUCT MEMBERS: + * nSize : Size of the structure in bytes + * nVersion : OMX specification version information + * nPortIndex : Port that this structure applies to + * eFormat : Format of VP stream / data + * eProfile : Profile or Version of VP stream / data + */ +typedef struct QOMX_VIDEO_PARAM_VPTYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + QOMX_VIDEO_VPFORMATTYPE eFormat; + QOMX_VIDEO_VPPROFILETYPE eProfile; +} QOMX_VIDEO_PARAM_VPTYPE; + +/** + * Spark Versions + */ +typedef enum QOMX_VIDEO_SPARKFORMATTYPE { + QOMX_VIDEO_SparkFormatUnused = 0x01, /**< Format unused or unknown */ + QOMX_VIDEO_SparkFormat0 = 0x02, /**< Video Format Version 0 */ + QOMX_VIDEO_SparkFormat1 = 0x04, /**< Video Format Version 1 */ + QOMX_VIDEO_SparkFormatKhronosExtensions = 0x6F000000, + QOMX_VIDEO_SparkFormatVendorStartUnused = 0x7F000000, + QOMX_VIDEO_SparkFormatMax = 0x7FFFFFFF +} QOMX_VIDEO_SPARKFORMATTYPE; + +/** + * Spark Video Params + * + * STRUCT MEMBERS: + * nSize : Size of the structure in bytes + * nVersion : OMX specification version information + * nPortIndex : Port that this structure applies to + * eFormat : Version of Spark stream / data + */ +typedef struct QOMX_VIDEO_PARAM_SPARKTYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + QOMX_VIDEO_SPARKFORMATTYPE eFormat; +} QOMX_VIDEO_PARAM_SPARKTYPE; + + +typedef struct QOMX_VIDEO_QUERY_DECODER_INSTANCES { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_U32 nNumOfInstances; +} QOMX_VIDEO_QUERY_DECODER_INSTANCES; + +typedef struct QOMX_ENABLETYPE { + OMX_BOOL bEnable; +} QOMX_ENABLETYPE; + +typedef enum QOMX_VIDEO_EVENTS { + OMX_EventIndexsettingChanged = OMX_EventVendorStartUnused +} QOMX_VIDEO_EVENTS; + +typedef enum QOMX_VIDEO_PICTURE_ORDER { + QOMX_VIDEO_DISPLAY_ORDER = 0x1, + QOMX_VIDEO_DECODE_ORDER = 0x2 +} QOMX_VIDEO_PICTURE_ORDER; + +typedef struct QOMX_VIDEO_DECODER_PICTURE_ORDER { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + QOMX_VIDEO_PICTURE_ORDER eOutputPictureOrder; +} QOMX_VIDEO_DECODER_PICTURE_ORDER; + +typedef struct QOMX_INDEXEXTRADATATYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_BOOL bEnabled; + OMX_INDEXTYPE nIndex; +} QOMX_INDEXEXTRADATATYPE; + +typedef struct QOMX_INDEXTIMESTAMPREORDER { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_BOOL bEnable; +} QOMX_INDEXTIMESTAMPREORDER; + +typedef struct QOMX_INDEXDOWNSCALAR { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_BOOL bEnable; +} QOMX_INDEXDOWNSCALAR; + +typedef struct QOMX_VIDEO_CUSTOM_BUFFERSIZE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_U32 nBufferSize; +} QOMX_VIDEO_CUSTOM_BUFFERSIZE; + +#define OMX_QCOM_INDEX_PARAM_VIDEO_SYNCFRAMEDECODINGMODE "OMX.QCOM.index.param.video.SyncFrameDecodingMode" +#define OMX_QCOM_INDEX_PARAM_INDEXEXTRADATA "OMX.QCOM.index.param.IndexExtraData" +#define OMX_QCOM_INDEX_PARAM_VIDEO_SLICEDELIVERYMODE "OMX.QCOM.index.param.SliceDeliveryMode" +#define OMX_QCOM_INDEX_PARAM_VIDEO_FRAMEPACKING_EXTRADATA "OMX.QCOM.index.param.video.FramePackingExtradata" +#define OMX_QCOM_INDEX_PARAM_VIDEO_QP_EXTRADATA "OMX.QCOM.index.param.video.QPExtradata" +#define OMX_QCOM_INDEX_PARAM_VIDEO_INPUTBITSINFO_EXTRADATA "OMX.QCOM.index.param.video.InputBitsInfoExtradata" +#define OMX_QCOM_INDEX_PARAM_VIDEO_EXTNUSER_EXTRADATA "OMX.QCOM.index.param.video.ExtnUserExtraData" +#define OMX_QCOM_INDEX_CONFIG_VIDEO_FRAMEPACKING_INFO "OMX.QCOM.index.config.video.FramePackingInfo" +#define OMX_QCOM_INDEX_PARAM_VIDEO_MPEG2SEQDISP_EXTRADATA "OMX.QCOM.index.param.video.Mpeg2SeqDispExtraData" + +#define OMX_QCOM_INDEX_PARAM_VIDEO_HIERSTRUCTURE "OMX.QCOM.index.param.video.HierStructure" +#define OMX_QCOM_INDEX_PARAM_VIDEO_LTRCOUNT "OMX.QCOM.index.param.video.LTRCount" +#define OMX_QCOM_INDEX_PARAM_VIDEO_LTRPERIOD "OMX.QCOM.index.param.video.LTRPeriod" +#define OMX_QCOM_INDEX_CONFIG_VIDEO_LTRUSE "OMX.QCOM.index.config.video.LTRUse" +#define OMX_QCOM_INDEX_CONFIG_VIDEO_LTRMARK "OMX.QCOM.index.config.video.LTRMark" +#define OMX_QCOM_INDEX_CONFIG_VIDEO_HIER_P_LAYERS "OMX.QCOM.index.config.video.hierplayers" +#define OMX_QCOM_INDEX_CONFIG_RECTANGLE_TYPE "OMX.QCOM.index.config.video.rectangle" +#define OMX_QCOM_INDEX_PARAM_VIDEO_BASE_LAYER_ID "OMX.QCOM.index.param.video.baselayerid" +#define OMX_QCOM_INDEX_CONFIG_VIDEO_QP "OMX.QCOM.index.config.video.qp" +#define OMX_QCOM_INDEX_PARAM_VIDEO_SAR "OMX.QCOM.index.param.video.sar" +#define OMX_QTI_INDEX_PARAM_VIDEO_LOW_LATENCY "OMX.QTI.index.param.video.LowLatency" + +#define OMX_QCOM_INDEX_PARAM_VIDEO_PASSINPUTBUFFERFD "OMX.QCOM.index.param.video.PassInputBufferFd" +#define OMX_QTI_INDEX_PARAM_VIDEO_PREFER_ADAPTIVE_PLAYBACK "OMX.QTI.index.param.video.PreferAdaptivePlayback" +#define OMX_QTI_INDEX_CONFIG_VIDEO_SETTIMEDATA "OMX.QTI.index.config.video.settimedata" +#define OMX_QTI_INDEX_PARAM_VIDEO_FORCE_COMPRESSED_FOR_DPB "OMX.QTI.index.param.video.ForceCompressedForDPB" +#define OMX_QTI_INDEX_PARAM_VIDEO_ENABLE_ROIINFO "OMX.QTI.index.param.enableRoiInfo" +#define OMX_QTI_INDEX_CONFIG_VIDEO_ROIINFO "OMX.QTI.index.config.RoiInfo" + +typedef enum { + QOMX_VIDEO_FRAME_PACKING_CHECKERBOARD = 0, + QOMX_VIDEO_FRAME_PACKING_COLUMN_INTERLEAVE = 1, + QOMX_VIDEO_FRAME_PACKING_ROW_INTERLEAVE = 2, + QOMX_VIDEO_FRAME_PACKING_SIDE_BY_SIDE = 3, + QOMX_VIDEO_FRAME_PACKING_TOP_BOTTOM = 4, + QOMX_VIDEO_FRAME_PACKING_TEMPORAL = 5, +} QOMX_VIDEO_FRAME_PACKING_ARRANGEMENT; + +typedef enum { + QOMX_VIDEO_CONTENT_UNSPECIFIED = 0, + QOMX_VIDEO_CONTENT_LR_VIEW = 1, + QOMX_VIDEO_CONTENT_RL_VIEW = 2, +} QOMX_VIDEO_CONTENT_INTERPRETATION; + +/** + * Specifies the extended picture types. These values should be + * OR'd along with the types defined in OMX_VIDEO_PICTURETYPE to + * signal all pictures types which are allowed. + * + * ENUMS: + * H.264 Specific Picture Types: IDR + */ +typedef enum QOMX_VIDEO_PICTURETYPE { + QOMX_VIDEO_PictureTypeIDR = OMX_VIDEO_PictureTypeVendorStartUnused + 0x1000 +} QOMX_VIDEO_PICTURETYPE; + +#define OMX_QCOM_INDEX_CONFIG_ACTIVE_REGION_DETECTION "OMX.QCOM.index.config.activeregiondetection" +#define OMX_QCOM_INDEX_CONFIG_ACTIVE_REGION_DETECTION_STATUS "OMX.QCOM.index.config.activeregiondetectionstatus" +#define OMX_QCOM_INDEX_CONFIG_SCALING_MODE "OMX.QCOM.index.config.scalingmode" +#define OMX_QCOM_INDEX_CONFIG_NOISEREDUCTION "OMX.QCOM.index.config.noisereduction" +#define OMX_QCOM_INDEX_CONFIG_IMAGEENHANCEMENT "OMX.QCOM.index.config.imageenhancement" +#define OMX_QCOM_INDEX_PARAM_HELDBUFFERCOUNT "OMX.QCOM.index.param.HeldBufferCount" /**< reference: QOMX_HELDBUFFERCOUNTTYPE */ + + +typedef struct QOMX_RECTTYPE { + OMX_S32 nLeft; + OMX_S32 nTop; + OMX_U32 nWidth; + OMX_U32 nHeight; +} QOMX_RECTTYPE; + +typedef struct QOMX_ACTIVEREGIONDETECTIONTYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_BOOL bEnable; + QOMX_RECTTYPE sROI; + OMX_U32 nNumExclusionRegions; + QOMX_RECTTYPE sExclusionRegions[1]; +} QOMX_ACTIVEREGIONDETECTIONTYPE; + +typedef struct QOMX_ACTIVEREGIONDETECTION_STATUSTYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_BOOL bDetected; + QOMX_RECTTYPE sDetectedRegion; +} QOMX_ACTIVEREGIONDETECTION_STATUSTYPE; + +typedef enum QOMX_SCALE_MODETYPE { + QOMX_SCALE_MODE_Normal, + QOMX_SCALE_MODE_Anamorphic, + QOMX_SCALE_MODE_Max = 0x7FFFFFFF +} QOMX_SCALE_MODETYPE; + +typedef struct QOMX_SCALINGMODETYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + QOMX_SCALE_MODETYPE eScaleMode; +} QOMX_SCALINGMODETYPE; + +typedef struct QOMX_NOISEREDUCTIONTYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_BOOL bEnable; + OMX_BOOL bAutoMode; + OMX_S32 nNoiseReduction; +} QOMX_NOISEREDUCTIONTYPE; + +typedef struct QOMX_IMAGEENHANCEMENTTYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_BOOL bEnable; + OMX_BOOL bAutoMode; + OMX_S32 nImageEnhancement; +} QOMX_IMAGEENHANCEMENTTYPE; + +/* + * these are part of OMX1.2 but JB MR2 branch doesn't have them defined + * OMX_IndexParamInterlaceFormat + * OMX_INTERLACEFORMATTYPE + */ +#ifndef OMX_IndexParamInterlaceFormat +#define OMX_IndexParamInterlaceFormat (0x7FF00000) +typedef struct OMX_INTERLACEFORMATTYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_U32 nFormat; + OMX_TICKS nTimeStamp; +} OMX_INTERLACEFORMATTYPE; +#endif + +/** + * This structure is used to indicate the maximum number of buffers + * that a port will hold during data flow. + * + * STRUCT MEMBERS: + * nSize : Size of the structure in bytes + * nVersion : OMX specification version info + * nPortIndex : Port that this structure applies to + * nHeldBufferCount : Read-only, maximum number of buffers that will be held + */ +typedef struct QOMX_HELDBUFFERCOUNTTYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_U32 nHeldBufferCount; +} QOMX_HELDBUFFERCOUNTTYPE; + +typedef enum QOMX_VIDEO_HIERARCHICALCODINGTYPE { + QOMX_HIERARCHICALCODING_P = 0x01, + QOMX_HIERARCHICALCODING_B = 0x02, +} QOMX_VIDEO_HIERARCHICALCODINGTYPE; + +typedef struct QOMX_VIDEO_HIERARCHICALLAYERS { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_U32 nNumLayers; + QOMX_VIDEO_HIERARCHICALCODINGTYPE eHierarchicalCodingType; +} QOMX_VIDEO_HIERARCHICALLAYERS; + +typedef struct QOMX_VIDEO_H264ENTROPYCODINGTYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_BOOL bCabac; + OMX_U32 nCabacInitIdc; +} QOMX_VIDEO_H264ENTROPYCODINGTYPE; + + +/* VIDEO POSTPROCESSING CTRLS AND ENUMS */ +#define QOMX_VPP_HQV_CUSTOMPAYLOAD_SZ 256 +#define VPP_HQV_CONTROL_GLOBAL_START (VPP_HQV_CONTROL_CUST + 1) + +typedef enum QOMX_VPP_HQV_MODE { + VPP_HQV_MODE_OFF, + VPP_HQV_MODE_AUTO, + VPP_HQV_MODE_MANUAL, + VPP_HQV_MODE_MAX +} QOMX_VPP_HQV_MODE; + +typedef enum QOMX_VPP_HQVCONTROLTYPE { + VPP_HQV_CONTROL_CADE = 0x1, + VPP_HQV_CONTROL_CNR = 0x04, + VPP_HQV_CONTROL_AIE = 0x05, + VPP_HQV_CONTROL_FRC = 0x06, + VPP_HQV_CONTROL_CUST = 0x07, + VPP_HQV_CONTROL_GLOBAL_DEMO = VPP_HQV_CONTROL_GLOBAL_START, + VPP_HQV_CONTROL_MAX, +} QOMX_VPP_HQVCONTROLTYPE; + +typedef enum QOMX_VPP_HQV_HUE_MODE { + VPP_HQV_HUE_MODE_OFF, + VPP_HQV_HUE_MODE_ON, + VPP_HQV_HUE_MODE_MAX, +} QOMX_VPP_HQV_HUE_MODE; + +typedef enum QOMX_VPP_HQV_FRC_MODE { + VPP_HQV_FRC_MODE_OFF, + VPP_HQV_FRC_MODE_LOW, + VPP_HQV_FRC_MODE_MED, + VPP_HQV_FRC_MODE_HIGH, + VPP_HQV_FRC_MODE_MAX, +} QOMX_VPP_HQV_FRC_MODE; + + +typedef struct QOMX_VPP_HQVCTRL_CADE { + QOMX_VPP_HQV_MODE mode; + OMX_U32 level; + OMX_S32 contrast; + OMX_S32 saturation; +} QOMX_VPP_HQVCTRL_CADE; + +typedef struct QOMX_VPP_HQVCTRL_CNR { + QOMX_VPP_HQV_MODE mode; + OMX_U32 level; +} QOMX_VPP_HQVCTRL_CNR; + +typedef struct QOMX_VPP_HQVCTRL_AIE { + QOMX_VPP_HQV_MODE mode; + QOMX_VPP_HQV_HUE_MODE hue_mode; + OMX_U32 cade_level; + OMX_U32 ltm_level; +} QOMX_VPP_HQVCTRL_AIE; + +typedef struct QOMX_VPP_HQVCTRL_CUSTOM { + OMX_U32 id; + OMX_U32 len; + OMX_U8 data[QOMX_VPP_HQV_CUSTOMPAYLOAD_SZ]; +} QOMX_VPP_HQVCTRL_CUSTOM; + +typedef struct QOMX_VPP_HQVCTRL_GLOBAL_DEMO { + OMX_U32 process_percent; +} QOMX_VPP_HQVCTRL_GLOBAL_DEMO; + +typedef struct QOMX_VPP_HQVCTRL_FRC { + QOMX_VPP_HQV_FRC_MODE mode; +} QOMX_VPP_HQVCTRL_FRC; + +typedef struct QOMX_VPP_HQVCONTROL { + QOMX_VPP_HQV_MODE mode; + QOMX_VPP_HQVCONTROLTYPE ctrl_type; + union { + QOMX_VPP_HQVCTRL_CADE cade; + QOMX_VPP_HQVCTRL_CNR cnr; + QOMX_VPP_HQVCTRL_AIE aie; + QOMX_VPP_HQVCTRL_CUSTOM custom; + QOMX_VPP_HQVCTRL_GLOBAL_DEMO global_demo; + QOMX_VPP_HQVCTRL_FRC frc; + }; +} QOMX_VPP_HQVCONTROL; + +/* STRUCTURE TO TURN VPP ON */ +typedef struct QOMX_VPP_ENABLE { + OMX_BOOL enable_vpp; +} QOMX_VPP_ENABLE; + +typedef enum OMX_QOMX_VIDEO_MBISTATISTICSTYPE { + QOMX_MBI_STATISTICS_MODE_DEFAULT = 0, + QOMX_MBI_STATISTICS_MODE_1 = 0x01, + QOMX_MBI_STATISTICS_MODE_2 = 0x02, +} OMX_QOMX_VIDEO_MBISTATISTICSTYPE; + +typedef struct OMX_QOMX_VIDEO_MBI_STATISTICS { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_QOMX_VIDEO_MBISTATISTICSTYPE eMBIStatisticsType; +} OMX_QOMX_VIDEO_MBI_STATISTICS; + +typedef struct QOMX_VIDEO_BATCHSIZETYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_U32 nBatchSize; +} QOMX_VIDEO_BATCHSIZETYPE; + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __OMX_QCOM_EXTENSIONS_H__ */ diff --git a/third_party/openmax/include/OMX_Skype_VideoExtensions.h b/third_party/openmax/include/OMX_Skype_VideoExtensions.h new file mode 100644 index 000000000..5cc832930 --- /dev/null +++ b/third_party/openmax/include/OMX_Skype_VideoExtensions.h @@ -0,0 +1,155 @@ +/*@@@+++@@@@****************************************************************** + + Microsoft Skype Engineering + Copyright (C) 2014 Microsoft Corporation. + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +*@@@---@@@@******************************************************************/ + + +#ifndef __OMX_SKYPE_VIDEOEXTENSIONS_H__ +#define __OMX_SKYPE_VIDEOEXTENSIONS_H__ + +#ifdef __cplusplus +extern "C" +{ +#endif + +#include + +#pragma pack(push, 1) + + +typedef enum OMX_SKYPE_VIDEO_SliceControlMode +{ + OMX_SKYPE_VIDEO_SliceControlModeNone = 0, + OMX_SKYPE_VIDEO_SliceControlModeMB = 1, + OMX_SKYPE_VIDEO_SliceControlModeByte = 2, + OMX_SKYPE_VIDEO_SliceControlModMBRow = 3, +} OMX_SKYPE_VIDEO_SliceControlMode; + + +typedef enum OMX_SKYPE_VIDEO_HierarType +{ + OMX_SKYPE_VIDEO_HierarType_P = 0x01, + OMX_SKYPE_VIDEO_HierarType_B = 0x02, +} OMX_SKYPE_VIDEO_HIERAR_HierarType; + +typedef enum OMX_VIDEO_EXTENSION_AVCPROFILETYPE +{ + OMX_VIDEO_EXT_AVCProfileConstrainedBaseline = 0x01, + OMX_VIDEO_EXT_AVCProfileConstrainedHigh = 0x02, +} OMX_VIDEO_EXTENSION_AVCPROFILETYPE; + +typedef struct OMX_SKYPE_VIDEO_ENCODERPARAMS { + OMX_BOOL bLowLatency; + OMX_BOOL bUseExtendedProfile; + OMX_BOOL bSequenceHeaderWithIDR; + OMX_VIDEO_EXTENSION_AVCPROFILETYPE eProfile; + OMX_U32 nLTRFrames; + OMX_SKYPE_VIDEO_HierarType eHierarType; + OMX_U32 nMaxTemporalLayerCount; + OMX_SKYPE_VIDEO_SliceControlMode eSliceControlMode; + OMX_U32 nSarIndex; + OMX_U32 nSarWidth; + OMX_U32 nSarHeight; +} OMX_SKYPE_VIDEO_ENCODERPARAMS; + +typedef struct OMX_SKYPE_VIDEO_PARAM_ENCODERSETTING { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_SKYPE_VIDEO_ENCODERPARAMS stEncParam; +} OMX_SKYPE_VIDEO_PARAM_ENCODESETTING; + +typedef struct OMX_SKYPE_VIDEO_ENCODERCAP { + OMX_BOOL bLowLatency; + OMX_U32 nMaxFrameWidth; + OMX_U32 nMaxFrameHeight; + OMX_U32 nMaxInstances; + OMX_U32 nMaxTemporaLayerCount; + OMX_U32 nMaxRefFrames; + OMX_U32 nMaxLTRFrames; + OMX_VIDEO_AVCLEVELTYPE nMaxLevel; + OMX_U32 nSliceControlModesBM; + OMX_U32 nMaxMacroblockProcessingRate; + OMX_U32 xMinScaleFactor; +} OMX_SKYPE_VIDEO_ENCODERCAP; + +typedef struct OMX_SKYPE_VIDEO_PARAM_ENCODERCAP { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_SKYPE_VIDEO_ENCODERCAP stEncCap; +} OMX_SKYPE_VIDEO_PARAM_ENCODERCAP; + +typedef struct OMX_SKYPE_VIDEO_DECODERCAP { + OMX_BOOL bLowLatency; + OMX_U32 nMaxFrameWidth; + OMX_U32 nMaxFrameHeight; + OMX_U32 nMaxInstances; + OMX_VIDEO_AVCLEVELTYPE nMaxLevel; + OMX_U32 nMaxMacroblockProcessingRate; +} OMX_SKYPE_VIDEO_DECODERCAP; + +typedef struct OMX_SKYPE_VIDEO_PARAM_DECODERCAP { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_SKYPE_VIDEO_DECODERCAP stDecoderCap; +} OMX_SKYPE_VIDEO_PARAM_DECODERCAP; + +typedef struct OMX_SKYPE_VIDEO_CONFIG_QP { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_U32 nQP; +} OMX_SKYPE_VIDEO_CONFIG_QP; + +typedef struct OMX_SKYPE_VIDEO_CONFIG_BASELAYERPID{ + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_U32 nPID; +} OMX_SKYPE_VIDEO_CONFIG_BASELAYERPID; + +typedef struct OMX_SKYPE_VIDEO_PARAM_DRIVERVER { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_U64 nDriverVersion; +} OMX_SKYPE_VIDEO_PARAM_DRIVERVER; + +typedef enum OMX_SKYPE_VIDEO_DownScaleFactor +{ + OMX_SKYPE_VIDEO_DownScaleFactor_1_1 = 0, + OMX_SKYPE_VIDEO_DownScaleFactor_Equal_AR = 1, + OMX_SKYPE_VIDEO_DownScaleFactor_Any = 2, +} OMX_SKYPE_VIDEO_DownScaleFactor; + +#pragma pack(pop) + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/third_party/openmax/include/OMX_Types.h b/third_party/openmax/include/OMX_Types.h new file mode 100644 index 000000000..3b9fab4fc --- /dev/null +++ b/third_party/openmax/include/OMX_Types.h @@ -0,0 +1,359 @@ +/* + * Copyright (c) 2008 The Khronos Group Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject + * to the following conditions: + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +/** OMX_Types.h - OpenMax IL version 1.1.2 + * The OMX_Types header file contains the primitive type definitions used by + * the core, the application and the component. This file may need to be + * modified to be used on systems that do not have "char" set to 8 bits, + * "short" set to 16 bits and "long" set to 32 bits. + */ + +#ifndef OMX_Types_h +#define OMX_Types_h + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/** The OMX_API and OMX_APIENTRY are platform specific definitions used + * to declare OMX function prototypes. They are modified to meet the + * requirements for a particular platform */ +#ifdef __SYMBIAN32__ +# ifdef __OMX_EXPORTS +# define OMX_API __declspec(dllexport) +# else +# ifdef _WIN32 +# define OMX_API __declspec(dllexport) +# else +# define OMX_API __declspec(dllimport) +# endif +# endif +#else +# ifdef _WIN32 +# ifdef __OMX_EXPORTS +# define OMX_API __declspec(dllexport) +# else +# define OMX_API __declspec(dllimport) +# endif +# else +# ifdef __OMX_EXPORTS +# define OMX_API +# else +# define OMX_API extern +# endif +# endif +#endif + +#ifndef OMX_APIENTRY +#define OMX_APIENTRY +#endif + +/** OMX_IN is used to identify inputs to an OMX function. This designation + will also be used in the case of a pointer that points to a parameter + that is used as an output. */ +#ifndef OMX_IN +#define OMX_IN +#endif + +/** OMX_OUT is used to identify outputs from an OMX function. This + designation will also be used in the case of a pointer that points + to a parameter that is used as an input. */ +#ifndef OMX_OUT +#define OMX_OUT +#endif + + +/** OMX_INOUT is used to identify parameters that may be either inputs or + outputs from an OMX function at the same time. This designation will + also be used in the case of a pointer that points to a parameter that + is used both as an input and an output. */ +#ifndef OMX_INOUT +#define OMX_INOUT +#endif + +/** OMX_ALL is used to as a wildcard to select all entities of the same type + * when specifying the index, or referring to a object by an index. (i.e. + * use OMX_ALL to indicate all N channels). When used as a port index + * for a config or parameter this OMX_ALL denotes that the config or + * parameter applies to the entire component not just one port. */ +#define OMX_ALL 0xFFFFFFFF + +/** In the following we define groups that help building doxygen documentation */ + +/** @defgroup core OpenMAX IL core + * Functions and structure related to the OMX IL core + */ + + /** @defgroup comp OpenMAX IL component + * Functions and structure related to the OMX IL component + */ + +/** @defgroup rpm Resource and Policy Management + * Structures for resource and policy management of components + */ + +/** @defgroup buf Buffer Management + * Buffer handling functions and structures + */ + +/** @defgroup tun Tunneling + * @ingroup core comp + * Structures and functions to manage tunnels among component ports + */ + +/** @defgroup cp Content Pipes + * @ingroup core + */ + + /** @defgroup metadata Metadata handling + * + */ + +/** OMX_U8 is an 8 bit unsigned quantity that is byte aligned */ +typedef unsigned char OMX_U8; + +/** OMX_S8 is an 8 bit signed quantity that is byte aligned */ +typedef signed char OMX_S8; + +/** OMX_U16 is a 16 bit unsigned quantity that is 16 bit word aligned */ +typedef unsigned short OMX_U16; + +/** OMX_S16 is a 16 bit signed quantity that is 16 bit word aligned */ +typedef signed short OMX_S16; + +/** OMX_U32 is a 32 bit unsigned quantity that is 32 bit word aligned */ +typedef unsigned int OMX_U32; + +/** OMX_S32 is a 32 bit signed quantity that is 32 bit word aligned */ +typedef signed int OMX_S32; + + +/* Users with compilers that cannot accept the "long long" designation should + define the OMX_SKIP64BIT macro. It should be noted that this may cause + some components to fail to compile if the component was written to require + 64 bit integral types. However, these components would NOT compile anyway + since the compiler does not support the way the component was written. +*/ +#ifndef OMX_SKIP64BIT +#ifdef __SYMBIAN32__ +/** OMX_U64 is a 64 bit unsigned quantity that is 64 bit word aligned */ +typedef unsigned long long OMX_U64; + +/** OMX_S64 is a 64 bit signed quantity that is 64 bit word aligned */ +typedef signed long long OMX_S64; + +#elif defined(WIN32) + +/** OMX_U64 is a 64 bit unsigned quantity that is 64 bit word aligned */ +typedef unsigned __int64 OMX_U64; + +/** OMX_S64 is a 64 bit signed quantity that is 64 bit word aligned */ +typedef signed __int64 OMX_S64; + +#else /* WIN32 */ + +/** OMX_U64 is a 64 bit unsigned quantity that is 64 bit word aligned */ +typedef unsigned long long OMX_U64; + +/** OMX_S64 is a 64 bit signed quantity that is 64 bit word aligned */ +typedef signed long long OMX_S64; + +#endif /* WIN32 */ +#endif + + +/** The OMX_BOOL type is intended to be used to represent a true or a false + value when passing parameters to and from the OMX core and components. The + OMX_BOOL is a 32 bit quantity and is aligned on a 32 bit word boundary. + */ +typedef enum OMX_BOOL { + OMX_FALSE = 0, + OMX_TRUE = !OMX_FALSE, + OMX_BOOL_MAX = 0x7FFFFFFF +} OMX_BOOL; + +#ifdef OMX_ANDROID_COMPILE_AS_32BIT_ON_64BIT_PLATFORMS + +typedef OMX_U32 OMX_PTR; +typedef OMX_PTR OMX_STRING; +typedef OMX_PTR OMX_BYTE; + +#else + +/** The OMX_PTR type is intended to be used to pass pointers between the OMX + applications and the OMX Core and components. This is a 32 bit pointer and + is aligned on a 32 bit boundary. + */ +typedef void* OMX_PTR; + +/** The OMX_STRING type is intended to be used to pass "C" type strings between + the application and the core and component. The OMX_STRING type is a 32 + bit pointer to a zero terminated string. The pointer is word aligned and + the string is byte aligned. + */ +typedef char* OMX_STRING; + +/** The OMX_BYTE type is intended to be used to pass arrays of bytes such as + buffers between the application and the component and core. The OMX_BYTE + type is a 32 bit pointer to a zero terminated string. The pointer is word + aligned and the string is byte aligned. + */ +typedef unsigned char* OMX_BYTE; + +/** OMX_UUIDTYPE is a very long unique identifier to uniquely identify + at runtime. This identifier should be generated by a component in a way + that guarantees that every instance of the identifier running on the system + is unique. */ + + +#endif + +typedef unsigned char OMX_UUIDTYPE[128]; + +/** The OMX_DIRTYPE enumeration is used to indicate if a port is an input or + an output port. This enumeration is common across all component types. + */ +typedef enum OMX_DIRTYPE +{ + OMX_DirInput, /**< Port is an input port */ + OMX_DirOutput, /**< Port is an output port */ + OMX_DirMax = 0x7FFFFFFF +} OMX_DIRTYPE; + +/** The OMX_ENDIANTYPE enumeration is used to indicate the bit ordering + for numerical data (i.e. big endian, or little endian). + */ +typedef enum OMX_ENDIANTYPE +{ + OMX_EndianBig, /**< big endian */ + OMX_EndianLittle, /**< little endian */ + OMX_EndianMax = 0x7FFFFFFF +} OMX_ENDIANTYPE; + + +/** The OMX_NUMERICALDATATYPE enumeration is used to indicate if data + is signed or unsigned + */ +typedef enum OMX_NUMERICALDATATYPE +{ + OMX_NumericalDataSigned, /**< signed data */ + OMX_NumericalDataUnsigned, /**< unsigned data */ + OMX_NumercialDataMax = 0x7FFFFFFF +} OMX_NUMERICALDATATYPE; + + +/** Unsigned bounded value type */ +typedef struct OMX_BU32 { + OMX_U32 nValue; /**< actual value */ + OMX_U32 nMin; /**< minimum for value (i.e. nValue >= nMin) */ + OMX_U32 nMax; /**< maximum for value (i.e. nValue <= nMax) */ +} OMX_BU32; + + +/** Signed bounded value type */ +typedef struct OMX_BS32 { + OMX_S32 nValue; /**< actual value */ + OMX_S32 nMin; /**< minimum for value (i.e. nValue >= nMin) */ + OMX_S32 nMax; /**< maximum for value (i.e. nValue <= nMax) */ +} OMX_BS32; + + +/** Structure representing some time or duration in microseconds. This structure + * must be interpreted as a signed 64 bit value. The quantity is signed to accommodate + * negative deltas and preroll scenarios. The quantity is represented in microseconds + * to accomodate high resolution timestamps (e.g. DVD presentation timestamps based + * on a 90kHz clock) and to allow more accurate and synchronized delivery (e.g. + * individual audio samples delivered at 192 kHz). The quantity is 64 bit to + * accommodate a large dynamic range (signed 32 bit values would allow only for plus + * or minus 35 minutes). + * + * Implementations with limited precision may convert the signed 64 bit value to + * a signed 32 bit value internally but risk loss of precision. + */ +#ifndef OMX_SKIP64BIT +typedef OMX_S64 OMX_TICKS; +#else +typedef struct OMX_TICKS +{ + OMX_U32 nLowPart; /** low bits of the signed 64 bit tick value */ + OMX_U32 nHighPart; /** high bits of the signed 64 bit tick value */ +} OMX_TICKS; +#endif +#define OMX_TICKS_PER_SECOND 1000000 + +/** Define the public interface for the OMX Handle. The core will not use + this value internally, but the application should only use this value. + */ +typedef void* OMX_HANDLETYPE; + +typedef struct OMX_MARKTYPE +{ + OMX_HANDLETYPE hMarkTargetComponent; /**< The component that will + generate a mark event upon + processing the mark. */ + OMX_PTR pMarkData; /**< Application specific data associated with + the mark sent on a mark event to disambiguate + this mark from others. */ +} OMX_MARKTYPE; + + +/** OMX_NATIVE_DEVICETYPE is used to map a OMX video port to the + * platform & operating specific object used to reference the display + * or can be used by a audio port for native audio rendering */ +typedef void* OMX_NATIVE_DEVICETYPE; + +/** OMX_NATIVE_WINDOWTYPE is used to map a OMX video port to the + * platform & operating specific object used to reference the window */ +typedef void* OMX_NATIVE_WINDOWTYPE; + +/** The OMX_VERSIONTYPE union is used to specify the version for + a structure or component. For a component, the version is entirely + specified by the component vendor. Components doing the same function + from different vendors may or may not have the same version. For + structures, the version shall be set by the entity that allocates the + structure. For structures specified in the OMX 1.1 specification, the + value of the version shall be set to 1.1.0.0 in all cases. Access to the + OMX_VERSIONTYPE can be by a single 32 bit access (e.g. by nVersion) or + by accessing one of the structure elements to, for example, check only + the Major revision. + */ +typedef union OMX_VERSIONTYPE +{ + struct + { + OMX_U8 nVersionMajor; /**< Major version accessor element */ + OMX_U8 nVersionMinor; /**< Minor version accessor element */ + OMX_U8 nRevision; /**< Revision version accessor element */ + OMX_U8 nStep; /**< Step version accessor element */ + } s; + OMX_U32 nVersion; /**< 32 bit value to make accessing the + version easily done in a single word + size copy/compare operation */ +} OMX_VERSIONTYPE; + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif +/* File EOF */ diff --git a/third_party/openmax/include/OMX_Video.h b/third_party/openmax/include/OMX_Video.h new file mode 100644 index 000000000..64dbe87b4 --- /dev/null +++ b/third_party/openmax/include/OMX_Video.h @@ -0,0 +1,1082 @@ +/** + * Copyright (c) 2008 The Khronos Group Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject + * to the following conditions: + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +/** + * @file OMX_Video.h - OpenMax IL version 1.1.2 + * The structures is needed by Video components to exchange parameters + * and configuration data with OMX components. + */ +#ifndef OMX_Video_h +#define OMX_Video_h + +/** @defgroup video OpenMAX IL Video Domain + * @ingroup iv + * Structures for OpenMAX IL Video domain + * @{ + */ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + +/** + * Each OMX header must include all required header files to allow the + * header to compile without errors. The includes below are required + * for this header file to compile successfully + */ + +#include + + +/** + * Enumeration used to define the possible video compression codings. + * NOTE: This essentially refers to file extensions. If the coding is + * being used to specify the ENCODE type, then additional work + * must be done to configure the exact flavor of the compression + * to be used. For decode cases where the user application can + * not differentiate between MPEG-4 and H.264 bit streams, it is + * up to the codec to handle this. + */ +typedef enum OMX_VIDEO_CODINGTYPE { + OMX_VIDEO_CodingUnused, /**< Value when coding is N/A */ + OMX_VIDEO_CodingAutoDetect, /**< Autodetection of coding type */ + OMX_VIDEO_CodingMPEG2, /**< AKA: H.262 */ + OMX_VIDEO_CodingH263, /**< H.263 */ + OMX_VIDEO_CodingMPEG4, /**< MPEG-4 */ + OMX_VIDEO_CodingWMV, /**< all versions of Windows Media Video */ + OMX_VIDEO_CodingRV, /**< all versions of Real Video */ + OMX_VIDEO_CodingAVC, /**< H.264/AVC */ + OMX_VIDEO_CodingMJPEG, /**< Motion JPEG */ + OMX_VIDEO_CodingVP8, /**< Google VP8, formerly known as On2 VP8 */ + OMX_VIDEO_CodingVP9, /**< Google VP9 */ + OMX_VIDEO_CodingHEVC, /**< HEVC */ + OMX_VIDEO_CodingKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_VIDEO_CodingVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + OMX_VIDEO_CodingMax = 0x7FFFFFFF +} OMX_VIDEO_CODINGTYPE; + + +/** + * Data structure used to define a video path. The number of Video paths for + * input and output will vary by type of the Video component. + * + * Input (aka Source) : zero Inputs, one Output, + * Splitter : one Input, 2 or more Outputs, + * Processing Element : one Input, one output, + * Mixer : 2 or more inputs, one output, + * Output (aka Sink) : one Input, zero outputs. + * + * The PortDefinition structure is used to define all of the parameters + * necessary for the compliant component to setup an input or an output video + * path. If additional vendor specific data is required, it should be + * transmitted to the component using the CustomCommand function. Compliant + * components will prepopulate this structure with optimal values during the + * GetDefaultInitParams command. + * + * STRUCT MEMBERS: + * cMIMEType : MIME type of data for the port + * pNativeRender : Platform specific reference for a display if a + * sync, otherwise this field is 0 + * nFrameWidth : Width of frame to be used on channel if + * uncompressed format is used. Use 0 for unknown, + * don't care or variable + * nFrameHeight : Height of frame to be used on channel if + * uncompressed format is used. Use 0 for unknown, + * don't care or variable + * nStride : Number of bytes per span of an image + * (i.e. indicates the number of bytes to get + * from span N to span N+1, where negative stride + * indicates the image is bottom up + * nSliceHeight : Height used when encoding in slices + * nBitrate : Bit rate of frame to be used on channel if + * compressed format is used. Use 0 for unknown, + * don't care or variable + * xFramerate : Frame rate to be used on channel if uncompressed + * format is used. Use 0 for unknown, don't care or + * variable. Units are Q16 frames per second. + * bFlagErrorConcealment : Turns on error concealment if it is supported by + * the OMX component + * eCompressionFormat : Compression format used in this instance of the + * component. When OMX_VIDEO_CodingUnused is + * specified, eColorFormat is used + * eColorFormat : Decompressed format used by this component + * pNativeWindow : Platform specific reference for a window object if a + * display sink , otherwise this field is 0x0. + */ +typedef struct OMX_VIDEO_PORTDEFINITIONTYPE { + OMX_STRING cMIMEType; + OMX_NATIVE_DEVICETYPE pNativeRender; + OMX_U32 nFrameWidth; + OMX_U32 nFrameHeight; + OMX_S32 nStride; + OMX_U32 nSliceHeight; + OMX_U32 nBitrate; + OMX_U32 xFramerate; + OMX_BOOL bFlagErrorConcealment; + OMX_VIDEO_CODINGTYPE eCompressionFormat; + OMX_COLOR_FORMATTYPE eColorFormat; + OMX_NATIVE_WINDOWTYPE pNativeWindow; +} OMX_VIDEO_PORTDEFINITIONTYPE; + +/** + * Port format parameter. This structure is used to enumerate the various + * data input/output format supported by the port. + * + * STRUCT MEMBERS: + * nSize : Size of the structure in bytes + * nVersion : OMX specification version information + * nPortIndex : Indicates which port to set + * nIndex : Indicates the enumeration index for the format from + * 0x0 to N-1 + * eCompressionFormat : Compression format used in this instance of the + * component. When OMX_VIDEO_CodingUnused is specified, + * eColorFormat is used + * eColorFormat : Decompressed format used by this component + * xFrameRate : Indicates the video frame rate in Q16 format + */ +typedef struct OMX_VIDEO_PARAM_PORTFORMATTYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_U32 nIndex; + OMX_VIDEO_CODINGTYPE eCompressionFormat; + OMX_COLOR_FORMATTYPE eColorFormat; + OMX_U32 xFramerate; +} OMX_VIDEO_PARAM_PORTFORMATTYPE; + + +/** + * This is a structure for configuring video compression quantization + * parameter values. Codecs may support different QP values for different + * frame types. + * + * STRUCT MEMBERS: + * nSize : Size of the structure in bytes + * nVersion : OMX specification version info + * nPortIndex : Port that this structure applies to + * nQpI : QP value to use for index frames + * nQpP : QP value to use for P frames + * nQpB : QP values to use for bidirectional frames + */ +typedef struct OMX_VIDEO_PARAM_QUANTIZATIONTYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_U32 nQpI; + OMX_U32 nQpP; + OMX_U32 nQpB; +} OMX_VIDEO_PARAM_QUANTIZATIONTYPE; + + +/** + * Structure for configuration of video fast update parameters. + * + * STRUCT MEMBERS: + * nSize : Size of the structure in bytes + * nVersion : OMX specification version info + * nPortIndex : Port that this structure applies to + * bEnableVFU : Enable/Disable video fast update + * nFirstGOB : Specifies the number of the first macroblock row + * nFirstMB : specifies the first MB relative to the specified first GOB + * nNumMBs : Specifies the number of MBs to be refreshed from nFirstGOB + * and nFirstMB + */ +typedef struct OMX_VIDEO_PARAM_VIDEOFASTUPDATETYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_BOOL bEnableVFU; + OMX_U32 nFirstGOB; + OMX_U32 nFirstMB; + OMX_U32 nNumMBs; +} OMX_VIDEO_PARAM_VIDEOFASTUPDATETYPE; + + +/** + * Enumeration of possible bitrate control types + */ +typedef enum OMX_VIDEO_CONTROLRATETYPE { + OMX_Video_ControlRateDisable, + OMX_Video_ControlRateVariable, + OMX_Video_ControlRateConstant, + OMX_Video_ControlRateVariableSkipFrames, + OMX_Video_ControlRateConstantSkipFrames, + OMX_Video_ControlRateKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_Video_ControlRateVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + OMX_Video_ControlRateMax = 0x7FFFFFFF +} OMX_VIDEO_CONTROLRATETYPE; + + +/** + * Structure for configuring bitrate mode of a codec. + * + * STRUCT MEMBERS: + * nSize : Size of the struct in bytes + * nVersion : OMX spec version info + * nPortIndex : Port that this struct applies to + * eControlRate : Control rate type enum + * nTargetBitrate : Target bitrate to encode with + */ +typedef struct OMX_VIDEO_PARAM_BITRATETYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_VIDEO_CONTROLRATETYPE eControlRate; + OMX_U32 nTargetBitrate; +} OMX_VIDEO_PARAM_BITRATETYPE; + + +/** + * Enumeration of possible motion vector (MV) types + */ +typedef enum OMX_VIDEO_MOTIONVECTORTYPE { + OMX_Video_MotionVectorPixel, + OMX_Video_MotionVectorHalfPel, + OMX_Video_MotionVectorQuarterPel, + OMX_Video_MotionVectorEighthPel, + OMX_Video_MotionVectorKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_Video_MotionVectorVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + OMX_Video_MotionVectorMax = 0x7FFFFFFF +} OMX_VIDEO_MOTIONVECTORTYPE; + + +/** + * Structure for configuring the number of motion vectors used as well + * as their accuracy. + * + * STRUCT MEMBERS: + * nSize : Size of the struct in bytes + * nVersion : OMX spec version info + * nPortIndex : port that this structure applies to + * eAccuracy : Enumerated MV accuracy + * bUnrestrictedMVs : Allow unrestricted MVs + * bFourMV : Allow use of 4 MVs + * sXSearchRange : Search range in horizontal direction for MVs + * sYSearchRange : Search range in vertical direction for MVs + */ +typedef struct OMX_VIDEO_PARAM_MOTIONVECTORTYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_VIDEO_MOTIONVECTORTYPE eAccuracy; + OMX_BOOL bUnrestrictedMVs; + OMX_BOOL bFourMV; + OMX_S32 sXSearchRange; + OMX_S32 sYSearchRange; +} OMX_VIDEO_PARAM_MOTIONVECTORTYPE; + + +/** + * Enumeration of possible methods to use for Intra Refresh + */ +typedef enum OMX_VIDEO_INTRAREFRESHTYPE { + OMX_VIDEO_IntraRefreshCyclic, + OMX_VIDEO_IntraRefreshAdaptive, + OMX_VIDEO_IntraRefreshBoth, + OMX_VIDEO_IntraRefreshKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_VIDEO_IntraRefreshVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + OMX_VIDEO_IntraRefreshRandom, + OMX_VIDEO_IntraRefreshMax = 0x7FFFFFFF +} OMX_VIDEO_INTRAREFRESHTYPE; + + +/** + * Structure for configuring intra refresh mode + * + * STRUCT MEMBERS: + * nSize : Size of the structure in bytes + * nVersion : OMX specification version information + * nPortIndex : Port that this structure applies to + * eRefreshMode : Cyclic, Adaptive, or Both + * nAirMBs : Number of intra macroblocks to refresh in a frame when + * AIR is enabled + * nAirRef : Number of times a motion marked macroblock has to be + * intra coded + * nCirMBs : Number of consecutive macroblocks to be coded as "intra" + * when CIR is enabled + */ +typedef struct OMX_VIDEO_PARAM_INTRAREFRESHTYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_VIDEO_INTRAREFRESHTYPE eRefreshMode; + OMX_U32 nAirMBs; + OMX_U32 nAirRef; + OMX_U32 nCirMBs; +} OMX_VIDEO_PARAM_INTRAREFRESHTYPE; + + +/** + * Structure for enabling various error correction methods for video + * compression. + * + * STRUCT MEMBERS: + * nSize : Size of the structure in bytes + * nVersion : OMX specification version information + * nPortIndex : Port that this structure applies to + * bEnableHEC : Enable/disable header extension codes (HEC) + * bEnableResync : Enable/disable resynchronization markers + * nResynchMarkerSpacing : Resynch markers interval (in bits) to be + * applied in the stream + * bEnableDataPartitioning : Enable/disable data partitioning + * bEnableRVLC : Enable/disable reversible variable length + * coding + */ +typedef struct OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_BOOL bEnableHEC; + OMX_BOOL bEnableResync; + OMX_U32 nResynchMarkerSpacing; + OMX_BOOL bEnableDataPartitioning; + OMX_BOOL bEnableRVLC; +} OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE; + + +/** + * Configuration of variable block-size motion compensation (VBSMC) + * + * STRUCT MEMBERS: + * nSize : Size of the structure in bytes + * nVersion : OMX specification version information + * nPortIndex : Port that this structure applies to + * b16x16 : Enable inter block search 16x16 + * b16x8 : Enable inter block search 16x8 + * b8x16 : Enable inter block search 8x16 + * b8x8 : Enable inter block search 8x8 + * b8x4 : Enable inter block search 8x4 + * b4x8 : Enable inter block search 4x8 + * b4x4 : Enable inter block search 4x4 + */ +typedef struct OMX_VIDEO_PARAM_VBSMCTYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_BOOL b16x16; + OMX_BOOL b16x8; + OMX_BOOL b8x16; + OMX_BOOL b8x8; + OMX_BOOL b8x4; + OMX_BOOL b4x8; + OMX_BOOL b4x4; +} OMX_VIDEO_PARAM_VBSMCTYPE; + + +/** + * H.263 profile types, each profile indicates support for various + * performance bounds and different annexes. + * + * ENUMS: + * Baseline : Baseline Profile: H.263 (V1), no optional modes + * H320 Coding : H.320 Coding Efficiency Backward Compatibility + * Profile: H.263+ (V2), includes annexes I, J, L.4 + * and T + * BackwardCompatible : Backward Compatibility Profile: H.263 (V1), + * includes annex F + * ISWV2 : Interactive Streaming Wireless Profile: H.263+ + * (V2), includes annexes I, J, K and T + * ISWV3 : Interactive Streaming Wireless Profile: H.263++ + * (V3), includes profile 3 and annexes V and W.6.3.8 + * HighCompression : Conversational High Compression Profile: H.263++ + * (V3), includes profiles 1 & 2 and annexes D and U + * Internet : Conversational Internet Profile: H.263++ (V3), + * includes profile 5 and annex K + * Interlace : Conversational Interlace Profile: H.263++ (V3), + * includes profile 5 and annex W.6.3.11 + * HighLatency : High Latency Profile: H.263++ (V3), includes + * profile 6 and annexes O.1 and P.5 + */ +typedef enum OMX_VIDEO_H263PROFILETYPE { + OMX_VIDEO_H263ProfileBaseline = 0x01, + OMX_VIDEO_H263ProfileH320Coding = 0x02, + OMX_VIDEO_H263ProfileBackwardCompatible = 0x04, + OMX_VIDEO_H263ProfileISWV2 = 0x08, + OMX_VIDEO_H263ProfileISWV3 = 0x10, + OMX_VIDEO_H263ProfileHighCompression = 0x20, + OMX_VIDEO_H263ProfileInternet = 0x40, + OMX_VIDEO_H263ProfileInterlace = 0x80, + OMX_VIDEO_H263ProfileHighLatency = 0x100, + OMX_VIDEO_H263ProfileKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_VIDEO_H263ProfileVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + OMX_VIDEO_H263ProfileMax = 0x7FFFFFFF +} OMX_VIDEO_H263PROFILETYPE; + + +/** + * H.263 level types, each level indicates support for various frame sizes, + * bit rates, decoder frame rates. + */ +typedef enum OMX_VIDEO_H263LEVELTYPE { + OMX_VIDEO_H263Level10 = 0x01, + OMX_VIDEO_H263Level20 = 0x02, + OMX_VIDEO_H263Level30 = 0x04, + OMX_VIDEO_H263Level40 = 0x08, + OMX_VIDEO_H263Level45 = 0x10, + OMX_VIDEO_H263Level50 = 0x20, + OMX_VIDEO_H263Level60 = 0x40, + OMX_VIDEO_H263Level70 = 0x80, + OMX_VIDEO_H263LevelKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_VIDEO_H263LevelVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + OMX_VIDEO_H263LevelMax = 0x7FFFFFFF +} OMX_VIDEO_H263LEVELTYPE; + + +/** + * Specifies the picture type. These values should be OR'd to signal all + * pictures types which are allowed. + * + * ENUMS: + * Generic Picture Types: I, P and B + * H.263 Specific Picture Types: SI and SP + * H.264 Specific Picture Types: EI and EP + * MPEG-4 Specific Picture Types: S + */ +typedef enum OMX_VIDEO_PICTURETYPE { + OMX_VIDEO_PictureTypeI = 0x01, + OMX_VIDEO_PictureTypeP = 0x02, + OMX_VIDEO_PictureTypeB = 0x04, + OMX_VIDEO_PictureTypeSI = 0x08, + OMX_VIDEO_PictureTypeSP = 0x10, + OMX_VIDEO_PictureTypeEI = 0x11, + OMX_VIDEO_PictureTypeEP = 0x12, + OMX_VIDEO_PictureTypeS = 0x14, + OMX_VIDEO_PictureTypeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_VIDEO_PictureTypeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + OMX_VIDEO_PictureTypeMax = 0x7FFFFFFF +} OMX_VIDEO_PICTURETYPE; + + +/** + * H.263 Params + * + * STRUCT MEMBERS: + * nSize : Size of the structure in bytes + * nVersion : OMX specification version information + * nPortIndex : Port that this structure applies to + * nPFrames : Number of P frames between each I frame + * nBFrames : Number of B frames between each I frame + * eProfile : H.263 profile(s) to use + * eLevel : H.263 level(s) to use + * bPLUSPTYPEAllowed : Indicating that it is allowed to use PLUSPTYPE + * (specified in the 1998 version of H.263) to + * indicate custom picture sizes or clock + * frequencies + * nAllowedPictureTypes : Specifies the picture types allowed in the + * bitstream + * bForceRoundingTypeToZero : value of the RTYPE bit (bit 6 of MPPTYPE) is + * not constrained. It is recommended to change + * the value of the RTYPE bit for each reference + * picture in error-free communication + * nPictureHeaderRepetition : Specifies the frequency of picture header + * repetition + * nGOBHeaderInterval : Specifies the interval of non-empty GOB + * headers in units of GOBs + */ +typedef struct OMX_VIDEO_PARAM_H263TYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_U32 nPFrames; + OMX_U32 nBFrames; + OMX_VIDEO_H263PROFILETYPE eProfile; + OMX_VIDEO_H263LEVELTYPE eLevel; + OMX_BOOL bPLUSPTYPEAllowed; + OMX_U32 nAllowedPictureTypes; + OMX_BOOL bForceRoundingTypeToZero; + OMX_U32 nPictureHeaderRepetition; + OMX_U32 nGOBHeaderInterval; +} OMX_VIDEO_PARAM_H263TYPE; + + +/** + * MPEG-2 profile types, each profile indicates support for various + * performance bounds and different annexes. + */ +typedef enum OMX_VIDEO_MPEG2PROFILETYPE { + OMX_VIDEO_MPEG2ProfileSimple = 0, /**< Simple Profile */ + OMX_VIDEO_MPEG2ProfileMain, /**< Main Profile */ + OMX_VIDEO_MPEG2Profile422, /**< 4:2:2 Profile */ + OMX_VIDEO_MPEG2ProfileSNR, /**< SNR Profile */ + OMX_VIDEO_MPEG2ProfileSpatial, /**< Spatial Profile */ + OMX_VIDEO_MPEG2ProfileHigh, /**< High Profile */ + OMX_VIDEO_MPEG2ProfileKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_VIDEO_MPEG2ProfileVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + OMX_VIDEO_MPEG2ProfileMax = 0x7FFFFFFF +} OMX_VIDEO_MPEG2PROFILETYPE; + + +/** + * MPEG-2 level types, each level indicates support for various frame + * sizes, bit rates, decoder frame rates. No need + */ +typedef enum OMX_VIDEO_MPEG2LEVELTYPE { + OMX_VIDEO_MPEG2LevelLL = 0, /**< Low Level */ + OMX_VIDEO_MPEG2LevelML, /**< Main Level */ + OMX_VIDEO_MPEG2LevelH14, /**< High 1440 */ + OMX_VIDEO_MPEG2LevelHL, /**< High Level */ + OMX_VIDEO_MPEG2LevelKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_VIDEO_MPEG2LevelVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + OMX_VIDEO_MPEG2LevelMax = 0x7FFFFFFF +} OMX_VIDEO_MPEG2LEVELTYPE; + + +/** + * MPEG-2 params + * + * STRUCT MEMBERS: + * nSize : Size of the structure in bytes + * nVersion : OMX specification version information + * nPortIndex : Port that this structure applies to + * nPFrames : Number of P frames between each I frame + * nBFrames : Number of B frames between each I frame + * eProfile : MPEG-2 profile(s) to use + * eLevel : MPEG-2 levels(s) to use + */ +typedef struct OMX_VIDEO_PARAM_MPEG2TYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_U32 nPFrames; + OMX_U32 nBFrames; + OMX_VIDEO_MPEG2PROFILETYPE eProfile; + OMX_VIDEO_MPEG2LEVELTYPE eLevel; +} OMX_VIDEO_PARAM_MPEG2TYPE; + + +/** + * MPEG-4 profile types, each profile indicates support for various + * performance bounds and different annexes. + * + * ENUMS: + * - Simple Profile, Levels 1-3 + * - Simple Scalable Profile, Levels 1-2 + * - Core Profile, Levels 1-2 + * - Main Profile, Levels 2-4 + * - N-bit Profile, Level 2 + * - Scalable Texture Profile, Level 1 + * - Simple Face Animation Profile, Levels 1-2 + * - Simple Face and Body Animation (FBA) Profile, Levels 1-2 + * - Basic Animated Texture Profile, Levels 1-2 + * - Hybrid Profile, Levels 1-2 + * - Advanced Real Time Simple Profiles, Levels 1-4 + * - Core Scalable Profile, Levels 1-3 + * - Advanced Coding Efficiency Profile, Levels 1-4 + * - Advanced Core Profile, Levels 1-2 + * - Advanced Scalable Texture, Levels 2-3 + */ +typedef enum OMX_VIDEO_MPEG4PROFILETYPE { + OMX_VIDEO_MPEG4ProfileSimple = 0x01, + OMX_VIDEO_MPEG4ProfileSimpleScalable = 0x02, + OMX_VIDEO_MPEG4ProfileCore = 0x04, + OMX_VIDEO_MPEG4ProfileMain = 0x08, + OMX_VIDEO_MPEG4ProfileNbit = 0x10, + OMX_VIDEO_MPEG4ProfileScalableTexture = 0x20, + OMX_VIDEO_MPEG4ProfileSimpleFace = 0x40, + OMX_VIDEO_MPEG4ProfileSimpleFBA = 0x80, + OMX_VIDEO_MPEG4ProfileBasicAnimated = 0x100, + OMX_VIDEO_MPEG4ProfileHybrid = 0x200, + OMX_VIDEO_MPEG4ProfileAdvancedRealTime = 0x400, + OMX_VIDEO_MPEG4ProfileCoreScalable = 0x800, + OMX_VIDEO_MPEG4ProfileAdvancedCoding = 0x1000, + OMX_VIDEO_MPEG4ProfileAdvancedCore = 0x2000, + OMX_VIDEO_MPEG4ProfileAdvancedScalable = 0x4000, + OMX_VIDEO_MPEG4ProfileAdvancedSimple = 0x8000, + OMX_VIDEO_MPEG4ProfileKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_VIDEO_MPEG4ProfileVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + OMX_VIDEO_MPEG4ProfileMax = 0x7FFFFFFF +} OMX_VIDEO_MPEG4PROFILETYPE; + + +/** + * MPEG-4 level types, each level indicates support for various frame + * sizes, bit rates, decoder frame rates. No need + */ +typedef enum OMX_VIDEO_MPEG4LEVELTYPE { + OMX_VIDEO_MPEG4Level0 = 0x01, /**< Level 0 */ + OMX_VIDEO_MPEG4Level0b = 0x02, /**< Level 0b */ + OMX_VIDEO_MPEG4Level1 = 0x04, /**< Level 1 */ + OMX_VIDEO_MPEG4Level2 = 0x08, /**< Level 2 */ + OMX_VIDEO_MPEG4Level3 = 0x10, /**< Level 3 */ + OMX_VIDEO_MPEG4Level4 = 0x20, /**< Level 4 */ + OMX_VIDEO_MPEG4Level4a = 0x40, /**< Level 4a */ + OMX_VIDEO_MPEG4Level5 = 0x80, /**< Level 5 */ + OMX_VIDEO_MPEG4LevelKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_VIDEO_MPEG4LevelVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + OMX_VIDEO_MPEG4LevelMax = 0x7FFFFFFF +} OMX_VIDEO_MPEG4LEVELTYPE; + + +/** + * MPEG-4 configuration. This structure handles configuration options + * which are specific to MPEG4 algorithms + * + * STRUCT MEMBERS: + * nSize : Size of the structure in bytes + * nVersion : OMX specification version information + * nPortIndex : Port that this structure applies to + * nSliceHeaderSpacing : Number of macroblocks between slice header (H263+ + * Annex K). Put zero if not used + * bSVH : Enable Short Video Header mode + * bGov : Flag to enable GOV + * nPFrames : Number of P frames between each I frame (also called + * GOV period) + * nBFrames : Number of B frames between each I frame + * nIDCVLCThreshold : Value of intra DC VLC threshold + * bACPred : Flag to use ac prediction + * nMaxPacketSize : Maximum size of packet in bytes. + * nTimeIncRes : Used to pass VOP time increment resolution for MPEG4. + * Interpreted as described in MPEG4 standard. + * eProfile : MPEG-4 profile(s) to use. + * eLevel : MPEG-4 level(s) to use. + * nAllowedPictureTypes : Specifies the picture types allowed in the bitstream + * nHeaderExtension : Specifies the number of consecutive video packet + * headers within a VOP + * bReversibleVLC : Specifies whether reversible variable length coding + * is in use + */ +typedef struct OMX_VIDEO_PARAM_MPEG4TYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_U32 nSliceHeaderSpacing; + OMX_BOOL bSVH; + OMX_BOOL bGov; + OMX_U32 nPFrames; + OMX_U32 nBFrames; + OMX_U32 nIDCVLCThreshold; + OMX_BOOL bACPred; + OMX_U32 nMaxPacketSize; + OMX_U32 nTimeIncRes; + OMX_VIDEO_MPEG4PROFILETYPE eProfile; + OMX_VIDEO_MPEG4LEVELTYPE eLevel; + OMX_U32 nAllowedPictureTypes; + OMX_U32 nHeaderExtension; + OMX_BOOL bReversibleVLC; +} OMX_VIDEO_PARAM_MPEG4TYPE; + + +/** + * WMV Versions + */ +typedef enum OMX_VIDEO_WMVFORMATTYPE { + OMX_VIDEO_WMVFormatUnused = 0x01, /**< Format unused or unknown */ + OMX_VIDEO_WMVFormat7 = 0x02, /**< Windows Media Video format 7 */ + OMX_VIDEO_WMVFormat8 = 0x04, /**< Windows Media Video format 8 */ + OMX_VIDEO_WMVFormat9 = 0x08, /**< Windows Media Video format 9 */ + OMX_VIDEO_WMFFormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_VIDEO_WMFFormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + OMX_VIDEO_WMVFormatMax = 0x7FFFFFFF +} OMX_VIDEO_WMVFORMATTYPE; + + +/** + * WMV Params + * + * STRUCT MEMBERS: + * nSize : Size of the structure in bytes + * nVersion : OMX specification version information + * nPortIndex : Port that this structure applies to + * eFormat : Version of WMV stream / data + */ +typedef struct OMX_VIDEO_PARAM_WMVTYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_VIDEO_WMVFORMATTYPE eFormat; +} OMX_VIDEO_PARAM_WMVTYPE; + + +/** + * Real Video Version + */ +typedef enum OMX_VIDEO_RVFORMATTYPE { + OMX_VIDEO_RVFormatUnused = 0, /**< Format unused or unknown */ + OMX_VIDEO_RVFormat8, /**< Real Video format 8 */ + OMX_VIDEO_RVFormat9, /**< Real Video format 9 */ + OMX_VIDEO_RVFormatG2, /**< Real Video Format G2 */ + OMX_VIDEO_RVFormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_VIDEO_RVFormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + OMX_VIDEO_RVFormatMax = 0x7FFFFFFF +} OMX_VIDEO_RVFORMATTYPE; + + +/** + * Real Video Params + * + * STUCT MEMBERS: + * nSize : Size of the structure in bytes + * nVersion : OMX specification version information + * nPortIndex : Port that this structure applies to + * eFormat : Version of RV stream / data + * nBitsPerPixel : Bits per pixel coded in the frame + * nPaddedWidth : Padded width in pixel of a video frame + * nPaddedHeight : Padded Height in pixels of a video frame + * nFrameRate : Rate of video in frames per second + * nBitstreamFlags : Flags which internal information about the bitstream + * nBitstreamVersion : Bitstream version + * nMaxEncodeFrameSize: Max encoded frame size + * bEnablePostFilter : Turn on/off post filter + * bEnableTemporalInterpolation : Turn on/off temporal interpolation + * bEnableLatencyMode : When enabled, the decoder does not display a decoded + * frame until it has detected that no enhancement layer + * frames or dependent B frames will be coming. This + * detection usually occurs when a subsequent non-B + * frame is encountered + */ +typedef struct OMX_VIDEO_PARAM_RVTYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_VIDEO_RVFORMATTYPE eFormat; + OMX_U16 nBitsPerPixel; + OMX_U16 nPaddedWidth; + OMX_U16 nPaddedHeight; + OMX_U32 nFrameRate; + OMX_U32 nBitstreamFlags; + OMX_U32 nBitstreamVersion; + OMX_U32 nMaxEncodeFrameSize; + OMX_BOOL bEnablePostFilter; + OMX_BOOL bEnableTemporalInterpolation; + OMX_BOOL bEnableLatencyMode; +} OMX_VIDEO_PARAM_RVTYPE; + + +/** + * AVC profile types, each profile indicates support for various + * performance bounds and different annexes. + */ +typedef enum OMX_VIDEO_AVCPROFILETYPE { + OMX_VIDEO_AVCProfileBaseline = 0x01, /**< Baseline profile */ + OMX_VIDEO_AVCProfileMain = 0x02, /**< Main profile */ + OMX_VIDEO_AVCProfileExtended = 0x04, /**< Extended profile */ + OMX_VIDEO_AVCProfileHigh = 0x08, /**< High profile */ + OMX_VIDEO_AVCProfileHigh10 = 0x10, /**< High 10 profile */ + OMX_VIDEO_AVCProfileHigh422 = 0x20, /**< High 4:2:2 profile */ + OMX_VIDEO_AVCProfileHigh444 = 0x40, /**< High 4:4:4 profile */ + OMX_VIDEO_AVCProfileKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_VIDEO_AVCProfileVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + OMX_VIDEO_AVCProfileMax = 0x7FFFFFFF +} OMX_VIDEO_AVCPROFILETYPE; + + +/** + * AVC level types, each level indicates support for various frame sizes, + * bit rates, decoder frame rates. No need + */ +typedef enum OMX_VIDEO_AVCLEVELTYPE { + OMX_VIDEO_AVCLevel1 = 0x01, /**< Level 1 */ + OMX_VIDEO_AVCLevel1b = 0x02, /**< Level 1b */ + OMX_VIDEO_AVCLevel11 = 0x04, /**< Level 1.1 */ + OMX_VIDEO_AVCLevel12 = 0x08, /**< Level 1.2 */ + OMX_VIDEO_AVCLevel13 = 0x10, /**< Level 1.3 */ + OMX_VIDEO_AVCLevel2 = 0x20, /**< Level 2 */ + OMX_VIDEO_AVCLevel21 = 0x40, /**< Level 2.1 */ + OMX_VIDEO_AVCLevel22 = 0x80, /**< Level 2.2 */ + OMX_VIDEO_AVCLevel3 = 0x100, /**< Level 3 */ + OMX_VIDEO_AVCLevel31 = 0x200, /**< Level 3.1 */ + OMX_VIDEO_AVCLevel32 = 0x400, /**< Level 3.2 */ + OMX_VIDEO_AVCLevel4 = 0x800, /**< Level 4 */ + OMX_VIDEO_AVCLevel41 = 0x1000, /**< Level 4.1 */ + OMX_VIDEO_AVCLevel42 = 0x2000, /**< Level 4.2 */ + OMX_VIDEO_AVCLevel5 = 0x4000, /**< Level 5 */ + OMX_VIDEO_AVCLevel51 = 0x8000, /**< Level 5.1 */ + OMX_VIDEO_AVCLevel52 = 0x10000, /**< Level 5.2 */ + OMX_VIDEO_AVCLevelKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_VIDEO_AVCLevelVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + OMX_VIDEO_AVCLevelMax = 0x7FFFFFFF +} OMX_VIDEO_AVCLEVELTYPE; + + +/** + * AVC loop filter modes + * + * OMX_VIDEO_AVCLoopFilterEnable : Enable + * OMX_VIDEO_AVCLoopFilterDisable : Disable + * OMX_VIDEO_AVCLoopFilterDisableSliceBoundary : Disabled on slice boundaries + */ +typedef enum OMX_VIDEO_AVCLOOPFILTERTYPE { + OMX_VIDEO_AVCLoopFilterEnable = 0, + OMX_VIDEO_AVCLoopFilterDisable, + OMX_VIDEO_AVCLoopFilterDisableSliceBoundary, + OMX_VIDEO_AVCLoopFilterKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_VIDEO_AVCLoopFilterVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + OMX_VIDEO_AVCLoopFilterMax = 0x7FFFFFFF +} OMX_VIDEO_AVCLOOPFILTERTYPE; + + +/** + * AVC params + * + * STRUCT MEMBERS: + * nSize : Size of the structure in bytes + * nVersion : OMX specification version information + * nPortIndex : Port that this structure applies to + * nSliceHeaderSpacing : Number of macroblocks between slice header, put + * zero if not used + * nPFrames : Number of P frames between each I frame + * nBFrames : Number of B frames between each I frame + * bUseHadamard : Enable/disable Hadamard transform + * nRefFrames : Max number of reference frames to use for inter + * motion search (1-16) + * nRefIdxTrailing : Pic param set ref frame index (index into ref + * frame buffer of trailing frames list), B frame + * support + * nRefIdxForward : Pic param set ref frame index (index into ref + * frame buffer of forward frames list), B frame + * support + * bEnableUEP : Enable/disable unequal error protection. This + * is only valid of data partitioning is enabled. + * bEnableFMO : Enable/disable flexible macroblock ordering + * bEnableASO : Enable/disable arbitrary slice ordering + * bEnableRS : Enable/disable sending of redundant slices + * eProfile : AVC profile(s) to use + * eLevel : AVC level(s) to use + * nAllowedPictureTypes : Specifies the picture types allowed in the + * bitstream + * bFrameMBsOnly : specifies that every coded picture of the + * coded video sequence is a coded frame + * containing only frame macroblocks + * bMBAFF : Enable/disable switching between frame and + * field macroblocks within a picture + * bEntropyCodingCABAC : Entropy decoding method to be applied for the + * syntax elements for which two descriptors appear + * in the syntax tables + * bWeightedPPrediction : Enable/disable weighted prediction shall not + * be applied to P and SP slices + * nWeightedBipredicitonMode : Default weighted prediction is applied to B + * slices + * bconstIpred : Enable/disable intra prediction + * bDirect8x8Inference : Specifies the method used in the derivation + * process for luma motion vectors for B_Skip, + * B_Direct_16x16 and B_Direct_8x8 as specified + * in subclause 8.4.1.2 of the AVC spec + * bDirectSpatialTemporal : Flag indicating spatial or temporal direct + * mode used in B slice coding (related to + * bDirect8x8Inference) . Spatial direct mode is + * more common and should be the default. + * nCabacInitIdx : Index used to init CABAC contexts + * eLoopFilterMode : Enable/disable loop filter + */ +typedef struct OMX_VIDEO_PARAM_AVCTYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_U32 nSliceHeaderSpacing; + OMX_U32 nPFrames; + OMX_U32 nBFrames; + OMX_BOOL bUseHadamard; + OMX_U32 nRefFrames; + OMX_U32 nRefIdx10ActiveMinus1; + OMX_U32 nRefIdx11ActiveMinus1; + OMX_BOOL bEnableUEP; + OMX_BOOL bEnableFMO; + OMX_BOOL bEnableASO; + OMX_BOOL bEnableRS; + OMX_VIDEO_AVCPROFILETYPE eProfile; + OMX_VIDEO_AVCLEVELTYPE eLevel; + OMX_U32 nAllowedPictureTypes; + OMX_BOOL bFrameMBsOnly; + OMX_BOOL bMBAFF; + OMX_BOOL bEntropyCodingCABAC; + OMX_BOOL bWeightedPPrediction; + OMX_U32 nWeightedBipredicitonMode; + OMX_BOOL bconstIpred ; + OMX_BOOL bDirect8x8Inference; + OMX_BOOL bDirectSpatialTemporal; + OMX_U32 nCabacInitIdc; + OMX_VIDEO_AVCLOOPFILTERTYPE eLoopFilterMode; +} OMX_VIDEO_PARAM_AVCTYPE; + +typedef struct OMX_VIDEO_PARAM_PROFILELEVELTYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_U32 eProfile; /**< type is OMX_VIDEO_AVCPROFILETYPE, OMX_VIDEO_H263PROFILETYPE, + or OMX_VIDEO_MPEG4PROFILETYPE depending on context */ + OMX_U32 eLevel; /**< type is OMX_VIDEO_AVCLEVELTYPE, OMX_VIDEO_H263LEVELTYPE, + or OMX_VIDEO_MPEG4PROFILETYPE depending on context */ + OMX_U32 nProfileIndex; /**< Used to query for individual profile support information, + This parameter is valid only for + OMX_IndexParamVideoProfileLevelQuerySupported index, + For all other indices this parameter is to be ignored. */ +} OMX_VIDEO_PARAM_PROFILELEVELTYPE; + +/** + * Structure for dynamically configuring bitrate mode of a codec. + * + * STRUCT MEMBERS: + * nSize : Size of the struct in bytes + * nVersion : OMX spec version info + * nPortIndex : Port that this struct applies to + * nEncodeBitrate : Target average bitrate to be generated in bps + */ +typedef struct OMX_VIDEO_CONFIG_BITRATETYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_U32 nEncodeBitrate; +} OMX_VIDEO_CONFIG_BITRATETYPE; + +/** + * Defines Encoder Frame Rate setting + * + * STRUCT MEMBERS: + * nSize : Size of the structure in bytes + * nVersion : OMX specification version information + * nPortIndex : Port that this structure applies to + * xEncodeFramerate : Encoding framerate represented in Q16 format + */ +typedef struct OMX_CONFIG_FRAMERATETYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_U32 xEncodeFramerate; /* Q16 format */ +} OMX_CONFIG_FRAMERATETYPE; + +typedef struct OMX_CONFIG_INTRAREFRESHVOPTYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_BOOL IntraRefreshVOP; +} OMX_CONFIG_INTRAREFRESHVOPTYPE; + +typedef struct OMX_CONFIG_MACROBLOCKERRORMAPTYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_U32 nErrMapSize; /* Size of the Error Map in bytes */ + OMX_U8 ErrMap[1]; /* Error map hint */ +} OMX_CONFIG_MACROBLOCKERRORMAPTYPE; + +typedef struct OMX_CONFIG_MBERRORREPORTINGTYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_BOOL bEnabled; +} OMX_CONFIG_MBERRORREPORTINGTYPE; + +typedef struct OMX_PARAM_MACROBLOCKSTYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_U32 nMacroblocks; +} OMX_PARAM_MACROBLOCKSTYPE; + +/** + * AVC Slice Mode modes + * + * OMX_VIDEO_SLICEMODE_AVCDefault : Normal frame encoding, one slice per frame + * OMX_VIDEO_SLICEMODE_AVCMBSlice : NAL mode, number of MBs per frame + * OMX_VIDEO_SLICEMODE_AVCByteSlice : NAL mode, number of bytes per frame + */ +typedef enum OMX_VIDEO_AVCSLICEMODETYPE { + OMX_VIDEO_SLICEMODE_AVCDefault = 0, + OMX_VIDEO_SLICEMODE_AVCMBSlice, + OMX_VIDEO_SLICEMODE_AVCByteSlice, + OMX_VIDEO_SLICEMODE_AVCKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_VIDEO_SLICEMODE_AVCVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + OMX_VIDEO_SLICEMODE_AVCLevelMax = 0x7FFFFFFF +} OMX_VIDEO_AVCSLICEMODETYPE; + +/** + * AVC FMO Slice Mode Params + * + * STRUCT MEMBERS: + * nSize : Size of the structure in bytes + * nVersion : OMX specification version information + * nPortIndex : Port that this structure applies to + * nNumSliceGroups : Specifies the number of slice groups + * nSliceGroupMapType : Specifies the type of slice groups + * eSliceMode : Specifies the type of slice + */ +typedef struct OMX_VIDEO_PARAM_AVCSLICEFMO { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_U8 nNumSliceGroups; + OMX_U8 nSliceGroupMapType; + OMX_VIDEO_AVCSLICEMODETYPE eSliceMode; +} OMX_VIDEO_PARAM_AVCSLICEFMO; + +/** + * AVC IDR Period Configs + * + * STRUCT MEMBERS: + * nSize : Size of the structure in bytes + * nVersion : OMX specification version information + * nPortIndex : Port that this structure applies to + * nIDRPeriod : Specifies periodicity of IDR frames + * nPFrames : Specifies internal of coding Intra frames + */ +typedef struct OMX_VIDEO_CONFIG_AVCINTRAPERIOD { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_U32 nIDRPeriod; + OMX_U32 nPFrames; +} OMX_VIDEO_CONFIG_AVCINTRAPERIOD; + +/** + * AVC NAL Size Configs + * + * STRUCT MEMBERS: + * nSize : Size of the structure in bytes + * nVersion : OMX specification version information + * nPortIndex : Port that this structure applies to + * nNaluBytes : Specifies the NAL unit size + */ +typedef struct OMX_VIDEO_CONFIG_NALSIZE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_U32 nNaluBytes; +} OMX_VIDEO_CONFIG_NALSIZE; + + +/** + * Deinterlace Config + * + * STRUCT MEMBERS: + * nSize : Size of the structure in bytes + * nVersion : OMX specification version information + * nPortIndex : Port that this structure applies to + * nEnable : Specifies to enable deinterlace + */ +typedef struct OMX_VIDEO_CONFIG_DEINTERLACE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_U32 nEnable; +} OMX_VIDEO_CONFIG_DEINTERLACE; + +/** @} */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif +/* File EOF */ + diff --git a/third_party/openmax/include/OMX_VideoExt.h b/third_party/openmax/include/OMX_VideoExt.h new file mode 100644 index 000000000..5bf6fd487 --- /dev/null +++ b/third_party/openmax/include/OMX_VideoExt.h @@ -0,0 +1,166 @@ +/* + * Copyright (c) 2010 The Khronos Group Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject + * to the following conditions: + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +/** OMX_VideoExt.h - OpenMax IL version 1.1.2 + * The OMX_VideoExt header file contains extensions to the + * definitions used by both the application and the component to + * access video items. + */ + +#ifndef OMX_VideoExt_h +#define OMX_VideoExt_h + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* Each OMX header shall include all required header files to allow the + * header to compile without errors. The includes below are required + * for this header file to compile successfully + */ +#include + +/** NALU Formats */ +typedef enum OMX_NALUFORMATSTYPE { + OMX_NaluFormatStartCodes = 1, + OMX_NaluFormatOneNaluPerBuffer = 2, + OMX_NaluFormatOneByteInterleaveLength = 4, + OMX_NaluFormatTwoByteInterleaveLength = 8, + OMX_NaluFormatFourByteInterleaveLength = 16, + OMX_NaluFormatCodingMax = 0x7FFFFFFF +} OMX_NALUFORMATSTYPE; + +/** NAL Stream Format */ +typedef struct OMX_NALSTREAMFORMATTYPE{ + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_NALUFORMATSTYPE eNaluFormat; +} OMX_NALSTREAMFORMATTYPE; + +/** VP8 profiles */ +typedef enum OMX_VIDEO_VP8PROFILETYPE { + OMX_VIDEO_VP8ProfileMain = 0x01, + OMX_VIDEO_VP8ProfileUnknown = 0x6EFFFFFF, + OMX_VIDEO_VP8ProfileMax = 0x7FFFFFFF +} OMX_VIDEO_VP8PROFILETYPE; + +/** VP8 levels */ +typedef enum OMX_VIDEO_VP8LEVELTYPE { + OMX_VIDEO_VP8Level_Version0 = 0x01, + OMX_VIDEO_VP8Level_Version1 = 0x02, + OMX_VIDEO_VP8Level_Version2 = 0x04, + OMX_VIDEO_VP8Level_Version3 = 0x08, + OMX_VIDEO_VP8LevelUnknown = 0x6EFFFFFF, + OMX_VIDEO_VP8LevelMax = 0x7FFFFFFF +} OMX_VIDEO_VP8LEVELTYPE; + +/** VP8 Param */ +typedef struct OMX_VIDEO_PARAM_VP8TYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_VIDEO_VP8PROFILETYPE eProfile; + OMX_VIDEO_VP8LEVELTYPE eLevel; + OMX_U32 nDCTPartitions; + OMX_BOOL bErrorResilientMode; +} OMX_VIDEO_PARAM_VP8TYPE; + +/** Structure for configuring VP8 reference frames */ +typedef struct OMX_VIDEO_VP8REFERENCEFRAMETYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_BOOL bPreviousFrameRefresh; + OMX_BOOL bGoldenFrameRefresh; + OMX_BOOL bAlternateFrameRefresh; + OMX_BOOL bUsePreviousFrame; + OMX_BOOL bUseGoldenFrame; + OMX_BOOL bUseAlternateFrame; +} OMX_VIDEO_VP8REFERENCEFRAMETYPE; + +/** Structure for querying VP8 reference frame type */ +typedef struct OMX_VIDEO_VP8REFERENCEFRAMEINFOTYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_BOOL bIsIntraFrame; + OMX_BOOL bIsGoldenOrAlternateFrame; +} OMX_VIDEO_VP8REFERENCEFRAMEINFOTYPE; + +/** HEVC Profiles */ +typedef enum OMX_VIDEO_HEVCPROFILETYPE { + OMX_VIDEO_HEVCProfileMain = 0x01, + OMX_VIDEO_HEVCProfileMain10 = 0x02, + OMX_VIDEO_HEVCProfileUnknown = 0x6EFFFFFF, + OMX_VIDEO_HEVCProfileMax = 0x7FFFFFFF +} OMX_VIDEO_HEVCPROFILETYPE; + +/** HEVC levels */ +typedef enum OMX_VIDEO_HEVCLEVELTYPE { + OMX_VIDEO_HEVCLevel_Version0 = 0x0, + OMX_VIDEO_HEVCMainTierLevel1 = 0x1, + OMX_VIDEO_HEVCHighTierLevel1 = 0x2, + OMX_VIDEO_HEVCMainTierLevel2 = 0x4, + OMX_VIDEO_HEVCHighTierLevel2 = 0x8, + OMX_VIDEO_HEVCMainTierLevel21 = 0x10, + OMX_VIDEO_HEVCHighTierLevel21 = 0x20, + OMX_VIDEO_HEVCMainTierLevel3 = 0x40, + OMX_VIDEO_HEVCHighTierLevel3 = 0x80, + OMX_VIDEO_HEVCMainTierLevel31 = 0x100, + OMX_VIDEO_HEVCHighTierLevel31 = 0x200, + OMX_VIDEO_HEVCMainTierLevel4 = 0x400, + OMX_VIDEO_HEVCHighTierLevel4 = 0x800, + OMX_VIDEO_HEVCMainTierLevel41 = 0x1000, + OMX_VIDEO_HEVCHighTierLevel41 = 0x2000, + OMX_VIDEO_HEVCMainTierLevel5 = 0x4000, + OMX_VIDEO_HEVCHighTierLevel5 = 0x8000, + OMX_VIDEO_HEVCMainTierLevel51 = 0x10000, + OMX_VIDEO_HEVCHighTierLevel51 = 0x20000, + OMX_VIDEO_HEVCMainTierLevel52 = 0x40000, + OMX_VIDEO_HEVCHighTierLevel52 = 0x80000, + OMX_VIDEO_HEVCMainTierLevel6 = 0x100000, + OMX_VIDEO_HEVCHighTierLevel6 = 0x200000, + OMX_VIDEO_HEVCMainTierLevel61 = 0x400000, + OMX_VIDEO_HEVCHighTierLevel61 = 0x800000, + OMX_VIDEO_HEVCMainTierLevel62 = 0x1000000, + OMX_VIDEO_HEVCLevelUnknown = 0x6EFFFFFF, + OMX_VIDEO_HEVCLevelMax = 0x7FFFFFFF +} OMX_VIDEO_HEVCLEVELTYPE; + +/** HEVC Param */ +typedef struct OMX_VIDEO_PARAM_HEVCTYPE { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_VIDEO_HEVCPROFILETYPE eProfile; + OMX_VIDEO_HEVCLEVELTYPE eLevel; +} OMX_VIDEO_PARAM_HEVCTYPE; + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* OMX_VideoExt_h */ +/* File EOF */ diff --git a/tools/lib/README.md b/tools/lib/README.md index 3cf239d2d..d77eef5ac 100644 --- a/tools/lib/README.md +++ b/tools/lib/README.md @@ -1,6 +1,6 @@ ## LogReader -Route is a class for conveniently accessing all the [logs](/selfdrive/loggerd/) from your routes. The LogReader class reads the non-video logs, i.e. rlog.bz2 and qlog.bz2. There's also a matching FrameReader class for reading the videos. +Route is a class for conveniently accessing all the [logs](/system/loggerd/) from your routes. The LogReader class reads the non-video logs, i.e. rlog.bz2 and qlog.bz2. There's also a matching FrameReader class for reading the videos. ```python from tools.lib.route import Route diff --git a/tools/replay/replay.h b/tools/replay/replay.h index 2c68443df..6788a97d0 100644 --- a/tools/replay/replay.h +++ b/tools/replay/replay.h @@ -64,6 +64,7 @@ public: inline void removeFlag(REPLAY_FLAGS flag) { flags_ &= ~flag; } inline const Route* route() const { return route_.get(); } inline double currentSeconds() const { return double(cur_mono_time_ - route_start_ts_) / 1e9; } + inline QDateTime currentDateTime() const { return route_->datetime().addSecs(currentSeconds()); } inline uint64_t routeStartTime() const { return route_start_ts_; } inline int toSeconds(uint64_t mono_time) const { return (mono_time - route_start_ts_) / 1e9; } inline int totalSeconds() const { return segments_.size() * 60; } diff --git a/tools/replay/route.h b/tools/replay/route.h index 6b78ebad8..86adf6a14 100644 --- a/tools/replay/route.h +++ b/tools/replay/route.h @@ -1,5 +1,6 @@ #pragma once +#include #include #include "tools/replay/framereader.h" @@ -27,6 +28,7 @@ public: Route(const QString &route, const QString &data_dir = {}); bool load(); inline const QString &name() const { return route_.str; } + inline const QDateTime datetime() const { return date_time_; } inline const QString &dir() const { return data_dir_; } inline const RouteIdentifier &identifier() const { return route_; } inline const std::map &segments() const { return segments_; } @@ -41,6 +43,7 @@ protected: RouteIdentifier route_ = {}; QString data_dir_; std::map segments_; + QDateTime date_time_; }; class Segment : public QObject {