mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-08-27 19:23:43 +08:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0ef3ce173a | |||
| c1112e4400 | |||
| bbc546fcf3 | |||
| bf662bb1fd | |||
| 8b274fc974 | |||
| 99b1d6a40b | |||
| 6418d4a09a | |||
| 747ff45da4 |
@@ -10,6 +10,7 @@ venv/
|
||||
.vscode*
|
||||
model2.png
|
||||
a.out
|
||||
.hypothesis
|
||||
|
||||
*.dylib
|
||||
*.DSYM
|
||||
@@ -59,6 +60,7 @@ notebooks
|
||||
xx
|
||||
hyperthneed
|
||||
panda_jungle
|
||||
provisioning
|
||||
|
||||
.coverage*
|
||||
coverage.xml
|
||||
|
||||
Vendored
+50
-17
@@ -36,7 +36,7 @@ EOF"""
|
||||
|
||||
def phone_steps(String device_type, steps) {
|
||||
lock(resource: "", label: device_type, inversePrecedence: true, variable: 'device_ip', quantity: 1) {
|
||||
timeout(time: 60, unit: 'MINUTES') {
|
||||
timeout(time: 150, unit: 'MINUTES') {
|
||||
phone(device_ip, "git checkout", readFile("selfdrive/test/setup_device_ci.sh"),)
|
||||
steps.each { item ->
|
||||
phone(device_ip, item[0], item[1])
|
||||
@@ -52,7 +52,7 @@ pipeline {
|
||||
TEST_DIR = "/data/openpilot"
|
||||
}
|
||||
options {
|
||||
timeout(time: 1, unit: 'HOURS')
|
||||
timeout(time: 3, unit: 'HOURS')
|
||||
}
|
||||
|
||||
stages {
|
||||
@@ -78,12 +78,11 @@ pipeline {
|
||||
when {
|
||||
not {
|
||||
anyOf {
|
||||
branch 'master-ci'; branch 'devel'; branch 'devel-staging'; branch 'release2'; branch 'release2-staging'; branch 'dashcam'; branch 'dashcam-staging'; branch 'testing-closet*'
|
||||
branch 'master-ci'; branch 'devel'; branch 'devel-staging'; branch 'release2'; branch 'release2-staging'; branch 'dashcam'; branch 'dashcam-staging'; branch 'testing-closet*'; branch 'hotfix-*'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
stages {
|
||||
|
||||
/*
|
||||
@@ -113,6 +112,10 @@ pipeline {
|
||||
stage('On-device Tests') {
|
||||
agent {
|
||||
docker {
|
||||
/*
|
||||
filename 'Dockerfile.ondevice_ci'
|
||||
args "--privileged -v /dev:/dev --shm-size=1G --user=root"
|
||||
*/
|
||||
image 'python:3.7.3'
|
||||
args '--user=root'
|
||||
}
|
||||
@@ -121,17 +124,12 @@ pipeline {
|
||||
stages {
|
||||
stage('parallel tests') {
|
||||
parallel {
|
||||
stage('Devel Build') {
|
||||
environment {
|
||||
CI_PUSH = "${env.BRANCH_NAME == 'master' ? 'master-ci' : ' '}"
|
||||
}
|
||||
stage('Devel Tests') {
|
||||
steps {
|
||||
phone_steps("eon-build", [
|
||||
["build", "SCONS_CACHE=1 scons -j4"],
|
||||
["test athena", "nosetests -s selfdrive/athena/tests/test_athenad_old.py"],
|
||||
["build devel", "cd release && DEVEL_TEST=1 ./build_devel.sh"],
|
||||
["test manager", "python selfdrive/manager/test/test_manager.py"],
|
||||
["onroad tests", "cd selfdrive/test/ && ./test_onroad.py"],
|
||||
["build devel", "cd release && CI_PUSH=${env.CI_PUSH} ./build_devel.sh"],
|
||||
["test car interfaces", "cd selfdrive/car/tests/ && ./test_car_interfaces.py"],
|
||||
])
|
||||
}
|
||||
@@ -140,8 +138,8 @@ pipeline {
|
||||
stage('Replay Tests') {
|
||||
steps {
|
||||
phone_steps("eon2", [
|
||||
["build QCOM_REPLAY", "SCONS_CACHE=1 QCOM_REPLAY=1 scons -j4"],
|
||||
["camerad/modeld replay", "cd selfdrive/test/process_replay && ./camera_replay.py"],
|
||||
["build", "cd selfdrive/manager && ./build.py"],
|
||||
["model replay", "cd selfdrive/test/process_replay && ./model_replay.py"],
|
||||
])
|
||||
}
|
||||
}
|
||||
@@ -149,7 +147,8 @@ pipeline {
|
||||
stage('HW + Unit Tests') {
|
||||
steps {
|
||||
phone_steps("eon", [
|
||||
["build", "SCONS_CACHE=1 scons -j4"],
|
||||
["build", "cd selfdrive/manager && ./build.py"],
|
||||
["test athena", "nosetests -s selfdrive/athena/tests/test_athenad_old.py"],
|
||||
["test sounds", "nosetests -s selfdrive/test/test_sounds.py"],
|
||||
["test boardd loopback", "nosetests -s selfdrive/boardd/tests/test_boardd_loopback.py"],
|
||||
["test loggerd", "python selfdrive/loggerd/tests/test_loggerd.py"],
|
||||
@@ -160,15 +159,37 @@ pipeline {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
stage('Power Consumption Tests') {
|
||||
steps {
|
||||
lock(resource: "", label: "c2-zookeeper", inversePrecedence: true, variable: 'device_ip', quantity: 1) {
|
||||
timeout(time: 90, unit: 'MINUTES') {
|
||||
sh script: "/home/batman/tools/zookeeper/enable_and_wait.py $device_ip 120", label: "turn on device"
|
||||
phone(device_ip, "git checkout", readFile("selfdrive/test/setup_device_ci.sh"),)
|
||||
phone(device_ip, "build", "scons -j4 && sync")
|
||||
sh script: "/home/batman/tools/zookeeper/disable.py $device_ip", label: "turn off device"
|
||||
sh script: "/home/batman/tools/zookeeper/enable_and_wait.py $device_ip 120", label: "turn on device"
|
||||
sh script: "/home/batman/tools/zookeeper/check_consumption.py 60 3", label: "idle power consumption after boot"
|
||||
sh script: "/home/batman/tools/zookeeper/ignition.py 1", label: "go onroad"
|
||||
sh script: "/home/batman/tools/zookeeper/check_consumption.py 60 10", label: "onroad power consumption"
|
||||
sh script: "/home/batman/tools/zookeeper/ignition.py 0", label: "go offroad"
|
||||
sh script: "/home/batman/tools/zookeeper/check_consumption.py 60 2", label: "idle power consumption offroad"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
stage('Tici Build') {
|
||||
environment {
|
||||
R3_PUSH = "${env.BRANCH_NAME == 'master' ? '1' : ' '}"
|
||||
}
|
||||
steps {
|
||||
phone_steps("tici", [
|
||||
["build", "SCONS_CACHE=1 scons -j16"],
|
||||
["build", "cd selfdrive/manager && ./build.py"],
|
||||
["test loggerd", "python selfdrive/loggerd/tests/test_loggerd.py"],
|
||||
["test encoder", "LD_LIBRARY_PATH=/usr/local/lib python selfdrive/loggerd/tests/test_encoder.py"],
|
||||
["onroad tests", "cd selfdrive/test/ && ./test_onroad.py"],
|
||||
//["build release3-staging", "cd release && PUSH=${env.R3_PUSH} ./build_release3.sh"],
|
||||
])
|
||||
}
|
||||
@@ -177,7 +198,7 @@ pipeline {
|
||||
stage('camerad') {
|
||||
steps {
|
||||
phone_steps("eon-party", [
|
||||
["build", "SCONS_CACHE=1 scons -j16"],
|
||||
["build", "cd selfdrive/manager && ./build.py"],
|
||||
["test camerad", "python selfdrive/camerad/test/test_camerad.py"],
|
||||
["test exposure", "python selfdrive/camerad/test/test_exposure.py"],
|
||||
])
|
||||
@@ -187,7 +208,7 @@ pipeline {
|
||||
stage('Tici camerad') {
|
||||
steps {
|
||||
phone_steps("tici-party", [
|
||||
["build", "SCONS_CACHE=1 scons -j16"],
|
||||
["build", "cd selfdrive/manager && ./build.py"],
|
||||
["test camerad", "python selfdrive/camerad/test/test_camerad.py"],
|
||||
["test exposure", "python selfdrive/camerad/test/test_exposure.py"],
|
||||
])
|
||||
@@ -196,6 +217,18 @@ pipeline {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
stage('Push master-ci') {
|
||||
when {
|
||||
branch 'master'
|
||||
}
|
||||
steps {
|
||||
phone_steps("eon-build", [
|
||||
["push devel", "cd release && CI_PUSH='master-ci' ./build_devel.sh"],
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
post {
|
||||
|
||||
@@ -66,7 +66,7 @@ Supported Cars
|
||||
| ----------| ------------------------------| ------------------| -----------------| -------------------| ------------------|
|
||||
| Acura | ILX 2016-19 | AcuraWatch Plus | openpilot | 25mph<sup>1</sup> | 25mph |
|
||||
| Acura | RDX 2016-18 | AcuraWatch Plus | openpilot | 25mph<sup>1</sup> | 12mph |
|
||||
| Acura | RDX 2020-21 | All | Stock | 0mph | 3mph |
|
||||
| Acura | RDX 2019-21 | 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-21 | Honda Sensing | Stock | 0mph | 12mph |
|
||||
@@ -86,18 +86,20 @@ Supported Cars
|
||||
| Hyundai | Palisade 2020-21 | All | Stock | 0mph | 0mph |
|
||||
| Hyundai | Sonata 2020-21 | All | Stock | 0mph | 0mph |
|
||||
| Lexus | CT Hybrid 2017-18 | LSS | Stock<sup>3</sup>| 0mph | 0mph |
|
||||
| Lexus | ES 2019-20 | All | openpilot | 0mph | 0mph |
|
||||
| Lexus | ES Hybrid 2018 | LSS | Stock<sup>3</sup>| 0mph | 0mph |
|
||||
| Lexus | ES Hybrid 2019 | All | openpilot | 0mph | 0mph |
|
||||
| Lexus | ES 2019-21 | All | openpilot | 0mph | 0mph |
|
||||
| Lexus | ES Hybrid 2017-18 | LSS | Stock<sup>3</sup>| 0mph | 0mph |
|
||||
| Lexus | ES Hybrid 2019-21 | 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 2020 | All | openpilot | 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-21 | All | openpilot | 0mph | 0mph |
|
||||
| Lexus | RX Hybrid 2016-19 | All | Stock<sup>3</sup>| 0mph | 0mph |
|
||||
| Lexus | RX Hybrid 2020 | All | openpilot | 0mph | 0mph |
|
||||
| Toyota | Avalon 2016-18, 2020-21 | TSS-P | Stock<sup>3</sup>| 20mph<sup>1</sup> | 0mph |
|
||||
| Lexus | UX Hybrid 2019 | All | openpilot | 0mph | 0mph |
|
||||
| Toyota | Avalon 2016-21 | TSS-P | Stock<sup>3</sup>| 20mph<sup>1</sup> | 0mph |
|
||||
| Toyota | Avalon Hybrid 2019 | TSS-P | Stock<sup>3</sup>| 20mph<sup>1</sup> | 0mph |
|
||||
| Toyota | Camry 2018-20 | All | Stock | 0mph<sup>4</sup> | 0mph |
|
||||
| Toyota | Camry 2021 | All | openpilot | 0mph | 0mph |
|
||||
| Toyota | Camry Hybrid 2018-20 | All | Stock | 0mph<sup>4</sup> | 0mph |
|
||||
@@ -112,6 +114,7 @@ Supported Cars
|
||||
| Toyota | Highlander 2020-21 | All | openpilot | 0mph | 0mph |
|
||||
| Toyota | Highlander Hybrid 2017-19 | All | Stock<sup>3</sup>| 0mph | 0mph |
|
||||
| Toyota | Highlander Hybrid 2020-21 | All | openpilot | 0mph | 0mph |
|
||||
| Toyota | Mirai 2021 | 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 |
|
||||
@@ -132,7 +135,9 @@ Community Maintained Cars and Features
|
||||
|
||||
| Make | Model (US Market Reference) | Supported Package | ACC | No ACC accel below | No ALC below |
|
||||
| ----------| ------------------------------| ------------------| -----------------| -------------------| -------------|
|
||||
| Audi | A3 2015, 2017 | Prestige | Stock | 0mph | 0mph |
|
||||
| Audi | A3 2014-18 | Prestige | Stock | 0mph | 0mph |
|
||||
| Audi | A3 Sportback e-tron 2017-18 | Prestige | Stock | 0mph | 0mph |
|
||||
| Audi | Q2 2018 | Driver Assistance | Stock | 0mph | 0mph |
|
||||
| Buick | Regal 2018<sup>1</sup> | Adaptive Cruise | openpilot | 0mph | 7mph |
|
||||
| Cadillac | ATS 2018<sup>1</sup> | Adaptive Cruise | openpilot | 0mph | 7mph |
|
||||
| Chevrolet | Malibu 2017<sup>1</sup> | Adaptive Cruise | openpilot | 0mph | 7mph |
|
||||
@@ -146,7 +151,7 @@ Community Maintained Cars and Features
|
||||
| Genesis | G90 2018 | All | Stock | 0mph | 0mph |
|
||||
| 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 | Elantra 2017-19, 2021 | SCC + LKAS | Stock | 19mph | 34mph |
|
||||
| Hyundai | Genesis 2015-16 | SCC + LKAS | Stock | 19mph | 37mph |
|
||||
| Hyundai | Ioniq Electric 2019 | SCC + LKAS | Stock | 0mph | 32mph |
|
||||
| Hyundai | Ioniq Electric 2020 | SCC + LKAS | Stock | 0mph | 0mph |
|
||||
@@ -157,45 +162,50 @@ Community Maintained Cars and Features
|
||||
| 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, 2021 | SCC + LKAS | Stock | 0mph | 0mph |
|
||||
| Kia | Forte 2018-2021 | 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 | Seltos 2021 | SCC + LKAS | Stock | 0mph | 0mph |
|
||||
| Kia | Sorento 2018 | SCC + LKAS | Stock | 0mph | 0mph |
|
||||
| Kia | Sorento 2018-19 | SCC + LKAS | Stock | 0mph | 0mph |
|
||||
| Kia | Stinger 2018 | SCC + LKAS | Stock | 0mph | 0mph |
|
||||
| Kia | Ceed 2019 | SCC + LKAS | Stock | 0mph | 0mph |
|
||||
| Nissan | Altima 2020 | ProPILOT | Stock | 0mph | 0mph |
|
||||
| Nissan | Altima 2019-20 | ProPILOT | Stock | 0mph | 0mph |
|
||||
| Nissan | Leaf 2018-20 | ProPILOT | Stock | 0mph | 0mph |
|
||||
| Nissan | Rogue 2018-19 | ProPILOT | Stock | 0mph | 0mph |
|
||||
| Nissan | Rogue 2018-20 | ProPILOT | Stock | 0mph | 0mph |
|
||||
| Nissan | X-Trail 2017 | ProPILOT | Stock | 0mph | 0mph |
|
||||
| SEAT | Ateca 2018 | Driver Assistance | Stock | 0mph | 0mph |
|
||||
| SEAT | Leon 2014-2020 | Driver Assistance | Stock | 0mph | 0mph |
|
||||
| Škoda | Kodiaq 2018 | Driver Assistance | Stock | 0mph | 0mph |
|
||||
| Škoda | Octavia 2015, 2019 | Driver Assistance | Stock | 0mph | 0mph |
|
||||
| Škoda | Scala 2020 | Driver Assistance | Stock | 0mph | 0mph |
|
||||
| Škoda | Superb 2018 | Driver Assistance | Stock | 0mph | 0mph |
|
||||
| Škoda | Superb 2015-18 | Driver Assistance | Stock | 0mph | 0mph |
|
||||
| Subaru | Ascent 2019 | EyeSight | Stock | 0mph | 0mph |
|
||||
| Subaru | Crosstrek 2018-19 | EyeSight | Stock | 0mph | 0mph |
|
||||
| Subaru | Forester 2019-20 | EyeSight | Stock | 0mph | 0mph |
|
||||
| Subaru | Forester 2019-21 | EyeSight | Stock | 0mph | 0mph |
|
||||
| Subaru | Impreza 2017-19 | EyeSight | Stock | 0mph | 0mph |
|
||||
| Volkswagen| e-Golf 2014, 2020 | Driver Assistance | Stock | 0mph | 0mph |
|
||||
| Volkswagen| Atlas 2018-19 | Driver Assistance | Stock | 0mph | 0mph |
|
||||
| Volkswagen| e-Golf 2014, 2019-20 | Driver Assistance | Stock | 0mph | 0mph |
|
||||
| Volkswagen| Golf 2015-19 | Driver Assistance | Stock | 0mph | 0mph |
|
||||
| Volkswagen| Golf Alltrack 2017-18 | Driver Assistance | Stock | 0mph | 0mph |
|
||||
| Volkswagen| Golf GTE 2016 | Driver Assistance | Stock | 0mph | 0mph |
|
||||
| Volkswagen| Golf GTI 2018-19 | Driver Assistance | Stock | 0mph | 0mph |
|
||||
| Volkswagen| Golf R 2016-19 | Driver Assistance | Stock | 0mph | 0mph |
|
||||
| Volkswagen| Golf SportsVan 2016 | Driver Assistance | Stock | 0mph | 0mph |
|
||||
| Volkswagen| Jetta 2018-21 | Driver Assistance | Stock | 0mph | 0mph |
|
||||
| Volkswagen| Jetta 2018-20 | Driver Assistance | Stock | 0mph | 0mph |
|
||||
| Volkswagen| Jetta GLI 2021 | Driver Assistance | Stock | 0mph | 0mph |
|
||||
| Volkswagen| Passat 2016-17<sup>2</sup> | Driver Assistance | Stock | 0mph | 0mph |
|
||||
| Volkswagen| Tiguan 2020 | 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 ASCM harness](https://github.com/commaai/openpilot/wiki/GM#hardware). ***NOTE: disconnecting the ASCM disables Automatic Emergency Braking (AEB).*** <br />
|
||||
<sup>2</sup>Only includes the MQB Passat sold outside of North America. The NMS Passat made in Chattanooga TN is not yet supported.
|
||||
|
||||
Although it's not upstream, there's a community of people getting openpilot to run on Tesla's [here](https://tinkla.us/)
|
||||
|
||||
Community Maintained Cars and Features are not verified by comma to meet our [safety model](SAFETY.md). Be extra cautious using them. They are only available after enabling the toggle in `Settings->Developer->Enable Community Features`.
|
||||
|
||||
To promote a car from community maintained, it must meet a few requirements. We must own one from the brand, we must sell the harness for it, has full ISO26262 in both panda and openpilot, there must be a path forward for longitudinal control, it must have AEB still enabled, and it must support fingerprinting 2.0
|
||||
|
||||
Although they're not upstream, the community has openpilot running on other makes and models. See the 'Community Supported Models' section of each make [on our wiki](https://wiki.comma.ai/).
|
||||
|
||||
Installation Instructions
|
||||
------
|
||||
|
||||
@@ -327,7 +337,7 @@ Directory Structure
|
||||
.
|
||||
├── cereal # The messaging spec and libs used for all logs
|
||||
├── common # Library like functionality we've developed here
|
||||
├── installer/updater # Manages auto-updates of openpilot
|
||||
├── installer/updater # Manages auto-updates of NEOS
|
||||
├── opendbc # Files showing how to interpret data from cars
|
||||
├── panda # Code used to communicate on CAN
|
||||
├── phonelibs # Libraries used on NEOS devices
|
||||
|
||||
+25
@@ -1,3 +1,28 @@
|
||||
Version 0.8.5 (2021-06-11)
|
||||
========================
|
||||
* NEOS update: improved reliability and stability with better voltage regulator configuration
|
||||
* Smart model-based Forward Collision Warning
|
||||
* CAN-based fingerprinting moved behind community features toggle
|
||||
* Improved longitudinal control on Toyotas with a comma pedal
|
||||
* Improved auto-brightness using road-facing camera
|
||||
* Added "Software" settings page with updater controls
|
||||
* Audi Q2 2018 support thanks to jyoung8607!
|
||||
* Hyundai Elantra 2021 support thanks to CruiseBrantley!
|
||||
* Lexus UX Hybrid 2019-2020 support thanks to brianhaugen2!
|
||||
* Toyota Avalon Hybrid 2019 support thanks to jbates9011!
|
||||
* SEAT Leon 2017 & 2020 support thanks to jyoung8607!
|
||||
* Škoda Octavia 2015 & 2019 support thanks to jyoung8607!
|
||||
|
||||
Version 0.8.4 (2021-05-17)
|
||||
========================
|
||||
* Delay controls start until system is ready
|
||||
* Fuzzy car identification, enabled with Community Features toggle
|
||||
* Localizer optimized for increased precision and less CPU usage
|
||||
* Retuned lateral control to be more aggressive when model is confident
|
||||
* Toyota Mirai 2021 support
|
||||
* Lexus NX 300 2020 support thanks to goesreallyfast!
|
||||
* Volkswagen Atlas 2018-19 support thanks to jyoung8607!
|
||||
|
||||
Version 0.8.3 (2021-04-01)
|
||||
========================
|
||||
* New model
|
||||
|
||||
+59
-38
@@ -13,6 +13,10 @@ AddOption('--test',
|
||||
action='store_true',
|
||||
help='build test files')
|
||||
|
||||
AddOption('--kaitai',
|
||||
action='store_true',
|
||||
help='Regenerate kaitai struct parsers')
|
||||
|
||||
AddOption('--asan',
|
||||
action='store_true',
|
||||
help='turn on ASAN')
|
||||
@@ -33,6 +37,10 @@ AddOption('--mpc-generate',
|
||||
action='store_true',
|
||||
help='regenerates the mpc sources')
|
||||
|
||||
AddOption('--snpe',
|
||||
action='store_true',
|
||||
help='use SNPE on PC')
|
||||
|
||||
AddOption('--external-sconscript',
|
||||
action='store',
|
||||
metavar='FILE',
|
||||
@@ -47,7 +55,6 @@ if arch == "aarch64" and TICI:
|
||||
arch = "larch64"
|
||||
|
||||
USE_WEBCAM = os.getenv("USE_WEBCAM") is not None
|
||||
QCOM_REPLAY = arch == "aarch64" and os.getenv("QCOM_REPLAY") is not None
|
||||
|
||||
lenv = {
|
||||
"PATH": os.environ['PATH'],
|
||||
@@ -79,6 +86,9 @@ if arch == "aarch64" or arch == "larch64":
|
||||
"#phonelibs/libyuv/larch64/lib",
|
||||
"/usr/lib/aarch64-linux-gnu"
|
||||
]
|
||||
cpppath += [
|
||||
"#selfdrive/camerad/include",
|
||||
]
|
||||
cflags = ["-DQCOM2", "-mcpu=cortex-a57"]
|
||||
cxxflags = ["-DQCOM2", "-mcpu=cortex-a57"]
|
||||
rpath = ["/usr/local/lib"]
|
||||
@@ -91,31 +101,33 @@ if arch == "aarch64" or arch == "larch64":
|
||||
cflags = ["-DQCOM", "-mcpu=cortex-a57"]
|
||||
cxxflags = ["-DQCOM", "-mcpu=cortex-a57"]
|
||||
rpath = []
|
||||
|
||||
if QCOM_REPLAY:
|
||||
cflags += ["-DQCOM_REPLAY"]
|
||||
cxxflags += ["-DQCOM_REPLAY"]
|
||||
else:
|
||||
cflags = []
|
||||
cxxflags = []
|
||||
cpppath = []
|
||||
|
||||
if arch == "Darwin":
|
||||
yuv_dir = "mac" if real_arch != "arm64" else "mac_arm64"
|
||||
libpath = [
|
||||
"#phonelibs/libyuv/mac/lib",
|
||||
"#cereal",
|
||||
"#selfdrive/common",
|
||||
f"#phonelibs/libyuv/{yuv_dir}/lib",
|
||||
"/usr/local/lib",
|
||||
"/opt/homebrew/lib",
|
||||
"/usr/local/opt/openssl/lib",
|
||||
"/opt/homebrew/opt/openssl/lib",
|
||||
"/System/Library/Frameworks/OpenGL.framework/Libraries",
|
||||
]
|
||||
cflags += ["-DGL_SILENCE_DEPRECATION"]
|
||||
cxxflags += ["-DGL_SILENCE_DEPRECATION"]
|
||||
cpppath += ["/usr/local/opt/openssl/include"]
|
||||
cpppath += [
|
||||
"/opt/homebrew/include",
|
||||
"/usr/local/opt/openssl/include",
|
||||
"/opt/homebrew/opt/openssl/include"
|
||||
]
|
||||
else:
|
||||
libpath = [
|
||||
"#phonelibs/snpe/x86_64-linux-clang",
|
||||
"#phonelibs/libyuv/x64/lib",
|
||||
"#phonelibs/mapbox-gl-native-qt/x86_64",
|
||||
"#cereal",
|
||||
"#selfdrive/common",
|
||||
"/usr/lib",
|
||||
@@ -141,6 +153,10 @@ else:
|
||||
ccflags = []
|
||||
ldflags = []
|
||||
|
||||
# no --as-needed on mac linker
|
||||
if arch != "Darwin":
|
||||
ldflags += ["-Wl,--as-needed"]
|
||||
|
||||
# change pythonpath to this
|
||||
lenv["PYTHONPATH"] = Dir("#").path
|
||||
|
||||
@@ -162,7 +178,6 @@ env = Environment(
|
||||
|
||||
CPPPATH=cpppath + [
|
||||
"#",
|
||||
"#selfdrive",
|
||||
"#phonelibs/catch2/include",
|
||||
"#phonelibs/bzip2",
|
||||
"#phonelibs/libyuv/include",
|
||||
@@ -175,16 +190,10 @@ env = Environment(
|
||||
"#phonelibs/android_system_core/include",
|
||||
"#phonelibs/linux/include",
|
||||
"#phonelibs/snpe/include",
|
||||
"#phonelibs/mapbox-gl-native-qt/include",
|
||||
"#phonelibs/nanovg",
|
||||
"#phonelibs/qrcode",
|
||||
"#selfdrive/boardd",
|
||||
"#selfdrive/common",
|
||||
"#selfdrive/camerad",
|
||||
"#selfdrive/camerad/include",
|
||||
"#selfdrive/loggerd/include",
|
||||
"#selfdrive/modeld",
|
||||
"#selfdrive/sensord",
|
||||
"#selfdrive/ui",
|
||||
"#phonelibs",
|
||||
"#cereal",
|
||||
"#cereal/messaging",
|
||||
"#cereal/visionipc",
|
||||
@@ -214,15 +223,10 @@ env = Environment(
|
||||
if GetOption('compile_db'):
|
||||
env.CompilationDatabase('compile_commands.json')
|
||||
|
||||
if os.environ.get('SCONS_CACHE'):
|
||||
cache_dir = '/tmp/scons_cache'
|
||||
if TICI:
|
||||
cache_dir = '/data/scons_cache'
|
||||
|
||||
if QCOM_REPLAY:
|
||||
cache_dir = '/tmp/scons_cache_qcom_replay'
|
||||
|
||||
CacheDir(cache_dir)
|
||||
# Setup cache dir
|
||||
cache_dir = '/data/scons_cache' if TICI else '/tmp/scons_cache'
|
||||
CacheDir(cache_dir)
|
||||
Clean(["."], cache_dir)
|
||||
|
||||
node_interval = 5
|
||||
node_count = 0
|
||||
@@ -264,13 +268,16 @@ Export('envCython')
|
||||
|
||||
# Qt build environment
|
||||
qt_env = env.Clone()
|
||||
qt_modules = ["Widgets", "Gui", "Core", "Network", "Concurrent", "Multimedia", "Quick", "Qml", "QuickWidgets"]
|
||||
qt_modules = ["Widgets", "Gui", "Core", "Network", "Concurrent", "Multimedia", "Quick", "Qml", "QuickWidgets", "Location", "Positioning"]
|
||||
if arch != "aarch64":
|
||||
qt_modules += ["DBus"]
|
||||
|
||||
qt_libs = []
|
||||
if arch == "Darwin":
|
||||
qt_env['QTDIR'] = "/usr/local/opt/qt@5"
|
||||
if real_arch == "arm64":
|
||||
qt_env['QTDIR'] = "/opt/homebrew/opt/qt@5"
|
||||
else:
|
||||
qt_env['QTDIR'] = "/usr/local/opt/qt@5"
|
||||
qt_dirs = [
|
||||
os.path.join(qt_env['QTDIR'], "include"),
|
||||
]
|
||||
@@ -326,12 +333,8 @@ if GetOption("clazy"):
|
||||
qt_env['CXX'] = 'clazy'
|
||||
qt_env['ENV']['CLAZY_IGNORE_DIRS'] = qt_dirs[0]
|
||||
qt_env['ENV']['CLAZY_CHECKS'] = ','.join(checks)
|
||||
Export('qt_env')
|
||||
|
||||
|
||||
# still needed for apks
|
||||
zmq = 'zmq'
|
||||
Export('env', 'arch', 'real_arch', 'zmq', 'SHARED', 'USE_WEBCAM', 'QCOM_REPLAY')
|
||||
Export('env', 'qt_env', 'arch', 'real_arch', 'SHARED', 'USE_WEBCAM')
|
||||
|
||||
# cereal and messaging are shared with the system
|
||||
SConscript(['cereal/SConscript'])
|
||||
@@ -356,6 +359,28 @@ else:
|
||||
|
||||
Export('common', 'gpucommon', 'visionipc')
|
||||
|
||||
# Build rednose library and ekf models
|
||||
|
||||
rednose_config = {
|
||||
'generated_folder': '#selfdrive/locationd/models/generated',
|
||||
'to_build': {
|
||||
'live': ('#selfdrive/locationd/models/live_kf.py', True, ['live_kf_constants.h']),
|
||||
'car': ('#selfdrive/locationd/models/car_kf.py', True, []),
|
||||
},
|
||||
}
|
||||
|
||||
if arch != "aarch64":
|
||||
rednose_config['to_build'].update({
|
||||
'gnss': ('#selfdrive/locationd/models/gnss_kf.py', True, []),
|
||||
'loc_4': ('#selfdrive/locationd/models/loc_kf.py', True, []),
|
||||
'pos_computer_4': ('#rednose/helpers/lst_sq_computer.py', False, []),
|
||||
'pos_computer_5': ('#rednose/helpers/lst_sq_computer.py', False, []),
|
||||
'feature_handler_5': ('#rednose/helpers/feature_handler.py', False, []),
|
||||
'lane': ('#xx/pipeline/lib/ekf/lane_kf.py', True, []),
|
||||
})
|
||||
|
||||
Export('rednose_config')
|
||||
SConscript(['rednose/SConscript'])
|
||||
|
||||
# Build openpilot
|
||||
|
||||
@@ -384,16 +409,12 @@ SConscript(['selfdrive/clocksd/SConscript'])
|
||||
SConscript(['selfdrive/loggerd/SConscript'])
|
||||
|
||||
SConscript(['selfdrive/locationd/SConscript'])
|
||||
SConscript(['selfdrive/locationd/models/SConscript'])
|
||||
SConscript(['selfdrive/sensord/SConscript'])
|
||||
SConscript(['selfdrive/ui/SConscript'])
|
||||
|
||||
if arch != "Darwin":
|
||||
SConscript(['selfdrive/logcatd/SConscript'])
|
||||
|
||||
if real_arch == "x86_64":
|
||||
SConscript(['tools/nui/SConscript'])
|
||||
|
||||
external_sconscript = GetOption('external_sconscript')
|
||||
if external_sconscript:
|
||||
SConscript([external_sconscript])
|
||||
|
||||
+4
-9
@@ -1,4 +1,4 @@
|
||||
Import('env', 'envCython', 'arch', 'zmq', 'QCOM_REPLAY')
|
||||
Import('env', 'envCython', 'arch')
|
||||
|
||||
import shutil
|
||||
|
||||
@@ -40,13 +40,6 @@ messaging_objects = env.SharedObject([
|
||||
messaging_lib = env.Library('messaging', messaging_objects)
|
||||
Depends('messaging/impl_zmq.cc', services_h)
|
||||
|
||||
# note, this rebuilds the deps shared, zmq is statically linked to make APK happy
|
||||
# TODO: get APK to load system zmq to remove the static link
|
||||
if arch == "aarch64":
|
||||
zmq_static = FindFile("libzmq.a", "/usr/lib")
|
||||
shared_lib_shared_lib = [zmq_static, 'm', 'stdc++', "gnustl_shared", "kj", "capnp"]
|
||||
env.SharedLibrary('messaging_shared', messaging_objects, LIBS=shared_lib_shared_lib)
|
||||
|
||||
env.Program('messaging/bridge', ['messaging/bridge.cc'], LIBS=[messaging_lib, 'zmq'])
|
||||
Depends('messaging/bridge.cc', services_h)
|
||||
|
||||
@@ -61,7 +54,7 @@ vipc_sources = [
|
||||
'visionipc/visionbuf.cc',
|
||||
]
|
||||
|
||||
if arch in ["aarch64", "larch64"] and (not QCOM_REPLAY):
|
||||
if arch in ["aarch64", "larch64"]:
|
||||
vipc_sources += ['visionipc/visionbuf_ion.cc']
|
||||
else:
|
||||
vipc_sources += ['visionipc/visionbuf_cl.cc']
|
||||
@@ -71,6 +64,8 @@ vipc = env.Library('visionipc', vipc_objects)
|
||||
|
||||
|
||||
libs = envCython["LIBS"]+["OpenCL", "zmq", vipc, messaging_lib]
|
||||
if arch == "aarch64":
|
||||
libs += ["adreno_utils"]
|
||||
if arch == "Darwin":
|
||||
del libs[libs.index('OpenCL')]
|
||||
envCython['FRAMEWORKS'] += ['OpenCL']
|
||||
|
||||
+17
-4
@@ -52,8 +52,8 @@ struct CarEvent @0x9b1657f34caf3ad3 {
|
||||
manualRestart @30;
|
||||
lowSpeedLockout @31;
|
||||
plannerError @32;
|
||||
debugAlert @34;
|
||||
steerTempUnavailableMute @35;
|
||||
joystickDebug @34;
|
||||
steerTempUnavailableUserOverride @35;
|
||||
resumeRequired @36;
|
||||
preDriverDistracted @37;
|
||||
promptDriverDistracted @38;
|
||||
@@ -64,7 +64,7 @@ struct CarEvent @0x9b1657f34caf3ad3 {
|
||||
belowSteerSpeed @46;
|
||||
lowBattery @48;
|
||||
vehicleModelInvalid @50;
|
||||
controlsFailed @51;
|
||||
accFaulted @51;
|
||||
sensorDataInvalid @52;
|
||||
commIssue @53;
|
||||
tooDistracted @54;
|
||||
@@ -89,6 +89,8 @@ struct CarEvent @0x9b1657f34caf3ad3 {
|
||||
startupNoCar @76;
|
||||
startupNoControl @77;
|
||||
startupMaster @78;
|
||||
startupFuzzyFingerprint @97;
|
||||
startupNoFw @104;
|
||||
fcw @79;
|
||||
steerSaturated @80;
|
||||
belowEngageSpeed @84;
|
||||
@@ -101,6 +103,12 @@ struct CarEvent @0x9b1657f34caf3ad3 {
|
||||
gpsMalfunction @94;
|
||||
processNotRunning @95;
|
||||
dashcamMode @96;
|
||||
controlsInitializing @98;
|
||||
usbError @99;
|
||||
roadCameraError @100;
|
||||
driverCameraError @101;
|
||||
wideRoadCameraError @102;
|
||||
localizerMalfunction @103;
|
||||
|
||||
radarCanErrorDEPRECATED @15;
|
||||
radarCommIssueDEPRECATED @67;
|
||||
@@ -145,7 +153,6 @@ struct CarState {
|
||||
# brake pedal, 0.0-1.0
|
||||
brake @5 :Float32; # this is user pedal only
|
||||
brakePressed @6 :Bool; # this is user pedal only
|
||||
brakeLights @19 :Bool;
|
||||
|
||||
# steering wheel
|
||||
steeringAngleDeg @7 :Float32;
|
||||
@@ -239,6 +246,7 @@ struct CarState {
|
||||
}
|
||||
|
||||
errorsDEPRECATED @0 :List(CarEvent.EventName);
|
||||
brakeLightsDEPRECATED @19 :Bool;
|
||||
}
|
||||
|
||||
# ******* radar state @ 20hz *******
|
||||
@@ -351,12 +359,15 @@ struct CarControl {
|
||||
struct CarParams {
|
||||
carName @0 :Text;
|
||||
carFingerprint @1 :Text;
|
||||
fuzzyFingerprint @55 :Bool;
|
||||
|
||||
enableGasInterceptor @2 :Bool;
|
||||
enableCruise @3 :Bool;
|
||||
enableCamera @4 :Bool;
|
||||
enableDsu @5 :Bool; # driving support unit
|
||||
enableApgs @6 :Bool; # advanced parking guidance system
|
||||
enableBsm @56 :Bool; # blind spot monitoring
|
||||
hasStockCamera @57 :Bool; # factory LKAS/LDW camera is present
|
||||
|
||||
minEnableSpeed @7 :Float32;
|
||||
minSteerSpeed @8 :Float32;
|
||||
@@ -412,6 +423,7 @@ struct CarParams {
|
||||
dashcamOnly @41: Bool;
|
||||
transmissionType @43 :TransmissionType;
|
||||
carFw @44 :List(CarFw);
|
||||
|
||||
radarTimeStep @45: Float32 = 0.05; # time delta between radar updates, 20Hz is very standard
|
||||
communityFeature @46: Bool; # true if a community maintained feature is detected
|
||||
fingerprintSource @49: FingerprintSource;
|
||||
@@ -507,6 +519,7 @@ struct CarParams {
|
||||
automatic @1; # Traditional auto, including DSG
|
||||
manual @2; # True "stick shift" only
|
||||
direct @3; # Electric vehicle or other direct drive
|
||||
cvt @4;
|
||||
}
|
||||
|
||||
struct CarFw {
|
||||
|
||||
+46
-5
@@ -23,6 +23,7 @@ struct Map(Key, Value) {
|
||||
struct InitData {
|
||||
kernelArgs @0 :List(Text);
|
||||
kernelVersion @15 :Text;
|
||||
osVersion @18 :Text;
|
||||
|
||||
gctx @1 :Text;
|
||||
dongleId @2 :Text;
|
||||
@@ -280,6 +281,7 @@ struct DeviceState @0xa4d8b5af2aa492eb {
|
||||
cpuUsagePercent @20 :Int8;
|
||||
usbOnline @12 :Bool;
|
||||
networkType @22 :NetworkType;
|
||||
networkInfo @31 :NetworkInfo;
|
||||
offroadPowerUsageUwh @23 :UInt32;
|
||||
networkStrength @24 :NetworkStrength;
|
||||
carBatteryCapacityUwh @25 :UInt32;
|
||||
@@ -288,6 +290,8 @@ struct DeviceState @0xa4d8b5af2aa492eb {
|
||||
started @11 :Bool;
|
||||
startedMonoTime @13 :UInt64;
|
||||
|
||||
lastAthenaPingTime @32 :UInt64;
|
||||
|
||||
# power
|
||||
batteryPercent @8 :Int16;
|
||||
batteryStatus @9 :Text;
|
||||
@@ -328,6 +332,15 @@ struct DeviceState @0xa4d8b5af2aa492eb {
|
||||
great @4;
|
||||
}
|
||||
|
||||
struct NetworkInfo {
|
||||
technology @0 :Text;
|
||||
operator @1 :Text;
|
||||
band @2 :Text;
|
||||
channel @3 :UInt16;
|
||||
extra @4 :Text;
|
||||
state @5 :Text;
|
||||
}
|
||||
|
||||
# deprecated
|
||||
cpu0DEPRECATED @0 :UInt16;
|
||||
cpu1DEPRECATED @1 :UInt16;
|
||||
@@ -361,6 +374,8 @@ struct PandaState @0xa7649e2575e4591e {
|
||||
powerSaveEnabled @16 :Bool;
|
||||
uptime @17 :UInt32;
|
||||
faults @18 :List(FaultType);
|
||||
harnessStatus @21 :HarnessStatus;
|
||||
heartbeatLost @22 :Bool;
|
||||
|
||||
enum FaultStatus {
|
||||
none @0;
|
||||
@@ -411,6 +426,12 @@ struct PandaState @0xa7649e2575e4591e {
|
||||
dcp @3;
|
||||
}
|
||||
|
||||
enum HarnessStatus {
|
||||
notConnected @0;
|
||||
normal @1;
|
||||
flipped @2;
|
||||
}
|
||||
|
||||
startedSignalDetectedDEPRECATED @5 :Bool;
|
||||
}
|
||||
|
||||
@@ -676,10 +697,24 @@ struct ModelDataV2 {
|
||||
struct MetaData {
|
||||
engagedProb @0 :Float32;
|
||||
desirePrediction @1 :List(Float32);
|
||||
brakeDisengageProb @2 :Float32;
|
||||
gasDisengageProb @3 :Float32;
|
||||
steerOverrideProb @4 :Float32;
|
||||
desireState @5 :List(Float32);
|
||||
disengagePredictions @6 :DisengagePredictions;
|
||||
hardBrakePredicted @7 :Bool;
|
||||
|
||||
# deprecated
|
||||
brakeDisengageProbDEPRECATED @2 :Float32;
|
||||
gasDisengageProbDEPRECATED @3 :Float32;
|
||||
steerOverrideProbDEPRECATED @4 :Float32;
|
||||
}
|
||||
|
||||
struct DisengagePredictions {
|
||||
t @0 :List(Float32);
|
||||
brakeDisengageProbs @1 :List(Float32);
|
||||
gasDisengageProbs @2 :List(Float32);
|
||||
steerOverrideProbs @3 :List(Float32);
|
||||
brake3MetersPerSecondSquaredProbs @4 :List(Float32);
|
||||
brake4MetersPerSecondSquaredProbs @5 :List(Float32);
|
||||
brake5MetersPerSecondSquaredProbs @6 :List(Float32);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -867,6 +902,8 @@ struct LiveLocationKalman {
|
||||
gpsOK @19 :Bool = true;
|
||||
sensorsOK @21 :Bool = true;
|
||||
deviceStable @22 :Bool = true;
|
||||
timeSinceReset @23 :Float64;
|
||||
excessiveResets @24 :Bool;
|
||||
|
||||
enum Status {
|
||||
uninitialized @0;
|
||||
@@ -1070,6 +1107,7 @@ struct UbloxGnss {
|
||||
aStatus @2 :AntennaSupervisorState;
|
||||
aPower @3 :AntennaPowerStatus;
|
||||
jamInd @4 :UInt8;
|
||||
flags @5 :UInt8;
|
||||
|
||||
enum AntennaSupervisorState {
|
||||
init @0;
|
||||
@@ -1192,9 +1230,11 @@ struct DriverMonitoringState @0xb83cda094a1da284 {
|
||||
|
||||
struct Boot {
|
||||
wallTimeNanos @0 :UInt64;
|
||||
lastKmsg @1 :Data;
|
||||
lastPmsg @2 :Data;
|
||||
pstore @4 :Map(Text, Data);
|
||||
launchLog @3 :Text;
|
||||
|
||||
lastKmsgDEPRECATED @1 :Data;
|
||||
lastPmsgDEPRECATED @2 :Data;
|
||||
}
|
||||
|
||||
struct LiveParametersData {
|
||||
@@ -1247,6 +1287,7 @@ struct Sentinel {
|
||||
startOfRoute @3;
|
||||
}
|
||||
type @0 :SentinelType;
|
||||
signal @1 :Int32;
|
||||
}
|
||||
|
||||
struct ManagerState {
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
# must be build with scons
|
||||
from .messaging_pyx import Context, Poller, SubSocket, PubSocket # pylint: disable=no-name-in-module, import-error
|
||||
from .messaging_pyx import MultiplePublishersError, MessagingError # pylint: disable=no-name-in-module, import-error
|
||||
import os
|
||||
import capnp
|
||||
|
||||
from typing import Optional, List, Union
|
||||
from collections import deque
|
||||
|
||||
from cereal import log
|
||||
from cereal.services import service_list
|
||||
@@ -11,6 +13,9 @@ from cereal.services import service_list
|
||||
assert MultiplePublishersError
|
||||
assert MessagingError
|
||||
|
||||
AVG_FREQ_HISTORY = 100
|
||||
SIMULATION = "SIMULATION" in os.environ
|
||||
|
||||
# sec_since_boot is faster, but allow to run standalone too
|
||||
try:
|
||||
from common.realtime import sec_since_boot
|
||||
@@ -126,12 +131,14 @@ def recv_one_retry(sock: SubSocket) -> capnp.lib.capnp._DynamicStructReader:
|
||||
|
||||
class SubMaster():
|
||||
def __init__(self, services: List[str], poll: Optional[List[str]] = None,
|
||||
ignore_alive: Optional[List[str]] = None, addr:str ="127.0.0.1"):
|
||||
ignore_alive: Optional[List[str]] = None, ignore_avg_freq: Optional[List[str]] = None,
|
||||
addr: str = "127.0.0.1"):
|
||||
self.frame = -1
|
||||
self.updated = {s: False for s in services}
|
||||
self.rcv_time = {s: 0. for s in services}
|
||||
self.rcv_frame = {s: 0 for s in services}
|
||||
self.alive = {s: False for s in services}
|
||||
self.recv_dts = {s: deque([0.0] * AVG_FREQ_HISTORY, maxlen=AVG_FREQ_HISTORY) for s in services}
|
||||
self.sock = {}
|
||||
self.freq = {}
|
||||
self.data = {}
|
||||
@@ -142,10 +149,8 @@ class SubMaster():
|
||||
self.non_polled_services = [s for s in services if poll is not None and
|
||||
len(poll) and s not in poll]
|
||||
|
||||
if ignore_alive is not None:
|
||||
self.ignore_alive = ignore_alive
|
||||
else:
|
||||
self.ignore_alive = []
|
||||
self.ignore_average_freq = [] if ignore_avg_freq is None else ignore_avg_freq
|
||||
self.ignore_alive = [] if ignore_alive is None else ignore_alive
|
||||
|
||||
for s in services:
|
||||
if addr is not None:
|
||||
@@ -184,20 +189,34 @@ class SubMaster():
|
||||
|
||||
s = msg.which()
|
||||
self.updated[s] = True
|
||||
|
||||
if self.rcv_time[s] > 1e-5 and self.freq[s] > 1e-5 and (s not in self.non_polled_services) \
|
||||
and (s not in self.ignore_average_freq):
|
||||
self.recv_dts[s].append(cur_time - self.rcv_time[s])
|
||||
|
||||
self.rcv_time[s] = cur_time
|
||||
self.rcv_frame[s] = self.frame
|
||||
self.data[s] = getattr(msg, s)
|
||||
self.logMonoTime[s] = msg.logMonoTime
|
||||
self.valid[s] = msg.valid
|
||||
|
||||
for s in self.data:
|
||||
# arbitrary small number to avoid float comparison. If freq is 0, we can skip the check
|
||||
if self.freq[s] > 1e-5:
|
||||
# alive if delay is within 10x the expected frequency
|
||||
self.alive[s] = (cur_time - self.rcv_time[s]) < (10. / self.freq[s])
|
||||
else:
|
||||
if SIMULATION:
|
||||
self.alive[s] = True
|
||||
|
||||
if not SIMULATION:
|
||||
for s in self.data:
|
||||
# arbitrary small number to avoid float comparison. If freq is 0, we can skip the check
|
||||
if self.freq[s] > 1e-5:
|
||||
# alive if delay is within 10x the expected frequency
|
||||
self.alive[s] = (cur_time - self.rcv_time[s]) < (10. / self.freq[s])
|
||||
|
||||
# alive if average frequency is higher than 90% of expected frequency
|
||||
avg_dt = sum(self.recv_dts[s]) / AVG_FREQ_HISTORY
|
||||
expected_dt = 1 / (self.freq[s] * 0.90)
|
||||
self.alive[s] = self.alive[s] and (avg_dt < expected_dt)
|
||||
else:
|
||||
self.alive[s] = True
|
||||
|
||||
def all_alive(self, service_list=None) -> bool:
|
||||
if service_list is None: # check all
|
||||
service_list = self.alive.keys()
|
||||
@@ -223,3 +242,6 @@ class PubMaster():
|
||||
if not isinstance(dat, bytes):
|
||||
dat = dat.to_bytes()
|
||||
self.sock[s].send(dat)
|
||||
|
||||
def all_readers_updated(self, s: str) -> bool:
|
||||
return self.sock[s].all_readers_updated()
|
||||
|
||||
@@ -8,8 +8,8 @@ typedef void (*sighandler_t)(int sig);
|
||||
|
||||
#include "services.h"
|
||||
|
||||
#include "impl_msgq.hpp"
|
||||
#include "impl_zmq.hpp"
|
||||
#include "impl_msgq.h"
|
||||
#include "impl_zmq.h"
|
||||
|
||||
void sigpipe_handler(int sig) {
|
||||
assert(sig == SIGPIPE);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <cerrno>
|
||||
|
||||
#include "services.h"
|
||||
#include "impl_msgq.hpp"
|
||||
#include "impl_msgq.h"
|
||||
|
||||
|
||||
volatile sig_atomic_t msgq_do_exit = 0;
|
||||
@@ -196,6 +196,10 @@ int MSGQPubSocket::send(char *data, size_t size){
|
||||
return msgq_msg_send(&msg, q);
|
||||
}
|
||||
|
||||
bool MSGQPubSocket::all_readers_updated() {
|
||||
return msgq_all_readers_updated(q);
|
||||
}
|
||||
|
||||
MSGQPubSocket::~MSGQPubSocket(){
|
||||
if (q != NULL){
|
||||
msgq_close_queue(q);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
#include "messaging.hpp"
|
||||
#include "msgq.hpp"
|
||||
#include "messaging.h"
|
||||
#include "msgq.h"
|
||||
#include <zmq.h>
|
||||
#include <string>
|
||||
|
||||
@@ -48,6 +48,7 @@ public:
|
||||
int connect(Context *context, std::string endpoint, bool check_endpoint=true);
|
||||
int sendMessage(Message *message);
|
||||
int send(char *data, size_t size);
|
||||
bool all_readers_updated();
|
||||
~MSGQPubSocket();
|
||||
};
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include <zmq.h>
|
||||
|
||||
#include "services.h"
|
||||
#include "impl_zmq.hpp"
|
||||
#include "impl_zmq.h"
|
||||
|
||||
static int get_port(std::string endpoint) {
|
||||
int port = -1;
|
||||
@@ -131,6 +131,11 @@ int ZMQPubSocket::send(char *data, size_t size){
|
||||
return zmq_send(sock, data, size, ZMQ_DONTWAIT);
|
||||
}
|
||||
|
||||
bool ZMQPubSocket::all_readers_updated() {
|
||||
assert(false); // TODO not implemented
|
||||
return false;
|
||||
}
|
||||
|
||||
ZMQPubSocket::~ZMQPubSocket(){
|
||||
zmq_close(sock);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#pragma once
|
||||
#include "messaging.hpp"
|
||||
#include "messaging.h"
|
||||
#include <zmq.h>
|
||||
#include <string>
|
||||
|
||||
@@ -47,6 +47,7 @@ public:
|
||||
int connect(Context *context, std::string endpoint, bool check_endpoint=true);
|
||||
int sendMessage(Message *message);
|
||||
int send(char *data, size_t size);
|
||||
bool all_readers_updated();
|
||||
~ZMQPubSocket();
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "messaging.hpp"
|
||||
#include "impl_zmq.hpp"
|
||||
#include "impl_msgq.hpp"
|
||||
#include "messaging.h"
|
||||
#include "impl_zmq.h"
|
||||
#include "impl_msgq.h"
|
||||
|
||||
#ifdef __APPLE__
|
||||
const bool MUST_USE_ZMQ = true;
|
||||
|
||||
@@ -48,6 +48,7 @@ public:
|
||||
virtual int connect(Context *context, std::string endpoint, bool check_endpoint=true) = 0;
|
||||
virtual int sendMessage(Message *message) = 0;
|
||||
virtual int send(char *data, size_t size) = 0;
|
||||
virtual bool all_readers_updated() = 0;
|
||||
static PubSocket * create();
|
||||
static PubSocket * create(Context * context, std::string endpoint, bool check_endpoint=true);
|
||||
static PubSocket * create(Context * context, std::string endpoint, int port, bool check_endpoint=true);
|
||||
@@ -65,22 +66,26 @@ public:
|
||||
|
||||
class SubMaster {
|
||||
public:
|
||||
SubMaster(const std::initializer_list<const char *> &service_list,
|
||||
const char *address = nullptr, const std::initializer_list<const char *> &ignore_alive = {});
|
||||
int update(int timeout = 1000);
|
||||
inline bool allAlive(const std::initializer_list<const char *> &service_list = {}) { return all_(service_list, false, true); }
|
||||
inline bool allValid(const std::initializer_list<const char *> &service_list = {}) { return all_(service_list, true, false); }
|
||||
inline bool allAliveAndValid(const std::initializer_list<const char *> &service_list = {}) { return all_(service_list, true, true); }
|
||||
SubMaster(const std::vector<const char *> &service_list,
|
||||
const char *address = nullptr, const std::vector<const char *> &ignore_alive = {});
|
||||
void update(int timeout = 1000);
|
||||
void update_msgs(uint64_t current_time, std::vector<std::pair<std::string, cereal::Event::Reader>> messages);
|
||||
inline bool allAlive(const std::vector<const char *> &service_list = {}) { return all_(service_list, false, true); }
|
||||
inline bool allValid(const std::vector<const char *> &service_list = {}) { return all_(service_list, true, false); }
|
||||
inline bool allAliveAndValid(const std::vector<const char *> &service_list = {}) { return all_(service_list, true, true); }
|
||||
void drain();
|
||||
~SubMaster();
|
||||
|
||||
uint64_t frame = 0;
|
||||
bool updated(const char *name) const;
|
||||
bool alive(const char *name) const;
|
||||
bool valid(const char *name) const;
|
||||
uint64_t rcv_frame(const char *name) const;
|
||||
cereal::Event::Reader &operator[](const char *name);
|
||||
uint64_t rcv_time(const char *name) const;
|
||||
cereal::Event::Reader &operator[](const char *name) const;
|
||||
|
||||
private:
|
||||
bool all_(const std::initializer_list<const char *> &service_list, bool valid, bool alive);
|
||||
bool all_(const std::vector<const char *> &service_list, bool valid, bool alive);
|
||||
Poller *poller_ = nullptr;
|
||||
struct SubMessage;
|
||||
std::map<SubSocket *, SubMessage *> messages_;
|
||||
@@ -112,7 +117,7 @@ private:
|
||||
|
||||
class PubMaster {
|
||||
public:
|
||||
PubMaster(const std::initializer_list<const char *> &service_list);
|
||||
PubMaster(const std::vector<const char *> &service_list);
|
||||
inline int send(const char *name, capnp::byte *data, size_t size) { return sockets_.at(name)->send((char *)data, size); }
|
||||
int send(const char *name, MessageBuilder &msg);
|
||||
~PubMaster();
|
||||
@@ -6,7 +6,7 @@ from libcpp.vector cimport vector
|
||||
from libcpp cimport bool
|
||||
|
||||
|
||||
cdef extern from "messaging.hpp":
|
||||
cdef extern from "messaging.h":
|
||||
cdef cppclass Context:
|
||||
@staticmethod
|
||||
Context * create()
|
||||
@@ -31,6 +31,7 @@ cdef extern from "messaging.hpp":
|
||||
int connect(Context *, string)
|
||||
int sendMessage(Message *)
|
||||
int send(char *, size_t)
|
||||
bool all_readers_updated()
|
||||
|
||||
cdef cppclass Poller:
|
||||
@staticmethod
|
||||
|
||||
@@ -149,3 +149,6 @@ cdef class PubSocket:
|
||||
raise MultiplePublishersError
|
||||
else:
|
||||
raise MessagingError
|
||||
|
||||
def all_readers_updated(self):
|
||||
return self.socket.all_readers_updated()
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "msgq.hpp"
|
||||
#include "msgq.h"
|
||||
|
||||
void sigusr2_handler(int signal) {
|
||||
assert(signal == SIGUSR2);
|
||||
@@ -452,3 +452,13 @@ int msgq_poll(msgq_pollitem_t * items, size_t nitems, int timeout){
|
||||
|
||||
return num;
|
||||
}
|
||||
|
||||
bool msgq_all_readers_updated(msgq_queue_t *q) {
|
||||
uint64_t num_readers = *q->num_readers;
|
||||
for (uint64_t i = 0; i < num_readers; i++) {
|
||||
if (*q->read_valids[i] && *q->write_pointer != *q->read_pointers[i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return num_readers > 0;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include <atomic>
|
||||
|
||||
#define DEFAULT_SEGMENT_SIZE (10 * 1024 * 1024)
|
||||
#define NUM_READERS 8
|
||||
#define NUM_READERS 10
|
||||
#define ALIGN(n) ((n + (8 - 1)) & -8)
|
||||
|
||||
#define UNPACK64(higher, lower, input) do {uint64_t tmp = input; higher = tmp >> 32; lower = tmp & 0xFFFFFFFF;} while (0)
|
||||
@@ -64,3 +64,5 @@ int msgq_msg_send(msgq_msg_t *msg, msgq_queue_t *q);
|
||||
int msgq_msg_recv(msgq_msg_t *msg, msgq_queue_t *q);
|
||||
int msgq_msg_ready(msgq_queue_t * q);
|
||||
int msgq_poll(msgq_pollitem_t * items, size_t nitems, int timeout);
|
||||
|
||||
bool msgq_all_readers_updated(msgq_queue_t *q);
|
||||
@@ -1,7 +1,13 @@
|
||||
#include <assert.h>
|
||||
#include <time.h>
|
||||
#include "messaging.hpp"
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <string>
|
||||
#include <mutex>
|
||||
|
||||
#include "services.h"
|
||||
#include "messaging.h"
|
||||
|
||||
const bool SIMULATION = (getenv("SIMULATION") != nullptr) && (std::string(getenv("SIMULATION")) == "1");
|
||||
|
||||
static inline uint64_t nanos_since_boot() {
|
||||
struct timespec t;
|
||||
@@ -16,7 +22,7 @@ static const service *get_service(const char *name) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static inline bool inList(const std::initializer_list<const char *> &list, const char *value) {
|
||||
static inline bool inList(const std::vector<const char *> &list, const char *value) {
|
||||
for (auto &v : list) {
|
||||
if (strcmp(value, v) == 0) return true;
|
||||
}
|
||||
@@ -25,17 +31,24 @@ static inline bool inList(const std::initializer_list<const char *> &list, const
|
||||
|
||||
class MessageContext {
|
||||
public:
|
||||
MessageContext() { ctx_ = Context::create(); }
|
||||
MessageContext() : ctx_(nullptr) {};
|
||||
~MessageContext() { delete ctx_; }
|
||||
inline Context *context() {
|
||||
std::call_once(init_flag, [=]() { ctx_ = Context::create(); });
|
||||
return ctx_;
|
||||
}
|
||||
private:
|
||||
Context *ctx_;
|
||||
std::once_flag init_flag;
|
||||
};
|
||||
MessageContext ctx;
|
||||
|
||||
MessageContext message_context;
|
||||
|
||||
struct SubMaster::SubMessage {
|
||||
std::string name;
|
||||
SubSocket *socket = nullptr;
|
||||
int freq = 0;
|
||||
bool updated = false, alive = false, valid = false, ignore_alive;
|
||||
bool updated = false, alive = false, valid = true, ignore_alive;
|
||||
uint64_t rcv_time = 0, rcv_frame = 0;
|
||||
void *allocated_msg_reader = nullptr;
|
||||
capnp::FlatArrayMessageReader *msg_reader = nullptr;
|
||||
@@ -43,64 +56,81 @@ struct SubMaster::SubMessage {
|
||||
cereal::Event::Reader event;
|
||||
};
|
||||
|
||||
SubMaster::SubMaster(const std::initializer_list<const char *> &service_list, const char *address,
|
||||
const std::initializer_list<const char *> &ignore_alive) {
|
||||
SubMaster::SubMaster(const std::vector<const char *> &service_list, const char *address,
|
||||
const std::vector<const char *> &ignore_alive) {
|
||||
poller_ = Poller::create();
|
||||
for (auto name : service_list) {
|
||||
const service *serv = get_service(name);
|
||||
assert(serv != nullptr);
|
||||
SubSocket *socket = SubSocket::create(ctx.ctx_, name, address ? address : "127.0.0.1", true);
|
||||
SubSocket *socket = SubSocket::create(message_context.context(), name, address ? address : "127.0.0.1", true);
|
||||
assert(socket != 0);
|
||||
poller_->registerSocket(socket);
|
||||
SubMessage *m = new SubMessage{
|
||||
.name = name,
|
||||
.socket = socket,
|
||||
.freq = serv->frequency,
|
||||
.ignore_alive = inList(ignore_alive, name),
|
||||
.allocated_msg_reader = malloc(sizeof(capnp::FlatArrayMessageReader))};
|
||||
m->msg_reader = new (m->allocated_msg_reader) capnp::FlatArrayMessageReader({});
|
||||
messages_[socket] = m;
|
||||
services_[name] = m;
|
||||
}
|
||||
}
|
||||
|
||||
int SubMaster::update(int timeout) {
|
||||
if (++frame == UINT64_MAX) frame = 1;
|
||||
void SubMaster::update(int timeout) {
|
||||
for (auto &kv : messages_) kv.second->updated = false;
|
||||
|
||||
int updated = 0;
|
||||
auto sockets = poller_->poll(timeout);
|
||||
uint64_t current_time = nanos_since_boot();
|
||||
|
||||
std::vector<std::pair<std::string, cereal::Event::Reader>> messages;
|
||||
|
||||
for (auto s : sockets) {
|
||||
Message *msg = s->receive(true);
|
||||
if (msg == nullptr) continue;
|
||||
|
||||
SubMessage *m = messages_.at(s);
|
||||
if (m->msg_reader) {
|
||||
m->msg_reader->~FlatArrayMessageReader();
|
||||
}
|
||||
|
||||
m->msg_reader->~FlatArrayMessageReader();
|
||||
m->msg_reader = new (m->allocated_msg_reader) capnp::FlatArrayMessageReader(m->aligned_buf.align(msg));
|
||||
delete msg;
|
||||
m->event = m->msg_reader->getRoot<cereal::Event>();
|
||||
messages.push_back({m->name, m->msg_reader->getRoot<cereal::Event>()});
|
||||
}
|
||||
|
||||
update_msgs(current_time, messages);
|
||||
}
|
||||
|
||||
void SubMaster::update_msgs(uint64_t current_time, std::vector<std::pair<std::string, cereal::Event::Reader>> messages){
|
||||
if (++frame == UINT64_MAX) frame = 1;
|
||||
|
||||
for(auto &kv : messages) {
|
||||
auto m_find = services_.find(kv.first);
|
||||
if (m_find == services_.end()){
|
||||
continue;
|
||||
}
|
||||
SubMessage *m = m_find->second;
|
||||
m->event = kv.second;
|
||||
m->updated = true;
|
||||
m->rcv_time = current_time;
|
||||
m->rcv_frame = frame;
|
||||
m->valid = m->event.getValid();
|
||||
|
||||
++updated;
|
||||
if (SIMULATION) m->alive = true;
|
||||
}
|
||||
|
||||
for (auto &kv : messages_) {
|
||||
SubMessage *m = kv.second;
|
||||
m->alive = (m->freq <= (1e-5) || ((current_time - m->rcv_time) * (1e-9)) < (10.0 / m->freq));
|
||||
if (!SIMULATION) {
|
||||
for (auto &kv : messages_) {
|
||||
SubMessage *m = kv.second;
|
||||
m->alive = (m->freq <= (1e-5) || ((current_time - m->rcv_time) * (1e-9)) < (10.0 / m->freq));
|
||||
}
|
||||
}
|
||||
return updated;
|
||||
}
|
||||
|
||||
bool SubMaster::all_(const std::initializer_list<const char *> &service_list, bool valid, bool alive) {
|
||||
bool SubMaster::all_(const std::vector<const char *> &service_list, bool valid, bool alive) {
|
||||
int found = 0;
|
||||
for (auto &kv : messages_) {
|
||||
SubMessage *m = kv.second;
|
||||
if (service_list.size() == 0 || inList(service_list, m->name.c_str())) {
|
||||
found += (!valid || m->valid) && (!alive || (m->alive && !m->ignore_alive));
|
||||
found += (!valid || m->valid) && (!alive || (m->alive || m->ignore_alive));
|
||||
}
|
||||
}
|
||||
return service_list.size() == 0 ? found == messages_.size() : found == service_list.size();
|
||||
@@ -123,11 +153,23 @@ bool SubMaster::updated(const char *name) const {
|
||||
return services_.at(name)->updated;
|
||||
}
|
||||
|
||||
bool SubMaster::alive(const char *name) const {
|
||||
return services_.at(name)->alive;
|
||||
}
|
||||
|
||||
bool SubMaster::valid(const char *name) const {
|
||||
return services_.at(name)->valid;
|
||||
}
|
||||
|
||||
uint64_t SubMaster::rcv_frame(const char *name) const {
|
||||
return services_.at(name)->rcv_frame;
|
||||
}
|
||||
|
||||
cereal::Event::Reader &SubMaster::operator[](const char *name) {
|
||||
uint64_t SubMaster::rcv_time(const char *name) const {
|
||||
return services_.at(name)->rcv_time;
|
||||
}
|
||||
|
||||
cereal::Event::Reader &SubMaster::operator[](const char *name) const {
|
||||
return services_.at(name)->event;
|
||||
};
|
||||
|
||||
@@ -135,19 +177,17 @@ SubMaster::~SubMaster() {
|
||||
delete poller_;
|
||||
for (auto &kv : messages_) {
|
||||
SubMessage *m = kv.second;
|
||||
if (m->msg_reader) {
|
||||
m->msg_reader->~FlatArrayMessageReader();
|
||||
}
|
||||
m->msg_reader->~FlatArrayMessageReader();
|
||||
free(m->allocated_msg_reader);
|
||||
delete m->socket;
|
||||
delete m;
|
||||
}
|
||||
}
|
||||
|
||||
PubMaster::PubMaster(const std::initializer_list<const char *> &service_list) {
|
||||
PubMaster::PubMaster(const std::vector<const char *> &service_list) {
|
||||
for (auto name : service_list) {
|
||||
assert(get_service(name) != nullptr);
|
||||
PubSocket *socket = PubSocket::create(ctx.ctx_, name);
|
||||
PubSocket *socket = PubSocket::create(message_context.context(), name);
|
||||
assert(socket);
|
||||
sockets_[name] = socket;
|
||||
}
|
||||
|
||||
+60
-49
@@ -2,7 +2,15 @@
|
||||
import os
|
||||
from typing import Optional
|
||||
|
||||
EON = os.path.isfile('/EON')
|
||||
TICI = os.path.isfile('/TICI')
|
||||
RESERVED_PORT = 8022 # sshd
|
||||
STARTING_PORT = 8001
|
||||
|
||||
|
||||
def new_port(port: int):
|
||||
port += STARTING_PORT
|
||||
return port + 1 if port >= RESERVED_PORT else port
|
||||
|
||||
|
||||
class Service:
|
||||
def __init__(self, port: int, should_log: bool, frequency: float, decimation: Optional[int] = None):
|
||||
@@ -11,55 +19,58 @@ class Service:
|
||||
self.frequency = frequency
|
||||
self.decimation = decimation
|
||||
|
||||
service_list = {
|
||||
"roadCameraState": Service(8002, True, 20., 1),
|
||||
"sensorEvents": Service(8003, True, 100., 100),
|
||||
"gpsNMEA": Service(8004, True, 9.),
|
||||
"deviceState": Service(8005, True, 2., 1),
|
||||
"can": Service(8006, True, 100.),
|
||||
"controlsState": Service(8007, True, 100., 100),
|
||||
"features": Service(8010, True, 0.),
|
||||
"pandaState": Service(8011, True, 2., 1),
|
||||
"radarState": Service(8012, True, 20., 5),
|
||||
"roadEncodeIdx": Service(8015, True, 20., 1),
|
||||
"liveTracks": Service(8016, True, 20.),
|
||||
"sendcan": Service(8017, True, 100.),
|
||||
"logMessage": Service(8018, True, 0.),
|
||||
"liveCalibration": Service(8019, True, 4., 4),
|
||||
"androidLog": Service(8020, True, 0., 1),
|
||||
"carState": Service(8021, True, 100., 10),
|
||||
"carControl": Service(8023, True, 100., 10),
|
||||
"longitudinalPlan": Service(8024, True, 20., 2),
|
||||
"liveLocation": Service(8025, True, 0., 1),
|
||||
"procLog": Service(8031, True, 0.5),
|
||||
"gpsLocationExternal": Service(8032, True, 10., 1),
|
||||
"ubloxGnss": Service(8033, True, 10.),
|
||||
"clocks": Service(8034, True, 1., 1),
|
||||
"liveMpc": Service(8035, False, 20.),
|
||||
"liveLongitudinalMpc": Service(8036, False, 20.),
|
||||
"ubloxRaw": Service(8042, True, 20.),
|
||||
"liveLocationKalman": Service(8054, True, 20., 2),
|
||||
"uiLayoutState": Service(8060, True, 0.),
|
||||
"liveParameters": Service(8064, True, 20., 2),
|
||||
"cameraOdometry": Service(8066, True, 20., 5),
|
||||
"lateralPlan": Service(8067, True, 20., 2),
|
||||
"thumbnail": Service(8069, True, 0.2, 1),
|
||||
"carEvents": Service(8070, True, 1., 1),
|
||||
"carParams": Service(8071, True, 0.02, 1),
|
||||
"driverCameraState": Service(8072, True, 10. if EON else 20., 1),
|
||||
"driverEncodeIdx": Service(8061, True, 10. if EON else 20., 1),
|
||||
"driverState": Service(8063, True, 10. if EON else 20., 1),
|
||||
"driverMonitoringState": Service(8073, True, 10. if EON else 20., 1),
|
||||
"offroadLayout": Service(8074, False, 0.),
|
||||
"wideRoadEncodeIdx": Service(8075, True, 20., 1),
|
||||
"wideRoadCameraState": Service(8076, True, 20., 1),
|
||||
"modelV2": Service(8077, True, 20., 20),
|
||||
"managerState": Service(8078, True, 2., 1),
|
||||
|
||||
"testModel": Service(8040, False, 0.),
|
||||
"testLiveLocation": Service(8045, False, 0.),
|
||||
"testJoystick": Service(8056, False, 0.),
|
||||
services = {
|
||||
"roadCameraState": (True, 20., 1), # should_log, frequency, decimation (optional)
|
||||
"sensorEvents": (True, 100., 100),
|
||||
"gpsNMEA": (True, 9.),
|
||||
"deviceState": (True, 2., 1),
|
||||
"can": (True, 100.),
|
||||
"controlsState": (True, 100., 100),
|
||||
"features": (True, 0.),
|
||||
"pandaState": (True, 2., 1),
|
||||
"radarState": (True, 20., 5),
|
||||
"roadEncodeIdx": (True, 20., 1),
|
||||
"liveTracks": (True, 20.),
|
||||
"sendcan": (True, 100.),
|
||||
"logMessage": (True, 0.),
|
||||
"liveCalibration": (True, 4., 4),
|
||||
"androidLog": (True, 0., 1),
|
||||
"carState": (True, 100., 10),
|
||||
"carControl": (True, 100., 10),
|
||||
"longitudinalPlan": (True, 20., 2),
|
||||
"liveLocation": (True, 0., 1),
|
||||
"procLog": (True, 0.5),
|
||||
"gpsLocationExternal": (True, 10., 1),
|
||||
"ubloxGnss": (True, 10.),
|
||||
"clocks": (True, 1., 1),
|
||||
"liveMpc": (False, 20.),
|
||||
"liveLongitudinalMpc": (False, 20.),
|
||||
"ubloxRaw": (True, 20.),
|
||||
"liveLocationKalman": (True, 20., 2),
|
||||
"uiLayoutState": (True, 0.),
|
||||
"liveParameters": (True, 20., 2),
|
||||
"cameraOdometry": (True, 20., 5),
|
||||
"lateralPlan": (True, 20., 2),
|
||||
"thumbnail": (True, 0.2, 1),
|
||||
"carEvents": (True, 1., 1),
|
||||
"carParams": (True, 0.02, 1),
|
||||
"driverCameraState": (True, 10. if not TICI else 20., 1),
|
||||
"driverEncodeIdx": (True, 10. if not TICI else 20., 1),
|
||||
"driverState": (True, 10. if not TICI else 20., 1),
|
||||
"driverMonitoringState": (True, 10. if not TICI else 20., 1),
|
||||
"offroadLayout": (False, 0.),
|
||||
"wideRoadEncodeIdx": (True, 20., 1),
|
||||
"wideRoadCameraState": (True, 20., 1),
|
||||
"modelV2": (True, 20., 20),
|
||||
"managerState": (True, 2., 1),
|
||||
|
||||
"testModel": (False, 0.),
|
||||
"testLiveLocation": (False, 0.),
|
||||
"testJoystick": (False, 0.),
|
||||
}
|
||||
service_list = {name: Service(new_port(idx), *vals) for # type: ignore
|
||||
idx, (name, vals) in enumerate(services.items())}
|
||||
|
||||
|
||||
def build_header():
|
||||
@@ -72,7 +83,7 @@ def build_header():
|
||||
for k, v in service_list.items():
|
||||
should_log = "true" if v.should_log else "false"
|
||||
decimation = -1 if v.decimation is None else v.decimation
|
||||
h += ' { .name = "%s", .port = %d, .should_log = %s, .frequency = %d, .decimation = %d },\n' % \
|
||||
h += ' { "%s", %d, %s, %d, %d },\n' % \
|
||||
(k, v.port, should_log, v.frequency, decimation)
|
||||
h += "};\n"
|
||||
h += "#endif\n"
|
||||
|
||||
@@ -15,7 +15,7 @@ extern "C" void compute_aligned_width_and_height(int width,
|
||||
#endif
|
||||
|
||||
void visionbuf_compute_aligned_width_and_height(int width, int height, int *aligned_w, int *aligned_h) {
|
||||
#if defined(QCOM) && !defined(QCOM_REPLAY)
|
||||
#ifdef QCOM
|
||||
compute_aligned_width_and_height(ALIGN(width, 32), ALIGN(height, 32), 3, 0, 0, 512, aligned_w, aligned_h);
|
||||
#else
|
||||
*aligned_w = width; *aligned_h = height;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include <string>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "messaging.hpp"
|
||||
#include "messaging.h"
|
||||
#include "visionipc.h"
|
||||
#include "visionbuf.h"
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include <sys/socket.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "messaging.hpp"
|
||||
#include "messaging.h"
|
||||
#include "ipc.h"
|
||||
#include "visionipc_server.h"
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include <atomic>
|
||||
#include <map>
|
||||
|
||||
#include "messaging.hpp"
|
||||
#include "messaging.h"
|
||||
#include "visionipc.h"
|
||||
#include "visionbuf.h"
|
||||
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
Import('envCython')
|
||||
Import('envCython', 'common')
|
||||
|
||||
envCython.Program('clock.so', 'clock.pyx')
|
||||
envCython.Program('params_pyx.so', 'params_pyx.pyx')
|
||||
envCython.Program('params_pyx.so', 'params_pyx.pyx', LIBS=envCython['LIBS'] + [common, 'zmq'])
|
||||
|
||||
+2
-1
@@ -1,5 +1,6 @@
|
||||
from common.params_pyx import Params, UnknownKeyName, put_nonblocking # pylint: disable=no-name-in-module, import-error
|
||||
from common.params_pyx import Params, ParamKeyType, UnknownKeyName, put_nonblocking # pylint: disable=no-name-in-module, import-error
|
||||
assert Params
|
||||
assert ParamKeyType
|
||||
assert UnknownKeyName
|
||||
assert put_nonblocking
|
||||
|
||||
|
||||
+14
-2
@@ -8,9 +8,21 @@ cdef extern from "selfdrive/common/util.cc":
|
||||
pass
|
||||
|
||||
cdef extern from "selfdrive/common/params.h":
|
||||
cpdef enum ParamKeyType:
|
||||
PERSISTENT
|
||||
CLEAR_ON_MANAGER_START
|
||||
CLEAR_ON_PANDA_DISCONNECT
|
||||
CLEAR_ON_IGNITION_ON
|
||||
CLEAR_ON_IGNITION_OFF
|
||||
ALL
|
||||
|
||||
cdef cppclass Params:
|
||||
Params(bool)
|
||||
Params(string)
|
||||
string get(string, bool) nogil
|
||||
int delete_db_value(string)
|
||||
int write_db_value(string, string)
|
||||
bool getBool(string)
|
||||
int remove(string)
|
||||
int put(string, string)
|
||||
int putBool(string, bool)
|
||||
bool checkKey(string)
|
||||
void clearAll(ParamKeyType)
|
||||
|
||||
+30
-95
@@ -2,88 +2,20 @@
|
||||
# cython: language_level = 3
|
||||
from libcpp cimport bool
|
||||
from libcpp.string cimport string
|
||||
from common.params_pxd cimport Params as c_Params
|
||||
from common.params_pxd cimport Params as c_Params, ParamKeyType as c_ParamKeyType
|
||||
|
||||
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"ApiCache_DriveStats": [TxType.PERSISTENT],
|
||||
b"ApiCache_Device": [TxType.PERSISTENT],
|
||||
b"ApiCache_Owner": [TxType.PERSISTENT],
|
||||
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"EndToEndToggle": [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"GitDiff": [TxType.PERSISTENT],
|
||||
b"GitBranch": [TxType.PERSISTENT],
|
||||
b"GitCommit": [TxType.PERSISTENT],
|
||||
b"GitRemote": [TxType.PERSISTENT],
|
||||
b"GithubSshKeys": [TxType.PERSISTENT],
|
||||
b"GithubUsername": [TxType.PERSISTENT],
|
||||
b"HardwareSerial": [TxType.PERSISTENT],
|
||||
b"HasAcceptedTerms": [TxType.PERSISTENT],
|
||||
b"HasCompletedSetup": [TxType.PERSISTENT],
|
||||
b"IsDriverViewEnabled": [TxType.CLEAR_ON_MANAGER_START],
|
||||
b"IMEI": [TxType.PERSISTENT],
|
||||
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"LastGPSPosition": [TxType.PERSISTENT],
|
||||
b"LastUpdateException": [TxType.PERSISTENT],
|
||||
b"LastUpdateTime": [TxType.PERSISTENT],
|
||||
b"LiveParameters": [TxType.PERSISTENT],
|
||||
b"OpenpilotEnabledToggle": [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"RecordFrontLock": [TxType.PERSISTENT], # for the internal fleet
|
||||
b"ReleaseNotes": [TxType.PERSISTENT],
|
||||
b"ShouldDoUpdate": [TxType.CLEAR_ON_MANAGER_START],
|
||||
b"SubscriberInfo": [TxType.PERSISTENT],
|
||||
b"SshEnabled": [TxType.PERSISTENT],
|
||||
b"TermsVersion": [TxType.PERSISTENT],
|
||||
b"Timezone": [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"VisionRadarToggle": [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],
|
||||
b"ForcePowerDown": [TxType.CLEAR_ON_MANAGER_START],
|
||||
}
|
||||
cdef class ParamKeyType:
|
||||
PERSISTENT = c_ParamKeyType.PERSISTENT
|
||||
CLEAR_ON_MANAGER_START = c_ParamKeyType.CLEAR_ON_MANAGER_START
|
||||
CLEAR_ON_PANDA_DISCONNECT = c_ParamKeyType.CLEAR_ON_PANDA_DISCONNECT
|
||||
CLEAR_ON_IGNITION_ON = c_ParamKeyType.CLEAR_ON_IGNITION_ON
|
||||
CLEAR_ON_IGNITION_OFF = c_ParamKeyType.CLEAR_ON_IGNITION_OFF
|
||||
ALL = c_ParamKeyType.ALL
|
||||
|
||||
def ensure_bytes(v):
|
||||
if isinstance(v, str):
|
||||
@@ -108,23 +40,21 @@ cdef class Params:
|
||||
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)
|
||||
if tx_type is None:
|
||||
tx_type = ParamKeyType.ALL
|
||||
|
||||
def manager_start(self):
|
||||
self.clear_all(TxType.CLEAR_ON_MANAGER_START)
|
||||
self.p.clearAll(tx_type)
|
||||
|
||||
def panda_disconnect(self):
|
||||
self.clear_all(TxType.CLEAR_ON_PANDA_DISCONNECT)
|
||||
|
||||
def get(self, key, block=False, encoding=None):
|
||||
def check_key(self, key):
|
||||
key = ensure_bytes(key)
|
||||
|
||||
if key not in keys:
|
||||
if not self.p.checkKey(key):
|
||||
raise UnknownKeyName(key)
|
||||
|
||||
cdef string k = key
|
||||
return key
|
||||
|
||||
def get(self, key, block=False, encoding=None):
|
||||
cdef string k = self.check_key(key)
|
||||
cdef bool b = block
|
||||
|
||||
cdef string val
|
||||
@@ -144,6 +74,10 @@ cdef class Params:
|
||||
else:
|
||||
return val
|
||||
|
||||
def get_bool(self, key):
|
||||
cdef string k = self.check_key(key)
|
||||
return self.p.getBool(k)
|
||||
|
||||
def put(self, key, dat):
|
||||
"""
|
||||
Warning: This function blocks until the param is written to disk!
|
||||
@@ -151,23 +85,24 @@ cdef class Params:
|
||||
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)
|
||||
cdef string k = self.check_key(key)
|
||||
dat = ensure_bytes(dat)
|
||||
self.p.put(k, dat)
|
||||
|
||||
if key not in keys:
|
||||
raise UnknownKeyName(key)
|
||||
|
||||
self.p.write_db_value(key, dat)
|
||||
def put_bool(self, key, val):
|
||||
cdef string k = self.check_key(key)
|
||||
self.p.putBool(k, val)
|
||||
|
||||
def delete(self, key):
|
||||
key = ensure_bytes(key)
|
||||
self.p.delete_db_value(key)
|
||||
cdef string k = self.check_key(key)
|
||||
self.p.remove(k)
|
||||
|
||||
|
||||
def put_nonblocking(key, val, d=None):
|
||||
def f(key, val):
|
||||
params = Params(d)
|
||||
params.put(key, val)
|
||||
cdef string k = ensure_bytes(key)
|
||||
params.put(k, val)
|
||||
|
||||
t = threading.Thread(target=f, args=(key, val))
|
||||
t.start()
|
||||
|
||||
+12
-11
@@ -3,6 +3,7 @@ import gc
|
||||
import os
|
||||
import time
|
||||
import multiprocessing
|
||||
from typing import Optional
|
||||
|
||||
from common.clock import sec_since_boot # pylint: disable=no-name-in-module, import-error
|
||||
from selfdrive.hardware import PC, TICI
|
||||
@@ -31,49 +32,49 @@ class Priority:
|
||||
CTRL_HIGH = 53
|
||||
|
||||
|
||||
def set_realtime_priority(level):
|
||||
def set_realtime_priority(level: int) -> None:
|
||||
if not PC:
|
||||
os.sched_setscheduler(0, os.SCHED_FIFO, os.sched_param(level))
|
||||
os.sched_setscheduler(0, os.SCHED_FIFO, os.sched_param(level)) # type: ignore[attr-defined]
|
||||
|
||||
|
||||
def set_core_affinity(core):
|
||||
def set_core_affinity(core: int) -> None:
|
||||
if not PC:
|
||||
os.sched_setaffinity(0, [core,])
|
||||
|
||||
|
||||
def config_realtime_process(core, priority):
|
||||
def config_realtime_process(core: int, priority: int) -> None:
|
||||
gc.disable()
|
||||
set_realtime_priority(priority)
|
||||
set_core_affinity(core)
|
||||
|
||||
|
||||
class Ratekeeper():
|
||||
def __init__(self, rate, print_delay_threshold=0.):
|
||||
class Ratekeeper:
|
||||
def __init__(self, rate: int, print_delay_threshold: Optional[float] = 0.0) -> None:
|
||||
"""Rate in Hz for ratekeeping. print_delay_threshold must be nonnegative."""
|
||||
self._interval = 1. / rate
|
||||
self._next_frame_time = sec_since_boot() + self._interval
|
||||
self._print_delay_threshold = print_delay_threshold
|
||||
self._frame = 0
|
||||
self._remaining = 0
|
||||
self._remaining = 0.0
|
||||
self._process_name = multiprocessing.current_process().name
|
||||
|
||||
@property
|
||||
def frame(self):
|
||||
def frame(self) -> int:
|
||||
return self._frame
|
||||
|
||||
@property
|
||||
def remaining(self):
|
||||
def remaining(self) -> float:
|
||||
return self._remaining
|
||||
|
||||
# Maintain loop rate by calling this at the end of each loop
|
||||
def keep_time(self):
|
||||
def keep_time(self) -> bool:
|
||||
lagged = self.monitor_time()
|
||||
if self._remaining > 0:
|
||||
time.sleep(self._remaining)
|
||||
return lagged
|
||||
|
||||
# this only monitor the cumulative lag, but does not enforce a rate
|
||||
def monitor_time(self):
|
||||
def monitor_time(self) -> bool:
|
||||
lagged = False
|
||||
remaining = self._next_frame_time - sec_since_boot()
|
||||
self._next_frame_time += self._interval
|
||||
|
||||
@@ -5,14 +5,12 @@ from selfdrive.hardware import TICI
|
||||
|
||||
## -- hardcoded hardware params --
|
||||
eon_f_focal_length = 910.0
|
||||
eon_d_focal_length = 860.0
|
||||
leon_d_focal_length = 650.0
|
||||
eon_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)
|
||||
eon_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
|
||||
@@ -22,11 +20,6 @@ eon_fcam_intrinsics = np.array([
|
||||
[0.0, 0.0, 1.0]])
|
||||
eon_intrinsics = eon_fcam_intrinsics # xx
|
||||
|
||||
leon_dcam_intrinsics = np.array([
|
||||
[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([
|
||||
[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],
|
||||
|
||||
@@ -6,8 +6,6 @@
|
||||
|
||||
#include "coordinates.hpp"
|
||||
|
||||
#define DEG2RAD(x) ((x) * M_PI / 180.0)
|
||||
#define RAD2DEG(x) ((x) * 180.0 / M_PI)
|
||||
|
||||
|
||||
double a = 6378137; // lgtm [cpp/short-global-name]
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#define DEG2RAD(x) ((x) * M_PI / 180.0)
|
||||
#define RAD2DEG(x) ((x) * 180.0 / M_PI)
|
||||
|
||||
struct ECEF {
|
||||
double x, y, z;
|
||||
Eigen::Vector3d to_vector(){
|
||||
@@ -9,6 +12,9 @@ struct ECEF {
|
||||
|
||||
struct NED {
|
||||
double n, e, d;
|
||||
Eigen::Vector3d to_vector(){
|
||||
return Eigen::Vector3d(n, e, d);
|
||||
}
|
||||
};
|
||||
|
||||
struct Geodetic {
|
||||
|
||||
@@ -30,7 +30,8 @@ Eigen::Vector3d quat2euler(Eigen::Quaterniond quat){
|
||||
// Eigen::Vector3d euler = quat.toRotationMatrix().eulerAngles(2, 1, 0);
|
||||
// return {euler(2), euler(1), euler(0)};
|
||||
double gamma = atan2(2 * (quat.w() * quat.x() + quat.y() * quat.z()), 1 - 2 * (quat.x()*quat.x() + quat.y()*quat.y()));
|
||||
double theta = asin(2 * (quat.w() * quat.y() - quat.z() * quat.x()));
|
||||
double asin_arg_clipped = std::clamp(2 * (quat.w() * quat.y() - quat.z() * quat.x()), -1.0, 1.0);
|
||||
double theta = asin(asin_arg_clipped);
|
||||
double psi = atan2(2 * (quat.w() * quat.z() + quat.x() * quat.y()), 1 - 2 * (quat.y()*quat.y() + quat.z()*quat.z()));
|
||||
return {gamma, theta, psi};
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"ota_url": "https://commadist.azureedge.net/neosupdate/ota-signed-969e22c42e5c6314e54bc3ccaa5c6a684f3130a53a7a70e0cea9f1453ceb0b06.zip",
|
||||
"ota_hash": "969e22c42e5c6314e54bc3ccaa5c6a684f3130a53a7a70e0cea9f1453ceb0b06",
|
||||
"recovery_url": "https://commadist.azureedge.net/neosupdate/recovery-9c784a24826c25df315d0ace864224478e9c0e86b904f5d1f8e18ea1037e842b.img",
|
||||
"ota_url": "https://commadist.azureedge.net/neosupdate/ota-signed-c4f56c62c5603c86e2ae9d83008a8d42a91319979661d0c42fb97b85d9112266.zip",
|
||||
"ota_hash": "c4f56c62c5603c86e2ae9d83008a8d42a91319979661d0c42fb97b85d9112266",
|
||||
"recovery_url": "https://commadist.azureedge.net/neosupdate/recovery-c5db3790c3b09756e8e896187ddb3f1258315eb0a86030468baa187b84a3bbf5.img",
|
||||
"recovery_len": 15209772,
|
||||
"recovery_hash": "9c784a24826c25df315d0ace864224478e9c0e86b904f5d1f8e18ea1037e842b"
|
||||
"recovery_hash": "c5db3790c3b09756e8e896187ddb3f1258315eb0a86030468baa187b84a3bbf5"
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -1,37 +1,33 @@
|
||||
#include <sys/stat.h>
|
||||
#include <sys/statvfs.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <cassert>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <cassert>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/statvfs.h>
|
||||
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <mutex>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
|
||||
#include <curl/curl.h>
|
||||
#include <openssl/sha.h>
|
||||
|
||||
#include <GLES3/gl3.h>
|
||||
#include <EGL/egl.h>
|
||||
#include <EGL/eglext.h>
|
||||
|
||||
#include <GLES3/gl3.h>
|
||||
#include "nanovg.h"
|
||||
#define NANOVG_GLES3_IMPLEMENTATION
|
||||
#include "json11.hpp"
|
||||
#include "nanovg_gl.h"
|
||||
#include "nanovg_gl_utils.h"
|
||||
|
||||
#include "json11.hpp"
|
||||
|
||||
#include "common/framebuffer.h"
|
||||
#include "common/touch.h"
|
||||
#include "common/util.h"
|
||||
#include "selfdrive/common/framebuffer.h"
|
||||
#include "selfdrive/common/touch.h"
|
||||
#include "selfdrive/common/util.h"
|
||||
|
||||
#define USER_AGENT "NEOSUpdater-0.2"
|
||||
|
||||
@@ -250,7 +246,12 @@ struct Updater {
|
||||
b_y = 720;
|
||||
b_h = 220;
|
||||
|
||||
state = CONFIRMATION;
|
||||
if (download_stage(true)) {
|
||||
state = RUNNING;
|
||||
update_thread_handle = std::thread(&Updater::run_stages, this);
|
||||
} else {
|
||||
state = CONFIRMATION;
|
||||
}
|
||||
}
|
||||
|
||||
int download_file_xferinfo(curl_off_t dltotal, curl_off_t dlno,
|
||||
@@ -351,11 +352,15 @@ struct Updater {
|
||||
state = RUNNING;
|
||||
}
|
||||
|
||||
std::string download(std::string url, std::string hash, std::string name) {
|
||||
std::string download(std::string url, std::string hash, std::string name, bool dry_run) {
|
||||
std::string out_fn = UPDATE_DIR "/" + util::base_name(url);
|
||||
|
||||
// start or resume downloading if hash doesn't match
|
||||
std::string fn_hash = sha256_file(out_fn);
|
||||
if (dry_run) {
|
||||
return (hash.compare(fn_hash) != 0) ? "" : out_fn;
|
||||
}
|
||||
|
||||
// start or resume downloading if hash doesn't match
|
||||
if (hash.compare(fn_hash) != 0) {
|
||||
set_progress("Downloading " + name + "...");
|
||||
bool r = download_file(url, out_fn);
|
||||
@@ -377,14 +382,14 @@ struct Updater {
|
||||
return out_fn;
|
||||
}
|
||||
|
||||
bool download_stage() {
|
||||
bool download_stage(bool dry_run = false) {
|
||||
curl = curl_easy_init();
|
||||
assert(curl);
|
||||
|
||||
// ** quick checks before download **
|
||||
|
||||
if (!check_space()) {
|
||||
set_error("2GB of free space required to update");
|
||||
if (!dry_run) set_error("2GB of free space required to update");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -432,7 +437,7 @@ struct Updater {
|
||||
printf("existing recovery hash: %s\n", existing_recovery_hash.c_str());
|
||||
|
||||
if (existing_recovery_hash != recovery_hash) {
|
||||
recovery_fn = download(recovery_url, recovery_hash, "recovery");
|
||||
recovery_fn = download(recovery_url, recovery_hash, "recovery", dry_run);
|
||||
if (recovery_fn.empty()) {
|
||||
// error'd
|
||||
return false;
|
||||
@@ -441,7 +446,7 @@ struct Updater {
|
||||
}
|
||||
|
||||
// ** handle ota download **
|
||||
ota_fn = download(ota_url, ota_hash, "update");
|
||||
ota_fn = download(ota_url, ota_hash, "update", dry_run);
|
||||
if (ota_fn.empty()) {
|
||||
//error'd
|
||||
return false;
|
||||
|
||||
@@ -96,6 +96,7 @@ function two_init {
|
||||
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'
|
||||
nmcli connection modify --temporary lte gsm.auto-config yes
|
||||
|
||||
# set success flag for current boot slot
|
||||
sudo abctl --set_success
|
||||
@@ -165,6 +166,9 @@ function launch {
|
||||
# Remove orphaned git lock if it exists on boot
|
||||
[ -f "$DIR/.git/index.lock" ] && rm -f $DIR/.git/index.lock
|
||||
|
||||
# Pull time from panda
|
||||
$DIR/selfdrive/boardd/set_time.py
|
||||
|
||||
# Check to see if there's a valid overlay-based update available. Conditions
|
||||
# are as follows:
|
||||
#
|
||||
|
||||
+2
-2
@@ -7,11 +7,11 @@ export OPENBLAS_NUM_THREADS=1
|
||||
export VECLIB_MAXIMUM_THREADS=1
|
||||
|
||||
if [ -z "$REQUIRED_NEOS_VERSION" ]; then
|
||||
export REQUIRED_NEOS_VERSION="16.2"
|
||||
export REQUIRED_NEOS_VERSION="17"
|
||||
fi
|
||||
|
||||
if [ -z "$AGNOS_VERSION" ]; then
|
||||
export AGNOS_VERSION="0.11"
|
||||
export AGNOS_VERSION="0.18"
|
||||
fi
|
||||
|
||||
if [ -z "$PASSIVE" ]; then
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -272,6 +272,8 @@ void CANParser::UpdateValid(uint64_t sec) {
|
||||
if (state.check_threshold > 0 && (sec - state.seen) > state.check_threshold) {
|
||||
if (state.seen > 0) {
|
||||
DEBUG("0x%X TIMEOUT\n", state.address);
|
||||
} else {
|
||||
DEBUG("0x%X MISSING\n", state.address);
|
||||
}
|
||||
can_valid = false;
|
||||
}
|
||||
|
||||
@@ -33,14 +33,14 @@ cdef class CANParser:
|
||||
bool can_valid
|
||||
int can_invalid_cnt
|
||||
|
||||
def __init__(self, dbc_name, signals, checks=None, bus=0):
|
||||
def __init__(self, dbc_name, signals, checks=None, bus=0, enforce_checks=True):
|
||||
if checks is None:
|
||||
checks = []
|
||||
self.can_valid = True
|
||||
self.dbc_name = dbc_name
|
||||
self.dbc = dbc_lookup(dbc_name)
|
||||
if not self.dbc:
|
||||
raise RuntimeError("Can't lookup" + dbc_name)
|
||||
raise RuntimeError(f"Can't find DBC: {dbc_name}")
|
||||
self.vl = {}
|
||||
self.ts = {}
|
||||
|
||||
@@ -74,6 +74,14 @@ cdef class CANParser:
|
||||
c = (self.msg_name_to_address[name], c[1])
|
||||
checks[i] = c
|
||||
|
||||
if enforce_checks:
|
||||
checked_addrs = {c[0] for c in checks}
|
||||
signal_addrs = {s[1] for s in signals}
|
||||
unchecked = signal_addrs - checked_addrs
|
||||
if len(unchecked):
|
||||
err_msg = ', '.join(f"{self.address_to_msg_name[addr].decode()} ({hex(addr)})" for addr in unchecked)
|
||||
raise RuntimeError(f"Unchecked addrs: {err_msg}")
|
||||
|
||||
cdef vector[SignalParseOptions] signal_options_v
|
||||
cdef SignalParseOptions spo
|
||||
for sig_name, sig_address, sig_default in signals:
|
||||
@@ -108,7 +116,6 @@ cdef class CANParser:
|
||||
self.can_invalid_cnt = 0
|
||||
self.can_valid = self.can_invalid_cnt < CAN_INVALID_CNT
|
||||
|
||||
|
||||
for cv in can_values:
|
||||
# Cast char * directly to unicode
|
||||
name = <unicode>self.address_to_msg_name[cv.address].c_str()
|
||||
@@ -149,8 +156,8 @@ cdef class CANDefine():
|
||||
self.dbc_name = dbc_name
|
||||
self.dbc = dbc_lookup(dbc_name)
|
||||
if not self.dbc:
|
||||
raise RuntimeError("Can't lookup" + dbc_name)
|
||||
|
||||
raise RuntimeError(f"Can't find DBC: '{dbc_name}'")
|
||||
|
||||
num_vals = self.dbc[0].num_vals
|
||||
|
||||
address_to_msg_name = {}
|
||||
|
||||
+10
-3
@@ -380,7 +380,7 @@ 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_ "honda_accord_lx15t_2018_can.dbc starts here";
|
||||
CM_ "honda_accord_2018_can.dbc starts here";
|
||||
|
||||
|
||||
BO_ 304 GAS_PEDAL_2: 8 PCM
|
||||
@@ -389,8 +389,14 @@ 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
|
||||
|
||||
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_ 401 GEARBOX_15T: 8 PCM
|
||||
SG_ GEAR_SHIFTER : 5|6@0+ (1,0) [0|63] "" EON
|
||||
SG_ BOH : 45|6@0+ (1,0) [0|63] "" XXX
|
||||
SG_ GEAR2 : 31|8@0+ (1,0) [0|1] "" XXX
|
||||
@@ -430,6 +436,7 @@ BO_ 1302 ODOMETER: 8 XXX
|
||||
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_ 401 GEAR_SHIFTER 32 "L" 16 "S" 8 "D" 4 "N" 2 "R" 1 "P" ;
|
||||
VAL_ 401 GEAR 7 "L" 10 "S" 4 "D" 3 "N" 2 "R" 1 "P" ;
|
||||
VAL_ 545 ECON_ON_2 0 "off" 3 "on" ;
|
||||
@@ -1,438 +0,0 @@
|
||||
CM_ "AUTOGENERATED FILE, DO NOT EDIT";
|
||||
|
||||
|
||||
CM_ "Imported file _bosch_2018.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_ STEER_DOWN_TO_ZERO : 38|1@0+ (1,0) [0|1] "" 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_ 330 STEERING_SENSORS: 8 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_ STEER_SENSOR_STATUS_1 : 34|1@0+ (1,0) [0|1] "" EON
|
||||
SG_ STEER_SENSOR_STATUS_2 : 33|1@0+ (1,0) [0|1] "" EON
|
||||
SG_ STEER_SENSOR_STATUS_3 : 32|1@0+ (1,0) [0|1] "" EON
|
||||
SG_ STEER_WHEEL_ANGLE : 47|16@0- (-0.1,0) [-500|500] "deg" EON
|
||||
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON
|
||||
SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON
|
||||
|
||||
BO_ 344 ENGINE_DATA: 8 PCM
|
||||
SG_ XMISSION_SPEED : 7|16@0+ (0.01,0) [0|250] "kph" EON
|
||||
SG_ ENGINE_RPM : 23|16@0+ (1,0) [0|15000] "rpm" EON
|
||||
SG_ XMISSION_SPEED2 : 39|16@0+ (0.01,0) [0|250] "kph" EON
|
||||
SG_ ODOMETER : 55|8@0+ (10,0) [0|2550] "m" XXX
|
||||
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON
|
||||
SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON
|
||||
|
||||
BO_ 380 POWERTRAIN_DATA: 8 PCM
|
||||
SG_ PEDAL_GAS : 7|8@0+ (1,0) [0|255] "" EON
|
||||
SG_ ENGINE_RPM : 23|16@0+ (1,0) [0|15000] "rpm" EON
|
||||
SG_ GAS_PRESSED : 39|1@0+ (1,0) [0|1] "" EON
|
||||
SG_ ACC_STATUS : 38|1@0+ (1,0) [0|1] "" EON
|
||||
SG_ BOH_17C : 37|5@0+ (1,0) [0|1] "" EON
|
||||
SG_ BRAKE_SWITCH : 32|1@0+ (1,0) [0|1] "" EON
|
||||
SG_ BOH2_17C : 47|10@0+ (1,0) [0|1] "" EON
|
||||
SG_ BRAKE_PRESSED : 53|1@0+ (1,0) [0|1] "" EON
|
||||
SG_ BOH3_17C : 52|5@0+ (1,0) [0|1] "" EON
|
||||
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON
|
||||
SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON
|
||||
|
||||
BO_ 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_ "honda_accord_s2t_2018_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";
|
||||
@@ -346,6 +346,7 @@ BO_ 862 HIGHBEAM_CONTROL: 8 ADAS
|
||||
SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX
|
||||
|
||||
BO_ 884 STALK_STATUS: 8 XXX
|
||||
SG_ DASHBOARD_ALERT : 39|8@0+ (1,0) [0|255] "" EON
|
||||
SG_ AUTO_HEADLIGHTS : 46|1@0+ (1,0) [0|1] "" EON
|
||||
SG_ HIGH_BEAM_HOLD : 47|1@0+ (1,0) [0|1] "" EON
|
||||
SG_ HIGH_BEAM_FLASH : 45|1@0+ (1,0) [0|1] "" EON
|
||||
@@ -389,6 +390,7 @@ 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_ 884 DASHBOARD_ALERT 0 "none" 51 "acc_problem" 55 "cmbs_problem" 75 "key_not_detected" 79 "fasten_seatbelt" 111 "lkas_problem" 131 "brake_system_problem" 132 "brake_hold_problem" 139 "tbd" 161 "door_open"
|
||||
VAL_ 891 WIPERS 4 "High" 2 "Low" 0 "Off" ;
|
||||
VAL_ 927 ACC_ALERTS 29 "esp_active_acc_canceled" 10 "b_pedal_applied" 9 "speed_too_low" 8 "speed_too_high" 7 "p_brake_applied" 6 "gear_no_d" 5 "seatbelt" 4 "too_steep_downhill" 3 "too_steep_uphill" 2 "too_close" 1 "no_vehicle_ahead" ;
|
||||
|
||||
|
||||
@@ -258,8 +258,10 @@ BO_ 1553 UI_SETTING: 8 XXX
|
||||
|
||||
BO_ 1556 STEERING_LEVERS: 8 XXX
|
||||
SG_ TURN_SIGNALS : 29|2@0+ (1,0) [0|3] "" XXX
|
||||
SG_ HAZARD_LIGHT : 27|1@0+ (1,0) [0|1] "" XXX
|
||||
|
||||
BO_ 1568 SEATS_DOORS: 8 XXX
|
||||
SG_ METER_DIMMED : 38|1@0+ (1,0) [0|1] "" 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
|
||||
@@ -268,6 +270,10 @@ BO_ 1568 SEATS_DOORS: 8 XXX
|
||||
|
||||
BO_ 1570 LIGHT_STALK: 8 SCM
|
||||
SG_ AUTO_HIGH_BEAM : 37|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ FRONT_FOG : 27|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ PARKING_LIGHT : 28|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ LOW_BEAM : 29|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ HIGH_BEAM : 30|1@0+ (1,0) [0|1] "" XXX
|
||||
|
||||
BO_ 1161 RSA1: 8 FCM
|
||||
SG_ TSGN1 : 7|8@0+ (1,0) [0|0] "" XXX
|
||||
@@ -364,7 +370,7 @@ 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 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" 81 "no right turn" 97 "stop" 105 "yield" 113 "stop" 114 "yield us" 129 "no entry" 138 "no entry tss2" 145 "do not enter";
|
||||
VAL_ 1162 SPLSGN3 15 "conditional blank" 4 "wet road" 5 "rain" 0 "none";
|
||||
|
||||
|
||||
|
||||
@@ -258,8 +258,10 @@ BO_ 1553 UI_SETTING: 8 XXX
|
||||
|
||||
BO_ 1556 STEERING_LEVERS: 8 XXX
|
||||
SG_ TURN_SIGNALS : 29|2@0+ (1,0) [0|3] "" XXX
|
||||
SG_ HAZARD_LIGHT : 27|1@0+ (1,0) [0|1] "" XXX
|
||||
|
||||
BO_ 1568 SEATS_DOORS: 8 XXX
|
||||
SG_ METER_DIMMED : 38|1@0+ (1,0) [0|1] "" 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
|
||||
@@ -268,6 +270,10 @@ BO_ 1568 SEATS_DOORS: 8 XXX
|
||||
|
||||
BO_ 1570 LIGHT_STALK: 8 SCM
|
||||
SG_ AUTO_HIGH_BEAM : 37|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ FRONT_FOG : 27|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ PARKING_LIGHT : 28|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ LOW_BEAM : 29|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ HIGH_BEAM : 30|1@0+ (1,0) [0|1] "" XXX
|
||||
|
||||
BO_ 1161 RSA1: 8 FCM
|
||||
SG_ TSGN1 : 7|8@0+ (1,0) [0|0] "" XXX
|
||||
@@ -364,7 +370,7 @@ 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 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" 81 "no right turn" 97 "stop" 105 "yield" 113 "stop" 114 "yield us" 129 "no entry" 138 "no entry tss2" 145 "do not enter";
|
||||
VAL_ 1162 SPLSGN3 15 "conditional blank" 4 "wet road" 5 "rain" 0 "none";
|
||||
|
||||
|
||||
|
||||
@@ -258,8 +258,10 @@ BO_ 1553 UI_SETTING: 8 XXX
|
||||
|
||||
BO_ 1556 STEERING_LEVERS: 8 XXX
|
||||
SG_ TURN_SIGNALS : 29|2@0+ (1,0) [0|3] "" XXX
|
||||
SG_ HAZARD_LIGHT : 27|1@0+ (1,0) [0|1] "" XXX
|
||||
|
||||
BO_ 1568 SEATS_DOORS: 8 XXX
|
||||
SG_ METER_DIMMED : 38|1@0+ (1,0) [0|1] "" 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
|
||||
@@ -268,6 +270,10 @@ BO_ 1568 SEATS_DOORS: 8 XXX
|
||||
|
||||
BO_ 1570 LIGHT_STALK: 8 SCM
|
||||
SG_ AUTO_HIGH_BEAM : 37|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ FRONT_FOG : 27|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ PARKING_LIGHT : 28|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ LOW_BEAM : 29|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ HIGH_BEAM : 30|1@0+ (1,0) [0|1] "" XXX
|
||||
|
||||
BO_ 1161 RSA1: 8 FCM
|
||||
SG_ TSGN1 : 7|8@0+ (1,0) [0|0] "" XXX
|
||||
@@ -364,7 +370,7 @@ 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 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" 81 "no right turn" 97 "stop" 105 "yield" 113 "stop" 114 "yield us" 129 "no entry" 138 "no entry tss2" 145 "do not enter";
|
||||
VAL_ 1162 SPLSGN3 15 "conditional blank" 4 "wet road" 5 "rain" 0 "none";
|
||||
|
||||
|
||||
|
||||
@@ -258,8 +258,10 @@ BO_ 1553 UI_SETTING: 8 XXX
|
||||
|
||||
BO_ 1556 STEERING_LEVERS: 8 XXX
|
||||
SG_ TURN_SIGNALS : 29|2@0+ (1,0) [0|3] "" XXX
|
||||
SG_ HAZARD_LIGHT : 27|1@0+ (1,0) [0|1] "" XXX
|
||||
|
||||
BO_ 1568 SEATS_DOORS: 8 XXX
|
||||
SG_ METER_DIMMED : 38|1@0+ (1,0) [0|1] "" 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
|
||||
@@ -268,6 +270,10 @@ BO_ 1568 SEATS_DOORS: 8 XXX
|
||||
|
||||
BO_ 1570 LIGHT_STALK: 8 SCM
|
||||
SG_ AUTO_HIGH_BEAM : 37|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ FRONT_FOG : 27|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ PARKING_LIGHT : 28|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ LOW_BEAM : 29|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ HIGH_BEAM : 30|1@0+ (1,0) [0|1] "" XXX
|
||||
|
||||
BO_ 1161 RSA1: 8 FCM
|
||||
SG_ TSGN1 : 7|8@0+ (1,0) [0|0] "" XXX
|
||||
@@ -364,7 +370,7 @@ 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 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" 81 "no right turn" 97 "stop" 105 "yield" 113 "stop" 114 "yield us" 129 "no entry" 138 "no entry tss2" 145 "do not enter";
|
||||
VAL_ 1162 SPLSGN3 15 "conditional blank" 4 "wet road" 5 "rain" 0 "none";
|
||||
|
||||
|
||||
|
||||
@@ -258,8 +258,10 @@ BO_ 1553 UI_SETTING: 8 XXX
|
||||
|
||||
BO_ 1556 STEERING_LEVERS: 8 XXX
|
||||
SG_ TURN_SIGNALS : 29|2@0+ (1,0) [0|3] "" XXX
|
||||
SG_ HAZARD_LIGHT : 27|1@0+ (1,0) [0|1] "" XXX
|
||||
|
||||
BO_ 1568 SEATS_DOORS: 8 XXX
|
||||
SG_ METER_DIMMED : 38|1@0+ (1,0) [0|1] "" 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
|
||||
@@ -268,6 +270,10 @@ BO_ 1568 SEATS_DOORS: 8 XXX
|
||||
|
||||
BO_ 1570 LIGHT_STALK: 8 SCM
|
||||
SG_ AUTO_HIGH_BEAM : 37|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ FRONT_FOG : 27|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ PARKING_LIGHT : 28|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ LOW_BEAM : 29|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ HIGH_BEAM : 30|1@0+ (1,0) [0|1] "" XXX
|
||||
|
||||
BO_ 1161 RSA1: 8 FCM
|
||||
SG_ TSGN1 : 7|8@0+ (1,0) [0|0] "" XXX
|
||||
@@ -364,7 +370,7 @@ 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 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" 81 "no right turn" 97 "stop" 105 "yield" 113 "stop" 114 "yield us" 129 "no entry" 138 "no entry tss2" 145 "do not enter";
|
||||
VAL_ 1162 SPLSGN3 15 "conditional blank" 4 "wet road" 5 "rain" 0 "none";
|
||||
|
||||
|
||||
|
||||
@@ -258,8 +258,10 @@ BO_ 1553 UI_SETTING: 8 XXX
|
||||
|
||||
BO_ 1556 STEERING_LEVERS: 8 XXX
|
||||
SG_ TURN_SIGNALS : 29|2@0+ (1,0) [0|3] "" XXX
|
||||
SG_ HAZARD_LIGHT : 27|1@0+ (1,0) [0|1] "" XXX
|
||||
|
||||
BO_ 1568 SEATS_DOORS: 8 XXX
|
||||
SG_ METER_DIMMED : 38|1@0+ (1,0) [0|1] "" 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
|
||||
@@ -268,6 +270,10 @@ BO_ 1568 SEATS_DOORS: 8 XXX
|
||||
|
||||
BO_ 1570 LIGHT_STALK: 8 SCM
|
||||
SG_ AUTO_HIGH_BEAM : 37|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ FRONT_FOG : 27|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ PARKING_LIGHT : 28|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ LOW_BEAM : 29|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ HIGH_BEAM : 30|1@0+ (1,0) [0|1] "" XXX
|
||||
|
||||
BO_ 1161 RSA1: 8 FCM
|
||||
SG_ TSGN1 : 7|8@0+ (1,0) [0|0] "" XXX
|
||||
@@ -364,7 +370,7 @@ 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 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" 81 "no right turn" 97 "stop" 105 "yield" 113 "stop" 114 "yield us" 129 "no entry" 138 "no entry tss2" 145 "do not enter";
|
||||
VAL_ 1162 SPLSGN3 15 "conditional blank" 4 "wet road" 5 "rain" 0 "none";
|
||||
|
||||
|
||||
|
||||
@@ -168,17 +168,16 @@ BO_ 581 CAM_IDK3: 8 XXX
|
||||
SG_ S9 : 56|8@1+ (1,0) [0|255] "" XXX
|
||||
|
||||
BO_ 863 CAM_TRAFFIC_SIGNS: 8 XXX
|
||||
SG_ STOP_SIGN : 31|4@0+ (1,0) [0|1] "" XXX
|
||||
SG_ NEW_SIGNAL_3 : 55|1@0+ (1,0) [0|127] "" XXX
|
||||
SG_ FORWARD_COLLISION : 40|8@1+ (1,0) [0|7] "" XXX
|
||||
SG_ SPEED_SIGN : 4|7@0+ (1,0) [0|15] "" XXX
|
||||
SG_ NEW_SIGNAL_2 : 52|5@0+ (1,0) [0|31] "" XXX
|
||||
SG_ NEW_SIGNAL_4 : 33|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ NEW_SIGNAL_1 : 13|2@0+ (1,0) [0|3] "" XXX
|
||||
SG_ SPEED_SIGN_CAM : 32|1@0+ (1,0) [0|32767] "" XXX
|
||||
SG_ SPEED_SIGN_ON : 12|1@0+ (1,0) [0|3] "" XXX
|
||||
SG_ STOP_SIGN : 31|4@0+ (1,0) [0|1] "" XXX
|
||||
SG_ NEW_SIGNAL_4 : 33|1@0+ (1,0) [0|1] "" XXX
|
||||
|
||||
BO_ 1157 CAM_SETTINGS: 8 XXX
|
||||
SG_ NEW_SIGNAL_2 : 14|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ SBS_WARNING_DISTANCE : 25|2@0+ (1,0) [0|127] "" XXX
|
||||
SG_ SBS_SCBC : 28|2@0+ (1,0) [0|7] "" XXX
|
||||
SG_ LKAS_ASSIT_TIMING : 13|1@0+ (1,0) [0|1] "" XXX
|
||||
@@ -186,8 +185,10 @@ BO_ 1157 CAM_SETTINGS: 8 XXX
|
||||
SG_ ILKAS_NTERVENTION_ON2 : 17|1@0+ (1,0) [0|255] "" XXX
|
||||
SG_ LANEE_DEPARTURE_ALERT : 16|2@0+ (1,0) [0|1] "" XXX
|
||||
SG_ LKAS_INERVENTION_ON1 : 15|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ NEW_SIGNAL_1 : 12|1@0+ (1,0) [0|7] "" XXX
|
||||
SG_ WARNING : 11|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ BIT1 : 12|1@0+ (1,0) [0|7] "" XXX
|
||||
SG_ BIT2 : 14|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ BIT3 : 18|1@0+ (1,0) [0|1] "" XXX
|
||||
|
||||
BO_ 1160 CAM_Empty3: 8 XXX
|
||||
SG_ NEW_SIGNAL_1 : 47|24@0+ (1,0) [0|16777215] "" XXX
|
||||
@@ -759,6 +760,7 @@ CM_ SG_ 605 BRAKE_WARNING "Flashing brake warning and audible alert for potentia
|
||||
CM_ SG_ 579 STEERING_ANGLE "steering angle aligns with 0.022 factor and -45.06 offset";
|
||||
CM_ SG_ 863 SPEED_SIGN "speed limit in MPH";
|
||||
CM_ SG_ 863 SPEED_SIGN_CAM "1: The speed limit is recognized by the camera. 0: speed limit is map based or is not available";
|
||||
CM_ SG_ 863 STOP_SIGN "value 9 when stop sign is active";
|
||||
CM_ SG_ 1157 SBS_WARNING_DISTANCE "1 far, 2 mid, 3 near";
|
||||
CM_ SG_ 1157 SBS_SCBC "1 off, 2 on";
|
||||
CM_ SG_ 1157 LKAS_ASSIT_TIMING "1 at, 0 before";
|
||||
@@ -773,4 +775,4 @@ CM_ SG_ 552 GEAR "0 Shifting, 1 P, 2 R, 3 N, 4 D";
|
||||
CM_ SG_ 552 GEAR_BOX "0 P, 14 R, 1 though 6 D for speeds, 15 Shift";
|
||||
CM_ SG_ 540 HANDS_ON_STEER_WARN "0 no warning, b warning";
|
||||
CM_ SG_ 1143 REAR_CT_ALERT "Rear Cross Traffic Alert";
|
||||
VAL_ 552 GEAR 1 "P" 2 "R" 3 "N" 4 "D";
|
||||
VAL_ 552 GEAR 1 "P" 2 "R" 3 "N" 4 "D" ;
|
||||
|
||||
@@ -76,13 +76,17 @@ BO_ 212 Wheel_Speeds: 8 XXX
|
||||
BO_ 320 Throttle: 8 XXX
|
||||
SG_ Throttle_Pedal : 0|8@1+ (0.392157,0) [0|255] "" XXX
|
||||
SG_ Counter : 8|4@1+ (1,0) [0|15] "" XXX
|
||||
SG_ Signal1 : 12|2@1+ (1,0) [0|7] "" XXX
|
||||
SG_ Not_Full_Throttle : 14|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Signal2 : 15|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Engine_RPM : 16|14@1+ (1,0) [0|32767] "" XXX
|
||||
SG_ Off_Throttle : 30|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Signal3 : 31|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Throttle_Cruise : 32|8@1+ (1,0) [0|255] "" XXX
|
||||
SG_ Throttle_Combo : 40|8@1+ (1,0) [0|255] "" XXX
|
||||
SG_ Throttle_Body : 48|8@1+ (1,0) [0|255] "" XXX
|
||||
SG_ Off_Throttle_2 : 56|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Signal4 : 57|7@1+ (1,0) [0|127] "" XXX
|
||||
|
||||
BO_ 321 Engine: 8 XXX
|
||||
SG_ Engine_Torque : 0|15@1+ (1,0) [0|255] "" XXX
|
||||
@@ -124,7 +128,7 @@ BO_ 338 Stalk: 8 XXX
|
||||
BO_ 352 ES_Brake: 8 XXX
|
||||
SG_ Brake_Pressure : 0|16@1+ (1,0) [0|255] "" XXX
|
||||
SG_ Brake_Light : 20|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ ES_Error : 21|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Cruise_Fault : 21|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Brake_On : 22|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Cruise_Activated : 23|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Counter : 48|3@1+ (1,0) [0|7] "" XXX
|
||||
@@ -136,17 +140,17 @@ BO_ 353 ES_CruiseThrottle: 8 XXX
|
||||
SG_ Cruise_Activated : 16|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Signal2 : 17|3@1+ (1,0) [0|7] "" XXX
|
||||
SG_ Brake_On : 20|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ DistanceSwap : 21|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Distance_Swap : 21|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Standstill : 22|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Signal3 : 23|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ CloseDistance : 24|8@1+ (0.0196,0) [0|255] "m" XXX
|
||||
SG_ Close_Distance : 24|8@1+ (0.0196,0) [0|255] "m" XXX
|
||||
SG_ Signal4 : 32|9@1+ (1,0) [0|255] "" XXX
|
||||
SG_ Standstill_2 : 41|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ ES_Error : 42|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Cruise_Fault : 42|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Signal5 : 43|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Counter : 44|3@1+ (1,0) [0|7] "" XXX
|
||||
SG_ Signal6 : 47|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Button : 48|3@1+ (1,0) [0|7] "" XXX
|
||||
SG_ Cruise_Button : 48|3@1+ (1,0) [0|7] "" XXX
|
||||
SG_ Signal7 : 51|5@1+ (1,0) [0|31] "" XXX
|
||||
SG_ Checksum : 56|8@1+ (1,0) [0|255] "" XXX
|
||||
|
||||
@@ -213,6 +217,9 @@ BO_ 864 Engine_Temp: 8 XXX
|
||||
|
||||
BO_ 866 Fuel: 8 XXX
|
||||
|
||||
BO_ 977 Dash_State2: 8 XXX
|
||||
SG_ Units : 15|1@1+ (1,0) [0|1] "" XXX
|
||||
|
||||
BO_ 1745 Dash_State: 8 XXX
|
||||
SG_ Units : 15|1@1+ (1,0) [0|1] "" XXX
|
||||
|
||||
@@ -220,7 +227,7 @@ CM_ SG_ 320 Off_Throttle_2 "Less sensitive";
|
||||
CM_ SG_ 320 Throttle_Body "Throttle related";
|
||||
CM_ SG_ 328 Gear "15 = P, 14 = R, 0 = N, 1-6=gear";
|
||||
CM_ SG_ 328 Gear_2 "15 = P, 14 = R, 0 = N, 1-6=gear";
|
||||
CM_ SG_ 353 Button "1 = main, 2 = set shallow, 3 = set deep, 4 = resume shallow, 5 resume deep";
|
||||
CM_ SG_ 353 Cruise_Button "1 = main, 2 = set shallow, 3 = set deep, 4 = resume shallow, 5 resume deep";
|
||||
CM_ SG_ 354 RPM "20hz version of Transmission_Engine under Transmission";
|
||||
CM_ SG_ 359 Sig1Right_Depart "right depart, hill steep and seatbelt disengage";
|
||||
CM_ SG_ 359 LKAS_Inactive_2017 "1 when not steering, 0 when lkas steering";
|
||||
@@ -253,6 +260,6 @@ BO_ 355 ES_DashStatus: 8 XXX
|
||||
BO_ 881 Steering_Torque: 8 XXX
|
||||
SG_ Steering_Motor_Flat : 0|10@1+ (32,0) [0|1000] "" XXX
|
||||
SG_ Steer_Torque_Output : 16|11@1- (-32,0) [-1000|1000] "" XXX
|
||||
SG_ LKA_Lockout : 27|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Steer_Error_1 : 27|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Steer_Torque_Sensor : 29|11@1- (-1,0) [-1000|1000] "" XXX
|
||||
SG_ Steering_Angle : 40|16@1- (-0.033,0) [-600|600] "" XXX
|
||||
|
||||
@@ -48,11 +48,13 @@ BO_ 2 Steering: 8 XXX
|
||||
BO_ 64 Throttle: 8 XXX
|
||||
SG_ CHECKSUM : 0|8@1+ (1,0) [0|255] "" XXX
|
||||
SG_ Counter : 8|4@1+ (1,0) [0|15] "" XXX
|
||||
SG_ Signal1 : 12|4@1+ (1,0) [0|15] "" XXX
|
||||
SG_ Engine_RPM : 16|12@1+ (1,0) [0|4095] "" XXX
|
||||
SG_ Signal2 : 28|4@1+ (1,0) [0|15] "" XXX
|
||||
SG_ Throttle_Pedal : 32|8@1+ (1,0) [0|255] "" XXX
|
||||
SG_ Throttle_Cruise : 40|8@1+ (1,0) [0|255] "" XXX
|
||||
SG_ Throttle_Combo : 48|8@1+ (1,0) [0|255] "" XXX
|
||||
SG_ Signal1 : 56|4@1+ (1,0) [0|15] "" XXX
|
||||
SG_ Signal3 : 56|4@1+ (1,0) [0|15] "" XXX
|
||||
SG_ Off_Accel : 60|4@1+ (1,0) [0|15] "" XXX
|
||||
|
||||
BO_ 316 Brake_Status: 8 XXX
|
||||
|
||||
@@ -76,13 +76,17 @@ BO_ 212 Wheel_Speeds: 8 XXX
|
||||
BO_ 320 Throttle: 8 XXX
|
||||
SG_ Throttle_Pedal : 0|8@1+ (0.392157,0) [0|255] "" XXX
|
||||
SG_ Counter : 8|4@1+ (1,0) [0|15] "" XXX
|
||||
SG_ Signal1 : 12|2@1+ (1,0) [0|7] "" XXX
|
||||
SG_ Not_Full_Throttle : 14|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Signal2 : 15|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Engine_RPM : 16|14@1+ (1,0) [0|32767] "" XXX
|
||||
SG_ Off_Throttle : 30|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Signal3 : 31|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Throttle_Cruise : 32|8@1+ (1,0) [0|255] "" XXX
|
||||
SG_ Throttle_Combo : 40|8@1+ (1,0) [0|255] "" XXX
|
||||
SG_ Throttle_Body : 48|8@1+ (1,0) [0|255] "" XXX
|
||||
SG_ Off_Throttle_2 : 56|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Signal4 : 57|7@1+ (1,0) [0|127] "" XXX
|
||||
|
||||
BO_ 321 Engine: 8 XXX
|
||||
SG_ Engine_Torque : 0|15@1+ (1,0) [0|255] "" XXX
|
||||
@@ -124,7 +128,7 @@ BO_ 338 Stalk: 8 XXX
|
||||
BO_ 352 ES_Brake: 8 XXX
|
||||
SG_ Brake_Pressure : 0|16@1+ (1,0) [0|255] "" XXX
|
||||
SG_ Brake_Light : 20|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ ES_Error : 21|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Cruise_Fault : 21|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Brake_On : 22|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Cruise_Activated : 23|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Counter : 48|3@1+ (1,0) [0|7] "" XXX
|
||||
@@ -136,17 +140,17 @@ BO_ 353 ES_CruiseThrottle: 8 XXX
|
||||
SG_ Cruise_Activated : 16|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Signal2 : 17|3@1+ (1,0) [0|7] "" XXX
|
||||
SG_ Brake_On : 20|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ DistanceSwap : 21|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Distance_Swap : 21|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Standstill : 22|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Signal3 : 23|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ CloseDistance : 24|8@1+ (0.0196,0) [0|255] "m" XXX
|
||||
SG_ Close_Distance : 24|8@1+ (0.0196,0) [0|255] "m" XXX
|
||||
SG_ Signal4 : 32|9@1+ (1,0) [0|255] "" XXX
|
||||
SG_ Standstill_2 : 41|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ ES_Error : 42|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Cruise_Fault : 42|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Signal5 : 43|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Counter : 44|3@1+ (1,0) [0|7] "" XXX
|
||||
SG_ Signal6 : 47|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Button : 48|3@1+ (1,0) [0|7] "" XXX
|
||||
SG_ Cruise_Button : 48|3@1+ (1,0) [0|7] "" XXX
|
||||
SG_ Signal7 : 51|5@1+ (1,0) [0|31] "" XXX
|
||||
SG_ Checksum : 56|8@1+ (1,0) [0|255] "" XXX
|
||||
|
||||
@@ -213,6 +217,9 @@ BO_ 864 Engine_Temp: 8 XXX
|
||||
|
||||
BO_ 866 Fuel: 8 XXX
|
||||
|
||||
BO_ 977 Dash_State2: 8 XXX
|
||||
SG_ Units : 15|1@1+ (1,0) [0|1] "" XXX
|
||||
|
||||
BO_ 1745 Dash_State: 8 XXX
|
||||
SG_ Units : 15|1@1+ (1,0) [0|1] "" XXX
|
||||
|
||||
@@ -220,7 +227,7 @@ CM_ SG_ 320 Off_Throttle_2 "Less sensitive";
|
||||
CM_ SG_ 320 Throttle_Body "Throttle related";
|
||||
CM_ SG_ 328 Gear "15 = P, 14 = R, 0 = N, 1-6=gear";
|
||||
CM_ SG_ 328 Gear_2 "15 = P, 14 = R, 0 = N, 1-6=gear";
|
||||
CM_ SG_ 353 Button "1 = main, 2 = set shallow, 3 = set deep, 4 = resume shallow, 5 resume deep";
|
||||
CM_ SG_ 353 Cruise_Button "1 = main, 2 = set shallow, 3 = set deep, 4 = resume shallow, 5 resume deep";
|
||||
CM_ SG_ 354 RPM "20hz version of Transmission_Engine under Transmission";
|
||||
CM_ SG_ 359 Sig1Right_Depart "right depart, hill steep and seatbelt disengage";
|
||||
CM_ SG_ 359 LKAS_Inactive_2017 "1 when not steering, 0 when lkas steering";
|
||||
@@ -252,22 +259,22 @@ BO_ 358 ES_DashStatus: 8 XXX
|
||||
SG_ Signal1 : 18|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ WHEELS_MOVING_2015 : 19|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Driver_Input : 20|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Distance_Bars : 21|3@1+ (1,0) [0|7] "" XXX
|
||||
SG_ Cruise_Distance : 21|3@1+ (1,0) [0|7] "" XXX
|
||||
SG_ Cruise_Set_Speed : 24|8@1+ (1,0) [0|255] "" XXX
|
||||
SG_ ES_Error : 32|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Cruise_Fault : 32|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Cruise_On_2 : 34|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Counter : 37|3@1+ (1,0) [0|7] "" XXX
|
||||
SG_ Steep_Hill_Disengage : 44|1@1+ (1,0) [0|3] "" XXX
|
||||
SG_ Lead_Car : 46|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Obstacle_Distance : 48|4@1+ (5,0) [0|15] "m" XXX
|
||||
SG_ Car_Follow : 46|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Far_Distance : 48|4@1+ (5,0) [0|15] "m" XXX
|
||||
|
||||
BO_ 881 Steering_Torque: 8 XXX
|
||||
SG_ Steering_Motor_Flat : 0|10@1+ (32,0) [0|1000] "" XXX
|
||||
SG_ Steer_Torque_Output : 16|11@1- (-32,0) [-1000|1000] "" XXX
|
||||
SG_ LKA_Lockout : 27|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Steer_Error_1 : 27|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Steer_Torque_Sensor : 29|11@1- (1,0) [-1000|1000] "" XXX
|
||||
SG_ Steering_Angle : 40|16@1- (-0.033,0) [-600|600] "" XXX
|
||||
|
||||
CM_ SG_ 358 Disengage_Alert "seatbelt and steep hill disengage";
|
||||
CM_ SG_ 358 ES_Error "No engagement until restart";
|
||||
CM_ SG_ 358 Lead_Car "front car detected";
|
||||
CM_ SG_ 358 Cruise_Fault "No engagement until restart";
|
||||
CM_ SG_ 358 Car_Follow "lead car detected";
|
||||
|
||||
@@ -76,13 +76,17 @@ BO_ 212 Wheel_Speeds: 8 XXX
|
||||
BO_ 320 Throttle: 8 XXX
|
||||
SG_ Throttle_Pedal : 0|8@1+ (0.392157,0) [0|255] "" XXX
|
||||
SG_ Counter : 8|4@1+ (1,0) [0|15] "" XXX
|
||||
SG_ Signal1 : 12|2@1+ (1,0) [0|7] "" XXX
|
||||
SG_ Not_Full_Throttle : 14|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Signal2 : 15|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Engine_RPM : 16|14@1+ (1,0) [0|32767] "" XXX
|
||||
SG_ Off_Throttle : 30|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Signal3 : 31|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Throttle_Cruise : 32|8@1+ (1,0) [0|255] "" XXX
|
||||
SG_ Throttle_Combo : 40|8@1+ (1,0) [0|255] "" XXX
|
||||
SG_ Throttle_Body : 48|8@1+ (1,0) [0|255] "" XXX
|
||||
SG_ Off_Throttle_2 : 56|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Signal4 : 57|7@1+ (1,0) [0|127] "" XXX
|
||||
|
||||
BO_ 321 Engine: 8 XXX
|
||||
SG_ Engine_Torque : 0|15@1+ (1,0) [0|255] "" XXX
|
||||
@@ -124,7 +128,7 @@ BO_ 338 Stalk: 8 XXX
|
||||
BO_ 352 ES_Brake: 8 XXX
|
||||
SG_ Brake_Pressure : 0|16@1+ (1,0) [0|255] "" XXX
|
||||
SG_ Brake_Light : 20|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ ES_Error : 21|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Cruise_Fault : 21|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Brake_On : 22|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Cruise_Activated : 23|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Counter : 48|3@1+ (1,0) [0|7] "" XXX
|
||||
@@ -136,17 +140,17 @@ BO_ 353 ES_CruiseThrottle: 8 XXX
|
||||
SG_ Cruise_Activated : 16|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Signal2 : 17|3@1+ (1,0) [0|7] "" XXX
|
||||
SG_ Brake_On : 20|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ DistanceSwap : 21|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Distance_Swap : 21|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Standstill : 22|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Signal3 : 23|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ CloseDistance : 24|8@1+ (0.0196,0) [0|255] "m" XXX
|
||||
SG_ Close_Distance : 24|8@1+ (0.0196,0) [0|255] "m" XXX
|
||||
SG_ Signal4 : 32|9@1+ (1,0) [0|255] "" XXX
|
||||
SG_ Standstill_2 : 41|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ ES_Error : 42|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Cruise_Fault : 42|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Signal5 : 43|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Counter : 44|3@1+ (1,0) [0|7] "" XXX
|
||||
SG_ Signal6 : 47|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Button : 48|3@1+ (1,0) [0|7] "" XXX
|
||||
SG_ Cruise_Button : 48|3@1+ (1,0) [0|7] "" XXX
|
||||
SG_ Signal7 : 51|5@1+ (1,0) [0|31] "" XXX
|
||||
SG_ Checksum : 56|8@1+ (1,0) [0|255] "" XXX
|
||||
|
||||
@@ -213,6 +217,9 @@ BO_ 864 Engine_Temp: 8 XXX
|
||||
|
||||
BO_ 866 Fuel: 8 XXX
|
||||
|
||||
BO_ 977 Dash_State2: 8 XXX
|
||||
SG_ Units : 15|1@1+ (1,0) [0|1] "" XXX
|
||||
|
||||
BO_ 1745 Dash_State: 8 XXX
|
||||
SG_ Units : 15|1@1+ (1,0) [0|1] "" XXX
|
||||
|
||||
@@ -220,7 +227,7 @@ CM_ SG_ 320 Off_Throttle_2 "Less sensitive";
|
||||
CM_ SG_ 320 Throttle_Body "Throttle related";
|
||||
CM_ SG_ 328 Gear "15 = P, 14 = R, 0 = N, 1-6=gear";
|
||||
CM_ SG_ 328 Gear_2 "15 = P, 14 = R, 0 = N, 1-6=gear";
|
||||
CM_ SG_ 353 Button "1 = main, 2 = set shallow, 3 = set deep, 4 = resume shallow, 5 resume deep";
|
||||
CM_ SG_ 353 Cruise_Button "1 = main, 2 = set shallow, 3 = set deep, 4 = resume shallow, 5 resume deep";
|
||||
CM_ SG_ 354 RPM "20hz version of Transmission_Engine under Transmission";
|
||||
CM_ SG_ 359 Sig1Right_Depart "right depart, hill steep and seatbelt disengage";
|
||||
CM_ SG_ 359 LKAS_Inactive_2017 "1 when not steering, 0 when lkas steering";
|
||||
@@ -252,22 +259,22 @@ BO_ 358 ES_DashStatus: 8 XXX
|
||||
SG_ Signal1 : 18|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ WHEELS_MOVING_2015 : 19|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Driver_Input : 20|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Distance_Bars : 21|3@1+ (1,0) [0|7] "" XXX
|
||||
SG_ Cruise_Distance : 21|3@1+ (1,0) [0|7] "" XXX
|
||||
SG_ Cruise_Set_Speed : 24|8@1+ (1,0) [0|255] "" XXX
|
||||
SG_ ES_Error : 32|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Cruise_Fault : 32|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Cruise_On_2 : 34|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Counter : 37|3@1+ (1,0) [0|7] "" XXX
|
||||
SG_ Steep_Hill_Disengage : 44|1@1+ (1,0) [0|3] "" XXX
|
||||
SG_ Lead_Car : 46|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Obstacle_Distance : 48|4@1+ (5,0) [0|15] "m" XXX
|
||||
SG_ Car_Follow : 46|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Far_Distance : 48|4@1+ (5,0) [0|15] "m" XXX
|
||||
|
||||
BO_ 881 Steering_Torque: 8 XXX
|
||||
SG_ Steering_Motor_Flat : 0|10@1+ (32,0) [0|1000] "" XXX
|
||||
SG_ Steer_Torque_Output : 16|11@1- (-32,0) [-1000|1000] "" XXX
|
||||
SG_ LKA_Lockout : 27|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Steer_Error_1 : 27|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Steer_Torque_Sensor : 29|11@1- (-1,0) [-1000|1000] "" XXX
|
||||
SG_ Steering_Angle : 40|16@1- (-0.033,0) [-600|600] "" XXX
|
||||
|
||||
CM_ SG_ 358 Disengage_Alert "seatbelt and steep hill disengage";
|
||||
CM_ SG_ 358 ES_Error "No engagement until restart";
|
||||
CM_ SG_ 358 Lead_Car "front car detected";
|
||||
CM_ SG_ 358 Cruise_Fault "No engagement until restart";
|
||||
CM_ SG_ 358 Car_Follow "lead car detected";
|
||||
|
||||
@@ -258,8 +258,10 @@ BO_ 1553 UI_SETTING: 8 XXX
|
||||
|
||||
BO_ 1556 STEERING_LEVERS: 8 XXX
|
||||
SG_ TURN_SIGNALS : 29|2@0+ (1,0) [0|3] "" XXX
|
||||
SG_ HAZARD_LIGHT : 27|1@0+ (1,0) [0|1] "" XXX
|
||||
|
||||
BO_ 1568 SEATS_DOORS: 8 XXX
|
||||
SG_ METER_DIMMED : 38|1@0+ (1,0) [0|1] "" 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
|
||||
@@ -268,6 +270,10 @@ BO_ 1568 SEATS_DOORS: 8 XXX
|
||||
|
||||
BO_ 1570 LIGHT_STALK: 8 SCM
|
||||
SG_ AUTO_HIGH_BEAM : 37|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ FRONT_FOG : 27|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ PARKING_LIGHT : 28|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ LOW_BEAM : 29|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ HIGH_BEAM : 30|1@0+ (1,0) [0|1] "" XXX
|
||||
|
||||
BO_ 1161 RSA1: 8 FCM
|
||||
SG_ TSGN1 : 7|8@0+ (1,0) [0|0] "" XXX
|
||||
@@ -364,7 +370,7 @@ 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 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" 81 "no right turn" 97 "stop" 105 "yield" 113 "stop" 114 "yield us" 129 "no entry" 138 "no entry tss2" 145 "do not enter";
|
||||
VAL_ 1162 SPLSGN3 15 "conditional blank" 4 "wet road" 5 "rain" 0 "none";
|
||||
|
||||
|
||||
|
||||
@@ -258,8 +258,10 @@ BO_ 1553 UI_SETTING: 8 XXX
|
||||
|
||||
BO_ 1556 STEERING_LEVERS: 8 XXX
|
||||
SG_ TURN_SIGNALS : 29|2@0+ (1,0) [0|3] "" XXX
|
||||
SG_ HAZARD_LIGHT : 27|1@0+ (1,0) [0|1] "" XXX
|
||||
|
||||
BO_ 1568 SEATS_DOORS: 8 XXX
|
||||
SG_ METER_DIMMED : 38|1@0+ (1,0) [0|1] "" 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
|
||||
@@ -268,6 +270,10 @@ BO_ 1568 SEATS_DOORS: 8 XXX
|
||||
|
||||
BO_ 1570 LIGHT_STALK: 8 SCM
|
||||
SG_ AUTO_HIGH_BEAM : 37|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ FRONT_FOG : 27|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ PARKING_LIGHT : 28|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ LOW_BEAM : 29|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ HIGH_BEAM : 30|1@0+ (1,0) [0|1] "" XXX
|
||||
|
||||
BO_ 1161 RSA1: 8 FCM
|
||||
SG_ TSGN1 : 7|8@0+ (1,0) [0|0] "" XXX
|
||||
@@ -364,7 +370,7 @@ 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 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" 81 "no right turn" 97 "stop" 105 "yield" 113 "stop" 114 "yield us" 129 "no entry" 138 "no entry tss2" 145 "do not enter";
|
||||
VAL_ 1162 SPLSGN3 15 "conditional blank" 4 "wet road" 5 "rain" 0 "none";
|
||||
|
||||
|
||||
|
||||
@@ -258,8 +258,10 @@ BO_ 1553 UI_SETTING: 8 XXX
|
||||
|
||||
BO_ 1556 STEERING_LEVERS: 8 XXX
|
||||
SG_ TURN_SIGNALS : 29|2@0+ (1,0) [0|3] "" XXX
|
||||
SG_ HAZARD_LIGHT : 27|1@0+ (1,0) [0|1] "" XXX
|
||||
|
||||
BO_ 1568 SEATS_DOORS: 8 XXX
|
||||
SG_ METER_DIMMED : 38|1@0+ (1,0) [0|1] "" 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
|
||||
@@ -268,6 +270,10 @@ BO_ 1568 SEATS_DOORS: 8 XXX
|
||||
|
||||
BO_ 1570 LIGHT_STALK: 8 SCM
|
||||
SG_ AUTO_HIGH_BEAM : 37|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ FRONT_FOG : 27|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ PARKING_LIGHT : 28|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ LOW_BEAM : 29|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ HIGH_BEAM : 30|1@0+ (1,0) [0|1] "" XXX
|
||||
|
||||
BO_ 1161 RSA1: 8 FCM
|
||||
SG_ TSGN1 : 7|8@0+ (1,0) [0|0] "" XXX
|
||||
@@ -364,7 +370,7 @@ 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 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" 81 "no right turn" 97 "stop" 105 "yield" 113 "stop" 114 "yield us" 129 "no entry" 138 "no entry tss2" 145 "do not enter";
|
||||
VAL_ 1162 SPLSGN3 15 "conditional blank" 4 "wet road" 5 "rain" 0 "none";
|
||||
|
||||
|
||||
|
||||
@@ -258,8 +258,10 @@ BO_ 1553 UI_SETTING: 8 XXX
|
||||
|
||||
BO_ 1556 STEERING_LEVERS: 8 XXX
|
||||
SG_ TURN_SIGNALS : 29|2@0+ (1,0) [0|3] "" XXX
|
||||
SG_ HAZARD_LIGHT : 27|1@0+ (1,0) [0|1] "" XXX
|
||||
|
||||
BO_ 1568 SEATS_DOORS: 8 XXX
|
||||
SG_ METER_DIMMED : 38|1@0+ (1,0) [0|1] "" 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
|
||||
@@ -268,6 +270,10 @@ BO_ 1568 SEATS_DOORS: 8 XXX
|
||||
|
||||
BO_ 1570 LIGHT_STALK: 8 SCM
|
||||
SG_ AUTO_HIGH_BEAM : 37|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ FRONT_FOG : 27|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ PARKING_LIGHT : 28|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ LOW_BEAM : 29|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ HIGH_BEAM : 30|1@0+ (1,0) [0|1] "" XXX
|
||||
|
||||
BO_ 1161 RSA1: 8 FCM
|
||||
SG_ TSGN1 : 7|8@0+ (1,0) [0|0] "" XXX
|
||||
@@ -364,7 +370,7 @@ 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 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" 81 "no right turn" 97 "stop" 105 "yield" 113 "stop" 114 "yield us" 129 "no entry" 138 "no entry tss2" 145 "do not enter";
|
||||
VAL_ 1162 SPLSGN3 15 "conditional blank" 4 "wet road" 5 "rain" 0 "none";
|
||||
|
||||
|
||||
|
||||
@@ -258,8 +258,10 @@ BO_ 1553 UI_SETTING: 8 XXX
|
||||
|
||||
BO_ 1556 STEERING_LEVERS: 8 XXX
|
||||
SG_ TURN_SIGNALS : 29|2@0+ (1,0) [0|3] "" XXX
|
||||
SG_ HAZARD_LIGHT : 27|1@0+ (1,0) [0|1] "" XXX
|
||||
|
||||
BO_ 1568 SEATS_DOORS: 8 XXX
|
||||
SG_ METER_DIMMED : 38|1@0+ (1,0) [0|1] "" 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
|
||||
@@ -268,6 +270,10 @@ BO_ 1568 SEATS_DOORS: 8 XXX
|
||||
|
||||
BO_ 1570 LIGHT_STALK: 8 SCM
|
||||
SG_ AUTO_HIGH_BEAM : 37|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ FRONT_FOG : 27|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ PARKING_LIGHT : 28|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ LOW_BEAM : 29|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ HIGH_BEAM : 30|1@0+ (1,0) [0|1] "" XXX
|
||||
|
||||
BO_ 1161 RSA1: 8 FCM
|
||||
SG_ TSGN1 : 7|8@0+ (1,0) [0|0] "" XXX
|
||||
@@ -364,7 +370,7 @@ 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 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" 81 "no right turn" 97 "stop" 105 "yield" 113 "stop" 114 "yield us" 129 "no entry" 138 "no entry tss2" 145 "do not enter";
|
||||
VAL_ 1162 SPLSGN3 15 "conditional blank" 4 "wet road" 5 "rain" 0 "none";
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,20 @@
|
||||
CM_ "AUTOGENERATED FILE, DO NOT EDIT";
|
||||
|
||||
|
||||
CM_ "Imported file _toyota_nodsu_bsm.dbc starts here";
|
||||
CM_ "Imported file _toyota_nodsu_common.dbc starts here";
|
||||
BO_ 401 STEERING_LTA: 8 XXX
|
||||
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
|
||||
SG_ SETME_X3 : 29|2@0+ (1,0) [0|3] "" XXX
|
||||
SG_ PERCENTAGE : 39|8@0+ (1,0) [0|255] "" XXX
|
||||
SG_ SETME_X64 : 47|8@0+ (1,0) [0|255] "" XXX
|
||||
SG_ ANGLE : 55|8@0- (0.5,0) [0|255] "" XXX
|
||||
SG_ STEER_ANGLE_CMD : 15|16@0- (0.0573,0) [-540|540] "" XXX
|
||||
SG_ STEER_REQUEST : 25|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ BIT : 30|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ COUNTER : 6|6@0+ (1,0) [0|255] "" XXX
|
||||
SG_ STEER_REQUEST_2 : 0|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ SETME_X1 : 7|1@0+ (1,0) [0|1] "" XXX
|
||||
|
||||
BO_ 1014 BSM: 8 XXX
|
||||
SG_ L_ADJACENT : 0|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ L_APPROACHING : 8|1@0+ (1,0) [0|1] "" XXX
|
||||
@@ -275,8 +288,10 @@ BO_ 1553 UI_SETTING: 8 XXX
|
||||
|
||||
BO_ 1556 STEERING_LEVERS: 8 XXX
|
||||
SG_ TURN_SIGNALS : 29|2@0+ (1,0) [0|3] "" XXX
|
||||
SG_ HAZARD_LIGHT : 27|1@0+ (1,0) [0|1] "" XXX
|
||||
|
||||
BO_ 1568 SEATS_DOORS: 8 XXX
|
||||
SG_ METER_DIMMED : 38|1@0+ (1,0) [0|1] "" 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
|
||||
@@ -285,6 +300,10 @@ BO_ 1568 SEATS_DOORS: 8 XXX
|
||||
|
||||
BO_ 1570 LIGHT_STALK: 8 SCM
|
||||
SG_ AUTO_HIGH_BEAM : 37|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ FRONT_FOG : 27|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ PARKING_LIGHT : 28|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ LOW_BEAM : 29|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ HIGH_BEAM : 30|1@0+ (1,0) [0|1] "" XXX
|
||||
|
||||
BO_ 1161 RSA1: 8 FCM
|
||||
SG_ TSGN1 : 7|8@0+ (1,0) [0|0] "" XXX
|
||||
@@ -381,7 +400,7 @@ 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 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" 81 "no right turn" 97 "stop" 105 "yield" 113 "stop" 114 "yield us" 129 "no entry" 138 "no entry tss2" 145 "do not enter";
|
||||
VAL_ 1162 SPLSGN3 15 "conditional blank" 4 "wet road" 5 "rain" 0 "none";
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,20 @@
|
||||
CM_ "AUTOGENERATED FILE, DO NOT EDIT";
|
||||
|
||||
|
||||
CM_ "Imported file _toyota_nodsu_bsm.dbc starts here";
|
||||
CM_ "Imported file _toyota_nodsu_common.dbc starts here";
|
||||
BO_ 401 STEERING_LTA: 8 XXX
|
||||
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
|
||||
SG_ SETME_X3 : 29|2@0+ (1,0) [0|3] "" XXX
|
||||
SG_ PERCENTAGE : 39|8@0+ (1,0) [0|255] "" XXX
|
||||
SG_ SETME_X64 : 47|8@0+ (1,0) [0|255] "" XXX
|
||||
SG_ ANGLE : 55|8@0- (0.5,0) [0|255] "" XXX
|
||||
SG_ STEER_ANGLE_CMD : 15|16@0- (0.0573,0) [-540|540] "" XXX
|
||||
SG_ STEER_REQUEST : 25|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ BIT : 30|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ COUNTER : 6|6@0+ (1,0) [0|255] "" XXX
|
||||
SG_ STEER_REQUEST_2 : 0|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ SETME_X1 : 7|1@0+ (1,0) [0|1] "" XXX
|
||||
|
||||
BO_ 1014 BSM: 8 XXX
|
||||
SG_ L_ADJACENT : 0|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ L_APPROACHING : 8|1@0+ (1,0) [0|1] "" XXX
|
||||
@@ -275,8 +288,10 @@ BO_ 1553 UI_SETTING: 8 XXX
|
||||
|
||||
BO_ 1556 STEERING_LEVERS: 8 XXX
|
||||
SG_ TURN_SIGNALS : 29|2@0+ (1,0) [0|3] "" XXX
|
||||
SG_ HAZARD_LIGHT : 27|1@0+ (1,0) [0|1] "" XXX
|
||||
|
||||
BO_ 1568 SEATS_DOORS: 8 XXX
|
||||
SG_ METER_DIMMED : 38|1@0+ (1,0) [0|1] "" 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
|
||||
@@ -285,6 +300,10 @@ BO_ 1568 SEATS_DOORS: 8 XXX
|
||||
|
||||
BO_ 1570 LIGHT_STALK: 8 SCM
|
||||
SG_ AUTO_HIGH_BEAM : 37|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ FRONT_FOG : 27|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ PARKING_LIGHT : 28|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ LOW_BEAM : 29|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ HIGH_BEAM : 30|1@0+ (1,0) [0|1] "" XXX
|
||||
|
||||
BO_ 1161 RSA1: 8 FCM
|
||||
SG_ TSGN1 : 7|8@0+ (1,0) [0|0] "" XXX
|
||||
@@ -381,7 +400,7 @@ 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 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" 81 "no right turn" 97 "stop" 105 "yield" 113 "stop" 114 "yield us" 129 "no entry" 138 "no entry tss2" 145 "do not enter";
|
||||
VAL_ 1162 SPLSGN3 15 "conditional blank" 4 "wet road" 5 "rain" 0 "none";
|
||||
|
||||
|
||||
@@ -392,19 +411,6 @@ CM_ "toyota_nodsu_pt.dbc starts here";
|
||||
|
||||
|
||||
|
||||
BO_ 401 STEERING_LTA: 8 XXX
|
||||
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
|
||||
SG_ SETME_X3 : 29|2@0+ (1,0) [0|3] "" XXX
|
||||
SG_ PERCENTAGE : 39|8@0+ (1,0) [0|255] "" XXX
|
||||
SG_ SETME_X64 : 47|8@0+ (1,0) [0|255] "" XXX
|
||||
SG_ ANGLE : 55|8@0- (0.5,0) [0|255] "" XXX
|
||||
SG_ STEER_ANGLE_CMD : 15|16@0- (0.0573,0) [-540|540] "" XXX
|
||||
SG_ STEER_REQUEST : 25|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ BIT : 30|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ COUNTER : 6|6@0+ (1,0) [0|255] "" XXX
|
||||
SG_ STEER_REQUEST_2 : 0|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ SETME_X1 : 7|1@0+ (1,0) [0|1] "" XXX
|
||||
|
||||
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
|
||||
|
||||
@@ -258,8 +258,10 @@ BO_ 1553 UI_SETTING: 8 XXX
|
||||
|
||||
BO_ 1556 STEERING_LEVERS: 8 XXX
|
||||
SG_ TURN_SIGNALS : 29|2@0+ (1,0) [0|3] "" XXX
|
||||
SG_ HAZARD_LIGHT : 27|1@0+ (1,0) [0|1] "" XXX
|
||||
|
||||
BO_ 1568 SEATS_DOORS: 8 XXX
|
||||
SG_ METER_DIMMED : 38|1@0+ (1,0) [0|1] "" 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
|
||||
@@ -268,6 +270,10 @@ BO_ 1568 SEATS_DOORS: 8 XXX
|
||||
|
||||
BO_ 1570 LIGHT_STALK: 8 SCM
|
||||
SG_ AUTO_HIGH_BEAM : 37|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ FRONT_FOG : 27|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ PARKING_LIGHT : 28|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ LOW_BEAM : 29|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ HIGH_BEAM : 30|1@0+ (1,0) [0|1] "" XXX
|
||||
|
||||
BO_ 1161 RSA1: 8 FCM
|
||||
SG_ TSGN1 : 7|8@0+ (1,0) [0|0] "" XXX
|
||||
@@ -364,7 +370,7 @@ 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 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" 81 "no right turn" 97 "stop" 105 "yield" 113 "stop" 114 "yield us" 129 "no entry" 138 "no entry tss2" 145 "do not enter";
|
||||
VAL_ 1162 SPLSGN3 15 "conditional blank" 4 "wet road" 5 "rain" 0 "none";
|
||||
|
||||
|
||||
|
||||
@@ -258,8 +258,10 @@ BO_ 1553 UI_SETTING: 8 XXX
|
||||
|
||||
BO_ 1556 STEERING_LEVERS: 8 XXX
|
||||
SG_ TURN_SIGNALS : 29|2@0+ (1,0) [0|3] "" XXX
|
||||
SG_ HAZARD_LIGHT : 27|1@0+ (1,0) [0|1] "" XXX
|
||||
|
||||
BO_ 1568 SEATS_DOORS: 8 XXX
|
||||
SG_ METER_DIMMED : 38|1@0+ (1,0) [0|1] "" 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
|
||||
@@ -268,6 +270,10 @@ BO_ 1568 SEATS_DOORS: 8 XXX
|
||||
|
||||
BO_ 1570 LIGHT_STALK: 8 SCM
|
||||
SG_ AUTO_HIGH_BEAM : 37|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ FRONT_FOG : 27|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ PARKING_LIGHT : 28|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ LOW_BEAM : 29|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ HIGH_BEAM : 30|1@0+ (1,0) [0|1] "" XXX
|
||||
|
||||
BO_ 1161 RSA1: 8 FCM
|
||||
SG_ TSGN1 : 7|8@0+ (1,0) [0|0] "" XXX
|
||||
@@ -364,7 +370,7 @@ 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 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" 81 "no right turn" 97 "stop" 105 "yield" 113 "stop" 114 "yield us" 129 "no entry" 138 "no entry tss2" 145 "do not enter";
|
||||
VAL_ 1162 SPLSGN3 15 "conditional blank" 4 "wet road" 5 "rain" 0 "none";
|
||||
|
||||
|
||||
|
||||
@@ -258,8 +258,10 @@ BO_ 1553 UI_SETTING: 8 XXX
|
||||
|
||||
BO_ 1556 STEERING_LEVERS: 8 XXX
|
||||
SG_ TURN_SIGNALS : 29|2@0+ (1,0) [0|3] "" XXX
|
||||
SG_ HAZARD_LIGHT : 27|1@0+ (1,0) [0|1] "" XXX
|
||||
|
||||
BO_ 1568 SEATS_DOORS: 8 XXX
|
||||
SG_ METER_DIMMED : 38|1@0+ (1,0) [0|1] "" 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
|
||||
@@ -268,6 +270,10 @@ BO_ 1568 SEATS_DOORS: 8 XXX
|
||||
|
||||
BO_ 1570 LIGHT_STALK: 8 SCM
|
||||
SG_ AUTO_HIGH_BEAM : 37|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ FRONT_FOG : 27|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ PARKING_LIGHT : 28|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ LOW_BEAM : 29|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ HIGH_BEAM : 30|1@0+ (1,0) [0|1] "" XXX
|
||||
|
||||
BO_ 1161 RSA1: 8 FCM
|
||||
SG_ TSGN1 : 7|8@0+ (1,0) [0|0] "" XXX
|
||||
@@ -364,7 +370,7 @@ 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 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" 81 "no right turn" 97 "stop" 105 "yield" 113 "stop" 114 "yield us" 129 "no entry" 138 "no entry tss2" 145 "do not enter";
|
||||
VAL_ 1162 SPLSGN3 15 "conditional blank" 4 "wet road" 5 "rain" 0 "none";
|
||||
|
||||
|
||||
|
||||
@@ -258,8 +258,10 @@ BO_ 1553 UI_SETTING: 8 XXX
|
||||
|
||||
BO_ 1556 STEERING_LEVERS: 8 XXX
|
||||
SG_ TURN_SIGNALS : 29|2@0+ (1,0) [0|3] "" XXX
|
||||
SG_ HAZARD_LIGHT : 27|1@0+ (1,0) [0|1] "" XXX
|
||||
|
||||
BO_ 1568 SEATS_DOORS: 8 XXX
|
||||
SG_ METER_DIMMED : 38|1@0+ (1,0) [0|1] "" 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
|
||||
@@ -268,6 +270,10 @@ BO_ 1568 SEATS_DOORS: 8 XXX
|
||||
|
||||
BO_ 1570 LIGHT_STALK: 8 SCM
|
||||
SG_ AUTO_HIGH_BEAM : 37|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ FRONT_FOG : 27|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ PARKING_LIGHT : 28|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ LOW_BEAM : 29|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ HIGH_BEAM : 30|1@0+ (1,0) [0|1] "" XXX
|
||||
|
||||
BO_ 1161 RSA1: 8 FCM
|
||||
SG_ TSGN1 : 7|8@0+ (1,0) [0|0] "" XXX
|
||||
@@ -364,7 +370,7 @@ 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 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" 81 "no right turn" 97 "stop" 105 "yield" 113 "stop" 114 "yield us" 129 "no entry" 138 "no entry tss2" 145 "do not enter";
|
||||
VAL_ 1162 SPLSGN3 15 "conditional blank" 4 "wet road" 5 "rain" 0 "none";
|
||||
|
||||
|
||||
|
||||
@@ -1351,18 +1351,19 @@ BO_ 391 EV_Gearshift: 8 XXX
|
||||
SG_ GearPosition : 16|4@1+ (1,0) [0|255] "" XXX
|
||||
SG_ RegenBrakingMode : 12|2@1+ (1,0) [0|3] "" XXX
|
||||
|
||||
CM_ SG_ 173 COUNTERXX "Message not renamed to COUNTER because J533 rate-limiting makes it look like messages are being lost";
|
||||
CM_ SG_ 134 LWI_Lenkradwinkel "Steering angle WITH variable ratio effect included";
|
||||
CM_ SG_ 159 EPS_HCA_Status "Status of Heading Control Assist feature"
|
||||
CM_ SG_ 159 EPS_Lenkmoment "Steering input by driver, torque";
|
||||
CM_ SG_ 159 EPS_VZ_Lenkmoment "Steering input by driver, direction";
|
||||
CM_ SG_ 159 EPS_Berechneter_LW "Raw steering angle, degrees";
|
||||
CM_ SG_ 159 EPS_VZ_BLW "Raw steering angle, direction"
|
||||
CM_ SG_ 173 COUNTERXX "Message not renamed to COUNTER because J533 rate-limiting makes it look like messages are being lost";
|
||||
CM_ SG_ 294 3 "May be zero when sent by older cameras";
|
||||
CM_ SG_ 294 7 "May be zero when sent by older cameras";
|
||||
CM_ SG_ 294 254 "May be zero when sent by older cameras";
|
||||
CM_ SG_ 294 Assist_Torque "Heading control input, torque";
|
||||
CM_ SG_ 294 Assist_VZ "Heading control input, direction (sign)";
|
||||
CM_ SG_ 294 HCA_Available "Must be 1 for steering rack to accept HCA commands";
|
||||
CM_ SG_ 159 HCA_Ready "1 if HCA is okay, 0 if the rack doesn't have HCA configured or a timer/constraint has been violated, rack will not respond to HCA commands";
|
||||
CM_ SG_ 159 Driver_Strain "Steering input by driver, torque";
|
||||
CM_ SG_ 159 Driver_Strain_VZ "Steering input by driver, sign (direction)";
|
||||
CM_ SG_ 159 Steering_Wheel_Angle "Steering angle WITHOUT variable ratio effect included";
|
||||
CM_ SG_ 919 LDW_DLC "Probable DLC (distance to line crossing)";
|
||||
CM_ SG_ 919 LDW_TLC "Probable TLC (time to line crossing)";
|
||||
CM_ SG_ 919 LDW_Unknown "Might be a steering pressed / driver active flag";
|
||||
@@ -1378,6 +1379,7 @@ CM_ SG_ 780 Abstand "Following distance";
|
||||
CM_ SG_ 780 SetSpeed "ACC set speed";
|
||||
CM_ SG_ 391 GearPosition "Traditional PRND plus B-mode aggressive regen, B-mode mapped to Drive";
|
||||
CM_ SG_ 960 ZAS_Kl_15 "Indicates ignition on";
|
||||
VAL_ 159 EPS_HCA_Status 0 "disabled" 1 "initializing" 2 "fault" 3 "ready" 4 "rejected" 5 "active";
|
||||
VAL_ 173 GE_Fahrstufe 5 "P" 6 "R" 7 "N" 8 "D" 9 "S" 10 "E" 14 "T";
|
||||
VAL_ 391 GearPosition 2 "P" 3 "R" 4 "N" 5 "D" 6 "D";
|
||||
VAL_ 391 RegenBrakingMode 0 "default" 1 "B1" 2 "B2" 3 "B3";
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
.*.swo
|
||||
*.o
|
||||
*.so
|
||||
*.os
|
||||
*.d
|
||||
*.dump
|
||||
a.out
|
||||
|
||||
@@ -136,6 +136,11 @@ panda_env = Environment(
|
||||
# Common autogenerated includes
|
||||
version = f'const uint8_t gitversion[] = "{get_version(BUILDER, BUILD_TYPE)}";'
|
||||
gitversion = panda_env.Textfile("obj/gitversion.h", [version, ""])
|
||||
Ignore('bootstub.o', gitversion)
|
||||
Requires('bootstub.o', gitversion)
|
||||
Ignore('main.o', gitversion)
|
||||
Requires('main.o', gitversion)
|
||||
|
||||
certs = [get_key_header(n) for n in ["debug", "release"]]
|
||||
certheader = panda_env.Textfile("obj/cert.h", certs + [""])
|
||||
|
||||
@@ -144,13 +149,11 @@ startup = panda_env.Object(STARTUP_FILE)
|
||||
# Bootstub
|
||||
crypto = ["../crypto/rsa.c", "../crypto/sha.c"]
|
||||
bootstub_elf = panda_env.Program(f"obj/bootstub.{PROJECT}.elf", [startup] + crypto + ["bootstub.c"])
|
||||
Requires(bootstub_elf, gitversion)
|
||||
bootstub_bin = panda_env.Objcopy(f"obj/bootstub.{PROJECT}.bin", bootstub_elf)
|
||||
|
||||
# Build main
|
||||
main_elf = panda_env.Program(f"obj/{PROJECT}.elf", [startup, MAIN],
|
||||
LINKFLAGS=["-Wl,--section-start,.isr_vector=0x8004000"] + flags)
|
||||
Requires(main_elf, gitversion)
|
||||
main_bin = panda_env.Objcopy(f"obj/{PROJECT}.bin", main_elf)
|
||||
|
||||
# Sign main
|
||||
|
||||
@@ -26,9 +26,9 @@ void dos_enable_can_transceivers(bool enabled) {
|
||||
for(uint8_t i=1U; i<=4U; i++){
|
||||
// Leave main CAN always on for CAN-based ignition detection
|
||||
if((car_harness_status == HARNESS_STATUS_FLIPPED) ? (i == 3U) : (i == 1U)){
|
||||
uno_enable_can_transceiver(i, true);
|
||||
dos_enable_can_transceiver(i, true);
|
||||
} else {
|
||||
uno_enable_can_transceiver(i, enabled);
|
||||
dos_enable_can_transceiver(i, enabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-3
@@ -12,6 +12,7 @@ void jump_to_bootloader(void) {
|
||||
void (*bootloader)(void) = (void (*)(void)) (*((uint32_t *)0x1fff0004));
|
||||
|
||||
// jump to bootloader
|
||||
enable_interrupts();
|
||||
bootloader();
|
||||
|
||||
// reset on exit
|
||||
@@ -21,14 +22,12 @@ void jump_to_bootloader(void) {
|
||||
|
||||
void early(void) {
|
||||
// Reset global critical depth
|
||||
disable_interrupts();
|
||||
global_critical_depth = 0;
|
||||
|
||||
// Init register and interrupt tables
|
||||
init_registers();
|
||||
|
||||
// neccesary for DFU flashing on a non-power cycled white panda
|
||||
enable_interrupts();
|
||||
|
||||
// after it's been in the bootloader, things are initted differently, so we reset
|
||||
if ((enter_bootloader_mode != BOOT_NORMAL) &&
|
||||
(enter_bootloader_mode != ENTER_BOOTLOADER_MAGIC) &&
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
|
||||
extern int _app_start[0xc000]; // Only first 3 sectors of size 0x4000 are used
|
||||
|
||||
// When changing this struct, boardd and python/__init__.py needs to be kept up to date!
|
||||
struct __attribute__((packed)) health_t {
|
||||
uint32_t uptime_pkt;
|
||||
uint32_t voltage_pkt;
|
||||
@@ -61,6 +62,7 @@ struct __attribute__((packed)) health_t {
|
||||
int16_t safety_param_pkt;
|
||||
uint8_t fault_status_pkt;
|
||||
uint8_t power_save_enabled_pkt;
|
||||
uint8_t heartbeat_lost_pkt;
|
||||
};
|
||||
|
||||
|
||||
@@ -140,6 +142,7 @@ void set_safety_mode(uint16_t mode, int16_t param) {
|
||||
case SAFETY_ELM327:
|
||||
set_intercept_relay(false);
|
||||
heartbeat_counter = 0U;
|
||||
heartbeat_lost = false;
|
||||
if (board_has_obd()) {
|
||||
current_board->set_can_mode(CAN_MODE_OBD_CAN2);
|
||||
}
|
||||
@@ -148,6 +151,7 @@ void set_safety_mode(uint16_t mode, int16_t param) {
|
||||
default:
|
||||
set_intercept_relay(true);
|
||||
heartbeat_counter = 0U;
|
||||
heartbeat_lost = false;
|
||||
if (board_has_obd()) {
|
||||
current_board->set_can_mode(CAN_MODE_NORMAL);
|
||||
}
|
||||
@@ -182,6 +186,7 @@ int get_health_pkt(void *dat) {
|
||||
health->safety_mode_pkt = (uint8_t)(current_safety_mode);
|
||||
health->safety_param_pkt = current_safety_param;
|
||||
health->power_save_enabled_pkt = (uint8_t)(power_save_status == POWER_SAVE_STATUS_ENABLED);
|
||||
health->heartbeat_lost_pkt = (uint8_t)(heartbeat_lost);
|
||||
|
||||
health->fault_status_pkt = fault_status;
|
||||
health->faults_pkt = faults;
|
||||
@@ -595,6 +600,7 @@ int usb_cb_control_msg(USB_Setup_TypeDef *setup, uint8_t *resp, bool hardwired)
|
||||
case 0xf3:
|
||||
{
|
||||
heartbeat_counter = 0U;
|
||||
heartbeat_lost = false;
|
||||
break;
|
||||
}
|
||||
// **** 0xf4: k-line/l-line 5 baud initialization
|
||||
@@ -732,6 +738,9 @@ void TIM1_BRK_TIM9_IRQ_Handler(void) {
|
||||
set_power_save_state(POWER_SAVE_STATUS_ENABLED);
|
||||
}
|
||||
|
||||
// set flag to indicate the heartbeat was lost
|
||||
heartbeat_lost = true;
|
||||
|
||||
// Also disable IR when the heartbeat goes missing
|
||||
current_board->set_ir_power(0U);
|
||||
|
||||
|
||||
@@ -13,5 +13,6 @@ const board *current_board;
|
||||
bool is_enumerated = 0;
|
||||
uint32_t heartbeat_counter = 0;
|
||||
uint32_t uptime_cnt = 0;
|
||||
bool heartbeat_lost = false;
|
||||
bool siren_enabled = false;
|
||||
bool green_led_enabled = false;
|
||||
|
||||
@@ -37,7 +37,8 @@ const int HONDA_RX_CHECKS_LEN = sizeof(honda_rx_checks) / sizeof(honda_rx_checks
|
||||
AddrCheckStruct honda_bh_rx_checks[] = {
|
||||
{.msg = {{0x296, 1, 4, .check_checksum = true, .max_counter = 3U, .expected_timestep = 40000U}}},
|
||||
{.msg = {{0x158, 1, 8, .check_checksum = true, .max_counter = 3U, .expected_timestep = 10000U}}},
|
||||
{.msg = {{0x17C, 1, 8, .check_checksum = true, .max_counter = 3U, .expected_timestep = 10000U}}},
|
||||
{.msg = {{0x17C, 1, 8, .check_checksum = true, .max_counter = 3U, .expected_timestep = 10000U},
|
||||
{0x1BE, 1, 3, .check_checksum = true, .max_counter = 3U, .expected_timestep = 20000U}}},
|
||||
};
|
||||
const int HONDA_BH_RX_CHECKS_LEN = sizeof(honda_bh_rx_checks) / sizeof(honda_bh_rx_checks[0]);
|
||||
|
||||
|
||||
@@ -17,11 +17,9 @@ const CanMsg HYUNDAI_TX_MSGS[] = {
|
||||
// {1186, 0, 8} // 4a2SCC, Bus 0
|
||||
};
|
||||
|
||||
// TODO: missing checksum for wheel speeds message,worst failure case is
|
||||
// wheel speeds stuck at 0 and we don't disengage on brake press
|
||||
AddrCheckStruct hyundai_rx_checks[] = {
|
||||
{.msg = {{608, 0, 8, .check_checksum = true, .max_counter = 3U, .expected_timestep = 10000U}}},
|
||||
{.msg = {{902, 0, 8, .check_checksum = false, .max_counter = 15U, .expected_timestep = 10000U}}},
|
||||
{.msg = {{902, 0, 8, .check_checksum = true, .max_counter = 15U, .expected_timestep = 10000U}}},
|
||||
{.msg = {{916, 0, 8, .check_checksum = true, .max_counter = 7U, .expected_timestep = 10000U}}},
|
||||
{.msg = {{1057, 0, 8, .check_checksum = true, .max_counter = 15U, .expected_timestep = 20000U}}},
|
||||
};
|
||||
@@ -63,6 +61,8 @@ static uint8_t hyundai_get_checksum(CAN_FIFOMailBox_TypeDef *to_push) {
|
||||
uint8_t chksum;
|
||||
if (addr == 608) {
|
||||
chksum = GET_BYTE(to_push, 7) & 0xF;
|
||||
} else if (addr == 902) {
|
||||
chksum = ((GET_BYTE(to_push, 7) >> 6) << 2) | (GET_BYTE(to_push, 5) >> 6);
|
||||
} else if (addr == 916) {
|
||||
chksum = GET_BYTE(to_push, 6) & 0xF;
|
||||
} else if (addr == 1057) {
|
||||
@@ -77,15 +77,36 @@ static uint8_t hyundai_compute_checksum(CAN_FIFOMailBox_TypeDef *to_push) {
|
||||
int addr = GET_ADDR(to_push);
|
||||
|
||||
uint8_t chksum = 0;
|
||||
// same algorithm, but checksum is in a different place
|
||||
for (int i = 0; i < 8; i++) {
|
||||
uint8_t b = GET_BYTE(to_push, i);
|
||||
if (((addr == 608) && (i == 7)) || ((addr == 916) && (i == 6)) || ((addr == 1057) && (i == 7))) {
|
||||
b &= (addr == 1057) ? 0x0FU : 0xF0U; // remove checksum
|
||||
if (addr == 902) {
|
||||
// count the bits
|
||||
for (int i = 0; i < 8; i++) {
|
||||
uint8_t b = GET_BYTE(to_push, i);
|
||||
for (int j = 0; j < 8; j++) {
|
||||
uint8_t bit = 0;
|
||||
// exclude checksum and counter
|
||||
if (((i != 1) || (j < 6)) && ((i != 3) || (j < 6)) && ((i != 5) || (j < 6)) && ((i != 7) || (j < 6))) {
|
||||
bit = (b >> (uint8_t)j) & 1U;
|
||||
}
|
||||
chksum += bit;
|
||||
}
|
||||
}
|
||||
chksum += (b % 16U) + (b / 16U);
|
||||
chksum = (chksum ^ 9U) & 15U;
|
||||
} else {
|
||||
// sum of nibbles
|
||||
for (int i = 0; i < 8; i++) {
|
||||
if ((addr == 916) && (i == 7)) {
|
||||
continue; // exclude
|
||||
}
|
||||
uint8_t b = GET_BYTE(to_push, i);
|
||||
if (((addr == 608) && (i == 7)) || ((addr == 916) && (i == 6)) || ((addr == 1057) && (i == 7))) {
|
||||
b &= (addr == 1057) ? 0x0FU : 0xF0U; // remove checksum
|
||||
}
|
||||
chksum += (b % 16U) + (b / 16U);
|
||||
}
|
||||
chksum = (16U - (chksum % 16U)) % 16U;
|
||||
}
|
||||
return (16U - (chksum % 16U)) % 16U;
|
||||
|
||||
return chksum;
|
||||
}
|
||||
|
||||
static int hyundai_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
|
||||
|
||||
@@ -30,9 +30,9 @@ const int TOYOTA_GAS_INTERCEPTOR_THRSLD = 845;
|
||||
#define TOYOTA_GET_INTERCEPTOR(msg) (((GET_BYTE((msg), 0) << 8) + GET_BYTE((msg), 1) + (GET_BYTE((msg), 2) << 8) + GET_BYTE((msg), 3)) / 2) // avg between 2 tracks
|
||||
|
||||
const CanMsg TOYOTA_TX_MSGS[] = {{0x283, 0, 7}, {0x2E6, 0, 8}, {0x2E7, 0, 8}, {0x33E, 0, 7}, {0x344, 0, 8}, {0x365, 0, 7}, {0x366, 0, 7}, {0x4CB, 0, 8}, // DSU bus 0
|
||||
{0x128, 1, 6}, {0x141, 1, 4}, {0x160, 1, 8}, {0x161, 1, 7}, {0x470, 1, 4}, // DSU bus 1
|
||||
{0x2E4, 0, 5}, {0x411, 0, 8}, {0x412, 0, 8}, {0x343, 0, 8}, {0x1D2, 0, 8}, // LKAS + ACC
|
||||
{0x200, 0, 6}}; // interceptor
|
||||
{0x128, 1, 6}, {0x141, 1, 4}, {0x160, 1, 8}, {0x161, 1, 7}, {0x470, 1, 4}, // DSU bus 1
|
||||
{0x2E4, 0, 5}, {0x191, 0, 8}, {0x411, 0, 8}, {0x412, 0, 8}, {0x343, 0, 8}, {0x1D2, 0, 8}, // LKAS + ACC
|
||||
{0x200, 0, 6}}; // interceptor
|
||||
|
||||
AddrCheckStruct toyota_rx_checks[] = {
|
||||
{.msg = {{ 0xaa, 0, 8, .check_checksum = false, .expected_timestep = 12000U}}},
|
||||
@@ -180,6 +180,21 @@ static int toyota_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) {
|
||||
}
|
||||
}
|
||||
|
||||
// LTA steering check
|
||||
// only sent to prevent dash errors, no actuation is accepted
|
||||
if (addr == 0x191) {
|
||||
// check the STEER_REQUEST, STEER_REQUEST_2, and STEER_ANGLE_CMD signals
|
||||
bool lta_request = (GET_BYTE(to_send, 0) & 1) != 0;
|
||||
bool lta_request2 = ((GET_BYTE(to_send, 3) >> 1) & 1) != 0;
|
||||
int lta_angle = (GET_BYTE(to_send, 1) << 8) | GET_BYTE(to_send, 2);
|
||||
lta_angle = to_signed(lta_angle, 16);
|
||||
|
||||
// block LTA msgs with actuation requests
|
||||
if (lta_request || lta_request2 || (lta_angle != 0)) {
|
||||
tx = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// STEER: safety check on bytes 2-3
|
||||
if (addr == 0x2E4) {
|
||||
int desired_torque = (GET_BYTE(to_send, 1) << 8) | GET_BYTE(to_send, 2);
|
||||
|
||||
@@ -179,7 +179,7 @@ class Panda(object):
|
||||
self.bootstub = device.getProductID() == 0xddee
|
||||
self.legacy = (device.getbcdDevice() != 0x2300)
|
||||
self._handle = device.open()
|
||||
if sys.platform not in ["win32", "cygwin", "msys"]:
|
||||
if sys.platform not in ["win32", "cygwin", "msys", "darwin"]:
|
||||
self._handle.setAutoDetachKernelDriver(True)
|
||||
if claim:
|
||||
self._handle.claimInterface(0)
|
||||
@@ -332,8 +332,8 @@ class Panda(object):
|
||||
# ******************* health *******************
|
||||
|
||||
def health(self):
|
||||
dat = self._handle.controlRead(Panda.REQUEST_IN, 0xd2, 0, 0, 41)
|
||||
a = struct.unpack("IIIIIIIIBBBBBBBBB", dat)
|
||||
dat = self._handle.controlRead(Panda.REQUEST_IN, 0xd2, 0, 0, 44)
|
||||
a = struct.unpack("<IIIIIIIIBBBBBBBHBBB", dat)
|
||||
return {
|
||||
"uptime": a[0],
|
||||
"voltage": a[1],
|
||||
@@ -350,8 +350,10 @@ class Panda(object):
|
||||
"car_harness_status": a[12],
|
||||
"usb_power_mode": a[13],
|
||||
"safety_mode": a[14],
|
||||
"fault_status": a[15],
|
||||
"power_save_enabled": a[16]
|
||||
"safety_param": a[15],
|
||||
"fault_status": a[16],
|
||||
"power_save_enabled": a[17],
|
||||
"heartbeat_lost": a[18],
|
||||
}
|
||||
|
||||
# ******************* control *******************
|
||||
|
||||
+1
-1
@@ -240,7 +240,7 @@ _negative_response_codes = {
|
||||
0x31: 'request out of range',
|
||||
0x33: 'security access denied',
|
||||
0x35: 'invalid key',
|
||||
0x36: 'exceed numebr of attempts',
|
||||
0x36: 'exceed number of attempts',
|
||||
0x37: 'required time delay not expired',
|
||||
0x70: 'upload download not accepted',
|
||||
0x71: 'transfer data suspended',
|
||||
|
||||
@@ -2,3 +2,5 @@ Import('env')
|
||||
|
||||
env.Library('json11', ['json11/json11.cpp'])
|
||||
env.Append(CPPPATH=[Dir('json11')])
|
||||
|
||||
env.Library('kaitai', ['kaitai/kaitaistream.cpp'], CPPDEFINES=['KS_STR_ENCODING_NONE'])
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
#ifndef KAITAI_CUSTOM_DECODER_H
|
||||
#define KAITAI_CUSTOM_DECODER_H
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace kaitai {
|
||||
|
||||
class custom_decoder {
|
||||
public:
|
||||
virtual ~custom_decoder() {};
|
||||
virtual std::string decode(std::string src) = 0;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,189 @@
|
||||
#ifndef KAITAI_EXCEPTIONS_H
|
||||
#define KAITAI_EXCEPTIONS_H
|
||||
|
||||
#include <kaitai/kaitaistream.h>
|
||||
|
||||
#include <string>
|
||||
#include <stdexcept>
|
||||
|
||||
// We need to use "noexcept" in virtual destructor of our exceptions
|
||||
// subclasses. Different compilers have different ideas on how to
|
||||
// achieve that: C++98 compilers prefer `throw()`, C++11 and later
|
||||
// use `noexcept`. We define KS_NOEXCEPT macro for that.
|
||||
|
||||
#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1900)
|
||||
#define KS_NOEXCEPT noexcept
|
||||
#else
|
||||
#define KS_NOEXCEPT throw()
|
||||
#endif
|
||||
|
||||
namespace kaitai {
|
||||
|
||||
/**
|
||||
* Common ancestor for all error originating from Kaitai Struct usage.
|
||||
* Stores KSY source path, pointing to an element supposedly guilty of
|
||||
* an error.
|
||||
*/
|
||||
class kstruct_error: public std::runtime_error {
|
||||
public:
|
||||
kstruct_error(const std::string what, const std::string src_path):
|
||||
std::runtime_error(src_path + ": " + what),
|
||||
m_src_path(src_path)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~kstruct_error() KS_NOEXCEPT {};
|
||||
|
||||
protected:
|
||||
const std::string m_src_path;
|
||||
};
|
||||
|
||||
/**
|
||||
* Error that occurs when default endianness should be decided with
|
||||
* a switch, but nothing matches (although using endianness expression
|
||||
* implies that there should be some positive result).
|
||||
*/
|
||||
class undecided_endianness_error: public kstruct_error {
|
||||
public:
|
||||
undecided_endianness_error(const std::string src_path):
|
||||
kstruct_error("unable to decide on endianness for a type", src_path)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~undecided_endianness_error() KS_NOEXCEPT {};
|
||||
};
|
||||
|
||||
/**
|
||||
* Common ancestor for all validation failures. Stores pointer to
|
||||
* KaitaiStream IO object which was involved in an error.
|
||||
*/
|
||||
class validation_failed_error: public kstruct_error {
|
||||
public:
|
||||
validation_failed_error(const std::string what, kstream* io, const std::string src_path):
|
||||
kstruct_error("at pos " + kstream::to_string(static_cast<int>(io->pos())) + ": validation failed: " + what, src_path),
|
||||
m_io(io)
|
||||
{
|
||||
}
|
||||
|
||||
// "at pos #{io.pos}: validation failed: #{msg}"
|
||||
|
||||
virtual ~validation_failed_error() KS_NOEXCEPT {};
|
||||
|
||||
protected:
|
||||
kstream* m_io;
|
||||
};
|
||||
|
||||
/**
|
||||
* Signals validation failure: we required "actual" value to be equal to
|
||||
* "expected", but it turned out that it's not.
|
||||
*/
|
||||
template<typename T>
|
||||
class validation_not_equal_error: public validation_failed_error {
|
||||
public:
|
||||
validation_not_equal_error<T>(const T& expected, const T& actual, kstream* io, const std::string src_path):
|
||||
validation_failed_error("not equal", io, src_path),
|
||||
m_expected(expected),
|
||||
m_actual(actual)
|
||||
{
|
||||
}
|
||||
|
||||
// "not equal, expected #{expected.inspect}, but got #{actual.inspect}"
|
||||
|
||||
virtual ~validation_not_equal_error<T>() KS_NOEXCEPT {};
|
||||
|
||||
protected:
|
||||
const T& m_expected;
|
||||
const T& m_actual;
|
||||
};
|
||||
|
||||
/**
|
||||
* Signals validation failure: we required "actual" value to be greater
|
||||
* than or equal to "min", but it turned out that it's not.
|
||||
*/
|
||||
template<typename T>
|
||||
class validation_less_than_error: public validation_failed_error {
|
||||
public:
|
||||
validation_less_than_error<T>(const T& min, const T& actual, kstream* io, const std::string src_path):
|
||||
validation_failed_error("not in range", io, src_path),
|
||||
m_min(min),
|
||||
m_actual(actual)
|
||||
{
|
||||
}
|
||||
|
||||
// "not in range, min #{min.inspect}, but got #{actual.inspect}"
|
||||
|
||||
virtual ~validation_less_than_error<T>() KS_NOEXCEPT {};
|
||||
|
||||
protected:
|
||||
const T& m_min;
|
||||
const T& m_actual;
|
||||
};
|
||||
|
||||
/**
|
||||
* Signals validation failure: we required "actual" value to be less
|
||||
* than or equal to "max", but it turned out that it's not.
|
||||
*/
|
||||
template<typename T>
|
||||
class validation_greater_than_error: public validation_failed_error {
|
||||
public:
|
||||
validation_greater_than_error<T>(const T& max, const T& actual, kstream* io, const std::string src_path):
|
||||
validation_failed_error("not in range", io, src_path),
|
||||
m_max(max),
|
||||
m_actual(actual)
|
||||
{
|
||||
}
|
||||
|
||||
// "not in range, max #{max.inspect}, but got #{actual.inspect}"
|
||||
|
||||
virtual ~validation_greater_than_error<T>() KS_NOEXCEPT {};
|
||||
|
||||
protected:
|
||||
const T& m_max;
|
||||
const T& m_actual;
|
||||
};
|
||||
|
||||
/**
|
||||
* Signals validation failure: we required "actual" value to be from
|
||||
* the list, but it turned out that it's not.
|
||||
*/
|
||||
template<typename T>
|
||||
class validation_not_any_of_error: public validation_failed_error {
|
||||
public:
|
||||
validation_not_any_of_error<T>(const T& actual, kstream* io, const std::string src_path):
|
||||
validation_failed_error("not any of the list", io, src_path),
|
||||
m_actual(actual)
|
||||
{
|
||||
}
|
||||
|
||||
// "not any of the list, got #{actual.inspect}"
|
||||
|
||||
virtual ~validation_not_any_of_error<T>() KS_NOEXCEPT {};
|
||||
|
||||
protected:
|
||||
const T& m_actual;
|
||||
};
|
||||
|
||||
/**
|
||||
* Signals validation failure: we required "actual" value to match
|
||||
* the expression, but it turned out that it doesn't.
|
||||
*/
|
||||
template<typename T>
|
||||
class validation_expr_error: public validation_failed_error {
|
||||
public:
|
||||
validation_expr_error<T>(const T& actual, kstream* io, const std::string src_path):
|
||||
validation_failed_error("not matching the expression", io, src_path),
|
||||
m_actual(actual)
|
||||
{
|
||||
}
|
||||
|
||||
// "not matching the expression, got #{actual.inspect}"
|
||||
|
||||
virtual ~validation_expr_error<T>() KS_NOEXCEPT {};
|
||||
|
||||
protected:
|
||||
const T& m_actual;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,689 @@
|
||||
#include <kaitai/kaitaistream.h>
|
||||
|
||||
#if defined(__APPLE__)
|
||||
#include <machine/endian.h>
|
||||
#include <libkern/OSByteOrder.h>
|
||||
#define bswap_16(x) OSSwapInt16(x)
|
||||
#define bswap_32(x) OSSwapInt32(x)
|
||||
#define bswap_64(x) OSSwapInt64(x)
|
||||
#define __BYTE_ORDER BYTE_ORDER
|
||||
#define __BIG_ENDIAN BIG_ENDIAN
|
||||
#define __LITTLE_ENDIAN LITTLE_ENDIAN
|
||||
#elif defined(_MSC_VER) // !__APPLE__
|
||||
#include <stdlib.h>
|
||||
#define __LITTLE_ENDIAN 1234
|
||||
#define __BIG_ENDIAN 4321
|
||||
#define __BYTE_ORDER __LITTLE_ENDIAN
|
||||
#define bswap_16(x) _byteswap_ushort(x)
|
||||
#define bswap_32(x) _byteswap_ulong(x)
|
||||
#define bswap_64(x) _byteswap_uint64(x)
|
||||
#else // !__APPLE__ or !_MSC_VER
|
||||
#include <endian.h>
|
||||
#include <byteswap.h>
|
||||
#endif
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <stdexcept>
|
||||
|
||||
kaitai::kstream::kstream(std::istream* io) {
|
||||
m_io = io;
|
||||
init();
|
||||
}
|
||||
|
||||
kaitai::kstream::kstream(std::string& data): m_io_str(data) {
|
||||
m_io = &m_io_str;
|
||||
init();
|
||||
}
|
||||
|
||||
void kaitai::kstream::init() {
|
||||
exceptions_enable();
|
||||
align_to_byte();
|
||||
}
|
||||
|
||||
void kaitai::kstream::close() {
|
||||
// m_io->close();
|
||||
}
|
||||
|
||||
void kaitai::kstream::exceptions_enable() const {
|
||||
m_io->exceptions(
|
||||
std::istream::eofbit |
|
||||
std::istream::failbit |
|
||||
std::istream::badbit
|
||||
);
|
||||
}
|
||||
|
||||
// ========================================================================
|
||||
// Stream positioning
|
||||
// ========================================================================
|
||||
|
||||
bool kaitai::kstream::is_eof() const {
|
||||
if (m_bits_left > 0) {
|
||||
return false;
|
||||
}
|
||||
char t;
|
||||
m_io->exceptions(
|
||||
std::istream::badbit
|
||||
);
|
||||
m_io->get(t);
|
||||
if (m_io->eof()) {
|
||||
m_io->clear();
|
||||
exceptions_enable();
|
||||
return true;
|
||||
} else {
|
||||
m_io->unget();
|
||||
exceptions_enable();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void kaitai::kstream::seek(uint64_t pos) {
|
||||
m_io->seekg(pos);
|
||||
}
|
||||
|
||||
uint64_t kaitai::kstream::pos() {
|
||||
return m_io->tellg();
|
||||
}
|
||||
|
||||
uint64_t kaitai::kstream::size() {
|
||||
std::iostream::pos_type cur_pos = m_io->tellg();
|
||||
m_io->seekg(0, std::ios::end);
|
||||
std::iostream::pos_type len = m_io->tellg();
|
||||
m_io->seekg(cur_pos);
|
||||
return len;
|
||||
}
|
||||
|
||||
// ========================================================================
|
||||
// Integer numbers
|
||||
// ========================================================================
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Signed
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
int8_t kaitai::kstream::read_s1() {
|
||||
char t;
|
||||
m_io->get(t);
|
||||
return t;
|
||||
}
|
||||
|
||||
// ........................................................................
|
||||
// Big-endian
|
||||
// ........................................................................
|
||||
|
||||
int16_t kaitai::kstream::read_s2be() {
|
||||
int16_t t;
|
||||
m_io->read(reinterpret_cast<char *>(&t), 2);
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
t = bswap_16(t);
|
||||
#endif
|
||||
return t;
|
||||
}
|
||||
|
||||
int32_t kaitai::kstream::read_s4be() {
|
||||
int32_t t;
|
||||
m_io->read(reinterpret_cast<char *>(&t), 4);
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
t = bswap_32(t);
|
||||
#endif
|
||||
return t;
|
||||
}
|
||||
|
||||
int64_t kaitai::kstream::read_s8be() {
|
||||
int64_t t;
|
||||
m_io->read(reinterpret_cast<char *>(&t), 8);
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
t = bswap_64(t);
|
||||
#endif
|
||||
return t;
|
||||
}
|
||||
|
||||
// ........................................................................
|
||||
// Little-endian
|
||||
// ........................................................................
|
||||
|
||||
int16_t kaitai::kstream::read_s2le() {
|
||||
int16_t t;
|
||||
m_io->read(reinterpret_cast<char *>(&t), 2);
|
||||
#if __BYTE_ORDER == __BIG_ENDIAN
|
||||
t = bswap_16(t);
|
||||
#endif
|
||||
return t;
|
||||
}
|
||||
|
||||
int32_t kaitai::kstream::read_s4le() {
|
||||
int32_t t;
|
||||
m_io->read(reinterpret_cast<char *>(&t), 4);
|
||||
#if __BYTE_ORDER == __BIG_ENDIAN
|
||||
t = bswap_32(t);
|
||||
#endif
|
||||
return t;
|
||||
}
|
||||
|
||||
int64_t kaitai::kstream::read_s8le() {
|
||||
int64_t t;
|
||||
m_io->read(reinterpret_cast<char *>(&t), 8);
|
||||
#if __BYTE_ORDER == __BIG_ENDIAN
|
||||
t = bswap_64(t);
|
||||
#endif
|
||||
return t;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Unsigned
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
uint8_t kaitai::kstream::read_u1() {
|
||||
char t;
|
||||
m_io->get(t);
|
||||
return t;
|
||||
}
|
||||
|
||||
// ........................................................................
|
||||
// Big-endian
|
||||
// ........................................................................
|
||||
|
||||
uint16_t kaitai::kstream::read_u2be() {
|
||||
uint16_t t;
|
||||
m_io->read(reinterpret_cast<char *>(&t), 2);
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
t = bswap_16(t);
|
||||
#endif
|
||||
return t;
|
||||
}
|
||||
|
||||
uint32_t kaitai::kstream::read_u4be() {
|
||||
uint32_t t;
|
||||
m_io->read(reinterpret_cast<char *>(&t), 4);
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
t = bswap_32(t);
|
||||
#endif
|
||||
return t;
|
||||
}
|
||||
|
||||
uint64_t kaitai::kstream::read_u8be() {
|
||||
uint64_t t;
|
||||
m_io->read(reinterpret_cast<char *>(&t), 8);
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
t = bswap_64(t);
|
||||
#endif
|
||||
return t;
|
||||
}
|
||||
|
||||
// ........................................................................
|
||||
// Little-endian
|
||||
// ........................................................................
|
||||
|
||||
uint16_t kaitai::kstream::read_u2le() {
|
||||
uint16_t t;
|
||||
m_io->read(reinterpret_cast<char *>(&t), 2);
|
||||
#if __BYTE_ORDER == __BIG_ENDIAN
|
||||
t = bswap_16(t);
|
||||
#endif
|
||||
return t;
|
||||
}
|
||||
|
||||
uint32_t kaitai::kstream::read_u4le() {
|
||||
uint32_t t;
|
||||
m_io->read(reinterpret_cast<char *>(&t), 4);
|
||||
#if __BYTE_ORDER == __BIG_ENDIAN
|
||||
t = bswap_32(t);
|
||||
#endif
|
||||
return t;
|
||||
}
|
||||
|
||||
uint64_t kaitai::kstream::read_u8le() {
|
||||
uint64_t t;
|
||||
m_io->read(reinterpret_cast<char *>(&t), 8);
|
||||
#if __BYTE_ORDER == __BIG_ENDIAN
|
||||
t = bswap_64(t);
|
||||
#endif
|
||||
return t;
|
||||
}
|
||||
|
||||
// ========================================================================
|
||||
// Floating point numbers
|
||||
// ========================================================================
|
||||
|
||||
// ........................................................................
|
||||
// Big-endian
|
||||
// ........................................................................
|
||||
|
||||
float kaitai::kstream::read_f4be() {
|
||||
uint32_t t;
|
||||
m_io->read(reinterpret_cast<char *>(&t), 4);
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
t = bswap_32(t);
|
||||
#endif
|
||||
return reinterpret_cast<float&>(t);
|
||||
}
|
||||
|
||||
double kaitai::kstream::read_f8be() {
|
||||
uint64_t t;
|
||||
m_io->read(reinterpret_cast<char *>(&t), 8);
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
t = bswap_64(t);
|
||||
#endif
|
||||
return reinterpret_cast<double&>(t);
|
||||
}
|
||||
|
||||
// ........................................................................
|
||||
// Little-endian
|
||||
// ........................................................................
|
||||
|
||||
float kaitai::kstream::read_f4le() {
|
||||
uint32_t t;
|
||||
m_io->read(reinterpret_cast<char *>(&t), 4);
|
||||
#if __BYTE_ORDER == __BIG_ENDIAN
|
||||
t = bswap_32(t);
|
||||
#endif
|
||||
return reinterpret_cast<float&>(t);
|
||||
}
|
||||
|
||||
double kaitai::kstream::read_f8le() {
|
||||
uint64_t t;
|
||||
m_io->read(reinterpret_cast<char *>(&t), 8);
|
||||
#if __BYTE_ORDER == __BIG_ENDIAN
|
||||
t = bswap_64(t);
|
||||
#endif
|
||||
return reinterpret_cast<double&>(t);
|
||||
}
|
||||
|
||||
// ========================================================================
|
||||
// Unaligned bit values
|
||||
// ========================================================================
|
||||
|
||||
void kaitai::kstream::align_to_byte() {
|
||||
m_bits_left = 0;
|
||||
m_bits = 0;
|
||||
}
|
||||
|
||||
uint64_t kaitai::kstream::read_bits_int_be(int n) {
|
||||
int bits_needed = n - m_bits_left;
|
||||
if (bits_needed > 0) {
|
||||
// 1 bit => 1 byte
|
||||
// 8 bits => 1 byte
|
||||
// 9 bits => 2 bytes
|
||||
int bytes_needed = ((bits_needed - 1) / 8) + 1;
|
||||
if (bytes_needed > 8)
|
||||
throw std::runtime_error("read_bits_int: more than 8 bytes requested");
|
||||
char buf[8];
|
||||
m_io->read(buf, bytes_needed);
|
||||
for (int i = 0; i < bytes_needed; i++) {
|
||||
uint8_t b = buf[i];
|
||||
m_bits <<= 8;
|
||||
m_bits |= b;
|
||||
m_bits_left += 8;
|
||||
}
|
||||
}
|
||||
|
||||
// raw mask with required number of 1s, starting from lowest bit
|
||||
uint64_t mask = get_mask_ones(n);
|
||||
// shift mask to align with highest bits available in @bits
|
||||
int shift_bits = m_bits_left - n;
|
||||
mask <<= shift_bits;
|
||||
// derive reading result
|
||||
uint64_t res = (m_bits & mask) >> shift_bits;
|
||||
// clear top bits that we've just read => AND with 1s
|
||||
m_bits_left -= n;
|
||||
mask = get_mask_ones(m_bits_left);
|
||||
m_bits &= mask;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
// Deprecated, use read_bits_int_be() instead.
|
||||
uint64_t kaitai::kstream::read_bits_int(int n) {
|
||||
return read_bits_int_be(n);
|
||||
}
|
||||
|
||||
uint64_t kaitai::kstream::read_bits_int_le(int n) {
|
||||
int bits_needed = n - m_bits_left;
|
||||
if (bits_needed > 0) {
|
||||
// 1 bit => 1 byte
|
||||
// 8 bits => 1 byte
|
||||
// 9 bits => 2 bytes
|
||||
int bytes_needed = ((bits_needed - 1) / 8) + 1;
|
||||
if (bytes_needed > 8)
|
||||
throw std::runtime_error("read_bits_int_le: more than 8 bytes requested");
|
||||
char buf[8];
|
||||
m_io->read(buf, bytes_needed);
|
||||
for (int i = 0; i < bytes_needed; i++) {
|
||||
uint8_t b = buf[i];
|
||||
m_bits |= (static_cast<uint64_t>(b) << m_bits_left);
|
||||
m_bits_left += 8;
|
||||
}
|
||||
}
|
||||
|
||||
// raw mask with required number of 1s, starting from lowest bit
|
||||
uint64_t mask = get_mask_ones(n);
|
||||
// derive reading result
|
||||
uint64_t res = m_bits & mask;
|
||||
// remove bottom bits that we've just read by shifting
|
||||
m_bits >>= n;
|
||||
m_bits_left -= n;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
uint64_t kaitai::kstream::get_mask_ones(int n) {
|
||||
if (n == 64) {
|
||||
return 0xFFFFFFFFFFFFFFFF;
|
||||
} else {
|
||||
return ((uint64_t) 1 << n) - 1;
|
||||
}
|
||||
}
|
||||
|
||||
// ========================================================================
|
||||
// Byte arrays
|
||||
// ========================================================================
|
||||
|
||||
std::string kaitai::kstream::read_bytes(std::streamsize len) {
|
||||
std::vector<char> result(len);
|
||||
|
||||
// NOTE: streamsize type is signed, negative values are only *supposed* to not be used.
|
||||
// http://en.cppreference.com/w/cpp/io/streamsize
|
||||
if (len < 0) {
|
||||
throw std::runtime_error("read_bytes: requested a negative amount");
|
||||
}
|
||||
|
||||
if (len > 0) {
|
||||
m_io->read(&result[0], len);
|
||||
}
|
||||
|
||||
return std::string(result.begin(), result.end());
|
||||
}
|
||||
|
||||
std::string kaitai::kstream::read_bytes_full() {
|
||||
std::iostream::pos_type p1 = m_io->tellg();
|
||||
m_io->seekg(0, std::ios::end);
|
||||
std::iostream::pos_type p2 = m_io->tellg();
|
||||
size_t len = p2 - p1;
|
||||
|
||||
// Note: this requires a std::string to be backed with a
|
||||
// contiguous buffer. Officially, it's a only requirement since
|
||||
// C++11 (C++98 and C++03 didn't have this requirement), but all
|
||||
// major implementations had contiguous buffers anyway.
|
||||
std::string result(len, ' ');
|
||||
m_io->seekg(p1);
|
||||
m_io->read(&result[0], len);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
std::string kaitai::kstream::read_bytes_term(char term, bool include, bool consume, bool eos_error) {
|
||||
std::string result;
|
||||
std::getline(*m_io, result, term);
|
||||
if (m_io->eof()) {
|
||||
// encountered EOF
|
||||
if (eos_error) {
|
||||
throw std::runtime_error("read_bytes_term: encountered EOF");
|
||||
}
|
||||
} else {
|
||||
// encountered terminator
|
||||
if (include)
|
||||
result.push_back(term);
|
||||
if (!consume)
|
||||
m_io->unget();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
std::string kaitai::kstream::ensure_fixed_contents(std::string expected) {
|
||||
std::string actual = read_bytes(expected.length());
|
||||
|
||||
if (actual != expected) {
|
||||
// NOTE: I think printing it outright is not best idea, it could contain non-ascii charactes like backspace and beeps and whatnot. It would be better to print hexlified version, and also to redirect it to stderr.
|
||||
throw std::runtime_error("ensure_fixed_contents: actual data does not match expected data");
|
||||
}
|
||||
|
||||
return actual;
|
||||
}
|
||||
|
||||
std::string kaitai::kstream::bytes_strip_right(std::string src, char pad_byte) {
|
||||
std::size_t new_len = src.length();
|
||||
|
||||
while (new_len > 0 && src[new_len - 1] == pad_byte)
|
||||
new_len--;
|
||||
|
||||
return src.substr(0, new_len);
|
||||
}
|
||||
|
||||
std::string kaitai::kstream::bytes_terminate(std::string src, char term, bool include) {
|
||||
std::size_t new_len = 0;
|
||||
std::size_t max_len = src.length();
|
||||
|
||||
while (new_len < max_len && src[new_len] != term)
|
||||
new_len++;
|
||||
|
||||
if (include && new_len < max_len)
|
||||
new_len++;
|
||||
|
||||
return src.substr(0, new_len);
|
||||
}
|
||||
|
||||
// ========================================================================
|
||||
// Byte array processing
|
||||
// ========================================================================
|
||||
|
||||
std::string kaitai::kstream::process_xor_one(std::string data, uint8_t key) {
|
||||
size_t len = data.length();
|
||||
std::string result(len, ' ');
|
||||
|
||||
for (size_t i = 0; i < len; i++)
|
||||
result[i] = data[i] ^ key;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
std::string kaitai::kstream::process_xor_many(std::string data, std::string key) {
|
||||
size_t len = data.length();
|
||||
size_t kl = key.length();
|
||||
std::string result(len, ' ');
|
||||
|
||||
size_t ki = 0;
|
||||
for (size_t i = 0; i < len; i++) {
|
||||
result[i] = data[i] ^ key[ki];
|
||||
ki++;
|
||||
if (ki >= kl)
|
||||
ki = 0;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
std::string kaitai::kstream::process_rotate_left(std::string data, int amount) {
|
||||
size_t len = data.length();
|
||||
std::string result(len, ' ');
|
||||
|
||||
for (size_t i = 0; i < len; i++) {
|
||||
uint8_t bits = data[i];
|
||||
result[i] = (bits << amount) | (bits >> (8 - amount));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#ifdef KS_ZLIB
|
||||
#include <zlib.h>
|
||||
|
||||
std::string kaitai::kstream::process_zlib(std::string data) {
|
||||
int ret;
|
||||
|
||||
unsigned char *src_ptr = reinterpret_cast<unsigned char*>(&data[0]);
|
||||
std::stringstream dst_strm;
|
||||
|
||||
z_stream strm;
|
||||
strm.zalloc = Z_NULL;
|
||||
strm.zfree = Z_NULL;
|
||||
strm.opaque = Z_NULL;
|
||||
|
||||
ret = inflateInit(&strm);
|
||||
if (ret != Z_OK)
|
||||
throw std::runtime_error("process_zlib: inflateInit error");
|
||||
|
||||
strm.next_in = src_ptr;
|
||||
strm.avail_in = data.length();
|
||||
|
||||
unsigned char outbuffer[ZLIB_BUF_SIZE];
|
||||
std::string outstring;
|
||||
|
||||
// get the decompressed bytes blockwise using repeated calls to inflate
|
||||
do {
|
||||
strm.next_out = reinterpret_cast<Bytef*>(outbuffer);
|
||||
strm.avail_out = sizeof(outbuffer);
|
||||
|
||||
ret = inflate(&strm, 0);
|
||||
|
||||
if (outstring.size() < strm.total_out)
|
||||
outstring.append(reinterpret_cast<char*>(outbuffer), strm.total_out - outstring.size());
|
||||
} while (ret == Z_OK);
|
||||
|
||||
if (ret != Z_STREAM_END) { // an error occurred that was not EOF
|
||||
std::ostringstream exc_msg;
|
||||
exc_msg << "process_zlib: error #" << ret << "): " << strm.msg;
|
||||
throw std::runtime_error(exc_msg.str());
|
||||
}
|
||||
|
||||
if (inflateEnd(&strm) != Z_OK)
|
||||
throw std::runtime_error("process_zlib: inflateEnd error");
|
||||
|
||||
return outstring;
|
||||
}
|
||||
#endif
|
||||
|
||||
// ========================================================================
|
||||
// Misc utility methods
|
||||
// ========================================================================
|
||||
|
||||
int kaitai::kstream::mod(int a, int b) {
|
||||
if (b <= 0)
|
||||
throw std::invalid_argument("mod: divisor b <= 0");
|
||||
int r = a % b;
|
||||
if (r < 0)
|
||||
r += b;
|
||||
return r;
|
||||
}
|
||||
|
||||
#include <stdio.h>
|
||||
std::string kaitai::kstream::to_string(int val) {
|
||||
// if int is 32 bits, "-2147483648" is the longest string representation
|
||||
// => 11 chars + zero => 12 chars
|
||||
// if int is 64 bits, "-9223372036854775808" is the longest
|
||||
// => 20 chars + zero => 21 chars
|
||||
char buf[25];
|
||||
int got_len = snprintf(buf, sizeof(buf), "%d", val);
|
||||
|
||||
// should never happen, but check nonetheless
|
||||
if (got_len > sizeof(buf))
|
||||
throw std::invalid_argument("to_string: integer is longer than string buffer");
|
||||
|
||||
return std::string(buf);
|
||||
}
|
||||
|
||||
#include <algorithm>
|
||||
std::string kaitai::kstream::reverse(std::string val) {
|
||||
std::reverse(val.begin(), val.end());
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
uint8_t kaitai::kstream::byte_array_min(const std::string val) {
|
||||
uint8_t min = 0xff; // UINT8_MAX
|
||||
std::string::const_iterator end = val.end();
|
||||
for (std::string::const_iterator it = val.begin(); it != end; ++it) {
|
||||
uint8_t cur = static_cast<uint8_t>(*it);
|
||||
if (cur < min) {
|
||||
min = cur;
|
||||
}
|
||||
}
|
||||
return min;
|
||||
}
|
||||
|
||||
uint8_t kaitai::kstream::byte_array_max(const std::string val) {
|
||||
uint8_t max = 0; // UINT8_MIN
|
||||
std::string::const_iterator end = val.end();
|
||||
for (std::string::const_iterator it = val.begin(); it != end; ++it) {
|
||||
uint8_t cur = static_cast<uint8_t>(*it);
|
||||
if (cur > max) {
|
||||
max = cur;
|
||||
}
|
||||
}
|
||||
return max;
|
||||
}
|
||||
|
||||
// ========================================================================
|
||||
// Other internal methods
|
||||
// ========================================================================
|
||||
|
||||
#ifndef KS_STR_DEFAULT_ENCODING
|
||||
#define KS_STR_DEFAULT_ENCODING "UTF-8"
|
||||
#endif
|
||||
|
||||
#ifdef KS_STR_ENCODING_ICONV
|
||||
|
||||
#include <iconv.h>
|
||||
#include <cerrno>
|
||||
#include <stdexcept>
|
||||
|
||||
std::string kaitai::kstream::bytes_to_str(std::string src, std::string src_enc) {
|
||||
iconv_t cd = iconv_open(KS_STR_DEFAULT_ENCODING, src_enc.c_str());
|
||||
|
||||
if (cd == (iconv_t) -1) {
|
||||
if (errno == EINVAL) {
|
||||
throw std::runtime_error("bytes_to_str: invalid encoding pair conversion requested");
|
||||
} else {
|
||||
throw std::runtime_error("bytes_to_str: error opening iconv");
|
||||
}
|
||||
}
|
||||
|
||||
size_t src_len = src.length();
|
||||
size_t src_left = src_len;
|
||||
|
||||
// Start with a buffer length of double the source length.
|
||||
size_t dst_len = src_len * 2;
|
||||
std::string dst(dst_len, ' ');
|
||||
size_t dst_left = dst_len;
|
||||
|
||||
char *src_ptr = &src[0];
|
||||
char *dst_ptr = &dst[0];
|
||||
|
||||
while (true) {
|
||||
size_t res = iconv(cd, &src_ptr, &src_left, &dst_ptr, &dst_left);
|
||||
|
||||
if (res == (size_t) -1) {
|
||||
if (errno == E2BIG) {
|
||||
// dst buffer is not enough to accomodate whole string
|
||||
// enlarge the buffer and try again
|
||||
size_t dst_used = dst_len - dst_left;
|
||||
dst_left += dst_len;
|
||||
dst_len += dst_len;
|
||||
dst.resize(dst_len);
|
||||
|
||||
// dst.resize might have allocated destination buffer in another area
|
||||
// of memory, thus our previous pointer "dst" will be invalid; re-point
|
||||
// it using "dst_used".
|
||||
dst_ptr = &dst[dst_used];
|
||||
} else {
|
||||
throw std::runtime_error("bytes_to_str: iconv error");
|
||||
}
|
||||
} else {
|
||||
// conversion successful
|
||||
dst.resize(dst_len - dst_left);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (iconv_close(cd) != 0) {
|
||||
throw std::runtime_error("bytes_to_str: iconv close error");
|
||||
}
|
||||
|
||||
return dst;
|
||||
}
|
||||
#elif defined(KS_STR_ENCODING_NONE)
|
||||
std::string kaitai::kstream::bytes_to_str(std::string src, std::string src_enc) {
|
||||
return src;
|
||||
}
|
||||
#else
|
||||
#error Need to decide how to handle strings: please define one of: KS_STR_ENCODING_ICONV, KS_STR_ENCODING_NONE
|
||||
#endif
|
||||
@@ -0,0 +1,268 @@
|
||||
#ifndef KAITAI_STREAM_H
|
||||
#define KAITAI_STREAM_H
|
||||
|
||||
// Kaitai Struct runtime API version: x.y.z = 'xxxyyyzzz' decimal
|
||||
#define KAITAI_STRUCT_VERSION 9000L
|
||||
|
||||
#include <istream>
|
||||
#include <sstream>
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
namespace kaitai {
|
||||
|
||||
/**
|
||||
* Kaitai Stream class (kaitai::kstream) is an implementation of
|
||||
* <a href="https://doc.kaitai.io/stream_api.html">Kaitai Struct stream API</a>
|
||||
* for C++/STL. It's implemented as a wrapper over generic STL std::istream.
|
||||
*
|
||||
* It provides a wide variety of simple methods to read (parse) binary
|
||||
* representations of primitive types, such as integer and floating
|
||||
* point numbers, byte arrays and strings, and also provides stream
|
||||
* positioning / navigation methods with unified cross-language and
|
||||
* cross-toolkit semantics.
|
||||
*
|
||||
* Typically, end users won't access Kaitai Stream class manually, but would
|
||||
* describe a binary structure format using .ksy language and then would use
|
||||
* Kaitai Struct compiler to generate source code in desired target language.
|
||||
* That code, in turn, would use this class and API to do the actual parsing
|
||||
* job.
|
||||
*/
|
||||
class kstream {
|
||||
public:
|
||||
/**
|
||||
* Constructs new Kaitai Stream object, wrapping a given std::istream.
|
||||
* \param io istream object to use for this Kaitai Stream
|
||||
*/
|
||||
kstream(std::istream* io);
|
||||
|
||||
/**
|
||||
* Constructs new Kaitai Stream object, wrapping a given in-memory data
|
||||
* buffer.
|
||||
* \param data data buffer to use for this Kaitai Stream
|
||||
*/
|
||||
kstream(std::string& data);
|
||||
|
||||
void close();
|
||||
|
||||
/** @name Stream positioning */
|
||||
//@{
|
||||
/**
|
||||
* Check if stream pointer is at the end of stream. Note that the semantics
|
||||
* are different from traditional STL semantics: one does *not* need to do a
|
||||
* read (which will fail) after the actual end of the stream to trigger EOF
|
||||
* flag, which can be accessed after that read. It is sufficient to just be
|
||||
* at the end of the stream for this method to return true.
|
||||
* \return "true" if we are located at the end of the stream.
|
||||
*/
|
||||
bool is_eof() const;
|
||||
|
||||
/**
|
||||
* Set stream pointer to designated position.
|
||||
* \param pos new position (offset in bytes from the beginning of the stream)
|
||||
*/
|
||||
void seek(uint64_t pos);
|
||||
|
||||
/**
|
||||
* Get current position of a stream pointer.
|
||||
* \return pointer position, number of bytes from the beginning of the stream
|
||||
*/
|
||||
uint64_t pos();
|
||||
|
||||
/**
|
||||
* Get total size of the stream in bytes.
|
||||
* \return size of the stream in bytes
|
||||
*/
|
||||
uint64_t size();
|
||||
//@}
|
||||
|
||||
/** @name Integer numbers */
|
||||
//@{
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Signed
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
int8_t read_s1();
|
||||
|
||||
// ........................................................................
|
||||
// Big-endian
|
||||
// ........................................................................
|
||||
|
||||
int16_t read_s2be();
|
||||
int32_t read_s4be();
|
||||
int64_t read_s8be();
|
||||
|
||||
// ........................................................................
|
||||
// Little-endian
|
||||
// ........................................................................
|
||||
|
||||
int16_t read_s2le();
|
||||
int32_t read_s4le();
|
||||
int64_t read_s8le();
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Unsigned
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
uint8_t read_u1();
|
||||
|
||||
// ........................................................................
|
||||
// Big-endian
|
||||
// ........................................................................
|
||||
|
||||
uint16_t read_u2be();
|
||||
uint32_t read_u4be();
|
||||
uint64_t read_u8be();
|
||||
|
||||
// ........................................................................
|
||||
// Little-endian
|
||||
// ........................................................................
|
||||
|
||||
uint16_t read_u2le();
|
||||
uint32_t read_u4le();
|
||||
uint64_t read_u8le();
|
||||
|
||||
//@}
|
||||
|
||||
/** @name Floating point numbers */
|
||||
//@{
|
||||
|
||||
// ........................................................................
|
||||
// Big-endian
|
||||
// ........................................................................
|
||||
|
||||
float read_f4be();
|
||||
double read_f8be();
|
||||
|
||||
// ........................................................................
|
||||
// Little-endian
|
||||
// ........................................................................
|
||||
|
||||
float read_f4le();
|
||||
double read_f8le();
|
||||
|
||||
//@}
|
||||
|
||||
/** @name Unaligned bit values */
|
||||
//@{
|
||||
|
||||
void align_to_byte();
|
||||
uint64_t read_bits_int_be(int n);
|
||||
uint64_t read_bits_int(int n);
|
||||
uint64_t read_bits_int_le(int n);
|
||||
|
||||
//@}
|
||||
|
||||
/** @name Byte arrays */
|
||||
//@{
|
||||
|
||||
std::string read_bytes(std::streamsize len);
|
||||
std::string read_bytes_full();
|
||||
std::string read_bytes_term(char term, bool include, bool consume, bool eos_error);
|
||||
std::string ensure_fixed_contents(std::string expected);
|
||||
|
||||
static std::string bytes_strip_right(std::string src, char pad_byte);
|
||||
static std::string bytes_terminate(std::string src, char term, bool include);
|
||||
static std::string bytes_to_str(std::string src, std::string src_enc);
|
||||
|
||||
//@}
|
||||
|
||||
/** @name Byte array processing */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* Performs a XOR processing with given data, XORing every byte of input with a single
|
||||
* given value.
|
||||
* @param data data to process
|
||||
* @param key value to XOR with
|
||||
* @return processed data
|
||||
*/
|
||||
static std::string process_xor_one(std::string data, uint8_t key);
|
||||
|
||||
/**
|
||||
* Performs a XOR processing with given data, XORing every byte of input with a key
|
||||
* array, repeating key array many times, if necessary (i.e. if data array is longer
|
||||
* than key array).
|
||||
* @param data data to process
|
||||
* @param key array of bytes to XOR with
|
||||
* @return processed data
|
||||
*/
|
||||
static std::string process_xor_many(std::string data, std::string key);
|
||||
|
||||
/**
|
||||
* Performs a circular left rotation shift for a given buffer by a given amount of bits,
|
||||
* using groups of 1 bytes each time. Right circular rotation should be performed
|
||||
* using this procedure with corrected amount.
|
||||
* @param data source data to process
|
||||
* @param amount number of bits to shift by
|
||||
* @return copy of source array with requested shift applied
|
||||
*/
|
||||
static std::string process_rotate_left(std::string data, int amount);
|
||||
|
||||
#ifdef KS_ZLIB
|
||||
/**
|
||||
* Performs an unpacking ("inflation") of zlib-compressed data with usual zlib headers.
|
||||
* @param data data to unpack
|
||||
* @return unpacked data
|
||||
* @throws IOException
|
||||
*/
|
||||
static std::string process_zlib(std::string data);
|
||||
#endif
|
||||
|
||||
//@}
|
||||
|
||||
/**
|
||||
* Performs modulo operation between two integers: dividend `a`
|
||||
* and divisor `b`. Divisor `b` is expected to be positive. The
|
||||
* result is always 0 <= x <= b - 1.
|
||||
*/
|
||||
static int mod(int a, int b);
|
||||
|
||||
/**
|
||||
* Converts given integer `val` to a decimal string representation.
|
||||
* Should be used in place of std::to_string() (which is available only
|
||||
* since C++11) in older C++ implementations.
|
||||
*/
|
||||
static std::string to_string(int val);
|
||||
|
||||
/**
|
||||
* Reverses given string `val`, so that the first character becomes the
|
||||
* last and the last one becomes the first. This should be used to avoid
|
||||
* the need of local variables at the caller.
|
||||
*/
|
||||
static std::string reverse(std::string val);
|
||||
|
||||
/**
|
||||
* Finds the minimal byte in a byte array, treating bytes as
|
||||
* unsigned values.
|
||||
* @param val byte array to scan
|
||||
* @return minimal byte in byte array as integer
|
||||
*/
|
||||
static uint8_t byte_array_min(const std::string val);
|
||||
|
||||
/**
|
||||
* Finds the maximal byte in a byte array, treating bytes as
|
||||
* unsigned values.
|
||||
* @param val byte array to scan
|
||||
* @return maximal byte in byte array as integer
|
||||
*/
|
||||
static uint8_t byte_array_max(const std::string val);
|
||||
|
||||
private:
|
||||
std::istream* m_io;
|
||||
std::istringstream m_io_str;
|
||||
int m_bits_left;
|
||||
uint64_t m_bits;
|
||||
|
||||
void init();
|
||||
void exceptions_enable() const;
|
||||
|
||||
static uint64_t get_mask_ones(int n);
|
||||
|
||||
static const int ZLIB_BUF_SIZE = 128 * 1024;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,20 @@
|
||||
#ifndef KAITAI_STRUCT_H
|
||||
#define KAITAI_STRUCT_H
|
||||
|
||||
#include <kaitai/kaitaistream.h>
|
||||
|
||||
namespace kaitai {
|
||||
|
||||
class kstruct {
|
||||
public:
|
||||
kstruct(kstream *_io) { m__io = _io; }
|
||||
virtual ~kstruct() {}
|
||||
protected:
|
||||
kstream *m__io;
|
||||
public:
|
||||
kstream *_io() { return m__io; }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,40 @@
|
||||
Import('env', 'envCython', 'arch', 'rednose_config')
|
||||
|
||||
generated_folder = rednose_config['generated_folder']
|
||||
|
||||
templates = Glob('#rednose/templates/*')
|
||||
|
||||
sympy_helpers = "#rednose/helpers/sympy_helpers.py"
|
||||
ekf_sym = "#rednose/helpers/ekf_sym.py"
|
||||
ekf_sym_pyx = "#rednose/helpers/ekf_sym_pyx.pyx"
|
||||
ekf_sym_cc = env.Object("#rednose/helpers/ekf_sym.cc")
|
||||
common_ekf = "#rednose/helpers/common_ekf.cc"
|
||||
|
||||
found = {}
|
||||
for target, (command, combined_lib, extra_generated) in rednose_config['to_build'].items():
|
||||
if File(command).exists():
|
||||
found[target] = (command, combined_lib, extra_generated)
|
||||
|
||||
lib_target = [common_ekf]
|
||||
for target, (command, combined_lib, extra_generated) in found.items():
|
||||
target_files = File([f'{generated_folder}/{target}.cpp', f'{generated_folder}/{target}.h'])
|
||||
extra_generated = [File(f'{generated_folder}/{x}') for x in extra_generated]
|
||||
command_file = File(command)
|
||||
|
||||
env.Command(target_files + extra_generated,
|
||||
[templates, command_file, sympy_helpers, ekf_sym],
|
||||
command_file.get_abspath() + " " + target + " " + Dir(generated_folder).get_abspath())
|
||||
|
||||
if combined_lib:
|
||||
lib_target.append(target_files[0])
|
||||
else:
|
||||
env.SharedLibrary(f'{generated_folder}/' + target, [target_files[0], common_ekf])
|
||||
|
||||
libkf = env.SharedLibrary(f'{generated_folder}/libkf', lib_target)
|
||||
|
||||
lenv = envCython.Clone()
|
||||
lenv["LINKFLAGS"] += [libkf[0].get_labspath()]
|
||||
ekf_sym_so = lenv.Program('#rednose/helpers/ekf_sym_pyx.so', [ekf_sym_pyx, ekf_sym_cc, common_ekf])
|
||||
lenv.Depends(ekf_sym_so, libkf)
|
||||
|
||||
Export('libkf')
|
||||
@@ -13,14 +13,19 @@ def write_code(folder, name, code, header):
|
||||
open(os.path.join(folder, f"{name}.h"), 'w').write(header)
|
||||
|
||||
|
||||
def load_code(folder, name):
|
||||
def load_code(folder, name, lib_name=None):
|
||||
if lib_name is None:
|
||||
lib_name = name
|
||||
shared_ext = "dylib" if platform.system() == "Darwin" else "so"
|
||||
shared_fn = os.path.join(folder, f"lib{name}.{shared_ext}")
|
||||
shared_fn = os.path.join(folder, f"lib{lib_name}.{shared_ext}")
|
||||
header_fn = os.path.join(folder, f"{name}.h")
|
||||
|
||||
with open(header_fn) as f:
|
||||
header = f.read()
|
||||
|
||||
# is the only thing that can be parsed by cffi
|
||||
header = "\n".join([line for line in header.split("\n") if line.startswith("void ")])
|
||||
|
||||
ffi = FFI()
|
||||
ffi.cdef(header)
|
||||
return (ffi, ffi.dlopen(shared_fn))
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
#include "common_ekf.h"
|
||||
|
||||
std::vector<const EKF*>& get_ekfs() {
|
||||
static std::vector<const EKF*> vec;
|
||||
return vec;
|
||||
}
|
||||
|
||||
void ekf_register(const EKF* ekf) {
|
||||
get_ekfs().push_back(ekf);
|
||||
}
|
||||
|
||||
const EKF* ekf_lookup(const std::string& ekf_name) {
|
||||
for (const auto& ekfi : get_ekfs()) {
|
||||
if (ekf_name == ekfi->name) {
|
||||
return ekfi;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
#pragma once
|
||||
|
||||
#include <iostream>
|
||||
#include <cassert>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <deque>
|
||||
#include <unordered_map>
|
||||
#include <map>
|
||||
#include <cmath>
|
||||
|
||||
#include <eigen3/Eigen/Dense>
|
||||
|
||||
typedef void (*extra_routine_t)(double *, double *);
|
||||
|
||||
struct EKF {
|
||||
std::string name;
|
||||
std::vector<int> kinds;
|
||||
std::vector<int> feature_kinds;
|
||||
|
||||
void (*f_fun)(double *, double, double *);
|
||||
void (*F_fun)(double *, double, double *);
|
||||
void (*err_fun)(double *, double *, double *);
|
||||
void (*inv_err_fun)(double *, double *, double *);
|
||||
void (*H_mod_fun)(double *, double *);
|
||||
void (*predict)(double *, double *, double *, double);
|
||||
std::unordered_map<int, void (*)(double *, double *, double *)> hs = {};
|
||||
std::unordered_map<int, void (*)(double *, double *, double *)> Hs = {};
|
||||
std::unordered_map<int, void (*)(double *, double *, double *, double *, double *)> updates = {};
|
||||
std::unordered_map<int, void (*)(double *, double *, double *)> Hes = {};
|
||||
std::unordered_map<std::string, void (*)(double)> sets = {};
|
||||
std::unordered_map<std::string, extra_routine_t> extra_routines = {};
|
||||
};
|
||||
|
||||
std::vector<const EKF*>& get_ekfs();
|
||||
const EKF* ekf_lookup(const std::string& ekf_name);
|
||||
|
||||
void ekf_register(const EKF* ekf);
|
||||
|
||||
#define ekf_init(ekf) \
|
||||
static void __attribute__((constructor)) do_ekf_init_ ## ekf(void) { \
|
||||
ekf_register(&ekf); \
|
||||
}
|
||||
@@ -0,0 +1,223 @@
|
||||
#include "ekf_sym.h"
|
||||
|
||||
using namespace EKFS;
|
||||
using namespace Eigen;
|
||||
|
||||
EKFSym::EKFSym(std::string name, Map<MatrixXdr> Q, Map<VectorXd> x_initial, Map<MatrixXdr> P_initial, int dim_main,
|
||||
int dim_main_err, int N, int dim_augment, int dim_augment_err, std::vector<int> maha_test_kinds,
|
||||
std::vector<int> quaternion_idxs, std::vector<std::string> global_vars, double max_rewind_age)
|
||||
{
|
||||
// TODO: add logger
|
||||
|
||||
this->ekf = ekf_lookup(name);
|
||||
assert(this->ekf);
|
||||
|
||||
this->msckf = N > 0;
|
||||
this->N = N;
|
||||
this->dim_augment = dim_augment;
|
||||
this->dim_augment_err = dim_augment_err;
|
||||
this->dim_main = dim_main;
|
||||
this->dim_main_err = dim_main_err;
|
||||
|
||||
this->dim_x = x_initial.rows();
|
||||
this->dim_err = P_initial.rows();
|
||||
|
||||
assert(dim_main + dim_augment * N == dim_x);
|
||||
assert(dim_main_err + dim_augment_err * N == this->dim_err);
|
||||
assert(Q.rows() == P_initial.rows() && Q.cols() == P_initial.cols());
|
||||
|
||||
// kinds that should get mahalanobis distance
|
||||
// tested for outlier rejection
|
||||
this->maha_test_kinds = maha_test_kinds;
|
||||
|
||||
// quaternions need normalization
|
||||
this->quaternion_idxs = quaternion_idxs;
|
||||
|
||||
this->global_vars = global_vars;
|
||||
|
||||
// Process noise
|
||||
this->Q = Q;
|
||||
|
||||
this->max_rewind_age = max_rewind_age;
|
||||
this->init_state(x_initial, P_initial, NAN);
|
||||
}
|
||||
|
||||
void EKFSym::init_state(Map<VectorXd> state, Map<MatrixXdr> covs, double filter_time) {
|
||||
this->x = state;
|
||||
this->P = covs;
|
||||
this->filter_time = filter_time;
|
||||
this->augment_times = VectorXd::Zero(this->N);
|
||||
this->reset_rewind();
|
||||
}
|
||||
|
||||
VectorXd EKFSym::state() {
|
||||
return this->x;
|
||||
}
|
||||
|
||||
MatrixXdr EKFSym::covs() {
|
||||
return this->P;
|
||||
}
|
||||
|
||||
void EKFSym::set_filter_time(double t) {
|
||||
this->filter_time = t;
|
||||
}
|
||||
|
||||
double EKFSym::get_filter_time() {
|
||||
return this->filter_time;
|
||||
}
|
||||
|
||||
void EKFSym::normalize_quaternions() {
|
||||
for(std::size_t i = 0; i < this->quaternion_idxs.size(); ++i) {
|
||||
this->normalize_slice(this->quaternion_idxs[i], this->quaternion_idxs[i] + 4);
|
||||
}
|
||||
}
|
||||
|
||||
void EKFSym::normalize_slice(int slice_start, int slice_end_ex) {
|
||||
this->x.block(slice_start, 0, slice_end_ex - slice_start, this->x.cols()).normalize();
|
||||
}
|
||||
|
||||
void EKFSym::set_global(std::string global_var, double val) {
|
||||
this->ekf->sets.at(global_var)(val);
|
||||
}
|
||||
|
||||
std::optional<Estimate> EKFSym::predict_and_update_batch(double t, int kind, std::vector<Map<VectorXd>> z_map,
|
||||
std::vector<Map<MatrixXdr>> R_map, std::vector<std::vector<double>> extra_args, bool augment)
|
||||
{
|
||||
// TODO handle rewinding at this level
|
||||
|
||||
std::deque<Observation> rewound;
|
||||
if (!std::isnan(this->filter_time) && t < this->filter_time) {
|
||||
if (this->rewind_t.empty() || t < this->rewind_t.front() || t < this->rewind_t.back() - this->max_rewind_age) {
|
||||
std::cout << "observation too old at " << t << " with filter at " << this->filter_time << ", ignoring" << std::endl;
|
||||
return std::nullopt;
|
||||
}
|
||||
rewound = this->rewind(t);
|
||||
}
|
||||
|
||||
Observation obs;
|
||||
obs.t = t;
|
||||
obs.kind = kind;
|
||||
obs.extra_args = extra_args;
|
||||
for (Map<VectorXd> zi : z_map) {
|
||||
obs.z.push_back(zi);
|
||||
}
|
||||
for (Map<MatrixXdr> Ri : R_map) {
|
||||
obs.R.push_back(Ri);
|
||||
}
|
||||
|
||||
std::optional<Estimate> res = std::make_optional(this->predict_and_update_batch(obs, augment));
|
||||
|
||||
// optional fast forward
|
||||
while (!rewound.empty()) {
|
||||
this->predict_and_update_batch(rewound.front(), false);
|
||||
rewound.pop_front();
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
void EKFSym::reset_rewind() {
|
||||
this->rewind_obscache.clear();
|
||||
this->rewind_t.clear();
|
||||
this->rewind_states.clear();
|
||||
}
|
||||
|
||||
std::deque<Observation> EKFSym::rewind(double t) {
|
||||
std::deque<Observation> rewound;
|
||||
|
||||
// rewind observations until t is after previous observation
|
||||
while (this->rewind_t.back() > t) {
|
||||
rewound.push_front(this->rewind_obscache.back());
|
||||
this->rewind_t.pop_back();
|
||||
this->rewind_states.pop_back();
|
||||
this->rewind_obscache.pop_back();
|
||||
}
|
||||
|
||||
// set the state to the time right before that
|
||||
this->filter_time = this->rewind_t.back();
|
||||
this->x = this->rewind_states.back().first;
|
||||
this->P = this->rewind_states.back().second;
|
||||
|
||||
return rewound;
|
||||
}
|
||||
|
||||
void EKFSym::checkpoint(Observation& obs) {
|
||||
// push to rewinder
|
||||
this->rewind_t.push_back(this->filter_time);
|
||||
this->rewind_states.push_back(std::make_pair(this->x, this->P));
|
||||
this->rewind_obscache.push_back(obs);
|
||||
|
||||
// only keep a certain number around
|
||||
if (this->rewind_t.size() > REWIND_TO_KEEP) {
|
||||
this->rewind_t.pop_front();
|
||||
this->rewind_states.pop_front();
|
||||
this->rewind_obscache.pop_front();
|
||||
}
|
||||
}
|
||||
|
||||
Estimate EKFSym::predict_and_update_batch(Observation& obs, bool augment) {
|
||||
assert(obs.z.size() == obs.R.size());
|
||||
assert(obs.z.size() == obs.extra_args.size());
|
||||
|
||||
this->predict(obs.t);
|
||||
|
||||
Estimate res;
|
||||
res.t = obs.t;
|
||||
res.kind = obs.kind;
|
||||
res.z = obs.z;
|
||||
res.extra_args = obs.extra_args;
|
||||
res.xk1 = this->x;
|
||||
res.Pk1 = this->P;
|
||||
|
||||
// update batch
|
||||
std::vector<VectorXd> y;
|
||||
for (int i = 0; i < obs.z.size(); i++) {
|
||||
assert(obs.z[i].rows() == obs.R[i].rows());
|
||||
assert(obs.z[i].rows() == obs.R[i].cols());
|
||||
|
||||
// update state
|
||||
y.push_back(this->update(obs.kind, obs.z[i], obs.R[i], obs.extra_args[i]));
|
||||
}
|
||||
|
||||
res.xk = this->x;
|
||||
res.Pk = this->P;
|
||||
res.y = y;
|
||||
|
||||
assert(!augment); // TODO
|
||||
// if (augment) {
|
||||
// this->augment();
|
||||
// }
|
||||
|
||||
this->checkpoint(obs);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
void EKFSym::predict(double t) {
|
||||
// initialize time
|
||||
if (std::isnan(this->filter_time)) {
|
||||
this->filter_time = t;
|
||||
}
|
||||
|
||||
// predict
|
||||
double dt = t - this->filter_time;
|
||||
assert(dt >= 0.0);
|
||||
|
||||
this->ekf->predict(this->x.data(), this->P.data(), this->Q.data(), dt);
|
||||
this->normalize_quaternions();
|
||||
this->filter_time = t;
|
||||
}
|
||||
|
||||
VectorXd EKFSym::update(int kind, VectorXd z, MatrixXdr R, std::vector<double> extra_args) {
|
||||
this->ekf->updates.at(kind)(this->x.data(), this->P.data(), z.data(), R.data(), extra_args.data());
|
||||
this->normalize_quaternions();
|
||||
|
||||
if (this->msckf && std::find(this->feature_track_kinds.begin(), this->feature_track_kinds.end(), kind) != this->feature_track_kinds.end()) {
|
||||
return z.head(z.rows() - extra_args.size());
|
||||
}
|
||||
return z;
|
||||
}
|
||||
|
||||
extra_routine_t EKFSym::get_extra_routine(const std::string& routine) {
|
||||
return this->ekf->extra_routines.at(routine);
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
#pragma once
|
||||
|
||||
#include <iostream>
|
||||
#include <cassert>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <deque>
|
||||
#include <unordered_map>
|
||||
#include <map>
|
||||
#include <cmath>
|
||||
#include <optional>
|
||||
|
||||
#include <eigen3/Eigen/Dense>
|
||||
|
||||
#include "common_ekf.h"
|
||||
|
||||
#define REWIND_TO_KEEP 512
|
||||
|
||||
namespace EKFS {
|
||||
|
||||
typedef Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> MatrixXdr;
|
||||
|
||||
typedef struct Observation {
|
||||
double t;
|
||||
int kind;
|
||||
std::vector<Eigen::VectorXd> z;
|
||||
std::vector<MatrixXdr> R;
|
||||
std::vector<std::vector<double>> extra_args;
|
||||
} Observation;
|
||||
|
||||
typedef struct Estimate {
|
||||
Eigen::VectorXd xk1;
|
||||
Eigen::VectorXd xk;
|
||||
MatrixXdr Pk1;
|
||||
MatrixXdr Pk;
|
||||
double t;
|
||||
int kind;
|
||||
std::vector<Eigen::VectorXd> y;
|
||||
std::vector<Eigen::VectorXd> z;
|
||||
std::vector<std::vector<double>> extra_args;
|
||||
} Estimate;
|
||||
|
||||
class EKFSym {
|
||||
public:
|
||||
EKFSym(std::string name, Eigen::Map<MatrixXdr> Q, Eigen::Map<Eigen::VectorXd> x_initial,
|
||||
Eigen::Map<MatrixXdr> P_initial, int dim_main, int dim_main_err, int N = 0, int dim_augment = 0,
|
||||
int dim_augment_err = 0, std::vector<int> maha_test_kinds = std::vector<int>(),
|
||||
std::vector<int> quaternion_idxs = std::vector<int>(),
|
||||
std::vector<std::string> global_vars = std::vector<std::string>(), double max_rewind_age = 1.0);
|
||||
void init_state(Eigen::Map<Eigen::VectorXd> state, Eigen::Map<MatrixXdr> covs, double filter_time);
|
||||
|
||||
Eigen::VectorXd state();
|
||||
MatrixXdr covs();
|
||||
void set_filter_time(double t);
|
||||
double get_filter_time();
|
||||
void normalize_quaternions();
|
||||
void normalize_slice(int slice_start, int slice_end_ex);
|
||||
void set_global(std::string global_var, double val);
|
||||
void reset_rewind();
|
||||
|
||||
void predict(double t);
|
||||
std::optional<Estimate> predict_and_update_batch(double t, int kind, std::vector<Eigen::Map<Eigen::VectorXd>> z,
|
||||
std::vector<Eigen::Map<MatrixXdr>> R, std::vector<std::vector<double>> extra_args = {{}}, bool augment = false);
|
||||
|
||||
extra_routine_t get_extra_routine(const std::string& routine);
|
||||
|
||||
private:
|
||||
std::deque<Observation> rewind(double t);
|
||||
void checkpoint(Observation& obs);
|
||||
|
||||
Estimate predict_and_update_batch(Observation& obs, bool augment);
|
||||
Eigen::VectorXd update(int kind, Eigen::VectorXd z, MatrixXdr R, std::vector<double> extra_args);
|
||||
|
||||
// stuct with linked sympy generated functions
|
||||
const EKF *ekf = NULL;
|
||||
|
||||
Eigen::VectorXd x; // state
|
||||
MatrixXdr P; // covs
|
||||
|
||||
bool msckf;
|
||||
int N;
|
||||
int dim_augment;
|
||||
int dim_augment_err;
|
||||
int dim_main;
|
||||
int dim_main_err;
|
||||
|
||||
// state
|
||||
int dim_x;
|
||||
int dim_err;
|
||||
|
||||
double filter_time;
|
||||
|
||||
std::vector<int> maha_test_kinds;
|
||||
std::vector<int> quaternion_idxs;
|
||||
|
||||
std::vector<std::string> global_vars;
|
||||
|
||||
// process noise
|
||||
MatrixXdr Q;
|
||||
|
||||
// rewind stuff
|
||||
double max_rewind_age;
|
||||
std::deque<double> rewind_t;
|
||||
std::deque<std::pair<Eigen::VectorXd, MatrixXdr>> rewind_states;
|
||||
std::deque<Observation> rewind_obscache;
|
||||
|
||||
Eigen::VectorXd augment_times;
|
||||
|
||||
std::vector<int> feature_track_kinds;
|
||||
};
|
||||
|
||||
}
|
||||
+133
-55
@@ -7,7 +7,7 @@ import sympy as sp
|
||||
from numpy import dot
|
||||
|
||||
from rednose.helpers.sympy_helpers import sympy_into_c
|
||||
from rednose.helpers import (TEMPLATE_DIR, load_code, write_code)
|
||||
from rednose.helpers import TEMPLATE_DIR, load_code
|
||||
from rednose.helpers.chi2_lookup import chi2_ppf
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ def null(H, eps=1e-12):
|
||||
|
||||
|
||||
def gen_code(folder, name, f_sym, dt_sym, x_sym, obs_eqs, dim_x, dim_err, eskf_params=None, msckf_params=None, # pylint: disable=dangerous-default-value
|
||||
maha_test_kinds=[], global_vars=None):
|
||||
maha_test_kinds=[], quaternion_idxs=[], global_vars=None, extra_routines=[]):
|
||||
# optional state transition matrix, H modifier
|
||||
# and err_function if an error-state kalman filter (ESKF)
|
||||
# is desired. Best described in "Quaternion kinematics
|
||||
@@ -91,6 +91,9 @@ def gen_code(folder, name, f_sym, dt_sym, x_sym, obs_eqs, dim_x, dim_err, eskf_p
|
||||
# collect sympy functions
|
||||
sympy_functions = []
|
||||
|
||||
# extra routines
|
||||
sympy_functions += extra_routines
|
||||
|
||||
# error functions
|
||||
sympy_functions.append(('err_fun', err_eqs[0], [err_eqs[1], err_eqs[2]]))
|
||||
sympy_functions.append(('inv_err_fun', inv_err_eqs[0], [inv_err_eqs[1], inv_err_eqs[2]]))
|
||||
@@ -110,15 +113,26 @@ def gen_code(folder, name, f_sym, dt_sym, x_sym, obs_eqs, dim_x, dim_err, eskf_p
|
||||
sympy_functions.append(('He_%d' % kind, He_sym, [x_sym, ea_sym]))
|
||||
|
||||
# Generate and wrap all th c code
|
||||
header, code = sympy_into_c(sympy_functions, global_vars)
|
||||
extra_header = "#define DIM %d\n" % dim_x
|
||||
extra_header += "#define EDIM %d\n" % dim_err
|
||||
extra_header += "#define MEDIM %d\n" % dim_main_err
|
||||
extra_header += "typedef void (*Hfun)(double *, double *, double *);\n"
|
||||
sympy_header, code = sympy_into_c(sympy_functions, global_vars)
|
||||
|
||||
extra_header += "\nvoid predict(double *x, double *P, double *Q, double dt);"
|
||||
header = "#pragma once\n"
|
||||
header += "#include \"rednose/helpers/common_ekf.h\"\n"
|
||||
header += "extern \"C\" {\n"
|
||||
|
||||
extra_post = ""
|
||||
pre_code = f"#include \"{name}.h\"\n"
|
||||
pre_code += "\nnamespace {\n"
|
||||
pre_code += "#define DIM %d\n" % dim_x
|
||||
pre_code += "#define EDIM %d\n" % dim_err
|
||||
pre_code += "#define MEDIM %d\n" % dim_main_err
|
||||
pre_code += "typedef void (*Hfun)(double *, double *, double *);\n"
|
||||
|
||||
if global_vars is not None:
|
||||
for var in global_vars:
|
||||
pre_code += f"\ndouble {var.name};\n"
|
||||
pre_code += f"\nvoid set_{var.name}(double x){{ {var.name} = x;}}\n"
|
||||
|
||||
post_code = "\n}\n" # namespace
|
||||
post_code += "extern \"C\" {\n\n"
|
||||
|
||||
for h_sym, kind, ea_sym, H_sym, He_sym in obs_eqs:
|
||||
if msckf and kind in feature_track_kinds:
|
||||
@@ -129,36 +143,80 @@ def gen_code(folder, name, f_sym, dt_sym, x_sym, obs_eqs, dim_x, dim_err, eskf_p
|
||||
# ea_dim = 1 # not really dim of ea but makes c function work
|
||||
maha_thresh = chi2_ppf(0.95, int(h_sym.shape[0])) # mahalanobis distance for outlier detection
|
||||
maha_test = kind in maha_test_kinds
|
||||
extra_post += """
|
||||
void update_%d(double *in_x, double *in_P, double *in_z, double *in_R, double *in_ea) {
|
||||
update<%d,%d,%d>(in_x, in_P, h_%d, H_%d, %s, in_z, in_R, in_ea, MAHA_THRESH_%d);
|
||||
}
|
||||
""" % (kind, h_sym.shape[0], 3, maha_test, kind, kind, He_str, kind)
|
||||
extra_header += "\nconst static double MAHA_THRESH_%d = %f;" % (kind, maha_thresh)
|
||||
extra_header += "\nvoid update_%d(double *, double *, double *, double *, double *);" % kind
|
||||
|
||||
code += '\nextern "C"{\n' + extra_header + "\n}\n"
|
||||
code += "\n" + open(os.path.join(TEMPLATE_DIR, "ekf_c.c")).read()
|
||||
code += '\nextern "C"{\n' + extra_post + "\n}\n"
|
||||
pre_code += f"const static double MAHA_THRESH_{kind} = {maha_thresh};\n"
|
||||
|
||||
header += f"void {name}_update_{kind}(double *in_x, double *in_P, double *in_z, double *in_R, double *in_ea);\n"
|
||||
post_code += f"void {name}_update_{kind}(double *in_x, double *in_P, double *in_z, double *in_R, double *in_ea) {{\n"
|
||||
post_code += f" update<{h_sym.shape[0]}, 3, {int(maha_test)}>(in_x, in_P, h_{kind}, H_{kind}, {He_str}, in_z, in_R, in_ea, MAHA_THRESH_{kind});\n"
|
||||
post_code += "}\n"
|
||||
|
||||
# For ffi loading of specific functions
|
||||
for line in sympy_header.split("\n"):
|
||||
if line.startswith("void "): # sympy functions
|
||||
func_call = line[5: line.index(')') + 1]
|
||||
header += f"void {name}_{func_call};\n"
|
||||
post_code += f"void {name}_{func_call} {{\n"
|
||||
post_code += f" {func_call.replace('double *', '').replace('double', '')};\n"
|
||||
post_code += "}\n"
|
||||
header += f"void {name}_predict(double *in_x, double *in_P, double *in_Q, double dt);\n"
|
||||
post_code += f"void {name}_predict(double *in_x, double *in_P, double *in_Q, double dt) {{\n"
|
||||
post_code += " predict(in_x, in_P, in_Q, dt);\n"
|
||||
post_code += "}\n"
|
||||
if global_vars is not None:
|
||||
global_code = '\nextern "C"{\n'
|
||||
for var in global_vars:
|
||||
global_code += f"\ndouble {var.name};\n"
|
||||
global_code += f"\nvoid set_{var.name}(double x){{ {var.name} = x;}}\n"
|
||||
extra_header += f"\nvoid set_{var.name}(double x);\n"
|
||||
header += f"void {name}_set_{var.name}(double x);\n"
|
||||
post_code += f"void {name}_set_{var.name}(double x) {{\n"
|
||||
post_code += f" set_{var.name}(x);\n"
|
||||
post_code += "}\n"
|
||||
|
||||
global_code += '\n}\n'
|
||||
code = global_code + code
|
||||
post_code += "}\n\n" # extern c
|
||||
|
||||
header += "\n" + extra_header
|
||||
funcs = ['f_fun', 'F_fun', 'err_fun', 'inv_err_fun', 'H_mod_fun', 'predict']
|
||||
func_lists = {
|
||||
'h': [kind for _, kind, _, _, _ in obs_eqs],
|
||||
'H': [kind for _, kind, _, _, _ in obs_eqs],
|
||||
'update': [kind for _, kind, _, _, _ in obs_eqs],
|
||||
'He': [kind for _, kind, _, _, _ in obs_eqs if msckf and kind in feature_track_kinds],
|
||||
'set': [var.name for var in global_vars] if global_vars is not None else [],
|
||||
}
|
||||
func_extra = [x[0] for x in extra_routines]
|
||||
|
||||
write_code(folder, name, code, header)
|
||||
# For dynamic loading of specific functions
|
||||
post_code += f"const EKF {name} = {{\n"
|
||||
post_code += f" .name = \"{name}\",\n"
|
||||
post_code += f" .kinds = {{ {', '.join([str(kind) for _, kind, _, _, _ in obs_eqs])} }},\n"
|
||||
post_code += f" .feature_kinds = {{ {', '.join([str(kind) for _, kind, _, _, _ in obs_eqs if msckf and kind in feature_track_kinds])} }},\n"
|
||||
for func in funcs:
|
||||
post_code += f" .{func} = {name}_{func},\n"
|
||||
for group, kinds in func_lists.items():
|
||||
post_code += f" .{group}s = {{\n"
|
||||
for kind in kinds:
|
||||
str_kind = f"\"{kind}\"" if type(kind) == str else kind
|
||||
post_code += f" {{ {str_kind}, {name}_{group}_{kind} }},\n"
|
||||
post_code += " },\n"
|
||||
post_code += " .extra_routines = {\n"
|
||||
for f in func_extra:
|
||||
post_code += f" {{ \"{f}\", {name}_{f} }},\n"
|
||||
post_code += " },\n"
|
||||
post_code += "};\n\n"
|
||||
post_code += f"ekf_init({name});\n"
|
||||
|
||||
# merge code blocks
|
||||
header += "}"
|
||||
code = "\n".join([pre_code, code, open(os.path.join(TEMPLATE_DIR, "ekf_c.c")).read(), post_code])
|
||||
|
||||
# write to file
|
||||
if not os.path.exists(folder):
|
||||
os.mkdir(folder)
|
||||
|
||||
open(os.path.join(folder, f"{name}.h"), 'w').write(header) # header is used for ffi import
|
||||
open(os.path.join(folder, f"{name}.cpp"), 'w').write(code)
|
||||
|
||||
|
||||
class EKF_sym():
|
||||
def __init__(self, folder, name, Q, x_initial, P_initial, dim_main, dim_main_err, # pylint: disable=dangerous-default-value
|
||||
N=0, dim_augment=0, dim_augment_err=0, maha_test_kinds=[], global_vars=None, max_rewind_age=1.0, logger=logging):
|
||||
N=0, dim_augment=0, dim_augment_err=0, maha_test_kinds=[], quaternion_idxs=[], global_vars=None, max_rewind_age=1.0, logger=logging):
|
||||
"""Generates process function and all observation functions for the kalman filter."""
|
||||
self.msckf = N > 0
|
||||
self.N = N
|
||||
@@ -181,7 +239,8 @@ class EKF_sym():
|
||||
# tested for outlier rejection
|
||||
self.maha_test_kinds = maha_test_kinds
|
||||
|
||||
self.global_vars = global_vars
|
||||
# quaternions need normalization
|
||||
self.quaternion_idxs = quaternion_idxs
|
||||
|
||||
# process noise
|
||||
self.Q = Q
|
||||
@@ -193,25 +252,25 @@ class EKF_sym():
|
||||
self.rewind_obscache = []
|
||||
self.init_state(x_initial, P_initial, None)
|
||||
|
||||
ffi, lib = load_code(folder, name)
|
||||
ffi, lib = load_code(folder, name, "kf")
|
||||
kinds, self.feature_track_kinds = [], []
|
||||
for func in dir(lib):
|
||||
if func[:2] == 'h_':
|
||||
kinds.append(int(func[2:]))
|
||||
if func[:3] == 'He_':
|
||||
self.feature_track_kinds.append(int(func[3:]))
|
||||
if func[:len(name) + 3] == f'{name}_h_':
|
||||
kinds.append(int(func[len(name) + 3:]))
|
||||
if func[:len(name) + 4] == f'{name}_He_':
|
||||
self.feature_track_kinds.append(int(func[len(name) + 4:]))
|
||||
|
||||
# wrap all the sympy functions
|
||||
def wrap_1lists(name):
|
||||
func = eval("lib.%s" % name, {"lib": lib}) # pylint: disable=eval-used
|
||||
def wrap_1lists(func_name):
|
||||
func = eval(f"lib.{name}_{func_name}", {"lib": lib}) # pylint: disable=eval-used
|
||||
|
||||
def ret(lst1, out):
|
||||
func(ffi.cast("double *", lst1.ctypes.data),
|
||||
ffi.cast("double *", out.ctypes.data))
|
||||
return ret
|
||||
|
||||
def wrap_2lists(name):
|
||||
func = eval("lib.%s" % name, {"lib": lib}) # pylint: disable=eval-used
|
||||
def wrap_2lists(func_name):
|
||||
func = eval(f"lib.{name}_{func_name}", {"lib": lib}) # pylint: disable=eval-used
|
||||
|
||||
def ret(lst1, lst2, out):
|
||||
func(ffi.cast("double *", lst1.ctypes.data),
|
||||
@@ -219,8 +278,8 @@ class EKF_sym():
|
||||
ffi.cast("double *", out.ctypes.data))
|
||||
return ret
|
||||
|
||||
def wrap_1list_1float(name):
|
||||
func = eval("lib.%s" % name, {"lib": lib}) # pylint: disable=eval-used
|
||||
def wrap_1list_1float(func_name):
|
||||
func = eval(f"lib.{name}_{func_name}", {"lib": lib}) # pylint: disable=eval-used
|
||||
|
||||
def ret(lst1, fl, out):
|
||||
func(ffi.cast("double *", lst1.ctypes.data),
|
||||
@@ -237,27 +296,28 @@ class EKF_sym():
|
||||
|
||||
self.hs, self.Hs, self.Hes = {}, {}, {}
|
||||
for kind in kinds:
|
||||
self.hs[kind] = wrap_2lists("h_%d" % kind)
|
||||
self.Hs[kind] = wrap_2lists("H_%d" % kind)
|
||||
self.hs[kind] = wrap_2lists(f"h_{kind}")
|
||||
self.Hs[kind] = wrap_2lists(f"H_{kind}")
|
||||
if self.msckf and kind in self.feature_track_kinds:
|
||||
self.Hes[kind] = wrap_2lists("He_%d" % kind)
|
||||
self.Hes[kind] = wrap_2lists(f"He_{kind}")
|
||||
|
||||
if self.global_vars is not None:
|
||||
for var in self.global_vars:
|
||||
fun_name = f"set_{var.name}"
|
||||
setattr(self, fun_name, getattr(lib, fun_name))
|
||||
self.set_globals = {}
|
||||
if global_vars is not None:
|
||||
for global_var in global_vars:
|
||||
self.set_globals[global_var] = getattr(lib, f"{name}_set_{global_var}")
|
||||
|
||||
# wrap the C++ predict function
|
||||
def _predict_blas(x, P, dt):
|
||||
lib.predict(ffi.cast("double *", x.ctypes.data),
|
||||
ffi.cast("double *", P.ctypes.data),
|
||||
ffi.cast("double *", self.Q.ctypes.data),
|
||||
ffi.cast("double", dt))
|
||||
func = eval(f"lib.{name}_predict", {"lib": lib}) # pylint: disable=eval-used
|
||||
func(ffi.cast("double *", x.ctypes.data),
|
||||
ffi.cast("double *", P.ctypes.data),
|
||||
ffi.cast("double *", self.Q.ctypes.data),
|
||||
ffi.cast("double", dt))
|
||||
return x, P
|
||||
|
||||
# wrap the C++ update function
|
||||
def fun_wrapper(f, kind):
|
||||
f = eval("lib.%s" % f, {"lib": lib}) # pylint: disable=eval-used
|
||||
f = eval(f"lib.{name}_{f}", {"lib": lib}) # pylint: disable=eval-used
|
||||
|
||||
def _update_inner_blas(x, P, z, R, extra_args):
|
||||
f(ffi.cast("double *", x.ctypes.data),
|
||||
@@ -333,6 +393,25 @@ class EKF_sym():
|
||||
def covs(self):
|
||||
return self.P
|
||||
|
||||
def set_filter_time(self, t):
|
||||
self.filter_time = t
|
||||
|
||||
def get_filter_time(self):
|
||||
return self.filter_time
|
||||
|
||||
def normalize_quaternions(self):
|
||||
for idx in self.quaternion_idxs:
|
||||
self.normalize_slice(idx, idx+4)
|
||||
|
||||
def normalize_slice(self, slice_start, slice_end_ex):
|
||||
self.x[slice_start:slice_end_ex] /= np.linalg.norm(self.x[slice_start:slice_end_ex])
|
||||
|
||||
def get_augment_times(self):
|
||||
return self.augment_times
|
||||
|
||||
def set_global(self, global_var, val):
|
||||
self.set_globals[global_var](val)
|
||||
|
||||
def rewind(self, t):
|
||||
# find where we are rewinding to
|
||||
idx = bisect_right(self.rewind_t, t)
|
||||
@@ -376,6 +455,7 @@ class EKF_sym():
|
||||
dt = t - self.filter_time
|
||||
assert dt >= 0
|
||||
self.x, self.P = self._predict(self.x, self.P, dt)
|
||||
self.normalize_quaternions()
|
||||
self.filter_time = t
|
||||
|
||||
def predict_and_update_batch(self, t, kind, z, R, extra_args=[[]], augment=False): # pylint: disable=dangerous-default-value
|
||||
@@ -401,11 +481,9 @@ class EKF_sym():
|
||||
def _predict_and_update_batch(self, t, kind, z, R, extra_args, augment=False):
|
||||
"""The main kalman filter function
|
||||
Predicts the state and then updates a batch of observations
|
||||
|
||||
dim_x: dimensionality of the state space
|
||||
dim_z: dimensionality of the observation and depends on kind
|
||||
n: number of observations
|
||||
|
||||
Args:
|
||||
t (float): Time of observation
|
||||
kind (int): Type of observation
|
||||
@@ -437,6 +515,7 @@ class EKF_sym():
|
||||
extra_args_i = np.array(extra_args[i], dtype=np.float64, order='F')
|
||||
# update
|
||||
self.x, self.P, y_i = self._update(self.x, self.P, kind, z_i, R_i, extra_args=extra_args_i)
|
||||
self.normalize_quaternions()
|
||||
y.append(y_i)
|
||||
xk_k, Pk_k = np.copy(self.x).flatten(), np.copy(self.P)
|
||||
|
||||
@@ -570,7 +649,6 @@ class EKF_sym():
|
||||
'''
|
||||
Returns rts smoothed results of
|
||||
kalman filter estimates
|
||||
|
||||
If the kalman state is augmented with
|
||||
old states only the main state is smoothed
|
||||
'''
|
||||
|
||||
@@ -0,0 +1,190 @@
|
||||
# cython: language_level=3
|
||||
# cython: profile=True
|
||||
# distutils: language = c++
|
||||
|
||||
cimport cython
|
||||
|
||||
from libcpp.string cimport string
|
||||
from libcpp.vector cimport vector
|
||||
from libcpp cimport bool
|
||||
cimport numpy as np
|
||||
|
||||
import numpy as np
|
||||
|
||||
cdef extern from "<optional>" namespace "std" nogil:
|
||||
cdef cppclass optional[T]:
|
||||
ctypedef T value_type
|
||||
bool has_value()
|
||||
T& value()
|
||||
|
||||
cdef extern from "rednose/helpers/ekf_sym.h" namespace "EKFS":
|
||||
cdef cppclass MapVectorXd "Eigen::Map<Eigen::VectorXd>":
|
||||
MapVectorXd(double*, int)
|
||||
|
||||
cdef cppclass MapMatrixXdr "Eigen::Map<Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> >":
|
||||
MapMatrixXdr(double*, int, int)
|
||||
|
||||
cdef cppclass VectorXd "Eigen::VectorXd":
|
||||
VectorXd()
|
||||
double* data()
|
||||
int rows()
|
||||
|
||||
cdef cppclass MatrixXdr "Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>":
|
||||
MatrixXdr()
|
||||
double* data()
|
||||
int rows()
|
||||
int cols()
|
||||
|
||||
ctypedef struct Estimate:
|
||||
VectorXd xk1
|
||||
VectorXd xk
|
||||
MatrixXdr Pk1
|
||||
MatrixXdr Pk
|
||||
double t
|
||||
int kind
|
||||
vector[VectorXd] y
|
||||
vector[VectorXd] z
|
||||
vector[vector[double]] extra_args
|
||||
|
||||
cdef cppclass EKFSym:
|
||||
EKFSym(string name, MapMatrixXdr Q, MapVectorXd x_initial, MapMatrixXdr P_initial, int dim_main,
|
||||
int dim_main_err, int N, int dim_augment, int dim_augment_err, vector[int] maha_test_kinds,
|
||||
vector[int] quaternion_idxs, vector[string] global_vars, double max_rewind_age)
|
||||
void init_state(MapVectorXd state, MapMatrixXdr covs, double filter_time)
|
||||
|
||||
VectorXd state()
|
||||
MatrixXdr covs()
|
||||
void set_filter_time(double t)
|
||||
double get_filter_time()
|
||||
void set_global(string name, double val)
|
||||
void reset_rewind()
|
||||
|
||||
void predict(double t)
|
||||
optional[Estimate] predict_and_update_batch(double t, int kind, vector[MapVectorXd] z, vector[MapMatrixXdr] z,
|
||||
vector[vector[double]] extra_args, bool augment)
|
||||
|
||||
# Functions like `numpy_to_matrix` are not possible, cython requires default
|
||||
# constructor for return variable types which aren't available with Eigen::Map
|
||||
|
||||
@cython.wraparound(False)
|
||||
@cython.boundscheck(False)
|
||||
cdef np.ndarray[np.float64_t, ndim=2, mode="c"] matrix_to_numpy(MatrixXdr arr):
|
||||
cdef double[:,:] mem_view = <double[:arr.rows(),:arr.cols()]>arr.data()
|
||||
return np.copy(np.asarray(mem_view, dtype=np.double, order="C"))
|
||||
|
||||
@cython.wraparound(False)
|
||||
@cython.boundscheck(False)
|
||||
cdef np.ndarray[np.float64_t, ndim=1, mode="c"] vector_to_numpy(VectorXd arr):
|
||||
cdef double[:] mem_view = <double[:arr.rows()]>arr.data()
|
||||
return np.copy(np.asarray(mem_view, dtype=np.double, order="C"))
|
||||
|
||||
cdef class EKF_sym:
|
||||
cdef EKFSym* ekf
|
||||
def __cinit__(self, str gen_dir, str name, np.ndarray[np.float64_t, ndim=2] Q,
|
||||
np.ndarray[np.float64_t, ndim=1] x_initial, np.ndarray[np.float64_t, ndim=2] P_initial, int dim_main,
|
||||
int dim_main_err, int N=0, int dim_augment=0, int dim_augment_err=0, list maha_test_kinds=[],
|
||||
list quaternion_idxs=[], list global_vars=[], double max_rewind_age=1.0, logger=None):
|
||||
# TODO logger
|
||||
|
||||
cdef np.ndarray[np.float64_t, ndim=2, mode='c'] Q_b = np.ascontiguousarray(Q, dtype=np.double)
|
||||
cdef np.ndarray[np.float64_t, ndim=1, mode='c'] x_initial_b = np.ascontiguousarray(x_initial, dtype=np.double)
|
||||
cdef np.ndarray[np.float64_t, ndim=2, mode='c'] P_initial_b = np.ascontiguousarray(P_initial, dtype=np.double)
|
||||
self.ekf = new EKFSym(
|
||||
name.encode('utf8'),
|
||||
MapMatrixXdr(<double*> Q_b.data, Q.shape[0], Q.shape[1]),
|
||||
MapVectorXd(<double*> x_initial_b.data, x_initial.shape[0]),
|
||||
MapMatrixXdr(<double*> P_initial_b.data, P_initial.shape[0], P_initial.shape[1]),
|
||||
dim_main,
|
||||
dim_main_err,
|
||||
N,
|
||||
dim_augment,
|
||||
dim_augment_err,
|
||||
maha_test_kinds,
|
||||
quaternion_idxs,
|
||||
[x.encode('utf8') for x in global_vars],
|
||||
max_rewind_age
|
||||
)
|
||||
|
||||
def init_state(self, np.ndarray[np.float64_t, ndim=1] state, np.ndarray[np.float64_t, ndim=2] covs, filter_time):
|
||||
cdef np.ndarray[np.float64_t, ndim=1, mode='c'] state_b = np.ascontiguousarray(state, dtype=np.double)
|
||||
cdef np.ndarray[np.float64_t, ndim=2, mode='c'] covs_b = np.ascontiguousarray(covs, dtype=np.double)
|
||||
self.ekf.init_state(
|
||||
MapVectorXd(<double*> state_b.data, state.shape[0]),
|
||||
MapMatrixXdr(<double*> covs_b.data, covs.shape[0], covs.shape[1]),
|
||||
np.nan if filter_time is None else filter_time
|
||||
)
|
||||
|
||||
def state(self):
|
||||
cdef np.ndarray res = vector_to_numpy(self.ekf.state())
|
||||
return res
|
||||
|
||||
def covs(self):
|
||||
return matrix_to_numpy(self.ekf.covs())
|
||||
|
||||
def set_filter_time(self, double t):
|
||||
self.ekf.set_filter_time(t)
|
||||
|
||||
def get_filter_time(self):
|
||||
return self.ekf.get_filter_time()
|
||||
|
||||
def set_global(self, str global_var, double val):
|
||||
self.ekf.set_global(global_var.encode('utf8'), val)
|
||||
|
||||
def reset_rewind(self):
|
||||
self.ekf.reset_rewind()
|
||||
|
||||
def predict(self, double t):
|
||||
self.ekf.predict(t)
|
||||
|
||||
def predict_and_update_batch(self, double t, int kind, z, R, extra_args=[[]], bool augment=False):
|
||||
cdef vector[MapVectorXd] z_map
|
||||
cdef np.ndarray[np.float64_t, ndim=1, mode='c'] zi_b
|
||||
for zi in z:
|
||||
zi_b = np.ascontiguousarray(zi, dtype=np.double)
|
||||
z_map.push_back(MapVectorXd(<double*> zi_b.data, zi.shape[0]))
|
||||
|
||||
cdef vector[MapMatrixXdr] R_map
|
||||
cdef np.ndarray[np.float64_t, ndim=2, mode='c'] Ri_b
|
||||
for Ri in R:
|
||||
Ri_b = np.ascontiguousarray(Ri, dtype=np.double)
|
||||
R_map.push_back(MapMatrixXdr(<double*> Ri_b.data, Ri.shape[0], Ri.shape[1]))
|
||||
|
||||
cdef vector[vector[double]] extra_args_map
|
||||
cdef vector[double] args_map
|
||||
for args in extra_args:
|
||||
args_map.clear()
|
||||
for a in args:
|
||||
args_map.push_back(a)
|
||||
extra_args_map.push_back(args_map)
|
||||
|
||||
cdef optional[Estimate] res = self.ekf.predict_and_update_batch(t, kind, z_map, R_map, extra_args_map, augment)
|
||||
if not res.has_value():
|
||||
return None
|
||||
|
||||
cdef VectorXd tmpvec
|
||||
return (
|
||||
vector_to_numpy(res.value().xk1),
|
||||
vector_to_numpy(res.value().xk),
|
||||
matrix_to_numpy(res.value().Pk1),
|
||||
matrix_to_numpy(res.value().Pk),
|
||||
res.value().t,
|
||||
res.value().kind,
|
||||
[vector_to_numpy(tmpvec) for tmpvec in res.value().y],
|
||||
z, # TODO: take return values?
|
||||
extra_args,
|
||||
)
|
||||
|
||||
def augment(self):
|
||||
raise NotImplementedError() # TODO
|
||||
|
||||
def get_augment_times(self):
|
||||
raise NotImplementedError() # TODO
|
||||
|
||||
def rts_smooth(self, estimates, norm_quats=False):
|
||||
raise NotImplementedError() # TODO
|
||||
|
||||
def maha_test(self, x, P, kind, z, R, extra_args=[], maha_thresh=0.95):
|
||||
raise NotImplementedError() # TODO
|
||||
|
||||
def __dealloc__(self):
|
||||
del self.ekf
|
||||
@@ -35,7 +35,9 @@ class FeatureHandler():
|
||||
c_code = "#include <math.h>\n"
|
||||
c_code += "#include <string.h>\n"
|
||||
c_code += "#define K %d\n" % K
|
||||
c_code += "extern \"C\" {\n"
|
||||
c_code += "\n" + open(os.path.join(TEMPLATE_DIR, "feature_handler.c")).read()
|
||||
c_code += "\n}\n"
|
||||
|
||||
filename = f"{FeatureHandler.name}_{K}"
|
||||
write_code(generated_dir, filename, c_code, c_header)
|
||||
|
||||
@@ -2,8 +2,6 @@ from typing import Any, Dict
|
||||
|
||||
import numpy as np
|
||||
|
||||
from rednose.helpers.ekf_sym import EKF_sym
|
||||
|
||||
|
||||
class KalmanFilter:
|
||||
name = "<name>"
|
||||
@@ -12,12 +10,7 @@ class KalmanFilter:
|
||||
Q = np.zeros((0, 0))
|
||||
obs_noise: Dict[int, Any] = {}
|
||||
|
||||
def __init__(self, generated_dir):
|
||||
dim_state = self.initial_x.shape[0]
|
||||
dim_state_err = self.initial_P_diag.shape[0]
|
||||
|
||||
# init filter
|
||||
self.filter = EKF_sym(generated_dir, self.name, self.Q, self.initial_x, np.diag(self.initial_P_diag), dim_state, dim_state_err)
|
||||
filter = None # Should be initialized when initializating a KalmanFilter implementation
|
||||
|
||||
@property
|
||||
def x(self):
|
||||
@@ -25,7 +18,7 @@ class KalmanFilter:
|
||||
|
||||
@property
|
||||
def t(self):
|
||||
return self.filter.filter_time
|
||||
return self.filter.get_filter_time()
|
||||
|
||||
@property
|
||||
def P(self):
|
||||
@@ -48,14 +48,16 @@ class LstSqComputer():
|
||||
@staticmethod
|
||||
def generate_code(generated_dir, K=4):
|
||||
sympy_functions = generate_residual(K)
|
||||
header, code = sympy_into_c(sympy_functions)
|
||||
header, sympy_code = sympy_into_c(sympy_functions)
|
||||
|
||||
code = "\n#include \"rednose/helpers/common_ekf.h\"\n"
|
||||
code += "\n#define KDIM %d\n" % K
|
||||
code += "\n" + open(os.path.join(TEMPLATE_DIR, "compute_pos.c")).read()
|
||||
code += "extern \"C\" {\n"
|
||||
code += sympy_code
|
||||
code += "\n" + open(os.path.join(TEMPLATE_DIR, "compute_pos.c")).read() + "\n"
|
||||
code += "}\n"
|
||||
|
||||
header += """
|
||||
void compute_pos(double *to_c, double *in_poses, double *in_img_positions, double *param, double *pos);
|
||||
"""
|
||||
header += "\nvoid compute_pos(double *to_c, double *in_poses, double *in_img_positions, double *param, double *pos);\n"
|
||||
|
||||
filename = f"{LstSqComputer.name}_{K}"
|
||||
write_code(generated_dir, filename, code, header)
|
||||
|
||||
@@ -151,6 +151,5 @@ def sympy_into_c(sympy_functions, global_vars=None):
|
||||
c_header = '\n'.join(x for x in c_header.split("\n") if len(x) > 0 and x[0] != '#')
|
||||
|
||||
c_code = '\n'.join(x for x in c_code.split("\n") if len(x) > 0 and x[0] != '#')
|
||||
c_code = 'extern "C" {\n#include <math.h>\n' + c_code + "\n}\n"
|
||||
|
||||
return c_header, c_code
|
||||
|
||||
@@ -7,7 +7,6 @@ typedef Eigen::Matrix<double, KDIM*2, 1> R1M;
|
||||
typedef Eigen::Matrix<double, 3, 1> O1M;
|
||||
typedef Eigen::Matrix<double, 3, 3, Eigen::RowMajor> M3D;
|
||||
|
||||
extern "C" {
|
||||
void gauss_newton(double *in_x, double *in_poses, double *in_img_positions) {
|
||||
|
||||
double res[KDIM*2] = {0};
|
||||
@@ -51,4 +50,3 @@ void compute_pos(double *to_c, double *poses, double *img_positions, double *par
|
||||
ecef_output = rot*ecef_output + ecef_offset;
|
||||
memcpy(pos, ecef_output.data(), 3 * sizeof(double));
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user