mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-08-25 10:13:43 +08:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c39abc00af | |||
| cfd8323ccb | |||
| bcd4bb4821 | |||
| 75c97aaf3f | |||
| b47ad523a3 |
+4
-3
@@ -36,6 +36,7 @@ a.out
|
||||
config.json
|
||||
clcache
|
||||
compile_commands.json
|
||||
compare_runtime*.html
|
||||
|
||||
persist
|
||||
board/obj/
|
||||
@@ -45,12 +46,10 @@ selfdrive/mapd/default_speeds_by_region.json
|
||||
system/proclogd/proclogd
|
||||
selfdrive/ui/_ui
|
||||
selfdrive/test/longitudinal_maneuvers/out
|
||||
selfdrive/visiond/visiond
|
||||
selfdrive/sensord/_gpsd
|
||||
selfdrive/sensord/_sensord
|
||||
system/camerad/camerad
|
||||
system/camerad/test/ae_gray_test
|
||||
selfdrive/modeld/_modeld
|
||||
selfdrive/modeld/_navmodeld
|
||||
selfdrive/modeld/_dmonitoringmodeld
|
||||
/src/
|
||||
|
||||
@@ -82,3 +81,5 @@ selfdrive/modeld/models/*.thneed
|
||||
build/
|
||||
|
||||
!**/.gitkeep
|
||||
|
||||
poetry.toml
|
||||
|
||||
Vendored
+85
-16
@@ -11,11 +11,17 @@ export SOURCE_DIR=${env.SOURCE_DIR}
|
||||
export GIT_BRANCH=${env.GIT_BRANCH}
|
||||
export GIT_COMMIT=${env.GIT_COMMIT}
|
||||
export AZURE_TOKEN='${env.AZURE_TOKEN}'
|
||||
export MAPBOX_TOKEN='${env.MAPBOX_TOKEN}'
|
||||
|
||||
export GIT_SSH_COMMAND="ssh -i /data/gitkey"
|
||||
|
||||
source ~/.bash_profile
|
||||
if [ -f /TICI ]; then
|
||||
source /etc/profile
|
||||
fi
|
||||
if [ -f /data/openpilot/launch_env.sh ]; then
|
||||
source /data/openpilot/launch_env.sh
|
||||
fi
|
||||
|
||||
ln -snf ${env.TEST_DIR} /data/pythonpath
|
||||
|
||||
@@ -47,20 +53,34 @@ pipeline {
|
||||
TEST_DIR = "/data/openpilot"
|
||||
SOURCE_DIR = "/data/openpilot_source/"
|
||||
AZURE_TOKEN = credentials('azure_token')
|
||||
MAPBOX_TOKEN = credentials('mapbox_token')
|
||||
}
|
||||
options {
|
||||
timeout(time: 4, unit: 'HOURS')
|
||||
timeout(time: 3, unit: 'HOURS')
|
||||
disableConcurrentBuilds(abortPrevious: env.BRANCH_NAME != 'master')
|
||||
}
|
||||
|
||||
stages {
|
||||
stage('build release3') {
|
||||
stage('build release3-staging') {
|
||||
agent { docker { image 'ghcr.io/commaai/alpine-ssh'; args '--user=root' } }
|
||||
when {
|
||||
branch 'devel-staging'
|
||||
}
|
||||
steps {
|
||||
phone_steps("tici", [
|
||||
["build release3-staging & dashcam3-staging", "PUSH=1 $SOURCE_DIR/release/build_release.sh"],
|
||||
phone_steps("tici-needs-can", [
|
||||
["build release3-staging & dashcam3-staging", "RELEASE_BRANCH=release3-staging DASHCAM_BRANCH=dashcam3-staging $SOURCE_DIR/release/build_release.sh"],
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
stage('build nightly') {
|
||||
agent { docker { image 'ghcr.io/commaai/alpine-ssh'; args '--user=root' } }
|
||||
when {
|
||||
branch 'master-ci'
|
||||
}
|
||||
steps {
|
||||
phone_steps("tici-needs-can", [
|
||||
["build nightly", "RELEASE_BRANCH=nightly $SOURCE_DIR/release/build_release.sh"],
|
||||
])
|
||||
}
|
||||
}
|
||||
@@ -78,6 +98,7 @@ pipeline {
|
||||
|
||||
parallel {
|
||||
|
||||
/*
|
||||
stage('simulator') {
|
||||
agent {
|
||||
dockerfile {
|
||||
@@ -87,7 +108,8 @@ pipeline {
|
||||
}
|
||||
}
|
||||
steps {
|
||||
sh "git config --global --add safe.directory ${WORKSPACE}"
|
||||
sh "git config --global --add safe.directory '*'"
|
||||
sh "git submodule update --init --recursive"
|
||||
sh "git lfs pull"
|
||||
lock(resource: "", label: "simulator", inversePrecedence: true, quantity: 1) {
|
||||
sh "${WORKSPACE}/tools/sim/build_container.sh"
|
||||
@@ -104,6 +126,22 @@ pipeline {
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
stage('tizi-tests') {
|
||||
agent { docker { image 'ghcr.io/commaai/alpine-ssh'; args '--user=root' } }
|
||||
steps {
|
||||
phone_steps("tizi", [
|
||||
["build openpilot", "cd selfdrive/manager && ./build.py"],
|
||||
["test boardd loopback", "SINGLE_PANDA=1 python selfdrive/boardd/tests/test_boardd_loopback.py"],
|
||||
["test pandad", "python selfdrive/boardd/tests/test_pandad.py"],
|
||||
["test sensord", "cd system/sensord/tests && python -m unittest test_sensord.py"],
|
||||
["test camerad", "python system/camerad/test/test_camerad.py"],
|
||||
["test exposure", "python system/camerad/test/test_exposure.py"],
|
||||
["test amp", "python system/hardware/tici/tests/test_amplifier.py"],
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
stage('build') {
|
||||
agent { docker { image 'ghcr.io/commaai/alpine-ssh'; args '--user=root' } }
|
||||
@@ -111,27 +149,38 @@ pipeline {
|
||||
R3_PUSH = "${env.BRANCH_NAME == 'master' ? '1' : ' '}"
|
||||
}
|
||||
steps {
|
||||
phone_steps("tici", [
|
||||
phone_steps("tici-needs-can", [
|
||||
["build master-ci", "cd $SOURCE_DIR/release && TARGET_DIR=$TEST_DIR EXTRA_FILES='tools/' ./build_devel.sh"],
|
||||
["build openpilot", "cd selfdrive/manager && ./build.py"],
|
||||
["check dirty", "release/check-dirty.sh"],
|
||||
["test manager", "python selfdrive/manager/test/test_manager.py"],
|
||||
["onroad tests", "cd selfdrive/test/ && ./test_onroad.py"],
|
||||
["time to onroad", "cd selfdrive/test/ && pytest test_time_to_onroad.py"],
|
||||
["test car interfaces", "cd selfdrive/car/tests/ && ./test_car_interfaces.py"],
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
stage('loopback-tests') {
|
||||
agent { docker { image 'ghcr.io/commaai/alpine-ssh'; args '--user=root' } }
|
||||
steps {
|
||||
phone_steps("tici-loopback", [
|
||||
["build openpilot", "cd selfdrive/manager && ./build.py"],
|
||||
["test boardd loopback", "python selfdrive/boardd/tests/test_boardd_loopback.py"],
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
stage('HW + Unit Tests') {
|
||||
agent { docker { image 'ghcr.io/commaai/alpine-ssh'; args '--user=root' } }
|
||||
steps {
|
||||
phone_steps("tici2", [
|
||||
phone_steps("tici-common", [
|
||||
["build", "cd selfdrive/manager && ./build.py"],
|
||||
//["test power draw", "python system/hardware/tici/test_power_draw.py"],
|
||||
["test boardd loopback", "python selfdrive/boardd/tests/test_boardd_loopback.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"],
|
||||
["test sensord", "python selfdrive/sensord/test/test_sensord.py"],
|
||||
["test pandad", "python selfdrive/boardd/tests/test_pandad.py"],
|
||||
["test power draw", "python system/hardware/tici/tests/test_power_draw.py"],
|
||||
["test loggerd", "python system/loggerd/tests/test_loggerd.py"],
|
||||
["test encoder", "LD_LIBRARY_PATH=/usr/local/lib python system/loggerd/tests/test_encoder.py"],
|
||||
["test pigeond", "python system/sensord/tests/test_pigeond.py"],
|
||||
["test manager", "python selfdrive/manager/test/test_manager.py"],
|
||||
])
|
||||
}
|
||||
}
|
||||
@@ -139,7 +188,12 @@ pipeline {
|
||||
stage('camerad') {
|
||||
agent { docker { image 'ghcr.io/commaai/alpine-ssh'; args '--user=root' } }
|
||||
steps {
|
||||
phone_steps("tici-party", [
|
||||
phone_steps("tici-ar0231", [
|
||||
["build", "cd selfdrive/manager && ./build.py"],
|
||||
["test camerad", "python system/camerad/test/test_camerad.py"],
|
||||
["test exposure", "python system/camerad/test/test_exposure.py"],
|
||||
])
|
||||
phone_steps("tici-ox03c10", [
|
||||
["build", "cd selfdrive/manager && ./build.py"],
|
||||
["test camerad", "python system/camerad/test/test_camerad.py"],
|
||||
["test exposure", "python system/camerad/test/test_exposure.py"],
|
||||
@@ -147,17 +201,32 @@ pipeline {
|
||||
}
|
||||
}
|
||||
|
||||
stage('sensord') {
|
||||
agent { docker { image 'ghcr.io/commaai/alpine-ssh'; args '--user=root' } }
|
||||
steps {
|
||||
phone_steps("tici-lsmc", [
|
||||
["build", "cd selfdrive/manager && ./build.py"],
|
||||
["test sensord", "cd system/sensord/tests && python -m unittest test_sensord.py"],
|
||||
])
|
||||
phone_steps("tici-bmx-lsm", [
|
||||
["build", "cd selfdrive/manager && ./build.py"],
|
||||
["test sensord", "cd system/sensord/tests && python -m unittest test_sensord.py"],
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
stage('replay') {
|
||||
agent { docker { image 'ghcr.io/commaai/alpine-ssh'; args '--user=root' } }
|
||||
steps {
|
||||
phone_steps("tici3", [
|
||||
phone_steps("tici-common", [
|
||||
["build", "cd selfdrive/manager && ./build.py"],
|
||||
["model replay", "cd selfdrive/test/process_replay && ./model_replay.py"],
|
||||
])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ To use openpilot in a car, you need four things
|
||||
* A supported device to run this software: a [comma three](https://comma.ai/shop/products/three).
|
||||
* This software. The setup procedure of the comma three allows the user to enter a URL for custom software.
|
||||
The URL, openpilot.comma.ai will install the release version of openpilot. To install openpilot master, you can use installer.comma.ai/commaai/master, and replacing commaai with another GitHub username can install a fork.
|
||||
* One of [the 150+ supported cars](docs/CARS.md). We support Honda, Toyota, Hyundai, Nissan, Kia, Chrysler, Lexus, Acura, Audi, VW, and more. If your car is not supported but has adaptive cruise control and lane-keeping assist, it's likely able to run openpilot.
|
||||
* One of [the 250+ supported cars](docs/CARS.md). We support Honda, Toyota, Hyundai, Nissan, Kia, Chrysler, Lexus, Acura, Audi, VW, Ford and more. If your car is not supported but has adaptive cruise control and lane-keeping assist, it's likely able to run openpilot.
|
||||
* A [car harness](https://comma.ai/shop/products/car-harness) to connect to your car.
|
||||
|
||||
We have detailed instructions for [how to mount the device in a car](https://comma.ai/setup).
|
||||
@@ -50,7 +50,7 @@ We have detailed instructions for [how to mount the device in a car](https://com
|
||||
Running on PC
|
||||
------
|
||||
|
||||
All of openpilot's services can run as normal on a PC, even without special hardware or a car. To develop or experiment with openpilot you can run openpilot on recorded or simulated data.
|
||||
All openpilot services can run as usual on a PC without requiring special hardware or a car. You can also run openpilot on recorded or simulated data to develop or experiment with openpilot.
|
||||
|
||||
With openpilot's tools, you can plot logs, replay drives, and watch the full-res camera streams. See [the tools README](tools/README.md) for more information.
|
||||
|
||||
@@ -67,7 +67,7 @@ Documentation related to openpilot development can be found on [docs.comma.ai](h
|
||||
|
||||
You can add support for your car by following guides we have written for [Brand](https://blog.comma.ai/how-to-write-a-car-port-for-openpilot/) and [Model](https://blog.comma.ai/openpilot-port-guide-for-toyota-models/) ports. Generally, a car with adaptive cruise control and lane keep assist is a good candidate. [Join our Discord](https://discord.comma.ai) to discuss car ports: most car makes have a dedicated channel.
|
||||
|
||||
Want to get paid to work on openpilot? [comma is hiring](https://comma.ai/jobs/).
|
||||
Want to get paid to work on openpilot? [comma is hiring](https://comma.ai/jobs#open-positions).
|
||||
|
||||
And [follow us on Twitter](https://twitter.com/comma_ai).
|
||||
|
||||
@@ -103,13 +103,15 @@ Directory Structure
|
||||
├── opendbc # Files showing how to interpret data from cars
|
||||
├── panda # Code used to communicate on CAN
|
||||
├── third_party # External libraries
|
||||
├── pyextra # Extra python packages
|
||||
└── system # Generic services
|
||||
├── camerad # Driver to capture images from the camera sensors
|
||||
├── clocksd # Broadcasts current time
|
||||
├── hardware # Hardware abstraction classes
|
||||
├── logcatd # systemd journal as a service
|
||||
└── proclogd # Logs information from /proc
|
||||
├── loggerd # Logger and uploader of car data
|
||||
├── proclogd # Logs information from /proc
|
||||
├── sensord # IMU interface code
|
||||
└── ubloxd # u-blox GNSS module interface code
|
||||
└── selfdrive # Code needed to drive the car
|
||||
├── assets # Fonts, images, and sounds for UI
|
||||
├── athena # Allows communication with the app
|
||||
@@ -118,12 +120,10 @@ Directory Structure
|
||||
├── controls # Planning and controls
|
||||
├── debug # Tools to help you debug and do car ports
|
||||
├── locationd # Precise localization and vehicle parameter estimation
|
||||
├── loggerd # Logger and uploader of car data
|
||||
├── manager # Deamon that starts/stops all other daemons as needed
|
||||
├── manager # Daemon that starts/stops all other daemons as needed
|
||||
├── modeld # Driving and monitoring model runners
|
||||
├── monitoring # Daemon to determine driver attention
|
||||
├── navd # Turn-by-turn navigation
|
||||
├── sensord # IMU interface code
|
||||
├── test # Unit tests, system tests, and a car simulator
|
||||
└── ui # The UI
|
||||
|
||||
@@ -143,7 +143,4 @@ NO WARRANTY EXPRESSED OR IMPLIED.**
|
||||
<img src="https://d1qb2nb5cznatu.cloudfront.net/startups/i/1061157-bc7e9bf3b246ece7322e6ffe653f6af8-medium_jpg.jpg?buster=1458363130" width="75"></img> <img src="https://cdn-images-1.medium.com/max/1600/1*C87EjxGeMPrkTuVRVWVg4w.png" width="225"></img>
|
||||
|
||||
[](https://github.com/commaai/openpilot/actions)
|
||||
[](https://lgtm.com/projects/g/commaai/openpilot/alerts/)
|
||||
[](https://lgtm.com/projects/g/commaai/openpilot/context:python)
|
||||
[](https://lgtm.com/projects/g/commaai/openpilot/context:cpp)
|
||||
[](https://codecov.io/gh/commaai/openpilot)
|
||||
|
||||
+97
-3
@@ -1,3 +1,97 @@
|
||||
Version 0.9.3 (2023-06-29)
|
||||
========================
|
||||
* New driving model
|
||||
* Improved height estimation and added height tracking in liveCalibration
|
||||
* Model inputs refactor
|
||||
* New driving personality setting
|
||||
* Three settings: aggressive, standard, and relaxed
|
||||
* Standard is recommended and the default
|
||||
* In aggressive mode, lead follow distance is shorter and acceleration response is quicker
|
||||
* In relaxed mode, lead follow distance is longer
|
||||
* Improved fuzzy fingerprinting for Hyundai, Kia, and Genesis
|
||||
* Improved thermal management logic
|
||||
|
||||
Version 0.9.2 (2023-05-22)
|
||||
========================
|
||||
* New driving model
|
||||
* Reduced turn diving
|
||||
* Trained on a new dataset
|
||||
* UI updates
|
||||
* New experimental mode visualization
|
||||
* Draw MPC path instead of model-predicted path
|
||||
* AGNOS 7
|
||||
* Faster boot time
|
||||
* Fixes rare no sounds bug
|
||||
* Fixes bootsplash bug at extreme temperatures
|
||||
* Buick LaCrosse 2017-19 support thanks to koch-cf!
|
||||
* Chevrolet Trailblazer 2021-22 support thanks to TurboCE!
|
||||
* Ford Bronco Sport 2021-22 support
|
||||
* Ford Escape 2020-22 support
|
||||
* Ford Explorer 2020-22 support
|
||||
* Ford Kuga 2020-22 support
|
||||
* Ford Maverick 2022-23 support
|
||||
* Genesis GV80 2023 support thanks to JWingate80!
|
||||
* Honda HR-V 2023 support thanks to AlexandreSato and galegozi!
|
||||
* Kia Niro EV 2023 support thanks to JosselinLecocq!
|
||||
* Lexus ES 2017-18 support
|
||||
* Lincoln Aviator 2021 support
|
||||
* Škoda Fabia 2022-23 support thanks to jyoung8607!
|
||||
|
||||
|
||||
Version 0.9.1 (2023-02-28)
|
||||
========================
|
||||
* New driving model
|
||||
* 30% improved height estimation resulting in better driving performance for tall cars
|
||||
* Driver monitoring: removed timer resetting on user interaction if distracted
|
||||
* UI updates
|
||||
* Adjust alert volume using ambient noise level
|
||||
* Driver monitoring icon shows driver's head pose
|
||||
* German translation thanks to Vrabetz and CzokNorris!
|
||||
* Cadillac Escalade 2017 support thanks to rickygilleland!
|
||||
* Chevrolet Bolt EV 2022-23 support thanks to JasonJShuler!
|
||||
* Genesis GV60 2023 support thanks to sunnyhaibin!
|
||||
* Hyundai Tucson 2022-23 support
|
||||
* Kia K5 Hybrid 2020 support thanks to sunnyhaibin!
|
||||
* Kia Niro Hybrid 2023 support thanks to sunnyhaibin!
|
||||
* Kia Sorento 2022-23 support thanks to sunnyhaibin!
|
||||
* Kia Sorento Plug-in Hybrid 2022 support thanks to sunnyhaibin!
|
||||
* Toyota C-HR 2021 support thanks to eFiniLan!
|
||||
* Toyota C-HR Hybrid 2022 support thanks to Korben00!
|
||||
* Volkswagen Crafter and MAN TGE 2017-23 support thanks to jyoung8607!
|
||||
|
||||
Version 0.9.0 (2022-11-21)
|
||||
========================
|
||||
* New driving model
|
||||
* Internal feature space information content increased tenfold during training to ~700 bits, which makes the model dramatically more accurate
|
||||
* Less reliance on previous frames makes model more reactive and snappy
|
||||
* Trained in new reprojective simulator
|
||||
* Trained in 36 hours from scratch, compared to one week for previous releases
|
||||
* Training now simulates both lateral and longitudinal behavior, which allows openpilot to slow down for turns, stop at traffic lights, and more in experimental mode
|
||||
* Experimental driving mode
|
||||
* End-to-end longitudinal control
|
||||
* Stops for traffic lights and stop signs
|
||||
* Slows down for turns
|
||||
* openpilot defaults to chill mode, enable experimental mode in settings
|
||||
* Driver monitoring updates
|
||||
* New bigger model with added end-to-end distracted trigger
|
||||
* Reduced false positives during driver calibration
|
||||
* Self-tuning torque controller: learns parameters live for each car
|
||||
* Torque controller used on all Toyota, Lexus, Hyundai, Kia, and Genesis models
|
||||
* UI updates
|
||||
* Matched speeds shown on car's dash
|
||||
* Multi-language in navigation
|
||||
* Improved update experience
|
||||
* Border turns grey while overriding steering
|
||||
* Bookmark events while driving; view them in comma connect
|
||||
* New onroad visualization for experimental mode
|
||||
* tools: new and improved cabana thanks to deanlee!
|
||||
* Experimental longitudinal support for Volkswagen, CAN-FD Hyundai, and new GM models
|
||||
* Genesis GV70 2022-23 support thanks to zunichky and sunnyhaibin!
|
||||
* Hyundai Santa Cruz 2021-22 support thanks to sunnyhaibin!
|
||||
* Kia Sportage 2023 support thanks to sunnyhaibin!
|
||||
* Kia Sportage Hybrid 2023 support thanks to sunnyhaibin!
|
||||
* Kia Stinger 2022 support thanks to sunnyhaibin!
|
||||
|
||||
Version 0.8.16 (2022-08-26)
|
||||
========================
|
||||
* New driving model
|
||||
@@ -73,7 +167,7 @@ Version 0.8.14 (2022-06-01)
|
||||
Version 0.8.13 (2022-02-18)
|
||||
========================
|
||||
* Improved driver monitoring
|
||||
* Retuned driver pose learner for relaxed driving positions
|
||||
* Re-tuned driver pose learner for relaxed driving positions
|
||||
* Added reliance on driving model to be more scene adaptive
|
||||
* Matched strictness between comma two and comma three
|
||||
* Improved performance in turns by compensating for the road bank angle
|
||||
@@ -219,7 +313,7 @@ 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
|
||||
* Re-tuned 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!
|
||||
@@ -384,7 +478,7 @@ Version 0.7 (2019-12-13)
|
||||
* Improve GM longitudinal control: proper computations for 15Hz radar
|
||||
* Move GM port, Toyota with DSU removed, comma pedal in community features; toggle switch required
|
||||
* Remove upload over cellular toggle: only upload qlog and qcamera files if not on wifi
|
||||
* Refactor Panda code towards ISO26262 and SIL2 compliancy
|
||||
* Refactor Panda code towards ISO26262 and SIL2 compliance
|
||||
* Forward stock FCW for Honda Nidec
|
||||
* Volkswagen port now standard: comma Harness intercepts stock camera
|
||||
|
||||
|
||||
+63
-45
@@ -5,15 +5,15 @@ import sysconfig
|
||||
import platform
|
||||
import numpy as np
|
||||
|
||||
import SCons.Errors
|
||||
|
||||
SCons.Warnings.warningAsException(True)
|
||||
|
||||
TICI = os.path.isfile('/TICI')
|
||||
AGNOS = TICI
|
||||
|
||||
Decider('MD5-timestamp')
|
||||
|
||||
AddOption('--test',
|
||||
action='store_true',
|
||||
help='build test files')
|
||||
|
||||
AddOption('--extras',
|
||||
action='store_true',
|
||||
help='build misc extras, like setup and installer files')
|
||||
@@ -53,6 +53,17 @@ AddOption('--no-thneed',
|
||||
dest='no_thneed',
|
||||
help='avoid using thneed')
|
||||
|
||||
AddOption('--pc-thneed',
|
||||
action='store_true',
|
||||
dest='pc_thneed',
|
||||
help='use thneed on pc')
|
||||
|
||||
AddOption('--no-test',
|
||||
action='store_false',
|
||||
dest='test',
|
||||
default=os.path.islink(Dir('#laika/').abspath),
|
||||
help='skip building test files')
|
||||
|
||||
real_arch = arch = subprocess.check_output(["uname", "-m"], encoding='utf8').rstrip()
|
||||
if platform.system() == "Darwin":
|
||||
arch = "Darwin"
|
||||
@@ -60,16 +71,15 @@ if platform.system() == "Darwin":
|
||||
if arch == "aarch64" and AGNOS:
|
||||
arch = "larch64"
|
||||
|
||||
USE_WEBCAM = os.getenv("USE_WEBCAM") is not None
|
||||
|
||||
lenv = {
|
||||
"PATH": os.environ['PATH'],
|
||||
"LD_LIBRARY_PATH": [Dir(f"#third_party/acados/{arch}/lib").abspath],
|
||||
"PYTHONPATH": Dir("#").abspath + ":" + Dir("#pyextra/").abspath,
|
||||
"PYTHONPATH": Dir("#").abspath,
|
||||
|
||||
"ACADOS_SOURCE_DIR": Dir("#third_party/acados/include/acados").abspath,
|
||||
"ACADOS_PYTHON_INTERFACE_PATH": Dir("#pyextra/acados_template").abspath,
|
||||
"TERA_PATH": Dir("#").abspath + f"/third_party/acados/{arch}/t_renderer",
|
||||
"ACADOS_PYTHON_INTERFACE_PATH": Dir("#third_party/acados/acados_template").abspath,
|
||||
"TERA_PATH": Dir("#").abspath + f"/third_party/acados/{arch}/t_renderer"
|
||||
}
|
||||
|
||||
rpath = lenv["LD_LIBRARY_PATH"].copy()
|
||||
@@ -93,9 +103,6 @@ if arch == "larch64":
|
||||
"#third_party/libyuv/larch64/lib",
|
||||
"/usr/lib/aarch64-linux-gnu"
|
||||
]
|
||||
cpppath += [
|
||||
"#system/camerad/include",
|
||||
]
|
||||
cflags = ["-DQCOM2", "-mcpu=cortex-a57"]
|
||||
cxxflags = ["-DQCOM2", "-mcpu=cortex-a57"]
|
||||
rpath += ["/usr/local/lib"]
|
||||
@@ -106,22 +113,29 @@ else:
|
||||
|
||||
# MacOS
|
||||
if arch == "Darwin":
|
||||
if real_arch == "x86_64":
|
||||
lenv["TERA_PATH"] = Dir("#").abspath + f"/third_party/acados/Darwin_x86_64/t_renderer"
|
||||
|
||||
brew_prefix = subprocess.check_output(['brew', '--prefix'], encoding='utf8').strip()
|
||||
yuv_dir = "mac" if real_arch != "arm64" else "mac_arm64"
|
||||
libpath = [
|
||||
f"#third_party/libyuv/{yuv_dir}/lib",
|
||||
f"{brew_prefix}/lib",
|
||||
f"{brew_prefix}/Library",
|
||||
f"{brew_prefix}/opt/openssl/lib",
|
||||
f"{brew_prefix}/opt/openssl@3.0/lib",
|
||||
f"{brew_prefix}/Cellar",
|
||||
f"#third_party/acados/{arch}/lib",
|
||||
"/System/Library/Frameworks/OpenGL.framework/Libraries",
|
||||
]
|
||||
if real_arch == "x86_64":
|
||||
libpath.append(f"#third_party/acados/Darwin_x86_64/lib")
|
||||
else:
|
||||
libpath.append(f"#third_party/acados/{arch}/lib")
|
||||
|
||||
cflags += ["-DGL_SILENCE_DEPRECATION"]
|
||||
cxxflags += ["-DGL_SILENCE_DEPRECATION"]
|
||||
cpppath += [
|
||||
f"{brew_prefix}/include",
|
||||
f"{brew_prefix}/opt/openssl/include",
|
||||
f"{brew_prefix}/opt/openssl@3.0/include",
|
||||
]
|
||||
# Linux 86_64
|
||||
else:
|
||||
@@ -187,10 +201,6 @@ env = Environment(
|
||||
"#third_party/libyuv/include",
|
||||
"#third_party/json11",
|
||||
"#third_party/curl/include",
|
||||
"#third_party/libgralloc/include",
|
||||
"#third_party/android_frameworks_native/include",
|
||||
"#third_party/android_hardware_libhardware/include",
|
||||
"#third_party/android_system_core/include",
|
||||
"#third_party/linux/include",
|
||||
"#third_party/snpe/include",
|
||||
"#third_party/mapbox-gl-native-qt/include",
|
||||
@@ -253,7 +263,7 @@ def abspath(x):
|
||||
# rpath works elsewhere
|
||||
return x[0].path.rsplit("/", 1)[1][:-3]
|
||||
|
||||
# Cython build enviroment
|
||||
# Cython build environment
|
||||
py_include = sysconfig.get_paths()['include']
|
||||
envCython = env.Clone()
|
||||
envCython["CPPPATH"] += [py_include, np.get_include()]
|
||||
@@ -272,7 +282,7 @@ Export('envCython')
|
||||
|
||||
# Qt build environment
|
||||
qt_env = env.Clone()
|
||||
qt_modules = ["Widgets", "Gui", "Core", "Network", "Concurrent", "Multimedia", "Quick", "Qml", "QuickWidgets", "Location", "Positioning", "DBus"]
|
||||
qt_modules = ["Widgets", "Gui", "Core", "Network", "Concurrent", "Multimedia", "Quick", "Qml", "QuickWidgets", "Location", "Positioning", "DBus", "Xml"]
|
||||
|
||||
qt_libs = []
|
||||
if arch == "Darwin":
|
||||
@@ -288,20 +298,30 @@ if arch == "Darwin":
|
||||
qt_env["FRAMEWORKS"] += [f"Qt{m}" for m in qt_modules] + ["OpenGL"]
|
||||
qt_env.AppendENVPath('PATH', os.path.join(qt_env['QTDIR'], "bin"))
|
||||
else:
|
||||
qt_env['QTDIR'] = "/usr"
|
||||
qt_install_prefix = subprocess.check_output(['qmake', '-query', 'QT_INSTALL_PREFIX'], encoding='utf8').strip()
|
||||
qt_install_headers = subprocess.check_output(['qmake', '-query', 'QT_INSTALL_HEADERS'], encoding='utf8').strip()
|
||||
|
||||
qt_env['QTDIR'] = qt_install_prefix
|
||||
qt_dirs = [
|
||||
f"/usr/include/{real_arch}-linux-gnu/qt5",
|
||||
f"/usr/include/{real_arch}-linux-gnu/qt5/QtGui/5.12.8/QtGui",
|
||||
f"{qt_install_headers}",
|
||||
f"{qt_install_headers}/QtGui/5.12.8/QtGui",
|
||||
]
|
||||
qt_dirs += [f"/usr/include/{real_arch}-linux-gnu/qt5/Qt{m}" for m in qt_modules]
|
||||
qt_dirs += [f"{qt_install_headers}/Qt{m}" for m in qt_modules]
|
||||
|
||||
qt_libs = [f"Qt5{m}" for m in qt_modules]
|
||||
if arch == "larch64":
|
||||
qt_libs += ["GLESv2", "wayland-client"]
|
||||
qt_env.PrependENVPath('PATH', Dir("#third_party/qt5/larch64/bin/").abspath)
|
||||
elif arch != "Darwin":
|
||||
qt_libs += ["GL"]
|
||||
qt_env['QT3DIR'] = qt_env['QTDIR']
|
||||
|
||||
# compatibility for older SCons versions
|
||||
try:
|
||||
qt_env.Tool('qt3')
|
||||
except SCons.Errors.UserError:
|
||||
qt_env.Tool('qt')
|
||||
|
||||
qt_env.Tool('qt')
|
||||
qt_env['CPPPATH'] += qt_dirs + ["#selfdrive/ui/qt/"]
|
||||
qt_flags = [
|
||||
"-D_REENTRANT",
|
||||
@@ -317,6 +337,7 @@ qt_flags = [
|
||||
qt_env['CXXFLAGS'] += qt_flags
|
||||
qt_env['LIBPATH'] += ['#selfdrive/ui']
|
||||
qt_env['LIBS'] = qt_libs
|
||||
qt_env['QT_MOCHPREFIX'] = cache_dir + '/moc_files/moc_'
|
||||
|
||||
if GetOption("clazy"):
|
||||
checks = [
|
||||
@@ -329,7 +350,7 @@ if GetOption("clazy"):
|
||||
qt_env['ENV']['CLAZY_IGNORE_DIRS'] = qt_dirs[0]
|
||||
qt_env['ENV']['CLAZY_CHECKS'] = ','.join(checks)
|
||||
|
||||
Export('env', 'qt_env', 'arch', 'real_arch', 'SHARED', 'USE_WEBCAM')
|
||||
Export('env', 'qt_env', 'arch', 'real_arch', 'SHARED')
|
||||
|
||||
SConscript(['common/SConscript'])
|
||||
Import('_common', '_gpucommon')
|
||||
@@ -373,10 +394,10 @@ rednose_config = {
|
||||
if arch != "larch64":
|
||||
rednose_config['to_build'].update({
|
||||
'loc_4': ('#selfdrive/locationd/models/loc_kf.py', True, [], rednose_deps),
|
||||
'lane': ('#selfdrive/locationd/models/lane_kf.py', True, [], rednose_deps),
|
||||
'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, [], rednose_deps),
|
||||
})
|
||||
|
||||
Export('rednose_config')
|
||||
@@ -384,21 +405,26 @@ SConscript(['rednose/SConscript'])
|
||||
|
||||
# Build system services
|
||||
SConscript([
|
||||
'system/camerad/SConscript',
|
||||
'system/clocksd/SConscript',
|
||||
'system/proclogd/SConscript',
|
||||
'system/ubloxd/SConscript',
|
||||
'system/loggerd/SConscript',
|
||||
])
|
||||
if arch != "Darwin":
|
||||
SConscript(['system/logcatd/SConscript'])
|
||||
SConscript([
|
||||
'system/camerad/SConscript',
|
||||
'system/sensord/SConscript',
|
||||
'system/logcatd/SConscript',
|
||||
])
|
||||
|
||||
# Build openpilot
|
||||
|
||||
# build submodules
|
||||
SConscript([
|
||||
'cereal/SConscript',
|
||||
'body/board/SConscript',
|
||||
'panda/board/SConscript',
|
||||
'cereal/SConscript',
|
||||
'opendbc/can/SConscript',
|
||||
'panda/SConscript',
|
||||
])
|
||||
|
||||
SConscript(['third_party/SConscript'])
|
||||
@@ -406,25 +432,17 @@ SConscript(['third_party/SConscript'])
|
||||
SConscript(['common/kalman/SConscript'])
|
||||
SConscript(['common/transformations/SConscript'])
|
||||
|
||||
SConscript(['selfdrive/modeld/SConscript'])
|
||||
|
||||
SConscript(['selfdrive/controls/lib/cluster/SConscript'])
|
||||
SConscript(['selfdrive/boardd/SConscript'])
|
||||
SConscript(['selfdrive/controls/lib/lateral_mpc_lib/SConscript'])
|
||||
SConscript(['selfdrive/controls/lib/longitudinal_mpc_lib/SConscript'])
|
||||
|
||||
SConscript(['selfdrive/boardd/SConscript'])
|
||||
|
||||
SConscript(['selfdrive/loggerd/SConscript'])
|
||||
|
||||
SConscript(['selfdrive/locationd/SConscript'])
|
||||
SConscript(['selfdrive/sensord/SConscript'])
|
||||
SConscript(['selfdrive/ui/SConscript'])
|
||||
SConscript(['selfdrive/navd/SConscript'])
|
||||
SConscript(['selfdrive/modeld/SConscript'])
|
||||
SConscript(['selfdrive/ui/SConscript'])
|
||||
|
||||
SConscript(['tools/replay/SConscript'])
|
||||
|
||||
if GetOption('test'):
|
||||
SConscript('panda/tests/safety/SConscript')
|
||||
if (arch in ['x86_64', 'Darwin'] and Dir('#tools/cabana/').exists()) or GetOption('extras'):
|
||||
SConscript(['tools/replay/SConscript'])
|
||||
SConscript(['tools/cabana/SConscript'])
|
||||
|
||||
external_sconscript = GetOption('external_sconscript')
|
||||
if external_sconscript:
|
||||
|
||||
@@ -40,6 +40,7 @@ void board_detect(void) {
|
||||
board.led_portB = GPIOC;
|
||||
|
||||
board.can_addr_offset = 0x0U;
|
||||
board.uds_offset = 0x0U;
|
||||
|
||||
} else if (hw_type == HW_TYPE_KNEE) {
|
||||
board.hall_left.hall_portA = GPIOC;
|
||||
@@ -77,6 +78,7 @@ void board_detect(void) {
|
||||
board.led_portB = GPIOB;
|
||||
|
||||
board.can_addr_offset = KNEE_ADDR_OFFSET;
|
||||
board.uds_offset = 0x10U;
|
||||
|
||||
#ifndef BOOTSTUB
|
||||
MX_I2C_Init();
|
||||
|
||||
+18
-9
@@ -6,10 +6,10 @@
|
||||
#define BROADCAST_ADDR 0x7DFU
|
||||
#define FALLBACK_ADDR 0x7E0U
|
||||
#define FALLBACK_R_ADDR (FALLBACK_ADDR + OFFSET)
|
||||
#define ECU_ADDR 0x720U
|
||||
#define ECU_R_ADDR (ECU_ADDR + OFFSET)
|
||||
#define DEBUG_ADDR 0x721U
|
||||
#define DEBUG_R_ADDR (DEBUG_ADDR + OFFSET)
|
||||
#define ENGINE_ADDR 0x720U
|
||||
#define ENGINE_R_ADDR (ENGINE_ADDR + OFFSET)
|
||||
#define DEBUG_ADDR 0x721U
|
||||
#define DEBUG_R_ADDR (DEBUG_ADDR + OFFSET)
|
||||
|
||||
#include "drivers/llbxcan.h"
|
||||
#include "uds.h"
|
||||
@@ -24,6 +24,8 @@ extern board_t board;
|
||||
extern uint32_t enter_bootloader_mode;
|
||||
extern volatile uint32_t torque_cmd_timeout;
|
||||
|
||||
extern volatile uint32_t ignition_off_counter;
|
||||
|
||||
const uint8_t crc_poly = 0xD5U; // standard crc8
|
||||
uint32_t current_idx = 0;
|
||||
|
||||
@@ -84,8 +86,9 @@ void can_send_msg(uint32_t addr, uint32_t dhr, uint32_t dlr, uint8_t len) {
|
||||
}
|
||||
|
||||
void process_can(void) {
|
||||
__disable_irq();
|
||||
CAN_FIFOMailBox_TypeDef to_send;
|
||||
if (board.CAN->TSR & CAN_TSR_TME0) {
|
||||
if ((board.CAN->TSR & CAN_TSR_TME0) == CAN_TSR_TME0) {
|
||||
if (can_pop(&can_tx_q, &to_send)) {
|
||||
board.CAN->sTxMailBox[0].TDLR = to_send.RDLR;
|
||||
board.CAN->sTxMailBox[0].TDHR = to_send.RDHR;
|
||||
@@ -93,12 +96,13 @@ void process_can(void) {
|
||||
board.CAN->sTxMailBox[0].TIR = to_send.RIR;
|
||||
}
|
||||
}
|
||||
__enable_irq();
|
||||
}
|
||||
|
||||
void can_rx(void) {
|
||||
while ((board.CAN->RF0R & CAN_RF0R_FMP0) != 0) {
|
||||
int address = board.CAN->sFIFOMailBox[0].RIR >> 21;
|
||||
if (address == (int32_t)(0x250U + board.can_addr_offset)) {
|
||||
uint32_t address = board.CAN->sFIFOMailBox[0].RIR >> 21;
|
||||
if (address == (0x250U + board.can_addr_offset)) {
|
||||
if ((GET_MAILBOX_BYTES_04(&board.CAN->sFIFOMailBox[0]) == 0xdeadface) && (GET_MAILBOX_BYTES_48(&board.CAN->sFIFOMailBox[0]) == 0x0ab00b1e)) {
|
||||
enter_bootloader_mode = ENTER_SOFTLOADER_MAGIC;
|
||||
NVIC_SystemReset();
|
||||
@@ -121,7 +125,7 @@ void can_rx(void) {
|
||||
current_idx = idx;
|
||||
}
|
||||
out_enable(LED_BLUE, true);
|
||||
} else if (address == (int32_t)(0x251U + board.can_addr_offset)) {
|
||||
} else if (address == (0x251U + board.can_addr_offset)) {
|
||||
#define MSG_SPD_LEN 5
|
||||
uint8_t dat[MSG_TRQ_LEN];
|
||||
for (int i=0; i<MSG_TRQ_LEN; i++) {
|
||||
@@ -139,11 +143,16 @@ void can_rx(void) {
|
||||
}
|
||||
}
|
||||
out_enable(LED_BLUE, true);
|
||||
} else if ((hw_type == HW_TYPE_BASE) && ((address == BROADCAST_ADDR) || (address == FALLBACK_ADDR) || (address == ECU_ADDR) || (address == DEBUG_ADDR))) { // Process UBS and OBD2 requests, ignore for knee
|
||||
} else if ((address == BROADCAST_ADDR) || // Process UBS and OBD2 requests
|
||||
(address == FALLBACK_ADDR) ||
|
||||
(address == (ENGINE_ADDR + board.uds_offset)) ||
|
||||
(address == (DEBUG_ADDR + board.uds_offset))) {
|
||||
process_uds(address, GET_MAILBOX_BYTES_04(&board.CAN->sFIFOMailBox[0]));
|
||||
out_enable(LED_BLUE, true);
|
||||
} else if ((hw_type == HW_TYPE_BASE) && (address == 0x203U + KNEE_ADDR_OFFSET)) { // detect knee by body and set flag for use with UDS message
|
||||
knee_detected = 1;
|
||||
} else if ((hw_type == HW_TYPE_KNEE) && (address == 0x202U)) { // CAN based ignition for knee
|
||||
ignition_off_counter = 0;
|
||||
}
|
||||
// next
|
||||
board.CAN->RF0R |= CAN_RF0R_RFOM0;
|
||||
|
||||
+8
-6
@@ -5,23 +5,25 @@
|
||||
#include "stm32f4xx_hal.h"
|
||||
|
||||
#define CORE_FREQ 96000000U // MCU frequency in hertz
|
||||
#define PWM_FREQ 16000 // PWM frequency in Hz / is also used for buzzer
|
||||
#define DEAD_TIME 48 // PWM deadtime
|
||||
#define DELAY_IN_MAIN_LOOP 5 // in ms. default 5. it is independent of all the timing critical stuff. do not touch if you do not know what you are doing.
|
||||
#define A2BIT_CONV 50 // A to bit for current conversion on ADC. Example: 1 A = 50, 2 A = 100, etc
|
||||
#define I2C_CLOCKSPEED 100 // I2C clock in kHz
|
||||
#define PWM_FREQ 16000 // PWM frequency in Hz / is also used for buzzer
|
||||
#define DEAD_TIME 48 // PWM deadtime
|
||||
#define DELAY_IN_MAIN_LOOP 5 // in ms. default 5. it is independent of all the timing critical stuff. do not touch if you do not know what you are doing.
|
||||
#define A2BIT_CONV 50 // A to bit for current conversion on ADC. Example: 1 A = 50, 2 A = 100, etc
|
||||
|
||||
#define IGNITION_OFF_DELAY 5 // Stop sending CAN messages after 5 seconds
|
||||
|
||||
#define ADC_CONV_CLOCK_CYCLES (ADC_SAMPLETIME_15CYCLES)
|
||||
#define ADC_CLOCK_DIV (4)
|
||||
#define ADC_TOTAL_CONV_TIME (ADC_CLOCK_DIV * ADC_CONV_CLOCK_CYCLES) // = ((SystemCoreClock / ADC_CLOCK_HZ) * ADC_CONV_CLOCK_CYCLES), where ADC_CLOCK_HZ = SystemCoreClock/ADC_CLOCK_DIV
|
||||
|
||||
#define KNEE_ADDR_OFFSET 0x100U
|
||||
#define ANGLE_TO_DEGREES 0.021972656 // Convert 14 bit angle sensor output to degrees
|
||||
#define GEARBOX_RATIO_LEFT 19
|
||||
#define GEARBOX_RATIO_RIGHT 19
|
||||
#define TRQ_LIMIT_LEFT 400 // Torque limit for knee gearbox(left)
|
||||
#define TRQ_LIMIT_RIGHT 200 // Torque limit for hip gearbox(right)
|
||||
|
||||
#define KNEE_ADDR_OFFSET 0x100
|
||||
|
||||
#define BAT_FILT_COEF 655 // battery voltage filter coefficient in fixed-point. coef_fixedPoint = coef_floatingPoint * 2^16. In this case 655 = 0.01 * 2^16
|
||||
#define BAT_CALIB_REAL_VOLTAGE 3192 // input voltage measured by multimeter (multiplied by 100). In this case 43.00 V * 100 = 4300
|
||||
#define BAT_CALIB_ADC 1275 // adc-value measured by mainboard (value nr 5 on UART debug output)
|
||||
|
||||
@@ -166,7 +166,8 @@ typedef struct {
|
||||
GPIO_TypeDef* ignition_port;
|
||||
uint16_t ignition_pin;
|
||||
|
||||
uint32_t can_addr_offset;
|
||||
uint16_t can_addr_offset;
|
||||
uint8_t uds_offset;
|
||||
|
||||
GPIO_TypeDef* led_portR;
|
||||
uint16_t led_pinR;
|
||||
@@ -177,4 +178,11 @@ typedef struct {
|
||||
|
||||
} board_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t left_i2c : 1;
|
||||
uint8_t left_angle : 1;
|
||||
uint8_t right_i2c : 1;
|
||||
uint8_t right_angle : 1;
|
||||
} fault_status_t;
|
||||
|
||||
#endif // DEFINES_H
|
||||
|
||||
@@ -19,14 +19,29 @@ extern I2C_HandleTypeDef hi2c1;
|
||||
const uint8_t init_imu_regaddr[] = {0x76, 0x4c, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53};
|
||||
const uint8_t init_imu_data[] = {0x00, 0x12, 0x2f, 0x26, 0x67, 0x04, 0x00, 0x00};
|
||||
|
||||
fault_status_t fault_status = {0};
|
||||
|
||||
void angle_sensor_read(uint16_t *sensor_angle) {
|
||||
|
||||
if (fault_status.left_i2c && fault_status.right_i2c) { // Try to reinitialize halted I2C
|
||||
if (HAL_I2C_Init(&hi2c1) == HAL_OK) {
|
||||
fault_status.left_i2c = 0;
|
||||
fault_status.right_i2c = 0;
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t buf[2];
|
||||
if (HAL_I2C_Mem_Read(&hi2c1, (AS5048_ADDRESS_LEFT<<1), AS5048B_ANGLMSB_REG, I2C_MEMADD_SIZE_8BIT, buf, 2, 10) == HAL_OK) {
|
||||
sensor_angle[0] = (buf[0] << 6) | (buf[1] & 0x3F);
|
||||
fault_status.left_i2c = 0;
|
||||
} else {
|
||||
fault_status.left_i2c = 1;
|
||||
}
|
||||
if (HAL_I2C_Mem_Read(&hi2c1, (AS5048_ADDRESS_RIGHT<<1), AS5048B_ANGLMSB_REG, I2C_MEMADD_SIZE_8BIT, buf, 2, 10) == HAL_OK) {
|
||||
sensor_angle[1] = (buf[0] << 6) | (buf[1] & 0x3F);
|
||||
fault_status.right_i2c = 0;
|
||||
} else {
|
||||
fault_status.right_i2c = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#define SW_I2C_WAIT_TIME 22
|
||||
#define SW_I2C_WAIT_TIME 22
|
||||
|
||||
#define I2C_READ 0x01
|
||||
#define READ_CMD 1
|
||||
@@ -7,14 +7,14 @@
|
||||
|
||||
void SW_I2C_init(void)
|
||||
{
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
GPIO_InitTypeDef GPIO_InitStructure = { 0 };
|
||||
|
||||
GPIO_InitStructure.Speed = GPIO_SPEED_FREQ_HIGH;
|
||||
GPIO_InitStructure.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
|
||||
|
||||
GPIO_InitStructure.Pin = SW_I2C1_SCL_PIN;
|
||||
HAL_GPIO_Init(SW_I2C1_SCL_GPIO, &GPIO_InitStructure);
|
||||
GPIO_InitStructure.Pin = SW_I2C1_SDA_PIN;
|
||||
GPIO_InitStructure.Pin = SW_I2C1_SDA_PIN;
|
||||
HAL_GPIO_Init(SW_I2C1_SDA_GPIO, &GPIO_InitStructure);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ uint8_t SW_I2C_ReadVal_SDA(void)
|
||||
ret = (uint16_t)HAL_GPIO_ReadPin(SW_I2C1_SDA_GPIO, SW_I2C1_SDA_PIN);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void sda_high(void)
|
||||
{
|
||||
HAL_GPIO_WritePin(SW_I2C1_SDA_GPIO, SW_I2C1_SDA_PIN, GPIO_PIN_SET);
|
||||
@@ -59,23 +59,23 @@ void sda_out(uint8_t out)
|
||||
|
||||
void sda_in_mode(void)
|
||||
{
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
GPIO_InitTypeDef GPIO_InitStructure = { 0 };
|
||||
|
||||
GPIO_InitStructure.Speed=GPIO_SPEED_FREQ_HIGH;
|
||||
GPIO_InitStructure.Mode=GPIO_MODE_INPUT;
|
||||
|
||||
GPIO_InitStructure.Pin = SW_I2C1_SDA_PIN;
|
||||
GPIO_InitStructure.Speed = GPIO_SPEED_FREQ_HIGH;
|
||||
GPIO_InitStructure.Mode = GPIO_MODE_INPUT;
|
||||
|
||||
GPIO_InitStructure.Pin = SW_I2C1_SDA_PIN;
|
||||
HAL_GPIO_Init(SW_I2C1_SDA_GPIO, &GPIO_InitStructure);
|
||||
}
|
||||
|
||||
void sda_out_mode(void)
|
||||
{
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
GPIO_InitTypeDef GPIO_InitStructure = { 0 };
|
||||
|
||||
GPIO_InitStructure.Speed=GPIO_SPEED_FREQ_HIGH;
|
||||
GPIO_InitStructure.Mode=GPIO_MODE_OUTPUT_OD;
|
||||
|
||||
GPIO_InitStructure.Pin = SW_I2C1_SDA_PIN;
|
||||
GPIO_InitStructure.Speed = GPIO_SPEED_FREQ_HIGH;
|
||||
GPIO_InitStructure.Mode = GPIO_MODE_OUTPUT_OD;
|
||||
|
||||
GPIO_InitStructure.Pin = SW_I2C1_SDA_PIN;
|
||||
HAL_GPIO_Init(SW_I2C1_SDA_GPIO, &GPIO_InitStructure);
|
||||
}
|
||||
|
||||
@@ -129,15 +129,15 @@ uint8_t i2c_check_ack(void)
|
||||
delay(SW_I2C_WAIT_TIME);
|
||||
|
||||
for (i = 10; i > 0; i--) {
|
||||
temp = !(SW_I2C_ReadVal_SDA());
|
||||
if (temp)
|
||||
temp = !(SW_I2C_ReadVal_SDA());
|
||||
if (temp)
|
||||
{
|
||||
ack = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
scl_low();
|
||||
sda_out_mode();
|
||||
sda_out_mode();
|
||||
|
||||
delay(SW_I2C_WAIT_TIME);
|
||||
return ack;
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
// maximum 500kbps! (or needs clock change)
|
||||
// SAE 2284-3 : minimum 16 tq, SJW 3, sample point at 81.3%
|
||||
#define CAN_QUANTA 16U
|
||||
#define CAN_SEQ1 13U // roundf(quanta * 0.875f) - 1;
|
||||
#define CAN_SEQ2 2U // roundf(quanta * 0.125f);
|
||||
#define CAN_SEQ1 12U
|
||||
#define CAN_SEQ2 3U
|
||||
#define CAN_SJW 3U
|
||||
|
||||
#define CAN_PCLK (CORE_FREQ / 2U / 1000U)
|
||||
// 333 = 33.3 kbps
|
||||
// 5000 = 500 kbps
|
||||
#define can_speed_to_prescaler(x) (CAN_PCLK / CAN_QUANTA * 10U / (x))
|
||||
|
||||
#define CAN_INIT_TIMEOUT_MS 500
|
||||
|
||||
bool llcan_set_speed(CAN_TypeDef *CAN_obj, uint32_t speed, bool loopback, bool silent) {
|
||||
@@ -30,7 +28,10 @@ bool llcan_set_speed(CAN_TypeDef *CAN_obj, uint32_t speed, bool loopback, bool s
|
||||
|
||||
if(ret){
|
||||
// set time quanta from defines
|
||||
CAN_obj->BTR = ((CAN_BTR_TS1_0 * (CAN_SEQ1-1)) | (CAN_BTR_TS2_0 * (CAN_SEQ2-1)) | (can_speed_to_prescaler(speed) - 1U));
|
||||
CAN_obj->BTR = ((CAN_BTR_TS1_0 * (CAN_SEQ1-1)) |
|
||||
(CAN_BTR_TS2_0 * (CAN_SEQ2-1)) |
|
||||
(CAN_BTR_SJW_0 * (CAN_SJW-1)) |
|
||||
(can_speed_to_prescaler(speed) - 1U));
|
||||
|
||||
// silent loopback mode for debugging
|
||||
if (loopback) {
|
||||
|
||||
+29
-13
@@ -58,6 +58,9 @@ extern board_t board;
|
||||
extern volatile uint32_t buzzerTimer;
|
||||
volatile uint32_t torque_cmd_timeout = 0U;
|
||||
volatile uint32_t ignition_off_counter = 0U;
|
||||
|
||||
uint16_t cnt_press = 0;
|
||||
|
||||
int16_t batVoltageCalib; // global variable for calibrated battery voltage
|
||||
int16_t board_temp_deg_c; // global variable for calibrated temperature in degrees Celsius
|
||||
volatile int16_t cmdL; // global variable for Left Command
|
||||
@@ -66,9 +69,7 @@ volatile int16_t cmdR; // global variable for Right Command
|
||||
uint8_t hw_type; // type of the board detected(0 - base, 3 - knee)
|
||||
uint8_t ignition = 0; // global variable for ignition on SBU2 line
|
||||
uint8_t charger_connected = 0; // status of the charger port
|
||||
uint8_t fault_status = 0; // fault status of the whole system
|
||||
uint8_t pkt_idx = 0; // For CAN msg counter
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// Local variables
|
||||
//------------------------------------------------------------------------
|
||||
@@ -120,6 +121,7 @@ int main(void) {
|
||||
} else {
|
||||
out_enable(POWERSWITCH, false);
|
||||
ignition = 1;
|
||||
knee_detected = 1;
|
||||
}
|
||||
// Reset LEDs on startup
|
||||
out_enable(LED_RED, false);
|
||||
@@ -175,8 +177,10 @@ int main(void) {
|
||||
|
||||
if (hw_type == HW_TYPE_KNEE) {
|
||||
// Safety to stop operation if angle sensor reading failed TODO: adjust sensivity and add lowpass to angle sensor?
|
||||
if ((ABS((hall_angle_offset[0] + ((motPosL / 15 / GEARBOX_RATIO_LEFT) % 360)) - (sensor_angle[0] * ANGLE_TO_DEGREES)) > 5) ||
|
||||
(ABS((hall_angle_offset[1] + ((motPosR / 15 / GEARBOX_RATIO_RIGHT) % 360)) - (sensor_angle[1] * ANGLE_TO_DEGREES)) > 5)) {
|
||||
fault_status.left_angle = (ABS((hall_angle_offset[0] + ((motPosL / 15 / GEARBOX_RATIO_LEFT) % 360)) - (sensor_angle[0] * ANGLE_TO_DEGREES)) > 5);
|
||||
fault_status.right_angle = (ABS((hall_angle_offset[1] + ((motPosR / 15 / GEARBOX_RATIO_RIGHT) % 360)) - (sensor_angle[1] * ANGLE_TO_DEGREES)) > 5);
|
||||
|
||||
if (fault_status.left_angle || fault_status.right_angle) {
|
||||
cmdL = cmdR = 0;
|
||||
}
|
||||
// Safety to stop movement when reaching dead angles, around 20 and 340 degrees
|
||||
@@ -211,7 +215,7 @@ int main(void) {
|
||||
}
|
||||
}
|
||||
|
||||
if (ignition_off_counter <= 10) {
|
||||
if (ignition_off_counter <= IGNITION_OFF_DELAY) {
|
||||
// MOTORS_DATA: speed_L(2), speed_R(2), counter(1), checksum(1)
|
||||
uint8_t dat[8];
|
||||
uint16_t speedL = rtY_Left.n_mot;
|
||||
@@ -287,19 +291,15 @@ int main(void) {
|
||||
// runs at 10Hz
|
||||
if ((HAL_GetTick() - (main_loop_10Hz - main_loop_10Hz_runtime)) >= 100) {
|
||||
main_loop_10Hz_runtime = HAL_GetTick();
|
||||
if (ignition_off_counter <= 10) {
|
||||
// VAR_VALUES: fault_status(0:6), enable_motors(0:1), ignition(0:1), left motor error(1), right motor error(1), global fault status(1)
|
||||
if (ignition_off_counter <= IGNITION_OFF_DELAY) {
|
||||
// VAR_VALUES: fault_status(0:4), enable_motors(0:1), ignition(0:1), left motor error(1), right motor error(1)
|
||||
uint8_t dat[2];
|
||||
dat[0] = (((fault_status & 0x3F) << 2U) | (enable_motors << 1U) | ignition);
|
||||
dat[0] = ((fault_status.right_angle << 5U) | (fault_status.right_i2c << 4U) | (fault_status.left_angle << 3U) | (fault_status.left_i2c << 2U) | (enable_motors << 1U) | ignition);
|
||||
dat[1] = rtY_Left.z_errCode;
|
||||
dat[2] = rtY_Right.z_errCode;
|
||||
can_send_msg((0x202U + board.can_addr_offset), 0x0U, ((dat[2] << 16U) | (dat[1] << 8U) | dat[0]), 3U);
|
||||
}
|
||||
out_enable(LED_GREEN, ignition);
|
||||
|
||||
if (hw_type == HW_TYPE_BASE) {
|
||||
poweroffPressCheck();
|
||||
}
|
||||
|
||||
main_loop_10Hz_runtime = HAL_GetTick() - main_loop_10Hz_runtime;
|
||||
main_loop_10Hz = HAL_GetTick();
|
||||
@@ -330,7 +330,7 @@ int main(void) {
|
||||
out_enable(LED_BLUE, false); // Reset LED after CAN RX
|
||||
out_enable(LED_GREEN, true); // Always use LED to show that body is on
|
||||
|
||||
if (ignition) {
|
||||
if ((hw_type == HW_TYPE_BASE) && ignition) {
|
||||
ignition_off_counter = 0;
|
||||
} else {
|
||||
ignition_off_counter = (ignition_off_counter < MAX_uint32_T) ? (ignition_off_counter+1) : 0;
|
||||
@@ -341,6 +341,8 @@ int main(void) {
|
||||
} else if (rtY_Left.z_errCode || rtY_Right.z_errCode) { // 1 beep (low pitch): Motor error, disable motors
|
||||
enable_motors = 0;
|
||||
beepCount(1, 24, 1);
|
||||
} else if (fault_status.left_angle || fault_status.left_i2c || fault_status.right_angle || fault_status.right_i2c) { // 2 beeps (low pitch): Motor error, disable motors
|
||||
beepCount(2, 24, 1);
|
||||
} else if (TEMP_WARNING_ENABLE && board_temp_deg_c >= TEMP_WARNING) { // 5 beeps (low pitch): Mainboard temperature warning
|
||||
beepCount(5, 24, 1);
|
||||
} else if (batVoltage < BAT_LVL1) { // 1 beep fast (medium pitch): Low bat 1
|
||||
@@ -357,6 +359,20 @@ int main(void) {
|
||||
main_loop_1Hz = HAL_GetTick();
|
||||
}
|
||||
|
||||
if (hw_type == HW_TYPE_BASE) {
|
||||
if (HAL_GPIO_ReadPin(BUTTON_PORT, BUTTON_PIN)) {
|
||||
cnt_press += 1;
|
||||
if (cnt_press == (2 * 1008)) {
|
||||
poweroff();
|
||||
}
|
||||
} else if (cnt_press >= 10) {
|
||||
ignition = !ignition;
|
||||
out_enable(IGNITION, ignition);
|
||||
beepShort(5);
|
||||
cnt_press = 0;
|
||||
}
|
||||
}
|
||||
|
||||
process_can();
|
||||
tick_prev = HAL_GetTick();
|
||||
}
|
||||
|
||||
+3
-4
@@ -8,7 +8,6 @@ TIM_HandleTypeDef htim_right;
|
||||
TIM_HandleTypeDef htim_left;
|
||||
ADC_HandleTypeDef hadc;
|
||||
I2C_HandleTypeDef hi2c1;
|
||||
// SPI_HandleTypeDef hspi3;
|
||||
|
||||
volatile adc_buf_t adc_buffer;
|
||||
extern board_t board;
|
||||
@@ -26,7 +25,7 @@ void MX_GPIO_Clocks_Init(void) {
|
||||
}
|
||||
|
||||
void MX_GPIO_Common_Init(void) {
|
||||
GPIO_InitTypeDef GPIO_InitStruct;
|
||||
GPIO_InitTypeDef GPIO_InitStruct = { 0 };
|
||||
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
@@ -167,7 +166,7 @@ void MX_GPIO_Common_Init(void) {
|
||||
|
||||
|
||||
void MX_I2C_Init(void) {
|
||||
GPIO_InitTypeDef GPIO_InitStruct;
|
||||
GPIO_InitTypeDef GPIO_InitStruct = { 0 };
|
||||
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_6|GPIO_PIN_7;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_OD;
|
||||
@@ -179,7 +178,7 @@ void MX_I2C_Init(void) {
|
||||
__HAL_RCC_I2C1_CLK_ENABLE();
|
||||
|
||||
hi2c1.Instance = I2C1;
|
||||
hi2c1.Init.ClockSpeed = 400000;
|
||||
hi2c1.Init.ClockSpeed = (I2C_CLOCKSPEED * 1000);
|
||||
hi2c1.Init.DutyCycle = I2C_DUTYCYCLE_2;
|
||||
hi2c1.Init.OwnAddress1 = 0;
|
||||
hi2c1.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT;
|
||||
|
||||
+64
-57
@@ -1,118 +1,125 @@
|
||||
extern uint8_t hw_type;
|
||||
void can_send_msg(uint32_t addr, uint32_t dhr, uint32_t dlr, uint8_t len);
|
||||
|
||||
uint8_t uid[10];
|
||||
uint32_t uds_request = 0;
|
||||
uint32_t uds_engine_request = 0;
|
||||
uint32_t uds_debug_request = 0;
|
||||
uint8_t knee_detected = 0;
|
||||
uint8_t sep_time = 0;
|
||||
|
||||
void process_uds(uint32_t addr, uint32_t dlr) {
|
||||
memcpy(uid, (void *)0x1FFF7A10U, 0xAU);
|
||||
|
||||
if ((addr == BROADCAST_ADDR) || (addr == FALLBACK_ADDR)) { // OBD2 broadcast request, redirect to UDS?
|
||||
if ((hw_type == HW_TYPE_BASE) &&
|
||||
((addr == BROADCAST_ADDR) ||
|
||||
(addr == FALLBACK_ADDR))) { // OBD2 broadcast request, redirect to UDS?
|
||||
switch(dlr) {
|
||||
// VIN 09 OBD2
|
||||
case 0x020902U:
|
||||
can_send_msg(FALLBACK_R_ADDR, 0x4D4F4301U, 0x02491410U, 8U);
|
||||
uds_request = 0xF190U;
|
||||
uds_engine_request = 0xF190U;
|
||||
break;
|
||||
// VIN : F190 on broadcast
|
||||
case 0x90F12203U:
|
||||
can_send_msg(FALLBACK_R_ADDR, 0x4D4F4390U, 0xF1621410U, 8U);
|
||||
break;
|
||||
// VIN continue
|
||||
case 0x30U:
|
||||
can_send_msg(FALLBACK_R_ADDR, 0x5659444FU, 0x42414D21U, 8U);
|
||||
can_send_msg(FALLBACK_R_ADDR, 0x314E4F49U, 0x53524522U, 8U);
|
||||
default:
|
||||
if ((dlr & 0xFF) == 0x30U) {
|
||||
sep_time = (dlr >> 16U) & 0xFF;
|
||||
delay(sep_time);
|
||||
can_send_msg(FALLBACK_R_ADDR, 0x5659444FU, 0x42414D21U, 8U);
|
||||
can_send_msg(FALLBACK_R_ADDR, 0x314E4F49U, 0x53524522U, 8U);
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else if (addr == ECU_ADDR) { // UDS request to "main" ECU
|
||||
} else if (addr == (ENGINE_ADDR + board.uds_offset)) { // UDS request to "main" ECU
|
||||
switch(dlr) {
|
||||
// TESTER PRESENT
|
||||
case 0x3E02U:
|
||||
can_send_msg(ECU_R_ADDR, 0x0U, 0x7E02U, 8U);
|
||||
can_send_msg(ENGINE_R_ADDR + board.uds_offset, 0x0U, 0x7E02U, 8U);
|
||||
break;
|
||||
// DIAGNOSTIC SESSION CONTROL: DEFAULT
|
||||
case 0x011002U:
|
||||
can_send_msg(ECU_R_ADDR, 0x0U, 0x015002U, 8U);
|
||||
can_send_msg(ENGINE_R_ADDR + board.uds_offset, 0x0U, 0x015002U, 8U);
|
||||
break;
|
||||
// DIAGNOSTIC SESSION CONTROL: EXTENDED
|
||||
case 0x031002U:
|
||||
can_send_msg(ECU_R_ADDR, 0x0U, 0x035002U, 8U);
|
||||
can_send_msg(ENGINE_R_ADDR + board.uds_offset, 0x0U, 0x035002U, 8U);
|
||||
break;
|
||||
// APPLICATION SOFTWARE IDENTIFICATION : F181 (used for fingerprinting, firmware version)
|
||||
case 0x81F12203U:
|
||||
COMPILE_TIME_ASSERT(sizeof(version) == 6U);
|
||||
can_send_msg(ECU_R_ADDR, ((version[2] << 24U) | (version[1] << 16U) | (version[0] << 8U) | 0x81U), 0xF1620910U, 8U);
|
||||
uds_request = 0xF181U;
|
||||
can_send_msg(ENGINE_R_ADDR + board.uds_offset, ((version[2] << 24U) | (version[1] << 16U) | (version[0] << 8U) | 0x81U), 0xF1620A10U, 8U);
|
||||
uds_engine_request = 0xF181U;
|
||||
break;
|
||||
// ECU SERIAL NUMBER : F18C
|
||||
case 0x8CF12203U:
|
||||
can_send_msg(ECU_R_ADDR, ((uid[2] << 24U) | (uid[1] << 16U) | (uid[0] << 8U) | 0x8CU), 0xF1620D10U, 8U);
|
||||
uds_request = 0xF18CU;
|
||||
can_send_msg(ENGINE_R_ADDR + board.uds_offset, ((uid[2] << 24U) | (uid[1] << 16U) | (uid[0] << 8U) | 0x8CU), 0xF1620D10U, 8U);
|
||||
uds_engine_request = 0xF18CU;
|
||||
break;
|
||||
// VIN : F190
|
||||
case 0x90F12203U:
|
||||
can_send_msg(ECU_R_ADDR, 0x4D4F4390U, 0xF1621410U, 8U);
|
||||
uds_request = 0xF190U;
|
||||
break;
|
||||
// SYSTEM NAME OR ENGINE TYPE : F197
|
||||
case 0x97F12203U:
|
||||
can_send_msg(ECU_R_ADDR, 0x454C4597U, 0xF1620C10U, 8U);
|
||||
uds_request = 0xF197U;
|
||||
can_send_msg(ENGINE_R_ADDR + board.uds_offset, 0x4D4F4390U, 0xF1621410U, 8U);
|
||||
uds_engine_request = 0xF190U;
|
||||
break;
|
||||
// FLOW CONTROL MESSAGE
|
||||
case 0x30U:
|
||||
switch(uds_request) {
|
||||
// APPLICATION SOFTWARE IDENTIFICATION : F181
|
||||
case 0xF181U:
|
||||
can_send_msg(ECU_R_ADDR, 0x0U, ((version[5] << 24U) | (version[4] << 16U) | (version[3] << 8U) | 0x21U), 8U);
|
||||
uds_request = 0;
|
||||
break;
|
||||
// ECU SERIAL NUMBER : F18C
|
||||
case 0xF18CU:
|
||||
can_send_msg(ECU_R_ADDR, ((uid[9] << 24U) | (uid[8] << 16U) | (uid[7]<< 8U) | uid[6]), ((uid[5] << 24U) | (uid[4] << 16U) | (uid[3] << 8U) | 0x21U), 8U);
|
||||
uds_request = 0;
|
||||
break;
|
||||
// VIN : F190
|
||||
case 0xF190U:
|
||||
can_send_msg(ECU_R_ADDR, 0x5659444FU, 0x42414D21U, 8U);
|
||||
can_send_msg(ECU_R_ADDR, 0x314E4F49U, 0x53524522U, 8U);
|
||||
uds_request = 0;
|
||||
break;
|
||||
// SYSTEM NAME OR ENGINE TYPE : F197
|
||||
case 0xF197U:
|
||||
can_send_msg(ECU_R_ADDR, (((knee_detected + 0x30) << 16U) | 0x4349U), 0x52544321U, 8U);
|
||||
uds_request = 0;
|
||||
break;
|
||||
default:
|
||||
if ((dlr & 0xFF) == 0x30U) {
|
||||
sep_time = (dlr >> 16U) & 0xFF;
|
||||
delay(sep_time);
|
||||
switch(uds_engine_request) {
|
||||
// APPLICATION SOFTWARE IDENTIFICATION : F181
|
||||
case 0xF181U:
|
||||
can_send_msg(ENGINE_R_ADDR + board.uds_offset, (knee_detected + 0x61), ((version[5] << 24U) | (version[4] << 16U) | (version[3] << 8U) | 0x21U), 8U);
|
||||
uds_engine_request = 0;
|
||||
break;
|
||||
// ECU SERIAL NUMBER : F18C
|
||||
case 0xF18CU:
|
||||
can_send_msg(ENGINE_R_ADDR + board.uds_offset, ((uid[9] << 24U) | (uid[8] << 16U) | (uid[7]<< 8U) | uid[6]), ((uid[5] << 24U) | (uid[4] << 16U) | (uid[3] << 8U) | 0x21U), 8U);
|
||||
uds_engine_request = 0;
|
||||
break;
|
||||
// VIN : F190
|
||||
case 0xF190U:
|
||||
can_send_msg(ENGINE_R_ADDR + board.uds_offset, 0x5659444FU, 0x42414D21U, 8U);
|
||||
can_send_msg(ENGINE_R_ADDR + board.uds_offset, 0x314E4F49U, 0x53524522U, 8U);
|
||||
uds_engine_request = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else if (addr == DEBUG_ADDR) { // UDS request to "DEBUG" ECU
|
||||
} else if (addr == (DEBUG_ADDR + board.uds_offset)) { // UDS request to "DEBUG" ECU
|
||||
switch(dlr) {
|
||||
// TESTER PRESENT
|
||||
case 0x3E02U:
|
||||
can_send_msg(DEBUG_R_ADDR, 0x0U, 0x7E02U, 8U);
|
||||
can_send_msg(DEBUG_R_ADDR + board.uds_offset, 0x0U, 0x7E02U, 8U);
|
||||
break;
|
||||
// DIAGNOSTIC SESSION CONTROL: DEFAULT
|
||||
case 0x011002U:
|
||||
can_send_msg(DEBUG_R_ADDR, 0x0U, 0x015002U, 8U);
|
||||
can_send_msg(DEBUG_R_ADDR + board.uds_offset, 0x0U, 0x015002U, 8U);
|
||||
break;
|
||||
// DIAGNOSTIC SESSION CONTROL: EXTENDED
|
||||
case 0x031002U:
|
||||
can_send_msg(DEBUG_R_ADDR, 0x0U, 0x035002U, 8U);
|
||||
can_send_msg(DEBUG_R_ADDR + board.uds_offset, 0x0U, 0x035002U, 8U);
|
||||
break;
|
||||
// APPLICATION SOFTWARE IDENTIFICATION : F181 (used for git hash logging)
|
||||
case 0x81F12203U:
|
||||
COMPILE_TIME_ASSERT(sizeof(gitversion) == 8U);
|
||||
can_send_msg(DEBUG_R_ADDR, ((gitversion[2] << 24U) | (gitversion[1] << 16U) | (gitversion[0] << 8U) | 0x81U), 0xF1620B10U, 8U);
|
||||
uds_request = 0xF181U;
|
||||
can_send_msg((DEBUG_R_ADDR + board.uds_offset), ((gitversion[2] << 24U) | (gitversion[1] << 16U) | (gitversion[0] << 8U) | 0x81U), 0xF1620B10U, 8U);
|
||||
uds_debug_request = 0xF181U;
|
||||
break;
|
||||
case 0x30U:
|
||||
switch(uds_request) {
|
||||
// APPLICATION SOFTWARE IDENTIFICATION : F181
|
||||
case 0xF181U:
|
||||
can_send_msg(DEBUG_R_ADDR, ((gitversion[7]<< 8U) | gitversion[6]), ((gitversion[5] << 24U) | (gitversion[4] << 16U) | (gitversion[3] << 8U) | 0x21U), 8U);
|
||||
uds_request = 0;
|
||||
break;
|
||||
default:
|
||||
if ((dlr & 0xFF) == 0x30U) {
|
||||
sep_time = (dlr >> 16U) & 0xFF;
|
||||
delay(sep_time);
|
||||
switch(uds_debug_request) {
|
||||
// APPLICATION SOFTWARE IDENTIFICATION : F181
|
||||
case 0xF181U:
|
||||
can_send_msg((DEBUG_R_ADDR + board.uds_offset), ((gitversion[7]<< 8U) | gitversion[6]), ((gitversion[5] << 24U) | (gitversion[4] << 16U) | (gitversion[3] << 8U) | 0x21U), 8U);
|
||||
uds_debug_request = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -175,22 +175,6 @@ void poweroff(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void poweroffPressCheck(void) {
|
||||
if(HAL_GPIO_ReadPin(BUTTON_PORT, BUTTON_PIN)) {
|
||||
uint16_t cnt_press = 0;
|
||||
while(HAL_GPIO_ReadPin(BUTTON_PORT, BUTTON_PIN)) {
|
||||
HAL_Delay(10);
|
||||
cnt_press++;
|
||||
if (cnt_press == (2 * 100)) { poweroff(); }
|
||||
}
|
||||
if (cnt_press > 8) {
|
||||
ignition = !ignition;
|
||||
out_enable(IGNITION, ignition);
|
||||
beepShort(5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define PULL_EFFECTIVE_DELAY 4096
|
||||
uint8_t detect_with_pull(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin, uint32_t mode) {
|
||||
GPIO_InitTypeDef GPIO_InitStruct;
|
||||
|
||||
@@ -19,7 +19,6 @@ void calcAvgSpeed(void);
|
||||
|
||||
// Poweroff Functions
|
||||
void poweroff(void);
|
||||
void poweroffPressCheck(void);
|
||||
|
||||
// GPIO functions
|
||||
uint8_t detect_with_pull(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin, uint32_t mode);
|
||||
|
||||
@@ -1 +1 @@
|
||||
const uint8_t version[6] = "0.0.02";
|
||||
const uint8_t version[6] = "0.3.00";
|
||||
|
||||
+1
-4
@@ -1,6 +1,4 @@
|
||||
gen
|
||||
node_modules
|
||||
package-lock.json
|
||||
/gen/
|
||||
*.tmp
|
||||
*.pyc
|
||||
__pycache__
|
||||
@@ -18,4 +16,3 @@ services.h
|
||||
.sconsign.dblite
|
||||
libcereal_shared.*
|
||||
.mypy_cache/
|
||||
catch2/
|
||||
|
||||
+3
-1
@@ -8,7 +8,7 @@ messaging_dir = Dir('messaging')
|
||||
|
||||
# Build cereal
|
||||
|
||||
schema_files = ['log.capnp', 'car.capnp', 'legacy.capnp']
|
||||
schema_files = ['log.capnp', 'car.capnp', 'legacy.capnp', 'custom.capnp']
|
||||
env.Command(["gen/c/include/c++.capnp.h"], [], "mkdir -p " + gen_dir.path + "/c/include && touch $TARGETS")
|
||||
env.Command([f'gen/cpp/{s}.c++' for s in schema_files] + [f'gen/cpp/{s}.h' for s in schema_files],
|
||||
schema_files,
|
||||
@@ -26,8 +26,10 @@ services_h = env.Command(['services.h'], ['services.py'], 'python3 ' + cereal_di
|
||||
|
||||
messaging_objects = env.SharedObject([
|
||||
'messaging/messaging.cc',
|
||||
'messaging/event.cc',
|
||||
'messaging/impl_zmq.cc',
|
||||
'messaging/impl_msgq.cc',
|
||||
'messaging/impl_fake.cc',
|
||||
'messaging/msgq.cc',
|
||||
'messaging/socketmaster.cc',
|
||||
])
|
||||
|
||||
@@ -7,3 +7,4 @@ capnp.remove_import_hook()
|
||||
|
||||
log = capnp.load(os.path.join(CEREAL_PATH, "log.capnp"))
|
||||
car = capnp.load(os.path.join(CEREAL_PATH, "car.capnp"))
|
||||
custom = capnp.load(os.path.join(CEREAL_PATH, "custom.capnp"))
|
||||
|
||||
+64
-34
@@ -17,12 +17,12 @@ struct CarEvent @0x9b1657f34caf3ad3 {
|
||||
immediateDisable @6 :Bool;
|
||||
preEnable @7 :Bool;
|
||||
permanent @8 :Bool; # alerts presented regardless of openpilot state
|
||||
override @9 :Bool;
|
||||
overrideLateral @10 :Bool;
|
||||
overrideLongitudinal @9 :Bool;
|
||||
|
||||
enum EventName @0xbaa8c5d505f727de {
|
||||
canError @0;
|
||||
steerUnavailable @1;
|
||||
brakeUnavailable @2;
|
||||
wrongGear @4;
|
||||
doorOpen @5;
|
||||
seatbeltNotLatched @6;
|
||||
@@ -33,18 +33,19 @@ struct CarEvent @0x9b1657f34caf3ad3 {
|
||||
buttonCancel @11;
|
||||
buttonEnable @12;
|
||||
pedalPressed @13; # exits active state
|
||||
pedalPressedPreEnable @73; # added during pre-enable state for either pedal
|
||||
preEnableStandstill @73; # added during pre-enable state with brake
|
||||
gasPressedOverride @108; # added when user is pressing gas with no disengage on gas
|
||||
steerOverride @114;
|
||||
cruiseDisabled @14;
|
||||
speedTooLow @17;
|
||||
outOfSpace @18;
|
||||
overheat @19;
|
||||
calibrationIncomplete @20;
|
||||
calibrationInvalid @21;
|
||||
calibrationRecalibrating @117;
|
||||
controlsMismatch @22;
|
||||
pcmEnable @23;
|
||||
pcmDisable @24;
|
||||
noTarget @25;
|
||||
radarFault @26;
|
||||
brakeHold @28;
|
||||
parkBrake @29;
|
||||
@@ -112,6 +113,8 @@ struct CarEvent @0x9b1657f34caf3ad3 {
|
||||
canBusMissing @111;
|
||||
controlsdLagging @112;
|
||||
resumeBlocked @113;
|
||||
steerTimeLimit @115;
|
||||
vehicleSensorsInvalid @116;
|
||||
|
||||
radarCanErrorDEPRECATED @15;
|
||||
communityFeatureDisallowedDEPRECATED @62;
|
||||
@@ -135,6 +138,8 @@ struct CarEvent @0x9b1657f34caf3ad3 {
|
||||
modelLagWarningDEPRECATED @93;
|
||||
startupOneplusDEPRECATED @82;
|
||||
startupFuzzyFingerprintDEPRECATED @97;
|
||||
noTargetDEPRECATED @25;
|
||||
brakeUnavailableDEPRECATED @2;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,10 +166,13 @@ struct CarState {
|
||||
# gas pedal, 0.0-1.0
|
||||
gas @3 :Float32; # this is user pedal only
|
||||
gasPressed @4 :Bool; # this is user pedal only
|
||||
|
||||
engineRpm @46 :Float32;
|
||||
|
||||
# brake pedal, 0.0-1.0
|
||||
brake @5 :Float32; # this is user pedal only
|
||||
brakePressed @6 :Bool; # this is user pedal only
|
||||
regenBraking @45 :Bool; # this is user pedal only
|
||||
parkingBrake @39 :Bool;
|
||||
brakeHoldActive @38 :Bool;
|
||||
|
||||
@@ -181,6 +189,7 @@ struct CarState {
|
||||
stockFcw @31 :Bool;
|
||||
espDisabled @32 :Bool;
|
||||
accFaulted @42 :Bool;
|
||||
carFaultedNonCritical @47 :Bool; # some ECU is faulted, but car remains controllable
|
||||
|
||||
# cruise state
|
||||
cruiseState @10 :CruiseState;
|
||||
@@ -201,9 +210,6 @@ struct CarState {
|
||||
# clutch (manual transmission only)
|
||||
clutchPressed @28 :Bool;
|
||||
|
||||
# which packets this state came from
|
||||
canMonoTimes @12: List(UInt64);
|
||||
|
||||
# blindspot sensors
|
||||
leftBlindspot @33 :Bool; # Is there something blocking the left lane change
|
||||
rightBlindspot @34 :Bool; # Is there something blocking the right lane change
|
||||
@@ -263,9 +269,11 @@ struct CarState {
|
||||
}
|
||||
}
|
||||
|
||||
# deprecated
|
||||
errorsDEPRECATED @0 :List(CarEvent.EventName);
|
||||
brakeLightsDEPRECATED @19 :Bool;
|
||||
steeringRateLimitedDEPRECATED @29 :Bool;
|
||||
canMonoTimesDEPRECATED @12: List(UInt64);
|
||||
}
|
||||
|
||||
# ******* radar state @ 20hz *******
|
||||
@@ -274,9 +282,6 @@ struct RadarData @0x888ad6581cf0aacb {
|
||||
errors @0 :List(Error);
|
||||
points @1 :List(RadarPoint);
|
||||
|
||||
# which packets this state came from
|
||||
canMonoTimes @2 :List(UInt64);
|
||||
|
||||
enum Error {
|
||||
canError @0;
|
||||
fault @1;
|
||||
@@ -300,6 +305,9 @@ struct RadarData @0x888ad6581cf0aacb {
|
||||
# some radars flag measurements VS estimates
|
||||
measured @6 :Bool;
|
||||
}
|
||||
|
||||
# deprecated
|
||||
canMonoTimesDEPRECATED @2 :List(UInt64);
|
||||
}
|
||||
|
||||
# ******* car controls @ 100hz *******
|
||||
@@ -313,6 +321,9 @@ struct CarControl {
|
||||
# Actuator commands as computed by controlsd
|
||||
actuators @6 :Actuators;
|
||||
|
||||
leftBlinker @15: Bool;
|
||||
rightBlinker @16: Bool;
|
||||
|
||||
# Any car specific rate limits or quirks applied by
|
||||
# the CarController are reflected in actuatorsOutput
|
||||
# and matches what is sent to the car
|
||||
@@ -330,8 +341,12 @@ struct CarControl {
|
||||
brake @1: Float32;
|
||||
# range from -1.0 - 1.0
|
||||
steer @2: Float32;
|
||||
# value sent over can to the car
|
||||
steerOutputCan @8: Float32;
|
||||
steeringAngleDeg @3: Float32;
|
||||
|
||||
curvature @7: Float32;
|
||||
|
||||
speed @6: Float32; # m/s
|
||||
accel @4: Float32; # m/s^2
|
||||
longControlState @5: LongControlState;
|
||||
@@ -340,15 +355,14 @@ struct CarControl {
|
||||
off @0;
|
||||
pid @1;
|
||||
stopping @2;
|
||||
|
||||
startingDEPRECATED @3;
|
||||
starting @3;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
struct CruiseControl {
|
||||
cancel @0: Bool;
|
||||
resume @1: Bool;
|
||||
override @4: Bool;
|
||||
speedOverrideDEPRECATED @2: Float32;
|
||||
accelOverrideDEPRECATED @3: Float32;
|
||||
}
|
||||
@@ -414,23 +428,18 @@ struct CarParams {
|
||||
enableGasInterceptor @2 :Bool;
|
||||
pcmCruise @3 :Bool; # is openpilot's state tied to the PCM's cruise state?
|
||||
enableDsu @5 :Bool; # driving support unit
|
||||
enableApgs @6 :Bool; # advanced parking guidance system
|
||||
enableBsm @56 :Bool; # blind spot monitoring
|
||||
flags @64 :UInt32; # flags for car specific quirks
|
||||
experimentalLongitudinalAvailable @71 :Bool;
|
||||
|
||||
minEnableSpeed @7 :Float32;
|
||||
minSteerSpeed @8 :Float32;
|
||||
maxSteeringAngleDeg @54 :Float32;
|
||||
safetyConfigs @62 :List(SafetyConfig);
|
||||
alternativeExperience @65 :Int16; # panda flag for features like no disengage on gas
|
||||
maxLateralAccel @68 :Float32;
|
||||
|
||||
steerMaxBPDEPRECATED @11 :List(Float32);
|
||||
steerMaxVDEPRECATED @12 :List(Float32);
|
||||
gasMaxBPDEPRECATED @13 :List(Float32);
|
||||
gasMaxVDEPRECATED @14 :List(Float32);
|
||||
brakeMaxBPDEPRECATED @15 :List(Float32);
|
||||
brakeMaxVDEPRECATED @16 :List(Float32);
|
||||
# Car docs fields
|
||||
maxLateralAccel @68 :Float32;
|
||||
autoResumeSng @69 :Bool; # describes whether car can resume from a stop automatically
|
||||
|
||||
# things about the car in the manual
|
||||
mass @17 :Float32; # [kg] curb weight: all fluids no cargo
|
||||
@@ -458,12 +467,13 @@ struct CarParams {
|
||||
|
||||
vEgoStopping @29 :Float32; # Speed at which the car goes into stopping state
|
||||
vEgoStarting @59 :Float32; # Speed at which the car goes into starting state
|
||||
directAccelControl @30 :Bool; # Does the car have direct accel control or just gas/brake
|
||||
stoppingControl @31 :Bool; # Does the car allows full control even at lows speeds when stopping
|
||||
stopAccel @60 :Float32; # Required acceleraton to keep vehicle stationary
|
||||
stoppingControl @31 :Bool; # Does the car allow full control even at lows speeds when stopping
|
||||
steerControlType @34 :SteerControlType;
|
||||
radarOffCan @35 :Bool; # True when radar objects aren't visible on CAN
|
||||
radarUnavailable @35 :Bool; # True when radar objects aren't visible on CAN or aren't parsed out
|
||||
stopAccel @60 :Float32; # Required acceleration to keep vehicle stationary
|
||||
stoppingDecelRate @52 :Float32; # m/s^2/s while trying to stop
|
||||
startAccel @32 :Float32; # Required acceleration to get car moving
|
||||
startingState @70 :Bool; # Does this car make use of special starting state
|
||||
|
||||
steerActuatorDelay @36 :Float32; # Steering wheel actuator delay in seconds
|
||||
longitudinalActuatorDelayLowerBound @61 :Float32; # Gas/Brake actuator delay in seconds, lower bound
|
||||
@@ -507,6 +517,8 @@ struct CarParams {
|
||||
friction @3 :Float32;
|
||||
kf @4 :Float32;
|
||||
steeringAngleDeadzoneDeg @5 :Float32;
|
||||
latAccelFactor @6 :Float32;
|
||||
latAccelOffset @7 :Float32;
|
||||
}
|
||||
|
||||
struct LongitudinalPIDTuning {
|
||||
@@ -572,11 +584,11 @@ struct CarParams {
|
||||
noOutput @19; # like silent but without silent CAN TXs
|
||||
hondaBosch @20;
|
||||
volkswagenPq @21;
|
||||
subaruLegacy @22; # pre-Global platform
|
||||
subaruPreglobal @22; # pre-Global platform
|
||||
hyundaiLegacy @23;
|
||||
hyundaiCommunity @24;
|
||||
stellantis @25;
|
||||
faw @26;
|
||||
volkswagenMlb @25;
|
||||
hongqi @26;
|
||||
body @27;
|
||||
hyundaiCanfd @28;
|
||||
}
|
||||
@@ -584,6 +596,7 @@ struct CarParams {
|
||||
enum SteerControlType {
|
||||
torque @0;
|
||||
angle @1;
|
||||
curvature @2;
|
||||
}
|
||||
|
||||
enum TransmissionType {
|
||||
@@ -603,11 +616,13 @@ struct CarParams {
|
||||
request @5 :List(Data);
|
||||
brand @6 :Text;
|
||||
bus @7 :UInt8;
|
||||
logging @8 :Bool;
|
||||
obdMultiplexing @9 :Bool;
|
||||
}
|
||||
|
||||
enum Ecu {
|
||||
eps @0;
|
||||
esp @1;
|
||||
abs @1;
|
||||
fwdRadar @2;
|
||||
fwdCamera @3;
|
||||
engine @4;
|
||||
@@ -617,18 +632,25 @@ struct CarParams {
|
||||
gateway @10; # can gateway
|
||||
hud @11; # heads up display
|
||||
combinationMeter @12; # instrument cluster
|
||||
electricBrakeBooster @15;
|
||||
shiftByWire @16;
|
||||
adas @19;
|
||||
cornerRadar @21;
|
||||
hvac @20;
|
||||
parkingAdas @7; # parking assist system ECU, e.g. Toyota's IPAS, Hyundai's RSPA, etc.
|
||||
|
||||
# Toyota only
|
||||
dsu @6;
|
||||
apgs @7;
|
||||
|
||||
# Honda only
|
||||
vsa @13; # Vehicle Stability Assist
|
||||
programmedFuelInjection @14;
|
||||
electricBrakeBooster @15;
|
||||
shiftByWire @16;
|
||||
|
||||
# Chrysler only
|
||||
hcp @18; # Hybrid Control Processor
|
||||
|
||||
debug @17;
|
||||
unused @22;
|
||||
}
|
||||
|
||||
enum FingerprintSource {
|
||||
@@ -643,6 +665,7 @@ struct CarParams {
|
||||
}
|
||||
|
||||
enableCameraDEPRECATED @4 :Bool;
|
||||
enableApgsDEPRECATED @6 :Bool;
|
||||
steerRateCostDEPRECATED @33 :Float32;
|
||||
isPandaBlackDEPRECATED @39 :Bool;
|
||||
hasStockCameraDEPRECATED @57 :Bool;
|
||||
@@ -650,7 +673,14 @@ struct CarParams {
|
||||
safetyModelDEPRECATED @9 :SafetyModel;
|
||||
safetyModelPassiveDEPRECATED @42 :SafetyModel = silent;
|
||||
minSpeedCanDEPRECATED @51 :Float32;
|
||||
startAccelDEPRECATED @32 :Float32;
|
||||
communityFeatureDEPRECATED @46: Bool;
|
||||
startingAccelRateDEPRECATED @53 :Float32;
|
||||
steerMaxBPDEPRECATED @11 :List(Float32);
|
||||
steerMaxVDEPRECATED @12 :List(Float32);
|
||||
gasMaxBPDEPRECATED @13 :List(Float32);
|
||||
gasMaxVDEPRECATED @14 :List(Float32);
|
||||
brakeMaxBPDEPRECATED @15 :List(Float32);
|
||||
brakeMaxVDEPRECATED @16 :List(Float32);
|
||||
directAccelControlDEPRECATED @30 :Bool;
|
||||
maxSteeringAngleDegDEPRECATED @54 :Float32;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
using Cxx = import "./include/c++.capnp";
|
||||
$Cxx.namespace("cereal");
|
||||
|
||||
@0xb526ba661d550a59;
|
||||
|
||||
# custom.capnp: a home for empty structs reserved for custom forks
|
||||
# These structs are guaranteed to remain reserved and empty in mainline
|
||||
# cereal, so use these if you want custom events in your fork.
|
||||
|
||||
# you can rename the struct, but don't change the identifier
|
||||
struct CustomReserved0 @0x81c2f05a394cf4af {
|
||||
}
|
||||
|
||||
struct CustomReserved1 @0xaedffd8f31e7b55d {
|
||||
}
|
||||
|
||||
struct CustomReserved2 @0xf35cc4560bbf6ec2 {
|
||||
}
|
||||
|
||||
struct CustomReserved3 @0xda96579883444c35 {
|
||||
}
|
||||
|
||||
struct CustomReserved4 @0x80ae746ee2596b11 {
|
||||
}
|
||||
|
||||
struct CustomReserved5 @0xa5cd762cd951a455 {
|
||||
}
|
||||
|
||||
struct CustomReserved6 @0xf98d843bfd7004a3 {
|
||||
}
|
||||
|
||||
struct CustomReserved7 @0xb86e6369214c01c8 {
|
||||
}
|
||||
|
||||
struct CustomReserved8 @0xf416ec09499d9d19 {
|
||||
}
|
||||
|
||||
struct CustomReserved9 @0xa1680744031fdb2d {
|
||||
}
|
||||
+374
-84
@@ -3,6 +3,7 @@ $Cxx.namespace("cereal");
|
||||
|
||||
using Car = import "car.capnp";
|
||||
using Legacy = import "legacy.capnp";
|
||||
using Custom = import "custom.capnp";
|
||||
|
||||
@0xf3b1f17e25a4285b;
|
||||
|
||||
@@ -16,6 +17,12 @@ struct Map(Key, Value) {
|
||||
}
|
||||
}
|
||||
|
||||
enum LongitudinalPersonality {
|
||||
aggressive @0;
|
||||
standard @1;
|
||||
relaxed @2;
|
||||
}
|
||||
|
||||
struct InitData {
|
||||
kernelArgs @0 :List(Text);
|
||||
kernelVersion @15 :Text;
|
||||
@@ -46,6 +53,7 @@ struct InitData {
|
||||
chffrIos @3;
|
||||
tici @4;
|
||||
pc @5;
|
||||
tizi @6;
|
||||
}
|
||||
|
||||
struct PandaInfo {
|
||||
@@ -137,23 +145,11 @@ struct FrameData {
|
||||
gain @15 :Float32; # This includes highConversionGain if enabled
|
||||
measuredGreyFraction @21 :Float32;
|
||||
targetGreyFraction @22 :Float32;
|
||||
|
||||
# Focus
|
||||
lensPos @11 :Int32;
|
||||
lensSag @12 :Float32;
|
||||
lensErr @13 :Float32;
|
||||
lensTruePos @14 :Float32;
|
||||
focusVal @16 :List(Int16);
|
||||
focusConf @17 :List(UInt8);
|
||||
sharpnessScore @18 :List(UInt16);
|
||||
recoverState @19 :Int32;
|
||||
exposureValPercent @27 :Float32;
|
||||
|
||||
transform @10 :List(Float32);
|
||||
|
||||
androidCaptureResult @9 :AndroidCaptureResult;
|
||||
|
||||
image @6 :Data;
|
||||
globalGainDEPRECATED @5 :Int32;
|
||||
|
||||
temperaturesC @24 :List(Float32);
|
||||
|
||||
@@ -164,6 +160,23 @@ struct FrameData {
|
||||
front @3;
|
||||
}
|
||||
|
||||
sensor @26 :ImageSensor;
|
||||
enum ImageSensor {
|
||||
unknown @0;
|
||||
ar0231 @1;
|
||||
ox03c10 @2;
|
||||
}
|
||||
|
||||
globalGainDEPRECATED @5 :Int32;
|
||||
androidCaptureResultDEPRECATED @9 :AndroidCaptureResult;
|
||||
lensPosDEPRECATED @11 :Int32;
|
||||
lensSagDEPRECATED @12 :Float32;
|
||||
lensErrDEPRECATED @13 :Float32;
|
||||
lensTruePosDEPRECATED @14 :Float32;
|
||||
focusValDEPRECATED @16 :List(Int16);
|
||||
focusConfDEPRECATED @17 :List(UInt8);
|
||||
sharpnessScoreDEPRECATED @18 :List(UInt16);
|
||||
recoverStateDEPRECATED @19 :Int32;
|
||||
struct AndroidCaptureResult {
|
||||
sensitivity @0 :Int32;
|
||||
frameDuration @1 :Int64;
|
||||
@@ -220,9 +233,9 @@ struct SensorEventData {
|
||||
fiber @2;
|
||||
velodyne @3; # Velodyne IMU
|
||||
bno055 @4; # Bosch accelerometer
|
||||
lsm6ds3 @5; # accelerometer (c2)
|
||||
bmp280 @6; # barometer (c2)
|
||||
mmc3416x @7; # magnetometer (c2)
|
||||
lsm6ds3 @5; # includes LSM6DS3 and LSM6DS3TR, TR = tape reel
|
||||
bmp280 @6; # barometer
|
||||
mmc3416x @7; # magnetometer
|
||||
bmx055 @8;
|
||||
rpr0521 @9;
|
||||
lsm6ds3trc @10;
|
||||
@@ -290,7 +303,6 @@ struct CanData {
|
||||
}
|
||||
|
||||
struct DeviceState @0xa4d8b5af2aa492eb {
|
||||
usbOnline @12 :Bool;
|
||||
networkType @22 :NetworkType;
|
||||
networkInfo @31 :NetworkInfo;
|
||||
networkStrength @24 :NetworkStrength;
|
||||
@@ -308,10 +320,6 @@ struct DeviceState @0xa4d8b5af2aa492eb {
|
||||
cpuUsagePercent @34 :List(Int8); # per-core cpu usage
|
||||
|
||||
# power
|
||||
batteryPercent @8 :Int16;
|
||||
batteryCurrent @15 :Int32;
|
||||
chargingError @17 :Bool;
|
||||
chargingDisabled @18 :Bool;
|
||||
offroadPowerUsageUwh @23 :UInt32;
|
||||
carBatteryCapacityUwh @25 :UInt32;
|
||||
powerDrawW @40 :Float32;
|
||||
@@ -325,6 +333,7 @@ struct DeviceState @0xa4d8b5af2aa492eb {
|
||||
nvmeTempC @35 :List(Float32);
|
||||
modemTempC @36 :List(Float32);
|
||||
pmicTempC @39 :List(Float32);
|
||||
maxTempC @44 :Float32; # max of other temps, used to control fan
|
||||
thermalZones @38 :List(ThermalZone);
|
||||
thermalStatus @14 :ThermalStatus;
|
||||
|
||||
@@ -388,30 +397,52 @@ struct DeviceState @0xa4d8b5af2aa492eb {
|
||||
batteryStatusDEPRECATED @9 :Text;
|
||||
batteryVoltageDEPRECATED @16 :Int32;
|
||||
batteryTempCDEPRECATED @29 :Float32;
|
||||
batteryPercentDEPRECATED @8 :Int16;
|
||||
batteryCurrentDEPRECATED @15 :Int32;
|
||||
chargingErrorDEPRECATED @17 :Bool;
|
||||
chargingDisabledDEPRECATED @18 :Bool;
|
||||
usbOnlineDEPRECATED @12 :Bool;
|
||||
}
|
||||
|
||||
struct PandaState @0xa7649e2575e4591e {
|
||||
ignitionLine @2 :Bool;
|
||||
controlsAllowed @3 :Bool;
|
||||
gasInterceptorDetected @4 :Bool;
|
||||
canSendErrs @7 :UInt32;
|
||||
canFwdErrs @8 :UInt32;
|
||||
canRxErrs @19 :UInt32;
|
||||
rxBufferOverflow @7 :UInt32;
|
||||
txBufferOverflow @8 :UInt32;
|
||||
gmlanSendErrs @9 :UInt32;
|
||||
pandaType @10 :PandaType;
|
||||
ignitionCan @13 :Bool;
|
||||
safetyModel @14 :Car.CarParams.SafetyModel;
|
||||
safetyParam @27 :UInt16;
|
||||
alternativeExperience @23 :Int16;
|
||||
faultStatus @15 :FaultStatus;
|
||||
powerSaveEnabled @16 :Bool;
|
||||
uptime @17 :UInt32;
|
||||
faults @18 :List(FaultType);
|
||||
harnessStatus @21 :HarnessStatus;
|
||||
heartbeatLost @22 :Bool;
|
||||
blockedCnt @24 :UInt32;
|
||||
interruptLoad @25 :Float32;
|
||||
fanPower @28 :UInt8;
|
||||
fanStallCount @34 :UInt8;
|
||||
|
||||
spiChecksumErrorCount @33 :UInt16;
|
||||
|
||||
harnessStatus @21 :HarnessStatus;
|
||||
sbu1Voltage @35 :Float32;
|
||||
sbu2Voltage @36 :Float32;
|
||||
|
||||
# can health
|
||||
canState0 @29 :PandaCanState;
|
||||
canState1 @30 :PandaCanState;
|
||||
canState2 @31 :PandaCanState;
|
||||
|
||||
# safety stuff
|
||||
controlsAllowed @3 :Bool;
|
||||
safetyRxInvalid @19 :UInt32;
|
||||
safetyTxBlocked @24 :UInt32;
|
||||
safetyModel @14 :Car.CarParams.SafetyModel;
|
||||
safetyParam @27 :UInt16;
|
||||
alternativeExperience @23 :Int16;
|
||||
safetyRxChecksInvalid @32 :Bool;
|
||||
|
||||
voltage @0 :UInt32;
|
||||
current @1 :UInt32;
|
||||
|
||||
enum FaultStatus {
|
||||
none @0;
|
||||
@@ -443,6 +474,10 @@ struct PandaState @0xa7649e2575e4591e {
|
||||
interruptRateClockSource @20;
|
||||
interruptRateTick @21;
|
||||
interruptRateExti @22;
|
||||
interruptRateSpi @23;
|
||||
interruptRateUart7 @24;
|
||||
sirenMalfunction @25;
|
||||
heartbeatLoopWatchdog @26;
|
||||
# Update max fault type in boardd when adding faults
|
||||
}
|
||||
|
||||
@@ -455,6 +490,8 @@ struct PandaState @0xa7649e2575e4591e {
|
||||
uno @5;
|
||||
dos @6;
|
||||
redPanda @7;
|
||||
redPandaV2 @8;
|
||||
tres @9;
|
||||
}
|
||||
|
||||
enum HarnessStatus {
|
||||
@@ -463,12 +500,45 @@ struct PandaState @0xa7649e2575e4591e {
|
||||
flipped @2;
|
||||
}
|
||||
|
||||
struct PandaCanState {
|
||||
busOff @0 :Bool;
|
||||
busOffCnt @1 :UInt32;
|
||||
errorWarning @2 :Bool;
|
||||
errorPassive @3 :Bool;
|
||||
lastError @4 :LecErrorCode;
|
||||
lastStoredError @5 :LecErrorCode;
|
||||
lastDataError @6 :LecErrorCode;
|
||||
lastDataStoredError @7 :LecErrorCode;
|
||||
receiveErrorCnt @8 :UInt8;
|
||||
transmitErrorCnt @9 :UInt8;
|
||||
totalErrorCnt @10 :UInt32;
|
||||
totalTxLostCnt @11 :UInt32;
|
||||
totalRxLostCnt @12 :UInt32;
|
||||
totalTxCnt @13 :UInt32;
|
||||
totalRxCnt @14 :UInt32;
|
||||
totalFwdCnt @15 :UInt32;
|
||||
canSpeed @16 :UInt16;
|
||||
canDataSpeed @17 :UInt16;
|
||||
canfdEnabled @18 :Bool;
|
||||
brsEnabled @19 :Bool;
|
||||
canfdNonIso @20 :Bool;
|
||||
|
||||
enum LecErrorCode {
|
||||
noError @0;
|
||||
stuffError @1;
|
||||
formError @2;
|
||||
ackError @3;
|
||||
bit1Error @4;
|
||||
bit0Error @5;
|
||||
crcError @6;
|
||||
noChange @7;
|
||||
}
|
||||
}
|
||||
|
||||
startedSignalDetectedDEPRECATED @5 :Bool;
|
||||
voltageDEPRECATED @0 :UInt32;
|
||||
currentDEPRECATED @1 :UInt32;
|
||||
hasGpsDEPRECATED @6 :Bool;
|
||||
fanSpeedRpmDEPRECATED @11 :UInt16;
|
||||
usbPowerModeDEPRECATED @12 :PeripheralState.UsbPowerMode;
|
||||
usbPowerModeDEPRECATED @12 :PeripheralState.UsbPowerModeDEPRECATED;
|
||||
safetyParamDEPRECATED @20 :Int16;
|
||||
safetyParam2DEPRECATED @26 :UInt32;
|
||||
}
|
||||
@@ -478,9 +548,9 @@ struct PeripheralState {
|
||||
voltage @1 :UInt32;
|
||||
current @2 :UInt32;
|
||||
fanSpeedRpm @3 :UInt16;
|
||||
usbPowerMode @4 :UsbPowerMode;
|
||||
|
||||
enum UsbPowerMode @0xa8883583b32c9877 {
|
||||
usbPowerModeDEPRECATED @4 :UsbPowerModeDEPRECATED;
|
||||
enum UsbPowerModeDEPRECATED @0xa8883583b32c9877 {
|
||||
none @0;
|
||||
client @1;
|
||||
cdp @2;
|
||||
@@ -489,7 +559,6 @@ struct PeripheralState {
|
||||
}
|
||||
|
||||
struct RadarState @0x9a185389d6fdd05f {
|
||||
canMonoTimes @10 :List(UInt64);
|
||||
mdMonoTime @6 :UInt64;
|
||||
carStateMonoTime @11 :UInt64;
|
||||
radarErrors @12 :List(Car.RadarData.Error);
|
||||
@@ -524,10 +593,11 @@ struct RadarState @0x9a185389d6fdd05f {
|
||||
calStatusDEPRECATED @2 :Int8;
|
||||
calCycleDEPRECATED @8 :Int32;
|
||||
calPercDEPRECATED @9 :Int8;
|
||||
canMonoTimesDEPRECATED @10 :List(UInt64);
|
||||
}
|
||||
|
||||
struct LiveCalibrationData {
|
||||
calStatus @1 :Int8;
|
||||
calStatus @11 :Status;
|
||||
calCycle @2 :Int32;
|
||||
calPerc @3 :Int8;
|
||||
validBlocks @9 :Int32;
|
||||
@@ -538,10 +608,20 @@ struct LiveCalibrationData {
|
||||
# the direction of travel vector in device frame
|
||||
rpyCalib @7 :List(Float32);
|
||||
rpyCalibSpread @8 :List(Float32);
|
||||
wideFromDeviceEuler @10 :List(Float32);
|
||||
height @12 :List(Float32);
|
||||
|
||||
warpMatrixDEPRECATED @0 :List(Float32);
|
||||
calStatusDEPRECATED @1 :Int8;
|
||||
warpMatrix2DEPRECATED @5 :List(Float32);
|
||||
warpMatrixBigDEPRECATED @6 :List(Float32);
|
||||
|
||||
enum Status {
|
||||
uncalibrated @0;
|
||||
calibrated @1;
|
||||
invalid @2;
|
||||
recalibrating @3;
|
||||
}
|
||||
}
|
||||
|
||||
struct LiveTracks {
|
||||
@@ -559,7 +639,6 @@ struct LiveTracks {
|
||||
|
||||
struct ControlsState @0x97ff69c53601abf1 {
|
||||
startMonoTime @48 :UInt64;
|
||||
canMonoTimes @21 :List(UInt64);
|
||||
longitudinalPlanMonoTime @28 :UInt64;
|
||||
lateralPlanMonoTime @50 :UInt64;
|
||||
|
||||
@@ -567,6 +646,8 @@ struct ControlsState @0x97ff69c53601abf1 {
|
||||
enabled @19 :Bool;
|
||||
active @36 :Bool;
|
||||
|
||||
experimentalMode @64 :Bool;
|
||||
|
||||
longControlState @30 :Car.CarControl.Actuators.LongControlState;
|
||||
vPid @2 :Float32;
|
||||
vTargetLead @3 :Float32;
|
||||
@@ -597,10 +678,12 @@ struct ControlsState @0x97ff69c53601abf1 {
|
||||
lateralControlState :union {
|
||||
indiState @52 :LateralINDIState;
|
||||
pidState @53 :LateralPIDState;
|
||||
lqrState @55 :LateralLQRState;
|
||||
angleState @58 :LateralAngleState;
|
||||
debugState @59 :LateralDebugState;
|
||||
torqueState @60 :LateralTorqueState;
|
||||
curvatureState @65 :LateralCurvatureState;
|
||||
|
||||
lqrStateDEPRECATED @55 :LateralLQRState;
|
||||
}
|
||||
|
||||
enum OpenpilotState @0xdbe58b96d2d1ac61 {
|
||||
@@ -608,7 +691,7 @@ struct ControlsState @0x97ff69c53601abf1 {
|
||||
preEnabled @1;
|
||||
enabled @2;
|
||||
softDisabling @3;
|
||||
overriding @4;
|
||||
overriding @4; # superset of overriding with steering or accelerator
|
||||
}
|
||||
|
||||
enum AlertStatus {
|
||||
@@ -685,6 +768,18 @@ struct ControlsState @0x97ff69c53601abf1 {
|
||||
steeringAngleDesiredDeg @4 :Float32;
|
||||
}
|
||||
|
||||
struct LateralCurvatureState {
|
||||
active @0 :Bool;
|
||||
actualCurvature @1 :Float32;
|
||||
desiredCurvature @2 :Float32;
|
||||
error @3 :Float32;
|
||||
p @4 :Float32;
|
||||
i @5 :Float32;
|
||||
f @6 :Float32;
|
||||
output @7 :Float32;
|
||||
saturated @8 :Bool;
|
||||
}
|
||||
|
||||
struct LateralDebugState {
|
||||
active @0 :Bool;
|
||||
steeringAngleDeg @1 :Float32;
|
||||
@@ -721,6 +816,18 @@ struct ControlsState @0x97ff69c53601abf1 {
|
||||
jerkFactorDEPRECATED @12 :Float32;
|
||||
steerOverrideDEPRECATED @20 :Bool;
|
||||
steeringAngleDesiredDegDEPRECATED @29 :Float32;
|
||||
canMonoTimesDEPRECATED @21 :List(UInt64);
|
||||
}
|
||||
|
||||
# All SI units and in device frame
|
||||
struct XYZTData @0xc3cbae1fd505ae80 {
|
||||
x @0 :List(Float32);
|
||||
y @1 :List(Float32);
|
||||
z @2 :List(Float32);
|
||||
t @3 :List(Float32);
|
||||
xStd @4 :List(Float32);
|
||||
yStd @5 :List(Float32);
|
||||
zStd @6 :List(Float32);
|
||||
}
|
||||
|
||||
struct ModelDataV2 {
|
||||
@@ -753,16 +860,9 @@ struct ModelDataV2 {
|
||||
|
||||
meta @12 :MetaData;
|
||||
|
||||
# All SI units and in device frame
|
||||
struct XYZTData {
|
||||
x @0 :List(Float32);
|
||||
y @1 :List(Float32);
|
||||
z @2 :List(Float32);
|
||||
t @3 :List(Float32);
|
||||
xStd @4 :List(Float32);
|
||||
yStd @5 :List(Float32);
|
||||
zStd @6 :List(Float32);
|
||||
}
|
||||
# Model perceived motion
|
||||
temporalPose @21 :Pose;
|
||||
|
||||
|
||||
struct LeadDataV2 {
|
||||
prob @0 :Float32; # probability that car is your lead at time t
|
||||
@@ -816,6 +916,13 @@ struct ModelDataV2 {
|
||||
brake4MetersPerSecondSquaredProbs @5 :List(Float32);
|
||||
brake5MetersPerSecondSquaredProbs @6 :List(Float32);
|
||||
}
|
||||
|
||||
struct Pose {
|
||||
trans @0 :List(Float32); # m/s in device frame
|
||||
rot @1 :List(Float32); # rad/s in device frame
|
||||
transStd @2 :List(Float32); # std m/s in device frame
|
||||
rotStd @3 :List(Float32); # std rad/s in device frame
|
||||
}
|
||||
}
|
||||
|
||||
struct EncodeIndex {
|
||||
@@ -838,13 +945,17 @@ struct EncodeIndex {
|
||||
len @9 :UInt32;
|
||||
|
||||
enum Type {
|
||||
bigBoxLossless @0; # rcamera.mkv
|
||||
fullHEVC @1; # fcamera.hevc
|
||||
bigBoxHEVC @2; # bcamera.hevc
|
||||
chffrAndroidH264 @3; # acamera
|
||||
fullLosslessClip @4; # prcamera.mkv
|
||||
front @5; # dcamera.hevc
|
||||
qcameraH264 @6; # qcamera.ts
|
||||
bigBoxLossless @0;
|
||||
fullHEVC @1;
|
||||
qcameraH264 @6;
|
||||
livestreamH264 @7;
|
||||
|
||||
# deprecated
|
||||
bigBoxHEVCDEPRECATED @2;
|
||||
chffrAndroidH264DEPRECATED @3;
|
||||
fullLosslessClipDEPRECATED @4;
|
||||
frontDEPRECATED @5;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -871,6 +982,7 @@ struct LongitudinalPlan @0xe00b5b3eba12876c {
|
||||
jerks @34 :List(Float32);
|
||||
|
||||
solverExecutionTime @35 :Float32;
|
||||
personality @36 :LongitudinalPersonality;
|
||||
|
||||
enum LongitudinalPlanSource {
|
||||
cruise @0;
|
||||
@@ -914,14 +1026,19 @@ struct LongitudinalPlan @0xe00b5b3eba12876c {
|
||||
y @1 :List(Float32);
|
||||
}
|
||||
}
|
||||
struct UiPlan {
|
||||
frameId @2 :UInt32;
|
||||
position @0 :XYZTData;
|
||||
accel @1 :List(Float32);
|
||||
}
|
||||
|
||||
struct LateralPlan @0xe1e9318e2ae8b51e {
|
||||
modelMonoTime @31 :UInt64;
|
||||
laneWidth @0 :Float32;
|
||||
lProb @5 :Float32;
|
||||
rProb @7 :Float32;
|
||||
laneWidthDEPRECATED @0 :Float32;
|
||||
lProbDEPRECATED @5 :Float32;
|
||||
rProbDEPRECATED @7 :Float32;
|
||||
dPathPoints @20 :List(Float32);
|
||||
dProb @21 :Float32;
|
||||
dProbDEPRECATED @21 :Float32;
|
||||
|
||||
mpcSolutionValid @9 :Bool;
|
||||
desire @17 :Desire;
|
||||
@@ -1019,6 +1136,9 @@ struct LiveLocationKalman {
|
||||
deviceStable @22 :Bool = true;
|
||||
timeSinceReset @23 :Float64;
|
||||
excessiveResets @24 :Bool;
|
||||
timeToFirstFix @25 :Float32;
|
||||
|
||||
filterState @26 : Measurement;
|
||||
|
||||
enum Status {
|
||||
uninitialized @0;
|
||||
@@ -1086,18 +1206,27 @@ struct ProcLog {
|
||||
}
|
||||
|
||||
struct GnssMeasurements {
|
||||
ubloxMonoTime @0 :UInt64;
|
||||
measTime @0 :UInt64;
|
||||
gpsWeek @1 :Int16;
|
||||
gpsTimeOfWeek @2 :Float64;
|
||||
|
||||
correctedMeasurements @3 :List(CorrectedMeasurement);
|
||||
ephemerisStatuses @9 :List(EphemerisStatus);
|
||||
|
||||
positionECEF @4 :LiveLocationKalman.Measurement;
|
||||
velocityECEF @5 :LiveLocationKalman.Measurement;
|
||||
# Used for debugging:
|
||||
positionFixECEF @6 :LiveLocationKalman.Measurement;
|
||||
kalmanPositionECEF @4 :LiveLocationKalman.Measurement;
|
||||
kalmanVelocityECEF @5 :LiveLocationKalman.Measurement;
|
||||
positionECEF @6 :LiveLocationKalman.Measurement;
|
||||
velocityECEF @7 :LiveLocationKalman.Measurement;
|
||||
timeToFirstFix @8 :Float32;
|
||||
# Todo sync this with timing pulse of ublox
|
||||
|
||||
struct EphemerisStatus {
|
||||
constellationId @0 :ConstellationId;
|
||||
svId @1 :UInt8;
|
||||
type @2 :EphemerisType;
|
||||
source @3 :EphemerisSource;
|
||||
}
|
||||
|
||||
struct CorrectedMeasurement {
|
||||
constellationId @0 :ConstellationId;
|
||||
svId @1 :UInt8;
|
||||
@@ -1110,32 +1239,40 @@ struct GnssMeasurements {
|
||||
# Satellite position and velocity [x,y,z]
|
||||
satPos @7 :List(Float64);
|
||||
satVel @8 :List(Float64);
|
||||
ephemerisSource @9 :EphemerisSource;
|
||||
ephemerisSourceDEPRECATED @9 :EphemerisSourceDEPRECATED;
|
||||
}
|
||||
|
||||
struct EphemerisSource {
|
||||
type @0 :EphemerisSourceType;
|
||||
struct EphemerisSourceDEPRECATED {
|
||||
type @0 :EphemerisType;
|
||||
# first epoch in file:
|
||||
gpsWeek @1 :Int16; # -1 if Nav
|
||||
gpsTimeOfWeek @2 :Int32; # -1 if Nav. Integer for seconds is good enough for logs.
|
||||
}
|
||||
|
||||
enum ConstellationId {
|
||||
# Satellite Constellation using the Ublox gnssid as index
|
||||
gps @0;
|
||||
sbas @1;
|
||||
galileo @2;
|
||||
beidou @3;
|
||||
imes @4;
|
||||
qznss @5;
|
||||
glonass @6;
|
||||
# Satellite Constellation using the Ublox gnssid as index
|
||||
gps @0;
|
||||
sbas @1;
|
||||
galileo @2;
|
||||
beidou @3;
|
||||
imes @4;
|
||||
qznss @5;
|
||||
glonass @6;
|
||||
}
|
||||
|
||||
enum EphemerisSourceType {
|
||||
enum EphemerisType {
|
||||
nav @0;
|
||||
# Different ultra-rapid files:
|
||||
nasaUltraRapid @1;
|
||||
glonassIacUltraRapid @2;
|
||||
qcom @3;
|
||||
}
|
||||
|
||||
enum EphemerisSource {
|
||||
gnssChip @0;
|
||||
internet @1;
|
||||
cache @2;
|
||||
unknown @3;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1146,6 +1283,20 @@ struct UbloxGnss {
|
||||
ionoData @2 :IonoData;
|
||||
hwStatus @3 :HwStatus;
|
||||
hwStatus2 @4 :HwStatus2;
|
||||
glonassEphemeris @5 :GlonassEphemeris;
|
||||
satReport @6 :SatReport;
|
||||
}
|
||||
|
||||
struct SatReport {
|
||||
#received time of week in gps time in seconds and gps week
|
||||
iTow @0 :UInt32;
|
||||
svs @1 :List(SatInfo);
|
||||
|
||||
struct SatInfo {
|
||||
svId @0 :UInt8;
|
||||
gnssId @1 :UInt8;
|
||||
flagsBitfield @2 :UInt32;
|
||||
}
|
||||
}
|
||||
|
||||
struct MeasurementReport {
|
||||
@@ -1198,7 +1349,7 @@ struct UbloxGnss {
|
||||
carrierPhaseValid @1 :Bool;
|
||||
# half cycle valid
|
||||
halfCycleValid @2 :Bool;
|
||||
# half sycle subtracted from phase
|
||||
# half cycle subtracted from phase
|
||||
halfCycleSubtracted @3 :Bool;
|
||||
}
|
||||
}
|
||||
@@ -1239,7 +1390,7 @@ struct UbloxGnss {
|
||||
|
||||
iDot @26 :Float64;
|
||||
codesL2 @27 :Float64;
|
||||
gpsWeek @28 :Float64;
|
||||
gpsWeekDEPRECATED @28 :Float64;
|
||||
l2 @29 :Float64;
|
||||
|
||||
svAcc @30 :Float64;
|
||||
@@ -1256,6 +1407,9 @@ struct UbloxGnss {
|
||||
ionoAlpha @38 :List(Float64);
|
||||
ionoBeta @39 :List(Float64);
|
||||
|
||||
towCount @40 :UInt32;
|
||||
toeWeek @41 :UInt16;
|
||||
tocWeek @42 :UInt16;
|
||||
}
|
||||
|
||||
struct IonoData {
|
||||
@@ -1310,6 +1464,49 @@ struct UbloxGnss {
|
||||
flash @4;
|
||||
}
|
||||
}
|
||||
|
||||
struct GlonassEphemeris {
|
||||
svId @0 :UInt16;
|
||||
year @1 :UInt16;
|
||||
dayInYear @2 :UInt16;
|
||||
hour @3 :UInt16;
|
||||
minute @4 :UInt16;
|
||||
second @5 :Float32;
|
||||
|
||||
x @6 :Float64;
|
||||
xVel @7 :Float64;
|
||||
xAccel @8 :Float64;
|
||||
y @9 :Float64;
|
||||
yVel @10 :Float64;
|
||||
yAccel @11 :Float64;
|
||||
z @12 :Float64;
|
||||
zVel @13 :Float64;
|
||||
zAccel @14 :Float64;
|
||||
|
||||
svType @15 :UInt8;
|
||||
svURA @16 :Float32;
|
||||
age @17 :UInt8;
|
||||
|
||||
svHealth @18 :UInt8;
|
||||
tkDEPRECATED @19 :UInt16;
|
||||
tb @20 :UInt16;
|
||||
|
||||
tauN @21 :Float64;
|
||||
deltaTauN @22 :Float64;
|
||||
gammaN @23 :Float64;
|
||||
|
||||
p1 @24 :UInt8;
|
||||
p2 @25 :UInt8;
|
||||
p3 @26 :UInt8;
|
||||
p4 @27 :UInt8;
|
||||
|
||||
freqNumDEPRECATED @28 :UInt32;
|
||||
|
||||
n4 @29 :UInt8;
|
||||
nt @30 :UInt16;
|
||||
freqNum @31 :Int16;
|
||||
tkSeconds @32 :UInt32;
|
||||
}
|
||||
}
|
||||
|
||||
struct QcomGnss @0xde94674b07ae51c1 {
|
||||
@@ -1329,7 +1526,7 @@ struct QcomGnss @0xde94674b07ae51c1 {
|
||||
unknown3 @3;
|
||||
unknown4 @4;
|
||||
unknown5 @5;
|
||||
unknown6 @6;
|
||||
sbas @6;
|
||||
}
|
||||
|
||||
enum SVObservationState @0xe81e829a0d6c83e9 {
|
||||
@@ -1742,7 +1939,6 @@ struct LiveParametersData {
|
||||
stiffnessFactor @4 :Float32;
|
||||
steerRatio @5 :Float32;
|
||||
sensorValid @6 :Bool;
|
||||
yawRate @7 :Float32;
|
||||
posenetSpeed @8 :Float32;
|
||||
posenetValid @9 :Bool;
|
||||
angleOffsetFastStd @10 :Float32;
|
||||
@@ -1750,6 +1946,24 @@ struct LiveParametersData {
|
||||
stiffnessFactorStd @12 :Float32;
|
||||
steerRatioStd @13 :Float32;
|
||||
roll @14 :Float32;
|
||||
|
||||
yawRateDEPRECATED @7 :Float32;
|
||||
}
|
||||
|
||||
struct LiveTorqueParametersData {
|
||||
liveValid @0 :Bool;
|
||||
latAccelFactorRaw @1 :Float32;
|
||||
latAccelOffsetRaw @2 :Float32;
|
||||
frictionCoefficientRaw @3 :Float32;
|
||||
latAccelFactorFiltered @4 :Float32;
|
||||
latAccelOffsetFiltered @5 :Float32;
|
||||
frictionCoefficientFiltered @6 :Float32;
|
||||
totalBucketPoints @7 :Float32;
|
||||
decay @8 :Float32;
|
||||
maxResets @9 :Float32;
|
||||
points @10 :List(List(Float32));
|
||||
version @11 :Int32;
|
||||
useParams @12 :Bool;
|
||||
}
|
||||
|
||||
struct LiveMapDataDEPRECATED {
|
||||
@@ -1779,6 +1993,10 @@ struct CameraOdometry {
|
||||
rot @1 :List(Float32); # rad/s in device frame
|
||||
transStd @2 :List(Float32); # std m/s in device frame
|
||||
rotStd @3 :List(Float32); # std rad/s in device frame
|
||||
wideFromDeviceEuler @6 :List(Float32);
|
||||
wideFromDeviceEulerStd @7 :List(Float32);
|
||||
roadTransformTrans @8 :List(Float32);
|
||||
roadTransformTransStd @9 :List(Float32);
|
||||
}
|
||||
|
||||
struct Sentinel {
|
||||
@@ -1792,6 +2010,10 @@ struct Sentinel {
|
||||
signal @1 :Int32;
|
||||
}
|
||||
|
||||
struct UIDebug {
|
||||
drawTimeMillis @0 :Float32;
|
||||
}
|
||||
|
||||
struct ManagerState {
|
||||
processes @0 :List(ProcessState);
|
||||
|
||||
@@ -1861,6 +2083,30 @@ struct NavRoute {
|
||||
}
|
||||
}
|
||||
|
||||
struct MapRenderState {
|
||||
locationMonoTime @0 :UInt64;
|
||||
renderTime @1 :Float32;
|
||||
frameId @2: UInt32;
|
||||
}
|
||||
|
||||
struct NavModelData {
|
||||
frameId @0 :UInt32;
|
||||
modelExecutionTime @1 :Float32;
|
||||
dspExecutionTime @2 :Float32;
|
||||
features @3 :List(Float32);
|
||||
# predicted future position
|
||||
position @4 :XYData;
|
||||
desirePrediction @5 :List(Float32);
|
||||
|
||||
# All SI units and in device frame
|
||||
struct XYData {
|
||||
x @0 :List(Float32);
|
||||
y @1 :List(Float32);
|
||||
xStd @2 :List(Float32);
|
||||
yStd @3 :List(Float32);
|
||||
}
|
||||
}
|
||||
|
||||
struct EncodeData {
|
||||
idx @0 :EncodeIndex;
|
||||
data @1 :Data;
|
||||
@@ -1871,6 +2117,15 @@ struct EncodeData {
|
||||
struct UserFlag {
|
||||
}
|
||||
|
||||
struct Microphone {
|
||||
soundPressure @0 :Float32;
|
||||
|
||||
# uncalibrated, A-weighted
|
||||
soundPressureWeighted @3 :Float32;
|
||||
soundPressureWeightedDb @1 :Float32;
|
||||
filteredSoundPressureWeightedDb @2 :Float32;
|
||||
}
|
||||
|
||||
struct Event {
|
||||
logMonoTime @0 :UInt64; # nanoseconds
|
||||
valid @67 :Bool = true;
|
||||
@@ -1887,7 +2142,13 @@ struct Event {
|
||||
gpsNMEA @3 :GPSNMEAData;
|
||||
can @5 :List(CanData);
|
||||
controlsState @7 :ControlsState;
|
||||
sensorEvents @11 :List(SensorEventData);
|
||||
gyroscope @99 :SensorEventData;
|
||||
gyroscope2 @100 :SensorEventData;
|
||||
accelerometer @98 :SensorEventData;
|
||||
accelerometer2 @101 :SensorEventData;
|
||||
magnetometer @95 :SensorEventData;
|
||||
lightSensor @96 :SensorEventData;
|
||||
temperatureSensor @97 :SensorEventData;
|
||||
pandaStates @81 :List(PandaState);
|
||||
peripheralState @80 :PeripheralState;
|
||||
radarState @13 :RadarState;
|
||||
@@ -1898,6 +2159,7 @@ struct Event {
|
||||
carControl @23 :Car.CarControl;
|
||||
longitudinalPlan @24 :LongitudinalPlan;
|
||||
lateralPlan @64 :LateralPlan;
|
||||
uiPlan @106 :UiPlan;
|
||||
ubloxGnss @34 :UbloxGnss;
|
||||
ubloxRaw @39 :Data;
|
||||
qcomGnss @31 :QcomGnss;
|
||||
@@ -1905,6 +2167,7 @@ struct Event {
|
||||
gpsLocation @21 :GpsLocationData;
|
||||
gnssMeasurements @91 :GnssMeasurements;
|
||||
liveParameters @61 :LiveParametersData;
|
||||
liveTorqueParameters @94 :LiveTorqueParametersData;
|
||||
cameraOdometry @63 :CameraOdometry;
|
||||
thumbnail @66: Thumbnail;
|
||||
carEvents @68: List(Car.CarEvent);
|
||||
@@ -1913,6 +2176,7 @@ struct Event {
|
||||
liveLocationKalman @72 :LiveLocationKalman;
|
||||
modelV2 @75 :ModelDataV2;
|
||||
driverStateV2 @92 :DriverStateV2;
|
||||
navModel @104 :NavModelData;
|
||||
|
||||
# camera stuff, each camera state has a matching encode idx
|
||||
roadCameraState @2 :FrameData;
|
||||
@@ -1923,6 +2187,13 @@ struct Event {
|
||||
wideRoadEncodeIdx @77 :EncodeIndex;
|
||||
qRoadEncodeIdx @90 :EncodeIndex;
|
||||
|
||||
livestreamRoadEncodeIdx @117 :EncodeIndex;
|
||||
livestreamWideRoadEncodeIdx @118 :EncodeIndex;
|
||||
livestreamDriverEncodeIdx @119 :EncodeIndex;
|
||||
|
||||
# microphone data
|
||||
microphone @103 :Microphone;
|
||||
|
||||
# systems stuff
|
||||
androidLog @20 :AndroidLogEntry;
|
||||
managerState @78 :ManagerState;
|
||||
@@ -1937,9 +2208,11 @@ struct Event {
|
||||
navInstruction @82 :NavInstruction;
|
||||
navRoute @83 :NavRoute;
|
||||
navThumbnail @84: Thumbnail;
|
||||
mapRenderState @105: MapRenderState;
|
||||
|
||||
# user flags
|
||||
# UI services
|
||||
userFlag @93 :UserFlag;
|
||||
uiDebug @102 :UIDebug;
|
||||
|
||||
# *********** debug ***********
|
||||
testJoystick @52 :Joystick;
|
||||
@@ -1948,6 +2221,22 @@ struct Event {
|
||||
wideRoadEncodeData @88 :EncodeData;
|
||||
qRoadEncodeData @89 :EncodeData;
|
||||
|
||||
livestreamRoadEncodeData @120 :EncodeData;
|
||||
livestreamWideRoadEncodeData @121 :EncodeData;
|
||||
livestreamDriverEncodeData @122 :EncodeData;
|
||||
|
||||
# *********** Custom: reserved for forks ***********
|
||||
customReserved0 @107 :Custom.CustomReserved0;
|
||||
customReserved1 @108 :Custom.CustomReserved1;
|
||||
customReserved2 @109 :Custom.CustomReserved2;
|
||||
customReserved3 @110 :Custom.CustomReserved3;
|
||||
customReserved4 @111 :Custom.CustomReserved4;
|
||||
customReserved5 @112 :Custom.CustomReserved5;
|
||||
customReserved6 @113 :Custom.CustomReserved6;
|
||||
customReserved7 @114 :Custom.CustomReserved7;
|
||||
customReserved8 @115 :Custom.CustomReserved8;
|
||||
customReserved9 @116 :Custom.CustomReserved9;
|
||||
|
||||
# *********** legacy + deprecated ***********
|
||||
model @9 :Legacy.ModelData; # TODO: rename modelV2 and mark this as deprecated
|
||||
liveMpcDEPRECATED @36 :LiveMpcData;
|
||||
@@ -1985,5 +2274,6 @@ struct Event {
|
||||
uiLayoutStateDEPRECATED @57 :Legacy.UiLayoutState;
|
||||
pandaStateDEPRECATED @12 :PandaState;
|
||||
driverStateDEPRECATED @59 :DriverStateDEPRECATED;
|
||||
sensorEventsDEPRECATED @11 :List(SensorEventData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# 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 Context, Poller, SubSocket, PubSocket, SocketEventHandle, toggle_fake_events, set_fake_prefix, get_fake_prefix, delete_fake_prefix, wait_for_one_event # 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
|
||||
@@ -12,6 +12,11 @@ from cereal.services import service_list
|
||||
|
||||
assert MultiplePublishersError
|
||||
assert MessagingError
|
||||
assert toggle_fake_events
|
||||
assert set_fake_prefix
|
||||
assert get_fake_prefix
|
||||
assert delete_fake_prefix
|
||||
assert wait_for_one_event
|
||||
|
||||
NO_TRAVERSAL_LIMIT = 2**64-1
|
||||
AVG_FREQ_HISTORY = 100
|
||||
@@ -27,9 +32,20 @@ except ImportError:
|
||||
|
||||
context = Context()
|
||||
|
||||
|
||||
def fake_event_handle(endpoint: str, identifier: Optional[str] = None, override: bool = True, enable: bool = False) -> SocketEventHandle:
|
||||
identifier = identifier or get_fake_prefix()
|
||||
handle = SocketEventHandle(endpoint, identifier, override)
|
||||
if override:
|
||||
handle.enabled = enable
|
||||
|
||||
return handle
|
||||
|
||||
|
||||
def log_from_bytes(dat: bytes) -> capnp.lib.capnp._DynamicStructReader:
|
||||
return log.Event.from_bytes(dat, traversal_limit_in_words=NO_TRAVERSAL_LIMIT)
|
||||
|
||||
|
||||
def new_message(service: Optional[str] = None, size: Optional[int] = None) -> capnp.lib.capnp._DynamicStructBuilder:
|
||||
dat = log.Event.new_message()
|
||||
dat.logMonoTime = int(sec_since_boot() * 1e9)
|
||||
@@ -41,11 +57,13 @@ def new_message(service: Optional[str] = None, size: Optional[int] = None) -> ca
|
||||
dat.init(service, size)
|
||||
return dat
|
||||
|
||||
|
||||
def pub_sock(endpoint: str) -> PubSocket:
|
||||
sock = PubSocket()
|
||||
sock.connect(context, endpoint)
|
||||
return sock
|
||||
|
||||
|
||||
def sub_sock(endpoint: str, poller: Optional[Poller] = None, addr: str = "127.0.0.1",
|
||||
conflate: bool = False, timeout: Optional[int] = None) -> SubSocket:
|
||||
sock = SubSocket()
|
||||
@@ -75,6 +93,7 @@ def drain_sock_raw(sock: SubSocket, wait_for_one: bool = False) -> List[bytes]:
|
||||
|
||||
return ret
|
||||
|
||||
|
||||
def drain_sock(sock: SubSocket, wait_for_one: bool = False) -> List[capnp.lib.capnp._DynamicStructReader]:
|
||||
"""Receive all message currently available on the queue"""
|
||||
ret: List[capnp.lib.capnp._DynamicStructReader] = []
|
||||
@@ -114,18 +133,21 @@ def recv_sock(sock: SubSocket, wait: bool = False) -> Optional[capnp.lib.capnp._
|
||||
|
||||
return dat
|
||||
|
||||
|
||||
def recv_one(sock: SubSocket) -> Optional[capnp.lib.capnp._DynamicStructReader]:
|
||||
dat = sock.receive()
|
||||
if dat is not None:
|
||||
dat = log_from_bytes(dat)
|
||||
return dat
|
||||
|
||||
|
||||
def recv_one_or_none(sock: SubSocket) -> Optional[capnp.lib.capnp._DynamicStructReader]:
|
||||
dat = sock.receive(non_blocking=True)
|
||||
if dat is not None:
|
||||
dat = log_from_bytes(dat)
|
||||
return dat
|
||||
|
||||
|
||||
def recv_one_retry(sock: SubSocket) -> capnp.lib.capnp._DynamicStructReader:
|
||||
"""Keep receiving until we get a message"""
|
||||
while True:
|
||||
@@ -133,6 +155,7 @@ def recv_one_retry(sock: SubSocket) -> capnp.lib.capnp._DynamicStructReader:
|
||||
if dat is not None:
|
||||
return log_from_bytes(dat)
|
||||
|
||||
|
||||
class SubMaster:
|
||||
def __init__(self, services: List[str], poll: Optional[List[str]] = None,
|
||||
ignore_alive: Optional[List[str]] = None, ignore_avg_freq: Optional[List[str]] = None,
|
||||
@@ -247,6 +270,7 @@ class SubMaster:
|
||||
and self.all_freq_ok(service_list=service_list) \
|
||||
and self.all_valid(service_list=service_list)
|
||||
|
||||
|
||||
class PubMaster:
|
||||
def __init__(self, services: List[str]):
|
||||
self.sock = {}
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
|
||||
typedef void (*sighandler_t)(int sig);
|
||||
|
||||
#include "impl_msgq.h"
|
||||
#include "impl_zmq.h"
|
||||
#include "services.h"
|
||||
#include "cereal/services.h"
|
||||
#include "cereal/messaging/impl_msgq.h"
|
||||
#include "cereal/messaging/impl_zmq.h"
|
||||
|
||||
std::atomic<bool> do_exit = false;
|
||||
static void set_do_exit(int sig) {
|
||||
@@ -57,7 +57,7 @@ int main(int argc, char** argv) {
|
||||
}
|
||||
|
||||
std::map<SubSocket*, PubSocket*> sub2pub;
|
||||
for (auto endpoint: get_services(whitelist_str, zmq_to_msgq)) {
|
||||
for (auto endpoint : get_services(whitelist_str, zmq_to_msgq)) {
|
||||
PubSocket * pub_sock;
|
||||
SubSocket * sub_sock;
|
||||
if (zmq_to_msgq) {
|
||||
|
||||
@@ -0,0 +1,208 @@
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <exception>
|
||||
#include <filesystem>
|
||||
|
||||
#include <sys/eventfd.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <poll.h>
|
||||
#include <signal.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "cereal/messaging/event.h"
|
||||
|
||||
void event_state_shm_mmap(std::string endpoint, std::string identifier, char **shm_mem, std::string *shm_path) {
|
||||
const char* op_prefix = std::getenv("OPENPILOT_PREFIX");
|
||||
|
||||
std::string full_path = "/dev/shm/";
|
||||
if (op_prefix) {
|
||||
full_path += std::string(op_prefix) + "/";
|
||||
}
|
||||
full_path += CEREAL_EVENTS_PREFIX + "/";
|
||||
if (identifier.size() > 0) {
|
||||
full_path += identifier + "/";
|
||||
}
|
||||
std::filesystem::create_directories(full_path);
|
||||
full_path += endpoint;
|
||||
|
||||
int shm_fd = open(full_path.c_str(), O_RDWR | O_CREAT, 0664);
|
||||
if (shm_fd < 0) {
|
||||
throw std::runtime_error("Could not open shared memory file.");
|
||||
}
|
||||
|
||||
int rc = ftruncate(shm_fd, sizeof(EventState));
|
||||
if (rc < 0){
|
||||
close(shm_fd);
|
||||
throw std::runtime_error("Could not truncate shared memory file.");
|
||||
}
|
||||
|
||||
char * mem = (char*)mmap(NULL, sizeof(EventState), PROT_READ | PROT_WRITE, MAP_SHARED, shm_fd, 0);
|
||||
close(shm_fd);
|
||||
if (mem == nullptr) {
|
||||
throw std::runtime_error("Could not map shared memory file.");
|
||||
}
|
||||
|
||||
if (shm_mem != nullptr)
|
||||
*shm_mem = mem;
|
||||
if (shm_path != nullptr)
|
||||
*shm_path = full_path;
|
||||
}
|
||||
|
||||
SocketEventHandle::SocketEventHandle(std::string endpoint, std::string identifier, bool override) {
|
||||
char *mem;
|
||||
event_state_shm_mmap(endpoint, identifier, &mem, &this->shm_path);
|
||||
|
||||
this->state = (EventState*)mem;
|
||||
if (override) {
|
||||
this->state->fds[0] = eventfd(0, EFD_NONBLOCK);
|
||||
this->state->fds[1] = eventfd(0, EFD_NONBLOCK);
|
||||
}
|
||||
}
|
||||
|
||||
SocketEventHandle::~SocketEventHandle() {
|
||||
close(this->state->fds[0]);
|
||||
close(this->state->fds[1]);
|
||||
munmap(this->state, sizeof(EventState));
|
||||
unlink(this->shm_path.c_str());
|
||||
}
|
||||
|
||||
bool SocketEventHandle::is_enabled() {
|
||||
return this->state->enabled;
|
||||
}
|
||||
|
||||
void SocketEventHandle::set_enabled(bool enabled) {
|
||||
this->state->enabled = enabled;
|
||||
}
|
||||
|
||||
Event SocketEventHandle::recv_called() {
|
||||
return Event(this->state->fds[0]);
|
||||
}
|
||||
|
||||
Event SocketEventHandle::recv_ready() {
|
||||
return Event(this->state->fds[1]);
|
||||
}
|
||||
|
||||
void SocketEventHandle::toggle_fake_events(bool enabled) {
|
||||
if (enabled)
|
||||
setenv("CEREAL_FAKE", "1", true);
|
||||
else
|
||||
unsetenv("CEREAL_FAKE");
|
||||
}
|
||||
|
||||
void SocketEventHandle::set_fake_prefix(std::string prefix) {
|
||||
if (prefix.size() == 0) {
|
||||
unsetenv("CEREAL_FAKE_PREFIX");
|
||||
} else {
|
||||
setenv("CEREAL_FAKE_PREFIX", prefix.c_str(), true);
|
||||
}
|
||||
}
|
||||
|
||||
std::string SocketEventHandle::fake_prefix() {
|
||||
const char* prefix = std::getenv("CEREAL_FAKE_PREFIX");
|
||||
if (prefix == nullptr) {
|
||||
return "";
|
||||
} else {
|
||||
return std::string(prefix);
|
||||
}
|
||||
}
|
||||
|
||||
Event::Event(int fd): event_fd(fd) {}
|
||||
|
||||
void Event::set() const {
|
||||
throw_if_invalid();
|
||||
|
||||
uint64_t val = 1;
|
||||
size_t count = write(this->event_fd, &val, sizeof(uint64_t));
|
||||
assert(count == sizeof(uint64_t));
|
||||
}
|
||||
|
||||
int Event::clear() const {
|
||||
throw_if_invalid();
|
||||
|
||||
uint64_t val = 0;
|
||||
// read the eventfd to clear it
|
||||
read(this->event_fd, &val, sizeof(uint64_t));
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
void Event::wait(int timeout_sec) const {
|
||||
throw_if_invalid();
|
||||
|
||||
int event_count;
|
||||
struct pollfd fds = { this->event_fd, POLLIN, 0 };
|
||||
|
||||
struct timespec timeout = { timeout_sec, 0 };
|
||||
|
||||
sigset_t signals;
|
||||
sigfillset(&signals);
|
||||
sigdelset(&signals, SIGALRM);
|
||||
sigdelset(&signals, SIGINT);
|
||||
sigdelset(&signals, SIGTERM);
|
||||
sigdelset(&signals, SIGQUIT);
|
||||
|
||||
event_count = ppoll(&fds, 1, timeout_sec < 0 ? nullptr : &timeout, &signals);
|
||||
|
||||
if (event_count == 0) {
|
||||
throw std::runtime_error("Event timed out pid: " + std::to_string(getpid()));
|
||||
} else if (event_count < 0) {
|
||||
throw std::runtime_error("Event poll failed, errno: " + std::to_string(errno) + " pid: " + std::to_string(getpid()));
|
||||
}
|
||||
}
|
||||
|
||||
bool Event::peek() const {
|
||||
throw_if_invalid();
|
||||
|
||||
int event_count;
|
||||
struct pollfd fds = { this->event_fd, POLLIN, 0 };
|
||||
|
||||
// poll with timeout zero to return status immediately
|
||||
event_count = poll(&fds, 1, 0);
|
||||
|
||||
return event_count != 0;
|
||||
}
|
||||
|
||||
bool Event::is_valid() const {
|
||||
return event_fd != -1;
|
||||
}
|
||||
|
||||
int Event::fd() const {
|
||||
return event_fd;
|
||||
}
|
||||
|
||||
int Event::wait_for_one(const std::vector<Event>& events, int timeout_sec) {
|
||||
struct pollfd fds[events.size()];
|
||||
for (size_t i = 0; i < events.size(); i++) {
|
||||
fds[i] = { events[i].fd(), POLLIN, 0 };
|
||||
}
|
||||
|
||||
struct timespec timeout = { timeout_sec, 0 };
|
||||
|
||||
sigset_t signals;
|
||||
sigfillset(&signals);
|
||||
sigdelset(&signals, SIGALRM);
|
||||
sigdelset(&signals, SIGINT);
|
||||
sigdelset(&signals, SIGTERM);
|
||||
sigdelset(&signals, SIGQUIT);
|
||||
|
||||
int event_count = ppoll(fds, events.size(), timeout_sec < 0 ? nullptr : &timeout, &signals);
|
||||
|
||||
if (event_count == 0) {
|
||||
throw std::runtime_error("Event timed out pid: " + std::to_string(getpid()));
|
||||
} else if (event_count < 0) {
|
||||
throw std::runtime_error("Event poll failed, errno: " + std::to_string(errno) + " pid: " + std::to_string(getpid()));
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < events.size(); i++) {
|
||||
if (fds[i].revents & POLLIN) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
throw std::runtime_error("Event poll failed, no events ready");
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#define CEREAL_EVENTS_PREFIX std::string("cereal_events")
|
||||
|
||||
void event_state_shm_mmap(std::string endpoint, std::string identifier, char **shm_mem, std::string *shm_path);
|
||||
|
||||
enum EventPurpose {
|
||||
RECV_CALLED,
|
||||
RECV_READY
|
||||
};
|
||||
|
||||
struct EventState {
|
||||
int fds[2];
|
||||
bool enabled;
|
||||
};
|
||||
|
||||
class Event {
|
||||
private:
|
||||
int event_fd = -1;
|
||||
|
||||
inline void throw_if_invalid() const {
|
||||
if (!this->is_valid()) {
|
||||
throw std::runtime_error("Event does not have valid file descriptor.");
|
||||
}
|
||||
}
|
||||
public:
|
||||
Event(int fd = -1);
|
||||
|
||||
void set() const;
|
||||
int clear() const;
|
||||
void wait(int timeout_sec = -1) const;
|
||||
bool peek() const;
|
||||
bool is_valid() const;
|
||||
int fd() const;
|
||||
|
||||
static int wait_for_one(const std::vector<Event>& events, int timeout_sec = -1);
|
||||
};
|
||||
|
||||
class SocketEventHandle {
|
||||
private:
|
||||
std::string shm_path;
|
||||
EventState* state;
|
||||
public:
|
||||
SocketEventHandle(std::string endpoint, std::string identifier = "", bool override = true);
|
||||
~SocketEventHandle();
|
||||
|
||||
bool is_enabled();
|
||||
void set_enabled(bool enabled);
|
||||
Event recv_called();
|
||||
Event recv_ready();
|
||||
|
||||
static void toggle_fake_events(bool enabled);
|
||||
static void set_fake_prefix(std::string prefix);
|
||||
static std::string fake_prefix();
|
||||
};
|
||||
@@ -0,0 +1,9 @@
|
||||
#include "cereal/messaging/impl_fake.h"
|
||||
|
||||
void FakePoller::registerSocket(SubSocket *socket) {
|
||||
this->sockets.push_back(socket);
|
||||
}
|
||||
|
||||
std::vector<SubSocket*> FakePoller::poll(int timeout) {
|
||||
return this->sockets;
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
#pragma once
|
||||
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <filesystem>
|
||||
|
||||
#include <sys/mman.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "cereal/messaging/messaging.h"
|
||||
#include "cereal/messaging/event.h"
|
||||
|
||||
template<typename TSubSocket>
|
||||
class FakeSubSocket: public TSubSocket {
|
||||
private:
|
||||
Event *recv_called = nullptr;
|
||||
Event *recv_ready = nullptr;
|
||||
EventState *state = nullptr;
|
||||
|
||||
public:
|
||||
FakeSubSocket(): TSubSocket() {}
|
||||
~FakeSubSocket() {
|
||||
delete recv_called;
|
||||
delete recv_ready;
|
||||
if (state != nullptr) {
|
||||
munmap(state, sizeof(EventState));
|
||||
}
|
||||
}
|
||||
|
||||
int connect(Context *context, std::string endpoint, std::string address, bool conflate=false, bool check_endpoint=true) override {
|
||||
const char* cereal_prefix = std::getenv("CEREAL_FAKE_PREFIX");
|
||||
|
||||
char* mem;
|
||||
std::string identifier = cereal_prefix != nullptr ? std::string(cereal_prefix) : "";
|
||||
event_state_shm_mmap(endpoint, identifier, &mem, nullptr);
|
||||
|
||||
this->state = (EventState*)mem;
|
||||
this->recv_called = new Event(state->fds[EventPurpose::RECV_CALLED]);
|
||||
this->recv_ready = new Event(state->fds[EventPurpose::RECV_READY]);
|
||||
|
||||
return TSubSocket::connect(context, endpoint, address, conflate, check_endpoint);
|
||||
}
|
||||
|
||||
Message *receive(bool non_blocking=false) override {
|
||||
if (this->state->enabled) {
|
||||
this->recv_called->set();
|
||||
this->recv_ready->wait();
|
||||
this->recv_ready->clear();
|
||||
}
|
||||
|
||||
return TSubSocket::receive(non_blocking);
|
||||
}
|
||||
};
|
||||
|
||||
class FakePoller: public Poller {
|
||||
private:
|
||||
std::vector<SubSocket*> sockets;
|
||||
|
||||
public:
|
||||
void registerSocket(SubSocket *socket) override;
|
||||
std::vector<SubSocket*> poll(int timeout) override;
|
||||
~FakePoller() {};
|
||||
};
|
||||
@@ -5,8 +5,8 @@
|
||||
#include <csignal>
|
||||
#include <cerrno>
|
||||
|
||||
#include "services.h"
|
||||
#include "impl_msgq.h"
|
||||
#include "cereal/services.h"
|
||||
#include "cereal/messaging/impl_msgq.h"
|
||||
|
||||
|
||||
volatile sig_atomic_t msgq_do_exit = 0;
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
#pragma once
|
||||
#include "messaging.h"
|
||||
#include "msgq.h"
|
||||
#include <zmq.h>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "cereal/messaging/messaging.h"
|
||||
#include "cereal/messaging/msgq.h"
|
||||
|
||||
#define MAX_POLLERS 128
|
||||
|
||||
|
||||
@@ -4,10 +4,8 @@
|
||||
#include <cstdlib>
|
||||
#include <cerrno>
|
||||
|
||||
#include <zmq.h>
|
||||
|
||||
#include "services.h"
|
||||
#include "impl_zmq.h"
|
||||
#include "cereal/services.h"
|
||||
#include "cereal/messaging/impl_zmq.h"
|
||||
|
||||
static int get_port(std::string endpoint) {
|
||||
int port = -1;
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
#pragma once
|
||||
#include "messaging.h"
|
||||
|
||||
#include <zmq.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "cereal/messaging/messaging.h"
|
||||
|
||||
#define MAX_POLLERS 128
|
||||
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
|
||||
#include "messaging.h"
|
||||
#include "impl_zmq.h"
|
||||
#include "impl_msgq.h"
|
||||
#include "cereal/messaging/messaging.h"
|
||||
#include "cereal/messaging/impl_zmq.h"
|
||||
#include "cereal/messaging/impl_msgq.h"
|
||||
#include "cereal/messaging/impl_fake.h"
|
||||
|
||||
#ifdef __APPLE__
|
||||
const bool MUST_USE_ZMQ = true;
|
||||
@@ -22,6 +23,11 @@ bool messaging_use_zmq(){
|
||||
return false;
|
||||
}
|
||||
|
||||
bool messaging_use_fake(){
|
||||
char* fake_enabled = std::getenv("CEREAL_FAKE");
|
||||
return fake_enabled != NULL;
|
||||
}
|
||||
|
||||
Context * Context::create(){
|
||||
Context * c;
|
||||
if (messaging_use_zmq()){
|
||||
@@ -34,11 +40,20 @@ Context * Context::create(){
|
||||
|
||||
SubSocket * SubSocket::create(){
|
||||
SubSocket * s;
|
||||
if (messaging_use_zmq()){
|
||||
s = new ZMQSubSocket();
|
||||
if (messaging_use_fake()) {
|
||||
if (messaging_use_zmq()) {
|
||||
s = new FakeSubSocket<ZMQSubSocket>();
|
||||
} else {
|
||||
s = new FakeSubSocket<MSGQSubSocket>();
|
||||
}
|
||||
} else {
|
||||
s = new MSGQSubSocket();
|
||||
if (messaging_use_zmq()){
|
||||
s = new ZMQSubSocket();
|
||||
} else {
|
||||
s = new MSGQSubSocket();
|
||||
}
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
@@ -49,8 +64,10 @@ SubSocket * SubSocket::create(Context * context, std::string endpoint, std::stri
|
||||
if (r == 0) {
|
||||
return s;
|
||||
} else {
|
||||
std::cerr << "Error, failed to connect SubSocket to " << endpoint << ": " << strerror(errno) << std::endl;
|
||||
|
||||
delete s;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,6 +78,7 @@ PubSocket * PubSocket::create(){
|
||||
} else {
|
||||
s = new MSGQPubSocket();
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
@@ -71,17 +89,23 @@ PubSocket * PubSocket::create(Context * context, std::string endpoint, bool chec
|
||||
if (r == 0) {
|
||||
return s;
|
||||
} else {
|
||||
std::cerr << "Error, failed to bind PubSocket to " << endpoint << ": " << strerror(errno) << std::endl;
|
||||
|
||||
delete s;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
Poller * Poller::create(){
|
||||
Poller * p;
|
||||
if (messaging_use_zmq()){
|
||||
p = new ZMQPoller();
|
||||
if (messaging_use_fake()) {
|
||||
p = new FakePoller();
|
||||
} else {
|
||||
p = new MSGQPoller();
|
||||
if (messaging_use_zmq()){
|
||||
p = new ZMQPoller();
|
||||
} else {
|
||||
p = new MSGQPoller();
|
||||
}
|
||||
}
|
||||
return p;
|
||||
}
|
||||
@@ -94,20 +118,3 @@ Poller * Poller::create(std::vector<SubSocket*> sockets){
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
extern "C" Context * messaging_context_create() {
|
||||
return Context::create();
|
||||
}
|
||||
|
||||
extern "C" SubSocket * messaging_subsocket_create(Context* context, const char* endpoint) {
|
||||
return SubSocket::create(context, std::string(endpoint));
|
||||
}
|
||||
|
||||
extern "C" PubSocket * messaging_pubsocket_create(Context* context, const char* endpoint) {
|
||||
return PubSocket::create(context, std::string(endpoint));
|
||||
}
|
||||
|
||||
extern "C" Poller * messaging_poller_create(SubSocket** sockets, int size) {
|
||||
std::vector<SubSocket*> socketsVec(sockets, sockets + size);
|
||||
return Poller::create(socketsVec);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstddef>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
#include <time.h>
|
||||
|
||||
#include <capnp/serialize.h>
|
||||
#include "../gen/cpp/log.capnp.h"
|
||||
|
||||
#include "cereal/gen/cpp/log.capnp.h"
|
||||
|
||||
#ifdef __APPLE__
|
||||
#define CLOCK_BOOTTIME CLOCK_MONOTONIC
|
||||
@@ -18,7 +23,7 @@ class Context {
|
||||
public:
|
||||
virtual void * getRawContext() = 0;
|
||||
static Context * create();
|
||||
virtual ~Context(){};
|
||||
virtual ~Context(){}
|
||||
};
|
||||
|
||||
class Message {
|
||||
|
||||
@@ -6,7 +6,35 @@ from libcpp.vector cimport vector
|
||||
from libcpp cimport bool
|
||||
|
||||
|
||||
cdef extern from "messaging.h":
|
||||
cdef extern from "cereal/messaging/impl_fake.h":
|
||||
cdef cppclass Event:
|
||||
@staticmethod
|
||||
int wait_for_one(vector[Event], int) except +
|
||||
|
||||
Event()
|
||||
Event(int)
|
||||
void set()
|
||||
int clear()
|
||||
void wait(int) except +
|
||||
bool peek()
|
||||
int fd()
|
||||
|
||||
cdef cppclass SocketEventHandle:
|
||||
@staticmethod
|
||||
void toggle_fake_events(bool)
|
||||
@staticmethod
|
||||
void set_fake_prefix(string)
|
||||
@staticmethod
|
||||
string fake_prefix()
|
||||
|
||||
SocketEventHandle(string, string, bool)
|
||||
bool is_enabled()
|
||||
void set_enabled(bool)
|
||||
Event recv_called()
|
||||
Event recv_ready()
|
||||
|
||||
|
||||
cdef extern from "cereal/messaging/messaging.h":
|
||||
cdef cppclass Context:
|
||||
@staticmethod
|
||||
Context * create()
|
||||
|
||||
@@ -3,8 +3,11 @@
|
||||
|
||||
import sys
|
||||
from libcpp.string cimport string
|
||||
from libcpp.vector cimport vector
|
||||
from libcpp cimport bool
|
||||
from libc cimport errno
|
||||
from libc.string cimport strerror
|
||||
from cython.operator import dereference
|
||||
|
||||
|
||||
from .messaging cimport Context as cppContext
|
||||
@@ -12,16 +15,105 @@ from .messaging cimport SubSocket as cppSubSocket
|
||||
from .messaging cimport PubSocket as cppPubSocket
|
||||
from .messaging cimport Poller as cppPoller
|
||||
from .messaging cimport Message as cppMessage
|
||||
from .messaging cimport Event as cppEvent, SocketEventHandle as cppSocketEventHandle
|
||||
|
||||
|
||||
class MessagingError(Exception):
|
||||
pass
|
||||
def __init__(self, endpoint=None):
|
||||
suffix = "with {endpoint}" if endpoint else ""
|
||||
message = f"Messaging failure {suffix}: {strerror(errno.errno)}"
|
||||
super().__init__(message)
|
||||
|
||||
|
||||
class MultiplePublishersError(MessagingError):
|
||||
pass
|
||||
|
||||
|
||||
def toggle_fake_events(bool enabled):
|
||||
cppSocketEventHandle.toggle_fake_events(enabled)
|
||||
|
||||
|
||||
def set_fake_prefix(string prefix):
|
||||
cppSocketEventHandle.set_fake_prefix(prefix)
|
||||
|
||||
|
||||
def get_fake_prefix():
|
||||
return cppSocketEventHandle.fake_prefix()
|
||||
|
||||
|
||||
def delete_fake_prefix():
|
||||
cppSocketEventHandle.set_fake_prefix(b"")
|
||||
|
||||
|
||||
def wait_for_one_event(list events, int timeout=-1):
|
||||
cdef vector[cppEvent] items
|
||||
for event in events:
|
||||
items.push_back(dereference(<cppEvent*><size_t>event.ptr))
|
||||
return cppEvent.wait_for_one(items, timeout)
|
||||
|
||||
|
||||
cdef class Event:
|
||||
cdef cppEvent event;
|
||||
|
||||
def __cinit__(self):
|
||||
pass
|
||||
|
||||
cdef setEvent(self, cppEvent event):
|
||||
self.event = event
|
||||
|
||||
def set(self):
|
||||
self.event.set()
|
||||
|
||||
def clear(self):
|
||||
return self.event.clear()
|
||||
|
||||
def wait(self, int timeout=-1):
|
||||
self.event.wait(timeout)
|
||||
|
||||
def peek(self):
|
||||
return self.event.peek()
|
||||
|
||||
@property
|
||||
def fd(self):
|
||||
return self.event.fd()
|
||||
|
||||
@property
|
||||
def ptr(self):
|
||||
return <size_t><void*>&self.event
|
||||
|
||||
|
||||
cdef class SocketEventHandle:
|
||||
cdef cppSocketEventHandle * handle;
|
||||
|
||||
def __cinit__(self, string endpoint, string identifier, bool override):
|
||||
self.handle = new cppSocketEventHandle(endpoint, identifier, override)
|
||||
|
||||
def __dealloc__(self):
|
||||
del self.handle
|
||||
|
||||
@property
|
||||
def enabled(self):
|
||||
return self.handle.is_enabled()
|
||||
|
||||
@enabled.setter
|
||||
def enabled(self, bool value):
|
||||
self.handle.set_enabled(value)
|
||||
|
||||
@property
|
||||
def recv_called_event(self):
|
||||
e = Event()
|
||||
e.setEvent(self.handle.recv_called())
|
||||
|
||||
return e
|
||||
|
||||
@property
|
||||
def recv_ready_event(self):
|
||||
e = Event()
|
||||
e.setEvent(self.handle.recv_ready())
|
||||
|
||||
return e
|
||||
|
||||
|
||||
cdef class Context:
|
||||
cdef cppContext * context
|
||||
|
||||
@@ -68,6 +160,7 @@ cdef class Poller:
|
||||
|
||||
return sockets
|
||||
|
||||
|
||||
cdef class SubSocket:
|
||||
cdef cppSubSocket * socket
|
||||
cdef bool is_owner
|
||||
@@ -95,9 +188,9 @@ cdef class SubSocket:
|
||||
|
||||
if r != 0:
|
||||
if errno.errno == errno.EADDRINUSE:
|
||||
raise MultiplePublishersError
|
||||
raise MultiplePublishersError(endpoint)
|
||||
else:
|
||||
raise MessagingError
|
||||
raise MessagingError(endpoint)
|
||||
|
||||
def setTimeout(self, int timeout):
|
||||
self.socket.setTimeout(timeout)
|
||||
@@ -136,9 +229,9 @@ cdef class PubSocket:
|
||||
|
||||
if r != 0:
|
||||
if errno.errno == errno.EADDRINUSE:
|
||||
raise MultiplePublishersError
|
||||
raise MultiplePublishersError(endpoint)
|
||||
else:
|
||||
raise MessagingError
|
||||
raise MessagingError(endpoint)
|
||||
|
||||
def send(self, bytes data):
|
||||
length = len(data)
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <csignal>
|
||||
#include <random>
|
||||
#include <string>
|
||||
#include <limits>
|
||||
|
||||
#include <poll.h>
|
||||
#include <sys/ioctl.h>
|
||||
@@ -22,7 +23,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "msgq.h"
|
||||
#include "cereal/messaging/msgq.h"
|
||||
|
||||
void sigusr2_handler(int signal) {
|
||||
assert(signal == SIGUSR2);
|
||||
@@ -30,7 +31,7 @@ void sigusr2_handler(int signal) {
|
||||
|
||||
uint64_t msgq_get_uid(void){
|
||||
std::random_device rd("/dev/urandom");
|
||||
std::uniform_int_distribution<uint64_t> distribution(0,std::numeric_limits<uint32_t>::max());
|
||||
std::uniform_int_distribution<uint64_t> distribution(0, std::numeric_limits<uint32_t>::max());
|
||||
|
||||
#ifdef __APPLE__
|
||||
// TODO: this doesn't work
|
||||
@@ -76,7 +77,7 @@ void msgq_reset_reader(msgq_queue_t * q){
|
||||
|
||||
void msgq_wait_for_subscriber(msgq_queue_t *q){
|
||||
while (*q->num_readers == 0){
|
||||
;
|
||||
// wait for subscriber
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -320,9 +321,11 @@ int msgq_msg_ready(msgq_queue_t * q){
|
||||
|
||||
uint32_t read_cycles, read_pointer;
|
||||
UNPACK64(read_cycles, read_pointer, *q->read_pointers[id]);
|
||||
UNUSED(read_cycles);
|
||||
|
||||
uint32_t write_cycles, write_pointer;
|
||||
UNPACK64(write_cycles, write_pointer, *q->write_pointer);
|
||||
UNUSED(write_cycles);
|
||||
|
||||
// Check if new message is available
|
||||
return (read_pointer != write_pointer);
|
||||
@@ -350,6 +353,7 @@ int msgq_msg_recv(msgq_msg_t * msg, msgq_queue_t * q){
|
||||
|
||||
uint32_t write_cycles, write_pointer;
|
||||
UNPACK64(write_cycles, write_pointer, *q->write_pointer);
|
||||
UNUSED(write_cycles);
|
||||
|
||||
char * p = q->data + read_pointer;
|
||||
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
#include <atomic>
|
||||
|
||||
#define DEFAULT_SEGMENT_SIZE (10 * 1024 * 1024)
|
||||
#define NUM_READERS 10
|
||||
#define NUM_READERS 12
|
||||
#define ALIGN(n) ((n + (8 - 1)) & -8)
|
||||
|
||||
#define UNUSED(x) (void)x
|
||||
#define UNPACK64(higher, lower, input) do {uint64_t tmp = input; higher = tmp >> 32; lower = tmp & 0xFFFFFFFF;} while (0)
|
||||
#define PACK64(output, higher, lower) output = ((uint64_t)higher << 32 ) | ((uint64_t)lower & 0xFFFFFFFF)
|
||||
#define PACK64(output, higher, lower) output = ((uint64_t)higher << 32) | ((uint64_t)lower & 0xFFFFFFFF)
|
||||
|
||||
struct msgq_header_t {
|
||||
uint64_t num_readers;
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
#include <string>
|
||||
#include <mutex>
|
||||
|
||||
#include "services.h"
|
||||
#include "messaging.h"
|
||||
#include "cereal/services.h"
|
||||
#include "cereal/messaging/messaging.h"
|
||||
|
||||
const bool SIMULATION = (getenv("SIMULATION") != nullptr) && (std::string(getenv("SIMULATION")) == "1");
|
||||
|
||||
@@ -116,7 +116,7 @@ void SubMaster::update(int timeout) {
|
||||
void SubMaster::update_msgs(uint64_t current_time, const std::vector<std::pair<std::string, cereal::Event::Reader>> &messages){
|
||||
if (++frame == UINT64_MAX) frame = 1;
|
||||
|
||||
for(auto &kv : messages) {
|
||||
for (auto &kv : messages) {
|
||||
auto m_find = services_.find(kv.first);
|
||||
if (m_find == services_.end()){
|
||||
continue;
|
||||
|
||||
+21
-3
@@ -21,10 +21,16 @@ class Service:
|
||||
services = {
|
||||
# service: (should_log, frequency, qlog decimation (optional))
|
||||
# note: the "EncodeIdx" packets will still be in the log
|
||||
"sensorEvents": (True, 100., 100),
|
||||
"gyroscope": (True, 104., 104),
|
||||
"gyroscope2": (True, 100., 100),
|
||||
"accelerometer": (True, 104., 104),
|
||||
"accelerometer2": (True, 100., 100),
|
||||
"magnetometer": (True, 100., 100),
|
||||
"lightSensor": (True, 100., 100),
|
||||
"temperatureSensor": (True, 100., 100),
|
||||
"gpsNMEA": (True, 9.),
|
||||
"deviceState": (True, 2., 1),
|
||||
"can": (True, 100.),
|
||||
"can": (True, 100., 1223), # decimation gives ~5 msgs in a full segment
|
||||
"controlsState": (True, 100., 10),
|
||||
"pandaStates": (True, 2., 1),
|
||||
"peripheralState": (True, 2., 1),
|
||||
@@ -35,11 +41,12 @@ services = {
|
||||
"logMessage": (True, 0.),
|
||||
"errorLogMessage": (True, 0., 1),
|
||||
"liveCalibration": (True, 4., 4),
|
||||
"liveTorqueParameters": (True, 4., 1),
|
||||
"androidLog": (True, 0.),
|
||||
"carState": (True, 100., 10),
|
||||
"carControl": (True, 100., 10),
|
||||
"longitudinalPlan": (True, 20., 5),
|
||||
"procLog": (True, 0.5),
|
||||
"procLog": (True, 0.5, 15),
|
||||
"gpsLocationExternal": (True, 10., 10),
|
||||
"gpsLocation": (True, 1., 1),
|
||||
"ubloxGnss": (True, 10.),
|
||||
@@ -67,15 +74,26 @@ services = {
|
||||
"navInstruction": (True, 1., 10),
|
||||
"navRoute": (True, 0.),
|
||||
"navThumbnail": (True, 0.),
|
||||
"navModel": (True, 2., 4.),
|
||||
"mapRenderState": (True, 2., 1.),
|
||||
"uiPlan": (True, 20., 40.),
|
||||
"qRoadEncodeIdx": (False, 20.),
|
||||
"userFlag": (True, 0., 1),
|
||||
"microphone": (True, 10., 10),
|
||||
|
||||
# debug
|
||||
"uiDebug": (True, 0., 1),
|
||||
"testJoystick": (True, 0.),
|
||||
"roadEncodeData": (False, 20.),
|
||||
"driverEncodeData": (False, 20.),
|
||||
"wideRoadEncodeData": (False, 20.),
|
||||
"qRoadEncodeData": (False, 20.),
|
||||
"livestreamWideRoadEncodeIdx": (False, 20.),
|
||||
"livestreamRoadEncodeIdx": (False, 20.),
|
||||
"livestreamDriverEncodeIdx": (False, 20.),
|
||||
"livestreamWideRoadEncodeData": (False, 20.),
|
||||
"livestreamRoadEncodeData": (False, 20.),
|
||||
"livestreamDriverEncodeData": (False, 20.),
|
||||
}
|
||||
service_list = {name: Service(new_port(idx), *vals) for # type: ignore
|
||||
idx, (name, vals) in enumerate(services.items())}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
from cereal.visionipc.visionipc_pyx import VisionIpcClient, VisionIpcServer, VisionStreamType # pylint: disable=no-name-in-module, import-error
|
||||
from cereal.visionipc.visionipc_pyx import VisionIpcClient, VisionIpcServer, VisionStreamType, get_endpoint_name # pylint: disable=no-name-in-module, import-error
|
||||
assert VisionIpcClient
|
||||
assert VisionIpcServer
|
||||
assert VisionStreamType
|
||||
assert get_endpoint_name
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#define getsocket() socket(AF_UNIX, SOCK_SEQPACKET, 0)
|
||||
#endif
|
||||
|
||||
#include "ipc.h"
|
||||
#include "cereal/visionipc/ipc.h"
|
||||
|
||||
int ipc_connect(const char* socket_path) {
|
||||
int err;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "visionbuf.h"
|
||||
#include "cereal/visionipc/visionbuf.h"
|
||||
|
||||
#define ALIGN(x, align) (((x) + (align)-1) & ~((align)-1))
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
#include "visionipc.h"
|
||||
|
||||
#include "cereal/visionipc/visionipc.h"
|
||||
|
||||
#define CL_USE_DEPRECATED_OPENCL_1_2_APIS
|
||||
#ifdef __APPLE__
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "visionbuf.h"
|
||||
#include "cereal/visionipc/visionbuf.h"
|
||||
|
||||
#include <atomic>
|
||||
#include <stdio.h>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
#include <msm_ion.h>
|
||||
|
||||
#include "visionbuf.h"
|
||||
#include "cereal/visionipc/visionbuf.h"
|
||||
|
||||
// keep trying if x gets interrupted by a signal
|
||||
#define HANDLE_EINTR(x) \
|
||||
|
||||
@@ -3,10 +3,11 @@
|
||||
|
||||
from libcpp.string cimport string
|
||||
from libcpp.vector cimport vector
|
||||
from libcpp.set cimport set
|
||||
from libc.stdint cimport uint32_t, uint64_t
|
||||
from libcpp cimport bool
|
||||
|
||||
cdef extern from "visionbuf.h":
|
||||
cdef extern from "cereal/visionipc/visionbuf.h":
|
||||
cdef enum VisionStreamType:
|
||||
pass
|
||||
|
||||
@@ -19,13 +20,15 @@ cdef extern from "visionbuf.h":
|
||||
size_t uv_offset
|
||||
void set_frame_id(uint64_t id)
|
||||
|
||||
cdef extern from "visionipc.h":
|
||||
cdef extern from "cereal/visionipc/visionipc.h":
|
||||
struct VisionIpcBufExtra:
|
||||
uint32_t frame_id
|
||||
uint64_t timestamp_sof
|
||||
uint64_t timestamp_eof
|
||||
|
||||
cdef extern from "visionipc_server.h":
|
||||
cdef extern from "cereal/visionipc/visionipc_server.h":
|
||||
string get_endpoint_name(string, VisionStreamType)
|
||||
|
||||
cdef cppclass VisionIpcServer:
|
||||
VisionIpcServer(string, void*, void*)
|
||||
void create_buffers(VisionStreamType, size_t, bool, size_t, size_t)
|
||||
@@ -34,9 +37,11 @@ cdef extern from "visionipc_server.h":
|
||||
void send(VisionBuf *, VisionIpcBufExtra *, bool)
|
||||
void start_listener()
|
||||
|
||||
cdef extern from "visionipc_client.h":
|
||||
cdef extern from "cereal/visionipc/visionipc_client.h":
|
||||
cdef cppclass VisionIpcClient:
|
||||
VisionIpcClient(string, VisionStreamType, bool, void*, void*)
|
||||
VisionBuf * recv(VisionIpcBufExtra *, int)
|
||||
bool connect(bool)
|
||||
bool is_connected()
|
||||
@staticmethod
|
||||
set[VisionStreamType] getAvailableStreams(string, bool)
|
||||
|
||||
@@ -3,10 +3,21 @@
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
|
||||
#include "visionipc/ipc.h"
|
||||
#include "visionipc/visionipc_client.h"
|
||||
#include "visionipc/visionipc_server.h"
|
||||
#include "logger/logger.h"
|
||||
#include "cereal/visionipc/ipc.h"
|
||||
#include "cereal/visionipc/visionipc_client.h"
|
||||
#include "cereal/visionipc/visionipc_server.h"
|
||||
#include "cereal/logger/logger.h"
|
||||
|
||||
static int connect_to_vipc_server(const std::string &name, bool blocking) {
|
||||
std::string path = "/tmp/visionipc_" + name;
|
||||
int socket_fd = ipc_connect(path.c_str());
|
||||
while (socket_fd < 0 && blocking) {
|
||||
std::cout << "VisionIpcClient connecting" << std::endl;
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
socket_fd = ipc_connect(path.c_str());
|
||||
}
|
||||
return socket_fd;
|
||||
}
|
||||
|
||||
VisionIpcClient::VisionIpcClient(std::string name, VisionStreamType type, bool conflate, cl_device_id device_id, cl_context ctx) : name(name), type(type), device_id(device_id), ctx(ctx) {
|
||||
msg_ctx = Context::create();
|
||||
@@ -29,23 +40,10 @@ bool VisionIpcClient::connect(bool blocking){
|
||||
|
||||
num_buffers = 0;
|
||||
|
||||
// Connect to server socket and ask for all FDs of type
|
||||
std::string path = "/tmp/visionipc_" + name;
|
||||
|
||||
int socket_fd = -1;
|
||||
while (socket_fd < 0) {
|
||||
socket_fd = ipc_connect(path.c_str());
|
||||
|
||||
if (socket_fd < 0) {
|
||||
if (blocking){
|
||||
std::cout << "VisionIpcClient connecting" << std::endl;
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
int socket_fd = connect_to_vipc_server(name, blocking);
|
||||
if (socket_fd < 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Send stream type to server to request FDs
|
||||
int r = ipc_sendrecv_with_fds(true, socket_fd, &type, sizeof(type), nullptr, 0, nullptr);
|
||||
assert(r == sizeof(type));
|
||||
@@ -114,7 +112,22 @@ VisionBuf * VisionIpcClient::recv(VisionIpcBufExtra * extra, const int timeout_m
|
||||
return buf;
|
||||
}
|
||||
|
||||
std::set<VisionStreamType> VisionIpcClient::getAvailableStreams(const std::string &name, bool blocking) {
|
||||
int socket_fd = connect_to_vipc_server(name, blocking);
|
||||
if (socket_fd < 0) {
|
||||
return {};
|
||||
}
|
||||
// Send VISION_STREAM_MAX to server to request available streams
|
||||
int request = VISION_STREAM_MAX;
|
||||
int r = ipc_sendrecv_with_fds(true, socket_fd, &request, sizeof(request), nullptr, 0, nullptr);
|
||||
assert(r == sizeof(request));
|
||||
|
||||
VisionStreamType available_streams[VISION_STREAM_MAX] = {};
|
||||
r = ipc_sendrecv_with_fds(false, socket_fd, &available_streams, sizeof(available_streams), nullptr, 0, nullptr);
|
||||
assert((r >= 0) && (r % sizeof(VisionStreamType) == 0));
|
||||
close(socket_fd);
|
||||
return std::set<VisionStreamType>(available_streams, available_streams + r / sizeof(VisionStreamType));
|
||||
}
|
||||
|
||||
VisionIpcClient::~VisionIpcClient(){
|
||||
for (size_t i = 0; i < num_buffers; i++){
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
#pragma once
|
||||
#include <vector>
|
||||
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "messaging/messaging.h"
|
||||
#include "visionipc/visionipc.h"
|
||||
#include "visionipc/visionbuf.h"
|
||||
#include "cereal/messaging/messaging.h"
|
||||
#include "cereal/visionipc/visionipc.h"
|
||||
#include "cereal/visionipc/visionbuf.h"
|
||||
|
||||
class VisionIpcClient {
|
||||
private:
|
||||
@@ -14,8 +16,6 @@ private:
|
||||
SubSocket * sock;
|
||||
Poller * poller;
|
||||
|
||||
VisionStreamType type;
|
||||
|
||||
cl_device_id device_id = nullptr;
|
||||
cl_context ctx = nullptr;
|
||||
|
||||
@@ -23,6 +23,7 @@ private:
|
||||
|
||||
public:
|
||||
bool connected = false;
|
||||
VisionStreamType type;
|
||||
int num_buffers = 0;
|
||||
VisionBuf buffers[VISIONIPC_MAX_FDS];
|
||||
VisionIpcClient(std::string name, VisionStreamType type, bool conflate, cl_device_id device_id=nullptr, cl_context ctx=nullptr);
|
||||
@@ -30,4 +31,5 @@ public:
|
||||
VisionBuf * recv(VisionIpcBufExtra * extra=nullptr, const int timeout_ms=100);
|
||||
bool connect(bool blocking=true);
|
||||
bool is_connected() { return connected; }
|
||||
static std::set<VisionStreamType> getAvailableStreams(const std::string &name, bool blocking = true);
|
||||
};
|
||||
|
||||
@@ -14,6 +14,12 @@ from .visionipc cimport VisionIpcServer as cppVisionIpcServer
|
||||
from .visionipc cimport VisionIpcClient as cppVisionIpcClient
|
||||
from .visionipc cimport VisionBuf as cppVisionBuf
|
||||
from .visionipc cimport VisionIpcBufExtra
|
||||
from .visionipc cimport get_endpoint_name as cpp_get_endpoint_name
|
||||
|
||||
|
||||
def get_endpoint_name(string name, VisionStreamType stream):
|
||||
return cpp_get_endpoint_name(name, stream).decode('utf-8')
|
||||
|
||||
|
||||
cpdef enum VisionStreamType:
|
||||
VISION_STREAM_ROAD
|
||||
@@ -97,3 +103,7 @@ cdef class VisionIpcClient:
|
||||
|
||||
def is_connected(self):
|
||||
return self.client.is_connected()
|
||||
|
||||
@staticmethod
|
||||
def available_streams(string name, bool block):
|
||||
return cppVisionIpcClient.getAvailableStreams(name, block)
|
||||
|
||||
@@ -2,15 +2,16 @@
|
||||
#include <chrono>
|
||||
#include <cassert>
|
||||
#include <random>
|
||||
#include <limits>
|
||||
|
||||
#include <poll.h>
|
||||
#include <sys/socket.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "messaging/messaging.h"
|
||||
#include "visionipc/ipc.h"
|
||||
#include "visionipc/visionipc_server.h"
|
||||
#include "logger/logger.h"
|
||||
#include "cereal/messaging/messaging.h"
|
||||
#include "cereal/visionipc/ipc.h"
|
||||
#include "cereal/visionipc/visionipc_server.h"
|
||||
#include "cereal/logger/logger.h"
|
||||
|
||||
std::string get_endpoint_name(std::string name, VisionStreamType type){
|
||||
if (messaging_use_zmq()){
|
||||
@@ -25,7 +26,7 @@ VisionIpcServer::VisionIpcServer(std::string name, cl_device_id device_id, cl_co
|
||||
msg_ctx = Context::create();
|
||||
|
||||
std::random_device rd("/dev/urandom");
|
||||
std::uniform_int_distribution<uint64_t> distribution(0,std::numeric_limits<uint64_t>::max());
|
||||
std::uniform_int_distribution<uint64_t> distribution(0, std::numeric_limits<uint64_t>::max());
|
||||
server_id = distribution(rd);
|
||||
}
|
||||
|
||||
@@ -111,6 +112,19 @@ void VisionIpcServer::listener(){
|
||||
VisionStreamType type = VisionStreamType::VISION_STREAM_MAX;
|
||||
int r = ipc_sendrecv_with_fds(false, fd, &type, sizeof(type), nullptr, 0, nullptr);
|
||||
assert(r == sizeof(type));
|
||||
|
||||
// send available stream types
|
||||
if (type == VisionStreamType::VISION_STREAM_MAX) {
|
||||
std::vector<VisionStreamType> available_stream_types;
|
||||
for (auto& [stream_type, _] : buffers) {
|
||||
available_stream_types.push_back(stream_type);
|
||||
}
|
||||
r = ipc_sendrecv_with_fds(true, fd, available_stream_types.data(), available_stream_types.size() * sizeof(VisionStreamType), nullptr, 0, nullptr);
|
||||
assert(r == available_stream_types.size() * sizeof(VisionStreamType));
|
||||
close(fd);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (buffers.count(type) <= 0) {
|
||||
std::cout << "got request for invalid buffer type: " << type << std::endl;
|
||||
close(fd);
|
||||
@@ -140,6 +154,7 @@ void VisionIpcServer::listener(){
|
||||
|
||||
std::cout << "Stopping listener for: " << name << std::endl;
|
||||
close(sock);
|
||||
unlink(path.c_str());
|
||||
}
|
||||
|
||||
|
||||
@@ -174,7 +189,7 @@ VisionIpcServer::~VisionIpcServer(){
|
||||
listener_thread.join();
|
||||
|
||||
// VisionBuf cleanup
|
||||
for( auto const& [type, buf] : buffers ) {
|
||||
for (auto const& [type, buf] : buffers) {
|
||||
for (VisionBuf* b : buf){
|
||||
if (b->free() != 0) {
|
||||
LOGE("Failed to free buffer");
|
||||
@@ -184,7 +199,7 @@ VisionIpcServer::~VisionIpcServer(){
|
||||
}
|
||||
|
||||
// Messaging cleanup
|
||||
for( auto const& [type, sock] : sockets ) {
|
||||
for (auto const& [type, sock] : sockets) {
|
||||
delete sock;
|
||||
}
|
||||
delete msg_ctx;
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
#include <atomic>
|
||||
#include <map>
|
||||
|
||||
#include "messaging/messaging.h"
|
||||
#include "visionipc/visionipc.h"
|
||||
#include "visionipc/visionbuf.h"
|
||||
#include "cereal/messaging/messaging.h"
|
||||
#include "cereal/visionipc/visionipc.h"
|
||||
#include "cereal/visionipc/visionbuf.h"
|
||||
|
||||
std::string get_endpoint_name(std::string name, VisionStreamType type);
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
#include <chrono>
|
||||
|
||||
#include "catch2/catch.hpp"
|
||||
#include "visionipc_server.h"
|
||||
#include "visionipc_client.h"
|
||||
#include "cereal/visionipc/visionipc_server.h"
|
||||
#include "cereal/visionipc/visionipc_client.h"
|
||||
|
||||
static void zmq_sleep(int milliseconds=1000){
|
||||
if (messaging_use_zmq()){
|
||||
@@ -22,6 +22,17 @@ TEST_CASE("Connecting"){
|
||||
REQUIRE(client.connected);
|
||||
}
|
||||
|
||||
TEST_CASE("getAvailableStreams"){
|
||||
VisionIpcServer server("camerad");
|
||||
server.create_buffers(VISION_STREAM_ROAD, 1, false, 100, 100);
|
||||
server.create_buffers(VISION_STREAM_WIDE_ROAD, 1, false, 100, 100);
|
||||
server.start_listener();
|
||||
auto available_streams = VisionIpcClient::getAvailableStreams("camerad");
|
||||
REQUIRE(available_streams.size() == 2);
|
||||
REQUIRE(available_streams.count(VISION_STREAM_ROAD) == 1);
|
||||
REQUIRE(available_streams.count(VISION_STREAM_WIDE_ROAD) == 1);
|
||||
}
|
||||
|
||||
TEST_CASE("Check buffers"){
|
||||
size_t width = 100, height = 200, num_buffers = 5;
|
||||
VisionIpcServer server("camerad");
|
||||
|
||||
+3
-1
@@ -10,11 +10,13 @@ common_libs = [
|
||||
'statlog.cc',
|
||||
'swaglog.cc',
|
||||
'util.cc',
|
||||
'gpio.cc',
|
||||
'i2c.cc',
|
||||
'watchdog.cc',
|
||||
]
|
||||
|
||||
if arch != "Darwin":
|
||||
common_libs.append('gpio.cc')
|
||||
|
||||
_common = fxn('common', common_libs, LIBS="json11")
|
||||
|
||||
files = [
|
||||
|
||||
+16
-13
@@ -5,6 +5,7 @@
|
||||
#include <memory>
|
||||
|
||||
#include "common/util.h"
|
||||
#include "common/swaglog.h"
|
||||
|
||||
namespace { // helper functions
|
||||
|
||||
@@ -31,14 +32,14 @@ void cl_print_info(cl_platform_id platform, cl_device_id device) {
|
||||
case CL_DEVICE_TYPE_ACCELERATOR: type_str = "CL_DEVICE_TYPE_ACCELERATOR"; break;
|
||||
}
|
||||
|
||||
std::cout << "vendor: " << get_platform_info(platform, CL_PLATFORM_VENDOR) << std::endl
|
||||
<< "platform version: " << get_platform_info(platform, CL_PLATFORM_VERSION) << std::endl
|
||||
<< "profile: " << get_platform_info(platform, CL_PLATFORM_PROFILE) << std::endl
|
||||
<< "extensions: " << get_platform_info(platform, CL_PLATFORM_EXTENSIONS) << std::endl
|
||||
<< "name :" << get_device_info(device, CL_DEVICE_NAME) << std::endl
|
||||
<< "device version :" << get_device_info(device, CL_DEVICE_VERSION) << std::endl
|
||||
<< "max work group size :" << work_group_size << std::endl
|
||||
<< "type = " << device_type << " = " << type_str << std::endl;
|
||||
LOGD("vendor: %s", get_platform_info(platform, CL_PLATFORM_VENDOR).c_str());
|
||||
LOGD("platform version: %s", get_platform_info(platform, CL_PLATFORM_VERSION).c_str());
|
||||
LOGD("profile: %s", get_platform_info(platform, CL_PLATFORM_PROFILE).c_str());
|
||||
LOGD("extensions: %s", get_platform_info(platform, CL_PLATFORM_EXTENSIONS).c_str());
|
||||
LOGD("name: %s", get_device_info(device, CL_DEVICE_NAME).c_str());
|
||||
LOGD("device version: %s", get_device_info(device, CL_DEVICE_VERSION).c_str());
|
||||
LOGD("max work group size: %d", work_group_size);
|
||||
LOGD("type = %d = ", device_type, type_str);
|
||||
}
|
||||
|
||||
void cl_print_build_errors(cl_program program, cl_device_id device) {
|
||||
@@ -49,7 +50,7 @@ void cl_print_build_errors(cl_program program, cl_device_id device) {
|
||||
std::string log(log_size, '\0');
|
||||
clGetProgramBuildInfo(program, device, CL_PROGRAM_BUILD_LOG, log_size, &log[0], NULL);
|
||||
|
||||
std::cout << "build failed; status=" << status << ", log:" << std::endl << log << std::endl;
|
||||
LOGE("build failed; status=%d, log: %s", status, log.c_str());
|
||||
}
|
||||
|
||||
} // namespace
|
||||
@@ -61,14 +62,15 @@ cl_device_id cl_get_device_id(cl_device_type device_type) {
|
||||
CL_CHECK(clGetPlatformIDs(num_platforms, &platform_ids[0], NULL));
|
||||
|
||||
for (size_t i = 0; i < num_platforms; ++i) {
|
||||
std::cout << "platform[" << i << "] CL_PLATFORM_NAME: " << get_platform_info(platform_ids[i], CL_PLATFORM_NAME) << std::endl;
|
||||
LOGD("platform[%d] CL_PLATFORM_NAME: %s", i, get_platform_info(platform_ids[i], CL_PLATFORM_NAME).c_str());
|
||||
|
||||
// Get first device
|
||||
if (cl_device_id device_id = NULL; clGetDeviceIDs(platform_ids[i], device_type, 1, &device_id, NULL) == 0 && device_id) {
|
||||
cl_print_info(platform_ids[i], device_id);
|
||||
return device_id;
|
||||
}
|
||||
}
|
||||
std::cout << "No valid openCL platform found" << std::endl;
|
||||
LOGE("No valid openCL platform found");
|
||||
assert(0);
|
||||
return nullptr;
|
||||
}
|
||||
@@ -78,7 +80,8 @@ cl_program cl_program_from_file(cl_context ctx, cl_device_id device_id, const ch
|
||||
}
|
||||
|
||||
cl_program cl_program_from_source(cl_context ctx, cl_device_id device_id, const std::string& src, const char* args) {
|
||||
cl_program prg = CL_CHECK_ERR(clCreateProgramWithSource(ctx, 1, (const char*[]){src.c_str()}, NULL, &err));
|
||||
const char *csrc = src.c_str();
|
||||
cl_program prg = CL_CHECK_ERR(clCreateProgramWithSource(ctx, 1, &csrc, NULL, &err));
|
||||
if (int err = clBuildProgram(prg, 1, &device_id, args, NULL, NULL); err != 0) {
|
||||
cl_print_build_errors(prg, device_id);
|
||||
assert(0);
|
||||
@@ -87,7 +90,7 @@ cl_program cl_program_from_source(cl_context ctx, cl_device_id device_id, const
|
||||
}
|
||||
|
||||
cl_program cl_program_from_binary(cl_context ctx, cl_device_id device_id, const uint8_t* binary, size_t length, const char* args) {
|
||||
cl_program prg = CL_CHECK_ERR(clCreateProgramWithBinary(ctx, 1, &device_id, &length, (const uint8_t*[]){binary}, NULL, &err));
|
||||
cl_program prg = CL_CHECK_ERR(clCreateProgramWithBinary(ctx, 1, &device_id, &length, &binary, NULL, &err));
|
||||
if (int err = clBuildProgram(prg, 1, &device_id, args, NULL, NULL); err != 0) {
|
||||
cl_print_build_errors(prg, device_id);
|
||||
assert(0);
|
||||
|
||||
+53
-3
@@ -1,14 +1,29 @@
|
||||
#include "common/gpio.h"
|
||||
|
||||
#ifdef __APPLE__
|
||||
int gpio_init(int pin_nr, bool output) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int gpio_set(int pin_nr, bool high) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int gpiochip_get_ro_value_fd(const char* consumer_label, int gpiochiop_id, int pin_nr) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <cstring>
|
||||
#include <linux/gpio.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#include "common/util.h"
|
||||
|
||||
// We assume that all pins have already been exported on boot,
|
||||
// and that we have permission to write to them.
|
||||
#include "common/swaglog.h"
|
||||
|
||||
int gpio_init(int pin_nr, bool output) {
|
||||
char pin_dir_path[50];
|
||||
@@ -30,3 +45,38 @@ int gpio_set(int pin_nr, bool high) {
|
||||
}
|
||||
return util::write_file(pin_val_path, (void*)(high ? "1" : "0"), 1);
|
||||
}
|
||||
|
||||
int gpiochip_get_ro_value_fd(const char* consumer_label, int gpiochiop_id, int pin_nr) {
|
||||
|
||||
// Assumed that all interrupt pins are unexported and rights are given to
|
||||
// read from gpiochip0.
|
||||
std::string gpiochip_path = "/dev/gpiochip" + std::to_string(gpiochiop_id);
|
||||
int fd = open(gpiochip_path.c_str(), O_RDONLY);
|
||||
if (fd < 0) {
|
||||
LOGE("Error opening gpiochip0 fd")
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Setup event
|
||||
struct gpioevent_request rq;
|
||||
rq.lineoffset = pin_nr;
|
||||
rq.handleflags = GPIOHANDLE_REQUEST_INPUT;
|
||||
|
||||
/* Requesting both edges as the data ready pulse from the lsm6ds sensor is
|
||||
very short(75us) and is mostly detected as falling edge instead of rising.
|
||||
So if it is detected as rising the following falling edge is skipped. */
|
||||
rq.eventflags = GPIOEVENT_REQUEST_BOTH_EDGES;
|
||||
|
||||
strncpy(rq.consumer_label, consumer_label, std::size(rq.consumer_label) - 1);
|
||||
int ret = ioctl(fd, GPIO_GET_LINEEVENT_IOCTL, &rq);
|
||||
if (ret == -1) {
|
||||
LOGE("Unable to get line event from ioctl : %s", strerror(errno));
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
close(fd);
|
||||
return rq.fd;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -8,6 +8,11 @@
|
||||
#define GPIO_UBLOX_PWR_EN 34
|
||||
#define GPIO_STM_RST_N 124
|
||||
#define GPIO_STM_BOOT0 134
|
||||
#define GPIO_BMX_ACCEL_INT 21
|
||||
#define GPIO_BMX_GYRO_INT 23
|
||||
#define GPIO_BMX_MAGN_INT 87
|
||||
#define GPIO_LSM_INT 84
|
||||
#define GPIOCHIP_INT 0
|
||||
#else
|
||||
#define GPIO_HUB_RST_N 0
|
||||
#define GPIO_UBLOX_RST_N 0
|
||||
@@ -15,7 +20,14 @@
|
||||
#define GPIO_UBLOX_PWR_EN 0
|
||||
#define GPIO_STM_RST_N 0
|
||||
#define GPIO_STM_BOOT0 0
|
||||
#define GPIO_BMX_ACCEL_INT 0
|
||||
#define GPIO_BMX_GYRO_INT 0
|
||||
#define GPIO_BMX_MAGN_INT 0
|
||||
#define GPIO_LSM_INT 0
|
||||
#define GPIOCHIP_INT 0
|
||||
#endif
|
||||
|
||||
int gpio_init(int pin_nr, bool output);
|
||||
int gpio_set(int pin_nr, bool high);
|
||||
|
||||
int gpiochip_get_ro_value_fd(const char* consumer_label, int gpiochiop_id, int pin_nr);
|
||||
|
||||
+23
-1
@@ -1,3 +1,6 @@
|
||||
import glob
|
||||
from typing import Optional, List
|
||||
|
||||
def gpio_init(pin: int, output: bool) -> None:
|
||||
try:
|
||||
with open(f"/sys/class/gpio/gpio{pin}/direction", 'wb') as f:
|
||||
@@ -5,10 +8,29 @@ def gpio_init(pin: int, output: bool) -> None:
|
||||
except Exception as e:
|
||||
print(f"Failed to set gpio {pin} direction: {e}")
|
||||
|
||||
|
||||
def gpio_set(pin: int, high: bool) -> None:
|
||||
try:
|
||||
with open(f"/sys/class/gpio/gpio{pin}/value", 'wb') as f:
|
||||
f.write(b"1" if high else b"0")
|
||||
except Exception as e:
|
||||
print(f"Failed to set gpio {pin} value: {e}")
|
||||
|
||||
def gpio_read(pin: int) -> Optional[bool]:
|
||||
val = None
|
||||
try:
|
||||
with open(f"/sys/class/gpio/gpio{pin}/value", 'rb') as f:
|
||||
val = bool(int(f.read().strip()))
|
||||
except Exception as e:
|
||||
print(f"Failed to set gpio {pin} value: {e}")
|
||||
|
||||
return val
|
||||
|
||||
def get_irq_for_action(action: str) -> List[int]:
|
||||
ret = []
|
||||
for fn in glob.glob('/sys/kernel/irq/*/actions'):
|
||||
with open(fn) as f:
|
||||
actions = f.read().strip().split(',')
|
||||
if action in actions:
|
||||
irq = int(fn.split('/')[-2])
|
||||
ret.append(irq)
|
||||
return ret
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
#define UNUSED(x) (void)(x)
|
||||
|
||||
#ifdef QCOM2
|
||||
// TODO: decide if we want to isntall libi2c-dev everywhere
|
||||
// TODO: decide if we want to install libi2c-dev everywhere
|
||||
extern "C" {
|
||||
#include <linux/i2c-dev.h>
|
||||
#include <i2c/smbus.h>
|
||||
|
||||
@@ -153,9 +153,9 @@ class SwagLogger(logging.Logger):
|
||||
def bind_global(self, **kwargs):
|
||||
self.global_ctx.update(kwargs)
|
||||
|
||||
def event(self, event_name, *args, **kwargs):
|
||||
def event(self, event, *args, **kwargs):
|
||||
evt = NiceOrderedDict()
|
||||
evt['event'] = event_name
|
||||
evt['event'] = event
|
||||
if args:
|
||||
evt['args'] = args
|
||||
evt.update(kwargs)
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
#include "common/mat.h"
|
||||
#include "system/hardware/hw.h"
|
||||
|
||||
const int TRAJECTORY_SIZE = 33;
|
||||
const int TRAJECTORY_SIZE = 33;
|
||||
const int LAT_MPC_N = 16;
|
||||
const int LON_MPC_N = 32;
|
||||
const float MIN_DRAW_DISTANCE = 10.0;
|
||||
|
||||
+66
-30
@@ -3,6 +3,7 @@
|
||||
#include <dirent.h>
|
||||
#include <sys/file.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <csignal>
|
||||
#include <unordered_map>
|
||||
|
||||
@@ -84,28 +85,35 @@ private:
|
||||
|
||||
std::unordered_map<std::string, uint32_t> keys = {
|
||||
{"AccessToken", CLEAR_ON_MANAGER_START | DONT_LOG},
|
||||
{"AssistNowToken", PERSISTENT},
|
||||
{"AthenadPid", PERSISTENT},
|
||||
{"AthenadUploadQueue", PERSISTENT},
|
||||
{"CalibrationParams", PERSISTENT},
|
||||
{"CameraDebugExpGain", CLEAR_ON_MANAGER_START},
|
||||
{"CameraDebugExpTime", CLEAR_ON_MANAGER_START},
|
||||
{"CarBatteryCapacity", PERSISTENT},
|
||||
{"CarParams", CLEAR_ON_MANAGER_START | CLEAR_ON_IGNITION_ON},
|
||||
{"CarParams", CLEAR_ON_MANAGER_START | CLEAR_ON_ONROAD_TRANSITION},
|
||||
{"CarParamsCache", CLEAR_ON_MANAGER_START},
|
||||
{"CarVin", CLEAR_ON_MANAGER_START | CLEAR_ON_IGNITION_ON},
|
||||
{"CarParamsPersistent", PERSISTENT},
|
||||
{"CarVin", CLEAR_ON_MANAGER_START | CLEAR_ON_ONROAD_TRANSITION},
|
||||
{"CompletedTrainingVersion", PERSISTENT},
|
||||
{"ControlsReady", CLEAR_ON_MANAGER_START | CLEAR_ON_IGNITION_ON},
|
||||
{"CurrentRoute", CLEAR_ON_MANAGER_START | CLEAR_ON_IGNITION_ON},
|
||||
{"DashcamOverride", PERSISTENT},
|
||||
{"DisableLogging", CLEAR_ON_MANAGER_START | CLEAR_ON_IGNITION_ON},
|
||||
{"ControlsReady", CLEAR_ON_MANAGER_START | CLEAR_ON_ONROAD_TRANSITION},
|
||||
{"CurrentBootlog", PERSISTENT},
|
||||
{"CurrentRoute", CLEAR_ON_MANAGER_START | CLEAR_ON_ONROAD_TRANSITION},
|
||||
{"DisableLogging", CLEAR_ON_MANAGER_START | CLEAR_ON_ONROAD_TRANSITION},
|
||||
{"DisablePowerDown", PERSISTENT},
|
||||
{"DisableRadar_Allow", PERSISTENT},
|
||||
{"DisableRadar", PERSISTENT}, // WARNING: THIS DISABLES AEB
|
||||
{"ExperimentalMode", PERSISTENT},
|
||||
{"ExperimentalModeConfirmed", PERSISTENT},
|
||||
{"LongitudinalPersonality", PERSISTENT},
|
||||
{"ExperimentalLongitudinalEnabled", PERSISTENT},
|
||||
{"DisableUpdates", PERSISTENT},
|
||||
{"DisengageOnAccelerator", PERSISTENT},
|
||||
{"DongleId", PERSISTENT},
|
||||
{"DoReboot", CLEAR_ON_MANAGER_START},
|
||||
{"DoShutdown", CLEAR_ON_MANAGER_START},
|
||||
{"DoUninstall", CLEAR_ON_MANAGER_START},
|
||||
{"ForcePowerDown", CLEAR_ON_MANAGER_START},
|
||||
{"FirmwareQueryDone", CLEAR_ON_MANAGER_START | CLEAR_ON_ONROAD_TRANSITION},
|
||||
{"ForcePowerDown", PERSISTENT},
|
||||
{"GitBranch", PERSISTENT},
|
||||
{"GitCommit", PERSISTENT},
|
||||
{"GitDiff", PERSISTENT},
|
||||
@@ -113,6 +121,7 @@ std::unordered_map<std::string, uint32_t> keys = {
|
||||
{"GithubUsername", PERSISTENT},
|
||||
{"GitRemote", PERSISTENT},
|
||||
{"GsmApn", PERSISTENT},
|
||||
{"GsmMetered", PERSISTENT},
|
||||
{"GsmRoaming", PERSISTENT},
|
||||
{"HardwareSerial", PERSISTENT},
|
||||
{"HasAcceptedTerms", PERSISTENT},
|
||||
@@ -127,9 +136,10 @@ std::unordered_map<std::string, uint32_t> keys = {
|
||||
{"IsRhdDetected", PERSISTENT},
|
||||
{"IsTakingSnapshot", CLEAR_ON_MANAGER_START},
|
||||
{"IsTestedBranch", CLEAR_ON_MANAGER_START},
|
||||
{"IsReleaseBranch", CLEAR_ON_MANAGER_START},
|
||||
{"IsUpdateAvailable", CLEAR_ON_MANAGER_START},
|
||||
{"JoystickDebugMode", CLEAR_ON_MANAGER_START | CLEAR_ON_IGNITION_OFF},
|
||||
{"LaikadEphemeris", PERSISTENT | DONT_LOG},
|
||||
{"JoystickDebugMode", CLEAR_ON_MANAGER_START | CLEAR_ON_OFFROAD_TRANSITION},
|
||||
{"LaikadEphemerisV3", PERSISTENT | DONT_LOG},
|
||||
{"LanguageSetting", PERSISTENT},
|
||||
{"LastAthenaPingTime", CLEAR_ON_MANAGER_START},
|
||||
{"LastGPSPosition", PERSISTENT},
|
||||
@@ -139,58 +149,76 @@ std::unordered_map<std::string, uint32_t> keys = {
|
||||
{"LastUpdateException", CLEAR_ON_MANAGER_START},
|
||||
{"LastUpdateTime", PERSISTENT},
|
||||
{"LiveParameters", PERSISTENT},
|
||||
{"NavDestination", CLEAR_ON_MANAGER_START | CLEAR_ON_IGNITION_OFF},
|
||||
{"LiveTorqueCarParams", PERSISTENT},
|
||||
{"LiveTorqueParameters", PERSISTENT | DONT_LOG},
|
||||
{"LastOffroadStatusPacket", CLEAR_ON_MANAGER_START | CLEAR_ON_OFFROAD_TRANSITION},
|
||||
{"NavDestination", CLEAR_ON_MANAGER_START | CLEAR_ON_OFFROAD_TRANSITION},
|
||||
{"NavDestinationWaypoints", CLEAR_ON_MANAGER_START | CLEAR_ON_OFFROAD_TRANSITION},
|
||||
{"NavSettingTime24h", PERSISTENT},
|
||||
{"NavSettingLeftSide", PERSISTENT},
|
||||
{"NavdRender", PERSISTENT},
|
||||
{"ObdMultiplexingChanged", CLEAR_ON_MANAGER_START | CLEAR_ON_ONROAD_TRANSITION},
|
||||
{"ObdMultiplexingEnabled", CLEAR_ON_MANAGER_START | CLEAR_ON_ONROAD_TRANSITION},
|
||||
{"OpenpilotEnabledToggle", PERSISTENT},
|
||||
{"PandaHeartbeatLost", CLEAR_ON_MANAGER_START | CLEAR_ON_IGNITION_OFF},
|
||||
{"PandaHeartbeatLost", CLEAR_ON_MANAGER_START | CLEAR_ON_OFFROAD_TRANSITION},
|
||||
{"PandaSignatures", CLEAR_ON_MANAGER_START},
|
||||
{"Passive", PERSISTENT},
|
||||
{"PrimeType", PERSISTENT},
|
||||
{"RecordFront", PERSISTENT},
|
||||
{"RecordFrontLock", PERSISTENT}, // for the internal fleet
|
||||
{"ReleaseNotes", PERSISTENT},
|
||||
{"ReplayControlsState", CLEAR_ON_MANAGER_START | CLEAR_ON_IGNITION_ON},
|
||||
{"ReplayControlsState", CLEAR_ON_MANAGER_START | CLEAR_ON_ONROAD_TRANSITION},
|
||||
{"ShouldDoUpdate", CLEAR_ON_MANAGER_START},
|
||||
{"SnoozeUpdate", CLEAR_ON_MANAGER_START | CLEAR_ON_IGNITION_OFF},
|
||||
{"SnoozeUpdate", CLEAR_ON_MANAGER_START | CLEAR_ON_OFFROAD_TRANSITION},
|
||||
{"SshEnabled", PERSISTENT},
|
||||
{"SubscriberInfo", PERSISTENT},
|
||||
{"SwitchToBranch", CLEAR_ON_MANAGER_START},
|
||||
{"TermsVersion", PERSISTENT},
|
||||
{"Timezone", PERSISTENT},
|
||||
{"TrainingVersion", PERSISTENT},
|
||||
{"UpdateAvailable", CLEAR_ON_MANAGER_START},
|
||||
{"UbloxAvailable", PERSISTENT},
|
||||
{"UpdateAvailable", CLEAR_ON_MANAGER_START | CLEAR_ON_ONROAD_TRANSITION},
|
||||
{"UpdateFailedCount", CLEAR_ON_MANAGER_START},
|
||||
{"UpdaterState", CLEAR_ON_MANAGER_START},
|
||||
{"UpdaterFetchAvailable", CLEAR_ON_MANAGER_START},
|
||||
{"UpdaterTargetBranch", CLEAR_ON_MANAGER_START},
|
||||
{"UpdaterAvailableBranches", CLEAR_ON_MANAGER_START},
|
||||
{"UpdaterCurrentDescription", CLEAR_ON_MANAGER_START},
|
||||
{"UpdaterCurrentReleaseNotes", CLEAR_ON_MANAGER_START},
|
||||
{"UpdaterNewDescription", CLEAR_ON_MANAGER_START},
|
||||
{"UpdaterNewReleaseNotes", CLEAR_ON_MANAGER_START},
|
||||
{"Version", PERSISTENT},
|
||||
{"VisionRadarToggle", PERSISTENT},
|
||||
{"WideCameraOnly", PERSISTENT},
|
||||
{"ApiCache_Device", PERSISTENT},
|
||||
{"ApiCache_DriveStats", PERSISTENT},
|
||||
{"ApiCache_NavDestinations", PERSISTENT},
|
||||
{"ApiCache_Owner", PERSISTENT},
|
||||
{"Offroad_BadNvme", CLEAR_ON_MANAGER_START},
|
||||
{"Offroad_CarUnrecognized", CLEAR_ON_MANAGER_START | CLEAR_ON_IGNITION_ON},
|
||||
{"Offroad_CarUnrecognized", CLEAR_ON_MANAGER_START | CLEAR_ON_ONROAD_TRANSITION},
|
||||
{"Offroad_ConnectivityNeeded", CLEAR_ON_MANAGER_START},
|
||||
{"Offroad_ConnectivityNeededPrompt", CLEAR_ON_MANAGER_START},
|
||||
{"Offroad_InvalidTime", CLEAR_ON_MANAGER_START},
|
||||
{"Offroad_IsTakingSnapshot", CLEAR_ON_MANAGER_START},
|
||||
{"Offroad_NeosUpdate", CLEAR_ON_MANAGER_START},
|
||||
{"Offroad_NoFirmware", CLEAR_ON_MANAGER_START | CLEAR_ON_IGNITION_ON},
|
||||
{"Offroad_NoFirmware", CLEAR_ON_MANAGER_START | CLEAR_ON_ONROAD_TRANSITION},
|
||||
{"Offroad_StorageMissing", CLEAR_ON_MANAGER_START},
|
||||
{"Offroad_TemperatureTooHigh", CLEAR_ON_MANAGER_START},
|
||||
{"Offroad_UnofficialHardware", CLEAR_ON_MANAGER_START},
|
||||
{"Offroad_UpdateFailed", CLEAR_ON_MANAGER_START},
|
||||
{"Offroad_Recalibration", CLEAR_ON_MANAGER_START | CLEAR_ON_ONROAD_TRANSITION},
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
|
||||
Params::Params(const std::string &path) {
|
||||
const char* env = std::getenv("OPENPILOT_PREFIX");
|
||||
prefix = env ? "/" + std::string(env) : "/d";
|
||||
std::string default_param_path = ensure_params_path(prefix);
|
||||
params_path = path.empty() ? default_param_path : ensure_params_path(prefix, path);
|
||||
prefix = "/" + util::getenv("OPENPILOT_PREFIX", "d");
|
||||
params_path = ensure_params_path(prefix, path);
|
||||
}
|
||||
|
||||
std::vector<std::string> Params::allKeys() const {
|
||||
std::vector<std::string> ret;
|
||||
for (auto &p : keys) {
|
||||
ret.push_back(p.first);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool Params::checkKey(const std::string &key) {
|
||||
@@ -278,11 +306,19 @@ std::map<std::string, std::string> Params::readAll() {
|
||||
void Params::clearAll(ParamKeyType key_type) {
|
||||
FileLock file_lock(params_path + "/.lock");
|
||||
|
||||
std::string path;
|
||||
for (auto &[key, type] : keys) {
|
||||
if (type & key_type) {
|
||||
unlink(getParamPath(key).c_str());
|
||||
// 1) delete params of key_type
|
||||
// 2) delete files that are not defined in the keys.
|
||||
if (DIR *d = opendir(getParamPath().c_str())) {
|
||||
struct dirent *de = NULL;
|
||||
while ((de = readdir(d))) {
|
||||
if (de->d_type != DT_DIR) {
|
||||
auto it = keys.find(de->d_name);
|
||||
if (it == keys.end() || (it->second & key_type)) {
|
||||
unlink(getParamPath(de->d_name).c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir(d);
|
||||
}
|
||||
|
||||
fsync_dir(getParamPath());
|
||||
|
||||
+6
-4
@@ -2,12 +2,13 @@
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
enum ParamKeyType {
|
||||
PERSISTENT = 0x02,
|
||||
CLEAR_ON_MANAGER_START = 0x04,
|
||||
CLEAR_ON_IGNITION_ON = 0x08,
|
||||
CLEAR_ON_IGNITION_OFF = 0x10,
|
||||
CLEAR_ON_ONROAD_TRANSITION = 0x08,
|
||||
CLEAR_ON_OFFROAD_TRANSITION = 0x10,
|
||||
DONT_LOG = 0x20,
|
||||
ALL = 0xFFFFFFFF
|
||||
};
|
||||
@@ -15,6 +16,7 @@ enum ParamKeyType {
|
||||
class Params {
|
||||
public:
|
||||
Params(const std::string &path = {});
|
||||
std::vector<std::string> allKeys() const;
|
||||
bool checkKey(const std::string &key);
|
||||
ParamKeyType getKeyType(const std::string &key);
|
||||
inline std::string getParamPath(const std::string &key = {}) {
|
||||
@@ -27,8 +29,8 @@ public:
|
||||
|
||||
// helpers for reading values
|
||||
std::string get(const std::string &key, bool block = false);
|
||||
inline bool getBool(const std::string &key) {
|
||||
return get(key) == "1";
|
||||
inline bool getBool(const std::string &key, bool block = false) {
|
||||
return get(key, block) == "1";
|
||||
}
|
||||
std::map<std::string, std::string> readAll();
|
||||
|
||||
|
||||
+11
-6
@@ -2,26 +2,28 @@
|
||||
# cython: language_level = 3
|
||||
from libcpp cimport bool
|
||||
from libcpp.string cimport string
|
||||
from libcpp.vector cimport vector
|
||||
import threading
|
||||
|
||||
cdef extern from "common/params.h":
|
||||
cpdef enum ParamKeyType:
|
||||
PERSISTENT
|
||||
CLEAR_ON_MANAGER_START
|
||||
CLEAR_ON_IGNITION_ON
|
||||
CLEAR_ON_IGNITION_OFF
|
||||
CLEAR_ON_ONROAD_TRANSITION
|
||||
CLEAR_ON_OFFROAD_TRANSITION
|
||||
ALL
|
||||
|
||||
cdef cppclass c_Params "Params":
|
||||
c_Params(string) nogil
|
||||
string get(string, bool) nogil
|
||||
bool getBool(string) nogil
|
||||
bool getBool(string, bool) nogil
|
||||
int remove(string) nogil
|
||||
int put(string, string) nogil
|
||||
int putBool(string, bool) nogil
|
||||
bool checkKey(string) nogil
|
||||
string getParamPath(string) nogil
|
||||
void clearAll(ParamKeyType)
|
||||
vector[string] allKeys()
|
||||
|
||||
|
||||
def ensure_bytes(v):
|
||||
@@ -66,11 +68,11 @@ cdef class Params:
|
||||
|
||||
return val if encoding is None else val.decode(encoding)
|
||||
|
||||
def get_bool(self, key):
|
||||
def get_bool(self, key, bool block=False):
|
||||
cdef string k = self.check_key(key)
|
||||
cdef bool r
|
||||
with nogil:
|
||||
r = self.p.getBool(k)
|
||||
r = self.p.getBool(k, block)
|
||||
return r
|
||||
|
||||
def put(self, key, dat):
|
||||
@@ -90,7 +92,7 @@ cdef class Params:
|
||||
with nogil:
|
||||
self.p.putBool(k, val)
|
||||
|
||||
def delete(self, key):
|
||||
def remove(self, key):
|
||||
cdef string k = self.check_key(key)
|
||||
with nogil:
|
||||
self.p.remove(k)
|
||||
@@ -99,6 +101,9 @@ cdef class Params:
|
||||
cdef string key_bytes = ensure_bytes(key)
|
||||
return self.p.getParamPath(key_bytes).decode("utf-8")
|
||||
|
||||
def all_keys(self):
|
||||
return self.p.allKeys()
|
||||
|
||||
def put_nonblocking(key, val, d=""):
|
||||
threading.Thread(target=lambda: Params(d).put(key, val)).start()
|
||||
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
#pragma once
|
||||
|
||||
#include <cassert>
|
||||
#include <string>
|
||||
|
||||
#include "common/params.h"
|
||||
#include "common/util.h"
|
||||
|
||||
class OpenpilotPrefix {
|
||||
public:
|
||||
OpenpilotPrefix(std::string prefix = {}) {
|
||||
if (prefix.empty()) {
|
||||
prefix = util::random_string(15);
|
||||
}
|
||||
msgq_path = "/dev/shm/" + prefix;
|
||||
bool ret = util::create_directories(msgq_path, 0777);
|
||||
assert(ret);
|
||||
setenv("OPENPILOT_PREFIX", prefix.c_str(), 1);
|
||||
}
|
||||
|
||||
~OpenpilotPrefix() {
|
||||
auto param_path = Params().getParamPath();
|
||||
if (util::file_exists(param_path)) {
|
||||
std::string real_path = util::readlink(param_path);
|
||||
system(util::string_format("rm %s -rf", real_path.c_str()).c_str());
|
||||
unlink(param_path.c_str());
|
||||
}
|
||||
system(util::string_format("rm %s -rf", msgq_path.c_str()).c_str());
|
||||
unsetenv("OPENPILOT_PREFIX");
|
||||
}
|
||||
|
||||
private:
|
||||
std::string msgq_path;
|
||||
};
|
||||
+1
-1
@@ -31,7 +31,7 @@ class Priority:
|
||||
|
||||
def set_realtime_priority(level: int) -> None:
|
||||
if not PC:
|
||||
os.sched_setscheduler(0, os.SCHED_FIFO, os.sched_param(level)) # type: ignore[attr-defined] # pylint: disable=no-member
|
||||
os.sched_setscheduler(0, os.SCHED_FIFO, os.sched_param(level)) # pylint: disable=no-member
|
||||
|
||||
|
||||
def set_core_affinity(cores: List[int]) -> None:
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "common/statlog.h"
|
||||
#include "common/util.h"
|
||||
|
||||
#include <cstdarg>
|
||||
#include <stdio.h>
|
||||
#include <mutex>
|
||||
#include <zmq.h>
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "common/swaglog.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <cstdarg>
|
||||
#include <cstring>
|
||||
#include <limits>
|
||||
#include <mutex>
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
import datetime
|
||||
|
||||
MIN_DATE = datetime.datetime(year=2023, month=6, day=1)
|
||||
+24
-2
@@ -1,5 +1,6 @@
|
||||
#include "common/util.h"
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <dirent.h>
|
||||
|
||||
@@ -9,6 +10,7 @@
|
||||
#include <dirent.h>
|
||||
#include <fstream>
|
||||
#include <iomanip>
|
||||
#include <random>
|
||||
#include <sstream>
|
||||
|
||||
#ifdef __linux__
|
||||
@@ -133,6 +135,14 @@ int safe_fflush(FILE *stream) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
int safe_ioctl(int fd, unsigned long request, void *argp) {
|
||||
int ret;
|
||||
do {
|
||||
ret = ioctl(fd, request, argp);
|
||||
} while ((ret == -1) && (errno == EINTR));
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::string readlink(const std::string &path) {
|
||||
char buff[4096];
|
||||
ssize_t len = ::readlink(path.c_str(), buff, sizeof(buff)-1);
|
||||
@@ -179,7 +189,7 @@ bool create_directories(const std::string& dir, mode_t mode) {
|
||||
return createDirectory(dir, mode);
|
||||
}
|
||||
|
||||
std::string getenv(const char* key, const char* default_val) {
|
||||
std::string getenv(const char* key, std::string default_val) {
|
||||
const char* val = ::getenv(key);
|
||||
return val ? val : default_val;
|
||||
}
|
||||
@@ -203,6 +213,18 @@ std::string hexdump(const uint8_t* in, const size_t size) {
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
std::string random_string(std::string::size_type length) {
|
||||
const char* chrs = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
std::mt19937 rg{std::random_device{}()};
|
||||
std::uniform_int_distribution<std::string::size_type> pick(0, sizeof(chrs) - 2);
|
||||
std::string s;
|
||||
s.reserve(length);
|
||||
while (length--) {
|
||||
s += chrs[pick(rg)];
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
std::string dir_name(std::string const &path) {
|
||||
size_t pos = path.find_last_of("/");
|
||||
if (pos == std::string::npos) return "";
|
||||
@@ -238,7 +260,7 @@ struct tm get_time() {
|
||||
bool time_valid(struct tm sys_time) {
|
||||
int year = 1900 + sys_time.tm_year;
|
||||
int month = 1 + sys_time.tm_mon;
|
||||
return (year > 2021) || (year == 2021 && month >= 6);
|
||||
return (year > 2023) || (year == 2023 && month >= 6);
|
||||
}
|
||||
|
||||
} // namespace util
|
||||
|
||||
+3
-1
@@ -70,11 +70,12 @@ std::string string_format(const std::string& format, Args... args) {
|
||||
return std::string(buf.get(), buf.get() + size - 1);
|
||||
}
|
||||
|
||||
std::string getenv(const char* key, const char* default_val = "");
|
||||
std::string getenv(const char* key, std::string default_val = "");
|
||||
int getenv(const char* key, int default_val);
|
||||
float getenv(const char* key, float default_val);
|
||||
|
||||
std::string hexdump(const uint8_t* in, const size_t size);
|
||||
std::string random_string(std::string::size_type length);
|
||||
std::string dir_name(std::string const& path);
|
||||
|
||||
// **** file fhelpers *****
|
||||
@@ -85,6 +86,7 @@ int write_file(const char* path, const void* data, size_t size, int flags = O_WR
|
||||
FILE* safe_fopen(const char* filename, const char* mode);
|
||||
size_t safe_fwrite(const void * ptr, size_t size, size_t count, FILE * stream);
|
||||
int safe_fflush(FILE *stream);
|
||||
int safe_ioctl(int fd, unsigned long request, void *argp);
|
||||
|
||||
std::string readlink(const std::string& path);
|
||||
bool file_exists(const std::string& fn);
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
#define COMMA_VERSION "0.8.16"
|
||||
#define COMMA_VERSION "0.9.3"
|
||||
|
||||
+276
-224
@@ -2,227 +2,277 @@
|
||||
|
||||
# Supported Cars
|
||||
|
||||
A supported vehicle is one that just works when you install a comma device. Every car performs differently with openpilot, but all supported cars should provide a better experience than any stock system.
|
||||
A supported vehicle is one that just works when you install a comma three. All supported cars provide a better experience than any stock system. Supported vehicles reference the US market unless otherwise specified.
|
||||
|
||||
# 205 Supported Cars
|
||||
# 252 Supported Cars
|
||||
|
||||
|Make|Model|Supported Package|ACC|No ACC accel below|No ALC below|Steering Torque|Harness|
|
||||
|---|---|---|:---:|:---:|:---:|:---:|:---:|
|
||||
|Acura|ILX 2016-19|AcuraWatch Plus|openpilot|25 mph|25 mph|[](##)|Honda Nidec|
|
||||
|Acura|RDX 2016-18|AcuraWatch Plus|openpilot|25 mph|12 mph|[](##)|Honda Nidec|
|
||||
|Acura|RDX 2019-22|All|Stock|0 mph|3 mph|[](##)|Honda Bosch A|
|
||||
|Audi|A3 2014-19|ACC + Lane Assist|Stock|0 mph|0 mph|[](##)|VW|
|
||||
|Audi|A3 Sportback e-tron 2017-18|ACC + Lane Assist|Stock|0 mph|0 mph|[](##)|VW|
|
||||
|Audi|Q2 2018|ACC + Lane Assist|Stock|0 mph|0 mph|[](##)|VW|
|
||||
|Audi|Q3 2020-21|ACC + Lane Assist|Stock|0 mph|0 mph|[](##)|VW|
|
||||
|Audi|RS3 2018|ACC + Lane Assist|Stock|0 mph|0 mph|[](##)|VW|
|
||||
|Audi|S3 2015-17|ACC + Lane Assist|Stock|0 mph|0 mph|[](##)|VW|
|
||||
|Cadillac|Escalade ESV 2016[<sup>1</sup>](#footnotes)|Adaptive Cruise Control (ACC) & LKAS|openpilot|0 mph|7 mph|[](##)|OBD-II|
|
||||
|Chevrolet|Bolt EUV 2022-23|Premier or Premier Redline Trim without Super Cruise Package|Stock|0 mph|7 mph|[](##)|GM|
|
||||
|Chevrolet|Silverado 1500 2020-21|Safety Package II|Stock|0 mph|7 mph|[](##)|GM|
|
||||
|Chevrolet|Volt 2017-18[<sup>1</sup>](#footnotes)|Adaptive Cruise Control|openpilot|0 mph|7 mph|[](##)|OBD-II|
|
||||
|Chrysler|Pacifica 2017-18|Adaptive Cruise Control|Stock|0 mph|9 mph|[](##)|FCA|
|
||||
|Chrysler|Pacifica 2019-20|Adaptive Cruise Control|Stock|0 mph|39 mph|[](##)|FCA|
|
||||
|Chrysler|Pacifica 2021|All|Stock|0 mph|39 mph|[](##)|FCA|
|
||||
|Chrysler|Pacifica Hybrid 2017-18|Adaptive Cruise Control|Stock|0 mph|9 mph|[](##)|FCA|
|
||||
|Chrysler|Pacifica Hybrid 2019-22|Adaptive Cruise Control|Stock|0 mph|39 mph|[](##)|FCA|
|
||||
|comma|body|All|Stock|0 mph|0 mph|[](##)|None|
|
||||
|Genesis|G70 2018-19|All|Stock|0 mph|0 mph|[](##)|Hyundai F|
|
||||
|Genesis|G70 2020|All|openpilot|0 mph|0 mph|[](##)|Hyundai F|
|
||||
|Genesis|G80 2017-19|All|Stock|0 mph|0 mph|[](##)|Hyundai H|
|
||||
|Genesis|G90 2017-18|All|Stock|0 mph|0 mph|[](##)|Hyundai C|
|
||||
|GMC|Acadia 2018[<sup>1</sup>](#footnotes)|Adaptive Cruise Control|openpilot|0 mph|7 mph|[](##)|OBD-II|
|
||||
|GMC|Sierra 1500 2020-21|Driver Alert Package II|Stock|0 mph|7 mph|[](##)|GM|
|
||||
|Honda|Accord 2018-22|All|Stock|0 mph|3 mph|[](##)|Honda Bosch A|
|
||||
|Honda|Accord Hybrid 2018-22|All|Stock|0 mph|3 mph|[](##)|Honda Bosch A|
|
||||
|Honda|Civic 2016-18|Honda Sensing|openpilot|0 mph|12 mph|[](##)|Honda Nidec|
|
||||
|Honda|Civic 2019-21|All|Stock|0 mph|2 mph[<sup>2</sup>](#footnotes)|[](##)|Honda Bosch A|
|
||||
|Honda|Civic 2022|All|Stock|0 mph|0 mph|[](##)|Honda Bosch B|
|
||||
|Honda|Civic Hatchback 2017-21|Honda Sensing|Stock|0 mph|12 mph|[](##)|Honda Bosch A|
|
||||
|Honda|Civic Hatchback 2022|All|Stock|0 mph|0 mph|[](##)|Honda Bosch B|
|
||||
|Honda|CR-V 2015-16|Touring Trim|openpilot|25 mph|12 mph|[](##)|Honda Nidec|
|
||||
|Honda|CR-V 2017-22|Honda Sensing|Stock|0 mph|12 mph|[](##)|Honda Bosch A|
|
||||
|Honda|CR-V Hybrid 2017-19|Honda Sensing|Stock|0 mph|12 mph|[](##)|Honda Bosch A|
|
||||
|Honda|e 2020|All|Stock|0 mph|3 mph|[](##)|Honda Bosch A|
|
||||
|Honda|Fit 2018-20|Honda Sensing|openpilot|25 mph|12 mph|[](##)|Honda Nidec|
|
||||
|Honda|Freed 2020|Honda Sensing|openpilot|25 mph|12 mph|[](##)|Honda Nidec|
|
||||
|Honda|HR-V 2019-22|Honda Sensing|openpilot|25 mph|12 mph|[](##)|Honda Nidec|
|
||||
|Honda|Insight 2019-22|All|Stock|0 mph|3 mph|[](##)|Honda Bosch A|
|
||||
|Honda|Inspire 2018|All|Stock|0 mph|3 mph|[](##)|Honda Bosch A|
|
||||
|Honda|Odyssey 2018-20|Honda Sensing|openpilot|25 mph|0 mph|[](##)|Honda Nidec|
|
||||
|Honda|Passport 2019-21|All|openpilot|25 mph|12 mph|[](##)|Honda Nidec|
|
||||
|Honda|Pilot 2016-22|Honda Sensing|openpilot|25 mph|12 mph|[](##)|Honda Nidec|
|
||||
|Honda|Ridgeline 2017-22|Honda Sensing|openpilot|25 mph|12 mph|[](##)|Honda Nidec|
|
||||
|Hyundai|Elantra 2017-19|Smart Cruise Control (SCC) & LKAS|Stock|19 mph|32 mph|[](##)|Hyundai B|
|
||||
|Hyundai|Elantra 2021-22|Smart Cruise Control (SCC) & LKAS|Stock|0 mph|0 mph|[](##)|Hyundai K|
|
||||
|Hyundai|Elantra Hybrid 2021-22|Smart Cruise Control (SCC)|Stock|0 mph|0 mph|[](##)|Hyundai K|
|
||||
|Hyundai|Genesis 2015-16|Smart Cruise Control (SCC) & LKAS|Stock|19 mph|37 mph|[](##)|Hyundai J|
|
||||
|Hyundai|Ioniq 5 2022|Highway Driving Assist II|Stock|0 mph|0 mph|[](##)|Hyundai Q|
|
||||
|Hyundai|Ioniq Electric 2019|Smart Cruise Control (SCC) & LKAS|Stock|0 mph|32 mph|[](##)|Hyundai C|
|
||||
|Hyundai|Ioniq Electric 2020|Smart Cruise Control (SCC) & LKAS|Stock|0 mph|0 mph|[](##)|Hyundai H|
|
||||
|Hyundai|Ioniq Hybrid 2017-19|Smart Cruise Control (SCC) & LKAS|Stock|0 mph|32 mph|[](##)|Hyundai C|
|
||||
|Hyundai|Ioniq Hybrid 2020-22|Smart Cruise Control (SCC) & LFA|Stock|0 mph|0 mph|[](##)|Hyundai H|
|
||||
|Hyundai|Ioniq Plug-in Hybrid 2019|Smart Cruise Control (SCC) & LKAS|Stock|0 mph|32 mph|[](##)|Hyundai C|
|
||||
|Hyundai|Ioniq Plug-in Hybrid 2020-21|Smart Cruise Control (SCC)|Stock|0 mph|0 mph|[](##)|Hyundai H|
|
||||
|Hyundai|Kona 2020|Smart Cruise Control (SCC)|Stock|0 mph|0 mph|[](##)|Hyundai B|
|
||||
|Hyundai|Kona Electric 2018-21|Smart Cruise Control (SCC) & LKAS|Stock|0 mph|0 mph|[](##)|Hyundai G|
|
||||
|Hyundai|Kona Electric 2022|Smart Cruise Control (SCC)|Stock|0 mph|0 mph|[](##)|Hyundai O|
|
||||
|Hyundai|Kona Hybrid 2020|Smart Cruise Control (SCC) & LKAS|Stock|0 mph|0 mph|[](##)|Hyundai I|
|
||||
|Hyundai|Palisade 2020-22|All|openpilot|0 mph|0 mph|[](##)|Hyundai H|
|
||||
|Hyundai|Santa Fe 2019-20|All|openpilot|0 mph|0 mph|[](##)|Hyundai D|
|
||||
|Hyundai|Santa Fe 2021-22|All|Stock|0 mph|0 mph|[](##)|Hyundai L|
|
||||
|Hyundai|Santa Fe Hybrid 2022|All|Stock|0 mph|0 mph|[](##)|Hyundai L|
|
||||
|Hyundai|Santa Fe Plug-in Hybrid 2022|All|Stock|0 mph|0 mph|[](##)|Hyundai L|
|
||||
|Hyundai|Sonata 2018-19|Smart Cruise Control (SCC) & LKAS|Stock|0 mph|0 mph|[](##)|Hyundai E|
|
||||
|Hyundai|Sonata 2020-22|All|openpilot|0 mph|0 mph|[](##)|Hyundai A|
|
||||
|Hyundai|Sonata Hybrid 2020-22|All|openpilot|0 mph|0 mph|[](##)|Hyundai A|
|
||||
|Hyundai|Tucson 2021|Smart Cruise Control (SCC)|Stock|19 mph|0 mph|[](##)|Hyundai L|
|
||||
|Hyundai|Tucson Diesel 2019|Smart Cruise Control (SCC)|Stock|0 mph|0 mph|[](##)|Hyundai L|
|
||||
|Hyundai|Tucson Hybrid 2022|All|Stock|0 mph|0 mph|[](##)|Hyundai N|
|
||||
|Hyundai|Veloster 2019-20|Smart Cruise Control (SCC)|Stock|5 mph|0 mph|[](##)|Hyundai E|
|
||||
|Jeep|Grand Cherokee 2016-18|Adaptive Cruise Control|Stock|0 mph|9 mph|[](##)|FCA|
|
||||
|Jeep|Grand Cherokee 2019-21|Adaptive Cruise Control|Stock|0 mph|39 mph|[](##)|FCA|
|
||||
|Kia|Ceed 2019|Smart Cruise Control (SCC) & LKAS|Stock|0 mph|0 mph|[](##)|Hyundai E|
|
||||
|Kia|EV6 2022|Highway Driving Assist II|Stock|0 mph|0 mph|[](##)|Hyundai P|
|
||||
|Kia|Forte 2018|Smart Cruise Control (SCC) & LKAS|Stock|0 mph|0 mph|[](##)|Hyundai B|
|
||||
|Kia|Forte 2019-21|All|Stock|0 mph|0 mph|[](##)|Hyundai G|
|
||||
|Kia|K5 2021-22|Smart Cruise Control (SCC)|Stock|0 mph|0 mph|[](##)|Hyundai A|
|
||||
|Kia|Niro Electric 2019|All|openpilot|0 mph|0 mph|[](##)|Hyundai H|
|
||||
|Kia|Niro Electric 2020|All|openpilot|0 mph|0 mph|[](##)|Hyundai F|
|
||||
|Kia|Niro Electric 2021|All|openpilot|0 mph|0 mph|[](##)|Hyundai C|
|
||||
|Kia|Niro Electric 2022|All|openpilot|0 mph|0 mph|[](##)|Hyundai H|
|
||||
|Kia|Niro Hybrid 2021|Smart Cruise Control (SCC) & LKAS|Stock|0 mph|0 mph|[](##)|Hyundai F|
|
||||
|Kia|Niro Hybrid 2022|Smart Cruise Control (SCC) & LKAS|Stock|0 mph|0 mph|[](##)|Hyundai H|
|
||||
|Kia|Niro Plug-in Hybrid 2018-19|Smart Cruise Control (SCC) & LKAS|openpilot|10 mph|32 mph|[](##)|Hyundai C|
|
||||
|Kia|Optima 2017|Smart Cruise Control (SCC) & LKAS|Stock|0 mph|32 mph|[](##)|Hyundai B|
|
||||
|Kia|Optima 2019|Smart Cruise Control (SCC) & LKAS|Stock|0 mph|0 mph|[](##)|Hyundai G|
|
||||
|Kia|Seltos 2021|Smart Cruise Control (SCC)|Stock|0 mph|0 mph|[](##)|Hyundai A|
|
||||
|Kia|Sorento 2018|Smart Cruise Control (SCC) & LKAS|Stock|0 mph|0 mph|[](##)|Hyundai C|
|
||||
|Kia|Sorento 2019|Smart Cruise Control (SCC) & LKAS|Stock|0 mph|0 mph|[](##)|Hyundai E|
|
||||
|Kia|Stinger 2018-20|Smart Cruise Control (SCC) & LKAS|Stock|0 mph|0 mph|[](##)|Hyundai C|
|
||||
|Kia|Telluride 2020|All|openpilot|0 mph|0 mph|[](##)|Hyundai H|
|
||||
|Lexus|CT Hybrid 2017-18|Lexus Safety System+|Stock[<sup>3</sup>](#footnotes)|0 mph|0 mph|[](##)|Toyota|
|
||||
|Lexus|ES 2019-22|All|openpilot|0 mph|0 mph|[](##)|Toyota|
|
||||
|Lexus|ES Hybrid 2017-18|Lexus Safety System+|Stock[<sup>3</sup>](#footnotes)|0 mph|0 mph|[](##)|Toyota|
|
||||
|Lexus|ES Hybrid 2019-22|All|openpilot|0 mph|0 mph|[](##)|Toyota|
|
||||
|Lexus|IS 2017-19|All|Stock|19 mph|0 mph|[](##)|Toyota|
|
||||
|Lexus|NX 2018-19|All|Stock[<sup>3</sup>](#footnotes)|0 mph|0 mph|[](##)|Toyota|
|
||||
|Lexus|NX 2020-21|All|openpilot|0 mph|0 mph|[](##)|Toyota|
|
||||
|Lexus|NX Hybrid 2018-19|All|Stock[<sup>3</sup>](#footnotes)|0 mph|0 mph|[](##)|Toyota|
|
||||
|Lexus|NX Hybrid 2020-21|All|openpilot|0 mph|0 mph|[](##)|Toyota|
|
||||
|Lexus|RC 2017-20|All|Stock|19 mph|0 mph|[](##)|Toyota|
|
||||
|Lexus|RX 2016-19|All|Stock[<sup>3</sup>](#footnotes)|0 mph|0 mph|[](##)|Toyota|
|
||||
|Lexus|RX 2020-22|All|openpilot|0 mph|0 mph|[](##)|Toyota|
|
||||
|Lexus|RX Hybrid 2016-19|All|Stock[<sup>3</sup>](#footnotes)|0 mph|0 mph|[](##)|Toyota|
|
||||
|Lexus|RX Hybrid 2020-21|All|openpilot|0 mph|0 mph|[](##)|Toyota|
|
||||
|Lexus|UX Hybrid 2019-22|All|openpilot|0 mph|0 mph|[](##)|Toyota|
|
||||
|Mazda|CX-5 2022|All|Stock|0 mph|0 mph|[](##)|Mazda|
|
||||
|Mazda|CX-9 2021-22|All|Stock|0 mph|28 mph|[](##)|Mazda|
|
||||
|Nissan|Altima 2019-20|ProPILOT Assist|Stock|0 mph|0 mph|[](##)|Nissan B|
|
||||
|Nissan|Leaf 2018-22|ProPILOT Assist|Stock|0 mph|0 mph|[](##)|Nissan A|
|
||||
|Nissan|Rogue 2018-20|ProPILOT Assist|Stock|0 mph|0 mph|[](##)|Nissan A|
|
||||
|Nissan|X-Trail 2017|ProPILOT Assist|Stock|0 mph|0 mph|[](##)|Nissan A|
|
||||
|Ram|1500 2019-22|Adaptive Cruise Control|Stock|0 mph|32 mph|[](##)|Ram|
|
||||
|SEAT|Ateca 2018|Driver Assistance|Stock|0 mph|0 mph|[](##)|VW|
|
||||
|SEAT|Leon 2014-20|Driver Assistance|Stock|0 mph|0 mph|[](##)|VW|
|
||||
|Subaru|Ascent 2019-21|All|Stock|0 mph|0 mph|[](##)|Subaru A|
|
||||
|Subaru|Crosstrek 2018-19|EyeSight Driver Assistance|Stock|0 mph|0 mph|[](##)|Subaru A|
|
||||
|Subaru|Crosstrek 2020-21|EyeSight Driver Assistance|Stock|0 mph|0 mph|[](##)|Subaru A|
|
||||
|Subaru|Forester 2019-21|All|Stock|0 mph|0 mph|[](##)|Subaru A|
|
||||
|Subaru|Impreza 2017-19|EyeSight Driver Assistance|Stock|0 mph|0 mph|[](##)|Subaru A|
|
||||
|Subaru|Impreza 2020-22|EyeSight Driver Assistance|Stock|0 mph|0 mph|[](##)|Subaru A|
|
||||
|Subaru|Legacy 2020-22|All|Stock|0 mph|0 mph|[](##)|Subaru B|
|
||||
|Subaru|Outback 2020-22|All|Stock|0 mph|0 mph|[](##)|Subaru B|
|
||||
|Subaru|XV 2018-19|EyeSight Driver Assistance|Stock|0 mph|0 mph|[](##)|Subaru A|
|
||||
|Subaru|XV 2020-21|EyeSight Driver Assistance|Stock|0 mph|0 mph|[](##)|Subaru A|
|
||||
|Škoda|Kamiq 2021[<sup>5</sup>](#footnotes)|Driver Assistance|Stock|0 mph|0 mph|[](##)|VW|
|
||||
|Škoda|Karoq 2019-21[<sup>7</sup>](#footnotes)|Driver Assistance|Stock|0 mph|0 mph|[](##)|VW|
|
||||
|Škoda|Kodiaq 2018-19|Driver Assistance|Stock|0 mph|0 mph|[](##)|VW|
|
||||
|Škoda|Octavia 2015, 2018-19|Driver Assistance|Stock|0 mph|0 mph|[](##)|VW|
|
||||
|Škoda|Octavia RS 2016|Driver Assistance|Stock|0 mph|0 mph|[](##)|VW|
|
||||
|Škoda|Scala 2020|Driver Assistance|Stock|0 mph|0 mph|[](##)|VW|
|
||||
|Škoda|Superb 2015-18|Driver Assistance|Stock|0 mph|0 mph|[](##)|VW|
|
||||
|Toyota|Alphard 2019-20|All|openpilot|0 mph|0 mph|[](##)|Toyota|
|
||||
|Toyota|Alphard Hybrid 2021|All|openpilot|0 mph|0 mph|[](##)|Toyota|
|
||||
|Toyota|Avalon 2016|Toyota Safety Sense P|Stock[<sup>3</sup>](#footnotes)|19 mph|0 mph|[](##)|Toyota|
|
||||
|Toyota|Avalon 2017-18|All|Stock[<sup>3</sup>](#footnotes)|19 mph|0 mph|[](##)|Toyota|
|
||||
|Toyota|Avalon 2019-21|All|Stock[<sup>3</sup>](#footnotes)|0 mph|0 mph|[](##)|Toyota|
|
||||
|Toyota|Avalon 2022|All|openpilot|0 mph|0 mph|[](##)|Toyota|
|
||||
|Toyota|Avalon Hybrid 2019-21|All|Stock[<sup>3</sup>](#footnotes)|0 mph|0 mph|[](##)|Toyota|
|
||||
|Toyota|Avalon Hybrid 2022|All|openpilot|0 mph|0 mph|[](##)|Toyota|
|
||||
|Toyota|C-HR 2017-21|All|Stock|0 mph|0 mph|[](##)|Toyota|
|
||||
|Toyota|C-HR Hybrid 2017-19|All|Stock|0 mph|0 mph|[](##)|Toyota|
|
||||
|Toyota|Camry 2018-20|All|Stock|0 mph[<sup>4</sup>](#footnotes)|0 mph|[](##)|Toyota|
|
||||
|Toyota|Camry 2021-22|All|openpilot|0 mph[<sup>4</sup>](#footnotes)|0 mph|[](##)|Toyota|
|
||||
|Toyota|Camry Hybrid 2018-20|All|Stock|0 mph|0 mph|[](##)|Toyota|
|
||||
|Toyota|Camry Hybrid 2021-22|All|openpilot|0 mph|0 mph|[](##)|Toyota|
|
||||
|Toyota|Corolla 2017-19|All|Stock[<sup>3</sup>](#footnotes)|19 mph|0 mph|[](##)|Toyota|
|
||||
|Toyota|Corolla 2020-22|All|openpilot|0 mph|0 mph|[](##)|Toyota|
|
||||
|Toyota|Corolla Cross (Non-US only) 2020-21|All|openpilot|17 mph|0 mph|[](##)|Toyota|
|
||||
|Toyota|Corolla Cross Hybrid (Non-US only) 2020-22|All|openpilot|17 mph|0 mph|[](##)|Toyota|
|
||||
|Toyota|Corolla Hatchback 2019-22|All|openpilot|0 mph|0 mph|[](##)|Toyota|
|
||||
|Toyota|Corolla Hybrid 2020-22|All|openpilot|0 mph|0 mph|[](##)|Toyota|
|
||||
|Toyota|Highlander 2017-19|All|Stock[<sup>3</sup>](#footnotes)|0 mph|0 mph|[](##)|Toyota|
|
||||
|Toyota|Highlander 2020-22|All|openpilot|0 mph|0 mph|[](##)|Toyota|
|
||||
|Toyota|Highlander Hybrid 2017-19|All|Stock[<sup>3</sup>](#footnotes)|0 mph|0 mph|[](##)|Toyota|
|
||||
|Toyota|Highlander Hybrid 2020-22|All|openpilot|0 mph|0 mph|[](##)|Toyota|
|
||||
|Toyota|Mirai 2021|All|openpilot|0 mph|0 mph|[](##)|Toyota|
|
||||
|Toyota|Prius 2016|Toyota Safety Sense P|Stock[<sup>3</sup>](#footnotes)|0 mph|0 mph|[](##)|Toyota|
|
||||
|Toyota|Prius 2017-20|All|Stock[<sup>3</sup>](#footnotes)|0 mph|0 mph|[](##)|Toyota|
|
||||
|Toyota|Prius 2021-22|All|openpilot|0 mph|0 mph|[](##)|Toyota|
|
||||
|Toyota|Prius Prime 2017-20|All|Stock[<sup>3</sup>](#footnotes)|0 mph|0 mph|[](##)|Toyota|
|
||||
|Toyota|Prius Prime 2021-22|All|openpilot|0 mph|0 mph|[](##)|Toyota|
|
||||
|Toyota|Prius v 2017|Toyota Safety Sense P|Stock[<sup>3</sup>](#footnotes)|19 mph|0 mph|[](##)|Toyota|
|
||||
|Toyota|RAV4 2016|Toyota Safety Sense P|Stock[<sup>3</sup>](#footnotes)|19 mph|0 mph|[](##)|Toyota|
|
||||
|Toyota|RAV4 2017-18|All|Stock[<sup>3</sup>](#footnotes)|19 mph|0 mph|[](##)|Toyota|
|
||||
|Toyota|RAV4 2019-21|All|openpilot|0 mph|0 mph|[](##)|Toyota|
|
||||
|Toyota|RAV4 2022|All|Stock|0 mph|0 mph|[](##)|Toyota|
|
||||
|Toyota|RAV4 Hybrid 2016|Toyota Safety Sense P|Stock[<sup>3</sup>](#footnotes)|0 mph|0 mph|[](##)|Toyota|
|
||||
|Toyota|RAV4 Hybrid 2017-18|All|Stock[<sup>3</sup>](#footnotes)|0 mph|0 mph|[](##)|Toyota|
|
||||
|Toyota|RAV4 Hybrid 2019-21|All|openpilot|0 mph|0 mph|[](##)|Toyota|
|
||||
|Toyota|RAV4 Hybrid 2022|All|Stock|0 mph|0 mph|[](##)|Toyota|
|
||||
|Toyota|Sienna 2018-20|All|Stock[<sup>3</sup>](#footnotes)|19 mph|0 mph|[](##)|Toyota|
|
||||
|Volkswagen|Arteon 2018-22[<sup>7,8</sup>](#footnotes)|Driver Assistance|Stock|0 mph|0 mph|[](##)|J533|
|
||||
|Volkswagen|Arteon eHybrid 2020-22[<sup>7,8</sup>](#footnotes)|Driver Assistance|Stock|0 mph|0 mph|[](##)|J533|
|
||||
|Volkswagen|Arteon R 2020-22[<sup>7,8</sup>](#footnotes)|Driver Assistance|Stock|0 mph|0 mph|[](##)|J533|
|
||||
|Volkswagen|Atlas 2018-22[<sup>7</sup>](#footnotes)|Driver Assistance|Stock|0 mph|0 mph|[](##)|J533|
|
||||
|Volkswagen|Atlas Cross Sport 2021-22[<sup>7</sup>](#footnotes)|Driver Assistance|Stock|0 mph|0 mph|[](##)|J533|
|
||||
|Volkswagen|California 2021[<sup>7</sup>](#footnotes)|Driver Assistance|Stock|0 mph|31 mph|[](##)|J533|
|
||||
|Volkswagen|Caravelle 2020[<sup>7</sup>](#footnotes)|Driver Assistance|Stock|0 mph|31 mph|[](##)|J533|
|
||||
|Volkswagen|CC 2018-22[<sup>7,8</sup>](#footnotes)|Driver Assistance|Stock|0 mph|0 mph|[](##)|J533|
|
||||
|Volkswagen|e-Golf 2014-20|Driver Assistance|Stock|0 mph|0 mph|[](##)|VW|
|
||||
|Volkswagen|Golf 2015-20[<sup>8</sup>](#footnotes)|Driver Assistance|Stock|0 mph|0 mph|[](##)|VW|
|
||||
|Volkswagen|Golf Alltrack 2015-19|Driver Assistance|Stock|0 mph|0 mph|[](##)|VW|
|
||||
|Volkswagen|Golf GTD 2015-20|Driver Assistance|Stock|0 mph|0 mph|[](##)|VW|
|
||||
|Volkswagen|Golf GTE 2015-20|Driver Assistance|Stock|0 mph|0 mph|[](##)|VW|
|
||||
|Volkswagen|Golf GTI 2015-21|Driver Assistance|Stock|0 mph|0 mph|[](##)|VW|
|
||||
|Volkswagen|Golf R 2015-19[<sup>8</sup>](#footnotes)|Driver Assistance|Stock|0 mph|0 mph|[](##)|VW|
|
||||
|Volkswagen|Golf SportsVan 2015-20|Driver Assistance|Stock|0 mph|0 mph|[](##)|VW|
|
||||
|Volkswagen|Jetta 2018-22[<sup>7</sup>](#footnotes)|Driver Assistance|Stock|0 mph|0 mph|[](##)|J533|
|
||||
|Volkswagen|Jetta GLI 2021-22[<sup>7</sup>](#footnotes)|Driver Assistance|Stock|0 mph|0 mph|[](##)|J533|
|
||||
|Volkswagen|Passat 2015-22[<sup>6,7,8</sup>](#footnotes)|Driver Assistance|Stock|0 mph|0 mph|[](##)|J533|
|
||||
|Volkswagen|Passat Alltrack 2015-22[<sup>7</sup>](#footnotes)|Driver Assistance|Stock|0 mph|0 mph|[](##)|J533|
|
||||
|Volkswagen|Passat GTE 2015-22[<sup>7,8</sup>](#footnotes)|Driver Assistance|Stock|0 mph|0 mph|[](##)|J533|
|
||||
|Volkswagen|Polo 2020-22[<sup>7</sup>](#footnotes)|Driver Assistance|Stock|0 mph|0 mph|[](##)|J533|
|
||||
|Volkswagen|Polo GTI 2020-22[<sup>7</sup>](#footnotes)|Driver Assistance|Stock|0 mph|0 mph|[](##)|J533|
|
||||
|Volkswagen|T-Cross 2021[<sup>7</sup>](#footnotes)|Driver Assistance|Stock|0 mph|0 mph|[](##)|J533|
|
||||
|Volkswagen|T-Roc 2021[<sup>7</sup>](#footnotes)|Driver Assistance|Stock|0 mph|0 mph|[](##)|J533|
|
||||
|Volkswagen|Taos 2022[<sup>7</sup>](#footnotes)|Driver Assistance|Stock|0 mph|0 mph|[](##)|J533|
|
||||
|Volkswagen|Teramont 2018-22[<sup>7</sup>](#footnotes)|Driver Assistance|Stock|0 mph|0 mph|[](##)|J533|
|
||||
|Volkswagen|Teramont Cross Sport 2021-22[<sup>7</sup>](#footnotes)|Driver Assistance|Stock|0 mph|0 mph|[](##)|J533|
|
||||
|Volkswagen|Teramont X 2021-22[<sup>7</sup>](#footnotes)|Driver Assistance|Stock|0 mph|0 mph|[](##)|J533|
|
||||
|Volkswagen|Tiguan 2019-22[<sup>7</sup>](#footnotes)|Driver Assistance|Stock|0 mph|0 mph|[](##)|J533|
|
||||
|Volkswagen|Touran 2017|Driver Assistance|Stock|0 mph|0 mph|[](##)|VW|
|
||||
|Make|Model|Supported Package|ACC|No ACC accel below|No ALC below|Steering Torque|Resume from stop|<a href="##"><img width=2000></a>Hardware Needed<br> |Video|
|
||||
|---|---|---|:---:|:---:|:---:|:---:|:---:|:---:|:---:|
|
||||
|Acura|ILX 2016-19|AcuraWatch Plus|openpilot|25 mph|25 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Honda Nidec connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Acura&model=ILX 2016-19">Buy Here</a></sub></details>||
|
||||
|Acura|RDX 2016-18|AcuraWatch Plus|openpilot|25 mph|12 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Honda Nidec connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Acura&model=RDX 2016-18">Buy Here</a></sub></details>||
|
||||
|Acura|RDX 2019-22|All|openpilot available[<sup>1</sup>](#footnotes)|0 mph|3 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Honda Bosch A connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Acura&model=RDX 2019-22">Buy Here</a></sub></details>||
|
||||
|Audi|A3 2014-19|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[<sup>1,10</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 J533 connector<br>- 1 USB-C coupler<br>- 1 comma three<br>- 1 harness box<br>- 1 long OBD-C cable<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Audi&model=A3 2014-19">Buy Here</a></sub></details>||
|
||||
|Audi|A3 Sportback e-tron 2017-18|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[<sup>1,10</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 J533 connector<br>- 1 USB-C coupler<br>- 1 comma three<br>- 1 harness box<br>- 1 long OBD-C cable<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Audi&model=A3 Sportback e-tron 2017-18">Buy Here</a></sub></details>||
|
||||
|Audi|Q2 2018|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[<sup>1,10</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 J533 connector<br>- 1 USB-C coupler<br>- 1 comma three<br>- 1 harness box<br>- 1 long OBD-C cable<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Audi&model=Q2 2018">Buy Here</a></sub></details>||
|
||||
|Audi|Q3 2019-23|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[<sup>1,10</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 J533 connector<br>- 1 USB-C coupler<br>- 1 comma three<br>- 1 harness box<br>- 1 long OBD-C cable<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Audi&model=Q3 2019-23">Buy Here</a></sub></details>||
|
||||
|Audi|RS3 2018|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[<sup>1,10</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 J533 connector<br>- 1 USB-C coupler<br>- 1 comma three<br>- 1 harness box<br>- 1 long OBD-C cable<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Audi&model=RS3 2018">Buy Here</a></sub></details>||
|
||||
|Audi|S3 2015-17|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[<sup>1,10</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 J533 connector<br>- 1 USB-C coupler<br>- 1 comma three<br>- 1 harness box<br>- 1 long OBD-C cable<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Audi&model=S3 2015-17">Buy Here</a></sub></details>||
|
||||
|Buick|LaCrosse 2017-19[<sup>3</sup>](#footnotes)|Driver Confidence Package 2|openpilot|18 mph|7 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 OBD-II connector<br>- 1 comma three<br>- 2 long OBD-C cable<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Buick&model=LaCrosse 2017-19">Buy Here</a></sub></details>||
|
||||
|Cadillac|Escalade 2017[<sup>3</sup>](#footnotes)|Driver Assist Package|openpilot|0 mph|7 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 OBD-II connector<br>- 1 comma three<br>- 2 long OBD-C cable<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Cadillac&model=Escalade 2017">Buy Here</a></sub></details>||
|
||||
|Cadillac|Escalade ESV 2016[<sup>3</sup>](#footnotes)|Adaptive Cruise Control (ACC) & LKAS|openpilot|0 mph|7 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 OBD-II connector<br>- 1 comma three<br>- 2 long OBD-C cable<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Cadillac&model=Escalade ESV 2016">Buy Here</a></sub></details>||
|
||||
|Chevrolet|Bolt EUV 2022-23|Premier or Premier Redline Trim without Super Cruise Package|openpilot available[<sup>1</sup>](#footnotes)|3 mph|6 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 GM connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Chevrolet&model=Bolt EUV 2022-23">Buy Here</a></sub></details>|<a href="https://youtu.be/xvwzGMUA210" target="_blank"><img height="18px" src="assets/icon-youtube.svg"></img></a>|
|
||||
|Chevrolet|Bolt EV 2022-23|2LT Trim with Adaptive Cruise Control Package|openpilot available[<sup>1</sup>](#footnotes)|3 mph|6 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 GM connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Chevrolet&model=Bolt EV 2022-23">Buy Here</a></sub></details>||
|
||||
|Chevrolet|Silverado 1500 2020-21|Safety Package II|openpilot available[<sup>1</sup>](#footnotes)|3 mph|6 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 GM connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Chevrolet&model=Silverado 1500 2020-21">Buy Here</a></sub></details>||
|
||||
|Chevrolet|Trailblazer 2021-22|Adaptive Cruise Control (ACC)|openpilot available[<sup>1</sup>](#footnotes)|3 mph|6 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 GM connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Chevrolet&model=Trailblazer 2021-22">Buy Here</a></sub></details>||
|
||||
|Chevrolet|Volt 2017-18[<sup>3</sup>](#footnotes)|Adaptive Cruise Control (ACC)|openpilot|0 mph|7 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 OBD-II connector<br>- 1 comma three<br>- 2 long OBD-C cable<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Chevrolet&model=Volt 2017-18">Buy Here</a></sub></details>|<a href="https://youtu.be/QeMCN_4TFfQ" target="_blank"><img height="18px" src="assets/icon-youtube.svg"></img></a>|
|
||||
|Chrysler|Pacifica 2017-18|Adaptive Cruise Control (ACC)|Stock|0 mph|9 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 FCA connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Chrysler&model=Pacifica 2017-18">Buy Here</a></sub></details>||
|
||||
|Chrysler|Pacifica 2019-20|Adaptive Cruise Control (ACC)|Stock|0 mph|39 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 FCA connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Chrysler&model=Pacifica 2019-20">Buy Here</a></sub></details>||
|
||||
|Chrysler|Pacifica 2021|All|Stock|0 mph|39 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 FCA connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Chrysler&model=Pacifica 2021">Buy Here</a></sub></details>||
|
||||
|Chrysler|Pacifica Hybrid 2017-18|Adaptive Cruise Control (ACC)|Stock|0 mph|9 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 FCA connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Chrysler&model=Pacifica Hybrid 2017-18">Buy Here</a></sub></details>||
|
||||
|Chrysler|Pacifica Hybrid 2019-23|Adaptive Cruise Control (ACC)|Stock|0 mph|39 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 FCA connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Chrysler&model=Pacifica Hybrid 2019-23">Buy Here</a></sub></details>||
|
||||
|comma|body|All|openpilot|0 mph|0 mph|[](##)|[](##)|None||
|
||||
|Ford|Bronco Sport 2021-22|Co-Pilot360 Assist+|openpilot available[<sup>1</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Ford Q3 connector<br>- 1 RJ45 cable (7 ft)<br>- 1 angled mount (8 degrees)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Ford&model=Bronco Sport 2021-22">Buy Here</a></sub></details>||
|
||||
|Ford|Escape 2020-22|Co-Pilot360 Assist+|openpilot available[<sup>1</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Ford Q3 connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Ford&model=Escape 2020-22">Buy Here</a></sub></details>||
|
||||
|Ford|Explorer 2020-22|Co-Pilot360 Assist+|openpilot available[<sup>1</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Ford Q3 connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Ford&model=Explorer 2020-22">Buy Here</a></sub></details>||
|
||||
|Ford|Kuga 2020-22|Adaptive Cruise Control with Lane Centering|openpilot available[<sup>1</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Ford Q3 connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Ford&model=Kuga 2020-22">Buy Here</a></sub></details>||
|
||||
|Ford|Maverick 2022-23|Co-Pilot360 Assist|openpilot available[<sup>1</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Ford Q3 connector<br>- 1 RJ45 cable (7 ft)<br>- 1 angled mount (8 degrees)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Ford&model=Maverick 2022-23">Buy Here</a></sub></details>||
|
||||
|Genesis|G70 2018-19|All|Stock|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai F connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Genesis&model=G70 2018-19">Buy Here</a></sub></details>||
|
||||
|Genesis|G70 2020|All|openpilot available[<sup>1</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai F connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Genesis&model=G70 2020">Buy Here</a></sub></details>||
|
||||
|Genesis|G80 2017|All|Stock|19 mph|37 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai J connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Genesis&model=G80 2017">Buy Here</a></sub></details>||
|
||||
|Genesis|G80 2018-19|All|Stock|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai H connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Genesis&model=G80 2018-19">Buy Here</a></sub></details>||
|
||||
|Genesis|G90 2017-18|All|openpilot available[<sup>1</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai C connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Genesis&model=G90 2017-18">Buy Here</a></sub></details>||
|
||||
|Genesis|GV60 (Advanced Trim) 2023[<sup>5</sup>](#footnotes)|All|openpilot available[<sup>1</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai A connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Genesis&model=GV60 (Advanced Trim) 2023">Buy Here</a></sub></details>||
|
||||
|Genesis|GV60 (Performance Trim) 2023[<sup>5</sup>](#footnotes)|All|openpilot available[<sup>1</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai K connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Genesis&model=GV60 (Performance Trim) 2023">Buy Here</a></sub></details>||
|
||||
|Genesis|GV70 (2.5T Trim) 2022-23[<sup>5</sup>](#footnotes)|All|Stock|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai L connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Genesis&model=GV70 (2.5T Trim) 2022-23">Buy Here</a></sub></details>||
|
||||
|Genesis|GV70 (3.5T Trim) 2022-23[<sup>5</sup>](#footnotes)|All|Stock|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai M connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Genesis&model=GV70 (3.5T Trim) 2022-23">Buy Here</a></sub></details>||
|
||||
|Genesis|GV80 2023[<sup>5</sup>](#footnotes)|All|Stock|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai M connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Genesis&model=GV80 2023">Buy Here</a></sub></details>||
|
||||
|GMC|Acadia 2018[<sup>3</sup>](#footnotes)|Adaptive Cruise Control (ACC)|openpilot|0 mph|7 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 OBD-II connector<br>- 1 comma three<br>- 2 long OBD-C cable<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=GMC&model=Acadia 2018">Buy Here</a></sub></details>|<a href="https://www.youtube.com/watch?v=0ZN6DdsBUZo" target="_blank"><img height="18px" src="assets/icon-youtube.svg"></img></a>|
|
||||
|GMC|Sierra 1500 2020-21|Driver Alert Package II|openpilot available[<sup>1</sup>](#footnotes)|3 mph|6 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 GM connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=GMC&model=Sierra 1500 2020-21">Buy Here</a></sub></details>|<a href="https://youtu.be/5HbNoBLzRwE" target="_blank"><img height="18px" src="assets/icon-youtube.svg"></img></a>|
|
||||
|Honda|Accord 2018-22|All|openpilot available[<sup>1</sup>](#footnotes)|0 mph|3 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Honda Bosch A connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Honda&model=Accord 2018-22">Buy Here</a></sub></details>|<a href="https://www.youtube.com/watch?v=mrUwlj3Mi58" target="_blank"><img height="18px" src="assets/icon-youtube.svg"></img></a>|
|
||||
|Honda|Accord Hybrid 2018-22|All|openpilot available[<sup>1</sup>](#footnotes)|0 mph|3 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Honda Bosch A connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Honda&model=Accord Hybrid 2018-22">Buy Here</a></sub></details>||
|
||||
|Honda|Civic 2016-18|Honda Sensing|openpilot|0 mph|12 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Honda Nidec connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Honda&model=Civic 2016-18">Buy Here</a></sub></details>|<a href="https://youtu.be/-IkImTe1NYE" target="_blank"><img height="18px" src="assets/icon-youtube.svg"></img></a>|
|
||||
|Honda|Civic 2019-21|All|openpilot available[<sup>1</sup>](#footnotes)|0 mph|2 mph[<sup>4</sup>](#footnotes)|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Honda Bosch A connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Honda&model=Civic 2019-21">Buy Here</a></sub></details>|<a href="https://www.youtube.com/watch?v=4Iz1Mz5LGF8" target="_blank"><img height="18px" src="assets/icon-youtube.svg"></img></a>|
|
||||
|Honda|Civic 2022|All|openpilot available[<sup>1</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Honda Bosch B connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Honda&model=Civic 2022">Buy Here</a></sub></details>|<a href="https://youtu.be/ytiOT5lcp6Q" target="_blank"><img height="18px" src="assets/icon-youtube.svg"></img></a>|
|
||||
|Honda|Civic Hatchback 2017-21|Honda Sensing|openpilot available[<sup>1</sup>](#footnotes)|0 mph|12 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Honda Bosch A connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Honda&model=Civic Hatchback 2017-21">Buy Here</a></sub></details>||
|
||||
|Honda|Civic Hatchback 2022|All|openpilot available[<sup>1</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Honda Bosch B connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Honda&model=Civic Hatchback 2022">Buy Here</a></sub></details>|<a href="https://youtu.be/ytiOT5lcp6Q" target="_blank"><img height="18px" src="assets/icon-youtube.svg"></img></a>|
|
||||
|Honda|CR-V 2015-16|Touring Trim|openpilot|25 mph|12 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Honda Nidec connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Honda&model=CR-V 2015-16">Buy Here</a></sub></details>||
|
||||
|Honda|CR-V 2017-22|Honda Sensing|openpilot available[<sup>1</sup>](#footnotes)|0 mph|12 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Honda Bosch A connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Honda&model=CR-V 2017-22">Buy Here</a></sub></details>||
|
||||
|Honda|CR-V Hybrid 2017-19|Honda Sensing|openpilot available[<sup>1</sup>](#footnotes)|0 mph|12 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Honda Bosch A connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Honda&model=CR-V Hybrid 2017-19">Buy Here</a></sub></details>||
|
||||
|Honda|e 2020|All|openpilot available[<sup>1</sup>](#footnotes)|0 mph|3 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Honda Bosch A connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Honda&model=e 2020">Buy Here</a></sub></details>||
|
||||
|Honda|Fit 2018-20|Honda Sensing|openpilot|25 mph|12 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Honda Nidec connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Honda&model=Fit 2018-20">Buy Here</a></sub></details>||
|
||||
|Honda|Freed 2020|Honda Sensing|openpilot|25 mph|12 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Honda Nidec connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Honda&model=Freed 2020">Buy Here</a></sub></details>||
|
||||
|Honda|HR-V 2019-22|Honda Sensing|openpilot|25 mph|12 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Honda Nidec connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Honda&model=HR-V 2019-22">Buy Here</a></sub></details>||
|
||||
|Honda|HR-V 2023|All|openpilot available[<sup>1</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Honda Bosch B connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Honda&model=HR-V 2023">Buy Here</a></sub></details>||
|
||||
|Honda|Insight 2019-22|All|openpilot available[<sup>1</sup>](#footnotes)|0 mph|3 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Honda Bosch A connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Honda&model=Insight 2019-22">Buy Here</a></sub></details>||
|
||||
|Honda|Inspire 2018|All|openpilot available[<sup>1</sup>](#footnotes)|0 mph|3 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Honda Bosch A connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Honda&model=Inspire 2018">Buy Here</a></sub></details>||
|
||||
|Honda|Odyssey 2018-20|Honda Sensing|openpilot|25 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Honda Nidec connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Honda&model=Odyssey 2018-20">Buy Here</a></sub></details>||
|
||||
|Honda|Passport 2019-23|All|openpilot|25 mph|12 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Honda Nidec connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Honda&model=Passport 2019-23">Buy Here</a></sub></details>||
|
||||
|Honda|Pilot 2016-22|Honda Sensing|openpilot|25 mph|12 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Honda Nidec connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Honda&model=Pilot 2016-22">Buy Here</a></sub></details>||
|
||||
|Honda|Ridgeline 2017-23|Honda Sensing|openpilot|25 mph|12 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Honda Nidec connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Honda&model=Ridgeline 2017-23">Buy Here</a></sub></details>||
|
||||
|Hyundai|Elantra 2017-19|Smart Cruise Control (SCC)|Stock|19 mph|32 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai B connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Hyundai&model=Elantra 2017-19">Buy Here</a></sub></details>||
|
||||
|Hyundai|Elantra 2021-23|Smart Cruise Control (SCC)|openpilot available[<sup>1</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai K connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Hyundai&model=Elantra 2021-23">Buy Here</a></sub></details>|<a href="https://youtu.be/_EdYQtV52-c" target="_blank"><img height="18px" src="assets/icon-youtube.svg"></img></a>|
|
||||
|Hyundai|Elantra GT 2017-19|Smart Cruise Control (SCC)|Stock|0 mph|32 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai E connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Hyundai&model=Elantra GT 2017-19">Buy Here</a></sub></details>||
|
||||
|Hyundai|Elantra Hybrid 2021-23|Smart Cruise Control (SCC)|openpilot available[<sup>1</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai K connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Hyundai&model=Elantra Hybrid 2021-23">Buy Here</a></sub></details>|<a href="https://youtu.be/_EdYQtV52-c" target="_blank"><img height="18px" src="assets/icon-youtube.svg"></img></a>|
|
||||
|Hyundai|Genesis 2015-16|Smart Cruise Control (SCC)|Stock|19 mph|37 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai J connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Hyundai&model=Genesis 2015-16">Buy Here</a></sub></details>||
|
||||
|Hyundai|i30 2017-19|Smart Cruise Control (SCC)|Stock|0 mph|32 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai E connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Hyundai&model=i30 2017-19">Buy Here</a></sub></details>||
|
||||
|Hyundai|Ioniq 5 (Southeast Asia only) 2022-23[<sup>5</sup>](#footnotes)|All|openpilot available[<sup>1</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai Q connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Hyundai&model=Ioniq 5 (Southeast Asia only) 2022-23">Buy Here</a></sub></details>||
|
||||
|Hyundai|Ioniq 5 (with HDA II) 2022-23[<sup>5</sup>](#footnotes)|Highway Driving Assist II|openpilot available[<sup>1</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai Q connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Hyundai&model=Ioniq 5 (with HDA II) 2022-23">Buy Here</a></sub></details>||
|
||||
|Hyundai|Ioniq 5 (without HDA II) 2022-23[<sup>5</sup>](#footnotes)|Highway Driving Assist|openpilot available[<sup>1</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai K connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Hyundai&model=Ioniq 5 (without HDA II) 2022-23">Buy Here</a></sub></details>||
|
||||
|Hyundai|Ioniq Electric 2019|Smart Cruise Control (SCC)|Stock|0 mph|32 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai C connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Hyundai&model=Ioniq Electric 2019">Buy Here</a></sub></details>||
|
||||
|Hyundai|Ioniq Electric 2020|All|Stock|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai H connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Hyundai&model=Ioniq Electric 2020">Buy Here</a></sub></details>||
|
||||
|Hyundai|Ioniq Hybrid 2017-19|Smart Cruise Control (SCC)|Stock|0 mph|32 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai C connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Hyundai&model=Ioniq Hybrid 2017-19">Buy Here</a></sub></details>||
|
||||
|Hyundai|Ioniq Hybrid 2020-22|Smart Cruise Control (SCC)|Stock|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai H connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Hyundai&model=Ioniq Hybrid 2020-22">Buy Here</a></sub></details>||
|
||||
|Hyundai|Ioniq Plug-in Hybrid 2019|Smart Cruise Control (SCC)|openpilot available[<sup>1</sup>](#footnotes)|0 mph|32 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai C connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Hyundai&model=Ioniq Plug-in Hybrid 2019">Buy Here</a></sub></details>||
|
||||
|Hyundai|Ioniq Plug-in Hybrid 2020-22|All|Stock|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai H connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Hyundai&model=Ioniq Plug-in Hybrid 2020-22">Buy Here</a></sub></details>||
|
||||
|Hyundai|Kona 2020|Smart Cruise Control (SCC)|openpilot available[<sup>1</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai B connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Hyundai&model=Kona 2020">Buy Here</a></sub></details>||
|
||||
|Hyundai|Kona Electric 2018-21|Smart Cruise Control (SCC)|Stock|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai G connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Hyundai&model=Kona Electric 2018-21">Buy Here</a></sub></details>||
|
||||
|Hyundai|Kona Electric 2022|Smart Cruise Control (SCC)|Stock|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai O connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Hyundai&model=Kona Electric 2022">Buy Here</a></sub></details>||
|
||||
|Hyundai|Kona Hybrid 2020|Smart Cruise Control (SCC)|openpilot available[<sup>1</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai I connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Hyundai&model=Kona Hybrid 2020">Buy Here</a></sub></details>|<a href="https://youtu.be/0dwpAHiZgFo" target="_blank"><img height="18px" src="assets/icon-youtube.svg"></img></a>|
|
||||
|Hyundai|Palisade 2020-22|All|openpilot available[<sup>1</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai H connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Hyundai&model=Palisade 2020-22">Buy Here</a></sub></details>|<a href="https://youtu.be/TAnDqjF4fDY?t=456" target="_blank"><img height="18px" src="assets/icon-youtube.svg"></img></a>|
|
||||
|Hyundai|Santa Cruz 2022-23[<sup>5</sup>](#footnotes)|Smart Cruise Control (SCC)|Stock|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai N connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Hyundai&model=Santa Cruz 2022-23">Buy Here</a></sub></details>||
|
||||
|Hyundai|Santa Fe 2019-20|All|openpilot available[<sup>1</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai D connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Hyundai&model=Santa Fe 2019-20">Buy Here</a></sub></details>||
|
||||
|Hyundai|Santa Fe 2021-22|All|openpilot available[<sup>1</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai L connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Hyundai&model=Santa Fe 2021-22">Buy Here</a></sub></details>|<a href="https://youtu.be/VnHzSTygTS4" target="_blank"><img height="18px" src="assets/icon-youtube.svg"></img></a>|
|
||||
|Hyundai|Santa Fe Hybrid 2022-23|All|openpilot available[<sup>1</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai L connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Hyundai&model=Santa Fe Hybrid 2022-23">Buy Here</a></sub></details>||
|
||||
|Hyundai|Santa Fe Plug-in Hybrid 2022|All|openpilot available[<sup>1</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai L connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Hyundai&model=Santa Fe Plug-in Hybrid 2022">Buy Here</a></sub></details>||
|
||||
|Hyundai|Sonata 2018-19|Smart Cruise Control (SCC)|Stock|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai E connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Hyundai&model=Sonata 2018-19">Buy Here</a></sub></details>||
|
||||
|Hyundai|Sonata 2020-23|All|openpilot available[<sup>1</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai A connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Hyundai&model=Sonata 2020-23">Buy Here</a></sub></details>|<a href="https://www.youtube.com/watch?v=ix63r9kE3Fw" target="_blank"><img height="18px" src="assets/icon-youtube.svg"></img></a>|
|
||||
|Hyundai|Sonata Hybrid 2020-22|All|openpilot available[<sup>1</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai A connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Hyundai&model=Sonata Hybrid 2020-22">Buy Here</a></sub></details>||
|
||||
|Hyundai|Tucson 2021|Smart Cruise Control (SCC)|openpilot available[<sup>1</sup>](#footnotes)|19 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai L connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Hyundai&model=Tucson 2021">Buy Here</a></sub></details>||
|
||||
|Hyundai|Tucson 2022[<sup>5</sup>](#footnotes)|Smart Cruise Control (SCC)|Stock|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai N connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Hyundai&model=Tucson 2022">Buy Here</a></sub></details>||
|
||||
|Hyundai|Tucson 2023[<sup>5</sup>](#footnotes)|All|Stock|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai N connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Hyundai&model=Tucson 2023">Buy Here</a></sub></details>||
|
||||
|Hyundai|Tucson Diesel 2019|Smart Cruise Control (SCC)|openpilot available[<sup>1</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai L connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Hyundai&model=Tucson Diesel 2019">Buy Here</a></sub></details>||
|
||||
|Hyundai|Tucson Hybrid 2022-23[<sup>5</sup>](#footnotes)|All|openpilot available[<sup>1</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai N connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Hyundai&model=Tucson Hybrid 2022-23">Buy Here</a></sub></details>||
|
||||
|Hyundai|Veloster 2019-20|Smart Cruise Control (SCC)|Stock|5 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai E connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Hyundai&model=Veloster 2019-20">Buy Here</a></sub></details>||
|
||||
|Jeep|Grand Cherokee 2016-18|Adaptive Cruise Control (ACC)|Stock|0 mph|9 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 FCA connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Jeep&model=Grand Cherokee 2016-18">Buy Here</a></sub></details>|<a href="https://www.youtube.com/watch?v=eLR9o2JkuRk" target="_blank"><img height="18px" src="assets/icon-youtube.svg"></img></a>|
|
||||
|Jeep|Grand Cherokee 2019-21|Adaptive Cruise Control (ACC)|Stock|0 mph|39 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 FCA connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Jeep&model=Grand Cherokee 2019-21">Buy Here</a></sub></details>|<a href="https://www.youtube.com/watch?v=jBe4lWnRSu4" target="_blank"><img height="18px" src="assets/icon-youtube.svg"></img></a>|
|
||||
|Kia|Ceed 2019|Smart Cruise Control (SCC)|Stock|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai E connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Kia&model=Ceed 2019">Buy Here</a></sub></details>||
|
||||
|Kia|EV6 (Southeast Asia only) 2022-23[<sup>5</sup>](#footnotes)|All|openpilot available[<sup>1</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai P connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Kia&model=EV6 (Southeast Asia only) 2022-23">Buy Here</a></sub></details>||
|
||||
|Kia|EV6 (with HDA II) 2022-23[<sup>5</sup>](#footnotes)|Highway Driving Assist II|openpilot available[<sup>1</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai P connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Kia&model=EV6 (with HDA II) 2022-23">Buy Here</a></sub></details>||
|
||||
|Kia|EV6 (without HDA II) 2022-23[<sup>5</sup>](#footnotes)|Highway Driving Assist|openpilot available[<sup>1</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai L connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Kia&model=EV6 (without HDA II) 2022-23">Buy Here</a></sub></details>||
|
||||
|Kia|Forte 2019-21|Smart Cruise Control (SCC)|openpilot available[<sup>1</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai G connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Kia&model=Forte 2019-21">Buy Here</a></sub></details>||
|
||||
|Kia|Forte 2023|Smart Cruise Control (SCC)|openpilot available[<sup>1</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai E connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Kia&model=Forte 2023">Buy Here</a></sub></details>||
|
||||
|Kia|K5 2021-22|Smart Cruise Control (SCC)|openpilot available[<sup>1</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai A connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Kia&model=K5 2021-22">Buy Here</a></sub></details>||
|
||||
|Kia|K5 Hybrid 2020|Smart Cruise Control (SCC)|openpilot available[<sup>1</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai A connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Kia&model=K5 Hybrid 2020">Buy Here</a></sub></details>||
|
||||
|Kia|Niro EV 2019|All|openpilot available[<sup>1</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai H connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Kia&model=Niro EV 2019">Buy Here</a></sub></details>|<a href="https://www.youtube.com/watch?v=lT7zcG6ZpGo" target="_blank"><img height="18px" src="assets/icon-youtube.svg"></img></a>|
|
||||
|Kia|Niro EV 2020|All|openpilot available[<sup>1</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai F connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Kia&model=Niro EV 2020">Buy Here</a></sub></details>|<a href="https://www.youtube.com/watch?v=lT7zcG6ZpGo" target="_blank"><img height="18px" src="assets/icon-youtube.svg"></img></a>|
|
||||
|Kia|Niro EV 2021|All|openpilot available[<sup>1</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai C connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Kia&model=Niro EV 2021">Buy Here</a></sub></details>|<a href="https://www.youtube.com/watch?v=lT7zcG6ZpGo" target="_blank"><img height="18px" src="assets/icon-youtube.svg"></img></a>|
|
||||
|Kia|Niro EV 2022|All|openpilot available[<sup>1</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai H connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Kia&model=Niro EV 2022">Buy Here</a></sub></details>|<a href="https://www.youtube.com/watch?v=lT7zcG6ZpGo" target="_blank"><img height="18px" src="assets/icon-youtube.svg"></img></a>|
|
||||
|Kia|Niro EV 2023[<sup>5</sup>](#footnotes)|All|openpilot available[<sup>1</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai A connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Kia&model=Niro EV 2023">Buy Here</a></sub></details>||
|
||||
|Kia|Niro Hybrid 2021-22|Smart Cruise Control (SCC)|openpilot available[<sup>1</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai F connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Kia&model=Niro Hybrid 2021-22">Buy Here</a></sub></details>||
|
||||
|Kia|Niro Hybrid 2023[<sup>5</sup>](#footnotes)|Smart Cruise Control (SCC)|openpilot available[<sup>1</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai A connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Kia&model=Niro Hybrid 2023">Buy Here</a></sub></details>||
|
||||
|Kia|Niro Plug-in Hybrid 2018-19|All|openpilot available[<sup>1</sup>](#footnotes)|10 mph|32 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai C connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Kia&model=Niro Plug-in Hybrid 2018-19">Buy Here</a></sub></details>||
|
||||
|Kia|Niro Plug-in Hybrid 2020|All|openpilot available[<sup>1</sup>](#footnotes)|0 mph|32 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai D connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Kia&model=Niro Plug-in Hybrid 2020">Buy Here</a></sub></details>||
|
||||
|Kia|Optima 2017|Advanced Smart Cruise Control|Stock|0 mph|32 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai B connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Kia&model=Optima 2017">Buy Here</a></sub></details>||
|
||||
|Kia|Optima 2019-20|Smart Cruise Control (SCC)|Stock|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai G connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Kia&model=Optima 2019-20">Buy Here</a></sub></details>||
|
||||
|Kia|Seltos 2021|Smart Cruise Control (SCC)|openpilot available[<sup>1</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai A connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Kia&model=Seltos 2021">Buy Here</a></sub></details>||
|
||||
|Kia|Sorento 2018|Advanced Smart Cruise Control|Stock|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai C connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Kia&model=Sorento 2018">Buy Here</a></sub></details>|<a href="https://www.youtube.com/watch?v=Fkh3s6WHJz8" target="_blank"><img height="18px" src="assets/icon-youtube.svg"></img></a>|
|
||||
|Kia|Sorento 2019|Smart Cruise Control (SCC)|Stock|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai E connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Kia&model=Sorento 2019">Buy Here</a></sub></details>|<a href="https://www.youtube.com/watch?v=Fkh3s6WHJz8" target="_blank"><img height="18px" src="assets/icon-youtube.svg"></img></a>|
|
||||
|Kia|Sorento 2021-23[<sup>5</sup>](#footnotes)|Smart Cruise Control (SCC)|Stock|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai K connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Kia&model=Sorento 2021-23">Buy Here</a></sub></details>||
|
||||
|Kia|Sorento Plug-in Hybrid 2022-23[<sup>5</sup>](#footnotes)|Smart Cruise Control (SCC)|Stock|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai A connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Kia&model=Sorento Plug-in Hybrid 2022-23">Buy Here</a></sub></details>||
|
||||
|Kia|Sportage 2023[<sup>5</sup>](#footnotes)|Smart Cruise Control (SCC)|Stock|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai N connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Kia&model=Sportage 2023">Buy Here</a></sub></details>||
|
||||
|Kia|Sportage Hybrid 2023[<sup>5</sup>](#footnotes)|Smart Cruise Control (SCC)|openpilot available[<sup>1</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai N connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Kia&model=Sportage Hybrid 2023">Buy Here</a></sub></details>||
|
||||
|Kia|Stinger 2018-20|Smart Cruise Control (SCC)|openpilot available[<sup>1</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai C connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Kia&model=Stinger 2018-20">Buy Here</a></sub></details>|<a href="https://www.youtube.com/watch?v=MJ94qoofYw0" target="_blank"><img height="18px" src="assets/icon-youtube.svg"></img></a>|
|
||||
|Kia|Stinger 2022|All|openpilot available[<sup>1</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai K connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Kia&model=Stinger 2022">Buy Here</a></sub></details>||
|
||||
|Kia|Telluride 2020-22|All|openpilot available[<sup>1</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Hyundai H connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Kia&model=Telluride 2020-22">Buy Here</a></sub></details>||
|
||||
|Lexus|CT Hybrid 2017-18|Lexus Safety System+|openpilot available[<sup>2</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Toyota connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Lexus&model=CT Hybrid 2017-18">Buy Here</a></sub></details>||
|
||||
|Lexus|ES 2017-18|All|openpilot available[<sup>2</sup>](#footnotes)|19 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Toyota connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Lexus&model=ES 2017-18">Buy Here</a></sub></details>||
|
||||
|Lexus|ES 2019-22|All|openpilot|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Toyota connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Lexus&model=ES 2019-22">Buy Here</a></sub></details>||
|
||||
|Lexus|ES Hybrid 2017-18|All|openpilot available[<sup>2</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Toyota connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Lexus&model=ES Hybrid 2017-18">Buy Here</a></sub></details>||
|
||||
|Lexus|ES Hybrid 2019-23|All|openpilot|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Toyota connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Lexus&model=ES Hybrid 2019-23">Buy Here</a></sub></details>|<a href="https://youtu.be/BZ29osRVJeg?t=12" target="_blank"><img height="18px" src="assets/icon-youtube.svg"></img></a>|
|
||||
|Lexus|IS 2017-19|All|Stock|19 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Toyota connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Lexus&model=IS 2017-19">Buy Here</a></sub></details>||
|
||||
|Lexus|NX 2018-19|All|openpilot available[<sup>2</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Toyota connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Lexus&model=NX 2018-19">Buy Here</a></sub></details>||
|
||||
|Lexus|NX 2020-21|All|openpilot|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Toyota connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Lexus&model=NX 2020-21">Buy Here</a></sub></details>||
|
||||
|Lexus|NX Hybrid 2018-19|All|openpilot available[<sup>2</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Toyota connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Lexus&model=NX Hybrid 2018-19">Buy Here</a></sub></details>||
|
||||
|Lexus|NX Hybrid 2020-21|All|openpilot|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Toyota connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Lexus&model=NX Hybrid 2020-21">Buy Here</a></sub></details>||
|
||||
|Lexus|RC 2018-20|All|Stock|19 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Toyota connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Lexus&model=RC 2018-20">Buy Here</a></sub></details>||
|
||||
|Lexus|RX 2016|Lexus Safety System+|openpilot available[<sup>2</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Toyota connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Lexus&model=RX 2016">Buy Here</a></sub></details>||
|
||||
|Lexus|RX 2017-19|All|openpilot available[<sup>2</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Toyota connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Lexus&model=RX 2017-19">Buy Here</a></sub></details>||
|
||||
|Lexus|RX 2020-22|All|openpilot|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Toyota connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Lexus&model=RX 2020-22">Buy Here</a></sub></details>||
|
||||
|Lexus|RX Hybrid 2016|Lexus Safety System+|openpilot available[<sup>2</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Toyota connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Lexus&model=RX Hybrid 2016">Buy Here</a></sub></details>||
|
||||
|Lexus|RX Hybrid 2017-19|All|openpilot available[<sup>2</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Toyota connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Lexus&model=RX Hybrid 2017-19">Buy Here</a></sub></details>||
|
||||
|Lexus|RX Hybrid 2020-21|All|openpilot|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Toyota connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Lexus&model=RX Hybrid 2020-21">Buy Here</a></sub></details>||
|
||||
|Lexus|UX Hybrid 2019-22|All|openpilot|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Toyota connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Lexus&model=UX Hybrid 2019-22">Buy Here</a></sub></details>||
|
||||
|Lincoln|Aviator 2020-21|Co-Pilot360 Plus|openpilot available[<sup>1</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Ford Q3 connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Lincoln&model=Aviator 2020-21">Buy Here</a></sub></details>||
|
||||
|MAN|eTGE 2020-23|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[<sup>1,10</sup>](#footnotes)|0 mph|31 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 J533 connector<br>- 1 USB-C coupler<br>- 1 angled mount (8 degrees)<br>- 1 comma three<br>- 1 harness box<br>- 1 long OBD-C cable<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=MAN&model=eTGE 2020-23">Buy Here</a></sub></details>|<a href="https://youtu.be/4100gLeabmo" target="_blank"><img height="18px" src="assets/icon-youtube.svg"></img></a>|
|
||||
|MAN|TGE 2017-23|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[<sup>1,10</sup>](#footnotes)|0 mph|31 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 J533 connector<br>- 1 USB-C coupler<br>- 1 angled mount (8 degrees)<br>- 1 comma three<br>- 1 harness box<br>- 1 long OBD-C cable<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=MAN&model=TGE 2017-23">Buy Here</a></sub></details>|<a href="https://youtu.be/4100gLeabmo" target="_blank"><img height="18px" src="assets/icon-youtube.svg"></img></a>|
|
||||
|Mazda|CX-5 2022-23|All|Stock|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Mazda connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Mazda&model=CX-5 2022-23">Buy Here</a></sub></details>||
|
||||
|Mazda|CX-9 2021-23|All|Stock|0 mph|28 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Mazda connector<br>- 1 RJ45 cable (7 ft)<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Mazda&model=CX-9 2021-23">Buy Here</a></sub></details>|<a href="https://youtu.be/dA3duO4a0O4" target="_blank"><img height="18px" src="assets/icon-youtube.svg"></img></a>|
|
||||
|Nissan|Altima 2019-20|ProPILOT Assist|Stock|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Nissan B connector<br>- 1 RJ45 cable (7 ft)<br>- 1 USB-C coupler<br>- 1 comma three<br>- 1 harness box<br>- 1 long OBD-C cable<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Nissan&model=Altima 2019-20">Buy Here</a></sub></details>||
|
||||
|Nissan|Leaf 2018-23|ProPILOT Assist|Stock|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Nissan A connector<br>- 1 RJ45 cable (7 ft)<br>- 1 USB-C coupler<br>- 1 comma three<br>- 1 harness box<br>- 1 long OBD-C cable<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Nissan&model=Leaf 2018-23">Buy Here</a></sub></details>|<a href="https://youtu.be/vaMbtAh_0cY" target="_blank"><img height="18px" src="assets/icon-youtube.svg"></img></a>|
|
||||
|Nissan|Rogue 2018-20|ProPILOT Assist|Stock|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Nissan A connector<br>- 1 RJ45 cable (7 ft)<br>- 1 USB-C coupler<br>- 1 comma three<br>- 1 harness box<br>- 1 long OBD-C cable<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Nissan&model=Rogue 2018-20">Buy Here</a></sub></details>||
|
||||
|Nissan|X-Trail 2017|ProPILOT Assist|Stock|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 Nissan A connector<br>- 1 RJ45 cable (7 ft)<br>- 1 USB-C coupler<br>- 1 comma three<br>- 1 harness box<br>- 1 long OBD-C cable<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Nissan&model=X-Trail 2017">Buy Here</a></sub></details>||
|
||||
|Ram|1500 2019-23|Adaptive Cruise Control (ACC)|Stock|0 mph|32 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Ram connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Ram&model=1500 2019-23">Buy Here</a></sub></details>||
|
||||
|SEAT|Ateca 2018|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[<sup>1,10</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 J533 connector<br>- 1 USB-C coupler<br>- 1 comma three<br>- 1 harness box<br>- 1 long OBD-C cable<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=SEAT&model=Ateca 2018">Buy Here</a></sub></details>||
|
||||
|SEAT|Leon 2014-20|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[<sup>1,10</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 J533 connector<br>- 1 USB-C coupler<br>- 1 comma three<br>- 1 harness box<br>- 1 long OBD-C cable<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=SEAT&model=Leon 2014-20">Buy Here</a></sub></details>||
|
||||
|Subaru|Ascent 2019-21|All|Stock|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Subaru A connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Subaru&model=Ascent 2019-21">Buy Here</a></sub></details>||
|
||||
|Subaru|Crosstrek 2018-19|EyeSight Driver Assistance|Stock|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Subaru A connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Subaru&model=Crosstrek 2018-19">Buy Here</a></sub></details>|<a href="https://youtu.be/Agww7oE1k-s?t=26" target="_blank"><img height="18px" src="assets/icon-youtube.svg"></img></a>|
|
||||
|Subaru|Crosstrek 2020-23|EyeSight Driver Assistance|Stock|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Subaru A connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Subaru&model=Crosstrek 2020-23">Buy Here</a></sub></details>||
|
||||
|Subaru|Forester 2019-21|All|Stock|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Subaru A connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Subaru&model=Forester 2019-21">Buy Here</a></sub></details>||
|
||||
|Subaru|Impreza 2017-19|EyeSight Driver Assistance|Stock|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Subaru A connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Subaru&model=Impreza 2017-19">Buy Here</a></sub></details>||
|
||||
|Subaru|Impreza 2020-22|EyeSight Driver Assistance|Stock|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Subaru A connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Subaru&model=Impreza 2020-22">Buy Here</a></sub></details>||
|
||||
|Subaru|Legacy 2020-22|All|Stock|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Subaru B connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Subaru&model=Legacy 2020-22">Buy Here</a></sub></details>||
|
||||
|Subaru|Outback 2020-22|All|Stock|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Subaru B connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Subaru&model=Outback 2020-22">Buy Here</a></sub></details>||
|
||||
|Subaru|XV 2018-19|EyeSight Driver Assistance|Stock|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Subaru A connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Subaru&model=XV 2018-19">Buy Here</a></sub></details>|<a href="https://youtu.be/Agww7oE1k-s?t=26" target="_blank"><img height="18px" src="assets/icon-youtube.svg"></img></a>|
|
||||
|Subaru|XV 2020-21|EyeSight Driver Assistance|Stock|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Subaru A connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Subaru&model=XV 2020-21">Buy Here</a></sub></details>||
|
||||
|Škoda|Fabia 2022-23[<sup>9</sup>](#footnotes)|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[<sup>1,10</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 J533 connector<br>- 1 USB-C coupler<br>- 1 comma three<br>- 1 harness box<br>- 1 long OBD-C cable<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Škoda&model=Fabia 2022-23">Buy Here</a></sub></details>[<sup>11</sup>](#footnotes)||
|
||||
|Škoda|Kamiq 2021[<sup>7,9</sup>](#footnotes)|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[<sup>1,10</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 J533 connector<br>- 1 USB-C coupler<br>- 1 comma three<br>- 1 harness box<br>- 1 long OBD-C cable<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Škoda&model=Kamiq 2021">Buy Here</a></sub></details>[<sup>11</sup>](#footnotes)||
|
||||
|Škoda|Karoq 2019-21[<sup>9</sup>](#footnotes)|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[<sup>1,10</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 J533 connector<br>- 1 USB-C coupler<br>- 1 comma three<br>- 1 harness box<br>- 1 long OBD-C cable<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Škoda&model=Karoq 2019-21">Buy Here</a></sub></details>||
|
||||
|Škoda|Kodiaq 2017-23[<sup>9</sup>](#footnotes)|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[<sup>1,10</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 J533 connector<br>- 1 USB-C coupler<br>- 1 comma three<br>- 1 harness box<br>- 1 long OBD-C cable<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Škoda&model=Kodiaq 2017-23">Buy Here</a></sub></details>||
|
||||
|Škoda|Octavia 2015, 2018-19[<sup>9</sup>](#footnotes)|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[<sup>1,10</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 J533 connector<br>- 1 USB-C coupler<br>- 1 comma three<br>- 1 harness box<br>- 1 long OBD-C cable<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Škoda&model=Octavia 2015, 2018-19">Buy Here</a></sub></details>||
|
||||
|Škoda|Octavia RS 2016[<sup>9</sup>](#footnotes)|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[<sup>1,10</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 J533 connector<br>- 1 USB-C coupler<br>- 1 comma three<br>- 1 harness box<br>- 1 long OBD-C cable<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Škoda&model=Octavia RS 2016">Buy Here</a></sub></details>||
|
||||
|Škoda|Scala 2020[<sup>9</sup>](#footnotes)|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[<sup>1,10</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 J533 connector<br>- 1 USB-C coupler<br>- 1 comma three<br>- 1 harness box<br>- 1 long OBD-C cable<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Škoda&model=Scala 2020">Buy Here</a></sub></details>[<sup>11</sup>](#footnotes)||
|
||||
|Škoda|Superb 2015-22[<sup>9</sup>](#footnotes)|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[<sup>1,10</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 J533 connector<br>- 1 USB-C coupler<br>- 1 comma three<br>- 1 harness box<br>- 1 long OBD-C cable<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Škoda&model=Superb 2015-22">Buy Here</a></sub></details>||
|
||||
|Toyota|Alphard 2019-20|All|openpilot|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Toyota connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Toyota&model=Alphard 2019-20">Buy Here</a></sub></details>||
|
||||
|Toyota|Alphard Hybrid 2021|All|openpilot|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Toyota connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Toyota&model=Alphard Hybrid 2021">Buy Here</a></sub></details>||
|
||||
|Toyota|Avalon 2016|Toyota Safety Sense P|openpilot available[<sup>2</sup>](#footnotes)|19 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Toyota connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Toyota&model=Avalon 2016">Buy Here</a></sub></details>||
|
||||
|Toyota|Avalon 2017-18|All|openpilot available[<sup>2</sup>](#footnotes)|19 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Toyota connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Toyota&model=Avalon 2017-18">Buy Here</a></sub></details>||
|
||||
|Toyota|Avalon 2019-21|All|openpilot available[<sup>2</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Toyota connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Toyota&model=Avalon 2019-21">Buy Here</a></sub></details>||
|
||||
|Toyota|Avalon 2022|All|openpilot|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Toyota connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Toyota&model=Avalon 2022">Buy Here</a></sub></details>||
|
||||
|Toyota|Avalon Hybrid 2019-21|All|openpilot available[<sup>2</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Toyota connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Toyota&model=Avalon Hybrid 2019-21">Buy Here</a></sub></details>||
|
||||
|Toyota|Avalon Hybrid 2022|All|openpilot|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Toyota connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Toyota&model=Avalon Hybrid 2022">Buy Here</a></sub></details>||
|
||||
|Toyota|C-HR 2017-20|All|Stock|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Toyota connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Toyota&model=C-HR 2017-20">Buy Here</a></sub></details>||
|
||||
|Toyota|C-HR 2021|All|Stock|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Toyota connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Toyota&model=C-HR 2021">Buy Here</a></sub></details>||
|
||||
|Toyota|C-HR Hybrid 2017-20|All|Stock|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Toyota connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Toyota&model=C-HR Hybrid 2017-20">Buy Here</a></sub></details>||
|
||||
|Toyota|C-HR Hybrid 2021-22|All|Stock|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Toyota connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Toyota&model=C-HR Hybrid 2021-22">Buy Here</a></sub></details>||
|
||||
|Toyota|Camry 2018-20|All|Stock|0 mph[<sup>6</sup>](#footnotes)|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Toyota connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Toyota&model=Camry 2018-20">Buy Here</a></sub></details>|<a href="https://www.youtube.com/watch?v=fkcjviZY9CM" target="_blank"><img height="18px" src="assets/icon-youtube.svg"></img></a>|
|
||||
|Toyota|Camry 2021-23|All|openpilot|0 mph[<sup>6</sup>](#footnotes)|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Toyota connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Toyota&model=Camry 2021-23">Buy Here</a></sub></details>||
|
||||
|Toyota|Camry Hybrid 2018-20|All|Stock|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Toyota connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Toyota&model=Camry Hybrid 2018-20">Buy Here</a></sub></details>|<a href="https://www.youtube.com/watch?v=Q2DYY0AWKgk" target="_blank"><img height="18px" src="assets/icon-youtube.svg"></img></a>|
|
||||
|Toyota|Camry Hybrid 2021-23|All|openpilot|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Toyota connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Toyota&model=Camry Hybrid 2021-23">Buy Here</a></sub></details>||
|
||||
|Toyota|Corolla 2017-19|All|openpilot available[<sup>2</sup>](#footnotes)|19 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Toyota connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Toyota&model=Corolla 2017-19">Buy Here</a></sub></details>||
|
||||
|Toyota|Corolla 2020-22|All|openpilot|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Toyota connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Toyota&model=Corolla 2020-22">Buy Here</a></sub></details>|<a href="https://www.youtube.com/watch?v=_66pXk0CBYA" target="_blank"><img height="18px" src="assets/icon-youtube.svg"></img></a>|
|
||||
|Toyota|Corolla Cross (Non-US only) 2020-23|All|openpilot|17 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Toyota connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Toyota&model=Corolla Cross (Non-US only) 2020-23">Buy Here</a></sub></details>||
|
||||
|Toyota|Corolla Cross Hybrid (Non-US only) 2020-22|All|openpilot|17 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Toyota connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Toyota&model=Corolla Cross Hybrid (Non-US only) 2020-22">Buy Here</a></sub></details>||
|
||||
|Toyota|Corolla Hatchback 2019-22|All|openpilot|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Toyota connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Toyota&model=Corolla Hatchback 2019-22">Buy Here</a></sub></details>|<a href="https://www.youtube.com/watch?v=_66pXk0CBYA" target="_blank"><img height="18px" src="assets/icon-youtube.svg"></img></a>|
|
||||
|Toyota|Corolla Hybrid 2020-22|All|openpilot|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Toyota connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Toyota&model=Corolla Hybrid 2020-22">Buy Here</a></sub></details>||
|
||||
|Toyota|Corolla Hybrid (Non-US only) 2020-23|All|openpilot|17 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Toyota connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Toyota&model=Corolla Hybrid (Non-US only) 2020-23">Buy Here</a></sub></details>||
|
||||
|Toyota|Highlander 2017-19|All|openpilot available[<sup>2</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Toyota connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Toyota&model=Highlander 2017-19">Buy Here</a></sub></details>|<a href="https://www.youtube.com/watch?v=0wS0wXSLzoo" target="_blank"><img height="18px" src="assets/icon-youtube.svg"></img></a>|
|
||||
|Toyota|Highlander 2020-23|All|openpilot|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Toyota connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Toyota&model=Highlander 2020-23">Buy Here</a></sub></details>||
|
||||
|Toyota|Highlander Hybrid 2017-19|All|openpilot available[<sup>2</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Toyota connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Toyota&model=Highlander Hybrid 2017-19">Buy Here</a></sub></details>||
|
||||
|Toyota|Highlander Hybrid 2020-23|All|openpilot|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Toyota connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Toyota&model=Highlander Hybrid 2020-23">Buy Here</a></sub></details>||
|
||||
|Toyota|Mirai 2021|All|openpilot|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Toyota connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Toyota&model=Mirai 2021">Buy Here</a></sub></details>||
|
||||
|Toyota|Prius 2016|Toyota Safety Sense P|openpilot available[<sup>2</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Toyota connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Toyota&model=Prius 2016">Buy Here</a></sub></details>|<a href="https://www.youtube.com/watch?v=8zopPJI8XQ0" target="_blank"><img height="18px" src="assets/icon-youtube.svg"></img></a>|
|
||||
|Toyota|Prius 2017-20|All|openpilot available[<sup>2</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Toyota connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Toyota&model=Prius 2017-20">Buy Here</a></sub></details>|<a href="https://www.youtube.com/watch?v=8zopPJI8XQ0" target="_blank"><img height="18px" src="assets/icon-youtube.svg"></img></a>|
|
||||
|Toyota|Prius 2021-22|All|openpilot|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Toyota connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Toyota&model=Prius 2021-22">Buy Here</a></sub></details>|<a href="https://www.youtube.com/watch?v=J58TvCpUd4U" target="_blank"><img height="18px" src="assets/icon-youtube.svg"></img></a>|
|
||||
|Toyota|Prius Prime 2017-20|All|openpilot available[<sup>2</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Toyota connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Toyota&model=Prius Prime 2017-20">Buy Here</a></sub></details>|<a href="https://www.youtube.com/watch?v=8zopPJI8XQ0" target="_blank"><img height="18px" src="assets/icon-youtube.svg"></img></a>|
|
||||
|Toyota|Prius Prime 2021-22|All|openpilot|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Toyota connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Toyota&model=Prius Prime 2021-22">Buy Here</a></sub></details>|<a href="https://www.youtube.com/watch?v=J58TvCpUd4U" target="_blank"><img height="18px" src="assets/icon-youtube.svg"></img></a>|
|
||||
|Toyota|Prius v 2017|Toyota Safety Sense P|openpilot available[<sup>2</sup>](#footnotes)|19 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Toyota connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Toyota&model=Prius v 2017">Buy Here</a></sub></details>||
|
||||
|Toyota|RAV4 2016|Toyota Safety Sense P|openpilot available[<sup>2</sup>](#footnotes)|19 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Toyota connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Toyota&model=RAV4 2016">Buy Here</a></sub></details>||
|
||||
|Toyota|RAV4 2017-18|All|openpilot available[<sup>2</sup>](#footnotes)|19 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Toyota connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Toyota&model=RAV4 2017-18">Buy Here</a></sub></details>||
|
||||
|Toyota|RAV4 2019-21|All|openpilot|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Toyota connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Toyota&model=RAV4 2019-21">Buy Here</a></sub></details>|<a href="https://www.youtube.com/watch?v=wJxjDd42gGA" target="_blank"><img height="18px" src="assets/icon-youtube.svg"></img></a>|
|
||||
|Toyota|RAV4 2022|All|Stock|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Toyota connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Toyota&model=RAV4 2022">Buy Here</a></sub></details>||
|
||||
|Toyota|RAV4 Hybrid 2016|Toyota Safety Sense P|openpilot available[<sup>2</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Toyota connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Toyota&model=RAV4 Hybrid 2016">Buy Here</a></sub></details>|<a href="https://youtu.be/LhT5VzJVfNI?t=26" target="_blank"><img height="18px" src="assets/icon-youtube.svg"></img></a>|
|
||||
|Toyota|RAV4 Hybrid 2017-18|All|openpilot available[<sup>2</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Toyota connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Toyota&model=RAV4 Hybrid 2017-18">Buy Here</a></sub></details>|<a href="https://youtu.be/LhT5VzJVfNI?t=26" target="_blank"><img height="18px" src="assets/icon-youtube.svg"></img></a>|
|
||||
|Toyota|RAV4 Hybrid 2019-21|All|openpilot|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Toyota connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Toyota&model=RAV4 Hybrid 2019-21">Buy Here</a></sub></details>||
|
||||
|Toyota|RAV4 Hybrid 2022|All|Stock|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Toyota connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Toyota&model=RAV4 Hybrid 2022">Buy Here</a></sub></details>|<a href="https://youtu.be/U0nH9cnrFB0" target="_blank"><img height="18px" src="assets/icon-youtube.svg"></img></a>|
|
||||
|Toyota|Sienna 2018-20|All|openpilot available[<sup>2</sup>](#footnotes)|19 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 RJ45 cable (7 ft)<br>- 1 Toyota connector<br>- 1 comma power v2<br>- 1 comma three<br>- 1 harness box<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Toyota&model=Sienna 2018-20">Buy Here</a></sub></details>|<a href="https://www.youtube.com/watch?v=q1UPOo4Sh68" target="_blank"><img height="18px" src="assets/icon-youtube.svg"></img></a>|
|
||||
|Volkswagen|Arteon 2018-22|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[<sup>1,10</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 J533 connector<br>- 1 USB-C coupler<br>- 1 comma three<br>- 1 harness box<br>- 1 long OBD-C cable<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Volkswagen&model=Arteon 2018-22">Buy Here</a></sub></details>|<a href="https://youtu.be/FAomFKPFlDA" target="_blank"><img height="18px" src="assets/icon-youtube.svg"></img></a>|
|
||||
|Volkswagen|Arteon eHybrid 2020-22|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[<sup>1,10</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 J533 connector<br>- 1 USB-C coupler<br>- 1 comma three<br>- 1 harness box<br>- 1 long OBD-C cable<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Volkswagen&model=Arteon eHybrid 2020-22">Buy Here</a></sub></details>|<a href="https://youtu.be/FAomFKPFlDA" target="_blank"><img height="18px" src="assets/icon-youtube.svg"></img></a>|
|
||||
|Volkswagen|Arteon R 2020-22|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[<sup>1,10</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 J533 connector<br>- 1 USB-C coupler<br>- 1 comma three<br>- 1 harness box<br>- 1 long OBD-C cable<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Volkswagen&model=Arteon R 2020-22">Buy Here</a></sub></details>|<a href="https://youtu.be/FAomFKPFlDA" target="_blank"><img height="18px" src="assets/icon-youtube.svg"></img></a>|
|
||||
|Volkswagen|Atlas 2018-23|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[<sup>1,10</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 J533 connector<br>- 1 USB-C coupler<br>- 1 comma three<br>- 1 harness box<br>- 1 long OBD-C cable<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Volkswagen&model=Atlas 2018-23">Buy Here</a></sub></details>||
|
||||
|Volkswagen|Atlas Cross Sport 2021-22|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[<sup>1,10</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 J533 connector<br>- 1 USB-C coupler<br>- 1 comma three<br>- 1 harness box<br>- 1 long OBD-C cable<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Volkswagen&model=Atlas Cross Sport 2021-22">Buy Here</a></sub></details>||
|
||||
|Volkswagen|California 2021|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[<sup>1,10</sup>](#footnotes)|0 mph|31 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 J533 connector<br>- 1 USB-C coupler<br>- 1 angled mount (8 degrees)<br>- 1 comma three<br>- 1 harness box<br>- 1 long OBD-C cable<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Volkswagen&model=California 2021">Buy Here</a></sub></details>||
|
||||
|Volkswagen|Caravelle 2020|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[<sup>1,10</sup>](#footnotes)|0 mph|31 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 J533 connector<br>- 1 USB-C coupler<br>- 1 angled mount (8 degrees)<br>- 1 comma three<br>- 1 harness box<br>- 1 long OBD-C cable<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Volkswagen&model=Caravelle 2020">Buy Here</a></sub></details>||
|
||||
|Volkswagen|CC 2018-22|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[<sup>1,10</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 J533 connector<br>- 1 USB-C coupler<br>- 1 comma three<br>- 1 harness box<br>- 1 long OBD-C cable<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Volkswagen&model=CC 2018-22">Buy Here</a></sub></details>|<a href="https://youtu.be/FAomFKPFlDA" target="_blank"><img height="18px" src="assets/icon-youtube.svg"></img></a>|
|
||||
|Volkswagen|Crafter 2017-23|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[<sup>1,10</sup>](#footnotes)|0 mph|31 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 J533 connector<br>- 1 USB-C coupler<br>- 1 angled mount (8 degrees)<br>- 1 comma three<br>- 1 harness box<br>- 1 long OBD-C cable<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Volkswagen&model=Crafter 2017-23">Buy Here</a></sub></details>|<a href="https://youtu.be/4100gLeabmo" target="_blank"><img height="18px" src="assets/icon-youtube.svg"></img></a>|
|
||||
|Volkswagen|e-Crafter 2018-23|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[<sup>1,10</sup>](#footnotes)|0 mph|31 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 J533 connector<br>- 1 USB-C coupler<br>- 1 angled mount (8 degrees)<br>- 1 comma three<br>- 1 harness box<br>- 1 long OBD-C cable<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Volkswagen&model=e-Crafter 2018-23">Buy Here</a></sub></details>|<a href="https://youtu.be/4100gLeabmo" target="_blank"><img height="18px" src="assets/icon-youtube.svg"></img></a>|
|
||||
|Volkswagen|e-Golf 2014-20|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[<sup>1,10</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 J533 connector<br>- 1 USB-C coupler<br>- 1 comma three<br>- 1 harness box<br>- 1 long OBD-C cable<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Volkswagen&model=e-Golf 2014-20">Buy Here</a></sub></details>||
|
||||
|Volkswagen|Golf 2015-20|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[<sup>1,10</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 J533 connector<br>- 1 USB-C coupler<br>- 1 comma three<br>- 1 harness box<br>- 1 long OBD-C cable<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Volkswagen&model=Golf 2015-20">Buy Here</a></sub></details>||
|
||||
|Volkswagen|Golf Alltrack 2015-19|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[<sup>1,10</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 J533 connector<br>- 1 USB-C coupler<br>- 1 comma three<br>- 1 harness box<br>- 1 long OBD-C cable<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Volkswagen&model=Golf Alltrack 2015-19">Buy Here</a></sub></details>||
|
||||
|Volkswagen|Golf GTD 2015-20|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[<sup>1,10</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 J533 connector<br>- 1 USB-C coupler<br>- 1 comma three<br>- 1 harness box<br>- 1 long OBD-C cable<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Volkswagen&model=Golf GTD 2015-20">Buy Here</a></sub></details>||
|
||||
|Volkswagen|Golf GTE 2015-20|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[<sup>1,10</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 J533 connector<br>- 1 USB-C coupler<br>- 1 comma three<br>- 1 harness box<br>- 1 long OBD-C cable<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Volkswagen&model=Golf GTE 2015-20">Buy Here</a></sub></details>||
|
||||
|Volkswagen|Golf GTI 2015-21|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[<sup>1,10</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 J533 connector<br>- 1 USB-C coupler<br>- 1 comma three<br>- 1 harness box<br>- 1 long OBD-C cable<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Volkswagen&model=Golf GTI 2015-21">Buy Here</a></sub></details>||
|
||||
|Volkswagen|Golf R 2015-19|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[<sup>1,10</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 J533 connector<br>- 1 USB-C coupler<br>- 1 comma three<br>- 1 harness box<br>- 1 long OBD-C cable<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Volkswagen&model=Golf R 2015-19">Buy Here</a></sub></details>||
|
||||
|Volkswagen|Golf SportsVan 2015-20|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[<sup>1,10</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 J533 connector<br>- 1 USB-C coupler<br>- 1 comma three<br>- 1 harness box<br>- 1 long OBD-C cable<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Volkswagen&model=Golf SportsVan 2015-20">Buy Here</a></sub></details>||
|
||||
|Volkswagen|Grand California 2019-23|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[<sup>1,10</sup>](#footnotes)|0 mph|31 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 J533 connector<br>- 1 USB-C coupler<br>- 1 angled mount (8 degrees)<br>- 1 comma three<br>- 1 harness box<br>- 1 long OBD-C cable<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Volkswagen&model=Grand California 2019-23">Buy Here</a></sub></details>|<a href="https://youtu.be/4100gLeabmo" target="_blank"><img height="18px" src="assets/icon-youtube.svg"></img></a>|
|
||||
|Volkswagen|Jetta 2018-22|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[<sup>1,10</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 J533 connector<br>- 1 USB-C coupler<br>- 1 comma three<br>- 1 harness box<br>- 1 long OBD-C cable<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Volkswagen&model=Jetta 2018-22">Buy Here</a></sub></details>||
|
||||
|Volkswagen|Jetta GLI 2021-22|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[<sup>1,10</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 J533 connector<br>- 1 USB-C coupler<br>- 1 comma three<br>- 1 harness box<br>- 1 long OBD-C cable<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Volkswagen&model=Jetta GLI 2021-22">Buy Here</a></sub></details>||
|
||||
|Volkswagen|Passat 2015-22[<sup>8</sup>](#footnotes)|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[<sup>1,10</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 J533 connector<br>- 1 USB-C coupler<br>- 1 comma three<br>- 1 harness box<br>- 1 long OBD-C cable<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Volkswagen&model=Passat 2015-22">Buy Here</a></sub></details>||
|
||||
|Volkswagen|Passat Alltrack 2015-22|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[<sup>1,10</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 J533 connector<br>- 1 USB-C coupler<br>- 1 comma three<br>- 1 harness box<br>- 1 long OBD-C cable<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Volkswagen&model=Passat Alltrack 2015-22">Buy Here</a></sub></details>||
|
||||
|Volkswagen|Passat GTE 2015-22|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[<sup>1,10</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 J533 connector<br>- 1 USB-C coupler<br>- 1 comma three<br>- 1 harness box<br>- 1 long OBD-C cable<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Volkswagen&model=Passat GTE 2015-22">Buy Here</a></sub></details>||
|
||||
|Volkswagen|Polo 2018-23|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[<sup>1,10</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 J533 connector<br>- 1 USB-C coupler<br>- 1 comma three<br>- 1 harness box<br>- 1 long OBD-C cable<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Volkswagen&model=Polo 2018-23">Buy Here</a></sub></details>[<sup>11</sup>](#footnotes)||
|
||||
|Volkswagen|Polo GTI 2018-23|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[<sup>1,10</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 J533 connector<br>- 1 USB-C coupler<br>- 1 comma three<br>- 1 harness box<br>- 1 long OBD-C cable<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Volkswagen&model=Polo GTI 2018-23">Buy Here</a></sub></details>[<sup>11</sup>](#footnotes)||
|
||||
|Volkswagen|T-Cross 2021|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[<sup>1,10</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 J533 connector<br>- 1 USB-C coupler<br>- 1 comma three<br>- 1 harness box<br>- 1 long OBD-C cable<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Volkswagen&model=T-Cross 2021">Buy Here</a></sub></details>[<sup>11</sup>](#footnotes)||
|
||||
|Volkswagen|T-Roc 2021|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[<sup>1,10</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 J533 connector<br>- 1 USB-C coupler<br>- 1 comma three<br>- 1 harness box<br>- 1 long OBD-C cable<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Volkswagen&model=T-Roc 2021">Buy Here</a></sub></details>[<sup>11</sup>](#footnotes)||
|
||||
|Volkswagen|Taos 2022|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[<sup>1,10</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 J533 connector<br>- 1 USB-C coupler<br>- 1 comma three<br>- 1 harness box<br>- 1 long OBD-C cable<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Volkswagen&model=Taos 2022">Buy Here</a></sub></details>||
|
||||
|Volkswagen|Teramont 2018-22|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[<sup>1,10</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 J533 connector<br>- 1 USB-C coupler<br>- 1 comma three<br>- 1 harness box<br>- 1 long OBD-C cable<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Volkswagen&model=Teramont 2018-22">Buy Here</a></sub></details>||
|
||||
|Volkswagen|Teramont Cross Sport 2021-22|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[<sup>1,10</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 J533 connector<br>- 1 USB-C coupler<br>- 1 comma three<br>- 1 harness box<br>- 1 long OBD-C cable<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Volkswagen&model=Teramont Cross Sport 2021-22">Buy Here</a></sub></details>||
|
||||
|Volkswagen|Teramont X 2021-22|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[<sup>1,10</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 J533 connector<br>- 1 USB-C coupler<br>- 1 comma three<br>- 1 harness box<br>- 1 long OBD-C cable<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Volkswagen&model=Teramont X 2021-22">Buy Here</a></sub></details>||
|
||||
|Volkswagen|Tiguan 2018-23|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[<sup>1,10</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 J533 connector<br>- 1 USB-C coupler<br>- 1 comma three<br>- 1 harness box<br>- 1 long OBD-C cable<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Volkswagen&model=Tiguan 2018-23">Buy Here</a></sub></details>||
|
||||
|Volkswagen|Tiguan eHybrid 2021-23|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[<sup>1,10</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 J533 connector<br>- 1 USB-C coupler<br>- 1 comma three<br>- 1 harness box<br>- 1 long OBD-C cable<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Volkswagen&model=Tiguan eHybrid 2021-23">Buy Here</a></sub></details>||
|
||||
|Volkswagen|Touran 2016-23|Adaptive Cruise Control (ACC) & Lane Assist|openpilot available[<sup>1,10</sup>](#footnotes)|0 mph|0 mph|[](##)|[](##)|<details><summary>View</summary><sub>- 1 J533 connector<br>- 1 USB-C coupler<br>- 1 comma three<br>- 1 harness box<br>- 1 long OBD-C cable<br>- 1 mount<br>- 1 right angle OBD-C cable (1.5 ft)<br><a href="https://comma.ai/shop/comma-three.html?make=Volkswagen&model=Touran 2016-23">Buy Here</a></sub></details>||
|
||||
|
||||
<a id="footnotes"></a>
|
||||
<sup>1</sup>Requires a <a href="https://github.com/commaai/openpilot/wiki/GM#hardware">community built ASCM harness</a>. <b><i>NOTE: disconnecting the ASCM disables Automatic Emergency Braking (AEB).</i></b> <br />
|
||||
<sup>2</sup>2019 Honda Civic 1.6L Diesel Sedan does not have ALC below 12mph. <br />
|
||||
<sup>3</sup>When the Driver Support Unit (DSU) is disconnected, openpilot Adaptive Cruise Control (ACC) will replace stock Adaptive Cruise Control (ACC). <b><i>NOTE: disconnecting the DSU disables Automatic Emergency Braking (AEB).</i></b> <br />
|
||||
<sup>4</sup>openpilot operates above 28mph for Camry 4CYL L, 4CYL LE and 4CYL SE which don't have Full-Speed Range Dynamic Radar Cruise Control. <br />
|
||||
<sup>5</sup>Not including the China market Kamiq, which is based on the (currently) unsupported PQ34 platform. <br />
|
||||
<sup>6</sup>Refers only to the MQB-based European B8 Passat, not the NMS Passat in the USA/China/Mideast markets. <br />
|
||||
<sup>7</sup>Model-years 2021 and beyond may have a new camera harness design, which isn't yet available from the comma store. Before ordering, remove the Lane Assist camera cover and check to see if the connector is black (older design) or light brown (newer design). In the interim, if your car has a J533 connector CAN gateway inside the dashboard, choose "VW J533 Development" from the vehicle drop-down for a suitable harness. (Some newer models are also observed to not have a J533 connector.) <br />
|
||||
<sup>8</sup>Includes versions with extra rear cargo space (may be called Variant, Estate, SportWagen, Shooting Brake, etc.) <br />
|
||||
### Footnotes
|
||||
<sup>1</sup>Experimental openpilot longitudinal control is available behind a toggle; the toggle is only available in non-release branches such as `devel` or `master-ci`. <br />
|
||||
<sup>2</sup>By default, this car will use the stock Adaptive Cruise Control (ACC) for longitudinal control. If the Driver Support Unit (DSU) is disconnected, openpilot ACC will replace stock ACC. <b><i>NOTE: disconnecting the DSU disables Automatic Emergency Braking (AEB).</i></b> <br />
|
||||
<sup>3</sup>Requires a <a href="https://github.com/commaai/openpilot/wiki/GM#hardware" target="_blank">community built ASCM harness</a>. <b><i>NOTE: disconnecting the ASCM disables Automatic Emergency Braking (AEB).</i></b> <br />
|
||||
<sup>4</sup>2019 Honda Civic 1.6L Diesel Sedan does not have ALC below 12mph. <br />
|
||||
<sup>5</sup>Requires a <a href="https://comma.ai/shop/panda" target="_blank">red panda</a> for this <a href="https://en.wikipedia.org/wiki/CAN_FD" target="_blank">CAN FD car</a>. All the hardware needed is sold in the <a href="https://comma.ai/shop/can-fd-panda-kit" target="_blank">CAN FD kit</a>. <br />
|
||||
<sup>6</sup>openpilot operates above 28mph for Camry 4CYL L, 4CYL LE and 4CYL SE which don't have Full-Speed Range Dynamic Radar Cruise Control. <br />
|
||||
<sup>7</sup>Not including the China market Kamiq, which is based on the (currently) unsupported PQ34 platform. <br />
|
||||
<sup>8</sup>Refers only to the MQB-based European B8 Passat, not the NMS Passat in the USA/China/Mideast markets. <br />
|
||||
<sup>9</sup>Some Škoda vehicles are equipped with heated windshields, which are known to block GPS signal needed for some comma three functionality. <br />
|
||||
<sup>10</sup>Only available for vehicles using a gateway (J533) harness. At this time, vehicles using a camera harness are limited to using stock ACC. <br />
|
||||
<sup>11</sup>Model-years 2022 and beyond may have a combined CAN gateway and BCM, which is supported by openpilot in software, but doesn't yet have a harness available from the comma store. <br />
|
||||
|
||||
## Community Maintained Cars
|
||||
Although they're not upstream, the community has openpilot running on other makes and models. See the 'Community Supported Models' section of each make [on our wiki](https://wiki.comma.ai/).
|
||||
@@ -230,17 +280,18 @@ Although they're not upstream, the community has openpilot running on other make
|
||||
# Don't see your car here?
|
||||
|
||||
**openpilot can support many more cars than it currently does.** There are a few reasons your car may not be supported.
|
||||
If your car doesn't fit into any of the incompatibility criteria here, then there's a good chance it can be supported! We're adding support for new cars all the time. We don't have a roadmap for car support, and in fact, most car support comes from users like you!
|
||||
If your car doesn't fit into any of the incompatibility criteria here, then there's a good chance it can be supported! We're adding support for new cars all the time. **We don't have a roadmap for car support**, and in fact, most car support comes from users like you!
|
||||
|
||||
### Which cars are able to be supported?
|
||||
|
||||
openpilot uses the existing steering, gas, and brake interfaces in your car. If your car lacks any one of these interfaces, openpilot will not be able to control the car. If your car has any form of [LKAS](https://en.wikipedia.org/wiki/Automated_Lane_Keeping_Systems)/[LCA](https://en.wikipedia.org/wiki/Lane_centering) and [ACC](https://en.wikipedia.org/wiki/Adaptive_cruise_control), then it almost certainly has these interfaces. These interfaces generally started shipping on cars around 2016.
|
||||
openpilot uses the existing steering, gas, and brake interfaces in your car. If your car lacks any one of these interfaces, openpilot will not be able to control the car. If your car has [ACC](https://en.wikipedia.org/wiki/Adaptive_cruise_control) and any form of [LKAS](https://en.wikipedia.org/wiki/Automated_Lane_Keeping_Systems)/[LCA](https://en.wikipedia.org/wiki/Lane_centering), then it almost certainly has these interfaces. These features generally started shipping on cars around 2016. Note that manufacturers will often make their own [marketing terms](https://en.wikipedia.org/wiki/Adaptive_cruise_control#Vehicle_models_supporting_adaptive_cruise_control) for these features, such as Hyundai's "Smart Cruise Control" branding of Adaptive Cruise Control.
|
||||
|
||||
If your car has the following packages or features, then it's a good candidate for support. If it does not, then it's unlikely able to be supported.
|
||||
If your car has the following packages or features, then it's a good candidate for support.
|
||||
|
||||
| Make | Required Package/Features |
|
||||
| ---- | ------------------------- |
|
||||
| Acura | Any car with AcuraWatch Plus will work. AcuraWatch Plus comes standard on many newer models. |
|
||||
| Ford | Any car with Lane Centering will likely work. |
|
||||
| Honda | Any car with Honda Sensing will work. Honda Sensing comes standard on many newer models. |
|
||||
| Subaru | Any car with EyeSight will work. EyeSight comes standard on many newer models. |
|
||||
| Nissan | Any car with ProPILOT will likely work. |
|
||||
@@ -254,8 +305,9 @@ All the cars that openpilot supports use a [CAN bus](https://en.wikipedia.org/wi
|
||||
|
||||
### Toyota Security
|
||||
|
||||
Specific new Toyota models are shipping with a new message authentication method that openpilot does not yet support.
|
||||
So far, this list includes:
|
||||
openpilot does not yet support these Toyota models due to a new message authentication method.
|
||||
[Vote](https://comma.ai/shop/products/vote) if you'd like to see openpilot support on these models.
|
||||
|
||||
* Toyota RAV4 Prime 2021+
|
||||
* Toyota Sienna 2021+
|
||||
* Toyota Venza 2021+
|
||||
@@ -264,4 +316,4 @@ So far, this list includes:
|
||||
* Toyota Corolla Cross 2022+ (only US model)
|
||||
* Lexus NX 2022+
|
||||
* Toyota bZ4x 2023+
|
||||
* Subaru Solterra 2023+
|
||||
* Subaru Solterra 2023+
|
||||
|
||||
+1
-1
@@ -8,4 +8,4 @@ Additionally, on specific supported cars (see ACC column in [supported cars](CAR
|
||||
* Stock ACC is replaced by openpilot ACC.
|
||||
* openpilot FCW operates in addition to stock FCW.
|
||||
|
||||
openpilot should preserve all other vehicle's stock features, including, but are not limited to: FCW, Automatic Emergency Braking (AEB), auto high-beam, blind spot warning, and side collision warning.
|
||||
openpilot should preserve all other vehicle's stock features, including, but not limited to: FCW, Automatic Emergency Braking (AEB), auto high-beam, blind spot warning, and side collision warning.
|
||||
|
||||
@@ -1,2 +1,9 @@
|
||||
import logging
|
||||
import os
|
||||
|
||||
from .astro_dog import AstroDog
|
||||
assert AstroDog
|
||||
|
||||
# setup logging
|
||||
LOGLEVEL = os.environ.get('LOGLEVEL', 'INFO').upper()
|
||||
logging.basicConfig(level=LOGLEVEL, format='%(message)s')
|
||||
|
||||
+52
-23
@@ -9,7 +9,7 @@ from .ephemeris import Ephemeris, EphemerisType, GLONASSEphemeris, GPSEphemeris,
|
||||
from .downloader import download_orbits_gps, download_orbits_russia_src, download_nav, download_ionex, download_dcb, download_prediction_orbits_russia_src
|
||||
from .downloader import download_cors_station
|
||||
from .trop import saast
|
||||
from .iono import IonexMap, parse_ionex
|
||||
from .iono import IonexMap, parse_ionex, get_slant_delay
|
||||
from .dcb import DCB, parse_dcbs
|
||||
from .gps_time import GPSTime
|
||||
from .dgps import get_closest_station_names, parse_dgps
|
||||
@@ -33,9 +33,14 @@ class AstroDog:
|
||||
def __init__(self, auto_update=True,
|
||||
cache_dir='/tmp/gnss/',
|
||||
dgps=False,
|
||||
valid_const=('GPS', 'GLONASS'),
|
||||
valid_const=(ConstellationId.GPS, ConstellationId.GLONASS),
|
||||
valid_ephem_types=EphemerisType.all_orbits(),
|
||||
clear_old_ephemeris=False):
|
||||
|
||||
for const in valid_const:
|
||||
if not isinstance(const, ConstellationId):
|
||||
raise TypeError(f"valid_const must be a list of ConstellationId, got {const}")
|
||||
|
||||
self.auto_update = auto_update
|
||||
self.cache_dir = cache_dir
|
||||
self.clear_old_ephemeris = clear_old_ephemeris
|
||||
@@ -44,22 +49,25 @@ class AstroDog:
|
||||
valid_ephem_types = [valid_ephem_types]
|
||||
self.pull_orbit = len(set(EphemerisType.all_orbits()) & set(valid_ephem_types)) > 0
|
||||
self.pull_nav = EphemerisType.NAV in valid_ephem_types
|
||||
self.use_qcom_poly = EphemerisType.QCOM_POLY in valid_ephem_types
|
||||
self.valid_const = valid_const
|
||||
self.valid_ephem_types = valid_ephem_types
|
||||
|
||||
self.orbit_fetched_times = TimeRangeHolder()
|
||||
self.nav_fetched_times = TimeRangeHolder()
|
||||
self.navs_fetched_times = TimeRangeHolder()
|
||||
self.dcbs_fetched_times = TimeRangeHolder()
|
||||
|
||||
self.dgps_delays = []
|
||||
self.ionex_maps: List[IonexMap] = []
|
||||
self.orbits: DefaultDict[str, List[PolyEphemeris]] = defaultdict(list)
|
||||
self.nav: DefaultDict[str, List[Union[GPSEphemeris, GLONASSEphemeris]]] = defaultdict(list)
|
||||
self.qcom_polys: DefaultDict[str, List[PolyEphemeris]] = defaultdict(list)
|
||||
self.navs: DefaultDict[str, List[Union[GPSEphemeris, GLONASSEphemeris]]] = defaultdict(list)
|
||||
self.dcbs: DefaultDict[str, List[DCB]] = defaultdict(list)
|
||||
|
||||
self.cached_ionex: Optional[IonexMap] = None
|
||||
self.cached_dgps = None
|
||||
self.cached_orbit: DefaultDict[str, Optional[PolyEphemeris]] = defaultdict(lambda: None)
|
||||
self.cached_qcom_polys: DefaultDict[str, Optional[PolyEphemeris]] = defaultdict(lambda: None)
|
||||
self.cached_nav: DefaultDict[str, Union[GPSEphemeris, GLONASSEphemeris, None]] = defaultdict(lambda: None)
|
||||
self.cached_dcb: DefaultDict[str, Optional[DCB]] = defaultdict(lambda: None)
|
||||
|
||||
@@ -73,8 +81,8 @@ class AstroDog:
|
||||
return ionex
|
||||
|
||||
def get_nav(self, prn, time):
|
||||
skip_download = time in self.nav_fetched_times
|
||||
nav = self._get_latest_valid_data(self.nav[prn], self.cached_nav[prn], self.get_nav_data, time, skip_download)
|
||||
skip_download = time in self.navs_fetched_times
|
||||
nav = self._get_latest_valid_data(self.navs[prn], self.cached_nav[prn], self.get_nav_data, time, skip_download)
|
||||
if nav is not None:
|
||||
self.cached_nav[prn] = nav
|
||||
return nav
|
||||
@@ -96,10 +104,13 @@ class AstroDog:
|
||||
result[prn] = obj
|
||||
return result
|
||||
|
||||
def get_all_ephem_prns(self):
|
||||
return set(self.orbits.keys()).union(set(self.navs.keys())).union(set(self.qcom_polys.keys()))
|
||||
|
||||
def get_navs(self, time):
|
||||
if time not in self.nav_fetched_times and self.auto_update:
|
||||
if time not in self.navs_fetched_times:
|
||||
self.get_nav_data(time)
|
||||
return AstroDog._select_valid_temporal_items(self.nav, time, self.cached_nav)
|
||||
return AstroDog._select_valid_temporal_items(self.navs, time, self.cached_nav)
|
||||
|
||||
def get_orbit(self, prn: str, time: GPSTime):
|
||||
skip_download = time in self.orbit_fetched_times
|
||||
@@ -108,6 +119,12 @@ class AstroDog:
|
||||
self.cached_orbit[prn] = orbit
|
||||
return orbit
|
||||
|
||||
def get_qcom_poly(self, prn: str, time: GPSTime):
|
||||
poly = self._get_latest_valid_data(self.qcom_polys[prn], self.cached_qcom_polys[prn], None, time, True)
|
||||
if poly is not None:
|
||||
self.cached_qcom_polys[prn] = poly
|
||||
return poly
|
||||
|
||||
def get_orbits(self, time):
|
||||
if time not in self.orbit_fetched_times:
|
||||
self.get_orbit_data(time)
|
||||
@@ -129,13 +146,16 @@ class AstroDog:
|
||||
self.cached_dgps = latest_data
|
||||
return latest_data
|
||||
|
||||
def add_qcom_polys(self, new_ephems: Dict[str, List[Ephemeris]]):
|
||||
self._add_ephems(new_ephems, self.qcom_polys)
|
||||
|
||||
def add_orbits(self, new_ephems: Dict[str, List[Ephemeris]]):
|
||||
self._add_ephems(new_ephems, self.orbits, self.orbit_fetched_times)
|
||||
self._add_ephems(new_ephems, self.orbits)
|
||||
|
||||
def add_navs(self, new_ephems: Dict[str, List[Ephemeris]]):
|
||||
self._add_ephems(new_ephems, self.nav, self.nav_fetched_times)
|
||||
self._add_ephems(new_ephems, self.navs)
|
||||
|
||||
def _add_ephems(self, new_ephems: Dict[str, List[Ephemeris]], ephems_dict, fetched_times):
|
||||
def _add_ephems(self, new_ephems: Dict[str, List[Ephemeris]], ephems_dict):
|
||||
for k, v in new_ephems.items():
|
||||
if len(v) > 0:
|
||||
if self.clear_old_ephemeris:
|
||||
@@ -143,9 +163,10 @@ class AstroDog:
|
||||
else:
|
||||
ephems_dict[k].extend(v)
|
||||
|
||||
def add_ephem_fetched_time(self, ephems, fetched_times):
|
||||
min_epochs = []
|
||||
max_epochs = []
|
||||
for v in new_ephems.values():
|
||||
for v in ephems.values():
|
||||
if len(v) > 0:
|
||||
min_ephem, max_ephem = self.get_epoch_range(v)
|
||||
min_epochs.append(min_ephem)
|
||||
@@ -162,9 +183,9 @@ class AstroDog:
|
||||
|
||||
fetched_ephems = {}
|
||||
|
||||
if 'GPS' in self.valid_const:
|
||||
if ConstellationId.GPS in self.valid_const:
|
||||
fetched_ephems = download_and_parse(ConstellationId.GPS, parse_rinex_nav_msg_gps)
|
||||
if 'GLONASS' in self.valid_const:
|
||||
if ConstellationId.GLONASS in self.valid_const:
|
||||
for k, v in download_and_parse(ConstellationId.GLONASS, parse_rinex_nav_msg_glonass).items():
|
||||
fetched_ephems.setdefault(k, []).extend(v)
|
||||
self.add_navs(fetched_ephems)
|
||||
@@ -172,7 +193,7 @@ class AstroDog:
|
||||
if sum([len(v) for v in fetched_ephems.values()]) == 0:
|
||||
begin_day = GPSTime(time.week, SECS_IN_DAY * (time.tow // SECS_IN_DAY))
|
||||
end_day = GPSTime(time.week, SECS_IN_DAY * (1 + (time.tow // SECS_IN_DAY)))
|
||||
self.nav_fetched_times.add(begin_day, end_day)
|
||||
self.navs_fetched_times.add(begin_day, end_day)
|
||||
|
||||
def download_parse_orbit(self, gps_time: GPSTime, skip_before_epoch=None) -> Dict[str, List[PolyEphemeris]]:
|
||||
# Download multiple days to be able to polyfit at the start-end of the day
|
||||
@@ -180,7 +201,7 @@ class AstroDog:
|
||||
with ThreadPoolExecutor() as executor:
|
||||
futures_other = [executor.submit(download_orbits_russia_src, t, self.cache_dir, self.valid_ephem_types) for t in time_steps]
|
||||
futures_gps = None
|
||||
if "GPS" in self.valid_const:
|
||||
if ConstellationId.GPS in self.valid_const:
|
||||
futures_gps = [executor.submit(download_orbits_gps, t, self.cache_dir, self.valid_ephem_types) for t in time_steps]
|
||||
|
||||
ephems_other = parse_sp3_orbits([f.result() for f in futures_other if f.result()], self.valid_const, skip_before_epoch)
|
||||
@@ -195,7 +216,7 @@ class AstroDog:
|
||||
result = download_prediction_orbits_russia_src(gps_time, self.cache_dir)
|
||||
if result is not None:
|
||||
result = [result]
|
||||
elif "GPS" in self.valid_const:
|
||||
elif ConstellationId.GPS in self.valid_const:
|
||||
# Slower fallback. Russia src prediction orbits are published from 2022
|
||||
result = [download_orbits_gps(t, self.cache_dir, self.valid_ephem_types) for t in [gps_time - SECS_IN_DAY, gps_time]]
|
||||
if result is None:
|
||||
@@ -209,7 +230,7 @@ class AstroDog:
|
||||
ephems_sp3 = self.download_parse_orbit(time)
|
||||
if sum([len(v) for v in ephems_sp3.values()]) < 5:
|
||||
raise RuntimeError(f'No orbit data found. For Time {time.as_datetime()} constellations {self.valid_const} valid ephem types {self.valid_ephem_types}')
|
||||
|
||||
self.add_ephem_fetched_time(ephems_sp3, self.orbit_fetched_times)
|
||||
self.add_orbits(ephems_sp3)
|
||||
|
||||
def get_dcb_data(self, time):
|
||||
@@ -257,7 +278,7 @@ class AstroDog:
|
||||
return eph.get_tgd()
|
||||
return None
|
||||
|
||||
def get_sat_info(self, prn, time):
|
||||
def get_eph(self, prn, time):
|
||||
if get_constellation(prn) not in self.valid_const:
|
||||
return None
|
||||
eph = None
|
||||
@@ -265,7 +286,12 @@ class AstroDog:
|
||||
eph = self.get_orbit(prn, time)
|
||||
if not eph and self.pull_nav:
|
||||
eph = self.get_nav(prn, time)
|
||||
if not eph and self.use_qcom_poly:
|
||||
eph = self.get_qcom_poly(prn, time)
|
||||
return eph
|
||||
|
||||
def get_sat_info(self, prn, time):
|
||||
eph = self.get_eph(prn, time)
|
||||
if eph:
|
||||
return eph.get_sat_info(time)
|
||||
return None
|
||||
@@ -286,7 +312,7 @@ class AstroDog:
|
||||
return None
|
||||
|
||||
def get_frequency(self, prn, time, signal='C1C'):
|
||||
if get_constellation(prn) == 'GPS':
|
||||
if get_constellation(prn) == ConstellationId.GPS:
|
||||
switch = {'1': constants.GPS_L1,
|
||||
'2': constants.GPS_L2,
|
||||
'5': constants.GPS_L5,
|
||||
@@ -297,7 +323,7 @@ class AstroDog:
|
||||
if freq:
|
||||
return freq
|
||||
raise NotImplementedError("Dont know this GPS frequency: ", signal, prn)
|
||||
elif get_constellation(prn) == 'GLONASS':
|
||||
elif get_constellation(prn) == ConstellationId.GLONASS:
|
||||
n = self.get_glonass_channel(prn, time)
|
||||
if n is None:
|
||||
return None
|
||||
@@ -320,7 +346,6 @@ class AstroDog:
|
||||
el, az = get_el_az(rcv_pos, sat_pos)
|
||||
if el < 0.2:
|
||||
return None
|
||||
|
||||
if self.dgps and not no_dgps:
|
||||
return self._get_delay_dgps(prn, rcv_pos, time)
|
||||
|
||||
@@ -331,7 +356,11 @@ class AstroDog:
|
||||
# When using internet we expect all data or return None
|
||||
if self.auto_update and (ionex is None or dcb is None or freq is None):
|
||||
return None
|
||||
iono_delay = ionex.get_delay(rcv_pos, az, el, sat_pos, time, freq) if ionex is not None else 0.
|
||||
if ionex is not None:
|
||||
iono_delay = ionex.get_delay(rcv_pos, az, el, sat_pos, time, freq)
|
||||
else:
|
||||
# 5m vertical delay is a good default
|
||||
iono_delay = get_slant_delay(rcv_pos, az, el, sat_pos, time, freq, vertical_delay=5.0)
|
||||
trop_delay = saast(rcv_pos, el)
|
||||
code_bias = dcb.get_delay(signal) if dcb is not None else 0.
|
||||
return iono_delay + trop_delay + code_bias
|
||||
|
||||
+7
-6
@@ -5,10 +5,10 @@ from datetime import datetime
|
||||
from .gps_time import GPSTime
|
||||
from .constants import SECS_IN_YEAR
|
||||
from . import raw_gnss as raw
|
||||
from . import opt
|
||||
from .rinex_file import RINEXFile
|
||||
from .downloader import download_cors_coords
|
||||
from .helpers import get_constellation
|
||||
|
||||
from .helpers import get_constellation, ConstellationId
|
||||
|
||||
def mean_filter(delay):
|
||||
d2 = delay.copy()
|
||||
@@ -78,7 +78,7 @@ def get_station_position(station_id, cache_dir='/tmp/gnss/', time=GPSTime.from_d
|
||||
return ((time - epoch)/SECS_IN_YEAR)*np.array(vel) + np.array(pos)
|
||||
|
||||
|
||||
def parse_dgps(station_id, station_obs_file_path, dog, max_distance=100000, required_constellations=['GPS']):
|
||||
def parse_dgps(station_id, station_obs_file_path, dog, max_distance=100000, required_constellations=[ConstellationId.GPS]):
|
||||
station_pos = get_station_position(station_id, cache_dir=dog.cache_dir)
|
||||
obsdata = RINEXFile(station_obs_file_path)
|
||||
measurements = raw.read_rinex_obs(obsdata)
|
||||
@@ -107,8 +107,9 @@ def parse_dgps(station_id, station_obs_file_path, dog, max_distance=100000, requ
|
||||
station_delays[signal] = {}
|
||||
for i, proc_measurement in enumerate(proc_measurements):
|
||||
times.append(proc_measurement[0].recv_time)
|
||||
Fx_pos = raw.pr_residual(proc_measurement, signal=signal)
|
||||
residual = -np.array(Fx_pos(list(station_pos) + [0, 0]))
|
||||
Fx_pos = opt.pr_residual(proc_measurement, signal=signal)
|
||||
residual, _ = Fx_pos(list(station_pos) + [0,0])
|
||||
residual = -np.array(residual)
|
||||
for j, m in enumerate(proc_measurement):
|
||||
prn = m.prn
|
||||
if prn not in station_delays[signal]:
|
||||
@@ -120,7 +121,7 @@ def parse_dgps(station_id, station_obs_file_path, dog, max_distance=100000, requ
|
||||
# could this be biased? Only use GPS for convenience.
|
||||
model_delays = {}
|
||||
for prn in station_delays['C1C']:
|
||||
if get_constellation(prn) == 'GPS':
|
||||
if get_constellation(prn) == ConstellationId.GPS:
|
||||
model_delays[prn] = np.nan*np.zeros(n)
|
||||
for i in range(n):
|
||||
model_delays[prn][i] = dog.get_delay(prn, times[i], station_pos, no_dgps=True)
|
||||
|
||||
+67
-46
@@ -7,18 +7,19 @@ import urllib.error
|
||||
import pycurl
|
||||
import re
|
||||
import time
|
||||
import tempfile
|
||||
import socket
|
||||
import logging
|
||||
|
||||
from datetime import datetime, timedelta
|
||||
from urllib.parse import urlparse
|
||||
from io import BytesIO
|
||||
from ftplib import FTP_TLS
|
||||
|
||||
from atomicwrites import atomic_write
|
||||
|
||||
from laika.ephemeris import EphemerisType
|
||||
from .constants import SECS_IN_HR, SECS_IN_DAY, SECS_IN_WEEK
|
||||
from .gps_time import GPSTime
|
||||
from .gps_time import GPSTime, tow_to_datetime
|
||||
from .helpers import ConstellationId
|
||||
|
||||
dir_path = os.path.dirname(os.path.realpath(__file__))
|
||||
@@ -42,7 +43,7 @@ def retryable(f):
|
||||
try:
|
||||
return f(url_base, *args, **kwargs)
|
||||
except DownloadFailed as e:
|
||||
print(e)
|
||||
logging.warning(e)
|
||||
# none of them succeeded
|
||||
raise DownloadFailed("Multiple URL failures attempting to pull file(s)")
|
||||
return wrapped
|
||||
@@ -98,7 +99,7 @@ def ftp_download_files(url_base, folder_path, cacheDir, filenames):
|
||||
if "/" in filename:
|
||||
continue
|
||||
filepath = os.path.join(folder_path_abs, filename)
|
||||
print("pulling from", url_base, "to", filepath)
|
||||
logging.debug("pulling from", url_base, "to", filepath)
|
||||
|
||||
if not os.path.isfile(filepath):
|
||||
os.makedirs(folder_path_abs, exist_ok=True)
|
||||
@@ -141,7 +142,7 @@ def http_download_files(url_base, folder_path, cacheDir, filenames):
|
||||
continue
|
||||
filepath = os.path.join(folder_path_abs, filename)
|
||||
if not os.path.isfile(filepath):
|
||||
print("pulling from", url_base, "to", filepath)
|
||||
logging.debug("pulling from", url_base, "to", filepath)
|
||||
os.makedirs(folder_path_abs, exist_ok=True)
|
||||
url_path = url_base + folder_path + filename
|
||||
handle = pycurl.Curl()
|
||||
@@ -170,31 +171,13 @@ def http_download_files(url_base, folder_path, cacheDir, filenames):
|
||||
# if there are downloads left to be done, repeat, and don't overwrite
|
||||
_, requests_processing = fetcher.perform()
|
||||
if requests_processing > 0:
|
||||
print("some requests stalled, retrying them")
|
||||
logging.warning("some requests stalled, retrying them")
|
||||
return http_download_files(url_base, folder_path, cacheDir, filenames)
|
||||
|
||||
return filepaths
|
||||
|
||||
|
||||
def https_download_file(url):
|
||||
if 'nasa.gov/' not in url:
|
||||
netrc_path = None
|
||||
f = None
|
||||
elif os.path.isfile(dir_path + '/.netrc'):
|
||||
netrc_path = dir_path + '/.netrc'
|
||||
f = None
|
||||
else:
|
||||
try:
|
||||
username = os.environ['NASA_USERNAME']
|
||||
password = os.environ['NASA_PASSWORD']
|
||||
f = tempfile.NamedTemporaryFile()
|
||||
netrc = f"machine urs.earthdata.nasa.gov login {username} password {password}"
|
||||
f.write(netrc.encode())
|
||||
f.flush()
|
||||
netrc_path = f.name
|
||||
except KeyError:
|
||||
raise DownloadFailed('Could not find .netrc file and no NASA_USERNAME and NASA_PASSWORD in environment for urs.earthdata.nasa.gov authentication')
|
||||
|
||||
crl = pycurl.Curl()
|
||||
crl.setopt(crl.CAINFO, certifi.where())
|
||||
crl.setopt(crl.URL, url)
|
||||
@@ -202,17 +185,12 @@ def https_download_file(url):
|
||||
crl.setopt(crl.SSL_CIPHER_LIST, 'DEFAULT@SECLEVEL=1')
|
||||
crl.setopt(crl.COOKIEJAR, '/tmp/cddis_cookies')
|
||||
crl.setopt(pycurl.CONNECTTIMEOUT, 10)
|
||||
if netrc_path is not None:
|
||||
crl.setopt(crl.NETRC_FILE, netrc_path)
|
||||
crl.setopt(crl.NETRC, 2)
|
||||
|
||||
|
||||
buf = BytesIO()
|
||||
crl.setopt(crl.WRITEDATA, buf)
|
||||
crl.perform()
|
||||
response = crl.getinfo(pycurl.RESPONSE_CODE)
|
||||
crl.close()
|
||||
if f is not None:
|
||||
f.close()
|
||||
|
||||
if response != 200:
|
||||
raise DownloadFailed('HTTPS error ' + str(response))
|
||||
@@ -228,6 +206,17 @@ def ftp_download_file(url):
|
||||
except urllib.error.URLError as e:
|
||||
raise DownloadFailed(e)
|
||||
|
||||
def ftps_download_file(url):
|
||||
parsed = urlparse(url)
|
||||
try:
|
||||
buf = BytesIO()
|
||||
with FTP_TLS(parsed.hostname) as ftps:
|
||||
ftps.login(user='anonymous')
|
||||
ftps.prot_p()
|
||||
ftps.retrbinary('RETR ' + parsed.path, buf.write)
|
||||
return buf.getvalue()
|
||||
except ftplib.all_errors as e:
|
||||
raise DownloadFailed(e)
|
||||
|
||||
@retryable
|
||||
def download_files(url_base, folder_path, cacheDir, filenames):
|
||||
@@ -241,12 +230,14 @@ def download_files(url_base, folder_path, cacheDir, filenames):
|
||||
@retryable
|
||||
def download_file(url_base, folder_path, filename_zipped):
|
||||
url = url_base + folder_path + filename_zipped
|
||||
print('Downloading ' + url)
|
||||
if url.startswith('https'):
|
||||
logging.debug('Downloading ' + url)
|
||||
if url.startswith('https://'):
|
||||
return https_download_file(url)
|
||||
if url.startswith('ftp'):
|
||||
elif url.startswith('ftp://'):
|
||||
return ftp_download_file(url)
|
||||
raise NotImplementedError('Did find ftp or https preamble')
|
||||
elif url.startswith('sftp://'):
|
||||
return ftps_download_file(url)
|
||||
raise NotImplementedError('Did not find supported url scheme')
|
||||
|
||||
|
||||
def download_and_cache_file_return_first_success(url_bases, folder_and_file_names, cache_dir, compression='', overwrite=False, raise_error=False):
|
||||
@@ -308,26 +299,51 @@ def download_nav(time: GPSTime, cache_dir, constellation: ConstellationId):
|
||||
if GPSTime.from_datetime(datetime.utcnow()) - time > SECS_IN_DAY:
|
||||
url_bases = (
|
||||
'https://github.com/commaai/gnss-data/raw/master/gnss/data/daily/',
|
||||
'https://cddis.nasa.gov/archive/gnss/data/daily/',
|
||||
'sftp://gdc.cddis.eosdis.nasa.gov/gnss/data/daily/',
|
||||
)
|
||||
filename = t.strftime(f"brdc%j0.%y{c}")
|
||||
folder_path = t.strftime(f'%Y/%j/%y{c}/')
|
||||
compression = '.gz' if folder_path >= '2020/335/' else '.Z'
|
||||
return download_and_cache_file(url_bases, folder_path, cache_dir+'daily_nav/', filename, compression)
|
||||
elif constellation == ConstellationId.GPS:
|
||||
url_base = 'https://cddis.nasa.gov/archive/gnss/data/hourly/'
|
||||
filename = t.strftime(f"hour%j0.%y{c}")
|
||||
folder_path = t.strftime('%Y/%j/')
|
||||
compression = '.gz' if folder_path >= '2020/336/' else '.Z'
|
||||
return download_and_cache_file(url_base, folder_path, cache_dir+'hourly_nav/', filename, compression)
|
||||
else:
|
||||
url_bases = (
|
||||
'https://github.com/commaai/gnss-data-hourly/raw/master/',
|
||||
'sftp://gdc.cddis.eosdis.nasa.gov/gnss/data/hourly/',
|
||||
)
|
||||
times = [t, (t - timedelta(hours=1))]
|
||||
folder_and_filenames = [(t.strftime('%Y/%j/'), t.strftime(f"hour%j0.%y{c}")) for t in times]
|
||||
compression = '.gz' if folder_and_filenames[0][0] >= '2020/336/' else '.Z'
|
||||
# always overwrite as this file is appended
|
||||
return download_and_cache_file_return_first_success(url_bases,
|
||||
folder_and_filenames, cache_dir+'hourly_nav/', compression, overwrite=True)
|
||||
except DownloadFailed:
|
||||
pass
|
||||
|
||||
|
||||
def download_orbits_gps_cod0(time, cache_dir, ephem_types):
|
||||
url_bases = (
|
||||
'https://github.com/commaai/gnss-data/raw/master/gnss/products/',
|
||||
'sftp://gdc.cddis.eosdis.nasa.gov/gnss/products/',
|
||||
)
|
||||
|
||||
if EphemerisType.ULTRA_RAPID_ORBIT not in ephem_types:
|
||||
# TODO: raise error here
|
||||
return None
|
||||
|
||||
tm = tow_to_datetime(time.tow, time.week).timetuple()
|
||||
doy = str(tm.tm_yday).zfill(3)
|
||||
filename = f"COD0OPSULT_{tm.tm_year}{doy}0000_02D_05M_ORB.SP3"
|
||||
# TODO: add hour management
|
||||
|
||||
folder_path = "%i/" % time.week
|
||||
folder_file_names = [(folder_path, filename)]
|
||||
return download_and_cache_file_return_first_success(url_bases, folder_file_names, cache_dir+'cddis_products/', compression='.gz')
|
||||
|
||||
|
||||
def download_orbits_gps(time, cache_dir, ephem_types):
|
||||
url_bases = (
|
||||
'https://github.com/commaai/gnss-data/raw/master/gnss/products/',
|
||||
'https://cddis.nasa.gov/archive/gnss/products/',
|
||||
'sftp://gdc.cddis.eosdis.nasa.gov/gnss/products/',
|
||||
'ftp://igs.ign.fr/pub/igs/products/',
|
||||
)
|
||||
folder_path = "%i/" % time.week
|
||||
@@ -344,7 +360,12 @@ def download_orbits_gps(time, cache_dir, ephem_types):
|
||||
f"igu{time_str}_06.sp3",
|
||||
f"igu{time_str}_00.sp3"])
|
||||
folder_file_names = [(folder_path, filename) for filename in filenames]
|
||||
return download_and_cache_file_return_first_success(url_bases, folder_file_names, cache_dir+'cddis_products/', compression='.Z')
|
||||
ret = download_and_cache_file_return_first_success(url_bases, folder_file_names, cache_dir+'cddis_products/', compression='.Z')
|
||||
if ret is not None:
|
||||
return ret
|
||||
|
||||
# fallback to COD0 Ultra Rapid Orbits
|
||||
return download_orbits_gps_cod0(time, cache_dir, ephem_types)
|
||||
|
||||
|
||||
def download_prediction_orbits_russia_src(gps_time, cache_dir):
|
||||
@@ -406,7 +427,7 @@ def download_ionex(time, cache_dir):
|
||||
t = time.as_datetime()
|
||||
url_bases = (
|
||||
'https://github.com/commaai/gnss-data/raw/master/gnss/products/ionex/',
|
||||
'https://cddis.nasa.gov/archive/gnss/products/ionex/',
|
||||
'sftp://gdc.cddis.eosdis.nasa.gov/gnss/products/ionex/',
|
||||
'ftp://igs.ensg.ign.fr/pub/igs/products/ionosphere/',
|
||||
'ftp://gssc.esa.int/gnss/products/ionex/',
|
||||
)
|
||||
@@ -422,7 +443,7 @@ def download_dcb(time, cache_dir):
|
||||
folder_paths = []
|
||||
url_bases = (
|
||||
'https://github.com/commaai/gnss-data/raw/master/gnss/products/bias/',
|
||||
'https://cddis.nasa.gov/archive/gnss/products/bias/',
|
||||
'sftp://gdc.cddis.eosdis.nasa.gov/gnss/products/bias/',
|
||||
'ftp://igs.ign.fr/pub/igs/products/mgex/dcb/',
|
||||
)
|
||||
# seem to be a lot of data missing, so try many days
|
||||
@@ -458,5 +479,5 @@ def download_cors_station(time, station_name, cache_dir):
|
||||
filepath = download_and_cache_file(url_bases, folder_path, cache_dir+'cors_obs/', filename, compression='.gz')
|
||||
return filepath
|
||||
except DownloadFailed:
|
||||
print("File not downloaded, check availability on server.")
|
||||
logging.warning("File not downloaded, check availability on server.")
|
||||
return None
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
@0xb3ca6d2462778bb1;
|
||||
|
||||
struct Ephemeris {
|
||||
# This is according to the rinex (2?) format
|
||||
svId @0 :UInt16;
|
||||
year @1 :UInt16;
|
||||
month @2 :UInt16;
|
||||
day @3 :UInt16;
|
||||
hour @4 :UInt16;
|
||||
minute @5 :UInt16;
|
||||
second @6 :Float32;
|
||||
af0 @7 :Float64;
|
||||
af1 @8 :Float64;
|
||||
af2 @9 :Float64;
|
||||
|
||||
iode @10 :Float64;
|
||||
crs @11 :Float64;
|
||||
deltaN @12 :Float64;
|
||||
m0 @13 :Float64;
|
||||
|
||||
cuc @14 :Float64;
|
||||
ecc @15 :Float64;
|
||||
cus @16 :Float64;
|
||||
a @17 :Float64; # note that this is not the root!!
|
||||
|
||||
toe @18 :Float64;
|
||||
cic @19 :Float64;
|
||||
omega0 @20 :Float64;
|
||||
cis @21 :Float64;
|
||||
|
||||
i0 @22 :Float64;
|
||||
crc @23 :Float64;
|
||||
omega @24 :Float64;
|
||||
omegaDot @25 :Float64;
|
||||
|
||||
iDot @26 :Float64;
|
||||
codesL2 @27 :Float64;
|
||||
gpsWeekDEPRECATED @28 :Float64;
|
||||
l2 @29 :Float64;
|
||||
|
||||
svAcc @30 :Float64;
|
||||
svHealth @31 :Float64;
|
||||
tgd @32 :Float64;
|
||||
iodc @33 :Float64;
|
||||
|
||||
transmissionTime @34 :Float64;
|
||||
fitInterval @35 :Float64;
|
||||
|
||||
toc @36 :Float64;
|
||||
|
||||
ionoCoeffsValid @37 :Bool;
|
||||
ionoAlpha @38 :List(Float64);
|
||||
ionoBeta @39 :List(Float64);
|
||||
|
||||
towCount @40 :UInt32;
|
||||
toeWeek @41 :UInt16;
|
||||
tocWeek @42 :UInt16;
|
||||
}
|
||||
|
||||
struct GlonassEphemeris {
|
||||
svId @0 :UInt16;
|
||||
year @1 :UInt16;
|
||||
dayInYear @2 :UInt16;
|
||||
hour @3 :UInt16;
|
||||
minute @4 :UInt16;
|
||||
second @5 :Float32;
|
||||
|
||||
x @6 :Float64;
|
||||
xVel @7 :Float64;
|
||||
xAccel @8 :Float64;
|
||||
y @9 :Float64;
|
||||
yVel @10 :Float64;
|
||||
yAccel @11 :Float64;
|
||||
z @12 :Float64;
|
||||
zVel @13 :Float64;
|
||||
zAccel @14 :Float64;
|
||||
|
||||
svType @15 :UInt8;
|
||||
svURA @16 :Float32;
|
||||
age @17 :UInt8;
|
||||
|
||||
svHealth @18 :UInt8;
|
||||
tkDEPRECATED @19 :UInt16;
|
||||
tb @20 :UInt16;
|
||||
|
||||
tauN @21 :Float64;
|
||||
deltaTauN @22 :Float64;
|
||||
gammaN @23 :Float64;
|
||||
|
||||
p1 @24 :UInt8;
|
||||
p2 @25 :UInt8;
|
||||
p3 @26 :UInt8;
|
||||
p4 @27 :UInt8;
|
||||
|
||||
freqNumDEPRECATED @28 :UInt32;
|
||||
|
||||
n4 @29 :UInt8;
|
||||
nt @30 :UInt16;
|
||||
freqNum @31 :Int16;
|
||||
tkSeconds @32 :UInt32;
|
||||
}
|
||||
|
||||
struct EphemerisCache {
|
||||
gpsEphemerides @0 :List(Ephemeris);
|
||||
glonassEphemerides @1 :List(GlonassEphemeris);
|
||||
}
|
||||
+131
-185
@@ -1,4 +1,3 @@
|
||||
import json
|
||||
import warnings
|
||||
from abc import ABC, abstractmethod
|
||||
from collections import defaultdict
|
||||
@@ -11,8 +10,15 @@ from datetime import datetime
|
||||
from math import sin, cos, sqrt, fabs, atan2
|
||||
|
||||
from .gps_time import GPSTime, utc_to_gpst
|
||||
from .constants import SPEED_OF_LIGHT, SECS_IN_MIN, SECS_IN_HR, SECS_IN_DAY, EARTH_ROTATION_RATE, EARTH_GM
|
||||
from .helpers import get_constellation
|
||||
from .constants import SPEED_OF_LIGHT, SECS_IN_MIN, SECS_IN_HR, SECS_IN_DAY, \
|
||||
SECS_IN_WEEK, EARTH_ROTATION_RATE, EARTH_GM
|
||||
from .helpers import get_constellation, get_prn_from_nmea_id
|
||||
|
||||
import capnp
|
||||
import os
|
||||
capnp.remove_import_hook()
|
||||
capnp_path = os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__)), "ephemeris.capnp"))
|
||||
ephemeris_structs = capnp.load(capnp_path)
|
||||
|
||||
|
||||
def read4(f, rinex_ver):
|
||||
@@ -23,58 +29,13 @@ def read4(f, rinex_ver):
|
||||
return float(line[4:23]), float(line[23:42]), float(line[42:61]), float(line[61:80])
|
||||
|
||||
|
||||
def convert_ublox_ephem(ublox_ephem, current_time: Optional[datetime] = None):
|
||||
# Week time of ephemeris gps msg has a roll-over period of 10 bits (19.6 years)
|
||||
# The latest roll-over was on 2019-04-07
|
||||
week = ublox_ephem.gpsWeek
|
||||
if current_time is None:
|
||||
# Each message is incremented to be greater or equal than week 1877 (2015-12-27).
|
||||
# To skip this use the current_time argument
|
||||
week += 1024
|
||||
if week < 1877:
|
||||
week += 1024
|
||||
else:
|
||||
roll_overs = GPSTime.from_datetime(current_time).week // 1024
|
||||
week += (roll_overs - (week // 1024)) * 1024
|
||||
|
||||
ephem = {}
|
||||
ephem['sv_id'] = ublox_ephem.svId
|
||||
ephem['toe'] = GPSTime(week, ublox_ephem.toe)
|
||||
ephem['toc'] = GPSTime(week, ublox_ephem.toc)
|
||||
ephem['af0'] = ublox_ephem.af0
|
||||
ephem['af1'] = ublox_ephem.af1
|
||||
ephem['af2'] = ublox_ephem.af2
|
||||
ephem['tgd'] = ublox_ephem.tgd
|
||||
|
||||
ephem['sqrta'] = np.sqrt(ublox_ephem.a)
|
||||
ephem['dn'] = ublox_ephem.deltaN
|
||||
ephem['m0'] = ublox_ephem.m0
|
||||
|
||||
ephem['ecc'] = ublox_ephem.ecc
|
||||
ephem['w'] = ublox_ephem.omega
|
||||
ephem['cus'] = ublox_ephem.cus
|
||||
ephem['cuc'] = ublox_ephem.cuc
|
||||
ephem['crc'] = ublox_ephem.crc
|
||||
ephem['crs'] = ublox_ephem.crs
|
||||
ephem['cic'] = ublox_ephem.cic
|
||||
ephem['cis'] = ublox_ephem.cis
|
||||
|
||||
ephem['inc'] = ublox_ephem.i0
|
||||
ephem['inc_dot'] = ublox_ephem.iDot
|
||||
ephem['omegadot'] = ublox_ephem.omegaDot
|
||||
ephem['omega0'] = ublox_ephem.omega0
|
||||
|
||||
epoch = ephem['toe']
|
||||
return GPSEphemeris(ephem, epoch)
|
||||
|
||||
|
||||
class EphemerisType(IntEnum):
|
||||
# Matches the enum in log.capnp
|
||||
NAV = 0
|
||||
FINAL_ORBIT = 1
|
||||
RAPID_ORBIT = 2
|
||||
ULTRA_RAPID_ORBIT = 3
|
||||
QCOM_POLY = 4 # Currently not supported
|
||||
QCOM_POLY = 4
|
||||
|
||||
@staticmethod
|
||||
def all_orbits():
|
||||
@@ -86,24 +47,23 @@ class EphemerisType(IntEnum):
|
||||
return EphemerisType.FINAL_ORBIT
|
||||
if "/rapid" in file_name or "/igr" in file_name:
|
||||
return EphemerisType.RAPID_ORBIT
|
||||
if "/ultra" in file_name or "/igu" in file_name:
|
||||
if "/ultra" in file_name or "/igu" in file_name or "COD0OPSULT" in file_name:
|
||||
return EphemerisType.ULTRA_RAPID_ORBIT
|
||||
raise RuntimeError(f"Ephemeris type not found in filename: {file_name}")
|
||||
|
||||
|
||||
class Ephemeris(ABC):
|
||||
|
||||
def __init__(self, prn: str, data, epoch: GPSTime, eph_type: EphemerisType, healthy: bool, max_time_diff: float,
|
||||
def __init__(self, prn: str, epoch: GPSTime, eph_type: EphemerisType, healthy: bool, max_time_diff: float,
|
||||
file_epoch: Optional[GPSTime] = None, file_name=None):
|
||||
self.prn = prn
|
||||
self.data = data
|
||||
self.epoch = epoch
|
||||
self.eph_type = eph_type
|
||||
self.healthy = healthy
|
||||
self.max_time_diff = max_time_diff
|
||||
self.file_epoch = file_epoch
|
||||
self.file_name = file_name
|
||||
self.file_source = '' if file_name is None else file_name.split('/')[-1][:3] # File source for the ephemeris (e.g. igu, igr, Sta)
|
||||
self.__json = None
|
||||
|
||||
def valid(self, time):
|
||||
return abs(time - self.epoch) <= self.max_time_diff
|
||||
@@ -124,56 +84,24 @@ class Ephemeris(ABC):
|
||||
def _get_sat_info(self, time):
|
||||
pass
|
||||
|
||||
def to_json(self):
|
||||
if self.__json is None:
|
||||
dict = self.__dict__
|
||||
dict['ephemeris_class'] = self.__class__.__name__
|
||||
self.__json = {'ephemeris': json.dumps(dict, cls=EphemerisSerializer)}
|
||||
return self.__json
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_dct):
|
||||
dct = json.loads(json_dct['ephemeris'], object_hook=ephemeris_deserialize_hook)
|
||||
obj = cls.__new__(globals()[dct['ephemeris_class']])
|
||||
obj.__dict__.update(dct)
|
||||
obj.__json = json_dct
|
||||
return obj
|
||||
|
||||
|
||||
def ephemeris_deserialize_hook(dct):
|
||||
if 'week' in dct:
|
||||
return GPSTime(dct['week'], dct['tow'])
|
||||
return dct
|
||||
|
||||
|
||||
class EphemerisSerializer(json.JSONEncoder):
|
||||
|
||||
def default(self, o):
|
||||
if isinstance(o, GPSTime):
|
||||
return o.__dict__
|
||||
if isinstance(o, np.ndarray):
|
||||
return o.tolist()
|
||||
return json.JSONEncoder.default(self, o)
|
||||
|
||||
|
||||
class GLONASSEphemeris(Ephemeris):
|
||||
def __init__(self, data, epoch, healthy=True, file_name=None):
|
||||
super().__init__(data['prn'], data, epoch, EphemerisType.NAV, healthy, max_time_diff=25*SECS_IN_MIN, file_name=file_name)
|
||||
self.channel = data['freq_num']
|
||||
self.to_json()
|
||||
def __init__(self, data, file_name=None):
|
||||
self.epoch = GPSTime.from_glonass(data.n4, data.nt, data.tb*15*SECS_IN_MIN)
|
||||
super().__init__('R%02i' % data.svId, self.epoch, EphemerisType.NAV, data.svHealth==0, max_time_diff=25*SECS_IN_MIN, file_name=file_name)
|
||||
self.data = data
|
||||
self.epoch = GPSTime.from_glonass(data.n4, data.nt, data.tb*15 * SECS_IN_MIN)
|
||||
self.channel = data.freqNum
|
||||
|
||||
def _get_sat_info(self, time: GPSTime):
|
||||
# see the russian doc for this:
|
||||
# http://gauss.gge.unb.ca/GLONASS.ICD.pdf
|
||||
|
||||
eph = self.data
|
||||
# TODO should handle leap seconds better
|
||||
toc_gps_time = utc_to_gpst(eph['toc'])
|
||||
tdiff = time - toc_gps_time
|
||||
|
||||
tdiff = time - self.epoch
|
||||
# Clock correction (except for general relativity which is applied later)
|
||||
clock_err = eph['min_tauN'] + tdiff * (eph['GammaN'])
|
||||
clock_rate_err = eph['GammaN']
|
||||
clock_err = -eph.tauN + tdiff * eph.gammaN
|
||||
clock_rate_err = eph.gammaN
|
||||
|
||||
def glonass_diff_eq(state, acc):
|
||||
J2 = 1.0826257e-3
|
||||
@@ -195,14 +123,14 @@ class GLONASSEphemeris(Ephemeris):
|
||||
return ders
|
||||
|
||||
init_state = np.empty(6)
|
||||
init_state[0] = eph['x']
|
||||
init_state[1] = eph['y']
|
||||
init_state[2] = eph['z']
|
||||
init_state[3] = eph['x_vel']
|
||||
init_state[4] = eph['y_vel']
|
||||
init_state[5] = eph['z_vel']
|
||||
init_state[0] = eph.x
|
||||
init_state[1] = eph.y
|
||||
init_state[2] = eph.z
|
||||
init_state[3] = eph.xVel
|
||||
init_state[4] = eph.yVel
|
||||
init_state[5] = eph.zVel
|
||||
init_state = 1000*init_state
|
||||
acc = 1000*np.array([eph['x_acc'], eph['y_acc'], eph['z_acc']])
|
||||
acc = 1000*np.array([eph.xAccel, eph.yAccel, eph.zAccel])
|
||||
state = init_state
|
||||
tstep = 90
|
||||
if tdiff < 0:
|
||||
@@ -225,10 +153,12 @@ class GLONASSEphemeris(Ephemeris):
|
||||
|
||||
|
||||
class PolyEphemeris(Ephemeris):
|
||||
def __init__(self, prn: str, data, epoch: GPSTime, ephem_type: EphemerisType, file_epoch: GPSTime, file_name: str, healthy=True, tgd=0):
|
||||
super().__init__(prn, data, epoch, ephem_type, healthy, max_time_diff=SECS_IN_HR, file_epoch=file_epoch, file_name=file_name)
|
||||
def __init__(self, prn: str, data, epoch: GPSTime, ephem_type: EphemerisType,
|
||||
file_epoch: GPSTime=None, file_name: str=None, healthy=True, tgd=0,
|
||||
max_time_diff: int=SECS_IN_HR):
|
||||
super().__init__(prn, epoch, ephem_type, healthy, max_time_diff=max_time_diff, file_epoch=file_epoch, file_name=file_name)
|
||||
self.data = data
|
||||
self.tgd = tgd
|
||||
self.to_json()
|
||||
|
||||
def _get_sat_info(self, time: GPSTime):
|
||||
dt = time - self.data['t0']
|
||||
@@ -245,27 +175,32 @@ class PolyEphemeris(Ephemeris):
|
||||
|
||||
|
||||
class GPSEphemeris(Ephemeris):
|
||||
def __init__(self, data, epoch, healthy=True, file_name=None):
|
||||
super().__init__('G%02i' % data['sv_id'], data, epoch, EphemerisType.NAV, healthy, max_time_diff=2*SECS_IN_HR, file_name=file_name)
|
||||
def __init__(self, data, file_name=None):
|
||||
self.toe = GPSTime(data.toeWeek, data.toe)
|
||||
self.toc = GPSTime(data.tocWeek, data.toc)
|
||||
self.epoch = self.toc
|
||||
|
||||
super().__init__('G%02i' % data.svId, self.epoch, EphemerisType.NAV, data.svHealth==0, max_time_diff=2*SECS_IN_HR, file_name=file_name)
|
||||
self.max_time_diff_tgd = SECS_IN_DAY
|
||||
self.to_json()
|
||||
self.data = data
|
||||
self.sqrta = np.sqrt(data.a)
|
||||
|
||||
def get_tgd(self):
|
||||
return self.data['tgd']
|
||||
return self.datatgd
|
||||
|
||||
def _get_sat_info(self, time: GPSTime):
|
||||
eph = self.data
|
||||
tdiff = time - eph['toc'] # Time of clock
|
||||
clock_err = eph['af0'] + tdiff * (eph['af1'] + tdiff * eph['af2'])
|
||||
clock_rate_err = eph['af1'] + 2 * tdiff * eph['af2']
|
||||
tdiff = time - self.toc # Time of clock
|
||||
clock_err = eph.af0 + tdiff * (eph.af1 + tdiff * eph.af2)
|
||||
clock_rate_err = eph.af1 + 2 * tdiff * eph.af2\
|
||||
|
||||
# Orbit propagation
|
||||
tdiff = time - eph['toe'] # Time of ephemeris (might be different from time of clock)
|
||||
tdiff = time - self.toe # Time of ephemeris (might be different from time of clock)
|
||||
|
||||
# Calculate position per IS-GPS-200D p 97 Table 20-IV
|
||||
a = eph['sqrta'] * eph['sqrta'] # [m] Semi-major axis
|
||||
ma_dot = sqrt(EARTH_GM / (a * a * a)) + eph['dn'] # [rad/sec] Corrected mean motion
|
||||
ma = eph['m0'] + ma_dot * tdiff # [rad] Corrected mean anomaly
|
||||
a = self.sqrta * self.sqrta # [m] Semi-major axis
|
||||
ma_dot = sqrt(EARTH_GM / (a * a * a)) + eph.deltaN # [rad/sec] Corrected mean motion
|
||||
ma = eph.m0 + ma_dot * tdiff # [rad] Corrected mean anomaly
|
||||
|
||||
# Iteratively solve for the Eccentric Anomaly (from Keith Alter and David Johnston)
|
||||
ea = ma # Starting value for E
|
||||
@@ -273,37 +208,37 @@ class GPSEphemeris(Ephemeris):
|
||||
ea_old = 2222
|
||||
while fabs(ea - ea_old) > 1.0E-14:
|
||||
ea_old = ea
|
||||
tempd1 = 1.0 - eph['ecc'] * cos(ea_old)
|
||||
ea = ea + (ma - ea_old + eph['ecc'] * sin(ea_old)) / tempd1
|
||||
tempd1 = 1.0 - eph.ecc * cos(ea_old)
|
||||
ea = ea + (ma - ea_old + eph.ecc * sin(ea_old)) / tempd1
|
||||
ea_dot = ma_dot / tempd1
|
||||
|
||||
# Relativistic correction term
|
||||
einstein = -4.442807633E-10 * eph['ecc'] * eph['sqrta'] * sin(ea)
|
||||
einstein = -4.442807633E-10 * eph.ecc * self.sqrta * sin(ea)
|
||||
|
||||
# Begin calc for True Anomaly and Argument of Latitude
|
||||
tempd2 = sqrt(1.0 - eph['ecc'] * eph['ecc'])
|
||||
tempd2 = sqrt(1.0 - eph.ecc * eph.ecc)
|
||||
# [rad] Argument of Latitude = True Anomaly + Argument of Perigee
|
||||
al = atan2(tempd2 * sin(ea), cos(ea) - eph['ecc']) + eph['w']
|
||||
al = atan2(tempd2 * sin(ea), cos(ea) - eph.ecc) + eph.omega
|
||||
al_dot = tempd2 * ea_dot / tempd1
|
||||
|
||||
# Calculate corrected argument of latitude based on position
|
||||
cal = al + eph['cus'] * sin(2.0 * al) + eph['cuc'] * cos(2.0 * al)
|
||||
cal_dot = al_dot * (1.0 + 2.0 * (eph['cus'] * cos(2.0 * al) -
|
||||
eph['cuc'] * sin(2.0 * al)))
|
||||
cal = al + eph.cus * sin(2.0 * al) + eph.cuc * cos(2.0 * al)
|
||||
cal_dot = al_dot * (1.0 + 2.0 * (eph.cus * cos(2.0 * al) -
|
||||
eph.cuc * sin(2.0 * al)))
|
||||
|
||||
# Calculate corrected radius based on argument of latitude
|
||||
r = a * tempd1 + eph['crc'] * cos(2.0 * al) + eph['crs'] * sin(2.0 * al)
|
||||
r_dot = (a * eph['ecc'] * sin(ea) * ea_dot +
|
||||
2.0 * al_dot * (eph['crs'] * cos(2.0 * al) -
|
||||
eph['crc'] * sin(2.0 * al)))
|
||||
r = a * tempd1 + eph.crc * cos(2.0 * al) + eph.crs * sin(2.0 * al)
|
||||
r_dot = (a * eph.ecc * sin(ea) * ea_dot +
|
||||
2.0 * al_dot * (eph.crs * cos(2.0 * al) -
|
||||
eph.crc * sin(2.0 * al)))
|
||||
|
||||
# Calculate inclination based on argument of latitude
|
||||
inc = (eph['inc'] + eph['inc_dot'] * tdiff +
|
||||
eph['cic'] * cos(2.0 * al) +
|
||||
eph['cis'] * sin(2.0 * al))
|
||||
inc_dot = (eph['inc_dot'] +
|
||||
2.0 * al_dot * (eph['cis'] * cos(2.0 * al) -
|
||||
eph['cic'] * sin(2.0 * al)))
|
||||
inc = (eph.i0 + eph.iDot * tdiff +
|
||||
eph.cic * cos(2.0 * al) +
|
||||
eph.cis * sin(2.0 * al))
|
||||
inc_dot = (eph.iDot +
|
||||
2.0 * al_dot * (eph.cis * cos(2.0 * al) -
|
||||
eph.cic * sin(2.0 * al)))
|
||||
|
||||
# Calculate position and velocity in orbital plane
|
||||
x = r * cos(cal)
|
||||
@@ -312,8 +247,8 @@ class GPSEphemeris(Ephemeris):
|
||||
y_dot = r_dot * sin(cal) + x * cal_dot
|
||||
|
||||
# Corrected longitude of ascending node
|
||||
om_dot = eph['omegadot'] - EARTH_ROTATION_RATE
|
||||
om = eph['omega0'] + tdiff * om_dot - EARTH_ROTATION_RATE * eph['toe'].tow
|
||||
om_dot = eph.omegaDot - EARTH_ROTATION_RATE
|
||||
om = eph.omega0 + tdiff * om_dot - EARTH_ROTATION_RATE * self.toe.tow
|
||||
|
||||
# Compute the satellite's position in Earth-Centered Earth-Fixed coordinates
|
||||
pos = np.empty(3)
|
||||
@@ -401,7 +336,7 @@ def read_prn_data(data, prn, deg=16, deg_t=1):
|
||||
measurements = np_data_prn[i:i + deg + 1, 1:5]
|
||||
|
||||
times = (measurements[:, 0] - epoch).astype(float)
|
||||
if (np.diff(times) != 900).any():
|
||||
if not (np.diff(times) != 900).any() and not (np.diff(times) != 300).any():
|
||||
continue
|
||||
|
||||
poly_data = {}
|
||||
@@ -462,24 +397,26 @@ def parse_rinex_nav_msg_gps(file_name):
|
||||
line = ' ' + line # Shift 1 char to the right
|
||||
|
||||
line = line.replace('D', 'E') # Handle bizarro float format
|
||||
e = {'epoch': epoch, 'sv_id': sv_id}
|
||||
e['toc'] = epoch
|
||||
e = {'svId': sv_id}
|
||||
# TODO are TOC and TOE the same?
|
||||
e['toc'] = epoch.tow
|
||||
e['tocWeek'] = epoch.week
|
||||
e['af0'] = float(line[23:42])
|
||||
e['af1'] = float(line[42:61])
|
||||
e['af2'] = float(line[61:80])
|
||||
|
||||
e['iode'], e['crs'], e['dn'], e['m0'] = read4(f, rinex_ver)
|
||||
e['cuc'], e['ecc'], e['cus'], e['sqrta'] = read4(f, rinex_ver)
|
||||
toe_tow, e['cic'], e['omega0'], e['cis'] = read4(f, rinex_ver)
|
||||
e['inc'], e['crc'], e['w'], e['omegadot'] = read4(f, rinex_ver)
|
||||
e['inc_dot'], e['l2_codes'], toe_week, e['l2_pflag'] = read4(f, rinex_ver)
|
||||
e['sv_accuracy'], e['health'], e['tgd'], e['iodc'] = read4(f, rinex_ver)
|
||||
e['iode'], e['crs'], e['deltaN'], e['m0'] = read4(f, rinex_ver)
|
||||
e['cuc'], e['ecc'], e['cus'], sqrta = read4(f, rinex_ver)
|
||||
e['a'] = sqrta ** 2
|
||||
e['toe'], e['cic'], e['omega0'], e['cis'] = read4(f, rinex_ver)
|
||||
e['i0'], e['crc'], e['omega'], e['omegaDot'] = read4(f, rinex_ver)
|
||||
e['iDot'], e['codesL2'], e['toeWeek'], l2_pflag = read4(f, rinex_ver)
|
||||
e['svAcc'], e['svHealth'], e['tgd'], e['iodc'] = read4(f, rinex_ver)
|
||||
f.readline() # Discard last row
|
||||
|
||||
e['toe'] = GPSTime(toe_week, toe_tow)
|
||||
e['healthy'] = (e['health'] == 0.0)
|
||||
data_struct = ephemeris_structs.Ephemeris.new_message(**e)
|
||||
|
||||
ephem = GPSEphemeris(e, epoch, file_name=file_name)
|
||||
ephem = GPSEphemeris(data_struct, file_name=file_name)
|
||||
ephems[ephem.prn].append(ephem)
|
||||
f.close()
|
||||
return ephems
|
||||
@@ -505,53 +442,62 @@ def parse_rinex_nav_msg_glonass(file_name):
|
||||
got_header = True
|
||||
continue
|
||||
if rinex_ver == 3:
|
||||
prn = line[:3]
|
||||
epoch = GPSTime.from_datetime(datetime.strptime(line[4:23], "%y %m %d %H %M %S"))
|
||||
sv_id = int(line[1:3])
|
||||
|
||||
epoch = utc_to_gpst(GPSTime.from_datetime(datetime.strptime(line[4:23], "%y %m %d %H %M %S")))
|
||||
elif rinex_ver == 2:
|
||||
prn = 'R%02i' % int(line[0:2])
|
||||
epoch = GPSTime.from_datetime(datetime.strptime(line[3:20], "%y %m %d %H %M %S"))
|
||||
sv_id = int(line[0:2])
|
||||
epoch = utc_to_gpst(GPSTime.from_datetime(datetime.strptime(line[3:20], "%y %m %d %H %M %S")))
|
||||
line = ' ' + line # Shift 1 char to the right
|
||||
|
||||
line = line.replace('D', 'E') # Handle bizarro float format
|
||||
e = {'epoch': epoch, 'prn': prn}
|
||||
e['toc'] = epoch
|
||||
e['min_tauN'] = float(line[23:42])
|
||||
e['GammaN'] = float(line[42:61])
|
||||
e['tk'] = float(line[61:80])
|
||||
e = {'svId': sv_id}
|
||||
e['n4'], e['nt'], toe_seconds = epoch.as_glonass()
|
||||
tb = toe_seconds / (15 * SECS_IN_MIN)
|
||||
|
||||
e['x'], e['x_vel'], e['x_acc'], e['health'] = read4(f, rinex_ver)
|
||||
e['y'], e['y_vel'], e['y_acc'], e['freq_num'] = read4(f, rinex_ver)
|
||||
e['z'], e['z_vel'], e['z_acc'], e['age'] = read4(f, rinex_ver)
|
||||
|
||||
e['tb'] = tb
|
||||
|
||||
e['healthy'] = (e['health'] == 0.0)
|
||||
e['tauN'] = -float(line[23:42])
|
||||
e['gammaN'] = float(line[42:61])
|
||||
e['tkSeconds'] = float(line[61:80])
|
||||
|
||||
ephems[prn].append(GLONASSEphemeris(e, epoch, file_name=file_name))
|
||||
e['x'], e['xVel'], e['xAccel'], e['svHealth'] = read4(f, rinex_ver)
|
||||
e['y'], e['yVel'], e['yAccel'], e['freqNum'] = read4(f, rinex_ver)
|
||||
e['z'], e['zVel'], e['zAccel'], e['age'] = read4(f, rinex_ver)
|
||||
|
||||
# TODO unclear why glonass sometimes has nav messages 3s after correct one
|
||||
if abs(tb - int(tb)) > 1e-3:
|
||||
continue
|
||||
|
||||
|
||||
data_struct = ephemeris_structs.GlonassEphemeris.new_message(**e)
|
||||
ephem = GLONASSEphemeris(data_struct, file_name=file_name)
|
||||
|
||||
ephems[ephem.prn].append(ephem)
|
||||
f.close()
|
||||
return ephems
|
||||
|
||||
|
||||
'''
|
||||
def parse_qcom_ephem(qcom_poly, current_week):
|
||||
svId = qcom_poly.svId
|
||||
data = qcom_poly
|
||||
t0 = data.t0
|
||||
# fix glonass time
|
||||
prn = get_prn_from_nmea_id(svId)
|
||||
if prn[0] == 'R':
|
||||
# TODO should handle leap seconds better
|
||||
epoch = GPSTime(current_week, (t0 - 3*SECS_IN_HR + SECS_IN_DAY) % (SECS_IN_WEEK) + 18)
|
||||
else:
|
||||
epoch = GPSTime(current_week, t0)
|
||||
poly_data = {}
|
||||
poly_data['t0'] = epoch
|
||||
poly_data['xyz'] = np.array([
|
||||
[data.xyz0[0], data.xyzN[0], data.xyzN[1], data.xyzN[2]],
|
||||
[data.xyz0[1], data.xyzN[3], data.xyzN[4], data.xyzN[5]],
|
||||
[data.xyz0[2], data.xyzN[6], data.xyzN[7], data.xyzN[8]] ]).T
|
||||
|
||||
def parse_qcom_ephems(qcom_polys, current_week):
|
||||
ephems = []
|
||||
for qcom_poly in qcom_polys:
|
||||
svId = qcom_poly.qcomGnss.drSvPoly.svId
|
||||
data = qcom_poly.qcomGnss.drSvPoly
|
||||
t0 = data.t0
|
||||
# fix glonass time
|
||||
if get_constellation(svId) == 'GLONASS':
|
||||
# TODO should handle leap seconds better
|
||||
epoch = GPSTime(current_week, (t0 + 3*SECS_IN_WEEK) % (SECS_IN_WEEK) + 18)
|
||||
else:
|
||||
epoch = GPSTime(current_week, t0)
|
||||
poly_data = {}
|
||||
poly_data['t0'] = epoch
|
||||
poly_data['x'] = [data.xyzN[2], data.xyzN[1], data.xyzN[0], data.xyz0[0]]
|
||||
poly_data['y'] = [data.xyzN[5], data.xyzN[4], data.xyzN[3], data.xyz0[1]]
|
||||
poly_data['z'] = [data.xyzN[8], data.xyzN[7], data.xyzN[6], data.xyz0[2]]
|
||||
poly_data['clock'] = [1e-3*data.other[3], 1e-3*data.other[2], 1e-3*data.other[1], 1e-3*data.other[0]]
|
||||
poly_data['deg'] = 3
|
||||
poly_data['deg_t'] = 3
|
||||
ephems.append(PolyEphemeris(svId, poly_data, epoch, eph_type=EphemerisType.QCOM_POLY))
|
||||
return ephems
|
||||
'''
|
||||
poly_data['clock'] = [1e-3*data.other[3], 1e-3*data.other[2], 1e-3*data.other[1], 1e-3*data.other[0]]
|
||||
poly_data['deg'] = 3
|
||||
poly_data['deg_t'] = 3
|
||||
return PolyEphemeris(prn, poly_data, epoch, ephem_type=EphemerisType.QCOM_POLY, max_time_diff=300, file_name='qcom')
|
||||
|
||||
+12
-2
@@ -62,8 +62,7 @@ def get_leap_seconds(time):
|
||||
return 15
|
||||
elif time <= GPSTime.from_datetime(datetime.datetime(2015, 7, 1)):
|
||||
return 16
|
||||
# TODO is this correct?
|
||||
elif time <= GPSTime.from_datetime(datetime.datetime(2017, 7, 1)):
|
||||
elif time <= GPSTime.from_datetime(datetime.datetime(2017, 1, 1)):
|
||||
return 17
|
||||
else:
|
||||
return 18
|
||||
@@ -153,6 +152,17 @@ class GPSTime:
|
||||
def as_datetime(self):
|
||||
return tow_to_datetime(self.tow, self.week)
|
||||
|
||||
def as_glonass(self):
|
||||
time_utc = gpst_to_utc(self)
|
||||
datetime_utc = time_utc.as_datetime()
|
||||
datetime_glonass = datetime_utc + datetime.timedelta(hours=3)
|
||||
|
||||
year = datetime_glonass.year
|
||||
cycle = (year - 1992) // 4
|
||||
days = (datetime_glonass - datetime.datetime(1992 + cycle*4, 1, 1)).days + 1
|
||||
tod = (datetime_glonass - datetime_glonass.replace(hour=0, minute=0, second=0, microsecond=0)).total_seconds()
|
||||
return cycle, days, tod
|
||||
|
||||
def as_unix_timestamp(self):
|
||||
return (gpst_to_utc(self).as_datetime() - datetime.datetime(1970, 1, 1)).total_seconds()
|
||||
|
||||
|
||||
+10
-13
@@ -26,17 +26,19 @@ class ConstellationId(IntEnum):
|
||||
if c in RINEX_ID_TO_CONSTELLATION:
|
||||
return RINEX_ID_TO_CONSTELLATION[c]
|
||||
else:
|
||||
return None
|
||||
raise ValueError("Unknown rinex constellation id: ", c)
|
||||
|
||||
@classmethod
|
||||
def from_qcom_source(cls, report_source: int):
|
||||
if report_source == 0:
|
||||
return ConstellationId.GPS
|
||||
if report_source == 1:
|
||||
return ConstellationId.GLONASS
|
||||
if report_source == 2:
|
||||
return ConstellationId.BEIDOU
|
||||
if report_source == 6:
|
||||
return ConstellationId.SBAS
|
||||
elif report_source == 1:
|
||||
return ConstellationId.GLONASS
|
||||
raise NotImplementedError('Only GPS (0), SBAS (1) and GLONASS (6) are supported from qcom, not:', {report_source})
|
||||
raise NotImplementedError('Only GPS (0), GLONASS (1), BEIDOU (2) and SBAS (6) are supported from qcom, not:', {report_source})
|
||||
|
||||
|
||||
# From https://gpsd.gitlab.io/gpsd/NMEA.html#_satellite_ids
|
||||
@@ -95,14 +97,12 @@ def get_closest(time, candidates, recv_pos=None):
|
||||
default=None,
|
||||
)
|
||||
|
||||
|
||||
def get_constellation(prn: str):
|
||||
identifier = prn[0]
|
||||
constellation = ConstellationId.from_rinex_char(identifier)
|
||||
if constellation is not None:
|
||||
return constellation.name
|
||||
return None
|
||||
return ConstellationId.from_rinex_char(identifier)
|
||||
|
||||
def get_sv_id(prn: str):
|
||||
return int(prn[1:])
|
||||
|
||||
def get_constellation_and_sv_id(nmea_id):
|
||||
for c, ranges in CONSTELLATION_TO_NMEA_RANGES.items():
|
||||
@@ -121,11 +121,8 @@ def get_prn_from_nmea_id(nmea_id: int):
|
||||
|
||||
def get_nmea_id_from_prn(prn: str):
|
||||
constellation = get_constellation(prn)
|
||||
if constellation is None:
|
||||
raise ValueError(f"Constellation not found for prn {prn}")
|
||||
|
||||
sv_id = int(prn[1:]) # satellite id
|
||||
return get_nmea_id_from_constellation_and_svid(ConstellationId[constellation], sv_id)
|
||||
return get_nmea_id_from_constellation_and_svid(constellation, sv_id)
|
||||
|
||||
|
||||
def get_nmea_id_from_constellation_and_svid(constellation: ConstellationId, sv_id: int):
|
||||
|
||||
+14
-5
@@ -9,6 +9,17 @@ from .gps_time import GPSTime
|
||||
# Altitude of Ionospheric-pierce-point
|
||||
IPP_ALT = 6821000
|
||||
|
||||
def get_alpha_beta(rcv_pos, el):
|
||||
geocentric_alt = np.linalg.norm(rcv_pos)
|
||||
alpha = np.pi/2 + el
|
||||
beta = np.arcsin(geocentric_alt*np.sin(alpha)/IPP_ALT)
|
||||
return alpha, beta
|
||||
|
||||
def get_slant_delay(rcv_pos, az, el, sat_pos, time, freq, vertical_delay):
|
||||
alpha, beta = get_alpha_beta(rcv_pos, el)
|
||||
slant_delay = vertical_delay * ((1 - ((EARTH_RADIUS * np.sin(beta)) /
|
||||
(EARTH_RADIUS + 3.5e5))**2)**(-0.5))
|
||||
return slant_delay
|
||||
|
||||
def closest_in_list(lst, val, num=2):
|
||||
"""
|
||||
@@ -134,18 +145,16 @@ class IonexMap:
|
||||
# To get a delay from a TEC map, we need to calculate
|
||||
# the ionospheric pierce point, geometry described here
|
||||
# https://en.wikipedia.org/wiki/Ionospheric_pierce_point
|
||||
alpha, beta = get_alpha_beta(rcv_pos, el)
|
||||
conv = LocalCoord.from_ecef(rcv_pos)
|
||||
geocentric_alt = np.linalg.norm(rcv_pos)
|
||||
alpha = np.pi/2 + el
|
||||
beta = np.arcsin(geocentric_alt*np.sin(alpha)/IPP_ALT)
|
||||
gamma = np.pi - alpha - beta
|
||||
geocentric_alt = np.linalg.norm(rcv_pos)
|
||||
ipp_dist = geocentric_alt*np.sin(gamma)/np.sin(beta)
|
||||
ipp_ned = conv.ecef2ned(sat_pos)*(ipp_dist)/np.linalg.norm(sat_pos)
|
||||
ipp_geo = conv.ned2geodetic(ipp_ned)
|
||||
factor = 40.30E16 / (freq**2) * 10**(self.exp)
|
||||
vertical_delay = self.get_TEC(ipp_geo, time) * factor
|
||||
slant_delay = vertical_delay * ((1 - ((EARTH_RADIUS * np.sin(beta)) /
|
||||
(EARTH_RADIUS + 3.5e5))**2)**(-0.5))
|
||||
slant_delay = get_slant_delay(rcv_pos, az, el, sat_pos, time, freq, vertical_delay)
|
||||
return slant_delay
|
||||
|
||||
@staticmethod
|
||||
|
||||
+192
@@ -0,0 +1,192 @@
|
||||
import sympy
|
||||
import numpy as np
|
||||
from typing import List
|
||||
|
||||
from .constants import EARTH_ROTATION_RATE, SPEED_OF_LIGHT
|
||||
from .helpers import ConstellationId
|
||||
from .raw_gnss import GNSSMeasurement
|
||||
|
||||
|
||||
def gauss_newton(fun, b, M, xtol=1e-8, max_n=25):
|
||||
|
||||
W = np.linalg.inv(M)
|
||||
for _ in range(max_n):
|
||||
# Compute function and jacobian on current estimate
|
||||
r, J = fun(b)
|
||||
|
||||
# Update estimate, WLS https://en.wikipedia.org/wiki/Weighted_least_squares
|
||||
delta = np.linalg.pinv(J.T.dot(W).dot(J)).dot(J.T).dot(W) @ r
|
||||
b -= delta
|
||||
|
||||
# Check step size for stopping condition
|
||||
if np.linalg.norm(delta) < xtol:
|
||||
break
|
||||
|
||||
r, J = fun(b)
|
||||
Mb = np.linalg.pinv(J.T.dot(W).dot(J))
|
||||
x_std = np.sqrt(np.diagonal(Mb))
|
||||
return b, r, x_std
|
||||
|
||||
|
||||
def calc_pos_fix(measurements, posfix_functions=None, x0=None, signal='C1C', min_measurements=5):
|
||||
'''
|
||||
Calculates gps fix using gauss newton method
|
||||
To solve the problem a minimal of 4 measurements are required.
|
||||
If Glonass is included 5 are required to solve for the additional free variable.
|
||||
returns:
|
||||
0 -> list with positions
|
||||
1 -> pseudorange errs
|
||||
'''
|
||||
if x0 is None:
|
||||
x0 = [0, 0, 0, 0, 0]
|
||||
|
||||
if len(measurements) < min_measurements:
|
||||
return [],[],[]
|
||||
|
||||
Fx_pos = pr_residual(measurements, posfix_functions, signal=signal, no_nans=True)
|
||||
meas_cov = np.diag([meas.observables_std[signal]**2 for meas in measurements])
|
||||
|
||||
x, residual, x_std = gauss_newton(Fx_pos, x0, meas_cov)
|
||||
return x.tolist(), residual.tolist(), x_std
|
||||
|
||||
|
||||
def calc_vel_fix(measurements, est_pos, velfix_function=None, v0=None, signal='D1C', min_measurements=5):
|
||||
'''
|
||||
Calculates gps velocity fix using gauss newton method
|
||||
returns:
|
||||
0 -> list with velocities
|
||||
1 -> pseudorange_rate errs
|
||||
'''
|
||||
if v0 is None:
|
||||
v0 = [0, 0, 0, 0]
|
||||
|
||||
if len(measurements) < min_measurements:
|
||||
return [], [], []
|
||||
|
||||
Fx_vel = prr_residual(measurements, est_pos, velfix_function, signal=signal, no_nans=True)
|
||||
meas_cov = np.diag([meas.observables_std[signal]**2 for meas in measurements])
|
||||
|
||||
v, residual, x_std = gauss_newton(Fx_vel, v0, meas_cov)
|
||||
return v.tolist(), residual.tolist(), x_std
|
||||
|
||||
|
||||
def get_posfix_sympy_fun(constellation):
|
||||
# Unknowns
|
||||
x, y, z = sympy.Symbol('x'), sympy.Symbol('y'), sympy.Symbol('z')
|
||||
bc = sympy.Symbol('bc')
|
||||
bg = sympy.Symbol('bg')
|
||||
zero_theta = sympy.Symbol('zero_theta')
|
||||
var = [x, y, z, bc, bg]
|
||||
|
||||
# Knowns
|
||||
pr = sympy.Symbol('pr')
|
||||
sat_x, sat_y, sat_z = sympy.Symbol('sat_x'), sympy.Symbol('sat_y'), sympy.Symbol('sat_z')
|
||||
|
||||
theta = (EARTH_ROTATION_RATE * (pr - bc) / SPEED_OF_LIGHT)*zero_theta
|
||||
val = sympy.sqrt(
|
||||
(sat_x * sympy.cos(theta) + sat_y * sympy.sin(theta) - x) ** 2 +
|
||||
(sat_y * sympy.cos(theta) - sat_x * sympy.sin(theta) - y) ** 2 +
|
||||
(sat_z - z) ** 2
|
||||
)
|
||||
|
||||
if constellation == ConstellationId.GLONASS:
|
||||
res = val - (pr - bc - bg)
|
||||
elif constellation == ConstellationId.GPS:
|
||||
res = val - (pr - bc)
|
||||
else:
|
||||
raise NotImplementedError(f"Constellation {constellation} not supported")
|
||||
|
||||
res = [res] + [sympy.diff(res, v) for v in var]
|
||||
|
||||
return sympy.lambdify([x, y, z, bc, bg, pr, zero_theta, sat_x, sat_y, sat_z], res, modules=["numpy"])
|
||||
|
||||
|
||||
def get_velfix_sympy_func():
|
||||
# implementing this without sympy.Matrix gives a 2x speedup at generation
|
||||
|
||||
# knowns, receiver position, satellite position, satellite velocity
|
||||
ep_x, ep_y, ep_z = sympy.Symbol('ep_x'), sympy.Symbol('ep_y'), sympy.Symbol('ep_z')
|
||||
est_pos = np.array([ep_x, ep_y, ep_z])
|
||||
sp_x, sp_y, sp_z = sympy.Symbol('sp_x'), sympy.Symbol('sp_y'), sympy.Symbol('sp_z')
|
||||
sat_pos = np.array([sp_x, sp_y, sp_z])
|
||||
sv_x, sv_y, sv_z = sympy.Symbol('sv_x'), sympy.Symbol('sv_y'), sympy.Symbol('sv_z')
|
||||
sat_vel = np.array([sv_x, sv_y, sv_z])
|
||||
observables = sympy.Symbol('observables')
|
||||
|
||||
# unknown, receiver velocity
|
||||
v_x, v_y, v_z = sympy.Symbol('v_x'), sympy.Symbol('v_y'), sympy.Symbol('v_z')
|
||||
vel = np.array([v_x, v_y, v_z])
|
||||
vel_o = sympy.Symbol('vel_o')
|
||||
|
||||
loss = sat_pos - est_pos
|
||||
loss /= sympy.sqrt(loss.dot(loss))
|
||||
res = loss.dot(sat_vel - vel) - (observables - vel_o)
|
||||
|
||||
res = [res] + [sympy.diff(res, v) for v in [v_x, v_y, v_z, vel_o]]
|
||||
|
||||
return sympy.lambdify([
|
||||
ep_x, ep_y, ep_z, sp_x, sp_y, sp_z,
|
||||
sv_x, sv_y, sv_z, observables,
|
||||
v_x, v_y, v_z, vel_o
|
||||
],
|
||||
res, modules=["numpy"])
|
||||
|
||||
|
||||
def pr_residual(measurements: List[GNSSMeasurement], posfix_functions=None, signal='C1C', no_nans=False):
|
||||
|
||||
if posfix_functions is None:
|
||||
posfix_functions = {constellation: get_posfix_sympy_fun(constellation) for constellation in (ConstellationId.GPS, ConstellationId.GLONASS)}
|
||||
|
||||
def Fx_pos(inp):
|
||||
vals, gradients = [], []
|
||||
|
||||
for meas in measurements:
|
||||
if signal in meas.observables_final and np.isfinite(meas.observables_final[signal]):
|
||||
pr = meas.observables_final[signal]
|
||||
sat_pos = meas.sat_pos_final
|
||||
zero_theta = 0
|
||||
elif signal in meas.observables and np.isfinite(meas.observables[signal]) and meas.processed:
|
||||
pr = meas.observables[signal]
|
||||
pr += meas.sat_clock_err * SPEED_OF_LIGHT
|
||||
sat_pos = meas.sat_pos
|
||||
zero_theta = 1
|
||||
else:
|
||||
if not no_nans:
|
||||
vals.append(np.nan)
|
||||
gradients.append(np.nan)
|
||||
continue
|
||||
|
||||
val, *gradient = posfix_functions[meas.constellation_id](*inp, pr, zero_theta, *sat_pos)
|
||||
vals.append(val)
|
||||
gradients.append(gradient)
|
||||
return np.asarray(vals), np.asarray(gradients)
|
||||
return Fx_pos
|
||||
|
||||
|
||||
def prr_residual(measurements: List[GNSSMeasurement], est_pos, velfix_function=None, signal='D1C', no_nans=False):
|
||||
|
||||
if velfix_function is None:
|
||||
velfix_function = get_velfix_sympy_func()
|
||||
|
||||
def Fx_vel(vel):
|
||||
vals, gradients = [], []
|
||||
|
||||
for meas in measurements:
|
||||
if signal not in meas.observables or not np.isfinite(meas.observables[signal]):
|
||||
if not no_nans:
|
||||
vals.append(np.nan)
|
||||
gradients.append(np.nan)
|
||||
continue
|
||||
|
||||
sat_pos = meas.sat_pos_final if meas.corrected else meas.sat_pos
|
||||
|
||||
val, *gradient = velfix_function(est_pos[0], est_pos[1], est_pos[2],
|
||||
sat_pos[0], sat_pos[1], sat_pos[2],
|
||||
meas.sat_vel[0], meas.sat_vel[1], meas.sat_vel[2],
|
||||
meas.observables[signal],
|
||||
vel[0], vel[1], vel[2], vel[3])
|
||||
vals.append(val)
|
||||
gradients.append(gradient)
|
||||
|
||||
return np.asarray(vals), np.asarray(gradients)
|
||||
return Fx_vel
|
||||
+13
-112
@@ -92,11 +92,14 @@ class GNSSMeasurement:
|
||||
self.processed = True
|
||||
return True
|
||||
|
||||
def correct(self, est_pos, dog, allow_incomplete_delay=False):
|
||||
def correct(self, est_pos, dog, correct_delay=True):
|
||||
for obs in self.observables:
|
||||
if obs[0] == 'C': # or obs[0] == 'L':
|
||||
delay = dog.get_delay(self.prn, self.recv_time, est_pos, signal=obs)
|
||||
if delay is not None and (allow_incomplete_delay or delay != 0):
|
||||
if correct_delay:
|
||||
delay = dog.get_delay(self.prn, self.recv_time, est_pos, signal=obs)
|
||||
else:
|
||||
delay = 0.0
|
||||
if delay is not None:
|
||||
self.observables_final[obs] = (self.observables[obs] +
|
||||
self.sat_clock_err*constants.SPEED_OF_LIGHT -
|
||||
delay)
|
||||
@@ -147,10 +150,10 @@ def process_measurements(measurements: List[GNSSMeasurement], dog) -> List[GNSSM
|
||||
return proc_measurements
|
||||
|
||||
|
||||
def correct_measurements(measurements: List[GNSSMeasurement], est_pos, dog, allow_incomplete_delay=False) -> List[GNSSMeasurement]:
|
||||
def correct_measurements(measurements: List[GNSSMeasurement], est_pos, dog, correct_delay=True) -> List[GNSSMeasurement]:
|
||||
corrected_measurements = []
|
||||
for meas in measurements:
|
||||
if meas.correct(est_pos, dog, allow_incomplete_delay):
|
||||
if meas.correct(est_pos, dog, correct_delay=correct_delay):
|
||||
corrected_measurements.append(meas)
|
||||
return corrected_measurements
|
||||
|
||||
@@ -195,12 +198,12 @@ def read_raw_qcom(report):
|
||||
time_bias_ms = report.timeBias
|
||||
else:
|
||||
raise NotImplementedError('Only GPS (0), SBAS (1) and GLONASS (6) are supported from qcom, not:', {report.source})
|
||||
#print(recv_time, report.source, time_bias_ms, dr)
|
||||
# logging.debug(recv_time, report.source, time_bias_ms, dr)
|
||||
measurements = []
|
||||
for i in report.sv:
|
||||
nmea_id = i.svId # todo change svId to nmea_id in cereal message. Or better: change the publisher to publish correct svId's, since constellation id is also given
|
||||
if nmea_id == 255:
|
||||
# todo nmea_id is not valid. Fix publisher
|
||||
# TODO nmea_id is not valid. Fix publisher
|
||||
continue
|
||||
_, sv_id = get_constellation_and_sv_id(nmea_id)
|
||||
if not i.measurementStatus.measurementNotUsable and i.measurementStatus.satelliteTimeIsKnown:
|
||||
@@ -217,9 +220,9 @@ def read_raw_qcom(report):
|
||||
observables_std['D1C'] = i.unfilteredSpeedUncertainty
|
||||
observables['S1C'] = (i.carrierNoise/100.) if i.carrierNoise != 0 else np.nan
|
||||
observables['L1C'] = np.nan
|
||||
#print(" %.5f %3d %10.2f %7.2f %7.2f %.2f %d" % (recv_time.tow, nmea_id,
|
||||
# observables['C1C'], observables_std['C1C'],
|
||||
# observables_std['D1C'], observables['S1C'], i.latency), i.observationState, i.measurementStatus.fineOrCoarseVelocity)
|
||||
# logging.debug(" %.5f %3d %10.2f %7.2f %7.2f %.2f %d" % (recv_time.tow, nmea_id,
|
||||
# observables['C1C'], observables_std['C1C'],
|
||||
# observables_std['D1C'], observables['S1C'], i.latency), i.observationState, i.measurementStatus.fineOrCoarseVelocity)
|
||||
glonass_freq = (i.glonassFrequencyIndex - 7) if constellation_id == ConstellationId.GLONASS else np.nan
|
||||
measurements.append(GNSSMeasurement(constellation_id, sv_id,
|
||||
recv_time.week,
|
||||
@@ -292,108 +295,6 @@ def read_rinex_obs(obsdata) -> List[List[GNSSMeasurement]]:
|
||||
return measurements
|
||||
|
||||
|
||||
def calc_pos_fix(measurements, x0=[0, 0, 0, 0, 0], no_weight=False, signal='C1C', min_measurements=6):
|
||||
'''
|
||||
Calculates gps fix with WLS optimizer
|
||||
|
||||
returns:
|
||||
0 -> list with positions
|
||||
1 -> pseudorange errs
|
||||
'''
|
||||
import scipy.optimize as opt # Only use scipy here
|
||||
|
||||
n = len(measurements)
|
||||
if n < min_measurements:
|
||||
return []
|
||||
|
||||
Fx_pos = pr_residual(measurements, signal=signal, no_weight=no_weight, no_nans=True)
|
||||
opt_pos = opt.least_squares(Fx_pos, x0).x
|
||||
return opt_pos, Fx_pos(opt_pos, no_weight=True)
|
||||
|
||||
|
||||
def calc_vel_fix(measurements, est_pos, v0=[0, 0, 0, 0], no_weight=False, signal='D1C'):
|
||||
'''
|
||||
Calculates gps velocity fix with WLS optimizer
|
||||
|
||||
returns:
|
||||
0 -> list with velocities
|
||||
1 -> pseudorange_rate errs
|
||||
'''
|
||||
import scipy.optimize as opt # Only use scipy here
|
||||
|
||||
n = len(measurements)
|
||||
if n < 6:
|
||||
return []
|
||||
|
||||
Fx_vel = prr_residual(measurements, est_pos, signal=signal, no_weight=no_weight, no_nans=True)
|
||||
opt_vel = opt.least_squares(Fx_vel, v0).x
|
||||
return opt_vel, Fx_vel(opt_vel, no_weight=True)
|
||||
|
||||
|
||||
def pr_residual(measurements: List[GNSSMeasurement], signal='C1C', no_weight=False, no_nans=False):
|
||||
# solve for pos
|
||||
def Fx_pos(xxx_todo_changeme, no_weight=no_weight):
|
||||
(x, y, z, bc, bg) = xxx_todo_changeme
|
||||
rows = []
|
||||
|
||||
for meas in measurements:
|
||||
if signal in meas.observables_final and np.isfinite(meas.observables_final[signal]):
|
||||
pr = meas.observables_final[signal]
|
||||
sat_pos = meas.sat_pos_final
|
||||
theta = 0
|
||||
elif signal in meas.observables and np.isfinite(meas.observables[signal]) and meas.processed:
|
||||
pr = meas.observables[signal]
|
||||
pr += meas.sat_clock_err * constants.SPEED_OF_LIGHT
|
||||
sat_pos = meas.sat_pos
|
||||
theta = constants.EARTH_ROTATION_RATE * (pr - bc) / constants.SPEED_OF_LIGHT
|
||||
else:
|
||||
if not no_nans:
|
||||
rows.append(np.nan)
|
||||
continue
|
||||
if no_weight:
|
||||
weight = 1
|
||||
else:
|
||||
weight = (1 / meas.observables_std[signal])
|
||||
|
||||
val = np.sqrt(
|
||||
(sat_pos[0] * np.cos(theta) + sat_pos[1] * np.sin(theta) - x) ** 2 +
|
||||
(sat_pos[1] * np.cos(theta) - sat_pos[0] * np.sin(theta) - y) ** 2 +
|
||||
(sat_pos[2] - z) ** 2
|
||||
)
|
||||
if meas.constellation_id == ConstellationId.GLONASS:
|
||||
rows.append(weight * (val - (pr - bc - bg)))
|
||||
elif meas.constellation_id == ConstellationId.GPS:
|
||||
rows.append(weight * (val - (pr - bc)))
|
||||
return rows
|
||||
return Fx_pos
|
||||
|
||||
|
||||
def prr_residual(measurements, est_pos, signal='D1C', no_weight=False, no_nans=False):
|
||||
# solve for vel
|
||||
def Fx_vel(vel, no_weight=no_weight):
|
||||
rows = []
|
||||
for meas in measurements:
|
||||
if signal not in meas.observables or not np.isfinite(meas.observables[signal]):
|
||||
if not no_nans:
|
||||
rows.append(np.nan)
|
||||
continue
|
||||
if meas.corrected:
|
||||
sat_pos = meas.sat_pos_final
|
||||
else:
|
||||
sat_pos = meas.sat_pos
|
||||
if no_weight:
|
||||
weight = 1
|
||||
else:
|
||||
weight = (1 / meas.observables[signal])
|
||||
los_vector = (sat_pos - est_pos[0:3]
|
||||
) / np.linalg.norm(sat_pos - est_pos[0:3])
|
||||
rows.append(
|
||||
weight * ((meas.sat_vel - vel[0:3]).dot(los_vector) -
|
||||
(meas.observables[signal] - vel[3])))
|
||||
return rows
|
||||
return Fx_vel
|
||||
|
||||
|
||||
def get_Q(recv_pos, sat_positions):
|
||||
local = LocalCoord.from_ecef(recv_pos)
|
||||
sat_positions_rel = local.ecef2ned(sat_positions)
|
||||
|
||||
+3
-3
@@ -11,7 +11,7 @@
|
||||
|
||||
import datetime
|
||||
import numpy as np
|
||||
|
||||
import logging
|
||||
|
||||
def floatornan(x):
|
||||
if x == '' or x[-1] == ' ':
|
||||
@@ -49,10 +49,10 @@ class RINEXFile:
|
||||
self._read_header(f)
|
||||
self._read_data(f)
|
||||
except TypeError:
|
||||
print("TypeError, file likely not downloaded.")
|
||||
logging.exception("TypeError, file likely not downloaded.")
|
||||
raise DownloadError("file download failure")
|
||||
except FileNotFoundError:
|
||||
print("File not found in directory.")
|
||||
logging.exception("File not found in directory.")
|
||||
raise DownloadError("file missing in download cache")
|
||||
def _read_header(self, f):
|
||||
version_line = padline(f.readline(), 80)
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ def saast(pos, el, humi=0.75, temp0=15.0):
|
||||
:return: tropospheric delay (m)
|
||||
"""
|
||||
pos_rad = ecef2geodetic(pos, radians=True)
|
||||
if pos_rad[2] < -100.0 or 1E4 < pos_rad[2] or el <= 0:
|
||||
if pos_rad[2] < -1E3 or 1E4 < pos_rad[2] or el <= 0:
|
||||
return 0.0
|
||||
|
||||
# /* standard atmosphere */
|
||||
|
||||
+1
-1
@@ -74,7 +74,7 @@ function launch {
|
||||
|
||||
# handle pythonpath
|
||||
ln -sfn $(pwd) /data/pythonpath
|
||||
export PYTHONPATH="$PWD:$PWD/pyextra"
|
||||
export PYTHONPATH="$PWD"
|
||||
|
||||
# hardware specific init
|
||||
agnos_init
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ export OPENBLAS_NUM_THREADS=1
|
||||
export VECLIB_MAXIMUM_THREADS=1
|
||||
|
||||
if [ -z "$AGNOS_VERSION" ]; then
|
||||
export AGNOS_VERSION="5.2"
|
||||
export AGNOS_VERSION="7.1"
|
||||
fi
|
||||
|
||||
if [ -z "$PASSIVE" ]; then
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
.sconsign.dblite
|
||||
|
||||
can/*.so
|
||||
can/*.a
|
||||
can/build/
|
||||
can/obj/
|
||||
can/packer_pyx.cpp
|
||||
|
||||
@@ -255,7 +255,7 @@ BO_ 829 LKAS_HUD: 5 ADAS
|
||||
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_ BOH_2 : 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
|
||||
|
||||
@@ -255,7 +255,7 @@ BO_ 829 LKAS_HUD: 5 ADAS
|
||||
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_ BOH_2 : 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
|
||||
|
||||
@@ -357,7 +357,7 @@ BO_ 13274 LKAS_HUD_A: 5 ADAS
|
||||
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_ BOH_2 : 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_ SET_ME_X01 : 20|1@0+ (1,0) [0|1] "" BDY
|
||||
@@ -378,7 +378,7 @@ BO_ 13275 LKAS_HUD_B: 8 ADAS
|
||||
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_ BOH_2 : 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_ SET_ME_X01 : 20|1@0+ (1,0) [0|1] "" BDY
|
||||
@@ -436,7 +436,7 @@ BO_ 829 LKAS_HUD: 5 ADAS
|
||||
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_ BOH_2 : 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
|
||||
|
||||
@@ -5,7 +5,14 @@ import os
|
||||
envDBC = env.Clone()
|
||||
dbc_file_path = '-DDBC_FILE_PATH=\'"%s"\'' % (envDBC.Dir("..").abspath)
|
||||
envDBC['CXXFLAGS'] += [dbc_file_path]
|
||||
libdbc = envDBC.SharedLibrary('libdbc', ["dbc.cc", "parser.cc", "packer.cc", "common.cc"], LIBS=[common, "capnp", "kj", "zmq"])
|
||||
src = ["dbc.cc", "parser.cc", "packer.cc", "common.cc"]
|
||||
libs = [common, "capnp", "kj", "zmq"]
|
||||
|
||||
# shared library for openpilot
|
||||
libdbc = envDBC.SharedLibrary('libdbc', src, LIBS=libs)
|
||||
|
||||
# static library for tools like cabana
|
||||
envDBC.Library('libdbc_static', src, LIBS=libs)
|
||||
|
||||
# Build packer and parser
|
||||
lenv = envCython.Clone()
|
||||
|
||||
+23
-23
@@ -1,4 +1,5 @@
|
||||
#include "common.h"
|
||||
#include "opendbc/can/common.h"
|
||||
|
||||
|
||||
unsigned int honda_checksum(uint32_t address, const Signal &sig, const std::vector<uint8_t> &d) {
|
||||
int s = 0;
|
||||
@@ -34,7 +35,7 @@ unsigned int subaru_checksum(uint32_t address, const Signal &sig, const std::vec
|
||||
}
|
||||
|
||||
unsigned int chrysler_checksum(uint32_t address, const Signal &sig, const std::vector<uint8_t> &d) {
|
||||
/* jeep chrysler canbus checksum from http://illmatics.com/Remote%20Car%20Hacking.pdf */
|
||||
// jeep chrysler canbus checksum from http://illmatics.com/Remote%20Car%20Hacking.pdf
|
||||
uint8_t checksum = 0xFF;
|
||||
for (int j = 0; j < (d.size() - 1); j++) {
|
||||
uint8_t shift = 0x80;
|
||||
@@ -123,64 +124,64 @@ unsigned int volkswagen_mqb_checksum(uint32_t address, const Signal &sig, const
|
||||
// Look up and apply the magic final CRC padding byte, which permutes by CAN
|
||||
// address, and additionally (for SOME addresses) by the message counter.
|
||||
uint8_t counter = d[1] & 0x0F;
|
||||
switch(address) {
|
||||
switch (address) {
|
||||
case 0x86: // LWI_01 Steering Angle
|
||||
crc ^= (uint8_t[]){0x86,0x86,0x86,0x86,0x86,0x86,0x86,0x86,0x86,0x86,0x86,0x86,0x86,0x86,0x86,0x86}[counter];
|
||||
crc ^= (uint8_t[]){0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86}[counter];
|
||||
break;
|
||||
case 0x9F: // LH_EPS_03 Electric Power Steering
|
||||
crc ^= (uint8_t[]){0xF5,0xF5,0xF5,0xF5,0xF5,0xF5,0xF5,0xF5,0xF5,0xF5,0xF5,0xF5,0xF5,0xF5,0xF5,0xF5}[counter];
|
||||
crc ^= (uint8_t[]){0xF5, 0xF5, 0xF5, 0xF5, 0xF5, 0xF5, 0xF5, 0xF5, 0xF5, 0xF5, 0xF5, 0xF5, 0xF5, 0xF5, 0xF5, 0xF5}[counter];
|
||||
break;
|
||||
case 0xAD: // Getriebe_11 Automatic Gearbox
|
||||
crc ^= (uint8_t[]){0x3F,0x69,0x39,0xDC,0x94,0xF9,0x14,0x64,0xD8,0x6A,0x34,0xCE,0xA2,0x55,0xB5,0x2C}[counter];
|
||||
crc ^= (uint8_t[]){0x3F, 0x69, 0x39, 0xDC, 0x94, 0xF9, 0x14, 0x64, 0xD8, 0x6A, 0x34, 0xCE, 0xA2, 0x55, 0xB5, 0x2C}[counter];
|
||||
break;
|
||||
case 0xFD: // ESP_21 Electronic Stability Program
|
||||
crc ^= (uint8_t[]){0xB4,0xEF,0xF8,0x49,0x1E,0xE5,0xC2,0xC0,0x97,0x19,0x3C,0xC9,0xF1,0x98,0xD6,0x61}[counter];
|
||||
crc ^= (uint8_t[]){0xB4, 0xEF, 0xF8, 0x49, 0x1E, 0xE5, 0xC2, 0xC0, 0x97, 0x19, 0x3C, 0xC9, 0xF1, 0x98, 0xD6, 0x61}[counter];
|
||||
break;
|
||||
case 0x106: // ESP_05 Electronic Stability Program
|
||||
crc ^= (uint8_t[]){0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07}[counter];
|
||||
crc ^= (uint8_t[]){0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07}[counter];
|
||||
break;
|
||||
case 0x117: // ACC_10 Automatic Cruise Control
|
||||
crc ^= (uint8_t[]){0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16}[counter];
|
||||
crc ^= (uint8_t[]){0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16}[counter];
|
||||
break;
|
||||
case 0x120: // TSK_06 Drivetrain Coordinator
|
||||
crc ^= (uint8_t[]){0xC4,0xE2,0x4F,0xE4,0xF8,0x2F,0x56,0x81,0x9F,0xE5,0x83,0x44,0x05,0x3F,0x97,0xDF}[counter];
|
||||
crc ^= (uint8_t[]){0xC4, 0xE2, 0x4F, 0xE4, 0xF8, 0x2F, 0x56, 0x81, 0x9F, 0xE5, 0x83, 0x44, 0x05, 0x3F, 0x97, 0xDF}[counter];
|
||||
break;
|
||||
case 0x121: // Motor_20 Driver Throttle Inputs
|
||||
crc ^= (uint8_t[]){0xE9,0x65,0xAE,0x6B,0x7B,0x35,0xE5,0x5F,0x4E,0xC7,0x86,0xA2,0xBB,0xDD,0xEB,0xB4}[counter];
|
||||
crc ^= (uint8_t[]){0xE9, 0x65, 0xAE, 0x6B, 0x7B, 0x35, 0xE5, 0x5F, 0x4E, 0xC7, 0x86, 0xA2, 0xBB, 0xDD, 0xEB, 0xB4}[counter];
|
||||
break;
|
||||
case 0x122: // ACC_06 Automatic Cruise Control
|
||||
crc ^= (uint8_t[]){0x37,0x7D,0xF3,0xA9,0x18,0x46,0x6D,0x4D,0x3D,0x71,0x92,0x9C,0xE5,0x32,0x10,0xB9}[counter];
|
||||
crc ^= (uint8_t[]){0x37, 0x7D, 0xF3, 0xA9, 0x18, 0x46, 0x6D, 0x4D, 0x3D, 0x71, 0x92, 0x9C, 0xE5, 0x32, 0x10, 0xB9}[counter];
|
||||
break;
|
||||
case 0x126: // HCA_01 Heading Control Assist
|
||||
crc ^= (uint8_t[]){0xDA,0xDA,0xDA,0xDA,0xDA,0xDA,0xDA,0xDA,0xDA,0xDA,0xDA,0xDA,0xDA,0xDA,0xDA,0xDA}[counter];
|
||||
crc ^= (uint8_t[]){0xDA, 0xDA, 0xDA, 0xDA, 0xDA, 0xDA, 0xDA, 0xDA, 0xDA, 0xDA, 0xDA, 0xDA, 0xDA, 0xDA, 0xDA, 0xDA}[counter];
|
||||
break;
|
||||
case 0x12B: // GRA_ACC_01 Steering wheel controls for ACC
|
||||
crc ^= (uint8_t[]){0x6A,0x38,0xB4,0x27,0x22,0xEF,0xE1,0xBB,0xF8,0x80,0x84,0x49,0xC7,0x9E,0x1E,0x2B}[counter];
|
||||
crc ^= (uint8_t[]){0x6A, 0x38, 0xB4, 0x27, 0x22, 0xEF, 0xE1, 0xBB, 0xF8, 0x80, 0x84, 0x49, 0xC7, 0x9E, 0x1E, 0x2B}[counter];
|
||||
break;
|
||||
case 0x12E: // ACC_07 Automatic Cruise Control
|
||||
crc ^= (uint8_t[]){0xF8,0xE5,0x97,0xC9,0xD6,0x07,0x47,0x21,0x66,0xDD,0xCF,0x6F,0xA1,0x94,0x74,0x63}[counter];
|
||||
crc ^= (uint8_t[]){0xF8, 0xE5, 0x97, 0xC9, 0xD6, 0x07, 0x47, 0x21, 0x66, 0xDD, 0xCF, 0x6F, 0xA1, 0x94, 0x74, 0x63}[counter];
|
||||
break;
|
||||
case 0x187: // EV_Gearshift "Gear" selection data for EVs with no gearbox
|
||||
crc ^= (uint8_t[]){0x7F,0xED,0x17,0xC2,0x7C,0xEB,0x44,0x21,0x01,0xFA,0xDB,0x15,0x4A,0x6B,0x23,0x05}[counter];
|
||||
crc ^= (uint8_t[]){0x7F, 0xED, 0x17, 0xC2, 0x7C, 0xEB, 0x44, 0x21, 0x01, 0xFA, 0xDB, 0x15, 0x4A, 0x6B, 0x23, 0x05}[counter];
|
||||
break;
|
||||
case 0x30C: // ACC_02 Automatic Cruise Control
|
||||
crc ^= (uint8_t[]){0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F}[counter];
|
||||
crc ^= (uint8_t[]){0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F}[counter];
|
||||
break;
|
||||
case 0x30F: // SWA_01 Lane Change Assist (SpurWechselAssistent)
|
||||
crc ^= (uint8_t[]){0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C}[counter];
|
||||
crc ^= (uint8_t[]){0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C}[counter];
|
||||
break;
|
||||
case 0x324: // ACC_04 Automatic Cruise Control
|
||||
crc ^= (uint8_t[]){0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27}[counter];
|
||||
crc ^= (uint8_t[]){0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27}[counter];
|
||||
break;
|
||||
case 0x3C0: // Klemmen_Status_01 ignition and starting status
|
||||
crc ^= (uint8_t[]){0xC3,0xC3,0xC3,0xC3,0xC3,0xC3,0xC3,0xC3,0xC3,0xC3,0xC3,0xC3,0xC3,0xC3,0xC3,0xC3}[counter];
|
||||
crc ^= (uint8_t[]){0xC3, 0xC3, 0xC3, 0xC3, 0xC3, 0xC3, 0xC3, 0xC3, 0xC3, 0xC3, 0xC3, 0xC3, 0xC3, 0xC3, 0xC3, 0xC3}[counter];
|
||||
break;
|
||||
case 0x65D: // ESP_20 Electronic Stability Program
|
||||
crc ^= (uint8_t[]){0xAC,0xB3,0xAB,0xEB,0x7A,0xE1,0x3B,0xF7,0x73,0xBA,0x7C,0x9E,0x06,0x5F,0x02,0xD9}[counter];
|
||||
crc ^= (uint8_t[]){0xAC, 0xB3, 0xAB, 0xEB, 0x7A, 0xE1, 0x3B, 0xF7, 0x73, 0xBA, 0x7C, 0x9E, 0x06, 0x5F, 0x02, 0xD9}[counter];
|
||||
break;
|
||||
default: // As-yet undefined CAN message, CRC check expected to fail
|
||||
printf("Attempt to CRC check undefined Volkswagen message 0x%02X\n", address);
|
||||
crc ^= (uint8_t[]){0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}[counter];
|
||||
crc ^= (uint8_t[]){0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}[counter];
|
||||
break;
|
||||
}
|
||||
crc = crc8_lut_8h2f[crc];
|
||||
@@ -221,7 +222,6 @@ unsigned int pedal_checksum(uint32_t address, const Signal &sig, const std::vect
|
||||
}
|
||||
|
||||
unsigned int hkg_can_fd_checksum(uint32_t address, const Signal &sig, const std::vector<uint8_t> &d) {
|
||||
|
||||
uint16_t crc = 0;
|
||||
|
||||
for (int i = 2; i < d.size(); i++) {
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
#include "common_dbc.h"
|
||||
#include <capnp/dynamic.h>
|
||||
#include <capnp/serialize.h>
|
||||
|
||||
@@ -12,6 +13,8 @@
|
||||
#include "cereal/gen/cpp/log.capnp.h"
|
||||
#endif
|
||||
|
||||
#include "opendbc/can/common_dbc.h"
|
||||
|
||||
#define INFO printf
|
||||
#define WARN printf
|
||||
#define DEBUG(...)
|
||||
@@ -34,6 +37,7 @@ unsigned int pedal_checksum(uint32_t address, const Signal &sig, const std::vect
|
||||
|
||||
class MessageState {
|
||||
public:
|
||||
std::string name;
|
||||
uint32_t address;
|
||||
unsigned int size;
|
||||
|
||||
@@ -77,11 +81,12 @@ public:
|
||||
CANParser(int abus, const std::string& dbc_name, bool ignore_checksum, bool ignore_counter);
|
||||
#ifndef DYNAMIC_CAPNP
|
||||
void update_string(const std::string &data, bool sendcan);
|
||||
void update_strings(const std::vector<std::string> &data, std::vector<SignalValue> &vals, bool sendcan);
|
||||
void UpdateCans(uint64_t sec, const capnp::List<cereal::CanData>::Reader& cans);
|
||||
#endif
|
||||
void UpdateCans(uint64_t sec, const capnp::DynamicStruct::Reader& cans);
|
||||
void UpdateValid(uint64_t sec);
|
||||
std::vector<SignalValue> query_latest();
|
||||
void query_latest(std::vector<SignalValue> &vals, uint64_t last_ts = 0);
|
||||
};
|
||||
|
||||
class CANPacker {
|
||||
|
||||
@@ -3,10 +3,8 @@
|
||||
|
||||
from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t
|
||||
from libcpp cimport bool
|
||||
from libcpp.map cimport map
|
||||
from libcpp.string cimport string
|
||||
from libcpp.vector cimport vector
|
||||
from libcpp.unordered_set cimport unordered_set
|
||||
|
||||
|
||||
ctypedef unsigned int (*calc_checksum_type)(uint32_t, const Signal&, const vector[uint8_t] &)
|
||||
@@ -54,13 +52,13 @@ cdef extern from "common_dbc.h":
|
||||
uint32_t address
|
||||
string name
|
||||
|
||||
|
||||
cdef struct MessageParseOptions:
|
||||
uint32_t address
|
||||
int check_frequency
|
||||
|
||||
cdef struct SignalValue:
|
||||
uint32_t address
|
||||
uint64_t ts_nanos
|
||||
string name
|
||||
double value
|
||||
vector[double] all_values
|
||||
@@ -71,15 +69,14 @@ cdef extern from "common_dbc.h":
|
||||
|
||||
|
||||
cdef extern from "common.h":
|
||||
cdef const DBC* dbc_lookup(const string);
|
||||
cdef const DBC* dbc_lookup(const string)
|
||||
|
||||
cdef cppclass CANParser:
|
||||
bool can_valid
|
||||
bool bus_timeout
|
||||
CANParser(int, string, vector[MessageParseOptions], vector[SignalParseOptions])
|
||||
void update_string(string, bool)
|
||||
vector[SignalValue] query_latest()
|
||||
void update_strings(vector[string]&, vector[SignalValue]&, bool)
|
||||
|
||||
cdef cppclass CANPacker:
|
||||
CANPacker(string)
|
||||
vector[uint8_t] pack(uint32_t, vector[SignalPackValue])
|
||||
vector[uint8_t] pack(uint32_t, vector[SignalPackValue]&)
|
||||
|
||||
@@ -24,6 +24,7 @@ struct MessageParseOptions {
|
||||
|
||||
struct SignalValue {
|
||||
uint32_t address;
|
||||
uint64_t ts_nanos;
|
||||
std::string name;
|
||||
double value; // latest value
|
||||
std::vector<double> all_values; // all values from this cycle
|
||||
@@ -72,6 +73,17 @@ struct DBC {
|
||||
std::vector<Val> vals;
|
||||
};
|
||||
|
||||
typedef struct ChecksumState {
|
||||
int checksum_size;
|
||||
int counter_size;
|
||||
int checksum_start_bit;
|
||||
int counter_start_bit;
|
||||
bool little_endian;
|
||||
SignalType checksum_type;
|
||||
unsigned int (*calc_checksum)(uint32_t address, const Signal &sig, const std::vector<uint8_t> &d);
|
||||
} ChecksumState;
|
||||
|
||||
DBC* dbc_parse(const std::string& dbc_path);
|
||||
DBC* dbc_parse_from_stream(const std::string &dbc_name, std::istream &stream, ChecksumState *checksum = nullptr, bool allow_duplicate_msg_name=false);
|
||||
const DBC* dbc_lookup(const std::string& dbc_name);
|
||||
std::vector<std::string> get_dbc_names();
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user