mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-08-27 11:13:43 +08:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0b384ea101 | |||
| 8369e11417 | |||
| 26bccbdcc8 |
+1
-1
@@ -28,7 +28,7 @@ Code is automatically checked for style by Github Actions as part of the automat
|
||||
|
||||
We've released a [Model Port guide](https://medium.com/@comma_ai/openpilot-port-guide-for-toyota-models-e5467f4b5fe6) for porting to Toyota/Lexus models.
|
||||
|
||||
If you port openpilot to a substantially new car brand, see this more generic [Brand Port guide](https://medium.com/@comma_ai/how-to-write-a-car-port-for-openpilot-7ce0785eda84). You might also be eligible for a bounty.
|
||||
If you port openpilot to a substantially new car brand, see this more generic [Brand Port guide](https://medium.com/@comma_ai/how-to-write-a-car-port-for-openpilot-7ce0785eda84). You might also be eligible for a bounty.
|
||||
|
||||
## Pull Requests
|
||||
|
||||
|
||||
Vendored
+5
-1
@@ -34,6 +34,9 @@ pipeline {
|
||||
COMMA_JWT = credentials('athena-test-jwt')
|
||||
TEST_DIR = "/data/openpilot"
|
||||
}
|
||||
options {
|
||||
timeout(time: 1, unit: 'HOURS')
|
||||
}
|
||||
|
||||
stages {
|
||||
|
||||
@@ -58,7 +61,7 @@ pipeline {
|
||||
when {
|
||||
not {
|
||||
anyOf {
|
||||
branch 'master-ci'; branch 'devel'; branch 'devel-staging'; branch 'release2'; branch 'release2-staging'; branch 'dashcam'; branch 'dashcam-staging'
|
||||
branch 'master-ci'; branch 'devel'; branch 'devel-staging'; branch 'release2'; branch 'release2-staging'; branch 'dashcam'; branch 'dashcam-staging'; branch 'testing-closet*'
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -133,6 +136,7 @@ pipeline {
|
||||
["test sounds", "nosetests -s selfdrive/test/test_sounds.py"],
|
||||
["test boardd loopback", "nosetests -s selfdrive/boardd/tests/test_boardd_loopback.py"],
|
||||
["test loggerd", "CI=1 python selfdrive/loggerd/tests/test_loggerd.py"],
|
||||
//["test camerad", "CI=1 python selfdrive/camerad/test/test_camerad.py"], // wait for shelf refactor
|
||||
//["test updater", "python installer/updater/test_updater.py"],
|
||||
])
|
||||
}
|
||||
|
||||
@@ -66,6 +66,7 @@ Supported Cars
|
||||
| ----------| ------------------------------| ------------------| -----------------| -------------------| ------------------|
|
||||
| Acura | ILX 2016-18 | AcuraWatch Plus | openpilot | 25mph<sup>1</sup> | 25mph |
|
||||
| Acura | RDX 2016-18 | AcuraWatch Plus | openpilot | 25mph<sup>1</sup> | 12mph |
|
||||
| Acura | RDX 2020 | All | Stock | 0mph | 3mph |
|
||||
| Honda | Accord 2018-20 | All | Stock | 0mph | 3mph |
|
||||
| Honda | Accord Hybrid 2018-20 | All | Stock | 0mph | 3mph |
|
||||
| Honda | Civic Hatchback 2017-19 | Honda Sensing | Stock | 0mph | 12mph |
|
||||
@@ -77,6 +78,7 @@ Supported Cars
|
||||
| Honda | Fit 2018-19 | Honda Sensing | openpilot | 25mph<sup>1</sup> | 12mph |
|
||||
| Honda | HR-V 2019 | Honda Sensing | openpilot | 25mph<sup>1</sup> | 12mph |
|
||||
| Honda | Insight 2019-20 | All | Stock | 0mph | 3mph |
|
||||
| Honda | Inspire 2018 | All | Stock | 0mph | 3mph |
|
||||
| Honda | Odyssey 2018-20 | Honda Sensing | openpilot | 25mph<sup>1</sup> | 0mph |
|
||||
| Honda | Passport 2019 | All | openpilot | 25mph<sup>1</sup> | 12mph |
|
||||
| Honda | Pilot 2016-19 | Honda Sensing | openpilot | 25mph<sup>1</sup> | 12mph |
|
||||
@@ -84,10 +86,11 @@ Supported Cars
|
||||
| Hyundai | Palisade 2020 | All | Stock | 0mph | 0mph |
|
||||
| Hyundai | Sonata 2020 | All | Stock | 0mph | 0mph |
|
||||
| Lexus | CT Hybrid 2017-18 | LSS | Stock<sup>3</sup>| 0mph | 0mph |
|
||||
| Lexus | ES 2019 | All | openpilot | 0mph | 0mph |
|
||||
| Lexus | ES 2019-20 | All | openpilot | 0mph | 0mph |
|
||||
| Lexus | ES Hybrid 2019 | All | openpilot | 0mph | 0mph |
|
||||
| Lexus | IS 2017-2019 | All | Stock | 22mph | 0mph |
|
||||
| Lexus | IS Hybrid 2017 | All | Stock | 0mph | 0mph |
|
||||
| Lexus | NX 2018 | All | Stock<sup>3</sup>| 0mph | 0mph |
|
||||
| Lexus | NX Hybrid 2018 | All | Stock<sup>3</sup>| 0mph | 0mph |
|
||||
| Lexus | RX 2016-18 | All | Stock<sup>3</sup>| 0mph | 0mph |
|
||||
| Lexus | RX 2020 | All | openpilot | 0mph | 0mph |
|
||||
@@ -95,11 +98,11 @@ Supported Cars
|
||||
| Lexus | RX Hybrid 2020 | All | openpilot | 0mph | 0mph |
|
||||
| Toyota | Avalon 2016-18 | TSS-P | Stock<sup>3</sup>| 20mph<sup>1</sup> | 0mph |
|
||||
| Toyota | Camry 2018-20 | All | Stock | 0mph<sup>4</sup> | 0mph |
|
||||
| Toyota | Camry Hybrid 2018-19 | All | Stock | 0mph<sup>4</sup> | 0mph |
|
||||
| Toyota | Camry Hybrid 2018-20 | All | Stock | 0mph<sup>4</sup> | 0mph |
|
||||
| Toyota | C-HR 2017-19 | All | Stock | 0mph | 0mph |
|
||||
| Toyota | C-HR Hybrid 2017-19 | All | Stock | 0mph | 0mph |
|
||||
| Toyota | Corolla 2017-19 | All | Stock<sup>3</sup>| 20mph<sup>1</sup> | 0mph |
|
||||
| Toyota | Corolla 2020 | All | openpilot | 0mph | 0mph |
|
||||
| Toyota | Corolla 2020-21 | All | openpilot | 0mph | 0mph |
|
||||
| Toyota | Corolla Hatchback 2019-20 | All | openpilot | 0mph | 0mph |
|
||||
| Toyota | Corolla Hybrid 2020-21 | All | openpilot | 0mph | 0mph |
|
||||
| Toyota | Highlander 2017-19 | All | Stock<sup>3</sup>| 0mph | 0mph |
|
||||
@@ -107,11 +110,12 @@ Supported Cars
|
||||
| Toyota | Highlander Hybrid 2017-19 | All | Stock<sup>3</sup>| 0mph | 0mph |
|
||||
| Toyota | Highlander Hybrid 2020 | All | openpilot | 0mph | 0mph |
|
||||
| Toyota | Prius 2016-20 | TSS-P | Stock<sup>3</sup>| 0mph | 0mph |
|
||||
| Toyota | Prius 2021 | All | openpilot | 0mph | 0mph |
|
||||
| Toyota | Prius Prime 2017-20 | All | Stock<sup>3</sup>| 0mph | 0mph |
|
||||
| Toyota | Rav4 2016-18 | TSS-P | Stock<sup>3</sup>| 20mph<sup>1</sup> | 0mph |
|
||||
| Toyota | Rav4 2019-20 | All | openpilot | 0mph | 0mph |
|
||||
| Toyota | Rav4 2019-21 | All | openpilot | 0mph | 0mph |
|
||||
| Toyota | Rav4 Hybrid 2016-18 | TSS-P | Stock<sup>3</sup>| 0mph | 0mph |
|
||||
| Toyota | Rav4 Hybrid 2019-20 | All | openpilot | 0mph | 0mph |
|
||||
| Toyota | Rav4 Hybrid 2019-21 | All | openpilot | 0mph | 0mph |
|
||||
| Toyota | Sienna 2018-20 | All | Stock<sup>3</sup>| 0mph | 0mph |
|
||||
|
||||
<sup>1</sup>[Comma Pedal](https://github.com/commaai/openpilot/wiki/comma-pedal) is used to provide stop-and-go capability to some of the openpilot-supported cars that don't currently support stop-and-go. ***NOTE: The Comma Pedal is not officially supported by [comma](https://comma.ai).*** <br />
|
||||
@@ -135,7 +139,7 @@ Community Maintained Cars and Features
|
||||
| Genesis | G70 2018 | All | Stock | 0mph | 0mph |
|
||||
| Genesis | G80 2018 | All | Stock | 0mph | 0mph |
|
||||
| Genesis | G90 2018 | All | Stock | 0mph | 0mph |
|
||||
| GMC | Acadia Denali 2018<sup>2</sup>| Adaptive Cruise | openpilot | 0mph | 7mph |
|
||||
| GMC | Acadia 2018<sup>1</sup> | Adaptive Cruise | openpilot | 0mph | 7mph |
|
||||
| Holden | Astra 2017<sup>1</sup> | Adaptive Cruise | openpilot | 0mph | 7mph |
|
||||
| Hyundai | Elantra 2017-19 | SCC + LKAS | Stock | 19mph | 34mph |
|
||||
| Hyundai | Genesis 2015-16 | SCC + LKAS | Stock | 19mph | 37mph |
|
||||
@@ -143,17 +147,18 @@ Community Maintained Cars and Features
|
||||
| Hyundai | Kona 2020 | SCC + LKAS | Stock | 0mph | 0mph |
|
||||
| Hyundai | Kona EV 2019 | SCC + LKAS | Stock | 0mph | 0mph |
|
||||
| Hyundai | Santa Fe 2019 | All | Stock | 0mph | 0mph |
|
||||
| Hyundai | Sonata 2019 | All | Stock | 0mph | 0mph |
|
||||
| Hyundai | Sonata 2019 | SCC + LKAS | Stock | 0mph | 0mph |
|
||||
| Hyundai | Veloster 2019 | SCC + LKAS | Stock | 5mph | 0mph |
|
||||
| Jeep | Grand Cherokee 2016-18 | Adaptive Cruise | Stock | 0mph | 9mph |
|
||||
| Jeep | Grand Cherokee 2019-20 | Adaptive Cruise | Stock | 0mph | 39mph |
|
||||
| Kia | Forte 2018-19 | SCC + LKAS | Stock | 0mph | 0mph |
|
||||
| Kia | Niro EV 2020 | SCC + LKAS | Stock | 0mph | 0mph |
|
||||
| Kia | Optima 2017 | SCC + LKAS | Stock | 0mph | 32mph |
|
||||
| Kia | Optima 2019 | SCC + LKAS | Stock | 0mph | 0mph |
|
||||
| Kia | Sorento 2018 | SCC + LKAS | Stock | 0mph | 0mph |
|
||||
| Kia | Stinger 2018 | SCC + LKAS | Stock | 0mph | 0mph |
|
||||
| Nissan | Leaf 2018-19 | ProPILOT | Stock | 0mph | 0mph |
|
||||
| Nissan | Rogue 2019 | ProPILOT | Stock | 0mph | 0mph |
|
||||
| Nissan | Leaf 2018-20 | ProPILOT | Stock | 0mph | 0mph |
|
||||
| Nissan | Rogue 2018-19 | ProPILOT | Stock | 0mph | 0mph |
|
||||
| Nissan | X-Trail 2017 | ProPILOT | Stock | 0mph | 0mph |
|
||||
| Subaru | Ascent 2019 | EyeSight | Stock | 0mph | 0mph |
|
||||
| Subaru | Crosstrek 2018-19 | EyeSight | Stock | 0mph | 0mph |
|
||||
@@ -161,8 +166,7 @@ Community Maintained Cars and Features
|
||||
| Subaru | Impreza 2017-19 | EyeSight | Stock | 0mph | 0mph |
|
||||
| Volkswagen| Golf 2015-19 | Driver Assistance | Stock | 0mph | 0mph |
|
||||
|
||||
<sup>1</sup>Requires an [OBD-II car harness](https://comma.ai/shop/products/comma-car-harness) and [community built giraffe](https://github.com/commaai/openpilot/wiki/GM). ***NOTE: disconnecting the ASCM disables Automatic Emergency Braking (AEB).*** <br />
|
||||
<sup>2</sup>Requires a custom connector for the developer [car harness](https://comma.ai/shop/products/car-harness) <br />
|
||||
<sup>1</sup>Requires an [OBD-II car harness](https://comma.ai/shop/products/comma-car-harness) and [community built ASCM harness](https://github.com/commaai/openpilot/wiki/GM#hardware). ***NOTE: disconnecting the ASCM disables Automatic Emergency Braking (AEB).*** <br />
|
||||
|
||||
Although it's not upstream, there's a community of people getting openpilot to run on Tesla's [here](https://tinkla.us/)
|
||||
|
||||
@@ -238,7 +242,6 @@ Many factors can impact the performance of openpilot DM, causing it to be unable
|
||||
* Low light conditions, such as driving at night or in dark tunnels.
|
||||
* Bright light (due to oncoming headlights, direct sunlight, etc.).
|
||||
* The driver's face is partially or completely outside field of view of the driver facing camera.
|
||||
* Right hand driving vehicles.
|
||||
* The driver facing camera is obstructed, covered, or damaged.
|
||||
|
||||
The list above does not represent an exhaustive list of situations that may interfere with proper operation of openpilot components. A driver should not rely on openpilot DM to assess their level of attention.
|
||||
@@ -268,7 +271,7 @@ Safety and Testing
|
||||
|
||||
Testing on PC
|
||||
------
|
||||
For simplified development and experimentation, openpilot runs in the CARLA driving simulator, which allows you to develop openpilot without a car.
|
||||
For simplified development and experimentation, openpilot can be run in the CARLA driving simulator, which allows you to develop openpilot without a car. The whole setup should only take a few minutes.
|
||||
|
||||
Steps:
|
||||
1) Start the CARLA server on first terminal
|
||||
@@ -309,7 +312,7 @@ Directory Structure
|
||||
├── phonelibs # Libraries used on NEOS devices
|
||||
├── pyextra # Libraries used on NEOS devices
|
||||
└── selfdrive # Code needed to drive the car
|
||||
├── assets # Fonts, images, and sounds for UI
|
||||
├── assets # Fonts, images and sounds for UI
|
||||
├── athena # Allows communication with the app
|
||||
├── boardd # Daemon to talk to the board
|
||||
├── camerad # Driver to capture images from the camera sensors
|
||||
|
||||
+85
-63
@@ -1,3 +1,25 @@
|
||||
Version 0.8.0 (2020-11-30)
|
||||
========================
|
||||
* New driving model: fully 3D and improved cut-in detection
|
||||
* UI draws 2 road edges, 4 lanelines and paths in 3D
|
||||
* Major fixes to cut-in detection for openpilot longitudinal
|
||||
* Grey panda is no longer supported, upgrade to comma two or black panda
|
||||
* Lexus NX 2018 support thanks to matt12eagles!
|
||||
* Kia Niro EV 2020 support thanks to nickn17!
|
||||
* Toyota Prius 2021 support thanks to rav4kumar!
|
||||
* Improved lane positioning with uncertain lanelines, wide lanes and exits
|
||||
* Improved lateral control for Prius and Subaru
|
||||
|
||||
Version 0.7.10 (2020-10-29)
|
||||
========================
|
||||
* Grey panda is deprecated, upgrade to comma two or black panda
|
||||
* NEOS update: update to Python 3.8.2 and lower CPU frequency
|
||||
* Improved thermals due to reduced CPU frequency
|
||||
* Update SNPE to 1.41.0
|
||||
* Reduced offroad power consumption
|
||||
* Various system stability improvements
|
||||
* Acura RDX 2020 support thanks to csouers!
|
||||
|
||||
Version 0.7.9 (2020-10-09)
|
||||
========================
|
||||
* Improved car battery power management
|
||||
@@ -29,24 +51,24 @@ Version 0.7.7 (2020-07-20)
|
||||
|
||||
Version 0.7.6.1 (2020-06-16)
|
||||
========================
|
||||
* Hotfix: update kernel on some comma twos (orders #8570-#8680)
|
||||
* Hotfix: update kernel on some comma twos (orders #8570-#8680)
|
||||
|
||||
Version 0.7.6 (2020-06-05)
|
||||
========================
|
||||
* White panda is deprecated, upgrade to comma two or black panda
|
||||
* 2017 Nissan X-Trail, 2018-19 Leaf and 2019 Rogue support thanks to avolmensky!
|
||||
* 2017 Mazda CX-5 support in dashcam mode thanks to Jafaral!
|
||||
* Huge CPU savings in modeld by using thneed!
|
||||
* Lots of code cleanup and refactors
|
||||
* White panda is deprecated, upgrade to comma two or black panda
|
||||
* 2017 Nissan X-Trail, 2018-19 Leaf and 2019 Rogue support thanks to avolmensky!
|
||||
* 2017 Mazda CX-5 support in dashcam mode thanks to Jafaral!
|
||||
* Huge CPU savings in modeld by using thneed!
|
||||
* Lots of code cleanup and refactors
|
||||
|
||||
Version 0.7.5 (2020-05-13)
|
||||
========================
|
||||
* Right-Hand Drive support for both driving and driver monitoring!
|
||||
* New driving model: improved at sharp turns and lead speed estimation
|
||||
* New driver monitoring model: overall improvement on comma two
|
||||
* Driver camera preview in settings to improve mounting position
|
||||
* Added support for many Hyundai, Kia, Genesis models thanks to xx979xx!
|
||||
* Improved lateral tuning for 2020 Toyota Rav 4 (hybrid)
|
||||
* Right-Hand Drive support for both driving and driver monitoring!
|
||||
* New driving model: improved at sharp turns and lead speed estimation
|
||||
* New driver monitoring model: overall improvement on comma two
|
||||
* Driver camera preview in settings to improve mounting position
|
||||
* Added support for many Hyundai, Kia, Genesis models thanks to xx979xx!
|
||||
* Improved lateral tuning for 2020 Toyota Rav 4 (hybrid)
|
||||
|
||||
Version 0.7.4 (2020-03-20)
|
||||
========================
|
||||
@@ -482,96 +504,96 @@ Version 0.3.4 (2017-07-28)
|
||||
|
||||
Version 0.3.3 (2017-06-28)
|
||||
===========================
|
||||
* Improved model trained on more data
|
||||
* Alpha CR-V support thanks to energee and johnnwvs!
|
||||
* Using the opendbc project for DBC files
|
||||
* Minor performance improvements
|
||||
* UI update thanks to pjlao307
|
||||
* Power off button
|
||||
* 6% more torque on the Civic
|
||||
* Improved model trained on more data
|
||||
* Alpha CR-V support thanks to energee and johnnwvs!
|
||||
* Using the opendbc project for DBC files
|
||||
* Minor performance improvements
|
||||
* UI update thanks to pjlao307
|
||||
* Power off button
|
||||
* 6% more torque on the Civic
|
||||
|
||||
Version 0.3.2 (2017-05-22)
|
||||
===========================
|
||||
* Minor stability bugfixes
|
||||
* Added metrics and rear view mirror disable to settings
|
||||
* Update model with more crowdsourced data
|
||||
* Minor stability bugfixes
|
||||
* Added metrics and rear view mirror disable to settings
|
||||
* Update model with more crowdsourced data
|
||||
|
||||
Version 0.3.1 (2017-05-17)
|
||||
===========================
|
||||
* visiond stability bugfix
|
||||
* Add logging for angle and flashing
|
||||
* visiond stability bugfix
|
||||
* Add logging for angle and flashing
|
||||
|
||||
Version 0.3.0 (2017-05-12)
|
||||
===========================
|
||||
* Add CarParams struct to improve the abstraction layer
|
||||
* Refactor visiond IPC to support multiple clients
|
||||
* Add raw GPS and beginning support for navigation
|
||||
* Improve model in visiond using crowdsourced data
|
||||
* Add improved system logging to diagnose instability
|
||||
* Rewrite baseui in React Native
|
||||
* Moved calibration to the cloud
|
||||
* Add CarParams struct to improve the abstraction layer
|
||||
* Refactor visiond IPC to support multiple clients
|
||||
* Add raw GPS and beginning support for navigation
|
||||
* Improve model in visiond using crowdsourced data
|
||||
* Add improved system logging to diagnose instability
|
||||
* Rewrite baseui in React Native
|
||||
* Moved calibration to the cloud
|
||||
|
||||
Version 0.2.9 (2017-03-01)
|
||||
===========================
|
||||
* Retain compatibility with NEOS v1
|
||||
* Retain compatibility with NEOS v1
|
||||
|
||||
Version 0.2.8 (2017-02-27)
|
||||
===========================
|
||||
* Fix bug where frames were being dropped in minute 71
|
||||
* Fix bug where frames were being dropped in minute 71
|
||||
|
||||
Version 0.2.7 (2017-02-08)
|
||||
===========================
|
||||
* Better performance and pictures at night
|
||||
* Fix ptr alignment issue in boardd
|
||||
* Fix brake error light, fix crash if too cold
|
||||
* Better performance and pictures at night
|
||||
* Fix ptr alignment issue in boardd
|
||||
* Fix brake error light, fix crash if too cold
|
||||
|
||||
Version 0.2.6 (2017-01-31)
|
||||
===========================
|
||||
* Fix bug in visiond model execution
|
||||
* Fix bug in visiond model execution
|
||||
|
||||
Version 0.2.5 (2017-01-30)
|
||||
===========================
|
||||
* Fix race condition in manager
|
||||
* Fix race condition in manager
|
||||
|
||||
Version 0.2.4 (2017-01-27)
|
||||
===========================
|
||||
* OnePlus 3T support
|
||||
* Enable installation as NEOS app
|
||||
* Various minor bugfixes
|
||||
* OnePlus 3T support
|
||||
* Enable installation as NEOS app
|
||||
* Various minor bugfixes
|
||||
|
||||
Version 0.2.3 (2017-01-11)
|
||||
===========================
|
||||
* Reduce space usage by 80%
|
||||
* Add better logging
|
||||
* Add Travis CI
|
||||
* Reduce space usage by 80%
|
||||
* Add better logging
|
||||
* Add Travis CI
|
||||
|
||||
Version 0.2.2 (2017-01-10)
|
||||
===========================
|
||||
* Board triggers started signal on CAN messages
|
||||
* Improved autoexposure
|
||||
* Handle out of space, improve upload status
|
||||
* Board triggers started signal on CAN messages
|
||||
* Improved autoexposure
|
||||
* Handle out of space, improve upload status
|
||||
|
||||
Version 0.2.1 (2016-12-14)
|
||||
===========================
|
||||
* Performance improvements, removal of more numpy
|
||||
* Fix boardd process priority
|
||||
* Make counter timer reset on use of steering wheel
|
||||
* Performance improvements, removal of more numpy
|
||||
* Fix boardd process priority
|
||||
* Make counter timer reset on use of steering wheel
|
||||
|
||||
Version 0.2 (2016-12-12)
|
||||
=========================
|
||||
* Car/Radar abstraction layers have shipped, see cereal/car.capnp
|
||||
* controlsd has been refactored
|
||||
* Shipped plant model and testing maneuvers
|
||||
* visiond exits more gracefully now
|
||||
* Hardware encoder in visiond should always init
|
||||
* ui now turns off the screen after 30 seconds
|
||||
* Switch to openpilot release branch for future releases
|
||||
* Added preliminary Docker container to run tests on PC
|
||||
* Car/Radar abstraction layers have shipped, see cereal/car.capnp
|
||||
* controlsd has been refactored
|
||||
* Shipped plant model and testing maneuvers
|
||||
* visiond exits more gracefully now
|
||||
* Hardware encoder in visiond should always init
|
||||
* ui now turns off the screen after 30 seconds
|
||||
* Switch to openpilot release branch for future releases
|
||||
* Added preliminary Docker container to run tests on PC
|
||||
|
||||
Version 0.1 (2016-11-29)
|
||||
=========================
|
||||
* Initial release of openpilot
|
||||
* Adaptive cruise control is working
|
||||
* Lane keep assist is working
|
||||
* Support for Acura ILX 2016 with AcuraWatch Plus
|
||||
* Support for Honda Civic 2016 Touring Edition
|
||||
* Initial release of openpilot
|
||||
* Adaptive cruise control is working
|
||||
* Lane keep assist is working
|
||||
* Support for Acura ILX 2016 with AcuraWatch Plus
|
||||
* Support for Honda Civic 2016 Touring Edition
|
||||
|
||||
+39
-43
@@ -5,8 +5,11 @@ import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import platform
|
||||
import numpy as np
|
||||
from sysconfig import get_paths
|
||||
|
||||
TICI = os.path.isfile('/TICI')
|
||||
Decider('MD5-timestamp')
|
||||
|
||||
AddOption('--test',
|
||||
action='store_true',
|
||||
@@ -27,7 +30,7 @@ if platform.system() == "Darwin":
|
||||
if arch == "aarch64" and TICI:
|
||||
arch = "larch64"
|
||||
|
||||
webcam = bool(ARGUMENTS.get("use_webcam", 0))
|
||||
USE_WEBCAM = os.getenv("USE_WEBCAM") is not None
|
||||
QCOM_REPLAY = arch == "aarch64" and os.getenv("QCOM_REPLAY") is not None
|
||||
|
||||
if arch == "aarch64" or arch == "larch64":
|
||||
@@ -108,6 +111,7 @@ else:
|
||||
]
|
||||
|
||||
rpath = [
|
||||
"phonelibs/snpe/x86_64-linux-clang",
|
||||
"external/tensorflow/lib",
|
||||
"cereal",
|
||||
"selfdrive/common"
|
||||
@@ -126,6 +130,10 @@ else:
|
||||
# change pythonpath to this
|
||||
lenv["PYTHONPATH"] = Dir("#").path
|
||||
|
||||
#Get the path for Python.h for cython linking
|
||||
python_path = get_paths()['include']
|
||||
numpy_path = np.get_include()
|
||||
|
||||
env = Environment(
|
||||
ENV=lenv,
|
||||
CCFLAGS=[
|
||||
@@ -136,6 +144,7 @@ env = Environment(
|
||||
"-Werror",
|
||||
"-Wno-unknown-warning-option",
|
||||
"-Wno-deprecated-register",
|
||||
"-Wno-register",
|
||||
"-Wno-inconsistent-missing-override",
|
||||
"-Wno-c99-designator",
|
||||
"-Wno-reorder-init-list",
|
||||
@@ -156,6 +165,7 @@ env = Environment(
|
||||
"#phonelibs/linux/include",
|
||||
"#phonelibs/snpe/include",
|
||||
"#phonelibs/nanovg",
|
||||
"#selfdrive/boardd",
|
||||
"#selfdrive/common",
|
||||
"#selfdrive/camerad",
|
||||
"#selfdrive/camerad/include",
|
||||
@@ -175,52 +185,17 @@ env = Environment(
|
||||
RPATH=rpath,
|
||||
|
||||
CFLAGS=["-std=gnu11"] + cflags,
|
||||
CXXFLAGS=["-std=c++14"] + cxxflags,
|
||||
CXXFLAGS=["-std=c++1z"] + cxxflags,
|
||||
LIBPATH=libpath + [
|
||||
"#cereal",
|
||||
"#selfdrive/boardd",
|
||||
"#selfdrive/common",
|
||||
"#phonelibs",
|
||||
]
|
||||
],
|
||||
CYTHONCFILESUFFIX=".cpp",
|
||||
tools=["default", "cython"]
|
||||
)
|
||||
|
||||
qt_env = None
|
||||
if arch in ["x86_64", "Darwin", "larch64"]:
|
||||
qt_env = env.Clone()
|
||||
|
||||
if arch == "Darwin":
|
||||
qt_env['QTDIR'] = "/usr/local/opt/qt"
|
||||
QT_BASE = "/usr/local/opt/qt/"
|
||||
qt_dirs = [
|
||||
QT_BASE + "include/",
|
||||
QT_BASE + "include/QtWidgets",
|
||||
QT_BASE + "include/QtGui",
|
||||
QT_BASE + "include/QtCore",
|
||||
QT_BASE + "include/QtDBus",
|
||||
QT_BASE + "include/QtMultimedia",
|
||||
]
|
||||
qt_env["LINKFLAGS"] += ["-F" + QT_BASE + "lib"]
|
||||
else:
|
||||
qt_dirs = [
|
||||
f"/usr/include/{real_arch}-linux-gnu/qt5",
|
||||
f"/usr/include/{real_arch}-linux-gnu/qt5/QtWidgets",
|
||||
f"/usr/include/{real_arch}-linux-gnu/qt5/QtGui",
|
||||
f"/usr/include/{real_arch}-linux-gnu/qt5/QtCore",
|
||||
f"/usr/include/{real_arch}-linux-gnu/qt5/QtDBus",
|
||||
f"/usr/include/{real_arch}-linux-gnu/qt5/QtMultimedia",
|
||||
f"/usr/include/{real_arch}-linux-gnu/qt5/QtGui/5.5.1/QtGui",
|
||||
]
|
||||
|
||||
qt_env.Tool('qt')
|
||||
qt_env['CPPPATH'] += qt_dirs
|
||||
qt_flags = [
|
||||
"-D_REENTRANT",
|
||||
"-DQT_NO_DEBUG",
|
||||
"-DQT_WIDGETS_LIB",
|
||||
"-DQT_GUI_LIB",
|
||||
"-DQT_CORE_LIB"
|
||||
]
|
||||
qt_env['CXXFLAGS'] += qt_flags
|
||||
|
||||
if os.environ.get('SCONS_CACHE'):
|
||||
cache_dir = '/tmp/scons_cache'
|
||||
|
||||
@@ -234,6 +209,9 @@ if os.environ.get('SCONS_CACHE'):
|
||||
if not os.path.isdir(cache_dir_branch) and os.path.isdir(cache_dir):
|
||||
shutil.copytree(cache_dir, cache_dir_branch)
|
||||
cache_dir = cache_dir_branch
|
||||
elif TICI:
|
||||
cache_dir = '/data/scons_cache'
|
||||
|
||||
CacheDir(cache_dir)
|
||||
|
||||
node_interval = 5
|
||||
@@ -257,9 +235,28 @@ def abspath(x):
|
||||
# rpath works elsewhere
|
||||
return x[0].path.rsplit("/", 1)[1][:-3]
|
||||
|
||||
#Cython build enviroment
|
||||
envCython = env.Clone()
|
||||
envCython["CPPPATH"] += [python_path, numpy_path]
|
||||
envCython["CCFLAGS"] += ["-Wno-#warnings", "-Wno-deprecated-declarations"]
|
||||
|
||||
python_libs = []
|
||||
if arch == "Darwin":
|
||||
envCython["LINKFLAGS"]=["-bundle", "-undefined", "dynamic_lookup"]
|
||||
elif arch == "aarch64":
|
||||
envCython["LINKFLAGS"]=["-shared"]
|
||||
|
||||
python_libs.append(os.path.basename(python_path))
|
||||
else:
|
||||
envCython["LINKFLAGS"]=["-pthread", "-shared"]
|
||||
|
||||
envCython["LIBS"] = python_libs
|
||||
|
||||
Export('envCython')
|
||||
|
||||
# still needed for apks
|
||||
zmq = 'zmq'
|
||||
Export('env', 'qt_env', 'arch', 'zmq', 'SHARED', 'webcam', 'QCOM_REPLAY')
|
||||
Export('env', 'arch', 'real_arch', 'zmq', 'SHARED', 'USE_WEBCAM', 'QCOM_REPLAY')
|
||||
|
||||
# cereal and messaging are shared with the system
|
||||
SConscript(['cereal/SConscript'])
|
||||
@@ -312,6 +309,5 @@ SConscript(['selfdrive/ui/SConscript'])
|
||||
if arch != "Darwin":
|
||||
SConscript(['selfdrive/logcatd/SConscript'])
|
||||
|
||||
|
||||
if arch == "x86_64":
|
||||
SConscript(['tools/lib/index_log/SConscript'])
|
||||
|
||||
Binary file not shown.
+3
-2
@@ -2,6 +2,7 @@ Import('env', 'arch', 'zmq', 'cython_dependencies')
|
||||
|
||||
import shutil
|
||||
|
||||
cereal_dir = Dir('.')
|
||||
gen_dir = Dir('gen')
|
||||
messaging_dir = Dir('messaging')
|
||||
|
||||
@@ -9,12 +10,12 @@ messaging_dir = Dir('messaging')
|
||||
env.Command(["gen/c/include/c++.capnp.h", "gen/c/include/java.capnp.h"], [], "mkdir -p " + gen_dir.path + "/c/include && touch $TARGETS")
|
||||
env.Command(['gen/cpp/car.capnp.c++', 'gen/cpp/log.capnp.c++', 'gen/cpp/car.capnp.h', 'gen/cpp/log.capnp.h'],
|
||||
['car.capnp', 'log.capnp'],
|
||||
'capnpc $SOURCES --src-prefix=cereal -o c++:' + gen_dir.path + '/cpp/')
|
||||
f"capnpc --src-prefix={cereal_dir.path} $SOURCES -o c++:{gen_dir.path}/cpp/")
|
||||
|
||||
if shutil.which('capnpc-java'):
|
||||
env.Command(['gen/java/Car.java', 'gen/java/Log.java'],
|
||||
['car.capnp', 'log.capnp'],
|
||||
'capnpc $SOURCES --src-prefix=cereal -o java:' + gen_dir.path + '/java/')
|
||||
f"capnpc $SOURCES --src-prefix={cereal_dir.path} -o java:{gen_dir.path}/java/")
|
||||
|
||||
# TODO: remove non shared cereal and messaging
|
||||
cereal_objects = env.SharedObject([
|
||||
|
||||
+9
-6
@@ -25,7 +25,6 @@ struct CarEvent @0x9b1657f34caf3ad3 {
|
||||
canError @0;
|
||||
steerUnavailable @1;
|
||||
brakeUnavailable @2;
|
||||
gasUnavailable @3;
|
||||
wrongGear @4;
|
||||
doorOpen @5;
|
||||
seatbeltNotLatched @6;
|
||||
@@ -74,7 +73,6 @@ struct CarEvent @0x9b1657f34caf3ad3 {
|
||||
preLaneChangeLeft @57;
|
||||
preLaneChangeRight @58;
|
||||
laneChange @59;
|
||||
invalidGiraffeToyota @60;
|
||||
internetConnectivityNeeded @61;
|
||||
communityFeatureDisallowed @62;
|
||||
lowMemory @63;
|
||||
@@ -95,15 +93,15 @@ struct CarEvent @0x9b1657f34caf3ad3 {
|
||||
startupMaster @78;
|
||||
fcw @79;
|
||||
steerSaturated @80;
|
||||
whitePandaUnsupported @81;
|
||||
belowEngageSpeed @84;
|
||||
noGps @85;
|
||||
focusRecoverActive @86;
|
||||
wrongCruiseMode @87;
|
||||
neosUpdateRequired @88;
|
||||
modeldLagging @89;
|
||||
deviceFalling @90;
|
||||
fanMalfunction @91;
|
||||
cameraMalfunction @92;
|
||||
|
||||
gasUnavailableDEPRECATED @3;
|
||||
dataNeededDEPRECATED @16;
|
||||
modelCommIssueDEPRECATED @27;
|
||||
ipasOverrideDEPRECATED @33;
|
||||
@@ -112,8 +110,13 @@ struct CarEvent @0x9b1657f34caf3ad3 {
|
||||
driverMonitorOffDEPRECATED @42;
|
||||
calibrationProgressDEPRECATED @47;
|
||||
invalidGiraffeHondaDEPRECATED @49;
|
||||
invalidGiraffeToyotaDEPRECATED @60;
|
||||
whitePandaUnsupportedDEPRECATED @81;
|
||||
startupGreyPandaDEPRECATED @82;
|
||||
canErrorPersistentDEPRECATED @83;
|
||||
startupWhitePandaDEPRECATED @82;
|
||||
focusRecoverActiveDEPRECATED @86;
|
||||
neosUpdateRequiredDEPRECATED @88;
|
||||
modelLagWarningDEPRECATED @93;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+16
-2
@@ -571,7 +571,7 @@ struct ControlsState @0x97ff69c53601abf1 {
|
||||
|
||||
enum AlertStatus {
|
||||
normal @0; # low priority alert for user's convenience
|
||||
userPrompt @1; # mid piority alert that might require user intervention
|
||||
userPrompt @1; # mid priority alert that might require user intervention
|
||||
critical @2; # high priority alert that needs immediate user intervention
|
||||
}
|
||||
|
||||
@@ -628,6 +628,8 @@ struct ModelData {
|
||||
frameAge @12 :UInt32;
|
||||
frameDropPerc @13 :Float32;
|
||||
timestampEof @9 :UInt64;
|
||||
modelExecutionTime @14 :Float32;
|
||||
rawPred @15 :Data;
|
||||
|
||||
path @1 :PathData;
|
||||
leftLane @2 :PathData;
|
||||
@@ -694,6 +696,8 @@ struct ModelDataV2 {
|
||||
frameAge @1 :UInt32;
|
||||
frameDropPerc @2 :Float32;
|
||||
timestampEof @3 :UInt64;
|
||||
modelExecutionTime @15 :Float32;
|
||||
rawPred @16 :Data;
|
||||
|
||||
position @4 :XYZTData;
|
||||
orientation @5 :XYZTData;
|
||||
@@ -701,7 +705,9 @@ struct ModelDataV2 {
|
||||
orientationRate @7 :XYZTData;
|
||||
laneLines @8 :List(XYZTData);
|
||||
laneLineProbs @9 :List(Float32);
|
||||
laneLineStds @13 :List(Float32);
|
||||
roadEdges @10 :List(XYZTData);
|
||||
roadEdgeStds @14 :List(Float32);
|
||||
leads @11 :List(LeadDataV2);
|
||||
|
||||
meta @12 :MetaData;
|
||||
@@ -754,6 +760,8 @@ struct EncodeIndex {
|
||||
segmentId @4 :UInt32;
|
||||
# index into camera file in segment in encode order
|
||||
segmentIdEncode @5 :UInt32;
|
||||
timestampSof @6 :UInt64;
|
||||
timestampEof @7 :UInt64;
|
||||
|
||||
enum Type {
|
||||
bigBoxLossless @0; # rcamera.mkv
|
||||
@@ -1943,6 +1951,9 @@ struct OrbKeyFrame {
|
||||
|
||||
struct DriverState {
|
||||
frameId @0 :UInt32;
|
||||
modelExecutionTime @14 :Float32;
|
||||
rawPred @15 :Data;
|
||||
|
||||
descriptorDEPRECATED @1 :List(Float32);
|
||||
stdDEPRECATED @2 :Float32;
|
||||
faceOrientation @3 :List(Float32);
|
||||
@@ -1983,6 +1994,7 @@ struct Boot {
|
||||
wallTimeNanos @0 :UInt64;
|
||||
lastKmsg @1 :Data;
|
||||
lastPmsg @2 :Data;
|
||||
launchLog @3 :Text;
|
||||
}
|
||||
|
||||
struct LiveParametersData {
|
||||
@@ -2118,11 +2130,13 @@ struct Event {
|
||||
thumbnail @66: Thumbnail;
|
||||
carEvents @68: List(Car.CarEvent);
|
||||
carParams @69: Car.CarParams;
|
||||
frontFrame @70: FrameData;
|
||||
frontFrame @70: FrameData; # driver facing camera
|
||||
dMonitoringState @71: DMonitoringState;
|
||||
liveLocationKalman @72 :LiveLocationKalman;
|
||||
sentinel @73 :Sentinel;
|
||||
wideFrame @74: FrameData;
|
||||
modelV2 @75 :ModelDataV2;
|
||||
frontEncodeIdx @76 :EncodeIndex; # driver facing camera
|
||||
wideEncodeIdx @77 :EncodeIndex;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,9 +140,9 @@ cdef class PubSocket:
|
||||
else:
|
||||
raise MessagingError
|
||||
|
||||
def send(self, string data):
|
||||
def send(self, bytes data):
|
||||
length = len(data)
|
||||
r = self.socket.send(<char*>data.c_str(), length)
|
||||
r = self.socket.send(<char*>data, length)
|
||||
|
||||
if r != length:
|
||||
if errno.errno == errno.EADDRINUSE:
|
||||
|
||||
@@ -31,7 +31,7 @@ class BuildExtWithoutPlatformSuffix(build_ext):
|
||||
|
||||
|
||||
sourcefiles = ['messaging_pyx.pyx']
|
||||
extra_compile_args = ["-std=c++14", "-Wno-nullability-completeness"]
|
||||
extra_compile_args = ["-std=c++1z", "-Wno-nullability-completeness"]
|
||||
libraries = ['zmq']
|
||||
ARCH = subprocess.check_output(["uname", "-m"], encoding='utf8').rstrip() # pylint: disable=unexpected-keyword-arg
|
||||
|
||||
|
||||
@@ -114,6 +114,7 @@ int msgq_new_queue(msgq_queue_t * q, const char * path, size_t size){
|
||||
|
||||
int rc = ftruncate(fd, size + sizeof(msgq_header_t));
|
||||
if (rc < 0){
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
char * mem = (char*)mmap(NULL, size + sizeof(msgq_header_t), PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
|
||||
|
||||
+3
-5
@@ -1,6 +1,4 @@
|
||||
Import('env', 'cython_dependencies')
|
||||
Import('envCython')
|
||||
|
||||
# Build cython clock module
|
||||
env.Command(['common_pyx.so', 'clock.cpp'],
|
||||
cython_dependencies + ['common_pyx_setup.py', 'clock.pyx'],
|
||||
"cd common && python3 common_pyx_setup.py build_ext --inplace")
|
||||
envCython.Program('clock.so', 'clock.pyx')
|
||||
envCython.Program('params_pyx.so', 'params_pyx.pyx')
|
||||
|
||||
+11
-3
@@ -31,9 +31,17 @@ def start_offroad():
|
||||
system("am start -n ai.comma.plus.offroad/.MainActivity")
|
||||
|
||||
def set_package_permissions():
|
||||
pm_grant("ai.comma.plus.offroad", "android.permission.ACCESS_FINE_LOCATION")
|
||||
pm_grant("ai.comma.plus.offroad", "android.permission.READ_PHONE_STATE")
|
||||
pm_grant("ai.comma.plus.offroad", "android.permission.READ_EXTERNAL_STORAGE")
|
||||
try:
|
||||
output = subprocess.check_output(['dumpsys', 'package', 'ai.comma.plus.offroad'], encoding="utf-8")
|
||||
given_permissions = output.split("runtime permissions")[1]
|
||||
except Exception:
|
||||
given_permissions = ""
|
||||
|
||||
wanted_permissions = ["ACCESS_FINE_LOCATION", "READ_PHONE_STATE", "READ_EXTERNAL_STORAGE"]
|
||||
for permission in wanted_permissions:
|
||||
if permission not in given_permissions:
|
||||
pm_grant("ai.comma.plus.offroad", "android.permission."+permission)
|
||||
|
||||
appops_set("ai.comma.plus.offroad", "SU", "allow")
|
||||
appops_set("ai.comma.plus.offroad", "WIFI_SCAN", "allow")
|
||||
|
||||
|
||||
@@ -4,7 +4,5 @@ BASEDIR = os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__
|
||||
from common.hardware import PC
|
||||
if PC:
|
||||
PERSIST = os.path.join(BASEDIR, "persist")
|
||||
PARAMS = os.path.join(BASEDIR, "persist", "params")
|
||||
else:
|
||||
PERSIST = "/persist"
|
||||
PARAMS = "/data/params"
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# distutils: language = c++
|
||||
# cython: language_level = 3
|
||||
from posix.time cimport clock_gettime, timespec, CLOCK_MONOTONIC_RAW, clockid_t
|
||||
|
||||
IF UNAME_SYSNAME == "Darwin":
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
from distutils.core import Extension, setup # pylint: disable=import-error,no-name-in-module
|
||||
from Cython.Build import cythonize
|
||||
|
||||
from common.cython_hacks import BuildExtWithoutPlatformSuffix
|
||||
|
||||
sourcefiles = ['clock.pyx']
|
||||
extra_compile_args = ["-std=c++11"]
|
||||
|
||||
setup(name='Common',
|
||||
cmdclass={'build_ext': BuildExtWithoutPlatformSuffix},
|
||||
ext_modules=cythonize(
|
||||
Extension(
|
||||
"common_pyx",
|
||||
language="c++",
|
||||
sources=sourcefiles,
|
||||
extra_compile_args=extra_compile_args,
|
||||
)
|
||||
),
|
||||
nthreads=4,
|
||||
)
|
||||
@@ -44,7 +44,7 @@ def compile_code(name, c_code, c_header, directory, cflags="", libraries=None):
|
||||
ffibuilder = FFI()
|
||||
ffibuilder.set_source(name, c_code, source_extension='.cpp', libraries=libraries)
|
||||
ffibuilder.cdef(c_header)
|
||||
os.environ['OPT'] = "-fwrapv -O2 -DNDEBUG -std=c++11"
|
||||
os.environ['OPT'] = "-fwrapv -O2 -DNDEBUG -std=c++1z"
|
||||
os.environ['CFLAGS'] = cflags
|
||||
ffibuilder.compile(verbose=True, debug=False, tmpdir=directory)
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ import serial
|
||||
|
||||
from common.hardware_base import HardwareBase
|
||||
from cereal import log
|
||||
import subprocess
|
||||
|
||||
|
||||
NetworkType = log.ThermalData.NetworkType
|
||||
@@ -40,7 +41,7 @@ class Tici(HardwareBase):
|
||||
return ""
|
||||
|
||||
def reboot(self, reason=None):
|
||||
print("REBOOT!")
|
||||
subprocess.check_output(["sudo", "reboot"])
|
||||
|
||||
def get_network_type(self):
|
||||
return NetworkType.wifi
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
Import('env', 'cython_dependencies')
|
||||
|
||||
env.Command(['simple_kalman_impl.so'],
|
||||
cython_dependencies + ['simple_kalman_impl.pyx', 'simple_kalman_impl.pxd', 'simple_kalman_setup.py'],
|
||||
"cd common/kalman && python3 simple_kalman_setup.py build_ext --inplace")
|
||||
Import('envCython')
|
||||
|
||||
envCython.Program('simple_kalman_impl.so', 'simple_kalman_impl.pyx')
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# cython: language_level = 3
|
||||
|
||||
cdef class KF1D:
|
||||
cdef public:
|
||||
double x0_0
|
||||
@@ -13,4 +15,4 @@ cdef class KF1D:
|
||||
double A_K_0
|
||||
double A_K_1
|
||||
double A_K_2
|
||||
double A_K_3
|
||||
double A_K_3
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# distutils: language = c++
|
||||
# cython: language_level=3
|
||||
|
||||
cdef class KF1D:
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
from distutils.core import Extension, setup
|
||||
|
||||
from Cython.Build import cythonize
|
||||
|
||||
from common.cython_hacks import BuildExtWithoutPlatformSuffix
|
||||
|
||||
setup(name='Simple Kalman Implementation',
|
||||
cmdclass={'build_ext': BuildExtWithoutPlatformSuffix},
|
||||
ext_modules=cythonize(Extension("simple_kalman_impl", ["simple_kalman_impl.pyx"])))
|
||||
@@ -82,3 +82,6 @@ kf = KF1D(x0=[[x0_0], [x1_0]],
|
||||
kf_speed = timeit.timeit("kf.update(1234)", setup=setup, number=10000)
|
||||
kf_old_speed = timeit.timeit("kf_old.update(1234)", setup=setup, number=10000)
|
||||
self.assertTrue(kf_speed < kf_old_speed / 4)
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Executable → Regular
+4
-409
@@ -1,409 +1,4 @@
|
||||
#!/usr/bin/env python3
|
||||
"""ROS has a parameter server, we have files.
|
||||
|
||||
The parameter store is a persistent key value store, implemented as a directory with a writer lock.
|
||||
On Android, we store params under params_dir = /data/params. The writer lock is a file
|
||||
"<params_dir>/.lock" taken using flock(), and data is stored in a directory symlinked to by
|
||||
"<params_dir>/d".
|
||||
|
||||
Each key, value pair is stored as a file with named <key> with contents <value>, located in
|
||||
<params_dir>/d/<key>
|
||||
|
||||
Readers of a single key can just open("<params_dir>/d/<key>") and read the file contents.
|
||||
Readers who want a consistent snapshot of multiple keys should take the lock.
|
||||
|
||||
Writers should take the lock before modifying anything. Writers should also leave the DB in a
|
||||
consistent state after a crash. The implementation below does this by copying all params to a temp
|
||||
directory <params_dir>/<tmp>, then atomically symlinking <params_dir>/<d> to <params_dir>/<tmp>
|
||||
before deleting the old <params_dir>/<d> directory.
|
||||
|
||||
Writers that only modify a single key can simply take the lock, then swap the corresponding value
|
||||
file in place without messing with <params_dir>/d.
|
||||
"""
|
||||
import time
|
||||
import os
|
||||
import errno
|
||||
import shutil
|
||||
import fcntl
|
||||
import tempfile
|
||||
import threading
|
||||
from enum import Enum
|
||||
from common.basedir import PARAMS
|
||||
|
||||
|
||||
def mkdirs_exists_ok(path):
|
||||
try:
|
||||
os.makedirs(path)
|
||||
except OSError:
|
||||
if not os.path.isdir(path):
|
||||
raise
|
||||
|
||||
|
||||
class TxType(Enum):
|
||||
PERSISTENT = 1
|
||||
CLEAR_ON_MANAGER_START = 2
|
||||
CLEAR_ON_PANDA_DISCONNECT = 3
|
||||
|
||||
|
||||
class UnknownKeyName(Exception):
|
||||
pass
|
||||
|
||||
|
||||
keys = {
|
||||
"AccessToken": [TxType.CLEAR_ON_MANAGER_START],
|
||||
"AthenadPid": [TxType.PERSISTENT],
|
||||
"CalibrationParams": [TxType.PERSISTENT],
|
||||
"CarBatteryCapacity": [TxType.PERSISTENT],
|
||||
"CarParams": [TxType.CLEAR_ON_MANAGER_START, TxType.CLEAR_ON_PANDA_DISCONNECT],
|
||||
"CarParamsCache": [TxType.CLEAR_ON_MANAGER_START, TxType.CLEAR_ON_PANDA_DISCONNECT],
|
||||
"CarVin": [TxType.CLEAR_ON_MANAGER_START, TxType.CLEAR_ON_PANDA_DISCONNECT],
|
||||
"CommunityFeaturesToggle": [TxType.PERSISTENT],
|
||||
"CompletedTrainingVersion": [TxType.PERSISTENT],
|
||||
"DisablePowerDown": [TxType.PERSISTENT],
|
||||
"DisableUpdates": [TxType.PERSISTENT],
|
||||
"DoUninstall": [TxType.CLEAR_ON_MANAGER_START],
|
||||
"DongleId": [TxType.PERSISTENT],
|
||||
"GitBranch": [TxType.PERSISTENT],
|
||||
"GitCommit": [TxType.PERSISTENT],
|
||||
"GitRemote": [TxType.PERSISTENT],
|
||||
"GithubSshKeys": [TxType.PERSISTENT],
|
||||
"HasAcceptedTerms": [TxType.PERSISTENT],
|
||||
"HasCompletedSetup": [TxType.PERSISTENT],
|
||||
"IsDriverViewEnabled": [TxType.CLEAR_ON_MANAGER_START],
|
||||
"IsLdwEnabled": [TxType.PERSISTENT],
|
||||
"IsMetric": [TxType.PERSISTENT],
|
||||
"IsOffroad": [TxType.CLEAR_ON_MANAGER_START],
|
||||
"IsRHD": [TxType.PERSISTENT],
|
||||
"IsTakingSnapshot": [TxType.CLEAR_ON_MANAGER_START],
|
||||
"IsUpdateAvailable": [TxType.CLEAR_ON_MANAGER_START],
|
||||
"IsUploadRawEnabled": [TxType.PERSISTENT],
|
||||
"LastAthenaPingTime": [TxType.PERSISTENT],
|
||||
"LastUpdateTime": [TxType.PERSISTENT],
|
||||
"LastUpdateException": [TxType.PERSISTENT],
|
||||
"LiveParameters": [TxType.PERSISTENT],
|
||||
"OpenpilotEnabledToggle": [TxType.PERSISTENT],
|
||||
"LaneChangeEnabled": [TxType.PERSISTENT],
|
||||
"PandaFirmware": [TxType.CLEAR_ON_MANAGER_START, TxType.CLEAR_ON_PANDA_DISCONNECT],
|
||||
"PandaFirmwareHex": [TxType.CLEAR_ON_MANAGER_START, TxType.CLEAR_ON_PANDA_DISCONNECT],
|
||||
"PandaDongleId": [TxType.CLEAR_ON_MANAGER_START, TxType.CLEAR_ON_PANDA_DISCONNECT],
|
||||
"Passive": [TxType.PERSISTENT],
|
||||
"RecordFront": [TxType.PERSISTENT],
|
||||
"ReleaseNotes": [TxType.PERSISTENT],
|
||||
"ShouldDoUpdate": [TxType.CLEAR_ON_MANAGER_START],
|
||||
"SubscriberInfo": [TxType.PERSISTENT],
|
||||
"TermsVersion": [TxType.PERSISTENT],
|
||||
"TrainingVersion": [TxType.PERSISTENT],
|
||||
"UpdateAvailable": [TxType.CLEAR_ON_MANAGER_START],
|
||||
"UpdateFailedCount": [TxType.CLEAR_ON_MANAGER_START],
|
||||
"Version": [TxType.PERSISTENT],
|
||||
"Offroad_ChargeDisabled": [TxType.CLEAR_ON_MANAGER_START, TxType.CLEAR_ON_PANDA_DISCONNECT],
|
||||
"Offroad_ConnectivityNeeded": [TxType.CLEAR_ON_MANAGER_START],
|
||||
"Offroad_ConnectivityNeededPrompt": [TxType.CLEAR_ON_MANAGER_START],
|
||||
"Offroad_TemperatureTooHigh": [TxType.CLEAR_ON_MANAGER_START],
|
||||
"Offroad_PandaFirmwareMismatch": [TxType.CLEAR_ON_MANAGER_START, TxType.CLEAR_ON_PANDA_DISCONNECT],
|
||||
"Offroad_InvalidTime": [TxType.CLEAR_ON_MANAGER_START],
|
||||
"Offroad_IsTakingSnapshot": [TxType.CLEAR_ON_MANAGER_START],
|
||||
"Offroad_NeosUpdate": [TxType.CLEAR_ON_MANAGER_START],
|
||||
"Offroad_UpdateFailed": [TxType.CLEAR_ON_MANAGER_START],
|
||||
}
|
||||
|
||||
|
||||
def fsync_dir(path):
|
||||
fd = os.open(path, os.O_RDONLY)
|
||||
try:
|
||||
os.fsync(fd)
|
||||
finally:
|
||||
os.close(fd)
|
||||
|
||||
|
||||
class FileLock():
|
||||
def __init__(self, path, create, lock_ex):
|
||||
self._path = path
|
||||
self._create = create
|
||||
self._fd = None
|
||||
self._lock_ex = lock_ex
|
||||
|
||||
def acquire(self):
|
||||
self._fd = os.open(self._path, os.O_CREAT if self._create else 0)
|
||||
fcntl.flock(self._fd, fcntl.LOCK_EX if self._lock_ex else fcntl.LOCK_SH)
|
||||
|
||||
def release(self):
|
||||
if self._fd is not None:
|
||||
os.close(self._fd)
|
||||
self._fd = None
|
||||
|
||||
|
||||
class DBAccessor():
|
||||
def __init__(self, path):
|
||||
self._path = path
|
||||
self._vals = None
|
||||
|
||||
def keys(self):
|
||||
self._check_entered()
|
||||
return self._vals.keys()
|
||||
|
||||
def get(self, key):
|
||||
self._check_entered()
|
||||
|
||||
if self._vals is None:
|
||||
return None
|
||||
|
||||
try:
|
||||
return self._vals[key]
|
||||
except KeyError:
|
||||
return None
|
||||
|
||||
def _get_lock(self, create, lock_ex):
|
||||
lock = FileLock(os.path.join(self._path, ".lock"), create, lock_ex)
|
||||
lock.acquire()
|
||||
return lock
|
||||
|
||||
def _read_values_locked(self):
|
||||
"""Callers should hold a lock while calling this method."""
|
||||
vals = {}
|
||||
try:
|
||||
data_path = self._data_path()
|
||||
keys = os.listdir(data_path)
|
||||
for key in keys:
|
||||
with open(os.path.join(data_path, key), "rb") as f:
|
||||
vals[key] = f.read()
|
||||
except (OSError, IOError) as e:
|
||||
# Either the DB hasn't been created yet, or somebody wrote a bug and left the DB in an
|
||||
# inconsistent state. Either way, return empty.
|
||||
if e.errno == errno.ENOENT:
|
||||
return {}
|
||||
|
||||
return vals
|
||||
|
||||
def _data_path(self):
|
||||
return os.path.join(self._path, "d")
|
||||
|
||||
def _check_entered(self):
|
||||
if self._vals is None:
|
||||
raise Exception("Must call __enter__ before using DB")
|
||||
|
||||
|
||||
class DBReader(DBAccessor):
|
||||
def __enter__(self):
|
||||
try:
|
||||
lock = self._get_lock(False, False)
|
||||
except OSError as e:
|
||||
# Do not create lock if it does not exist.
|
||||
if e.errno == errno.ENOENT:
|
||||
self._vals = {}
|
||||
return self
|
||||
|
||||
try:
|
||||
# Read everything.
|
||||
self._vals = self._read_values_locked()
|
||||
return self
|
||||
finally:
|
||||
lock.release()
|
||||
|
||||
def __exit__(self, exc_type, exc_value, traceback):
|
||||
pass
|
||||
|
||||
|
||||
class DBWriter(DBAccessor):
|
||||
def __init__(self, path):
|
||||
super(DBWriter, self).__init__(path)
|
||||
self._lock = None
|
||||
self._prev_umask = None
|
||||
|
||||
def put(self, key, value):
|
||||
self._vals[key] = value
|
||||
|
||||
def delete(self, key):
|
||||
self._vals.pop(key, None)
|
||||
|
||||
def __enter__(self):
|
||||
mkdirs_exists_ok(self._path)
|
||||
|
||||
# Make sure we can write and that permissions are correct.
|
||||
self._prev_umask = os.umask(0)
|
||||
|
||||
try:
|
||||
os.chmod(self._path, 0o777)
|
||||
self._lock = self._get_lock(True, True)
|
||||
self._vals = self._read_values_locked()
|
||||
except Exception:
|
||||
os.umask(self._prev_umask)
|
||||
self._prev_umask = None
|
||||
raise
|
||||
|
||||
return self
|
||||
|
||||
def __exit__(self, exc_type, exc_value, traceback):
|
||||
self._check_entered()
|
||||
|
||||
try:
|
||||
# data_path refers to the externally used path to the params. It is a symlink.
|
||||
# old_data_path is the path currently pointed to by data_path.
|
||||
# tempdir_path is a path where the new params will go, which the new data path will point to.
|
||||
# new_data_path is a temporary symlink that will atomically overwrite data_path.
|
||||
#
|
||||
# The current situation is:
|
||||
# data_path -> old_data_path
|
||||
# We're going to write params data to tempdir_path
|
||||
# tempdir_path -> params data
|
||||
# Then point new_data_path to tempdir_path
|
||||
# new_data_path -> tempdir_path
|
||||
# Then atomically overwrite data_path with new_data_path
|
||||
# data_path -> tempdir_path
|
||||
old_data_path = None
|
||||
new_data_path = None
|
||||
tempdir_path = tempfile.mkdtemp(prefix=".tmp", dir=self._path)
|
||||
|
||||
try:
|
||||
# Write back all keys.
|
||||
os.chmod(tempdir_path, 0o777)
|
||||
for k, v in self._vals.items():
|
||||
with open(os.path.join(tempdir_path, k), "wb") as f:
|
||||
f.write(v)
|
||||
f.flush()
|
||||
os.fsync(f.fileno())
|
||||
fsync_dir(tempdir_path)
|
||||
|
||||
data_path = self._data_path()
|
||||
try:
|
||||
old_data_path = os.path.join(self._path, os.readlink(data_path))
|
||||
except (OSError, IOError):
|
||||
# NOTE(mgraczyk): If other DB implementations have bugs, this could cause
|
||||
# copies to be left behind, but we still want to overwrite.
|
||||
pass
|
||||
|
||||
new_data_path = "{}.link".format(tempdir_path)
|
||||
os.symlink(os.path.basename(tempdir_path), new_data_path)
|
||||
os.rename(new_data_path, data_path)
|
||||
fsync_dir(self._path)
|
||||
finally:
|
||||
# If the rename worked, we can delete the old data. Otherwise delete the new one.
|
||||
success = new_data_path is not None and os.path.exists(data_path) and (
|
||||
os.readlink(data_path) == os.path.basename(tempdir_path))
|
||||
|
||||
if success:
|
||||
if old_data_path is not None:
|
||||
shutil.rmtree(old_data_path)
|
||||
else:
|
||||
shutil.rmtree(tempdir_path)
|
||||
|
||||
# Regardless of what happened above, there should be no link at new_data_path.
|
||||
if new_data_path is not None and os.path.islink(new_data_path):
|
||||
os.remove(new_data_path)
|
||||
finally:
|
||||
os.umask(self._prev_umask)
|
||||
self._prev_umask = None
|
||||
|
||||
# Always release the lock.
|
||||
self._lock.release()
|
||||
self._lock = None
|
||||
|
||||
|
||||
def read_db(params_path, key):
|
||||
path = "%s/d/%s" % (params_path, key)
|
||||
try:
|
||||
with open(path, "rb") as f:
|
||||
return f.read()
|
||||
except IOError:
|
||||
return None
|
||||
|
||||
|
||||
def write_db(params_path, key, value):
|
||||
if isinstance(value, str):
|
||||
value = value.encode('utf8')
|
||||
|
||||
prev_umask = os.umask(0)
|
||||
lock = FileLock(params_path + "/.lock", True, True)
|
||||
lock.acquire()
|
||||
|
||||
try:
|
||||
tmp_path = tempfile.NamedTemporaryFile(mode="wb", prefix=".tmp", dir=params_path, delete=False)
|
||||
with tmp_path as f:
|
||||
f.write(value)
|
||||
f.flush()
|
||||
os.fsync(f.fileno())
|
||||
os.chmod(tmp_path.name, 0o666)
|
||||
|
||||
path = "%s/d/%s" % (params_path, key)
|
||||
os.rename(tmp_path.name, path)
|
||||
fsync_dir(os.path.dirname(path))
|
||||
finally:
|
||||
os.umask(prev_umask)
|
||||
lock.release()
|
||||
|
||||
|
||||
class Params():
|
||||
def __init__(self, db=PARAMS):
|
||||
self.db = db
|
||||
|
||||
# create the database if it doesn't exist...
|
||||
if not os.path.exists(self.db + "/d"):
|
||||
with self.transaction(write=True):
|
||||
pass
|
||||
|
||||
def clear_all(self):
|
||||
shutil.rmtree(self.db, ignore_errors=True)
|
||||
with self.transaction(write=True):
|
||||
pass
|
||||
|
||||
def transaction(self, write=False):
|
||||
if write:
|
||||
return DBWriter(self.db)
|
||||
else:
|
||||
return DBReader(self.db)
|
||||
|
||||
def _clear_keys_with_type(self, tx_type):
|
||||
with self.transaction(write=True) as txn:
|
||||
for key in keys:
|
||||
if tx_type in keys[key]:
|
||||
txn.delete(key)
|
||||
|
||||
def manager_start(self):
|
||||
self._clear_keys_with_type(TxType.CLEAR_ON_MANAGER_START)
|
||||
|
||||
def panda_disconnect(self):
|
||||
self._clear_keys_with_type(TxType.CLEAR_ON_PANDA_DISCONNECT)
|
||||
|
||||
def delete(self, key):
|
||||
with self.transaction(write=True) as txn:
|
||||
txn.delete(key)
|
||||
|
||||
def get(self, key, block=False, encoding=None):
|
||||
if key not in keys:
|
||||
raise UnknownKeyName(key)
|
||||
|
||||
while 1:
|
||||
ret = read_db(self.db, key)
|
||||
if not block or ret is not None:
|
||||
break
|
||||
# is polling really the best we can do?
|
||||
time.sleep(0.05)
|
||||
|
||||
if ret is not None and encoding is not None:
|
||||
ret = ret.decode(encoding)
|
||||
|
||||
return ret
|
||||
|
||||
def put(self, key, dat):
|
||||
"""
|
||||
Warning: This function blocks until the param is written to disk!
|
||||
In very rare cases this can take over a second, and your code will hang.
|
||||
|
||||
Use the put_nonblocking helper function in time sensitive code, but
|
||||
in general try to avoid writing params as much as possible.
|
||||
"""
|
||||
|
||||
if key not in keys:
|
||||
raise UnknownKeyName(key)
|
||||
|
||||
write_db(self.db, key, dat)
|
||||
|
||||
|
||||
def put_nonblocking(key, val):
|
||||
def f(key, val):
|
||||
params = Params()
|
||||
params.put(key, val)
|
||||
|
||||
t = threading.Thread(target=f, args=(key, val))
|
||||
t.start()
|
||||
return t
|
||||
from common.params_pyx import Params, UnknownKeyName, put_nonblocking # pylint: disable=no-name-in-module, import-error
|
||||
assert Params
|
||||
assert UnknownKeyName
|
||||
assert put_nonblocking
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
from libcpp.string cimport string
|
||||
from libcpp cimport bool
|
||||
|
||||
cdef extern from "selfdrive/common/params.cc":
|
||||
pass
|
||||
|
||||
cdef extern from "selfdrive/common/util.c":
|
||||
pass
|
||||
|
||||
cdef extern from "selfdrive/common/params.h":
|
||||
cdef cppclass Params:
|
||||
Params(bool)
|
||||
Params(string)
|
||||
string get(string, bool) nogil
|
||||
int delete_db_value(string)
|
||||
int write_db_value(string, string)
|
||||
Executable
+161
@@ -0,0 +1,161 @@
|
||||
# distutils: language = c++
|
||||
# cython: language_level = 3
|
||||
from libcpp cimport bool
|
||||
from libcpp.string cimport string
|
||||
from common.params_pxd cimport Params as c_Params
|
||||
|
||||
import os
|
||||
import threading
|
||||
from common.basedir import BASEDIR
|
||||
|
||||
cdef enum TxType:
|
||||
PERSISTENT = 1
|
||||
CLEAR_ON_MANAGER_START = 2
|
||||
CLEAR_ON_PANDA_DISCONNECT = 3
|
||||
|
||||
keys = {
|
||||
b"AccessToken": [TxType.CLEAR_ON_MANAGER_START],
|
||||
b"AthenadPid": [TxType.PERSISTENT],
|
||||
b"CalibrationParams": [TxType.PERSISTENT],
|
||||
b"CarBatteryCapacity": [TxType.PERSISTENT],
|
||||
b"CarParams": [TxType.CLEAR_ON_MANAGER_START, TxType.CLEAR_ON_PANDA_DISCONNECT],
|
||||
b"CarParamsCache": [TxType.CLEAR_ON_MANAGER_START, TxType.CLEAR_ON_PANDA_DISCONNECT],
|
||||
b"CarVin": [TxType.CLEAR_ON_MANAGER_START, TxType.CLEAR_ON_PANDA_DISCONNECT],
|
||||
b"CommunityFeaturesToggle": [TxType.PERSISTENT],
|
||||
b"CompletedTrainingVersion": [TxType.PERSISTENT],
|
||||
b"DisablePowerDown": [TxType.PERSISTENT],
|
||||
b"DisableUpdates": [TxType.PERSISTENT],
|
||||
b"DoUninstall": [TxType.CLEAR_ON_MANAGER_START],
|
||||
b"DongleId": [TxType.PERSISTENT],
|
||||
b"GitBranch": [TxType.PERSISTENT],
|
||||
b"GitCommit": [TxType.PERSISTENT],
|
||||
b"GitRemote": [TxType.PERSISTENT],
|
||||
b"GithubSshKeys": [TxType.PERSISTENT],
|
||||
b"HasAcceptedTerms": [TxType.PERSISTENT],
|
||||
b"HasCompletedSetup": [TxType.PERSISTENT],
|
||||
b"IsDriverViewEnabled": [TxType.CLEAR_ON_MANAGER_START],
|
||||
b"IsLdwEnabled": [TxType.PERSISTENT],
|
||||
b"IsMetric": [TxType.PERSISTENT],
|
||||
b"IsOffroad": [TxType.CLEAR_ON_MANAGER_START],
|
||||
b"IsRHD": [TxType.PERSISTENT],
|
||||
b"IsTakingSnapshot": [TxType.CLEAR_ON_MANAGER_START],
|
||||
b"IsUpdateAvailable": [TxType.CLEAR_ON_MANAGER_START],
|
||||
b"IsUploadRawEnabled": [TxType.PERSISTENT],
|
||||
b"LastAthenaPingTime": [TxType.PERSISTENT],
|
||||
b"LastUpdateTime": [TxType.PERSISTENT],
|
||||
b"LastUpdateException": [TxType.PERSISTENT],
|
||||
b"LiveParameters": [TxType.PERSISTENT],
|
||||
b"OpenpilotEnabledToggle": [TxType.PERSISTENT],
|
||||
b"LaneChangeEnabled": [TxType.PERSISTENT],
|
||||
b"PandaFirmware": [TxType.CLEAR_ON_MANAGER_START, TxType.CLEAR_ON_PANDA_DISCONNECT],
|
||||
b"PandaFirmwareHex": [TxType.CLEAR_ON_MANAGER_START, TxType.CLEAR_ON_PANDA_DISCONNECT],
|
||||
b"PandaDongleId": [TxType.CLEAR_ON_MANAGER_START, TxType.CLEAR_ON_PANDA_DISCONNECT],
|
||||
b"Passive": [TxType.PERSISTENT],
|
||||
b"RecordFront": [TxType.PERSISTENT],
|
||||
b"ReleaseNotes": [TxType.PERSISTENT],
|
||||
b"ShouldDoUpdate": [TxType.CLEAR_ON_MANAGER_START],
|
||||
b"SubscriberInfo": [TxType.PERSISTENT],
|
||||
b"TermsVersion": [TxType.PERSISTENT],
|
||||
b"TrainingVersion": [TxType.PERSISTENT],
|
||||
b"UpdateAvailable": [TxType.CLEAR_ON_MANAGER_START],
|
||||
b"UpdateFailedCount": [TxType.CLEAR_ON_MANAGER_START],
|
||||
b"Version": [TxType.PERSISTENT],
|
||||
b"Offroad_ChargeDisabled": [TxType.CLEAR_ON_MANAGER_START, TxType.CLEAR_ON_PANDA_DISCONNECT],
|
||||
b"Offroad_ConnectivityNeeded": [TxType.CLEAR_ON_MANAGER_START],
|
||||
b"Offroad_ConnectivityNeededPrompt": [TxType.CLEAR_ON_MANAGER_START],
|
||||
b"Offroad_TemperatureTooHigh": [TxType.CLEAR_ON_MANAGER_START],
|
||||
b"Offroad_PandaFirmwareMismatch": [TxType.CLEAR_ON_MANAGER_START, TxType.CLEAR_ON_PANDA_DISCONNECT],
|
||||
b"Offroad_InvalidTime": [TxType.CLEAR_ON_MANAGER_START],
|
||||
b"Offroad_IsTakingSnapshot": [TxType.CLEAR_ON_MANAGER_START],
|
||||
b"Offroad_NeosUpdate": [TxType.CLEAR_ON_MANAGER_START],
|
||||
b"Offroad_UpdateFailed": [TxType.CLEAR_ON_MANAGER_START],
|
||||
b"Offroad_HardwareUnsupported": [TxType.CLEAR_ON_MANAGER_START],
|
||||
}
|
||||
|
||||
def ensure_bytes(v):
|
||||
if isinstance(v, str):
|
||||
return v.encode()
|
||||
else:
|
||||
return v
|
||||
|
||||
|
||||
class UnknownKeyName(Exception):
|
||||
pass
|
||||
|
||||
cdef class Params:
|
||||
cdef c_Params* p
|
||||
|
||||
def __cinit__(self, d=None, bool persistent_params=False):
|
||||
if d is None:
|
||||
self.p = new c_Params(persistent_params)
|
||||
else:
|
||||
self.p = new c_Params(<string>d.encode())
|
||||
|
||||
def __dealloc__(self):
|
||||
del self.p
|
||||
|
||||
def clear_all(self, tx_type=None):
|
||||
for key in keys:
|
||||
if tx_type is None or tx_type in keys[key]:
|
||||
self.delete(key)
|
||||
|
||||
def manager_start(self):
|
||||
self.clear_all(TxType.CLEAR_ON_MANAGER_START)
|
||||
|
||||
def panda_disconnect(self):
|
||||
self.clear_all(TxType.CLEAR_ON_PANDA_DISCONNECT)
|
||||
|
||||
def get(self, key, block=False, encoding=None):
|
||||
key = ensure_bytes(key)
|
||||
|
||||
if key not in keys:
|
||||
raise UnknownKeyName(key)
|
||||
|
||||
cdef string k = key
|
||||
cdef bool b = block
|
||||
|
||||
cdef string val
|
||||
with nogil:
|
||||
val = self.p.get(k, b)
|
||||
|
||||
if val == b"":
|
||||
if block:
|
||||
# If we got no value while running in blocked mode
|
||||
# it means we got an interrupt while waiting
|
||||
raise KeyboardInterrupt
|
||||
else:
|
||||
return None
|
||||
|
||||
if encoding is not None:
|
||||
return val.decode(encoding)
|
||||
else:
|
||||
return val
|
||||
|
||||
def put(self, key, dat):
|
||||
"""
|
||||
Warning: This function blocks until the param is written to disk!
|
||||
In very rare cases this can take over a second, and your code will hang.
|
||||
Use the put_nonblocking helper function in time sensitive code, but
|
||||
in general try to avoid writing params as much as possible.
|
||||
"""
|
||||
key = ensure_bytes(key)
|
||||
dat = ensure_bytes(dat)
|
||||
|
||||
if key not in keys:
|
||||
raise UnknownKeyName(key)
|
||||
|
||||
self.p.write_db_value(key, dat)
|
||||
|
||||
def delete(self, key):
|
||||
key = ensure_bytes(key)
|
||||
self.p.delete_db_value(key)
|
||||
|
||||
|
||||
def put_nonblocking(key, val, d=None):
|
||||
def f(key, val):
|
||||
params = Params(d)
|
||||
params.put(key, val)
|
||||
|
||||
t = threading.Thread(target=f, args=(key, val))
|
||||
t.start()
|
||||
return t
|
||||
+3
-3
@@ -36,10 +36,10 @@ class Profiler():
|
||||
if not self.enabled:
|
||||
return
|
||||
self.iter += 1
|
||||
print("******* Profiling *******")
|
||||
print("******* Profiling %d *******" % self.iter)
|
||||
for n, ms in sorted(self.cp.items(), key=lambda x: -x[1]):
|
||||
if n in self.cp_ignored:
|
||||
print("%30s: %9.2f percent: %3.0f IGNORED" % (n, ms*1000.0, ms/self.tot*100))
|
||||
print("%30s: %9.2f avg: %7.2f percent: %3.0f IGNORED" % (n, ms*1000.0, ms*1000.0/self.iter, ms/self.tot*100))
|
||||
else:
|
||||
print("%30s: %9.2f percent: %3.0f" % (n, ms*1000.0, ms/self.tot*100))
|
||||
print("%30s: %9.2f avg: %7.2f percent: %3.0f" % (n, ms*1000.0, ms*1000.0/self.iter, ms/self.tot*100))
|
||||
print("Iter clock: %2.6f TOTAL: %2.2f" % (self.tot/self.iter, self.tot))
|
||||
|
||||
+2
-2
@@ -5,7 +5,7 @@ import time
|
||||
import multiprocessing
|
||||
|
||||
from common.hardware import PC
|
||||
from common.common_pyx import sec_since_boot # pylint: disable=no-name-in-module, import-error
|
||||
from common.clock import sec_since_boot # pylint: disable=no-name-in-module, import-error
|
||||
|
||||
|
||||
# time step for each process
|
||||
@@ -31,7 +31,7 @@ def set_core_affinity(core):
|
||||
os.sched_setaffinity(0, [core,])
|
||||
|
||||
|
||||
def config_rt_process(core, priority):
|
||||
def config_realtime_process(core, priority):
|
||||
gc.disable()
|
||||
set_realtime_priority(priority)
|
||||
set_core_affinity(core)
|
||||
|
||||
+8
-11
@@ -4,17 +4,14 @@ from common.basedir import BASEDIR
|
||||
|
||||
|
||||
class Spinner():
|
||||
def __init__(self, noop=False):
|
||||
# spinner is currently only implemented for android
|
||||
self.spinner_proc = None
|
||||
if not noop:
|
||||
try:
|
||||
self.spinner_proc = subprocess.Popen(["./spinner"],
|
||||
stdin=subprocess.PIPE,
|
||||
cwd=os.path.join(BASEDIR, "selfdrive", "ui", "spinner"),
|
||||
close_fds=True)
|
||||
except OSError:
|
||||
self.spinner_proc = None
|
||||
def __init__(self):
|
||||
try:
|
||||
self.spinner_proc = subprocess.Popen(["./spinner"],
|
||||
stdin=subprocess.PIPE,
|
||||
cwd=os.path.join(BASEDIR, "selfdrive", "ui"),
|
||||
close_fds=True)
|
||||
except OSError:
|
||||
self.spinner_proc = None
|
||||
|
||||
def __enter__(self):
|
||||
return self
|
||||
|
||||
+8
-11
@@ -6,17 +6,14 @@ from common.basedir import BASEDIR
|
||||
|
||||
|
||||
class TextWindow:
|
||||
def __init__(self, s, noop=False):
|
||||
# text window is only implemented for android currently
|
||||
self.text_proc = None
|
||||
if not noop:
|
||||
try:
|
||||
self.text_proc = subprocess.Popen(["./text", s],
|
||||
stdin=subprocess.PIPE,
|
||||
cwd=os.path.join(BASEDIR, "selfdrive", "ui", "text"),
|
||||
close_fds=True)
|
||||
except OSError:
|
||||
self.text_proc = None
|
||||
def __init__(self, text):
|
||||
try:
|
||||
self.text_proc = subprocess.Popen(["./text", text],
|
||||
stdin=subprocess.PIPE,
|
||||
cwd=os.path.join(BASEDIR, "selfdrive", "ui"),
|
||||
close_fds=True)
|
||||
except OSError:
|
||||
self.text_proc = None
|
||||
|
||||
def get_status(self):
|
||||
if self.text_proc is not None:
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
Import('env', 'cython_dependencies')
|
||||
Import('envCython')
|
||||
|
||||
d = Dir('.')
|
||||
|
||||
env.Command(['transformations.so'],
|
||||
cython_dependencies + ['transformations.pxd', 'transformations.pyx',
|
||||
'coordinates.cc', 'orientation.cc', 'coordinates.hpp', 'orientation.hpp'],
|
||||
'cd ' + d.path + ' && python3 setup.py build_ext --inplace')
|
||||
envCython.Program('transformations.so', 'transformations.pyx')
|
||||
|
||||
@@ -1,29 +1,67 @@
|
||||
import numpy as np
|
||||
import common.transformations.orientation as orient
|
||||
|
||||
FULL_FRAME_SIZE = (1164, 874)
|
||||
W, H = FULL_FRAME_SIZE[0], FULL_FRAME_SIZE[1]
|
||||
eon_focal_length = FOCAL = 910.0
|
||||
import common.transformations.orientation as orient
|
||||
from common.hardware import TICI
|
||||
|
||||
## -- hardcoded hardware params --
|
||||
eon_f_focal_length = 910.0
|
||||
eon_d_focal_length = 860.0
|
||||
leon_d_focal_length = 650.0
|
||||
tici_f_focal_length = 2648.0
|
||||
tici_e_focal_length = tici_d_focal_length = 567.0 # probably wrong? magnification is not consistent across frame
|
||||
|
||||
eon_f_frame_size = (1164, 874)
|
||||
eon_d_frame_size = (1152, 864)
|
||||
leon_d_frame_size = (816, 612)
|
||||
tici_f_frame_size = tici_e_frame_size = tici_d_frame_size = (1928, 1208)
|
||||
|
||||
# aka 'K' aka camera_frame_from_view_frame
|
||||
eon_intrinsics = np.array([
|
||||
[FOCAL, 0., W/2.],
|
||||
[ 0., FOCAL, H/2.],
|
||||
[ 0., 0., 1.]])
|
||||
|
||||
eon_fcam_intrinsics = np.array([
|
||||
[eon_f_focal_length, 0.0, float(eon_f_frame_size[0])/2],
|
||||
[0.0, eon_f_focal_length, float(eon_f_frame_size[1])/2],
|
||||
[0.0, 0.0, 1.0]])
|
||||
eon_intrinsics = eon_fcam_intrinsics # xx
|
||||
|
||||
leon_dcam_intrinsics = np.array([
|
||||
[650, 0, 816//2],
|
||||
[ 0, 650, 612//2],
|
||||
[ 0, 0, 1]])
|
||||
[leon_d_focal_length, 0.0, float(leon_d_frame_size[0])/2],
|
||||
[0.0, leon_d_focal_length, float(leon_d_frame_size[1])/2],
|
||||
[0.0, 0.0, 1.0]])
|
||||
|
||||
eon_dcam_intrinsics = np.array([
|
||||
[860, 0, 1152//2],
|
||||
[ 0, 860, 864//2],
|
||||
[ 0, 0, 1]])
|
||||
[eon_d_focal_length, 0.0, float(eon_d_frame_size[0])/2],
|
||||
[0.0, eon_d_focal_length, float(eon_d_frame_size[1])/2],
|
||||
[0.0, 0.0, 1.0]])
|
||||
|
||||
tici_fcam_intrinsics = np.array([
|
||||
[tici_f_focal_length, 0.0, float(tici_f_frame_size[0])/2],
|
||||
[0.0, tici_f_focal_length, float(tici_f_frame_size[1])/2],
|
||||
[0.0, 0.0, 1.0]])
|
||||
|
||||
tici_dcam_intrinsics = np.array([
|
||||
[tici_d_focal_length, 0.0, float(tici_d_frame_size[0])/2],
|
||||
[0.0, tici_d_focal_length, float(tici_d_frame_size[1])/2],
|
||||
[0.0, 0.0, 1.0]])
|
||||
|
||||
tici_ecam_intrinsics = tici_dcam_intrinsics
|
||||
|
||||
# aka 'K_inv' aka view_frame_from_camera_frame
|
||||
eon_intrinsics_inv = np.linalg.inv(eon_intrinsics)
|
||||
eon_fcam_intrinsics_inv = np.linalg.inv(eon_fcam_intrinsics)
|
||||
eon_intrinsics_inv = eon_fcam_intrinsics_inv # xx
|
||||
|
||||
tici_fcam_intrinsics_inv = np.linalg.inv(tici_fcam_intrinsics)
|
||||
tici_ecam_intrinsics_inv = np.linalg.inv(tici_ecam_intrinsics)
|
||||
|
||||
|
||||
if not TICI:
|
||||
FULL_FRAME_SIZE = eon_f_frame_size
|
||||
FOCAL = eon_f_focal_length
|
||||
fcam_intrinsics = eon_fcam_intrinsics
|
||||
else:
|
||||
FULL_FRAME_SIZE = tici_f_frame_size
|
||||
FOCAL = tici_f_focal_length
|
||||
fcam_intrinsics = tici_fcam_intrinsics
|
||||
|
||||
W, H = FULL_FRAME_SIZE[0], FULL_FRAME_SIZE[1]
|
||||
|
||||
|
||||
# device/mesh : x->forward, y-> right, z->down
|
||||
@@ -69,9 +107,9 @@ def vp_from_ke(m):
|
||||
return (m[0, 0]/m[2, 0], m[1, 0]/m[2, 0])
|
||||
|
||||
|
||||
def vp_from_rpy(rpy):
|
||||
def vp_from_rpy(rpy, intrinsics=fcam_intrinsics):
|
||||
e = get_view_frame_from_road_frame(rpy[0], rpy[1], rpy[2], 1.22)
|
||||
ke = np.dot(eon_intrinsics, e)
|
||||
ke = np.dot(intrinsics, e)
|
||||
return vp_from_ke(ke)
|
||||
|
||||
|
||||
@@ -81,7 +119,7 @@ def roll_from_ke(m):
|
||||
-(m[0, 0] - m[0, 1] * m[2, 0] / m[2, 1]))
|
||||
|
||||
|
||||
def normalize(img_pts, intrinsics=eon_intrinsics):
|
||||
def normalize(img_pts, intrinsics=fcam_intrinsics):
|
||||
# normalizes image coordinates
|
||||
# accepts single pt or array of pts
|
||||
intrinsics_inv = np.linalg.inv(intrinsics)
|
||||
@@ -94,7 +132,7 @@ def normalize(img_pts, intrinsics=eon_intrinsics):
|
||||
return img_pts_normalized[:, :2].reshape(input_shape)
|
||||
|
||||
|
||||
def denormalize(img_pts, intrinsics=eon_intrinsics):
|
||||
def denormalize(img_pts, intrinsics=fcam_intrinsics, width=W, height=H):
|
||||
# denormalizes image coordinates
|
||||
# accepts single pt or array of pts
|
||||
img_pts = np.array(img_pts)
|
||||
@@ -102,9 +140,9 @@ def denormalize(img_pts, intrinsics=eon_intrinsics):
|
||||
img_pts = np.atleast_2d(img_pts)
|
||||
img_pts = np.hstack((img_pts, np.ones((img_pts.shape[0], 1))))
|
||||
img_pts_denormalized = img_pts.dot(intrinsics.T)
|
||||
img_pts_denormalized[img_pts_denormalized[:, 0] > W] = np.nan
|
||||
img_pts_denormalized[img_pts_denormalized[:, 0] > width] = np.nan
|
||||
img_pts_denormalized[img_pts_denormalized[:, 0] < 0] = np.nan
|
||||
img_pts_denormalized[img_pts_denormalized[:, 1] > H] = np.nan
|
||||
img_pts_denormalized[img_pts_denormalized[:, 1] > height] = np.nan
|
||||
img_pts_denormalized[img_pts_denormalized[:, 1] < 0] = np.nan
|
||||
return img_pts_denormalized[:, :2].reshape(input_shape)
|
||||
|
||||
@@ -137,18 +175,10 @@ def img_from_device(pt_device):
|
||||
return pt_img.reshape(input_shape)[:, :2]
|
||||
|
||||
|
||||
def get_camera_frame_from_calib_frame(camera_frame_from_road_frame):
|
||||
def get_camera_frame_from_calib_frame(camera_frame_from_road_frame, intrinsics=fcam_intrinsics):
|
||||
camera_frame_from_ground = camera_frame_from_road_frame[:, (0, 1, 3)]
|
||||
calib_frame_from_ground = np.dot(eon_intrinsics,
|
||||
calib_frame_from_ground = np.dot(intrinsics,
|
||||
get_view_frame_from_road_frame(0, 0, 0, 1.22))[:, (0, 1, 3)]
|
||||
ground_from_calib_frame = np.linalg.inv(calib_frame_from_ground)
|
||||
camera_frame_from_calib_frame = np.dot(camera_frame_from_ground, ground_from_calib_frame)
|
||||
return camera_frame_from_calib_frame
|
||||
|
||||
|
||||
def pretransform_from_calib(calib):
|
||||
roll, pitch, yaw, height = calib
|
||||
view_frame_from_road_frame = get_view_frame_from_road_frame(roll, pitch, yaw, height)
|
||||
camera_frame_from_road_frame = np.dot(eon_intrinsics, view_frame_from_road_frame)
|
||||
camera_frame_from_calib_frame = get_camera_frame_from_calib_frame(camera_frame_from_road_frame)
|
||||
return np.linalg.inv(camera_frame_from_calib_frame)
|
||||
|
||||
@@ -1,34 +1,33 @@
|
||||
import numpy as np
|
||||
|
||||
from common.transformations.camera import (FULL_FRAME_SIZE, eon_focal_length,
|
||||
from common.transformations.camera import (FULL_FRAME_SIZE,
|
||||
FOCAL,
|
||||
get_view_frame_from_road_frame,
|
||||
get_view_frame_from_calib_frame,
|
||||
vp_from_ke)
|
||||
|
||||
# segnet
|
||||
|
||||
SEGNET_SIZE = (512, 384)
|
||||
|
||||
segnet_frame_from_camera_frame = np.array([
|
||||
[float(SEGNET_SIZE[0])/FULL_FRAME_SIZE[0], 0., ],
|
||||
[ 0., float(SEGNET_SIZE[1])/FULL_FRAME_SIZE[1]]])
|
||||
|
||||
def get_segnet_frame_from_camera_frame(segnet_size=SEGNET_SIZE, full_frame_size=FULL_FRAME_SIZE):
|
||||
return np.array([[float(segnet_size[0]) / full_frame_size[0], 0.0],
|
||||
[0.0, float(segnet_size[1]) / full_frame_size[1]]])
|
||||
segnet_frame_from_camera_frame = get_segnet_frame_from_camera_frame() # xx
|
||||
|
||||
# model
|
||||
|
||||
MODEL_INPUT_SIZE = (320, 160)
|
||||
MODEL_YUV_SIZE = (MODEL_INPUT_SIZE[0], MODEL_INPUT_SIZE[1] * 3 // 2)
|
||||
MODEL_CX = MODEL_INPUT_SIZE[0]/2.
|
||||
MODEL_CX = MODEL_INPUT_SIZE[0] / 2.
|
||||
MODEL_CY = 21.
|
||||
|
||||
model_zoom = 1.25
|
||||
model_fl = 728.0
|
||||
model_height = 1.22
|
||||
|
||||
# canonical model transform
|
||||
model_intrinsics = np.array(
|
||||
[[ eon_focal_length / model_zoom, 0. , MODEL_CX],
|
||||
[ 0. , eon_focal_length / model_zoom, MODEL_CY],
|
||||
[ 0. , 0. , 1.]])
|
||||
model_intrinsics = np.array([
|
||||
[model_fl, 0.0, MODEL_CX],
|
||||
[0.0, model_fl, MODEL_CY],
|
||||
[0.0, 0.0, 1.0]])
|
||||
|
||||
|
||||
# MED model
|
||||
@@ -36,34 +35,45 @@ MEDMODEL_INPUT_SIZE = (512, 256)
|
||||
MEDMODEL_YUV_SIZE = (MEDMODEL_INPUT_SIZE[0], MEDMODEL_INPUT_SIZE[1] * 3 // 2)
|
||||
MEDMODEL_CY = 47.6
|
||||
|
||||
medmodel_zoom = 1.
|
||||
medmodel_intrinsics = np.array(
|
||||
[[ eon_focal_length / medmodel_zoom, 0. , 0.5 * MEDMODEL_INPUT_SIZE[0]],
|
||||
[ 0. , eon_focal_length / medmodel_zoom, MEDMODEL_CY],
|
||||
[ 0. , 0. , 1.]])
|
||||
medmodel_fl = 910.0
|
||||
medmodel_intrinsics = np.array([
|
||||
[medmodel_fl, 0.0, 0.5 * MEDMODEL_INPUT_SIZE[0]],
|
||||
[0.0, medmodel_fl, MEDMODEL_CY],
|
||||
[0.0, 0.0, 1.0]])
|
||||
|
||||
|
||||
# CAL model
|
||||
CALMODEL_INPUT_SIZE = (512, 256)
|
||||
CALMODEL_YUV_SIZE = (CALMODEL_INPUT_SIZE[0], CALMODEL_INPUT_SIZE[1] * 3 // 2)
|
||||
CALMODEL_CY = 47.6
|
||||
|
||||
calmodel_zoom = 1.5
|
||||
calmodel_intrinsics = np.array(
|
||||
[[ eon_focal_length / calmodel_zoom, 0. , 0.5 * CALMODEL_INPUT_SIZE[0]],
|
||||
[ 0. , eon_focal_length / calmodel_zoom, CALMODEL_CY],
|
||||
[ 0. , 0. , 1.]])
|
||||
calmodel_fl = 606.7
|
||||
calmodel_intrinsics = np.array([
|
||||
[calmodel_fl, 0.0, 0.5 * CALMODEL_INPUT_SIZE[0]],
|
||||
[0.0, calmodel_fl, CALMODEL_CY],
|
||||
[0.0, 0.0, 1.0]])
|
||||
|
||||
|
||||
# BIG model
|
||||
|
||||
BIGMODEL_INPUT_SIZE = (1024, 512)
|
||||
BIGMODEL_YUV_SIZE = (BIGMODEL_INPUT_SIZE[0], BIGMODEL_INPUT_SIZE[1] * 3 // 2)
|
||||
|
||||
bigmodel_zoom = 1.
|
||||
bigmodel_intrinsics = np.array(
|
||||
[[ eon_focal_length / bigmodel_zoom, 0. , 0.5 * BIGMODEL_INPUT_SIZE[0]],
|
||||
[ 0. , eon_focal_length / bigmodel_zoom, 256+MEDMODEL_CY],
|
||||
[ 0. , 0. , 1.]])
|
||||
bigmodel_fl = 910.0
|
||||
bigmodel_intrinsics = np.array([
|
||||
[bigmodel_fl, 0.0, 0.5 * BIGMODEL_INPUT_SIZE[0]],
|
||||
[0.0, bigmodel_fl, 256 + MEDMODEL_CY],
|
||||
[0.0, 0.0, 1.0]])
|
||||
|
||||
|
||||
# SBIG model (big model with the size of small model)
|
||||
SBIGMODEL_INPUT_SIZE = (512, 256)
|
||||
SBIGMODEL_YUV_SIZE = (SBIGMODEL_INPUT_SIZE[0], SBIGMODEL_INPUT_SIZE[1] * 3 // 2)
|
||||
|
||||
sbigmodel_fl = 455.0
|
||||
sbigmodel_intrinsics = np.array([
|
||||
[sbigmodel_fl, 0.0, 0.5 * SBIGMODEL_INPUT_SIZE[0]],
|
||||
[0.0, sbigmodel_fl, 0.5 * (256 + MEDMODEL_CY)],
|
||||
[0.0, 0.0, 1.0]])
|
||||
|
||||
model_frame_from_road_frame = np.dot(model_intrinsics,
|
||||
get_view_frame_from_road_frame(0, 0, 0, model_height))
|
||||
@@ -80,20 +90,21 @@ medmodel_frame_from_calib_frame = np.dot(medmodel_intrinsics,
|
||||
model_frame_from_bigmodel_frame = np.dot(model_intrinsics, np.linalg.inv(bigmodel_intrinsics))
|
||||
medmodel_frame_from_bigmodel_frame = np.dot(medmodel_intrinsics, np.linalg.inv(bigmodel_intrinsics))
|
||||
|
||||
|
||||
# 'camera from model camera'
|
||||
def get_model_height_transform(camera_frame_from_road_frame, height):
|
||||
camera_frame_from_road_ground = np.dot(camera_frame_from_road_frame, np.array([
|
||||
[1, 0, 0],
|
||||
[0, 1, 0],
|
||||
[0, 0, 0],
|
||||
[0, 0, 1],
|
||||
[1, 0, 0],
|
||||
[0, 1, 0],
|
||||
[0, 0, 0],
|
||||
[0, 0, 1],
|
||||
]))
|
||||
|
||||
camera_frame_from_road_high = np.dot(camera_frame_from_road_frame, np.array([
|
||||
[1, 0, 0],
|
||||
[0, 1, 0],
|
||||
[0, 0, height - model_height],
|
||||
[0, 0, 1],
|
||||
[1, 0, 0],
|
||||
[0, 1, 0],
|
||||
[0, 0, height - model_height],
|
||||
[0, 0, 1],
|
||||
]))
|
||||
|
||||
road_high_from_camera_frame = np.linalg.inv(camera_frame_from_road_high)
|
||||
@@ -104,13 +115,14 @@ def get_model_height_transform(camera_frame_from_road_frame, height):
|
||||
|
||||
# camera_frame_from_model_frame aka 'warp matrix'
|
||||
# was: calibration.h/CalibrationTransform
|
||||
def get_camera_frame_from_model_frame(camera_frame_from_road_frame, height=model_height):
|
||||
def get_camera_frame_from_model_frame(camera_frame_from_road_frame, height=model_height, camera_fl=FOCAL):
|
||||
vp = vp_from_ke(camera_frame_from_road_frame)
|
||||
|
||||
model_zoom = camera_fl / model_fl
|
||||
model_camera_from_model_frame = np.array([
|
||||
[model_zoom, 0., vp[0] - MODEL_CX * model_zoom],
|
||||
[ 0., model_zoom, vp[1] - MODEL_CY * model_zoom],
|
||||
[ 0., 0., 1.],
|
||||
[model_zoom, 0.0, vp[0] - MODEL_CX * model_zoom],
|
||||
[0.0, model_zoom, vp[1] - MODEL_CY * model_zoom],
|
||||
[0.0, 0.0, 1.0],
|
||||
])
|
||||
|
||||
# This function is super slow, so skip it if height is very close to canonical
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
import os
|
||||
import numpy
|
||||
import sysconfig
|
||||
|
||||
from Cython.Build import cythonize
|
||||
from Cython.Distutils import build_ext
|
||||
from distutils.core import Extension, setup # pylint: disable=import-error,no-name-in-module
|
||||
|
||||
def get_ext_filename_without_platform_suffix(filename):
|
||||
name, ext = os.path.splitext(filename)
|
||||
ext_suffix = sysconfig.get_config_var('EXT_SUFFIX')
|
||||
|
||||
if ext_suffix == ext:
|
||||
return filename
|
||||
|
||||
ext_suffix = ext_suffix.replace(ext, '')
|
||||
idx = name.find(ext_suffix)
|
||||
|
||||
if idx == -1:
|
||||
return filename
|
||||
else:
|
||||
return name[:idx] + ext
|
||||
|
||||
|
||||
class BuildExtWithoutPlatformSuffix(build_ext):
|
||||
def get_ext_filename(self, ext_name):
|
||||
filename = super().get_ext_filename(ext_name)
|
||||
return get_ext_filename_without_platform_suffix(filename)
|
||||
|
||||
|
||||
setup(
|
||||
name='Cython transformations wrapper',
|
||||
cmdclass={'build_ext': BuildExtWithoutPlatformSuffix},
|
||||
ext_modules=cythonize(
|
||||
Extension(
|
||||
"transformations",
|
||||
sources=["transformations.pyx"],
|
||||
language="c++",
|
||||
extra_compile_args=["-std=c++14"],
|
||||
include_dirs=[numpy.get_include()],
|
||||
)
|
||||
))
|
||||
@@ -1,3 +1,4 @@
|
||||
#cython: language_level=3
|
||||
from libcpp cimport bool
|
||||
|
||||
cdef extern from "orientation.cc":
|
||||
|
||||
@@ -1,18 +1,20 @@
|
||||
from transformations cimport Matrix3, Vector3, Quaternion
|
||||
from transformations cimport ECEF, NED, Geodetic
|
||||
# distutils: language = c++
|
||||
# cython: language_level = 3
|
||||
from common.transformations.transformations cimport Matrix3, Vector3, Quaternion
|
||||
from common.transformations.transformations cimport ECEF, NED, Geodetic
|
||||
|
||||
from transformations cimport euler2quat as euler2quat_c
|
||||
from transformations cimport quat2euler as quat2euler_c
|
||||
from transformations cimport quat2rot as quat2rot_c
|
||||
from transformations cimport rot2quat as rot2quat_c
|
||||
from transformations cimport euler2rot as euler2rot_c
|
||||
from transformations cimport rot2euler as rot2euler_c
|
||||
from transformations cimport rot_matrix as rot_matrix_c
|
||||
from transformations cimport ecef_euler_from_ned as ecef_euler_from_ned_c
|
||||
from transformations cimport ned_euler_from_ecef as ned_euler_from_ecef_c
|
||||
from transformations cimport geodetic2ecef as geodetic2ecef_c
|
||||
from transformations cimport ecef2geodetic as ecef2geodetic_c
|
||||
from transformations cimport LocalCoord_c
|
||||
from common.transformations.transformations cimport euler2quat as euler2quat_c
|
||||
from common.transformations.transformations cimport quat2euler as quat2euler_c
|
||||
from common.transformations.transformations cimport quat2rot as quat2rot_c
|
||||
from common.transformations.transformations cimport rot2quat as rot2quat_c
|
||||
from common.transformations.transformations cimport euler2rot as euler2rot_c
|
||||
from common.transformations.transformations cimport rot2euler as rot2euler_c
|
||||
from common.transformations.transformations cimport rot_matrix as rot_matrix_c
|
||||
from common.transformations.transformations cimport ecef_euler_from_ned as ecef_euler_from_ned_c
|
||||
from common.transformations.transformations cimport ned_euler_from_ecef as ned_euler_from_ecef_c
|
||||
from common.transformations.transformations cimport geodetic2ecef as geodetic2ecef_c
|
||||
from common.transformations.transformations cimport ecef2geodetic as ecef2geodetic_c
|
||||
from common.transformations.transformations cimport LocalCoord_c
|
||||
|
||||
|
||||
import cython
|
||||
@@ -26,7 +28,7 @@ cdef np.ndarray[double, ndim=2] matrix2numpy(Matrix3 m):
|
||||
[m(2, 0), m(2, 1), m(2, 2)],
|
||||
])
|
||||
|
||||
cdef Matrix3 numpy2matrix (np.ndarray[double, ndim=2, mode="fortran"] m):
|
||||
cdef Matrix3 numpy2matrix(np.ndarray[double, ndim=2, mode="fortran"] m):
|
||||
assert m.shape[0] == 3
|
||||
assert m.shape[1] == 3
|
||||
return Matrix3(<double*>m.data)
|
||||
|
||||
@@ -10,7 +10,7 @@ WARN_FLAGS = -Werror=implicit-function-declaration \
|
||||
-Werror=format-extra-args
|
||||
|
||||
CFLAGS = -std=gnu11 -g -fPIC -O2 $(WARN_FLAGS)
|
||||
CXXFLAGS = -std=c++11 -g -fPIC -O2 $(WARN_FLAGS)
|
||||
CXXFLAGS = -std=c++1z -g -fPIC -O2 $(WARN_FLAGS)
|
||||
|
||||
CURL_FLAGS = -I$(PHONELIBS)/curl/include
|
||||
CURL_LIBS = $(PHONELIBS)/curl/lib/libcurl.a \
|
||||
@@ -34,6 +34,7 @@ all: updater
|
||||
OBJS = opensans_regular.ttf.o \
|
||||
opensans_semibold.ttf.o \
|
||||
opensans_bold.ttf.o \
|
||||
../../selfdrive/common/util.o \
|
||||
../../selfdrive/common/touch.o \
|
||||
../../selfdrive/common/framebuffer.o \
|
||||
$(PHONELIBS)/json11/json11.o \
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"ota_url": "https://commadist.azureedge.net/neosupdate/ota-signed-efdf7de63b1aef63d68301e6175930991bf9a5927d16ec6fcc69287e2ee7ca4a.zip",
|
||||
"ota_hash": "efdf7de63b1aef63d68301e6175930991bf9a5927d16ec6fcc69287e2ee7ca4a",
|
||||
"recovery_url": "https://commadist.azureedge.net/neosupdate/recovery-97c27e6ed04ed6bb0608b845a2d4100912093f9380c3f2ba6b56bccd608e5f6e.img",
|
||||
"recovery_len": 15861036,
|
||||
"recovery_hash": "97c27e6ed04ed6bb0608b845a2d4100912093f9380c3f2ba6b56bccd608e5f6e"
|
||||
"ota_url": "https://commadist.azureedge.net/neosupdate/ota-signed-e85f507777cb6b22f88ba1c8be6bbaa2630c484b971344b645fca2d1c461cd47.zip",
|
||||
"ota_hash": "e85f507777cb6b22f88ba1c8be6bbaa2630c484b971344b645fca2d1c461cd47",
|
||||
"recovery_url": "https://commadist.azureedge.net/neosupdate/recovery-db31ffe79dfd60be966fba6d1525a5081a920062b883644dc8f5734bcc6806bb.img",
|
||||
"recovery_len": 15926572,
|
||||
"recovery_hash": "db31ffe79dfd60be966fba6d1525a5081a920062b883644dc8f5734bcc6806bb"
|
||||
}
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"ota_url": "https://commadist.azureedge.net/neosupdate/ota-signed-3bd2b3bdd6a501569e00b8f12786d65e0fd2788c0dd238f8c986e3e2e504683a-kernel.zip",
|
||||
"ota_hash": "3bd2b3bdd6a501569e00b8f12786d65e0fd2788c0dd238f8c986e3e2e504683a",
|
||||
"recovery_url": "https://commadist.azureedge.net/neosupdate/recovery-97c27e6ed04ed6bb0608b845a2d4100912093f9380c3f2ba6b56bccd608e5f6e.img",
|
||||
"recovery_len": 15861036,
|
||||
"recovery_hash": "97c27e6ed04ed6bb0608b845a2d4100912093f9380c3f2ba6b56bccd608e5f6e"
|
||||
}
|
||||
Binary file not shown.
@@ -231,6 +231,8 @@ struct Updater {
|
||||
&fb_w, &fb_h);
|
||||
assert(fb);
|
||||
|
||||
framebuffer_set_power(fb, HWC_POWER_MODE_NORMAL);
|
||||
|
||||
vg = nvgCreateGLES3(NVG_ANTIALIAS | NVG_STENCIL_STROKES | NVG_DEBUG);
|
||||
assert(vg);
|
||||
|
||||
|
||||
+31
-6
@@ -8,26 +8,48 @@ source "$BASEDIR/launch_env.sh"
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
|
||||
|
||||
function tici_init {
|
||||
sudo su -c 'echo "performance" > /sys/class/devfreq/soc:qcom,memlat-cpu0/governor'
|
||||
sudo su -c 'echo "performance" > /sys/class/devfreq/soc:qcom,memlat-cpu4/governor'
|
||||
}
|
||||
|
||||
function two_init {
|
||||
# Restrict Android and other system processes to the first two cores
|
||||
echo 0-1 > /dev/cpuset/background/cpus
|
||||
echo 0-1 > /dev/cpuset/system-background/cpus
|
||||
echo 0-1 > /dev/cpuset/foreground/boost/cpus
|
||||
echo 0-1 > /dev/cpuset/foreground/cpus
|
||||
echo 0-1 > /dev/cpuset/foreground/boost/cpus
|
||||
echo 0-1 > /dev/cpuset/android/cpus
|
||||
|
||||
# openpilot gets all the cores
|
||||
echo 0-3 > /dev/cpuset/app/cpus
|
||||
|
||||
# set up governors
|
||||
# +50mW offroad, +500mW onroad for 30% more RAM bandwidth
|
||||
echo "performance" > /sys/class/devfreq/soc:qcom,cpubw/governor
|
||||
echo 1056000 > /sys/class/devfreq/soc:qcom,m4m/max_freq
|
||||
echo "performance" > /sys/class/devfreq/soc:qcom,m4m/governor
|
||||
|
||||
# unclear if these help, but they don't seem to hurt
|
||||
echo "performance" > /sys/class/devfreq/soc:qcom,memlat-cpu0/governor
|
||||
echo "performance" > /sys/class/devfreq/soc:qcom,memlat-cpu2/governor
|
||||
|
||||
# GPU
|
||||
echo "performance" > /sys/class/devfreq/b00000.qcom,kgsl-3d0/governor
|
||||
|
||||
# /sys/class/devfreq/soc:qcom,mincpubw is the only one left at "powersave"
|
||||
# it seems to gain nothing but a wasted 500mW
|
||||
|
||||
# Collect RIL and other possibly long-running I/O interrupts onto CPU 1
|
||||
echo 1 > /proc/irq/78/smp_affinity_list # qcom,smd-modem (LTE radio)
|
||||
echo 1 > /proc/irq/33/smp_affinity_list # ufshcd (flash storage)
|
||||
echo 1 > /proc/irq/35/smp_affinity_list # wifi (wlan_pci)
|
||||
echo 1 > /proc/irq/6/smp_affinity_list # MDSS
|
||||
|
||||
# USB traffic needs realtime handling on cpu 3
|
||||
[ -d "/proc/irq/733" ] && echo 3 > /proc/irq/733/smp_affinity_list # USB for LeEco
|
||||
[ -d "/proc/irq/736" ] && echo 3 > /proc/irq/736/smp_affinity_list # USB for OP3T
|
||||
|
||||
|
||||
# Check for NEOS update
|
||||
if [ $(< /VERSION) != "$REQUIRED_NEOS_VERSION" ]; then
|
||||
if [ -f "$DIR/scripts/continue.sh" ]; then
|
||||
@@ -43,10 +65,6 @@ function two_init {
|
||||
fi
|
||||
|
||||
"$DIR/installer/updater/updater" "file://$DIR/installer/updater/update.json"
|
||||
else
|
||||
if [[ $(uname -v) == "#1 SMP PREEMPT Wed Jun 10 12:40:53 PDT 2020" ]]; then
|
||||
"$DIR/installer/updater/updater" "file://$DIR/installer/updater/update_kernel.json"
|
||||
fi
|
||||
fi
|
||||
|
||||
# One-time fix for a subset of OP3T with gyro orientation offsets.
|
||||
@@ -113,10 +131,17 @@ function launch {
|
||||
two_init
|
||||
fi
|
||||
|
||||
if [ -f /TICI ]; then
|
||||
tici_init
|
||||
fi
|
||||
|
||||
# handle pythonpath
|
||||
ln -sfn $(pwd) /data/pythonpath
|
||||
export PYTHONPATH="$PWD"
|
||||
|
||||
# write tmux scrollback to a file
|
||||
tmux capture-pane -pq -S-1000 > /tmp/launch_log
|
||||
|
||||
# start manager
|
||||
cd selfdrive
|
||||
./manager.py
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ export OPENBLAS_NUM_THREADS=1
|
||||
export VECLIB_MAXIMUM_THREADS=1
|
||||
|
||||
if [ -z "$REQUIRED_NEOS_VERSION" ]; then
|
||||
export REQUIRED_NEOS_VERSION="14"
|
||||
export REQUIRED_NEOS_VERSION="15-1"
|
||||
fi
|
||||
|
||||
if [ -z "$PASSIVE" ]; then
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,433 @@
|
||||
CM_ "AUTOGENERATED FILE, DO NOT EDIT"
|
||||
|
||||
|
||||
CM_ "Imported file _bosch_2020.dbc starts here"
|
||||
VERSION ""
|
||||
|
||||
|
||||
NS_ :
|
||||
NS_DESC_
|
||||
CM_
|
||||
BA_DEF_
|
||||
BA_
|
||||
VAL_
|
||||
CAT_DEF_
|
||||
CAT_
|
||||
FILTER
|
||||
BA_DEF_DEF_
|
||||
EV_DATA_
|
||||
ENVVAR_DATA_
|
||||
SGTYPE_
|
||||
SGTYPE_VAL_
|
||||
BA_DEF_SGTYPE_
|
||||
BA_SGTYPE_
|
||||
SIG_TYPE_REF_
|
||||
VAL_TABLE_
|
||||
SIG_GROUP_
|
||||
SIG_VALTYPE_
|
||||
SIGTYPE_VALTYPE_
|
||||
BO_TX_BU_
|
||||
BA_DEF_REL_
|
||||
BA_REL_
|
||||
BA_DEF_DEF_REL_
|
||||
BU_SG_REL_
|
||||
BU_EV_REL_
|
||||
BU_BO_REL_
|
||||
SG_MUL_VAL_
|
||||
|
||||
BU_: EBCM EON CAM RADAR PCM EPS VSA SCM BDY XXX EPB
|
||||
|
||||
BO_ 148 KINEMATICS: 8 XXX
|
||||
SG_ LAT_ACCEL : 7|10@0+ (-0.035,17.92) [-20|20] "m/s2" EON
|
||||
SG_ LONG_ACCEL : 25|10@0+ (-0.035,17.92) [-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_ 228 STEERING_CONTROL: 5 EON
|
||||
SG_ STEER_TORQUE_REQUEST : 23|1@0+ (1,0) [0|1] "" EPS
|
||||
SG_ SET_ME_X00 : 22|7@0+ (1,0) [0|127] "" EPS
|
||||
SG_ SET_ME_X00_2 : 31|8@0+ (1,0) [0|0] "" EPS
|
||||
SG_ STEER_TORQUE : 7|16@0- (1,0) [-4096|4096] "" EPS
|
||||
SG_ COUNTER : 37|2@0+ (1,0) [0|3] "" EPS
|
||||
SG_ CHECKSUM : 35|4@0+ (1,0) [0|15] "" EPS
|
||||
|
||||
BO_ 229 BOSCH_SUPPLEMENTAL_1: 8 XXX
|
||||
SG_ SET_ME_X04 : 0|8@1+ (1,0) [0|255] "" XXX
|
||||
SG_ SET_ME_X00 : 8|8@1+ (1,0) [0|255] "" XXX
|
||||
SG_ SET_ME_X80 : 16|8@1+ (1,0) [0|255] "" XXX
|
||||
SG_ SET_ME_X10 : 24|8@1+ (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
|
||||
|
||||
BO_ 232 BRAKE_HOLD: 7 XXX
|
||||
SG_ XMISSION_SPEED : 7|14@0- (1,0) [1|0] "" XXX
|
||||
SG_ COMPUTER_BRAKE : 39|16@0+ (1,0) [0|0] "" XXX
|
||||
SG_ COMPUTER_BRAKE_REQUEST : 29|1@0+ (1,0) [0|0] "" XXX
|
||||
SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" XXX
|
||||
SG_ CHECKSUM : 51|4@0+ (1,0) [0|15] "" XXX
|
||||
|
||||
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
|
||||
|
||||
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_ 399 STEER_STATUS: 7 EPS
|
||||
SG_ STEER_TORQUE_SENSOR : 7|16@0- (-1,0) [-31000|31000] "tbd" EON
|
||||
SG_ STEER_ANGLE_RATE : 23|16@0- (-0.1,0) [-31000|31000] "deg/s" EON
|
||||
SG_ STEER_STATUS : 39|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_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON
|
||||
SG_ CHECKSUM : 51|4@0+ (1,0) [0|15] "" EON
|
||||
|
||||
BO_ 420 VSA_STATUS: 8 VSA
|
||||
SG_ ESP_DISABLED : 28|1@0+ (1,0) [0|1] "" EON
|
||||
SG_ USER_BRAKE : 7|16@0+ (0.015625,-1.609375) [0|1000] "" EON
|
||||
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_ 450 EPB_STATUS: 8 EPB
|
||||
SG_ EPB_ACTIVE : 3|1@0+ (1,0) [0|1] "" EON
|
||||
SG_ EPB_STATE : 29|2@0+ (1,0) [0|3] "" EON
|
||||
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX
|
||||
SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX
|
||||
|
||||
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_ 479 ACC_CONTROL: 8 EON
|
||||
SG_ SET_TO_0 : 20|5@0+ (1,0) [0|1] "" XXX
|
||||
SG_ CONTROL_ON : 23|3@0+ (1,0) [0|5] "" XXX
|
||||
SG_ GAS_COMMAND : 7|16@0- (1,0) [0|0] "" XXX
|
||||
SG_ ACCEL_COMMAND : 31|11@0- (0.01,0) [0|0] "m/s2" XXX
|
||||
SG_ BRAKE_LIGHTS : 62|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ BRAKE_REQUEST : 34|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ STANDSTILL : 35|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ STANDSTILL_RELEASE : 36|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ AEB_STATUS : 33|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ AEB_BRAKING : 47|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ AEB_PREPARE : 43|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_ 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_ 495 ACC_CONTROL_ON: 8 XXX
|
||||
SG_ SET_TO_75 : 31|8@0+ (1,0) [0|255] "" XXX
|
||||
SG_ SET_TO_30 : 39|8@0+ (1,0) [0|255] "" XXX
|
||||
SG_ ZEROS_BOH : 23|8@0+ (1,0) [0|255] "" XXX
|
||||
SG_ ZEROS_BOH2 : 47|16@0+ (1,0) [0|255] "" XXX
|
||||
SG_ SET_TO_FF : 15|8@0+ (1,0) [0|255] "" XXX
|
||||
SG_ SET_TO_3 : 6|7@0+ (1,0) [0|4095] "" XXX
|
||||
SG_ CONTROL_ON : 7|1@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 XXX_16: 6 SCM
|
||||
SG_ ECON_ON : 23|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ DRIVE_MODE : 37|2@0+ (1,0) [0|3] "" XXX
|
||||
SG_ COUNTER : 45|2@0+ (1,0) [0|3] "" BDY
|
||||
SG_ CHECKSUM : 43|4@0+ (1,0) [0|15] "" BDY
|
||||
|
||||
BO_ 576 LEFT_LANE_LINE_1: 8 CAM
|
||||
SG_ LINE_DISTANCE_VISIBLE : 39|9@0+ (1,0) [0|1] "" XXX
|
||||
SG_ LINE_PROBABILITY : 46|6@0+ (0.015625,0) [0|1] "" XXX
|
||||
SG_ LINE_OFFSET : 23|12@0+ (0.004,-8.192) [0|1] "Meters" XXX
|
||||
SG_ LINE_ANGLE : 7|12@0+ (0.0005,-1.024) [0|1] "" XXX
|
||||
SG_ FRAME_INDEX : 8|4@1+ (1,0) [0|15] "" XXX
|
||||
SG_ COUNTER : 61|2@0+ (1,0) [0|1] "" XXX
|
||||
SG_ CHECKSUM : 59|4@0+ (1,0) [0|1] "" XXX
|
||||
|
||||
BO_ 577 LEFT_LANE_LINE_2: 8 CAM
|
||||
SG_ LINE_FAR_EDGE_POSITION : 55|8@0+ (1,-128) [0|1] "" XXX
|
||||
SG_ LINE_SOLID : 13|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ LINE_DASHED : 14|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ LINE_CURVATURE : 23|12@0+ (0.00001,-0.02048) [0|1] "" XXX
|
||||
SG_ LINE_PARAMETER : 39|12@0+ (1,0) [0|1] "" XXX
|
||||
SG_ FRAME_INDEX : 7|4@0+ (1,0) [0|15] "" XXX
|
||||
SG_ COUNTER : 61|2@0+ (1,0) [0|1] "" XXX
|
||||
SG_ CHECKSUM : 59|4@0+ (1,0) [0|1] "" XXX
|
||||
|
||||
BO_ 579 RIGHT_LANE_LINE_1: 8 CAM
|
||||
SG_ LINE_DISTANCE_VISIBLE : 39|9@0+ (1,0) [0|1] "" XXX
|
||||
SG_ LINE_PROBABILITY : 46|6@0+ (0.015625,0) [0|1] "" XXX
|
||||
SG_ LINE_OFFSET : 23|12@0+ (0.004,-8.192) [0|1] "Meters" XXX
|
||||
SG_ LINE_ANGLE : 7|12@0+ (0.0005,-1.024) [0|1] "" XXX
|
||||
SG_ FRAME_INDEX : 8|4@1+ (1,0) [0|15] "" XXX
|
||||
SG_ COUNTER : 61|2@0+ (1,0) [0|1] "" XXX
|
||||
SG_ CHECKSUM : 59|4@0+ (1,0) [0|1] "" XXX
|
||||
|
||||
BO_ 580 RIGHT_LANE_LINE_2: 8 CAM
|
||||
SG_ LINE_FAR_EDGE_POSITION : 55|8@0+ (1,-128) [0|1] "" XXX
|
||||
SG_ LINE_SOLID : 13|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ LINE_DASHED : 14|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ LINE_CURVATURE : 23|12@0+ (0.00001,-0.02048) [0|1] "" XXX
|
||||
SG_ LINE_PARAMETER : 39|12@0+ (1,0) [0|1] "" XXX
|
||||
SG_ FRAME_INDEX : 7|4@0+ (1,0) [0|15] "" XXX
|
||||
SG_ COUNTER : 61|2@0+ (1,0) [0|1] "" XXX
|
||||
SG_ CHECKSUM : 59|4@0+ (1,0) [0|1] "" XXX
|
||||
|
||||
BO_ 582 ADJACENT_LEFT_LANE_LINE_1: 8 CAM
|
||||
SG_ LINE_DISTANCE_VISIBLE : 39|9@0+ (1,0) [0|1] "" XXX
|
||||
SG_ LINE_PROBABILITY : 46|6@0+ (0.015625,0) [0|1] "" XXX
|
||||
SG_ LINE_OFFSET : 23|12@0+ (0.004,-8.192) [0|1] "Meters" XXX
|
||||
SG_ LINE_ANGLE : 7|12@0+ (0.0005,-1.024) [0|1] "" XXX
|
||||
SG_ FRAME_INDEX : 8|4@1+ (1,0) [0|15] "" XXX
|
||||
SG_ COUNTER : 61|2@0+ (1,0) [0|1] "" XXX
|
||||
SG_ CHECKSUM : 59|4@0+ (1,0) [0|1] "" XXX
|
||||
|
||||
BO_ 583 ADJACENT_LEFT_LANE_LINE_2: 8 CAM
|
||||
SG_ LINE_FAR_EDGE_POSITION : 55|8@0+ (1,-128) [0|1] "" XXX
|
||||
SG_ LINE_SOLID : 13|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ LINE_DASHED : 14|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ LINE_CURVATURE : 23|12@0+ (0.00001,-0.02048) [0|1] "" XXX
|
||||
SG_ LINE_PARAMETER : 39|12@0+ (1,0) [0|1] "" XXX
|
||||
SG_ FRAME_INDEX : 7|4@0+ (1,0) [0|15] "" XXX
|
||||
SG_ COUNTER : 61|2@0+ (1,0) [0|1] "" XXX
|
||||
SG_ CHECKSUM : 59|4@0+ (1,0) [0|1] "" XXX
|
||||
|
||||
BO_ 585 ADJACENT_RIGHT_LANE_LINE_1: 8 CAM
|
||||
SG_ LINE_DISTANCE_VISIBLE : 39|9@0+ (1,0) [0|1] "" XXX
|
||||
SG_ LINE_PROBABILITY : 46|6@0+ (0.015625,0) [0|1] "" XXX
|
||||
SG_ LINE_OFFSET : 23|12@0+ (0.004,-8.192) [0|1] "Meters" XXX
|
||||
SG_ LINE_ANGLE : 7|12@0+ (0.0005,-1.024) [0|1] "" XXX
|
||||
SG_ FRAME_INDEX : 8|4@1+ (1,0) [0|15] "" XXX
|
||||
SG_ COUNTER : 61|2@0+ (1,0) [0|1] "" XXX
|
||||
SG_ CHECKSUM : 59|4@0+ (1,0) [0|1] "" XXX
|
||||
|
||||
BO_ 586 ADJACENT_RIGHT_LANE_LINE_2: 8 CAM
|
||||
SG_ LINE_FAR_EDGE_POSITION : 55|8@0+ (1,-128) [0|1] "" XXX
|
||||
SG_ LINE_SOLID : 13|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ LINE_DASHED : 14|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ LINE_CURVATURE : 23|12@0+ (0.00001,-0.02048) [0|1] "" XXX
|
||||
SG_ LINE_PARAMETER : 39|12@0+ (1,0) [0|1] "" XXX
|
||||
SG_ FRAME_INDEX : 7|4@0+ (1,0) [0|15] "" XXX
|
||||
SG_ COUNTER : 61|2@0+ (1,0) [0|1] "" XXX
|
||||
SG_ CHECKSUM : 59|4@0+ (1,0) [0|1] "" XXX
|
||||
|
||||
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] "" XXX
|
||||
SG_ SET_TO_X55_2 : 47|8@0+ (1,0) [0|255] "" EON
|
||||
SG_ LONG_COUNTER : 55|8@0+ (1,0) [0|255] "" XXX
|
||||
SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX
|
||||
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX
|
||||
|
||||
BO_ 662 SCM_BUTTONS: 4 SCM
|
||||
SG_ CRUISE_BUTTONS : 7|3@0+ (1,0) [0|7] "" EON
|
||||
SG_ CRUISE_SETTING : 3|2@0+ (1,0) [0|3] "" EON
|
||||
SG_ COUNTER : 29|2@0+ (1,0) [0|3] "" EON
|
||||
SG_ CHECKSUM : 27|4@0+ (1,0) [0|15] "" 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
|
||||
|
||||
BO_ 780 ACC_HUD: 8 ADAS
|
||||
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_ 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_ 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_ ZEROS_BOH : 7|24@0+ (0.002759506,0) [0|100] "m/s" BDY
|
||||
SG_ FCM_OFF : 35|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ SET_TO_1 : 36|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ HUD_DISTANCE : 47|2@0+ (1,0) [0|3] "" BDY
|
||||
SG_ HUD_LEAD : 45|2@0+ (1,0) [0|3] "" BDY
|
||||
SG_ ACC_PROBLEM : 37|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ ACC_ON : 52|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ BOH_6 : 51|4@0+ (1,0) [0|15] "" XXX
|
||||
SG_ SET_TO_X1 : 55|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ IMPERIAL_UNIT : 54|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_ 804 CRUISE: 8 PCM
|
||||
SG_ TRIP_FUEL_CONSUMED : 23|16@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_ 806 SCM_FEEDBACK: 8 SCM
|
||||
SG_ DRIVERS_DOOR_OPEN : 17|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ MAIN_ON : 28|1@0+ (1,0) [0|1] "" EON
|
||||
SG_ RIGHT_BLINKER : 27|1@0+ (1,0) [0|1] "" EON
|
||||
SG_ LEFT_BLINKER : 26|1@0+ (1,0) [0|1] "" EON
|
||||
SG_ CMBS_STATES : 22|2@0+ (1,0) [0|3] "" EON
|
||||
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX
|
||||
SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX
|
||||
|
||||
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_ 862 CAMERA_MESSAGES: 8 CAM
|
||||
SG_ ZEROS_BOH : 7|50@0+ (1,0) [0|127] "" BDY
|
||||
SG_ AUTO_HIGHBEAMS_ACTIVE : 53|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ HIGHBEAMS_ON : 52|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ ZEROS_BOH_2 : 51|4@0+ (1,0) [0|15] "" XXX
|
||||
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX
|
||||
SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX
|
||||
|
||||
BO_ 884 STALK_STATUS: 8 XXX
|
||||
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_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON
|
||||
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" 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_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON
|
||||
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON
|
||||
|
||||
CM_ SG_ 479 AEB_STATUS "set for the duration of AEB event";
|
||||
CM_ SG_ 479 AEB_BRAKING "set when braking is commanded during AEB event";
|
||||
CM_ SG_ 479 AEB_PREPARE "set 1s before AEB";
|
||||
CM_ SG_ 576 LINE_DISTANCE_VISIBLE "Length of line visible, undecoded";
|
||||
CM_ SG_ 577 LINE_FAR_EDGE_POSITION "Appears to be a measure of line thickness, indicates location of the portion of the line furthest from the car, undecoded";
|
||||
CM_ SG_ 577 LINE_PARAMETER "Unclear if this is low quality line curvature rate or if this is something else, but it is correlated with line curvature, undecoded";
|
||||
CM_ SG_ 577 LINE_DASHED "1 = line is dashed";
|
||||
CM_ SG_ 577 LINE_SOLID "1 = line is solid";
|
||||
VAL_ 399 STEER_STATUS 6 "tmp_fault" 5 "fault_1" 4 "no_torque_alert_2" 3 "low_speed_lockout" 2 "no_torque_alert_1" 0 "normal" ;
|
||||
|
||||
CM_ "acura_rdx_2020_can.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_ 419 GEARBOX: 8 PCM
|
||||
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON
|
||||
SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON
|
||||
SG_ GEAR_SHIFTER : 29|6@0+ (1,0) [0|63] "" EON
|
||||
SG_ GEAR : 7|8@0+ (1,0) [0|255] "" EON
|
||||
|
||||
BO_ 432 STANDSTILL: 7 VSA
|
||||
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|15] "" EON
|
||||
|
||||
BO_ 446 BRAKE_MODULE: 3 VSA
|
||||
SG_ BRAKE_PRESSED : 4|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ COUNTER : 21|2@0+ (1,0) [0|3] "" XXX
|
||||
SG_ CHECKSUM : 19|4@0+ (1,0) [0|15] "" XXX
|
||||
|
||||
BO_ 927 RADAR_HUD: 8 RADAR
|
||||
SG_ ZEROS_BOH : 7|10@0+ (1,0) [0|127] "" BDY
|
||||
SG_ CMBS_OFF : 12|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ RESUME_INSTRUCTION : 21|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ SET_TO_1 : 13|1@0+ (1,0) [0|1] "" BDY
|
||||
SG_ ZEROS_BOH2 : 11|4@0+ (1,0) [0|1] "" XXX
|
||||
SG_ APPLY_BRAKES_FOR_CANC : 23|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ ACC_ALERTS : 20|5@0+ (1,0) [0|1] "" BDY
|
||||
SG_ SET_TO_0 : 22|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ LEAD_DISTANCE : 39|8@0+ (1,0) [0|255] "" XXX
|
||||
SG_ BOH : 40|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ BOH_2 : 30|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_ 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
|
||||
|
||||
VAL_ 419 GEAR_SHIFTER 32 "D" 8 "R" 4 "P" ;
|
||||
VAL_ 545 ECON_ON_2 0 "off" 3 "on" ;
|
||||
VAL_ 662 CRUISE_BUTTONS 7 "tbd" 6 "tbd" 5 "tbd" 4 "accel_res" 3 "decel_set" 2 "cancel" 1 "main" 0 "none" ;
|
||||
VAL_ 662 CRUISE_SETTING 3 "distance_adj" 2 "tbd" 1 "lkas_button" 0 "none" ;
|
||||
VAL_ 806 CMBS_BUTTON 3 "pressed" 0 "released" ;
|
||||
VAL_ 891 WIPERS 4 "High" 2 "Low" 0 "Off" ;
|
||||
VAL_ 829 BEEP 3 "single_beep" 2 "triple_beep" 1 "repeated_beep" 0 "no_beep" ;
|
||||
|
||||
CM_ "CHFFR_METRIC 330 STEER_ANGLE STEER_ANGLE 0.36 180; CHFFR_METRIC 380 ENGINE_RPM ENGINE_RPM 1 0; CHFFR_METRIC 804 ENGINE_TEMPERATURE ENGINE_TEMPERATURE 1 0";
|
||||
@@ -97,18 +97,17 @@ unsigned int volkswagen_crc(unsigned int address, uint64_t d, int l) {
|
||||
// a magic variable padding byte tacked onto the end of the payload.
|
||||
// https://www.autosar.org/fileadmin/user_upload/standards/classic/4-3/AUTOSAR_SWS_CRCLibrary.pdf
|
||||
|
||||
uint8_t *dat = (uint8_t *)&d;
|
||||
uint8_t crc = 0xFF; // Standard init value for CRC8 8H2F/AUTOSAR
|
||||
|
||||
// CRC the payload first, skipping over the first byte where the CRC lives.
|
||||
for (int i = 1; i < l; i++) {
|
||||
crc ^= dat[i];
|
||||
crc ^= (d >> (i*8)) & 0xFF;
|
||||
crc = crc8_lut_8h2f[crc];
|
||||
}
|
||||
|
||||
// Look up and apply the magic final CRC padding byte, which permutes by CAN
|
||||
// address, and additionally (for SOME addresses) by the message counter.
|
||||
uint8_t counter = dat[1] & 0x0F;
|
||||
uint8_t counter = ((d >> 8) & 0xFF) & 0x0F;
|
||||
switch(address) {
|
||||
case 0x86: // LWI_01 Steering Angle
|
||||
crc ^= (uint8_t[]){0x86,0x86,0x86,0x86,0x86,0x86,0x86,0x86,0x86,0x86,0x86,0x86,0x86,0x86,0x86,0x86}[counter];
|
||||
@@ -176,11 +175,9 @@ unsigned int pedal_checksum(uint64_t d, int l) {
|
||||
d >>= ((8-l)*8); // remove padding
|
||||
d >>= 8; // remove checksum
|
||||
|
||||
uint8_t *dat = (uint8_t *)&d;
|
||||
|
||||
int i, j;
|
||||
for (i = 0; i < l - 1; i++) {
|
||||
crc ^= dat[i];
|
||||
crc ^= (d >> (i*8)) & 0xFF;
|
||||
for (j = 0; j < 8; j++) {
|
||||
if ((crc & 0x80) != 0) {
|
||||
crc = (uint8_t)((crc << 1) ^ poly);
|
||||
|
||||
@@ -34,7 +34,7 @@ class BuildExtWithoutPlatformSuffix(build_ext):
|
||||
return get_ext_filename_without_platform_suffix(filename)
|
||||
|
||||
|
||||
extra_compile_args = ["-std=c++14", "-Wno-nullability-completeness"]
|
||||
extra_compile_args = ["-std=c++1z", "-Wno-nullability-completeness"]
|
||||
ARCH = subprocess.check_output(["uname", "-m"], encoding='utf8').rstrip() # pylint: disable=unexpected-keyword-arg
|
||||
if ARCH == "aarch64":
|
||||
extra_compile_args += ["-Wno-deprecated-register"]
|
||||
|
||||
@@ -388,7 +388,7 @@ BO_ 304 GAS_PEDAL_2: 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_ 401 GEARBOX: 8 PCM
|
||||
SG_ GEAR_SHIFTER : 5|6@0+ (1,0) [0|63] "" EON
|
||||
SG_ BOH : 45|6@0+ (1,0) [0|63] "" XXX
|
||||
@@ -405,6 +405,11 @@ BO_ 432 STANDSTILL: 7 VSA
|
||||
SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON
|
||||
SG_ CHECKSUM : 51|4@0+ (1,0) [0|15] "" EON
|
||||
|
||||
BO_ 506 LEGACY_BRAKE_COMMAND: 8 ADAS
|
||||
SG_ CHIME : 40|8@1+ (1,0) [0|255] "" XXX
|
||||
SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX
|
||||
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX
|
||||
|
||||
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
|
||||
|
||||
@@ -400,6 +400,11 @@ BO_ 432 STANDSTILL: 7 VSA
|
||||
SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON
|
||||
SG_ CHECKSUM : 51|4@0+ (1,0) [0|15] "" EON
|
||||
|
||||
BO_ 506 LEGACY_BRAKE_COMMAND: 8 ADAS
|
||||
SG_ CHIME : 40|8@1+ (1,0) [0|255] "" XXX
|
||||
SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX
|
||||
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX
|
||||
|
||||
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
|
||||
|
||||
@@ -0,0 +1,404 @@
|
||||
CM_ "AUTOGENERATED FILE, DO NOT EDIT"
|
||||
|
||||
|
||||
CM_ "Imported file _comma.dbc starts here"
|
||||
BO_ 359 STEERING_IPAS_COMMA: 8 IPAS
|
||||
SG_ STATE : 7|4@0+ (1,0) [0|15] "" XXX
|
||||
SG_ ANGLE : 3|12@0- (1.5,0) [-510|510] "deg" XXX
|
||||
SG_ SET_ME_X10 : 23|8@0+ (1,0) [0|255] "" XXX
|
||||
SG_ SET_ME_X00 : 31|8@0+ (1,0) [0|255] "" XXX
|
||||
SG_ DIRECTION_CMD : 38|2@0+ (1,0) [0|3] "" XXX
|
||||
SG_ SET_ME_X40 : 47|8@0+ (1,0) [0|255] "" XXX
|
||||
SG_ SET_ME_X00 : 55|8@0+ (1,0) [0|255] "" XXX
|
||||
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
|
||||
|
||||
CM BO_ STEERING_IPAS_COMMA "Copy of msg 614 so we can do angle control while the Park Assist ECU is connected (Panda spoofs 614 with 359 on connector J70). Note that addresses 0x266 and 0x167 are checksum-invariant";
|
||||
|
||||
BO_ 512 GAS_COMMAND: 6 EON
|
||||
SG_ GAS_COMMAND : 7|16@0+ (0.159375,-75.555) [0|1] "" INTERCEPTOR
|
||||
SG_ GAS_COMMAND2 : 23|16@0+ (0.159375,-151.111) [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+ (0.159375,-75.555) [0|1] "" EON
|
||||
SG_ INTERCEPTOR_GAS2 : 23|16@0+ (0.159375,-151.111) [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 _toyota_2017.dbc starts here"
|
||||
VERSION ""
|
||||
|
||||
|
||||
NS_ :
|
||||
NS_DESC_
|
||||
CM_
|
||||
BA_DEF_
|
||||
BA_
|
||||
VAL_
|
||||
CAT_DEF_
|
||||
CAT_
|
||||
FILTER
|
||||
BA_DEF_DEF_
|
||||
EV_DATA_
|
||||
ENVVAR_DATA_
|
||||
SGTYPE_
|
||||
SGTYPE_VAL_
|
||||
BA_DEF_SGTYPE_
|
||||
BA_SGTYPE_
|
||||
SIG_TYPE_REF_
|
||||
VAL_TABLE_
|
||||
SIG_GROUP_
|
||||
SIG_VALTYPE_
|
||||
SIGTYPE_VALTYPE_
|
||||
BO_TX_BU_
|
||||
BA_DEF_REL_
|
||||
BA_REL_
|
||||
BA_DEF_DEF_REL_
|
||||
BU_SG_REL_
|
||||
BU_EV_REL_
|
||||
BU_BO_REL_
|
||||
SG_MUL_VAL_
|
||||
|
||||
BS_:
|
||||
|
||||
BU_: XXX DSU HCU EPS IPAS CGW
|
||||
|
||||
BO_ 36 KINEMATICS: 8 XXX
|
||||
SG_ ACCEL_Y : 33|10@0+ (0.03589,-18.375) [0|65535] "m/s^2" XXX
|
||||
SG_ YAW_RATE : 1|10@0+ (0.244,-125) [0|65535] "deg/sec" XXX
|
||||
SG_ STEERING_TORQUE : 17|10@0+ (1,-512) [0|65535] "" XXX
|
||||
|
||||
BO_ 37 STEER_ANGLE_SENSOR: 8 XXX
|
||||
SG_ STEER_ANGLE : 3|12@0- (1.5,0) [-500|500] "deg" XXX
|
||||
SG_ STEER_FRACTION : 39|4@0- (0.1,0) [-0.7|0.7] "deg" XXX
|
||||
SG_ STEER_RATE : 35|12@0- (1,0) [-2000|2000] "deg/s" XXX
|
||||
|
||||
BO_ 166 BRAKE: 8 XXX
|
||||
SG_ BRAKE_AMOUNT : 7|8@0+ (1,0) [0|255] "" XXX
|
||||
SG_ BRAKE_PEDAL : 23|8@0+ (1,0) [0|255] "" XXX
|
||||
|
||||
BO_ 170 WHEEL_SPEEDS: 8 XXX
|
||||
SG_ WHEEL_SPEED_FR : 7|16@0+ (0.01,-67.67) [0|250] "kph" XXX
|
||||
SG_ WHEEL_SPEED_FL : 23|16@0+ (0.01,-67.67) [0|250] "kph" XXX
|
||||
SG_ WHEEL_SPEED_RR : 39|16@0+ (0.01,-67.67) [0|250] "kph" XXX
|
||||
SG_ WHEEL_SPEED_RL : 55|16@0+ (0.01,-67.67) [0|250] "kph" XXX
|
||||
|
||||
BO_ 180 SPEED: 8 XXX
|
||||
SG_ ENCODER : 39|8@0+ (1,0) [0|255] "" XXX
|
||||
SG_ SPEED : 47|16@0+ (0.01,0) [0|250] "kph" XXX
|
||||
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
|
||||
|
||||
BO_ 353 DSU_SPEED: 7 XXX
|
||||
SG_ FORWARD_SPEED : 15|16@0- (0.00390625,-30) [0|255] "kph" XXX
|
||||
|
||||
BO_ 452 ENGINE_RPM: 8 CGW
|
||||
SG_ RPM : 7|16@0- (0.78125,0) [0|0] "rpm" SCS
|
||||
|
||||
BO_ 466 PCM_CRUISE: 8 XXX
|
||||
SG_ GAS_RELEASED : 4|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ CRUISE_ACTIVE : 5|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ STANDSTILL_ON : 12|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ ACCEL_NET : 23|16@0- (0.001,0) [-20|20] "m/s2" XXX
|
||||
SG_ CRUISE_STATE : 55|4@0+ (1,0) [0|15] "" XXX
|
||||
SG_ CANCEL_REQ : 49|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
|
||||
|
||||
BO_ 467 PCM_CRUISE_2: 8 XXX
|
||||
SG_ MAIN_ON : 15|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ LOW_SPEED_LOCKOUT : 14|2@0+ (1,0) [0|3] "kph" XXX
|
||||
SG_ SET_SPEED : 23|8@0+ (1,0) [0|255] "kph" XXX
|
||||
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
|
||||
|
||||
BO_ 552 ACCELEROMETER: 8 XXX
|
||||
SG_ ACCEL_Z : 22|15@0- (1,0) [0|32767] "" XXX
|
||||
SG_ ACCEL_X : 6|15@0- (0.001,0) [-20|20] "m/s2" XXX
|
||||
|
||||
BO_ 560 BRAKE_MODULE2: 7 XXX
|
||||
SG_ BRAKE_PRESSED : 26|1@0+ (1,0) [0|1] "" XXX
|
||||
|
||||
BO_ 614 STEERING_IPAS: 8 IPAS
|
||||
SG_ STATE : 7|4@0+ (1,0) [0|15] "" XXX
|
||||
SG_ ANGLE : 3|12@0- (1.5,0) [-510|510] "deg" XXX
|
||||
SG_ SET_ME_X10 : 23|8@0+ (1,0) [0|255] "" XXX
|
||||
SG_ SET_ME_X00 : 31|8@0+ (1,0) [0|255] "" XXX
|
||||
SG_ DIRECTION_CMD : 38|2@0+ (1,0) [0|3] "" XXX
|
||||
SG_ SET_ME_X40 : 47|8@0+ (1,0) [0|255] "" XXX
|
||||
SG_ SET_ME_X00_1 : 55|8@0+ (1,0) [0|255] "" XXX
|
||||
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
|
||||
|
||||
BO_ 643 PRE_COLLISION: 7 DSU
|
||||
SG_ COUNTER : 7|8@0+ (1,0) [0|255] "" XXX
|
||||
SG_ SET_ME_X00 : 15|8@0+ (1,0) [0|255] "" XXX
|
||||
SG_ FORCE : 23|16@0- (2,0) [0|255] "N" XXX
|
||||
SG_ SET_ME_X002 : 33|8@0+ (1,0) [0|3] "" XXX
|
||||
SG_ BRAKE_STATUS : 39|3@0+ (1,0) [0|255] "" XXX
|
||||
SG_ STATE : 36|3@0+ (1,0) [0|255] "" XXX
|
||||
SG_ SET_ME_X003 : 40|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ PRECOLLISION_ACTIVE : 41|1@0+ (1,0) [0|255] "" XXX
|
||||
SG_ CHECKSUM : 55|8@0+ (1,0) [0|255] "" XXX
|
||||
|
||||
BO_ 740 STEERING_LKA: 5 XXX
|
||||
SG_ LKA_STATE : 31|8@0+ (1,0) [0|255] "" XXX
|
||||
SG_ STEER_REQUEST : 0|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ COUNTER : 6|6@0+ (1,0) [0|63] "" XXX
|
||||
SG_ SET_ME_1 : 7|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ STEER_TORQUE_CMD : 15|16@0- (1,0) [0|65535] "" XXX
|
||||
SG_ CHECKSUM : 39|8@0+ (1,0) [0|255] "" XXX
|
||||
|
||||
BO_ 742 LEAD_INFO: 8 DSU
|
||||
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" HCU
|
||||
SG_ LEAD_REL_SPEED : 23|12@0- (0.025,0) [-100|100] "m/s" HCU
|
||||
SG_ LEAD_LONG_DIST : 7|13@0+ (0.05,0) [0|300] "m" HCU
|
||||
|
||||
BO_ 835 ACC_CONTROL: 8 DSU
|
||||
SG_ ACCEL_CMD : 7|16@0- (0.001,0) [-20|20] "m/s2" HCU
|
||||
SG_ SET_ME_X01 : 23|2@0+ (1,0) [0|3] "" HCU
|
||||
SG_ DISTANCE : 20|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ MINI_CAR : 21|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ SET_ME_X3 : 19|4@0+ (1,0) [0|15] "" XXX
|
||||
SG_ PERMIT_BRAKING : 30|1@0+ (1,0) [0|1] "" HCU
|
||||
SG_ RELEASE_STANDSTILL : 31|1@0+ (1,0) [0|1] "" HCU
|
||||
SG_ CANCEL_REQ : 24|1@0+ (1,0) [0|1] "" HCU
|
||||
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
|
||||
SG_ ACCEL_CMD_ALT : 47|8@0- (0.05,0) [0|0] "m/s^2" XXX
|
||||
|
||||
BO_ 836 PRE_COLLISION_2: 8 DSU
|
||||
SG_ CHECKSUM : 63|8@0+ (1,0) [0|0] "" XXX
|
||||
|
||||
BO_ 869 DSU_CRUISE : 7 DSU
|
||||
SG_ RES_BTN : 3|1@0+ (1,0) [0|0] "" XXX
|
||||
SG_ SET_BTN : 2|1@0+ (1,0) [0|0] "" XXX
|
||||
SG_ CANCEL_BTN : 1|1@0+ (1,0) [0|0] "" XXX
|
||||
SG_ MAIN_ON : 0|1@0+ (1,0) [0|0] "" XXX
|
||||
SG_ SET_SPEED : 15|8@0+ (1,0) [0|0] "km/h" XXX
|
||||
SG_ CRUISE_REQUEST : 31|8@0+ (100,-12800) [0|0] "N" XXX
|
||||
SG_ LEAD_DISTANCE : 39|8@0+ (1,0) [0|0] "m" XXX
|
||||
|
||||
BO_ 921 PCM_CRUISE_SM: 8 XXX
|
||||
SG_ MAIN_ON : 4|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ CRUISE_CONTROL_STATE : 11|4@0+ (1,0) [0|15] "" XXX
|
||||
SG_ DISTANCE_LINES : 14|2@0+ (1,0) [0|3] "" XXX
|
||||
SG_ UI_SET_SPEED : 31|8@0+ (1,0) [0|255] "" XXX
|
||||
|
||||
BO_ 951 ESP_CONTROL: 8 ESP
|
||||
SG_ TC_DISABLED : 13|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ VSC_DISABLED : 12|2@0+ (1,0) [0|1] "" XXX
|
||||
SG_ BRAKE_LIGHTS_ACC : 18|1@0+ (1,0) [0|1] "" XXX
|
||||
|
||||
BO_ 1041 ACC_HUD: 8 DSU
|
||||
SG_ FCW : 4|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ SET_ME_X20 : 15|8@0+ (1,0) [0|1] "" XXX
|
||||
SG_ SET_ME_X10 : 39|8@0+ (1,0) [0|1] "" XXX
|
||||
SG_ SET_ME_X80 : 55|8@0+ (1,0) [0|1] "" XXX
|
||||
|
||||
BO_ 1042 LKAS_HUD: 8 XXX
|
||||
SG_ BARRIERS : 1|2@0+ (1,0) [0|3] "" XXX
|
||||
SG_ RIGHT_LINE : 3|2@0+ (1,0) [0|3] "" XXX
|
||||
SG_ LEFT_LINE : 5|2@0+ (1,0) [0|3] "" XXX
|
||||
SG_ SET_ME_X01 : 7|2@0+ (1,0) [0|3] "" XXX
|
||||
SG_ SET_ME_X01_2 : 11|2@0+ (1,0) [0|3] "" XXX
|
||||
SG_ LDA_ALERT : 9|2@0+ (1,0) [0|3] "" XXX
|
||||
SG_ TWO_BEEPS : 12|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ ADJUSTING_CAMERA : 13|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ LDA_MALFUNCTION : 15|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ REPEATED_BEEPS : 32|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ SET_ME_X0C : 23|8@0+ (1,0) [0|1] "" XXX
|
||||
SG_ SET_ME_X2C : 47|8@0+ (1,0) [0|1] "" XXX
|
||||
SG_ SET_ME_X38 : 55|8@0+ (1,0) [0|1] "" XXX
|
||||
SG_ SET_ME_X02 : 63|8@0+ (1,0) [0|1] "" XXX
|
||||
|
||||
BO_ 1043 TIME : 8 CGW
|
||||
SG_ YEAR : 7|8@0+ (1,0) [0|0] "year" XXX
|
||||
SG_ MONTH : 15|8@0+ (1,0) [0|0] "month" XXX
|
||||
SG_ DAY : 23|8@0+ (1,0) [0|0] "day" XXX
|
||||
SG_ HOUR : 31|8@0+ (1,0) [0|0] "hour" XXX
|
||||
SG_ MINUTE : 39|8@0+ (1,0) [0|0] "minute" XXX
|
||||
SG_ GMT_DIFF : 55|1@0+ (1,0) [0|0] "" XXX
|
||||
SG_ GMTDIFF_HOURS : 54|4@0+ (1,0) [0|0] "hours" XXX
|
||||
SG_ GMTDIFF_MINUTES : 50|6@0+ (1,0) [0|0] "minutes" XXX
|
||||
SG_ SUMMER : 60|1@0+ (1,0) [0|0] "" XXX
|
||||
|
||||
BO_ 1408 VIN_PART_1: 8 CGW
|
||||
SG_ VIN_1 : 7|8@0+ (1,0) [0|0] "" XXX
|
||||
SG_ VIN_2 : 15|8@0+ (1,0) [0|0] "" XXX
|
||||
SG_ VIN_3 : 23|8@0+ (1,0) [0|0] "" XXX
|
||||
SG_ VIN_4 : 31|8@0+ (1,0) [0|0] "" XXX
|
||||
SG_ VIN_5 : 39|8@0+ (1,0) [0|0] "" XXX
|
||||
SG_ VIN_6 : 47|8@0+ (1,0) [0|0] "" XXX
|
||||
SG_ VIN_7 : 55|8@0+ (1,0) [0|0] "" XXX
|
||||
SG_ VIN_8 : 63|8@0+ (1,0) [0|0] "" XXX
|
||||
|
||||
BO_ 1409 VIN_PART_2: 8 CGW
|
||||
SG_ VIN_9 : 7|8@0+ (1,0) [0|0] "" XXX
|
||||
SG_ VIN_10 : 15|8@0+ (1,0) [0|0] "" XXX
|
||||
SG_ VIN_11 : 23|8@0+ (1,0) [0|0] "" XXX
|
||||
SG_ VIN_12 : 31|8@0+ (1,0) [0|0] "" XXX
|
||||
SG_ VIN_13 : 39|8@0+ (1,0) [0|0] "" XXX
|
||||
SG_ VIN_14 : 47|8@0+ (1,0) [0|0] "" XXX
|
||||
SG_ VIN_15 : 55|8@0+ (1,0) [0|0] "" XXX
|
||||
SG_ VIN_16 : 63|8@0+ (1,0) [0|0] "" XXX
|
||||
|
||||
BO_ 1410 VIN_PART_3: 8 CGW
|
||||
SG_ VIN_17 : 7|8@0+ (1,0) [0|0] "" XXX
|
||||
|
||||
BO_ 1553 UI_SETTING: 8 XXX
|
||||
SG_ UNITS : 26|2@0+ (1,0) [0|3] "" XXX
|
||||
|
||||
BO_ 1556 STEERING_LEVERS: 8 XXX
|
||||
SG_ TURN_SIGNALS : 29|2@0+ (1,0) [0|3] "" XXX
|
||||
|
||||
BO_ 1568 SEATS_DOORS: 8 XXX
|
||||
SG_ SEATBELT_DRIVER_UNLATCHED : 62|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ DOOR_OPEN_FL : 45|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ DOOR_OPEN_RL : 42|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ DOOR_OPEN_RR : 43|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ DOOR_OPEN_FR : 44|1@0+ (1,0) [0|1] "" XXX
|
||||
|
||||
BO_ 1570 LIGHT_STALK: 8 SCM
|
||||
SG_ AUTO_HIGH_BEAM : 37|1@0+ (1,0) [0|1] "" XXX
|
||||
|
||||
BO_ 1161 RSA1: 8 FCM
|
||||
SG_ TSGN1 : 7|8@0+ (1,0) [0|0] "" XXX
|
||||
SG_ TSGNGRY1 : 12|3@0+ (1,0) [0|0] "" XXX
|
||||
SG_ TSGNHLT1 : 9|2@0+ (1,0) [0|0] "" XXX
|
||||
SG_ SPDVAL1 : 23|8@0+ (1,0) [0|0] "kph" XXX
|
||||
SG_ SPLSGN1 : 31|4@0+ (1,0) [0|0] "" XXX
|
||||
SG_ SPLSGN2 : 27|4@0+ (1,0) [0|0] "" XXX
|
||||
SG_ TSGN2 : 39|8@0+ (1,0) [0|0] "" XXX
|
||||
SG_ TSGNGRY2 : 44|3@0+ (1,0) [0|0] "" XXX
|
||||
SG_ TSGNHLT2 : 41|2@0+ (1,0) [0|0] "" XXX
|
||||
SG_ SPDVAL2 : 55|8@0+ (1,0) [0|0] "" XXX
|
||||
SG_ BZRRQ_P : 63|2@0+ (1,0) [0|0] "" XXX
|
||||
SG_ BZRRQ_A : 61|2@0+ (1,0) [0|0] "" XXX
|
||||
SG_ SYNCID1 : 59|4@0+ (1,0) [0|0] "" XXX
|
||||
|
||||
BO_ 1162 RSA2: 8 FCM
|
||||
SG_ TSGN3 : 7|8@0+ (1,0) [0|0] "" XXX
|
||||
SG_ TSGNGRY3 : 12|3@0+ (1,0) [0|0] "" XXX
|
||||
SG_ TSGNHLT3 : 9|2@0+ (1,0) [0|0] "" XXX
|
||||
SG_ SPLSGN3 : 31|4@0+ (1,0) [0|0] "" XXX
|
||||
SG_ SPLSGN4 : 27|4@0+ (1,0) [0|0] "" XXX
|
||||
SG_ TSGN4 : 39|8@0+ (1,0) [0|0] "" XXX
|
||||
SG_ TSGNGRY4 : 44|3@0+ (1,0) [0|0] "" XXX
|
||||
SG_ TSGNHLT4 : 41|2@0+ (1,0) [0|0] "" XXX
|
||||
SG_ DPSGNREQ : 54|1@0+ (1,0) [0|0] "" XXX
|
||||
SG_ SGNNUMP : 53|3@0+ (1,0) [0|0] "" XXX
|
||||
SG_ SGNNUMA : 50|3@0+ (1,0) [0|0] "" XXX
|
||||
SG_ SPDUNT : 63|2@0+ (1,0) [0|0] "" XXX
|
||||
SG_ TSRWMSG : 61|2@0+ (1,0) [0|0] "" XXX
|
||||
SG_ SYNCID2 : 59|4@0+ (1,0) [0|0] "" XXX
|
||||
|
||||
BO_ 1163 RSA3: 8 FCM
|
||||
SG_ TSREQPD : 7|1@0+ (1,0) [0|0] "" XXX
|
||||
SG_ TSRMSW : 6|1@0+ (1,0) [0|0] "" XXX
|
||||
SG_ OTSGNNTM : 5|2@0+ (1,0) [0|0] "" XXX
|
||||
SG_ NTLVLSPD : 3|2@0+ (1,0) [0|0] "" XXX
|
||||
SG_ OVSPNTM : 1|2@0+ (1,0) [0|0] "" XXX
|
||||
SG_ OVSPVALL : 11|4@0+ (1,-5) [0|0] "" XXX
|
||||
SG_ OVSPVALM : 19|4@0+ (1,-5) [0|0] "" XXX
|
||||
SG_ OVSPVALH : 27|4@0+ (1,-5) [0|0] "" XXX
|
||||
SG_ TSRSPU : 33|2@0+ (1,0) [0|0] "" XXX
|
||||
|
||||
CM_ SG_ 36 ACCEL_Y "unit is tbd";
|
||||
CM_ SG_ 36 YAW_RATE "verify";
|
||||
CM_ SG_ 36 STEERING_TORQUE "does not seem the steer torque, tbd";
|
||||
CM_ SG_ 37 STEER_FRACTION "1/15th of the signal STEER_ANGLE, which is 1.5 deg; note that 0x8 is never set";
|
||||
CM_ SG_ 37 STEER_RATE "factor is tbd";
|
||||
CM_ SG_ 466 ACCEL_NET "net acceleration produced by the system, given ACCEL_CMD, road grade and other factors";
|
||||
CM_ SG_ 467 SET_SPEED "43 kph are shown as 28mph, so conversion isn't perfect";
|
||||
CM_ SG_ 467 LOW_SPEED_LOCKOUT "in low speed lockout, system would always disengage below 28mph";
|
||||
CM_ SG_ 560 BRAKE_PRESSED "another brake pressed?";
|
||||
CM_ SG_ 608 STEER_TORQUE_DRIVER "driver torque";
|
||||
CM_ SG_ 608 STEER_OVERRIDE "set when driver torque exceeds a certain value";
|
||||
CM_ SG_ 614 ANGLE "set to measured angle when ipas control isn't active";
|
||||
CM_ SG_ 643 COUNTER "only used on cars that use this msg for cruise control";
|
||||
CM_ SG_ 643 BRAKE_STATUS "only used on cars that use this msg for cruise control";
|
||||
CM_ SG_ 643 PRECOLLISION_ACTIVE "set 0.5s before any braking";
|
||||
CM_ SG_ 835 PERMIT_BRAKING "Original ACC has this going high when a car in front is detected. In openpilot and before the PERMIT_BRAKING name, this was "SET_ME_1" and is hardcoded to be high. Unsure if only informational or has an effect though existing usage in openpilot is to always set it to 1. Originally 'PMTBRKG' in the leaked toyota_2017_ref_pt.dbc file and name expansion speculated to be PerMiT BRaKinG.";
|
||||
CM_ SG_ 835 ACCEL_CMD_ALT "Copy of main ACCEL_CMD, but across 8 bits instead of 16 bits like ACCEL_CMD. Unsure if only informational or has an effect. Likely informational as existing openpilot sets this to 0 and no loss of functionality observed. Originally 'AT_RAW' in leaked toyota_2017_ref_pt.dbc file.";
|
||||
CM_ SG_ 921 UI_SET_SPEED "set speed shown in UI with user set unit";
|
||||
CM_ SG_ 951 BRAKE_LIGHTS_ACC "brake lights when ACC commands decel";
|
||||
CM_ SG_ 1042 SET_ME_1 "unclear what this is, but it's always 1 in drive traces";
|
||||
CM_ SG_ 1042 REPEATED_BEEPS "recommended for fcw and other important alerts";
|
||||
CM_ SG_ 1161 SPDVAL1 "Numbers 0-199 is displayed, 200-254 displays circle without number and 255 is for no limit.";
|
||||
CM_ SG_ 1161 SYNCID1 "counter from 1 to f at 1 Hz";
|
||||
CM_ SG_ 1161 SPDVAL2 "conditional speed value 70"
|
||||
CM_ SG_ 1162 SGNNUMP "1 if SPDVAL1 is set, otherwise 0";
|
||||
CM_ SG_ 1162 SYNCID2 "counter from 1 to f at 1 Hz";
|
||||
CM_ SG_ 1163 TSREQPD "always 1";
|
||||
CM_ SG_ 1163 TSRMSW "always 1";
|
||||
CM_ SG_ 1163 OTSGNNTM "always 3";
|
||||
CM_ SG_ 1163 NTLVLSPD "always 3";
|
||||
CM_ SG_ 1163 OVSPNTM "always 3";
|
||||
CM_ SG_ 1163 OVSPVALL "-5 at start then 2 after 2 seconds";
|
||||
CM_ SG_ 1163 OVSPVALM "-5 at start then 5 after 2 seconds";
|
||||
CM_ SG_ 1163 OVSPVALH "-5 at start then 10 after 2 seconds";
|
||||
CM_ SG_ 1163 TSRSPU "always 1";
|
||||
|
||||
VAL_ 466 CRUISE_STATE 8 "active" 7 "standstill" 1 "off";
|
||||
VAL_ 467 LOW_SPEED_LOCKOUT 2 "low speed locked" 1 "ok";
|
||||
VAL_ 614 STATE 3 "enabled" 1 "disabled";
|
||||
VAL_ 614 DIRECTION_CMD 3 "right" 2 "center" 1 "left";
|
||||
VAL_ 643 STATE 0 "normal" 1 "adaptive_cruise_control" 3 "emergency_braking";
|
||||
VAL_ 921 CRUISE_CONTROL_STATE 2 "disabled" 11 "hold" 10 "hold_waiting_user_cmd" 6 "enabled" 5 "faulted";
|
||||
VAL_ 1042 LDA_ALERT 3 "hold with continuous beep" 2 "LDA unavailable" 1 "hold" 0 "none";
|
||||
VAL_ 1042 BARRIERS 3 "both" 2 "right" 1 "left" 0 "none";
|
||||
VAL_ 1042 RIGHT_LINE 3 "orange" 2 "faded" 1 "solid" 0 "none";
|
||||
VAL_ 1042 LEFT_LINE 3 "orange" 2 "faded" 1 "solid" 0 "none";
|
||||
VAL_ 1553 UNITS 1 "km" 2 "miles";
|
||||
VAL_ 1556 TURN_SIGNALS 3 "none" 2 "right" 1 "left";
|
||||
VAL_ 1161 TSGN1 1 "speed sign" 0 "none";
|
||||
VAL_ 1161 TSGN2 1 "speed sign" 0 "none";
|
||||
VAL_ 1161 SPLSGN2 15 "conditional blank" 4 "wet road" 5 "rain" 0 "none";
|
||||
VAL_ 1162 TSGN3 0 "none" 1 "speed sign" 2 "0 unlimited" 7 "unlimited" 16 "highway" 17 "no highway" 18 "motorway" 19 "no motorway" 20 "in city" 21 "outside city" 22 "pedestrian area" 23 "no pedestrian area" 65 "no overtaking left" 66 "no overtaking right" 67 "overtaking allowed again" 129 "no entry";
|
||||
VAL_ 1162 SPLSGN3 15 "conditional blank" 4 "wet road" 5 "rain" 0 "none";
|
||||
|
||||
|
||||
CM_ "CHFFR_METRIC 37 STEER_ANGLE STEER_ANGLE 0.36 180";
|
||||
|
||||
CM_ "lexus_nx300_2018_pt.dbc starts here"
|
||||
|
||||
|
||||
|
||||
BO_ 550 BRAKE_MODULE: 8 XXX
|
||||
SG_ BRAKE_PRESSURE : 0|9@0+ (1,0) [0|511] "" XXX
|
||||
SG_ BRAKE_POSITION : 16|9@0+ (1,0) [0|511] "" XXX
|
||||
SG_ BRAKE_PRESSED : 37|1@0+ (1,0) [0|1] "" XXX
|
||||
|
||||
BO_ 705 GAS_PEDAL: 8 XXX
|
||||
SG_ GAS_RELEASED : 3|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ GAS_PEDAL : 55|8@0+ (0.005,0) [0|1] "" XXX
|
||||
|
||||
BO_ 608 STEER_TORQUE_SENSOR: 8 XXX
|
||||
SG_ STEER_TORQUE_EPS : 47|16@0- (0.73,0) [-20000|20000] "" XXX
|
||||
SG_ STEER_TORQUE_DRIVER : 15|16@0- (1,0) [-32768|32767] "" XXX
|
||||
SG_ STEER_OVERRIDE : 0|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
|
||||
SG_ STEER_ANGLE : 31|16@0- (0.0573,0) [-500|500] "" XXX
|
||||
|
||||
BO_ 610 EPS_STATUS: 5 EPS
|
||||
SG_ IPAS_STATE : 3|4@0+ (1,0) [0|15] "" XXX
|
||||
SG_ LKA_STATE : 31|7@0+ (1,0) [0|127] "" XXX
|
||||
SG_ TYPE : 24|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ CHECKSUM : 39|8@0+ (1,0) [0|255] "" XXX
|
||||
|
||||
BO_ 956 GEAR_PACKET: 8 XXX
|
||||
SG_ SPORT_ON : 2|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ GEAR : 13|6@0+ (1,0) [0|63] "" XXX
|
||||
SG_ ECON_ON : 40|1@0+ (1,0) [0|1] "" XXX
|
||||
|
||||
CM_ SG_ 550 BRAKE_PRESSURE "seems prop to pedal force";
|
||||
CM_ SG_ 550 BRAKE_POSITION "seems proportional to pedal displacement, unclear the max value of 0x1c8";
|
||||
CM_ SG_ 581 GAS_PEDAL "it seems slightly filtered";
|
||||
CM_ SG_ 610 TYPE "seems 1 on Corolla, 0 on all others";
|
||||
VAL_ 610 IPAS_STATE 5 "override" 3 "enabled" 1 "disabled";
|
||||
VAL_ 610 LKA_STATE 25 "temporary_fault" 9 "temporary_fault2" 5 "active" 1 "standby";
|
||||
VAL_ 956 GEAR 0 "D" 1 "S" 8 "N" 16 "R" 32 "P";
|
||||
VAL_ 956 SPORT_ON 0 "off" 1 "on";
|
||||
VAL_ 956 ECON_ON 0 "off" 1 "on";
|
||||
@@ -72,11 +72,9 @@ void uno_set_usb_power_mode(uint8_t mode) {
|
||||
bool valid = false;
|
||||
switch (mode) {
|
||||
case USB_POWER_CLIENT:
|
||||
uno_set_phone_power(false);
|
||||
valid = true;
|
||||
break;
|
||||
case USB_POWER_CDP:
|
||||
uno_set_phone_power(true);
|
||||
uno_bootkick();
|
||||
valid = true;
|
||||
break;
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Executable → Regular
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Executable → Regular
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,6 +1,6 @@
|
||||
//=============================================================================
|
||||
//
|
||||
// Copyright (c) 2015 Qualcomm Technologies, Inc.
|
||||
// Copyright (c) 2015, 2020 Qualcomm Technologies, Inc.
|
||||
// All Rights Reserved.
|
||||
// Confidential and Proprietary - Qualcomm Technologies, Inc.
|
||||
//
|
||||
@@ -8,14 +8,11 @@
|
||||
#ifndef __IDIAGLOG_HPP_
|
||||
#define __IDIAGLOG_HPP_
|
||||
|
||||
#ifndef ZDL_LOGGING_EXPORT
|
||||
#define ZDL_LOGGING_EXPORT __attribute__((visibility("default")))
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "DiagLog/Options.hpp"
|
||||
#include "DlSystem/String.hpp"
|
||||
#include "DlSystem/ZdlExportDefine.hpp"
|
||||
|
||||
namespace zdl
|
||||
{
|
||||
@@ -26,10 +23,10 @@ namespace DiagLog
|
||||
@{ */
|
||||
|
||||
/// @brief .
|
||||
///
|
||||
///
|
||||
/// Interface for controlling logging for zdl components.
|
||||
|
||||
class ZDL_LOGGING_EXPORT IDiagLog
|
||||
class ZDL_EXPORT IDiagLog
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -48,7 +45,7 @@ public:
|
||||
///
|
||||
/// @return Diag log options object.
|
||||
virtual Options getOptions() = 0;
|
||||
|
||||
|
||||
/// @brief .
|
||||
///
|
||||
/// Allows for setting the log mask once diag logging has started
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//=============================================================================
|
||||
//
|
||||
// Copyright (c) 2015 Qualcomm Technologies, Inc.
|
||||
// Copyright (c) 2015, 2020 Qualcomm Technologies, Inc.
|
||||
// All Rights Reserved.
|
||||
// Confidential and Proprietary - Qualcomm Technologies, Inc.
|
||||
//
|
||||
@@ -8,12 +8,8 @@
|
||||
#ifndef __DIAGLOG_OPTIONS_HPP_
|
||||
#define __DIAGLOG_OPTIONS_HPP_
|
||||
|
||||
#ifndef ZDL_LOGGING_EXPORT
|
||||
#define ZDL_LOGGING_EXPORT __attribute__((visibility("default")))
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
#include <set>
|
||||
#include "DlSystem/ZdlExportDefine.hpp"
|
||||
|
||||
namespace zdl
|
||||
{
|
||||
@@ -25,7 +21,7 @@ namespace DiagLog
|
||||
/// @brief .
|
||||
///
|
||||
/// Options for setting up diagnostic logging for zdl components.
|
||||
class ZDL_LOGGING_EXPORT Options
|
||||
class ZDL_EXPORT Options
|
||||
{
|
||||
public:
|
||||
Options() :
|
||||
@@ -40,12 +36,12 @@ public:
|
||||
}
|
||||
|
||||
/// @brief .
|
||||
///
|
||||
///
|
||||
/// Enables diag logging only on the specified area mask (DNN_RUNTIME=ON | OFF)
|
||||
std::string DiagLogMask;
|
||||
|
||||
/// @brief .
|
||||
///
|
||||
///
|
||||
/// The path to the directory where log files will be written.
|
||||
/// The path may be relative or absolute. Relative paths are interpreted
|
||||
/// from the current working directory.
|
||||
@@ -53,15 +49,15 @@ public:
|
||||
std::string LogFileDirectory;
|
||||
|
||||
/// @brief .
|
||||
///
|
||||
///
|
||||
//// The name used for log files. If this value is empty then BaseName will be
|
||||
/// used as the default file name.
|
||||
/// Default value is "DiagLog"
|
||||
std::string LogFileName;
|
||||
|
||||
/// @brief .
|
||||
///
|
||||
/// The maximum number of log files to create. If set to 0 no log rotation
|
||||
///
|
||||
/// The maximum number of log files to create. If set to 0 no log rotation
|
||||
/// will be used and the log file name specified will be used each time, overwriting
|
||||
/// any existing log file that may exist.
|
||||
/// Default value is 20
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//=============================================================================
|
||||
//
|
||||
// Copyright (c) 2015,2019 Qualcomm Technologies, Inc.
|
||||
// Copyright (c) 2015-2020 Qualcomm Technologies, Inc.
|
||||
// All Rights Reserved.
|
||||
// Confidential and Proprietary - Qualcomm Technologies, Inc.
|
||||
//
|
||||
@@ -14,7 +14,6 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <set>
|
||||
#include <stdexcept>
|
||||
|
||||
#include "DlSystem/ZdlExportDefine.hpp"
|
||||
#include "DlSystem/String.hpp"
|
||||
@@ -76,7 +75,7 @@ public:
|
||||
*
|
||||
* @return A pointer to the initialized container
|
||||
*/
|
||||
ZDL_EXPORT static std::unique_ptr<IDlContainer>
|
||||
static std::unique_ptr<IDlContainer>
|
||||
open(const std::string &filename) noexcept;
|
||||
|
||||
/**
|
||||
@@ -86,7 +85,7 @@ public:
|
||||
*
|
||||
* @return A pointer to the initialized container
|
||||
*/
|
||||
ZDL_EXPORT static std::unique_ptr<IDlContainer>
|
||||
static std::unique_ptr<IDlContainer>
|
||||
open(const zdl::DlSystem::String &filename) noexcept;
|
||||
|
||||
/**
|
||||
@@ -97,7 +96,7 @@ public:
|
||||
*
|
||||
* @return A pointer to the initialized container
|
||||
*/
|
||||
ZDL_EXPORT static std::unique_ptr<IDlContainer>
|
||||
static std::unique_ptr<IDlContainer>
|
||||
open(const std::vector<uint8_t> &buffer) noexcept;
|
||||
|
||||
/**
|
||||
@@ -110,7 +109,7 @@ public:
|
||||
*
|
||||
* @return A pointer to the initialized container
|
||||
*/
|
||||
ZDL_EXPORT static std::unique_ptr<IDlContainer>
|
||||
static std::unique_ptr<IDlContainer>
|
||||
open(const uint8_t* buffer, const size_t size) noexcept;
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//==============================================================================
|
||||
//
|
||||
// Copyright (c) 2014-2019 Qualcomm Technologies, Inc.
|
||||
// Copyright (c) 2014-2020 Qualcomm Technologies, Inc.
|
||||
// All Rights Reserved.
|
||||
// Confidential and Proprietary - Qualcomm Technologies, Inc.
|
||||
//
|
||||
@@ -128,9 +128,13 @@ enum class ProfilingLevel_t
|
||||
BASIC = 1,
|
||||
|
||||
/// Detailed profiling
|
||||
/// Collects more runtime stats in the DiagLog
|
||||
/// Collects more runtime stats in the DiagLog, including per-layer statistics
|
||||
/// Performance may be impacted
|
||||
DETAILED = 2
|
||||
DETAILED = 2,
|
||||
|
||||
/// Moderate profiling
|
||||
/// Collects more runtime stats in the DiagLog, no per-layer statistics
|
||||
MODERATE = 3
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//==============================================================================
|
||||
//
|
||||
// Copyright (c) 2016-2019 Qualcomm Technologies, Inc.
|
||||
// Copyright (c) 2016-2020 Qualcomm Technologies, Inc.
|
||||
// All Rights Reserved.
|
||||
// Confidential and Proprietary - Qualcomm Technologies, Inc.
|
||||
//
|
||||
@@ -79,6 +79,7 @@ enum class ZDL_EXPORT ErrorCode : uint32_t {
|
||||
SNPE_DLCONTAINER_BAD_DNN_FORMAT_VERSION = 312,
|
||||
SNPE_DLCONTAINER_UNKNOWN_AXIS_ANNOTATION = 313,
|
||||
SNPE_DLCONTAINER_UNKNOWN_SHUFFLE_TYPE = 314,
|
||||
SNPE_DLCONTAINER_TEMP_FILE_FAILURE = 315,
|
||||
|
||||
// Network errors
|
||||
SNPE_NETWORK_EMPTY_NETWORK = 400,
|
||||
@@ -191,7 +192,11 @@ enum class ZDL_EXPORT ErrorCode : uint32_t {
|
||||
|
||||
// DlCaching errors
|
||||
SNPE_DLCACHING_INVALID_METADATA = 1500,
|
||||
SNPE_DLCACHING_INVALID_INITBLOB = 1501
|
||||
SNPE_DLCACHING_INVALID_INITBLOB = 1501,
|
||||
|
||||
// Infrastructure Errors
|
||||
SNPE_INFRA_CLUSTERMGR_INSTANCE_INVALID = 1600,
|
||||
SNPE_INFRA_CLUSTERMGR_EXECUTE_SYNC_FAILED = 1601
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//==============================================================================
|
||||
//
|
||||
// Copyright (c) 2016 Qualcomm Technologies, Inc.
|
||||
// Copyright (c) 2016, 2020 Qualcomm Technologies, Inc.
|
||||
// All Rights Reserved.
|
||||
// Confidential and Proprietary - Qualcomm Technologies, Inc.
|
||||
//
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
#include <cstdio>
|
||||
#include <utility>
|
||||
#include <stdexcept>
|
||||
|
||||
#include "DlSystem/ZdlExportDefine.hpp"
|
||||
|
||||
@@ -173,25 +174,25 @@ private:
|
||||
|
||||
template <typename Q = T>
|
||||
typename std::enable_if<std::is_same<U, Q>::value, const Q&>::type GetReference() const noexcept {
|
||||
if (!isReference()) throw std::bad_exception();
|
||||
if (!isReference()) std::terminate();
|
||||
return *static_cast<const Q*>(m_StoragePtr);
|
||||
}
|
||||
|
||||
template <typename Q = T>
|
||||
typename std::enable_if<std::is_same<U*, Q>::value, const Q&>::type GetReference() const noexcept {
|
||||
if (!isPointer()) throw std::bad_exception();
|
||||
if (!isPointer()) std::terminate();
|
||||
return static_cast<const Q&>(m_StoragePtr);
|
||||
}
|
||||
|
||||
template <typename Q = T>
|
||||
typename std::enable_if<std::is_same<U, Q>::value, Q&>::type GetReference() noexcept {
|
||||
if (!isReference()) throw std::bad_exception();
|
||||
if (!isReference()) std::terminate();
|
||||
return *m_StoragePtr;
|
||||
}
|
||||
|
||||
template <typename Q = T>
|
||||
typename std::enable_if<std::is_same<U*, Q>::value, Q&>::type GetReference() noexcept {
|
||||
if (!isPointer()) throw std::bad_exception();
|
||||
if (!isPointer()) std::terminate();
|
||||
return m_StoragePtr;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//=============================================================================
|
||||
//
|
||||
// Copyright (c) 2015-2018 Qualcomm Technologies, Inc.
|
||||
// Copyright (c) 2015-2020 Qualcomm Technologies, Inc.
|
||||
// All Rights Reserved.
|
||||
// Confidential and Proprietary - Qualcomm Technologies, Inc.
|
||||
//
|
||||
@@ -14,7 +14,6 @@
|
||||
#include "TensorShape.hpp"
|
||||
#include "ZdlExportDefine.hpp"
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <ostream>
|
||||
#include <cmath>
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//=============================================================================
|
||||
//
|
||||
// Copyright (c) 2015 Qualcomm Technologies, Inc.
|
||||
// Copyright (c) 2015-2020 Qualcomm Technologies, Inc.
|
||||
// All Rights Reserved.
|
||||
// Confidential and Proprietary - Qualcomm Technologies, Inc.
|
||||
//
|
||||
@@ -13,7 +13,6 @@
|
||||
|
||||
#include <memory>
|
||||
#include <iterator>
|
||||
#include <vector>
|
||||
|
||||
namespace DlSystem
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//==============================================================================
|
||||
//
|
||||
// Copyright (c) 2017-2019 Qualcomm Technologies, Inc.
|
||||
// Copyright (c) 2017-2020 Qualcomm Technologies, Inc.
|
||||
// All Rights Reserved.
|
||||
// Confidential and Proprietary - Qualcomm Technologies, Inc.
|
||||
//
|
||||
@@ -160,6 +160,14 @@ public:
|
||||
m_StepExactly0(stepFor0),
|
||||
m_QuantizedStepSize(stepSize) {};
|
||||
|
||||
UserBufferEncodingTf8(const zdl::DlSystem::UserBufferEncoding &ubEncoding) : UserBufferEncodingUnsigned8Bit(ubEncoding.getElementType()){
|
||||
const zdl::DlSystem::UserBufferEncodingTf8* ubEncodingTf8
|
||||
= dynamic_cast <const zdl::DlSystem::UserBufferEncodingTf8*> (&ubEncoding);
|
||||
if (ubEncodingTf8) {
|
||||
m_StepExactly0 = ubEncodingTf8->getStepExactly0();
|
||||
m_QuantizedStepSize = ubEncodingTf8->getQuantizedStepSize();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Sets the step value that represents 0
|
||||
@@ -246,6 +254,17 @@ public:
|
||||
bitWidth(bWidth),
|
||||
m_StepExactly0(stepFor0),
|
||||
m_QuantizedStepSize(stepSize){};
|
||||
|
||||
UserBufferEncodingTfN(const zdl::DlSystem::UserBufferEncoding &ubEncoding) : UserBufferEncoding(ubEncoding.getElementType()){
|
||||
const zdl::DlSystem::UserBufferEncodingTfN* ubEncodingTfN
|
||||
= dynamic_cast <const zdl::DlSystem::UserBufferEncodingTfN*> (&ubEncoding);
|
||||
if (ubEncodingTfN) {
|
||||
m_StepExactly0 = ubEncodingTfN->getStepExactly0();
|
||||
m_QuantizedStepSize = ubEncodingTfN->getQuantizedStepSize();
|
||||
bitWidth = ubEncodingTfN->bitWidth;
|
||||
}
|
||||
}
|
||||
|
||||
size_t getElementSize() const noexcept override;
|
||||
/**
|
||||
* @brief Sets the step value that represents 0
|
||||
@@ -283,7 +302,7 @@ public:
|
||||
* @return Minimum representable floating point value
|
||||
*/
|
||||
float getMin() const {
|
||||
return m_QuantizedStepSize * (0 - (double)m_StepExactly0);
|
||||
return static_cast<float>(m_QuantizedStepSize * (0 - (double)m_StepExactly0));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -293,7 +312,7 @@ public:
|
||||
* @return Maximum representable floating point value
|
||||
*/
|
||||
float getMax() const{
|
||||
return m_QuantizedStepSize * (pow(2,bitWidth)-1 - (double)m_StepExactly0);
|
||||
return static_cast<float>(m_QuantizedStepSize * (pow(2,bitWidth)-1 - (double)m_StepExactly0));
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//=============================================================================
|
||||
//
|
||||
// Copyright (c) 2017 Qualcomm Technologies, Inc.
|
||||
// Copyright (c) 2017, 2020 Qualcomm Technologies, Inc.
|
||||
// All Rights Reserved.
|
||||
// Confidential and Proprietary - Qualcomm Technologies, Inc.
|
||||
//
|
||||
@@ -12,10 +12,7 @@
|
||||
#include <cstdio>
|
||||
#include <string>
|
||||
#include <ostream>
|
||||
|
||||
#ifndef ZDL_EXPORT
|
||||
#define ZDL_EXPORT __attribute__((visibility("default")))
|
||||
#endif
|
||||
#include "DlSystem/ZdlExportDefine.hpp"
|
||||
|
||||
namespace zdl
|
||||
{
|
||||
@@ -105,4 +102,3 @@ ZDL_EXPORT std::ostream& operator<<(std::ostream& os, const String& str) noexcep
|
||||
/** @} */ /* end_addtogroup c_plus_plus_apis C++ */
|
||||
|
||||
#endif // PLATFORM_STANDARD_STRING_HPP
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//=============================================================================
|
||||
//
|
||||
// Copyright (c) 2017 Qualcomm Technologies, Inc.
|
||||
// Copyright (c) 2017-2020 Qualcomm Technologies, Inc.
|
||||
// All Rights Reserved.
|
||||
// Confidential and Proprietary - Qualcomm Technologies, Inc.
|
||||
//
|
||||
@@ -8,7 +8,6 @@
|
||||
#include <initializer_list>
|
||||
#include <cstdio>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include "ZdlExportDefine.hpp"
|
||||
#include "DlSystem/TensorShape.hpp"
|
||||
#include "DlSystem/StringList.hpp"
|
||||
|
||||
@@ -1,16 +1,13 @@
|
||||
//=============================================================================
|
||||
//
|
||||
// Copyright (c) 2015 Qualcomm Technologies, Inc.
|
||||
// Copyright (c) 2015, 2020 Qualcomm Technologies, Inc.
|
||||
// All Rights Reserved.
|
||||
// Confidential and Proprietary - Qualcomm Technologies, Inc.
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
#ifndef _ZDL_EXPORT_DEFINE_HPP_
|
||||
#define _ZDL_EXPORT_DEFINE_HPP_
|
||||
#pragma once
|
||||
|
||||
#ifndef ZDL_EXPORT
|
||||
#define ZDL_EXPORT __attribute__((visibility("default")))
|
||||
#endif
|
||||
|
||||
#define ZDL_EXPORT
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
// =============================================================================
|
||||
//
|
||||
// Copyright (c) 2018-2019 Qualcomm Technologies, Inc.
|
||||
// All Rights Reserved.
|
||||
// Confidential and Proprietary - Qualcomm Technologies, Inc.
|
||||
//
|
||||
// =============================================================================
|
||||
|
||||
#ifndef SNPE_PLATFORMVALIDATOR_HPP
|
||||
#define SNPE_PLATFORMVALIDATOR_HPP
|
||||
|
||||
#include "DlSystem/DlEnums.hpp"
|
||||
#include "DlSystem/DlMacros.hpp"
|
||||
SNPE_DISABLE_WARNINGS("-Wdelete-non-virtual-dtor","-Wdelete-non-virtual-dtor")
|
||||
#include <string>
|
||||
#include <memory>
|
||||
SNPE_ENABLE_WARNINGS
|
||||
|
||||
namespace zdl
|
||||
{
|
||||
namespace SNPE
|
||||
{
|
||||
class PlatformValidator;
|
||||
|
||||
class IPlatformValidatorRuntime;
|
||||
}
|
||||
}
|
||||
|
||||
/** @addtogroup c_plus_plus_apis C++
|
||||
@{ */
|
||||
|
||||
/**
|
||||
* The class for checking SNPE compatibility/capability of a device.
|
||||
*
|
||||
*/
|
||||
|
||||
class zdl::SNPE::PlatformValidator
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief Default Constructor of the PlatformValidator Class
|
||||
*
|
||||
* @return A new instance of a PlatformValidator object
|
||||
* that can be used to check the SNPE compatibility
|
||||
* of a device
|
||||
*/
|
||||
PlatformValidator();
|
||||
|
||||
~PlatformValidator();
|
||||
|
||||
/**
|
||||
* @brief Sets the runtime processor for compatibility check
|
||||
*
|
||||
* @return Void
|
||||
*/
|
||||
void setRuntime(zdl::DlSystem::Runtime_t runtime);
|
||||
|
||||
/**
|
||||
* @brief Checks if the Runtime prerequisites for SNPE are available.
|
||||
*
|
||||
* @return True if the Runtime prerequisites are available, else false.
|
||||
*/
|
||||
bool isRuntimeAvailable();
|
||||
|
||||
/**
|
||||
* @brief Returns the core version for the Runtime selected.
|
||||
*
|
||||
* @return String which contains the actual core version value
|
||||
*/
|
||||
std::string getCoreVersion();
|
||||
|
||||
/**
|
||||
* @brief Returns the library version for the Runtime selected.
|
||||
*
|
||||
* @return String which contains the actual lib version value
|
||||
*/
|
||||
std::string getLibVersion();
|
||||
|
||||
/**
|
||||
* @brief Runs a small program on the runtime and Checks if SNPE is supported for Runtime.
|
||||
*
|
||||
* @return If True, the device is ready for SNPE execution, else not.
|
||||
*/
|
||||
|
||||
bool runtimeCheck();
|
||||
|
||||
private:
|
||||
zdl::DlSystem::Runtime_t m_runtimeType;
|
||||
std::unique_ptr<IPlatformValidatorRuntime> m_platformValidatorRuntime;
|
||||
};
|
||||
/** @} */ /* end_addtogroup c_plus_plus_apis C++ */
|
||||
|
||||
#endif //SNPE_PLATFORMVALIDATOR_HPP
|
||||
@@ -1,6 +1,6 @@
|
||||
// =============================================================================
|
||||
//
|
||||
// Copyright (c) 2019 Qualcomm Technologies, Inc.
|
||||
// Copyright (c) 2019-2020 Qualcomm Technologies, Inc.
|
||||
// All Rights Reserved.
|
||||
// Confidential and Proprietary - Qualcomm Technologies, Inc.
|
||||
//
|
||||
@@ -10,7 +10,6 @@
|
||||
#define PSNPE_HPP
|
||||
|
||||
#include <cstdlib>
|
||||
#include <unordered_map>
|
||||
#include <functional>
|
||||
#include "SNPE/SNPE.hpp"
|
||||
#include "DlSystem/UserBufferMap.hpp"
|
||||
@@ -73,22 +72,40 @@ struct ZDL_EXPORT InputOutputAsyncCallbackParam
|
||||
|
||||
};
|
||||
};
|
||||
/**
|
||||
* @brief This callback is called when the output data is ready, only use for Output Async mode
|
||||
*/
|
||||
using OutputAsyncCallbackFunc = std::function<void(OutputAsyncCallbackParam)>;
|
||||
/**
|
||||
* @brief This callback is called when the output data is ready, only use for Output-Input Async mode
|
||||
*/
|
||||
using InputOutputAsyncCallbackFunc = std::function<void(InputOutputAsyncCallbackParam)>;
|
||||
/**
|
||||
* @brief This callback is called when the input data is ready,only use for Output-Input Async mode
|
||||
*/
|
||||
using InputOutputAsyncInputCallback = std::function<std::shared_ptr<ApplicationBufferMap>(const std::vector<std::string> &,
|
||||
const zdl::DlSystem::StringList &)>;
|
||||
/**
|
||||
* @brief .
|
||||
*
|
||||
* A structure BulkSNPE configuration
|
||||
* A structure PSNPE configuration
|
||||
*
|
||||
*/
|
||||
struct ZDL_EXPORT BuildConfig final
|
||||
{
|
||||
BuildMode buildMode = BuildMode::SERIAL;
|
||||
zdl::DlContainer::IDlContainer* container;
|
||||
zdl::DlSystem::StringList outputBufferNames;
|
||||
RuntimeConfigList runtimeConfigList;
|
||||
OutputAsyncCallbackFunc outputCallback;
|
||||
InputOutputAsyncCallbackFunc inputOutputCallback;
|
||||
InputOutputTransmissionMode inputOutputTransmissionMode = InputOutputTransmissionMode::sync;
|
||||
BuildMode buildMode = BuildMode::SERIAL; ///< Specify build in serial mode or parallel mode
|
||||
zdl::DlContainer::IDlContainer* container;///< The opened container ptr
|
||||
zdl::DlSystem::StringList outputBufferNames;///< Specify the output layer name
|
||||
RuntimeConfigList runtimeConfigList;///< The runtime config list for PSNPE, @see RuntimeConfig
|
||||
size_t inputThreadNumbers = 1;///< Specify the number of threads used in the execution phase to process input data, only used in inputOutputAsync mode
|
||||
size_t outputThreadNumbers = 1;///< Specify the number of threads used in the execution phase to process output data, only used in inputOutputAsync and outputAsync mode
|
||||
OutputAsyncCallbackFunc outputCallback;///< The callback to deal with output data ,only used in outputAsync mode
|
||||
InputOutputAsyncCallbackFunc inputOutputCallback;///< The callback to deal with output data ,only used in inputOutputAsync mode
|
||||
InputOutputAsyncInputCallback inputOutputInputCallback;///< The callback to deal with input data ,only used in inputOutputAsync mode
|
||||
InputOutputTransmissionMode inputOutputTransmissionMode = InputOutputTransmissionMode::sync;///< Specify execution mode
|
||||
zdl::DlSystem::ProfilingLevel_t profilingLevel = zdl::DlSystem::ProfilingLevel_t::OFF;///< Specify profiling level for Diaglog
|
||||
uint64_t encode[2] = {0, 0};
|
||||
bool enableInitCache = false;
|
||||
};
|
||||
/**
|
||||
* @brief .
|
||||
@@ -130,7 +147,8 @@ class ZDL_EXPORT PSNPE final
|
||||
*
|
||||
* @return True if executed successfully; flase, otherwise.
|
||||
*/
|
||||
bool executeInputOutputAsync(const ApplicationBufferMap& inputMap, size_t dataIndex, bool isTF8buff) noexcept;
|
||||
bool executeInputOutputAsync(const std::vector<std::string>& inputMap, size_t dataIndex, bool isTF8buff) noexcept;
|
||||
bool executeInputOutputAsync(const std::vector<std::string>& inputMap, size_t dataIndex, bool isTF8buff,bool isTF8Outputbuff) noexcept;
|
||||
/**
|
||||
* @brief Returns the input layer names of the network.
|
||||
*
|
||||
@@ -161,6 +179,8 @@ class ZDL_EXPORT PSNPE final
|
||||
*/
|
||||
const zdl::DlSystem::TensorShape getBufferAttributesDims(const char *name) const noexcept;
|
||||
|
||||
zdl::DlSystem::Optional<zdl::DlSystem::IBufferAttributes*> getInputOutputBufferAttributes(const char *name) const noexcept;
|
||||
|
||||
private:
|
||||
PSNPE(const PSNPE&) = delete;
|
||||
PSNPE& operator=(const PSNPE&) = delete;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//==============================================================================
|
||||
//
|
||||
// Copyright (c) 2019 Qualcomm Technologies, Inc.
|
||||
// Copyright (c) 2019-2020 Qualcomm Technologies, Inc.
|
||||
// All Rights Reserved.
|
||||
// Confidential and Proprietary - Qualcomm Technologies, Inc.
|
||||
//
|
||||
@@ -9,80 +9,77 @@
|
||||
#define PSNPE_RUNTIMECONFIGLIST_HPP
|
||||
|
||||
#include <iostream>
|
||||
#include "DlSystem/DlEnums.hpp"
|
||||
#include "DlContainer/IDlContainer.hpp"
|
||||
#include "DlSystem/ZdlExportDefine.hpp"
|
||||
#include "DlSystem/DlEnums.hpp"
|
||||
#include "DlSystem/RuntimeList.hpp"
|
||||
|
||||
#include "DlSystem/TensorShapeMap.hpp"
|
||||
#include "DlSystem/ZdlExportDefine.hpp"
|
||||
namespace zdl {
|
||||
namespace PSNPE
|
||||
{
|
||||
namespace PSNPE {
|
||||
|
||||
/** @addtogroup c_plus_plus_apis C++
|
||||
@{ */
|
||||
|
||||
/**
|
||||
* @brief .
|
||||
*
|
||||
* The structure for configuring a BulkSNPE runtime
|
||||
*
|
||||
*/
|
||||
* @brief .
|
||||
*
|
||||
* The structure for configuring a BulkSNPE runtime
|
||||
*
|
||||
*/
|
||||
struct ZDL_EXPORT RuntimeConfig final {
|
||||
zdl::DlSystem::Runtime_t runtime;
|
||||
zdl::DlSystem::RuntimeList runtimeList;
|
||||
zdl::DlSystem::PerformanceProfile_t perfProfile;
|
||||
bool enableCPUFallback;
|
||||
RuntimeConfig(): runtime{zdl::DlSystem::Runtime_t::CPU_FLOAT32},
|
||||
perfProfile{zdl::DlSystem::PerformanceProfile_t::HIGH_PERFORMANCE},
|
||||
enableCPUFallback{false}
|
||||
{}
|
||||
RuntimeConfig(const RuntimeConfig& other)
|
||||
{
|
||||
runtime = other.runtime;
|
||||
runtimeList = other.runtimeList;
|
||||
perfProfile = other.perfProfile;
|
||||
enableCPUFallback = other.enableCPUFallback;
|
||||
}
|
||||
zdl::DlSystem::Runtime_t runtime;
|
||||
zdl::DlSystem::RuntimeList runtimeList;
|
||||
zdl::DlSystem::PerformanceProfile_t perfProfile;
|
||||
zdl::DlSystem::TensorShapeMap inputDimensionsMap;
|
||||
bool enableCPUFallback;
|
||||
RuntimeConfig()
|
||||
: runtime{zdl::DlSystem::Runtime_t::CPU_FLOAT32},
|
||||
perfProfile{zdl::DlSystem::PerformanceProfile_t::HIGH_PERFORMANCE},
|
||||
enableCPUFallback{false} {}
|
||||
RuntimeConfig(const RuntimeConfig& other) {
|
||||
runtime = other.runtime;
|
||||
runtimeList = other.runtimeList;
|
||||
perfProfile = other.perfProfile;
|
||||
enableCPUFallback = other.enableCPUFallback;
|
||||
inputDimensionsMap = other.inputDimensionsMap;
|
||||
}
|
||||
|
||||
RuntimeConfig& operator=(const RuntimeConfig &other)
|
||||
{
|
||||
this->runtimeList = other.runtimeList;
|
||||
this->runtime = other.runtime;
|
||||
this->perfProfile = other.perfProfile;
|
||||
this->enableCPUFallback = other.enableCPUFallback;
|
||||
return *this;
|
||||
}
|
||||
|
||||
~RuntimeConfig() {}
|
||||
RuntimeConfig& operator=(const RuntimeConfig& other) {
|
||||
this->runtimeList = other.runtimeList;
|
||||
this->runtime = other.runtime;
|
||||
this->perfProfile = other.perfProfile;
|
||||
this->enableCPUFallback = other.enableCPUFallback;
|
||||
this->inputDimensionsMap = other.inputDimensionsMap;
|
||||
return *this;
|
||||
}
|
||||
|
||||
~RuntimeConfig() {}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief .
|
||||
*
|
||||
* The class for creating a RuntimeConfig container.
|
||||
*
|
||||
*/
|
||||
class ZDL_EXPORT RuntimeConfigList final
|
||||
{
|
||||
public:
|
||||
RuntimeConfigList();
|
||||
RuntimeConfigList(const size_t size);
|
||||
void push_back(const RuntimeConfig &runtimeConfig);
|
||||
RuntimeConfig& operator[](const size_t index);
|
||||
RuntimeConfigList& operator =(const RuntimeConfigList &other);
|
||||
size_t size() const noexcept;
|
||||
size_t capacity() const noexcept;
|
||||
void clear() noexcept;
|
||||
~RuntimeConfigList() = default;
|
||||
|
||||
private:
|
||||
void swap(const RuntimeConfigList &other);
|
||||
std::vector<RuntimeConfig> m_runtimeConfigs;
|
||||
* @brief .
|
||||
*
|
||||
* The class for creating a RuntimeConfig container.
|
||||
*
|
||||
*/
|
||||
class ZDL_EXPORT RuntimeConfigList final {
|
||||
public:
|
||||
RuntimeConfigList();
|
||||
RuntimeConfigList(const size_t size);
|
||||
void push_back(const RuntimeConfig& runtimeConfig);
|
||||
RuntimeConfig& operator[](const size_t index);
|
||||
RuntimeConfigList& operator=(const RuntimeConfigList& other);
|
||||
size_t size() const noexcept;
|
||||
size_t capacity() const noexcept;
|
||||
void clear() noexcept;
|
||||
~RuntimeConfigList() = default;
|
||||
|
||||
private:
|
||||
void swap(const RuntimeConfigList& other);
|
||||
std::vector<RuntimeConfig> m_runtimeConfigs;
|
||||
};
|
||||
/** @} */ /* end_addtogroup c_plus_plus_apis C++ */
|
||||
|
||||
} // namespace PSNPE
|
||||
} // namespace zdl
|
||||
#endif //PSNPE_RUNTIMECONFIGLIST_HPP
|
||||
} // namespace PSNPE
|
||||
} // namespace zdl
|
||||
#endif // PSNPE_RUNTIMECONFIGLIST_HPP
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//==============================================================================
|
||||
//
|
||||
// Copyright (c) 2015-2017 Qualcomm Technologies, Inc.
|
||||
// Copyright (c) 2015-2020 Qualcomm Technologies, Inc.
|
||||
// All Rights Reserved.
|
||||
// Confidential and Proprietary - Qualcomm Technologies, Inc.
|
||||
//
|
||||
@@ -9,9 +9,6 @@
|
||||
#ifndef _SNPE_SNPE_HPP_
|
||||
#define _SNPE_SNPE_HPP_
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
#include "DlSystem/DlOptional.hpp"
|
||||
#include "DlSystem/DlVersion.hpp"
|
||||
#include "DlSystem/IBufferAttributes.hpp"
|
||||
|
||||
@@ -0,0 +1,483 @@
|
||||
//==============================================================================
|
||||
//
|
||||
// Copyright (c) 2019-2020 Qualcomm Technologies, Inc.
|
||||
// All Rights Reserved.
|
||||
// Confidential and Proprietary - Qualcomm Technologies, Inc.
|
||||
//
|
||||
//==============================================================================
|
||||
|
||||
#ifndef SNPE_UDO_BASE_H
|
||||
#define SNPE_UDO_BASE_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
// Provide values to use for API version.
|
||||
#define API_VERSION_MAJOR 1
|
||||
#define API_VERSION_MINOR 5
|
||||
#define API_VERSION_TEENY 0
|
||||
|
||||
/** @addtogroup c_plus_plus_apis C++
|
||||
@{ */
|
||||
|
||||
// Defines a bitmask of enum values.
|
||||
typedef uint32_t SnpeUdo_Bitmask_t;
|
||||
|
||||
// A string of characters, rather than an array of bytes.
|
||||
// Assumed to be UTF-8.
|
||||
typedef char* SnpeUdo_String_t;
|
||||
|
||||
// The maximum allowable length of a SnpeUdo_String_t in bytes,
|
||||
// including null terminator. SNPE will truncate strings longer
|
||||
// than this.
|
||||
#define SNPE_UDO_MAX_STRING_SIZE 1024
|
||||
|
||||
/**
|
||||
* An enum which holds the various error types.
|
||||
* The error types are divided to classes :
|
||||
* 0 - 99 : generic errors
|
||||
* 100 - 200 : errors related to configuration
|
||||
*
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
/// No Error
|
||||
SNPE_UDO_NO_ERROR = 0,
|
||||
/// Unsupported value for core type
|
||||
SNPE_UDO_WRONG_CORE = 1,
|
||||
/// Invalid attribute/argument passed into UDO API
|
||||
SNPE_UDO_INVALID_ARGUMENT = 2,
|
||||
/// Unsupported feature error
|
||||
SNPE_UDO_UNSUPPORTED_FEATURE = 3,
|
||||
/// Error relating to memory allocation
|
||||
SNPE_UDO_MEM_ALLOC_ERROR = 4,
|
||||
/* Configuration Specific errors */
|
||||
/// No op with given attributes available in library
|
||||
SNPE_UDO_WRONG_OPERATION = 100,
|
||||
/// Unsupported value for core type in UDO configuration
|
||||
SNPE_UDO_WRONG_CORE_TYPE = 101,
|
||||
/// Wrong number of params in UDO definition
|
||||
SNPE_UDO_WRONG_NUM_OF_PARAMS = 102,
|
||||
/// Wrong number of dimensions for tensor(s) in UDO definition
|
||||
SNPE_UDO_WRONG_NUM_OF_DIMENSIONS = 103,
|
||||
/// Wrong number of input tensors in UDO definition
|
||||
SNPE_UDO_WRONG_NUM_OF_INPUTS = 104,
|
||||
/// Wrong number of output tensors in UDO definition
|
||||
SNPE_UDO_WRONG_NUM_OF_OUTPUTS = 105,
|
||||
SNPE_UDO_PROGRAM_CACHE_NOT_FOUND = 106,
|
||||
SNPE_UDO_UNKNOWN_ERROR = 0xFFFFFFFF
|
||||
} SnpeUdo_ErrorType_t;
|
||||
|
||||
/**
|
||||
* An enum which holds the various data types.
|
||||
* Designed to be used as single values or combined into a bitfield parameter
|
||||
* (0x1, 0x2, 0x4, etc)
|
||||
* \n FIXED_XX types are targeted for data in tensors.
|
||||
* \n UINT / INT types are targeted for scalar params
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
/// data type: 16-bit floating point
|
||||
SNPE_UDO_DATATYPE_FLOAT_16 = 0x01,
|
||||
/// data type: 32-bit floating point
|
||||
SNPE_UDO_DATATYPE_FLOAT_32 = 0x02,
|
||||
/// data type: 4-bit fixed point
|
||||
SNPE_UDO_DATATYPE_FIXED_4 = 0x04,
|
||||
/// data type: 8-bit fixed point
|
||||
SNPE_UDO_DATATYPE_FIXED_8 = 0x08,
|
||||
/// data type: 16-bit fixed point
|
||||
SNPE_UDO_DATATYPE_FIXED_16 = 0x10,
|
||||
/// data type: 32-bit fixed point
|
||||
SNPE_UDO_DATATYPE_FIXED_32 = 0x20,
|
||||
/// data type: 8-bit unsigned integer
|
||||
SNPE_UDO_DATATYPE_UINT_8 = 0x100,
|
||||
/// data type: 16-bit unsigned integer
|
||||
SNPE_UDO_DATATYPE_UINT_16 = 0x200,
|
||||
/// data type: 32-bit unsigned integer
|
||||
SNPE_UDO_DATATYPE_UINT_32 = 0x400,
|
||||
/// data type: 8-bit signed integer
|
||||
SNPE_UDO_DATATYPE_INT_8 = 0x1000,
|
||||
/// data type: 16-bit signed integer
|
||||
SNPE_UDO_DATATYPE_INT_16 = 0x2000,
|
||||
/// data type: 32-bit signed integer
|
||||
SNPE_UDO_DATATYPE_INT_32 = 0x4000,
|
||||
SNPE_UDO_DATATYPE_LAST = 0xFFFFFFFF
|
||||
} SnpeUdo_DataType_t;
|
||||
|
||||
/**
|
||||
* An enum which holds the various layouts.
|
||||
* Designed to be used as single values or combined into a bitfield parameter
|
||||
* (0x1, 0x2, 0x4, etc)
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
/// data layout (4D): NHWC (batch-height-width-channel)
|
||||
SNPE_UDO_LAYOUT_NHWC = 0x01,
|
||||
/// data layout (4D): NCHW (batch-channel-height-width)
|
||||
SNPE_UDO_LAYOUT_NCHW = 0x02,
|
||||
/// data layout (5D): NDHWC (batch-dimension-height-width-channel)
|
||||
SNPE_UDO_LAYOUT_NDHWC = 0x04,
|
||||
SNPE_UDO_LAYOUT_GPU_OPTIMAL1 = 0x08,
|
||||
SNPE_UDO_LAYOUT_GPU_OPTIMAL2 = 0x10,
|
||||
SNPE_UDO_LAYOUT_DSP_OPTIMAL1 = 0x11,
|
||||
SNPE_UDO_LAYOUT_DSP_OPTIMAL2 = 0x12,
|
||||
// Indicates no data will be allocated for this tensor.
|
||||
// Used to specify optional inputs/outputs positionally.
|
||||
SNPE_UDO_LAYOUT_NULL = 0x13,
|
||||
SNPE_UDO_LAYOUT_LAST = 0xFFFFFFFF
|
||||
} SnpeUdo_TensorLayout_t;
|
||||
|
||||
/**
|
||||
* An enum which holds the UDO library Core type .
|
||||
* Designed to be used as single values or combined into a bitfield parameter
|
||||
* (0x1, 0x2, 0x4, etc)
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
/// Library target IP Core is undefined
|
||||
SNPE_UDO_CORETYPE_UNDEFINED = 0x00,
|
||||
/// Library target IP Core is CPU
|
||||
SNPE_UDO_CORETYPE_CPU = 0x01,
|
||||
/// Library target IP Core is GPU
|
||||
SNPE_UDO_CORETYPE_GPU = 0x02,
|
||||
/// Library target IP Core is DSP
|
||||
SNPE_UDO_CORETYPE_DSP = 0x04,
|
||||
SNPE_UDO_CORETYPE_LAST = 0xFFFFFFFF
|
||||
} SnpeUdo_CoreType_t;
|
||||
|
||||
/**
|
||||
* An enum to specify the parameter type : Scalar or Tensor
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
/// UDO static param type: scalar
|
||||
SNPE_UDO_PARAMTYPE_SCALAR,
|
||||
/// UDO static param type: string
|
||||
SNPE_UDO_PARAMTYPE_STRING,
|
||||
/// UDO static param type: tensor
|
||||
SNPE_UDO_PARAMTYPE_TENSOR,
|
||||
SNPE_UDO_PARAMTYPE_LAST = 0xFFFFFFFF
|
||||
} SnpeUdo_ParamType_t;
|
||||
|
||||
/**
|
||||
* An enum to specify quantization type
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
/// Tensor Quantization type: NONE. Signifies unquantized tensor data
|
||||
SNPE_UDO_QUANTIZATION_NONE,
|
||||
/// Tensor Quantization type: Tensorflow-style
|
||||
SNPE_UDO_QUANTIZATION_TF,
|
||||
SNPE_UDO_QUANTIZATION_QMN,
|
||||
SNPE_UDO_QUANTIZATION_LAST = 0xFFFFFFFF
|
||||
} SnpeUdo_QuantizationType_t;
|
||||
|
||||
/**
|
||||
* @brief A struct which is used to provide a version number using 3 values : major, minor, teeny
|
||||
*
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
/// version field: major - for backward-incompatible changes
|
||||
uint32_t major;
|
||||
/// version field: minor - for backward-compatible feature updates
|
||||
uint32_t minor;
|
||||
/// version field: teeny - for minor bug-fixes and clean-up
|
||||
uint32_t teeny;
|
||||
} SnpeUdo_Version_t;
|
||||
|
||||
/**
|
||||
* @brief A struct returned from version query, contains the Library version and API version
|
||||
*
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
/// Version of UDO library. Controlled by users
|
||||
SnpeUdo_Version_t libVersion;
|
||||
/// Version of SNPE UDO API used in compiling library. Determined by SNPE
|
||||
SnpeUdo_Version_t apiVersion;
|
||||
} SnpeUdo_LibVersion_t;
|
||||
|
||||
/**
|
||||
* @brief A union to hold the value of a generic type. Allows defining a parameter struct
|
||||
* in a generic way, with a "value" location that holds the data regardless of the type.
|
||||
*
|
||||
*/
|
||||
typedef union
|
||||
{
|
||||
/// value type: float
|
||||
float floatValue;
|
||||
/// value type: unsigned 32-bit integer
|
||||
uint32_t uint32Value;
|
||||
/// value type: signed 32-bit integer
|
||||
int32_t int32Value;
|
||||
/// value type: unsigned 16-bit integer
|
||||
uint16_t uint16Value;
|
||||
/// value type: signed 16-bit integer
|
||||
int16_t int16Value;
|
||||
/// value type: unsigned 8-bit integer
|
||||
uint8_t uint8Value;
|
||||
/// value type: signed 8-bit integer
|
||||
int8_t int8Value;
|
||||
} SnpeUdo_Value_t;
|
||||
|
||||
/**
|
||||
* @brief A struct which defines a scalar parameter : name, data type, and union of values
|
||||
*
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
/// The parameter data type : float, int, etc.
|
||||
SnpeUdo_DataType_t dataType;
|
||||
/// a union of specified type which holds the data
|
||||
SnpeUdo_Value_t dataValue;
|
||||
} SnpeUdo_ScalarParam_t;
|
||||
|
||||
/**
|
||||
* @brief A struct which defines the quantization parameters in case of Tensorflow style quantization
|
||||
*
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
/// minimum value of the quantization range of data
|
||||
float minValue;
|
||||
/// maximum value of the quantization range of data
|
||||
float maxValue;
|
||||
} SnpeUdo_TFQuantize_t;
|
||||
|
||||
/**
|
||||
* @brief A struct which defines the quantization type, and union of supported quantization structs
|
||||
*
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
/// quantization type (only TF-style currently supported)
|
||||
SnpeUdo_QuantizationType_t quantizeType;
|
||||
union
|
||||
{
|
||||
/// TF-style min-max quantization ranges
|
||||
SnpeUdo_TFQuantize_t TFParams;
|
||||
};
|
||||
} SnpeUdo_QuantizeParams_t;
|
||||
|
||||
/**
|
||||
* @brief A struct which defines the datatype associated with a specified core-type
|
||||
* This should be used to denote the datatypes for a single tensor info, depending
|
||||
* on the intended execution core.
|
||||
*
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
/// The IP Core
|
||||
SnpeUdo_CoreType_t coreType;
|
||||
/// The associated datatype for this coreType
|
||||
SnpeUdo_DataType_t dataType;
|
||||
} SnpeUdo_PerCoreDatatype_t;
|
||||
|
||||
/**
|
||||
* @brief A struct which defines a tensor parameter : name, data type, layout, quantization, more.
|
||||
* Also holds a pointer to the tensor data.
|
||||
*
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
/// The maximum allowable dimensions of the tensor. The memory held in
|
||||
/// _tensorData_ is guaranteed to be large enough for this.
|
||||
uint32_t* maxDimensions;
|
||||
/// The current dimensions of the tensor. An operation may modify the current
|
||||
/// dimensions of its output, to indicate cases where the output has been
|
||||
/// "resized".
|
||||
/// Note that for static parameters, the current and max dimensions must
|
||||
/// match.
|
||||
uint32_t* currDimensions;
|
||||
/// Quantization params applicable to the tensor. Currently only supports
|
||||
/// Tensorflow quantization style.
|
||||
SnpeUdo_QuantizeParams_t quantizeParams;
|
||||
/// Number of dimensions to the tensor: 3D, 4D, etc.
|
||||
uint32_t tensorRank;
|
||||
/// The parameter data type: float, int, etc.
|
||||
SnpeUdo_DataType_t dataType;
|
||||
/// The tensor layout type: NCHW, NHWC, etc.
|
||||
SnpeUdo_TensorLayout_t layout;
|
||||
/// Opaque pointer to tensor data. User may be required to re-interpret the pointer
|
||||
/// based on core-specific definitions.
|
||||
void* tensorData;
|
||||
} SnpeUdo_TensorParam_t;
|
||||
|
||||
/**
|
||||
* @brief A struct which defines tensor information for activation tensors only
|
||||
*
|
||||
* It describes an activation tensor object using its name, the intended layout and the datatype
|
||||
* it will take depending on the intended runtime core. The repeated field indicates that
|
||||
* that the tensor info describes several input/output activation tensors, which all share the
|
||||
* aforementioned properties.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
/// The tensor name
|
||||
SnpeUdo_String_t tensorName;
|
||||
/// The tensor layout type: NCHW, NHWC, etc.
|
||||
SnpeUdo_TensorLayout_t layout;
|
||||
/// The per core datatype: {SNPE_UDO_DATATYPE, SNPE_UDO_CORE_TYPE}
|
||||
SnpeUdo_PerCoreDatatype_t* perCoreDatatype;
|
||||
/// A boolean field indicating that this tensorinfo will be repeated e.x for ops such as Concat or Split
|
||||
bool repeated;
|
||||
|
||||
} SnpeUdo_TensorInfo_t;
|
||||
|
||||
|
||||
/**
|
||||
* @brief struct which defines a UDO parameter - a union of scalar, tensor and string parameters
|
||||
*
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
/// Type is scalar or tensor
|
||||
SnpeUdo_ParamType_t paramType;
|
||||
/// The param name, for example : "offset", "activation_type"
|
||||
SnpeUdo_String_t paramName;
|
||||
union
|
||||
{
|
||||
/// scalar param value
|
||||
SnpeUdo_ScalarParam_t scalarParam;
|
||||
/// tensor param value
|
||||
SnpeUdo_TensorParam_t tensorParam;
|
||||
/// string param value
|
||||
SnpeUdo_String_t stringParam;
|
||||
};
|
||||
} SnpeUdo_Param_t;
|
||||
|
||||
/**
|
||||
* @brief A struct which defines Operation information which is specific for IP core (CPU, GPU, DSP ...)
|
||||
*
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
/// The IP Core
|
||||
SnpeUdo_CoreType_t udoCoreType;
|
||||
/// Bitmask, defines supported internal calculation types (like FLOAT_32, etc)
|
||||
/// Based on SnpeUdo_DataType
|
||||
SnpeUdo_Bitmask_t operationCalculationTypes;
|
||||
} SnpeUdo_OpCoreInfo_t;
|
||||
|
||||
/**
|
||||
* @brief A struct which defines the common and core-specific Operation information
|
||||
*
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
/// Operation type
|
||||
SnpeUdo_String_t operationType;
|
||||
/// A bitmask describing which IP Cores (CPU, GPU, DSP ...) support this operation
|
||||
/// Translated based on SnpeUdo_CoreType
|
||||
SnpeUdo_Bitmask_t supportedByCores;
|
||||
/// Number of static parameters defined by the op
|
||||
uint32_t numOfStaticParams;
|
||||
/// Array of static parameters. Can be scalar or tensor params
|
||||
SnpeUdo_Param_t* staticParams;
|
||||
/// Number of input tensors this op receives
|
||||
uint32_t numOfInputs;
|
||||
/// Array of input tensor names to this operation
|
||||
SnpeUdo_String_t* inputNames;
|
||||
/// Number of output tensors this op receives
|
||||
uint32_t numOfOutputs;
|
||||
/// Array of output tensor names to this operation
|
||||
SnpeUdo_String_t* outputNames;
|
||||
/// Number of cores that the op can execute on
|
||||
uint32_t numOfCoreInfo;
|
||||
/// Array of per-core information entries
|
||||
SnpeUdo_OpCoreInfo_t* opPerCoreInfo;
|
||||
/// Array of input tensor infos for this operation
|
||||
SnpeUdo_TensorInfo_t* inputInfos;
|
||||
/// Array of output tensor infos for this operation
|
||||
SnpeUdo_TensorInfo_t* outputInfos;
|
||||
} SnpeUdo_OperationInfo_t;
|
||||
|
||||
/**
|
||||
* @brief A struct which provides the implementation library info : type, name
|
||||
*
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
/// Defines the IP Core that this implementation library is targeting
|
||||
SnpeUdo_CoreType_t udoCoreType;
|
||||
/// library name. will be looked at in the standard library path
|
||||
SnpeUdo_String_t libraryName;
|
||||
} SnpeUdo_LibraryInfo_t;
|
||||
|
||||
/**
|
||||
* @brief A struct returned by the registration library and contains information on the UDO package :
|
||||
* name, operations, libraries, etc.
|
||||
*
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
/// A string containing the package name
|
||||
SnpeUdo_String_t packageName;
|
||||
/// A bitmask describing supported IP cores (CPU, GPU, DSP ...)
|
||||
/// Translated based on SnpeUdo_CoreType
|
||||
SnpeUdo_Bitmask_t supportedCoreTypes;
|
||||
/// The number of implementation libraries in the package
|
||||
uint32_t numOfImplementationLib;
|
||||
/// Array of implementation libraries names/types
|
||||
SnpeUdo_LibraryInfo_t* implementationLib;
|
||||
/// A string containing all operation types separated by space
|
||||
SnpeUdo_String_t operationsString;
|
||||
/// Number of supported operations
|
||||
uint32_t numOfOperations;
|
||||
/// Array of Operation info structs. Each entry describes one
|
||||
/// Operation (name, params, inputs, outputs)
|
||||
SnpeUdo_OperationInfo_t* operationsInfo;
|
||||
} SnpeUdo_RegInfo_t;
|
||||
|
||||
/**
|
||||
* @brief A struct returned by the implementation library and contains information on the
|
||||
* specific library: name, IP Core, operations, etc.
|
||||
*
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
/// Defines the IP Core that this implementation library is targeting
|
||||
SnpeUdo_CoreType_t udoCoreType;
|
||||
/// A string containing the package name
|
||||
SnpeUdo_String_t packageName;
|
||||
/// A string containing all operation types separated by space
|
||||
SnpeUdo_String_t operationsString;
|
||||
/// Number of supported operations
|
||||
uint32_t numOfOperations;
|
||||
} SnpeUdo_ImpInfo_t;
|
||||
|
||||
/**
|
||||
* @brief This struct defines an operation. It is used for validation
|
||||
* or creation of an operation.
|
||||
* In case of using it for creation, the static params which are tensors
|
||||
* contain pointers to the real data (weights, for example), and input/output
|
||||
* tensors also include pointers to the buffers used.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
/// The IP Core that the operation is defined for - CPU, GPU, DSP...
|
||||
SnpeUdo_CoreType_t udoCoreType;
|
||||
/// Operation type
|
||||
SnpeUdo_String_t operationType;
|
||||
/// The number of static parameters provided in the staticParams array.
|
||||
/// this number has to match the number provided by the UDO Registration library information
|
||||
uint32_t numOfStaticParams;
|
||||
/// Array of static parameters
|
||||
SnpeUdo_Param_t* staticParams;
|
||||
/// The number of input parameters provided in inputs array.
|
||||
/// this number has to match the number provided by the UDO Registration library information
|
||||
uint32_t numOfInputs;
|
||||
/// Array of input tensors, providing layout, data type, sizes, etc
|
||||
/// When used to create an operation, also contains the initial location of the data
|
||||
SnpeUdo_TensorParam_t* inputs;
|
||||
/// The number of output parameters provided in inputs array.
|
||||
/// this number has to match the number provided by the UDO Registration library information
|
||||
uint32_t numOfOutputs;
|
||||
/// Array of output tensors, providing layout, data type, sizes, etc
|
||||
/// When used to create an operation, also contains the initial location of the data
|
||||
SnpeUdo_TensorParam_t* outputs;
|
||||
} SnpeUdo_OpDefinition_t;
|
||||
|
||||
/** @} */ /* end_addtogroup c_plus_plus_apis C++ */
|
||||
|
||||
#endif //SNPE_UDO_BASE_H
|
||||
@@ -0,0 +1,323 @@
|
||||
//==============================================================================
|
||||
//
|
||||
// Copyright (c) 2019-2020 Qualcomm Technologies, Inc.
|
||||
// All Rights Reserved.
|
||||
// Confidential and Proprietary - Qualcomm Technologies, Inc.
|
||||
//
|
||||
//==============================================================================
|
||||
|
||||
#ifndef SNPE_UDO_IMPL_H
|
||||
#define SNPE_UDO_IMPL_H
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "SnpeUdo/UdoShared.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/** @addtogroup c_plus_plus_apis C++
|
||||
@{ */
|
||||
|
||||
typedef struct _SnpeUdo_OpFactory_t* SnpeUdo_OpFactory_t;
|
||||
typedef struct _SnpeUdo_Operation_t* SnpeUdo_Operation_t;
|
||||
|
||||
/**
|
||||
* @brief Initialize the shared library's data structures. Calling any other
|
||||
* library function before this one will result in error.
|
||||
*
|
||||
* @param[in] globalInfrastructure Global core-specific infrastructure to be
|
||||
* used by operations created in this library. The definition and
|
||||
* semantics of this object will be defined in the corresponding
|
||||
* implementation header for the core type.
|
||||
* @return Error code
|
||||
*/
|
||||
SnpeUdo_ErrorType_t
|
||||
SnpeUdo_initImplLibrary(void* globalInfrastructure);
|
||||
|
||||
typedef SnpeUdo_ErrorType_t
|
||||
(*SnpeUdo_InitImplLibraryFunction_t)(void*);
|
||||
|
||||
/**
|
||||
* @brief A function to query the API version of the UDO implementation library.
|
||||
* The function populates a SnpeUdo_LibVersion_t struct, which contains a SnpeUdo_Version_t
|
||||
* struct for API version and library version.
|
||||
*
|
||||
* @param[in, out] version A pointer to struct which contains major, minor, teeny information for
|
||||
* library and api versions.
|
||||
*
|
||||
* @return Error code
|
||||
*/
|
||||
SnpeUdo_ErrorType_t
|
||||
SnpeUdo_getImplVersion(SnpeUdo_LibVersion_t** version);
|
||||
|
||||
typedef SnpeUdo_ErrorType_t
|
||||
(*SnpeUdo_getImplVersion_t)(SnpeUdo_LibVersion_t** version);
|
||||
|
||||
/**
|
||||
* @brief Release the shared library's data structures, and invalidate any
|
||||
* handles returned by the library. The behavior of any outstanding
|
||||
* asynchronous calls made to this library when this function is called
|
||||
* are undefined. All library functions (except SnpeUdo_initImplLibrary) will
|
||||
* return an error after this function has been successfully called.
|
||||
*
|
||||
* It should be possible to call SnpeUdo_initImplLibrary after calling this
|
||||
* function, and re-initialize the library.
|
||||
*
|
||||
* @return Error code
|
||||
*/
|
||||
SnpeUdo_ErrorType_t
|
||||
SnpeUdo_terminateImplLibrary(void);
|
||||
|
||||
typedef SnpeUdo_ErrorType_t
|
||||
(*SnpeUdo_TerminateImplLibraryFunction_t)(void);
|
||||
|
||||
|
||||
/**
|
||||
* @brief A function to query info on the UDO implementation library.
|
||||
* The function populates a structure which contains information about
|
||||
* operations that are part of this library
|
||||
*
|
||||
* @param[in, out] implementationInfo A pointer to struct which contains information
|
||||
* on the operations
|
||||
*
|
||||
* @return error code
|
||||
*
|
||||
*/
|
||||
SnpeUdo_ErrorType_t
|
||||
SnpeUdo_getImpInfo(SnpeUdo_ImpInfo_t** implementationInfo);
|
||||
|
||||
typedef SnpeUdo_ErrorType_t
|
||||
(*SnpeUdo_GetImpInfoFunction_t)(SnpeUdo_ImpInfo_t** implementationInfo);
|
||||
|
||||
/**
|
||||
* @brief A function to create an operation factory.
|
||||
* The function receives the operation type, and an array of static parameters,
|
||||
* and returns operation factory handler
|
||||
*
|
||||
* @param[in] udoCoreType The Core type to create the operation on. An error will
|
||||
* be returned if this does not match the core type of the library.
|
||||
*
|
||||
* @param[in] perFactoryInfrastructure CreateOpFactory infrastructure appropriate to this
|
||||
* core type. The definition and semantics of this object will be defined
|
||||
* in the corresponding implementation header for the core type.
|
||||
*
|
||||
* @param[in] operationType A string containing Operation type. for example "MY_CONV"
|
||||
*
|
||||
* @param[in] numOfStaticParams The number of static parameters.
|
||||
*
|
||||
* @param[in] staticParams Array of static parameters
|
||||
*
|
||||
* @param[in,out] opFactory Handler to Operation Factory, to be used when creating operations
|
||||
*
|
||||
* @return Error Code
|
||||
*/
|
||||
SnpeUdo_ErrorType_t
|
||||
SnpeUdo_createOpFactory(SnpeUdo_CoreType_t udoCoreType,
|
||||
void* perFactoryInfrastructure,
|
||||
SnpeUdo_String_t operationType,
|
||||
uint32_t numOfStaticParams,
|
||||
SnpeUdo_Param_t* staticParams,
|
||||
SnpeUdo_OpFactory_t* opFactory);
|
||||
|
||||
typedef SnpeUdo_ErrorType_t
|
||||
(*SnpeUdo_CreateOpFactoryFunction_t)(SnpeUdo_CoreType_t,
|
||||
void*,
|
||||
SnpeUdo_String_t,
|
||||
uint32_t,
|
||||
SnpeUdo_Param_t*,
|
||||
SnpeUdo_OpFactory_t*);
|
||||
|
||||
|
||||
/**
|
||||
* @brief A function to release the resources allocated for an operation factory
|
||||
* created by this library.
|
||||
*
|
||||
* @param[in] factory The operation factory to release. Upon success this handle will be invalidated.
|
||||
*
|
||||
* @return Error Code
|
||||
*/
|
||||
SnpeUdo_ErrorType_t
|
||||
SnpeUdo_releaseOpFactory(SnpeUdo_OpFactory_t opFactory);
|
||||
|
||||
typedef SnpeUdo_ErrorType_t
|
||||
(*SnpeUdo_ReleaseOpFactoryFunction_t)(SnpeUdo_OpFactory_t);
|
||||
|
||||
/**
|
||||
* @brief A function to create an operation from the factory.
|
||||
* The function receives array of inputs and array of outputs, and creates an operation
|
||||
* instance, returning the operation instance handler.
|
||||
*
|
||||
* @param[in] opFactory OpFactory instance containing the parameters for this operation.
|
||||
*
|
||||
* @param[in] perOpInfrastructure Per-Op infrastructure for this operation. The definition
|
||||
* and semantics of this object will be defined in the implementation header
|
||||
* appropriate to this core type.
|
||||
*
|
||||
* @param[in] numOfInputs The number of input tensors this operation will receive.
|
||||
*
|
||||
* @param[in] inputs Array of input tensors, providing both the sizes and initial
|
||||
* location of the data.
|
||||
*
|
||||
* @param[in] numOfOutputs Number of output tensors this operation will produce.
|
||||
*
|
||||
* @param[in] outputs Array of output tensors, providing both the sizes and
|
||||
* initial location of the data.
|
||||
*
|
||||
* @param[in,out] operation Handle for newly created operation instance.
|
||||
*
|
||||
* @return Error Code
|
||||
*/
|
||||
SnpeUdo_ErrorType_t
|
||||
SnpeUdo_createOperation(SnpeUdo_OpFactory_t opFactory,
|
||||
void* perOpInfrastructure,
|
||||
uint32_t numOfInputs,
|
||||
SnpeUdo_TensorParam_t* inputs,
|
||||
uint32_t numOfOutputs,
|
||||
SnpeUdo_TensorParam_t* outputs,
|
||||
SnpeUdo_Operation_t* operation);
|
||||
|
||||
typedef SnpeUdo_ErrorType_t
|
||||
(*SnpeUdo_CreateOperationFunction_t)(SnpeUdo_OpFactory_t,
|
||||
void*,
|
||||
uint32_t,
|
||||
SnpeUdo_TensorParam_t*,
|
||||
uint32_t,
|
||||
SnpeUdo_TensorParam_t*,
|
||||
SnpeUdo_Operation_t*);
|
||||
|
||||
/**
|
||||
* @brief A pointer to notification function.
|
||||
*
|
||||
* The notification function supports the non-blocking (e.g. asynchronous) execution use-case.
|
||||
* In case an "executeUdoOp" function is called with "blocking" set to zero, and a
|
||||
* notify function, this function will be called by the implementation library at the
|
||||
* end of execution. The implementation library will pass the notify function the ID
|
||||
* that was provided to it when "executeUdoOp" was called.
|
||||
*
|
||||
* @param[in] ID 32-bit value, that was provided to executeUdoOp by the calling entity.
|
||||
* Can be used to track the notifications, in case of multiple execute calls issued.
|
||||
*
|
||||
* @return Error code
|
||||
*
|
||||
*/
|
||||
typedef SnpeUdo_ErrorType_t
|
||||
(*SnpeUdo_ExternalNotify_t)(const uint32_t ID);
|
||||
|
||||
/**
|
||||
* @brief Operation execution function.
|
||||
*
|
||||
* Calling this function will run the operation on set of inputs, generating a set of outputs.
|
||||
* The call can be blocking (synchronous) or non-blocking (asynchronous). To support the
|
||||
* non-blocking mode, the calling entity can pass an ID and a notification function.
|
||||
* At the end of the execution this notification function would be called, passing it the ID.
|
||||
* <b> NOTE: Asynchronous execution mode not supported in this release. </b>
|
||||
*
|
||||
* @param[in] operation handle to the operation on which execute is invoked
|
||||
* @param[in] blocking flag to indicate execution mode.
|
||||
* If set, execution is blocking,
|
||||
* e.g SnpeUdo_executeOp call does not return until execution is done.
|
||||
* If not set, SnpeUdo_executeOp returns immediately, and the
|
||||
* library will call the notification function (if set) when execution is done.
|
||||
*
|
||||
* @param[in] ID 32-bit number that can be used by the calling entity to track execution
|
||||
* in case of non-blocking execution.
|
||||
* For example, it can be a sequence number, increased by one on each call.
|
||||
*
|
||||
* @param[in] notifyFunc Pointer to notification function. if the pointer is set, and execution is
|
||||
* non-blocking, the library will call this function at end of execution,
|
||||
* passing the number provided as ID
|
||||
*
|
||||
* @return Error code
|
||||
*
|
||||
*/
|
||||
SnpeUdo_ErrorType_t
|
||||
SnpeUdo_executeOp(SnpeUdo_Operation_t operation,
|
||||
bool blocking,
|
||||
const uint32_t ID,
|
||||
SnpeUdo_ExternalNotify_t notifyFunc);
|
||||
|
||||
typedef SnpeUdo_ErrorType_t
|
||||
(*SnpeUdo_ExecuteOpFunction_t)(SnpeUdo_Operation_t,
|
||||
bool,
|
||||
const uint32_t,
|
||||
SnpeUdo_ExternalNotify_t);
|
||||
|
||||
/**
|
||||
* @brief A function to setting the inputs & outputs. part of SnpeUdo_Operation struct,
|
||||
* returned from creation of a new operation instance.
|
||||
* <b> Not supported in this release. </b>
|
||||
*
|
||||
* This function allows the calling entity to change some of the inputs and outputs
|
||||
* between calls to execute.
|
||||
* Note that the change is limited to changing the <b> pointer </b> to the tensor data only.
|
||||
* Any other change may be rejected by the implementation library, causing
|
||||
* immediate invalidation of the operation instance
|
||||
*
|
||||
* @param[in] operation Operation on which IO tensors are set
|
||||
*
|
||||
* @param[in] inputs array of tensor parameters. The calling entity may provide a subset of the
|
||||
* operation inputs, providing only those that it wants to change.
|
||||
*
|
||||
* @param[in] outputs array of tensor parameters. The calling entity may provide a subset of the
|
||||
* operation outputs, providing only those that it wants to change.
|
||||
*
|
||||
* @return Error code
|
||||
*
|
||||
*/
|
||||
SnpeUdo_ErrorType_t
|
||||
SnpeUdo_setOpIO(SnpeUdo_Operation_t operation,
|
||||
SnpeUdo_TensorParam_t* inputs,
|
||||
SnpeUdo_TensorParam_t* outputs);
|
||||
|
||||
typedef SnpeUdo_ErrorType_t
|
||||
(*SnpeUdo_SetOpIOFunction_t)(SnpeUdo_Operation_t,
|
||||
SnpeUdo_TensorParam_t*,
|
||||
SnpeUdo_TensorParam_t*);
|
||||
|
||||
/**
|
||||
* @brief A function to return execution times.
|
||||
*
|
||||
* This function can be called to query the operation execution times on the IP core
|
||||
* on which the operation is run. The time is provided in micro-seconds
|
||||
*
|
||||
* @param[in] operation Handle to operation whose execution time is being profiled
|
||||
*
|
||||
* @param[in,out] executionTime pointer to a uint32 value.This function writes the operation
|
||||
* execution time in usec into this value.
|
||||
*
|
||||
* @return Error code
|
||||
*
|
||||
*/
|
||||
SnpeUdo_ErrorType_t
|
||||
SnpeUdo_profileOp(SnpeUdo_Operation_t operation, uint32_t *executionTime);
|
||||
|
||||
typedef SnpeUdo_ErrorType_t
|
||||
(*SnpeUdo_ProfileOpFunction_t)(SnpeUdo_Operation_t, uint32_t*);
|
||||
|
||||
/**
|
||||
* @brief A function to release the operation instance
|
||||
* \n When it is called, the implementation library needs to release all resources
|
||||
* allocated for this operation instance.
|
||||
* \n Note that all function pointers which are part of SnpeUdo_Operation become
|
||||
* <b> invalid </b> once releaseUdoOp call returns.
|
||||
*
|
||||
* @param[in] operation Handle to operation to be released
|
||||
* @return Error code
|
||||
*
|
||||
*/
|
||||
SnpeUdo_ErrorType_t
|
||||
SnpeUdo_releaseOp(SnpeUdo_Operation_t operation);
|
||||
|
||||
typedef SnpeUdo_ErrorType_t
|
||||
(*SnpeUdo_ReleaseOpFunction_t)(SnpeUdo_Operation_t);
|
||||
|
||||
/** @} */ /* end_addtogroup c_plus_plus_apis C++ */
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif //SNPE_UDO_IMPL_H
|
||||
@@ -0,0 +1,44 @@
|
||||
//==============================================================================
|
||||
//
|
||||
// Copyright (c) 2019-2020 Qualcomm Technologies, Inc.
|
||||
// All Rights Reserved.
|
||||
// Confidential and Proprietary - Qualcomm Technologies, Inc.
|
||||
//
|
||||
//==============================================================================
|
||||
|
||||
// Header to be used by a CPU UDO Implementation library
|
||||
|
||||
#ifndef SNPE_UDO_IMPL_CPU_H
|
||||
#define SNPE_UDO_IMPL_CPU_H
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/** @addtogroup c_plus_plus_apis C++
|
||||
@{ */
|
||||
|
||||
/**
|
||||
* @brief This struct provides the infrastructure needed by a developer of
|
||||
* CPU UDO Implementation library.
|
||||
*
|
||||
* The framework/runtime which loads the CPU UDO implementation library provides
|
||||
* this infrastructure data to the loaded library at the time of op factory creation.
|
||||
* as an opaque pointer. It contains hooks for the UDO library to invoke supported
|
||||
* functionality at the time of execution
|
||||
*
|
||||
* @param getData function pointer to retrieve raw tensor data from opaque pointer
|
||||
* passed into the UDO when creating an instance.
|
||||
* @param getDataSize function pointer to retrieve tensor data size from opaque pointer
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/// function pointer to retrieve raw tensor data from opaque pointer
|
||||
/// passed into the UDO when creating an instance.
|
||||
float* (*getData)(void*);
|
||||
/// function pointer to retrieve tensor data size from opaque pointer
|
||||
size_t (*getDataSize) (void*);
|
||||
} SnpeUdo_CpuInfrastructure_t;
|
||||
|
||||
/** @} */ /* end_addtogroup c_plus_plus_apis C++ */
|
||||
|
||||
#endif // SNPE_UDO_IMPL_CPU_H
|
||||
@@ -0,0 +1,187 @@
|
||||
//==============================================================================
|
||||
//
|
||||
// Copyright (c) 2019-2020 Qualcomm Technologies, Inc.
|
||||
// All Rights Reserved.
|
||||
// Confidential and Proprietary - Qualcomm Technologies, Inc.
|
||||
//
|
||||
//==============================================================================
|
||||
|
||||
//==============================================================================
|
||||
/*
|
||||
* THIS HEADER FILE IS COPIED FROM HEXAGON-NN PROJECT
|
||||
*
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
|
||||
// Header to be used by a DSP Hexnn UDO Implementation library
|
||||
|
||||
#ifndef SNPE_UDO_IMPL_DSP_H
|
||||
#define SNPE_UDO_IMPL_DSP_H
|
||||
#include <stdio.h>
|
||||
#include "SnpeUdo/UdoImpl.h"
|
||||
|
||||
/** @addtogroup c_plus_plus_apis C++
|
||||
@{ */
|
||||
|
||||
/**
|
||||
* @brief A function to validate that a set of params is supported by an operation
|
||||
* This function is HexNN specific, use case is when registration library is not in use.
|
||||
* Optional function.
|
||||
*
|
||||
* @param[in] operationType Operation type
|
||||
* @param[in] numOfStaticParams Number of static params defined by the op
|
||||
* @param[in] staticParams Array of static params to the op
|
||||
* @return Error code, indicating if the operation can be created on this set of configuration or not.
|
||||
*
|
||||
*/
|
||||
|
||||
SnpeUdo_ErrorType_t
|
||||
SnpeUdo_validateOperation (SnpeUdo_String_t operationType,
|
||||
uint32_t numOfStaticParams,
|
||||
const SnpeUdo_Param_t* staticParams);
|
||||
|
||||
typedef SnpeUdo_ErrorType_t (*SnpeUdo_ValidateOperationFunction_t) (SnpeUdo_String_t,
|
||||
uint32_t,
|
||||
const SnpeUdo_Param_t*);
|
||||
|
||||
|
||||
// enum used for indicating input/outout tensor data layouts on DSP, plain vs d32
|
||||
typedef enum {
|
||||
SNPE_UDO_DSP_TENSOR_LAYOUT_PLAIN,
|
||||
SNPE_UDO_DSP_TENSOR_LAYOUT_D32
|
||||
} SnpeUdo_HexNNTensorLayout_t;
|
||||
|
||||
/**
|
||||
* @brief A function to query numbers of inputs and outputs,
|
||||
* quantization type of each input and each output as arrays,
|
||||
* and data layout (plain vs d32) of each input and each output as arrays
|
||||
* of an operation.
|
||||
* inputsQuantTypes and inputsLayouts should point to arrays of size numOfInputs
|
||||
* outputsQuantTypes and outputsLayouts should point to arrays of size numOfOutputs
|
||||
*
|
||||
* Note: inputsLayouts and inputsLayouts can point to NULL, in this case, it is
|
||||
* assumed all inputs and/or outputs have plain data layouts, i.e. no D32
|
||||
*
|
||||
* @param[in] operationType Operation type
|
||||
* @param[in] numOfStaticParams Number of static params defined by the op
|
||||
* @param[in] staticParams Array of static params to the op
|
||||
* @param[in,out] numOfInputs Number of input tensors to the op
|
||||
* @param[in,out] inputsQuantTypes Array of Quantization info for each input tensor
|
||||
* @param[in,out] inputsLayouts Array of layout type for each input tensor
|
||||
* @param[in,out] numOfOutputs Number of output tensors to the op
|
||||
* @param[in,out] outputsQuantTypes Array of Quantization info for each output tensor
|
||||
* @param[in,out] outputsLayouts Array of layout type for each output tensor
|
||||
* @return error code, indicating status of query
|
||||
*/
|
||||
|
||||
SnpeUdo_ErrorType_t
|
||||
SnpeUdo_queryOperation (SnpeUdo_String_t operationType,
|
||||
uint32_t numOfStaticParams,
|
||||
const SnpeUdo_Param_t* staticParams,
|
||||
uint32_t* numOfInputs,
|
||||
SnpeUdo_QuantizationType_t** inputsQuantTypes,
|
||||
SnpeUdo_HexNNTensorLayout_t** inputsLayouts,
|
||||
uint32_t* numOfOutputs,
|
||||
SnpeUdo_QuantizationType_t** outputsQuantTypes,
|
||||
SnpeUdo_HexNNTensorLayout_t** outputsLayouts);
|
||||
|
||||
typedef SnpeUdo_ErrorType_t (*SnpeUdo_QueryOperationFunction_t) (SnpeUdo_String_t,
|
||||
uint32_t,
|
||||
const SnpeUdo_Param_t*,
|
||||
uint32_t*,
|
||||
SnpeUdo_QuantizationType_t**,
|
||||
SnpeUdo_HexNNTensorLayout_t**,
|
||||
uint32_t*,
|
||||
SnpeUdo_QuantizationType_t**,
|
||||
SnpeUdo_HexNNTensorLayout_t**);
|
||||
|
||||
|
||||
|
||||
// Global infrastructure functions supported by Hexagon-NN v2
|
||||
typedef void (*workerThread_t) (void* perOpInfrastructure, void* userData);
|
||||
typedef int (*udoSetOutputTensorSize_t) (void* perOpInfrastructure, uint32_t outIdx, uint32_t size);
|
||||
typedef int (*udoGetInputD32Paddings_t) (void* perOpInfrastructure, uint32_t inIdx,
|
||||
uint32_t* heightPadBefore, uint32_t* heightPadAfter,
|
||||
uint32_t* widthPadBefore, uint32_t* widthPadAfter,
|
||||
uint32_t* depthPadBefore, uint32_t* depthPadAfter);
|
||||
typedef int (*udoSetOutputD32ShapeSizePaddings_t) (void* perOpInfrastructure, uint32_t outIdx,
|
||||
uint32_t batch,
|
||||
uint32_t height, uint32_t heightPadBefore, uint32_t heightPadAfter,
|
||||
uint32_t width, uint32_t widthPadBefore, uint32_t widthPadAfter,
|
||||
uint32_t depth, uint32_t depthPadBefore, uint32_t depthPadAfter,
|
||||
SnpeUdo_DataType_t dataType);
|
||||
typedef void* (*udoMemalign_t) (size_t n, size_t size);
|
||||
typedef void* (*udoMalloc_t) (size_t size);
|
||||
typedef void* (*udoCalloc_t) (size_t n, size_t size);
|
||||
typedef void (*udoFree_t) (void* ptr);
|
||||
typedef uint32_t (*udoGetVtcmSize_t) (void* perOpInfrastructure);
|
||||
typedef void* (*udoGetVtcmPtr_t) (void* perOpInfrastructure);
|
||||
typedef uint32_t (*udoVtcmIsReal_t) (void* perOpInfrastructure);
|
||||
typedef void (*udoRunWorkerThreads_t) (void* perOpInfrastructure, uint32_t nThreads, workerThread_t w, void* userData);
|
||||
|
||||
typedef struct hexNNv2GlobalInfra {
|
||||
udoSetOutputTensorSize_t udoSetOutputTensorSize;
|
||||
udoGetInputD32Paddings_t udoGetInputD32Paddings;
|
||||
udoSetOutputD32ShapeSizePaddings_t udoSetOutputD32ShapeSizePaddings;
|
||||
udoMemalign_t udoMemalign;
|
||||
udoMalloc_t udoMalloc;
|
||||
udoCalloc_t udoCalloc;
|
||||
udoFree_t udoFree;
|
||||
udoGetVtcmSize_t udoGetVtcmSize;
|
||||
udoGetVtcmPtr_t udoGetVtcmPtr;
|
||||
udoVtcmIsReal_t udoVtcmIsReal;
|
||||
udoRunWorkerThreads_t udoRunWorkerThreads;
|
||||
} SnpeUdo_HexNNv2GlobalInfra_t;
|
||||
|
||||
// hexnn types
|
||||
typedef enum hexnnInfraType {
|
||||
UDO_INFRA_HEXNN_V2,
|
||||
UDO_INFRA_HEXNN_V3 // reserved, do not use
|
||||
} SnpeUdo_HexNNInfraType_t;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Infrastructures needed by a developer of DSP Hexnn UDO Implementation library.
|
||||
*
|
||||
* The framework/runtime which loads the Hexnn UDO implementation library provides
|
||||
* this infrastructure to the loaded library by calling "SnpeUdo_initImplLibrary"
|
||||
* function, and passing it (cast to void*). The Hexnn UDO library is expected
|
||||
* to cast it back to this structure.
|
||||
*
|
||||
*/
|
||||
typedef struct dspGlobalInfrastructure {
|
||||
SnpeUdo_Version_t dspInfraVersion; // api version
|
||||
SnpeUdo_HexNNInfraType_t infraType;
|
||||
SnpeUdo_HexNNv2GlobalInfra_t hexNNv2Infra;
|
||||
} SnpeUdo_DspGlobalInfrastructure_t;
|
||||
|
||||
|
||||
/**
|
||||
* hexnn v2 per op factory infrastructure
|
||||
*
|
||||
* The framework/runtime passes per op factory infrastructure as a void pointer
|
||||
* to HexNN UDO implementation library by calling function "SnpeUdo_createOpFactory".
|
||||
* UDO implementation library is expected to cast it back to this following struct.
|
||||
*
|
||||
*/
|
||||
typedef struct hexnnv2OpFactoryInfra {
|
||||
unsigned long graphId;
|
||||
} SnpeUdo_HexNNv2OpFactoryInfra_t;
|
||||
|
||||
|
||||
/**
|
||||
* hexnn v2 per operation infrastructure
|
||||
*
|
||||
* The framework/runtime passes per operation infrastructure as a void pointer
|
||||
* to HexNN UDO implementation library by calling function "SnpeUdo_createOperation".
|
||||
* UDO implementation library is expected to cast it to the following type and save it.
|
||||
*
|
||||
* This is needed to be passed back into some functions from global infrastructure.
|
||||
*
|
||||
*/
|
||||
typedef void* SnpeUdo_HexNNv2OpInfra_t;
|
||||
|
||||
/** @} */ /* end_addtogroup c_plus_plus_apis C++ */
|
||||
|
||||
#endif // SNPE_UDO_IMPL_DSP_H
|
||||
@@ -0,0 +1,112 @@
|
||||
//==============================================================================
|
||||
//
|
||||
// Copyright (c) 2019-2020 Qualcomm Technologies, Inc.
|
||||
// All Rights Reserved.
|
||||
// Confidential and Proprietary - Qualcomm Technologies, Inc.
|
||||
//
|
||||
//==============================================================================
|
||||
|
||||
// Header to be used by a GPU UDO Implementation library
|
||||
|
||||
#ifndef SNPE_UDO_IMPL_GPU_H
|
||||
#define SNPE_UDO_IMPL_GPU_H
|
||||
|
||||
#include "CL/cl.h"
|
||||
#include "SnpeUdo/UdoBase.h"
|
||||
|
||||
/** @addtogroup c_plus_plus_apis C++
|
||||
@{ */
|
||||
|
||||
/**
|
||||
* This header defines version 0.0.0 of the GPU UDO Infrastructure.
|
||||
* It defines the interpretation of the global and per-OpFactory infrastructure pointers
|
||||
* as well as the interpretation of tensorData pointers.
|
||||
*
|
||||
* The per-Operation infrastructure pointer is defined to be null, and should not be used.
|
||||
*
|
||||
* The SnpeUdoTensorParam_t struct below provides the interpretation for
|
||||
* the tensorData opaque pointer for SnpeUdoTensorParams representing inputs or outputs.
|
||||
*
|
||||
* The tensorData opaque pointer populated in SnpeUdoScalarParam_t structs should be interpreted
|
||||
* as a host-readable data pointer.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Function to retrieve opencl program from Program Cache repository.
|
||||
* @param programCache is opaque pointer to Program Cache repository provided by
|
||||
* SNPE GPU UDO runtime.
|
||||
* @param programName is name associated with opencl program for UDO.
|
||||
* @param program is pointer to opencl program which will be populated with
|
||||
* valid opencl program if found in Program Cache repository.
|
||||
* @return SnpeUdo_ErrorType_t is error type returned. SNPE_UDO_NO_ERROR is returned
|
||||
* on success.
|
||||
*/
|
||||
typedef SnpeUdo_ErrorType_t (*SnpeUdo_getProgram_t)
|
||||
(void* programCache, const char* programName, cl_program* program);
|
||||
|
||||
/**
|
||||
* @brief Function to store valid opencl program in Program Cache repository.
|
||||
* @param programCache is opaque pointer to Program Cache repository provided by
|
||||
* SNPE GPU UDO runtime.
|
||||
* @param programName is name associated with opencl program for UDO.
|
||||
* @param program is valid opencl program after program is built.
|
||||
* @return SnpeUdo_ErrorType_t is error type returned. SNPE_UDO_NO_ERROR is returned
|
||||
* on success.
|
||||
* */
|
||||
typedef SnpeUdo_ErrorType_t (*SnpeUdo_storeProgram_t)
|
||||
(void* programCache, const char * programName, cl_program program);
|
||||
|
||||
/**
|
||||
* @brief Global Infrastructure Definition for GPU UDO Implementations.
|
||||
*/
|
||||
typedef struct {
|
||||
// Infrastructure definition version. This header is 0.0.0
|
||||
SnpeUdo_Version_t gpuInfraVersion;
|
||||
SnpeUdo_getProgram_t SnpeUdo_getProgram;
|
||||
SnpeUdo_storeProgram_t SnpeUdo_storeProgram;
|
||||
} SnpeUdo_GpuInfrastructure_t;
|
||||
|
||||
/**
|
||||
* @brief Per OpFactory Infrastructure Definition for GPU UDO Implementations.
|
||||
* @note This version of the infrastructure definition guarantees that the same
|
||||
* Per OpFactory infrastructure pointer will be provided to all OpFactories
|
||||
* in the same network.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
cl_context context;
|
||||
cl_command_queue commandQueue;
|
||||
void* programCache;
|
||||
} SnpeUdo_GpuOpFactoryInfrastructure_t;
|
||||
|
||||
/**
|
||||
* @brief Opaque tensorData definition for operation inputs and outputs.
|
||||
*
|
||||
* The following is a list of all SnpeUdoTensorLayout_t values supported by the
|
||||
* GPU UDO implementation, and how the parameters of the struct should be
|
||||
* interpreted in each case:
|
||||
*
|
||||
* SNPE_UDO_LAYOUT_NHWC:
|
||||
* mem shall be single-element array, pointing to a cl buffer memory object.
|
||||
* the dimensions of this object match the dimensions specified in the encompassing
|
||||
* SnpeUdoTensorParam_t's currDimensions.
|
||||
*
|
||||
* memCount shall be 1.
|
||||
*
|
||||
* paddedRank and paddedDimensions are undefined and shall be ignored by the UDO
|
||||
* implementation.
|
||||
*
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
cl_mem* mem;
|
||||
uint32_t memCount;
|
||||
uint32_t paddedRank;
|
||||
uint32_t* paddedDimensions;
|
||||
|
||||
} SnpeUdo_GpuTensorData_t;
|
||||
|
||||
/** @} */ /* end_addtogroup c_plus_plus_apis C++ */
|
||||
|
||||
#endif // SNPE_UDO_IMPL_GPU_H
|
||||
@@ -0,0 +1,108 @@
|
||||
//==============================================================================
|
||||
//
|
||||
// Copyright (c) 2019-2020 Qualcomm Technologies, Inc.
|
||||
// All Rights Reserved.
|
||||
// Confidential and Proprietary - Qualcomm Technologies, Inc.
|
||||
//
|
||||
//==============================================================================
|
||||
|
||||
#ifndef SNPE_UDO_REG_H
|
||||
#define SNPE_UDO_REG_H
|
||||
|
||||
#include "SnpeUdo/UdoShared.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/** @addtogroup c_plus_plus_apis C++
|
||||
@{ */
|
||||
|
||||
/**
|
||||
* @brief Initialize the shared library's data structures. Calling any other
|
||||
* library function before this one will result in an error being returned.
|
||||
*
|
||||
* @return Error code
|
||||
*/
|
||||
SnpeUdo_ErrorType_t
|
||||
SnpeUdo_initRegLibrary(void);
|
||||
|
||||
typedef SnpeUdo_ErrorType_t
|
||||
(*SnpeUdo_InitRegLibraryFunction_t)(void);
|
||||
|
||||
/**
|
||||
* @brief A function to query the API version of the UDO registration library.
|
||||
* The function populates a SnpeUdo_LibVersion_t struct, which contains a SnpeUdo_Version_t
|
||||
* struct for API version and library version.
|
||||
*
|
||||
* @param[in, out] version A pointer to struct which contains major, minor, teeny information for
|
||||
* library and api versions.
|
||||
*
|
||||
* @return Error code
|
||||
*/
|
||||
SnpeUdo_ErrorType_t
|
||||
SnpeUdo_getRegLibraryVersion(SnpeUdo_LibVersion_t** version);
|
||||
|
||||
typedef SnpeUdo_ErrorType_t
|
||||
(*SnpeUdo_getRegLibraryVersion_t)(SnpeUdo_LibVersion_t** version);
|
||||
|
||||
/**
|
||||
* @brief Release the shared library's data structures, and invalidate any
|
||||
* handles returned by the library. The behavior of any outstanding
|
||||
* asynchronous calls made to this library when this function is called
|
||||
* are undefined. All library functions (except SnpeUdo_InitRegLibrary) will
|
||||
* return an error after this function has been successfully called.
|
||||
*
|
||||
* It should be possible to call SnpeUdo_InitRegLibrary after calling this
|
||||
* function, and re-initialize the library.
|
||||
*
|
||||
* @return Error code
|
||||
*/
|
||||
SnpeUdo_ErrorType_t
|
||||
SnpeUdo_terminateRegLibrary(void);
|
||||
|
||||
typedef SnpeUdo_ErrorType_t
|
||||
(*SnpeUdo_TerminateRegLibraryFunction_t)(void);
|
||||
|
||||
|
||||
/**
|
||||
* @brief A function to query the info on the UDO set.
|
||||
* The function populates a structure which contains information about
|
||||
* the package and operations contained in it.
|
||||
*
|
||||
* @param[in, out] registrationInfo A struct which contains information on the set of UDOs
|
||||
*
|
||||
* @return Error code
|
||||
*
|
||||
*/
|
||||
SnpeUdo_ErrorType_t
|
||||
SnpeUdo_getRegInfo(SnpeUdo_RegInfo_t** registrationInfo);
|
||||
|
||||
typedef SnpeUdo_ErrorType_t
|
||||
(*SnpeUdo_GetRegInfoFunction_t)(SnpeUdo_RegInfo_t** registrationInfo);
|
||||
|
||||
/**
|
||||
* @brief A function to validate that a set of params is supported by an operation
|
||||
* The function receives an operation definition struct, and returns if this configuration is
|
||||
* supported (e.g. if an operation can be created using this configuration)
|
||||
*
|
||||
* @param[in] opDefinition A struct of SnpeUdo_OpDefinition type, containing the information needed to
|
||||
* validate that an operation can be created with this configuration.
|
||||
*
|
||||
* @return Error code, indicating is the operation can be created on this set or not.
|
||||
*
|
||||
*/
|
||||
SnpeUdo_ErrorType_t
|
||||
SnpeUdo_validateOperation(SnpeUdo_OpDefinition_t* opDefinition);
|
||||
|
||||
typedef SnpeUdo_ErrorType_t
|
||||
(*SnpeUdo_ValidateOperationFunction_t)(SnpeUdo_OpDefinition_t* opDefinition);
|
||||
|
||||
/** @} */ /* end_addtogroup c_plus_plus_apis C++ */
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif //SNPE_UDO_REG_H
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user