Compare commits

..

9 Commits

Author SHA1 Message Date
Kumar
458dd1a527 Merge pull request #134 from Hikari1023/patch-9
Fix DLP laneless bug
2022-04-16 08:18:59 -07:00
Hikari1023
b03486fa10 Fix DLP laneless bug 2022-04-16 22:21:55 +08:00
Rick Lan
af80cdd94a dragonpilot for 0.8.12-4 2022-04-01 12:08:37 +08:00
rav4kumar
35f5828690 dragonpilot for 0.8.12-3 2022-01-31 22:14:41 -07:00
Adeeb Shihadeh
a965de3c96 Hotfix: revert "Qt/SetingWindow: faster initialization and painting (#21764)"
This reverts commit f482354e4e.
2021-12-15 10:07:42 -08:00
Vehicle Researcher
bc7d21687a openpilot v0.8.12 release 2021-12-14 04:51:54 +00:00
Adeeb Shihadeh
ce9e739428 Hotfix: fix controls mismatch on Honda Ridgeline (#23090) 2021-12-01 17:24:09 -08:00
Adeeb Shihadeh
1e0ef417c3 UI: fix cameraview crash after going offroad in settings window (#23009) (#23068)
Co-authored-by: Dean Lee <deanlee3@gmail.com>
2021-11-29 15:49:41 -08:00
Vehicle Researcher
bf338bf5e9 openpilot v0.8.11 release 2021-11-29 13:48:50 -08:00
437 changed files with 9240 additions and 25462 deletions

10
.gitignore vendored
View File

@@ -41,8 +41,6 @@ selfdrive/boardd/boardd
selfdrive/logcatd/logcatd
selfdrive/mapd/default_speeds_by_region.json
selfdrive/proclogd/proclogd
selfdrive/test/longitudinal_maneuvers/out
selfdrive/visiond/visiond
selfdrive/loggerd/loggerd
@@ -59,6 +57,7 @@ one
openpilot
notebooks
xx
yy
hyperthneed
panda_jungle
provisioning
@@ -78,5 +77,10 @@ selfdrive/modeld/thneed/compile
models/*.thneed
*.bz2
build/
!**/.gitkeep
!third_party/mapbox-gl-native-qt/aarch64/*.so
!third_party/mapbox-gl-native-qt/jarch64/*.so
!third_party/mapbox-gl-native-qt/jarch64/*.so

View File

@@ -1,3 +1,27 @@
dragonpilot 0.8.12-4
========================
* Fixed bins for C3.
dragonpilot 0.8.12-3
========================
* Bug fixes.
* ADDED: Car Selector for C3.
* ADDED: ColorBlind mode eon only. (thanks to @ihsakashi)
* TUNNING: Toyota long improvement.
* Reimplement: Following Distance and added @krkeegan implementation (toyota only with sdsu/tss2).
dragonpilot 0.8.12-2
========================
* Bug fixes.
* ADDED: FTP to easily manage storage.
* Readded: camera offset, path offset and autoshutdown.
dragonpilot 0.8.12-1
========================
* Based on openpilot 0.8.12 devel.
* ADDED: Support for no gps (mr.one panda).
* Reimplement: camera offset, path offset, nav for c2 and autoshutdown.
dragonpilot 0.8.10-4
========================
* FIXED: Allow gas press. (Thanks to @loveloveses)

View File

@@ -28,6 +28,8 @@ dinglx | [dingliangxue](ht
eyezenheim | [eyezenheim](https://github.com/eyezenheim)
Jason Wen | [sunnyhaibin](https://github.com/sunnyhaibin)
kegman | [kegman](https://github.com/kegman)
krkeegan | [krkeegan](https://github.com/krkeegan)
ihsakashi | [krkeegan](https://github.com/ihsakashi)
lijunhao731 | [lijunhao731](https://github.com/lijunhao731)
lirudy | [lirudy](https://github.com/lirudy)
LOVEChen | [LOVEChen](https://github.com/LOVEChen)

121
Jenkinsfile vendored
View File

@@ -1,7 +1,7 @@
def phone(String ip, String step_label, String cmd) {
withCredentials([file(credentialsId: 'id_rsa', variable: 'key_file')]) {
def ssh_cmd = """
ssh -tt -o StrictHostKeyChecking=no -i ${key_file} -p 8022 'comma@${ip}' /usr/bin/bash <<'EOF'
ssh -tt -o StrictHostKeyChecking=no -i ${key_file} 'comma@${ip}' /usr/bin/bash <<'END'
set -e
@@ -29,7 +29,7 @@ cd ${env.TEST_DIR} || true
${cmd}
exit 0
EOF"""
END"""
sh script: ssh_cmd, label: step_label
}
@@ -37,7 +37,7 @@ EOF"""
def phone_steps(String device_type, steps) {
lock(resource: "", label: device_type, inversePrecedence: true, variable: 'device_ip', quantity: 1) {
timeout(time: 150, unit: 'MINUTES') {
timeout(time: 60, unit: 'MINUTES') {
phone(device_ip, "git checkout", readFile("selfdrive/test/setup_device_ci.sh"),)
steps.each { item ->
phone(device_ip, item[0], item[1])
@@ -53,42 +53,33 @@ pipeline {
SOURCE_DIR = "/data/openpilot_source/"
}
options {
timeout(time: 3, unit: 'HOURS')
timeout(time: 4, unit: 'HOURS')
}
stages {
stage('Build release2') {
agent {
docker {
image 'python:3.7.3'
args '--user=root'
}
}
stage('build releases') {
when {
branch 'devel-staging'
}
steps {
phone_steps("eon-build", [
["build release2-staging & dashcam-staging", "PUSH=1 $SOURCE_DIR/release/build_release.sh"],
])
}
}
stage('Build release3') {
agent {
docker {
image 'python:3.7.3'
args '--user=root'
parallel {
stage('release2') {
agent { docker { image 'ghcr.io/commaai/alpine-ssh'; args '--user=root' } }
steps {
phone_steps("eon-build", [
["build release2-staging & dashcam-staging", "PUSH=1 $SOURCE_DIR/release/build_release.sh"],
])
}
}
stage('release3') {
agent { docker { image 'ghcr.io/commaai/alpine-ssh'; args '--user=root' } }
steps {
phone_steps("tici", [
["build release3-staging & dashcam3-staging", "PUSH=1 $SOURCE_DIR/release/build_release.sh"],
])
}
}
}
when {
branch 'devel-staging'
}
steps {
phone_steps("tici", [
["build release3-staging & dashcam3-staging", "PUSH=1 $SOURCE_DIR/release/build_release.sh"],
])
}
}
@@ -105,50 +96,15 @@ pipeline {
}
stages {
/*
stage('PC tests') {
agent {
dockerfile {
filename 'Dockerfile.openpilotci'
args '--privileged --shm-size=1G --user=root'
}
}
stages {
stage('Build') {
steps {
sh 'scons -j$(nproc)'
}
}
}
post {
always {
// fix permissions since docker runs as another user
sh "chmod -R 777 ."
}
}
}
*/
stage('On-device Tests') {
agent {
docker {
/*
filename 'Dockerfile.ondevice_ci'
args "--privileged -v /dev:/dev --shm-size=1G --user=root"
*/
image 'python:3.7.3'
args '--user=root'
}
}
agent { docker { image 'ghcr.io/commaai/alpine-ssh'; args '--user=root' } }
stages {
stage('parallel tests') {
parallel {
stage('Devel Tests') {
stage('C2: build') {
steps {
phone_steps("eon-build", [
["build devel", "cd $SOURCE_DIR/release && EXTRA_FILES='tools/' ./build_devel.sh"],
["build master-ci", "cd $SOURCE_DIR/release && EXTRA_FILES='tools/' ./build_devel.sh"],
["build openpilot", "cd selfdrive/manager && ./build.py"],
["test manager", "python selfdrive/manager/test/test_manager.py"],
["onroad tests", "cd selfdrive/test/ && ./test_onroad.py"],
@@ -157,7 +113,7 @@ pipeline {
}
}
stage('Replay Tests') {
stage('C2: replay') {
steps {
phone_steps("eon2", [
["build", "cd selfdrive/manager && ./build.py"],
@@ -166,7 +122,7 @@ pipeline {
}
}
stage('HW + Unit Tests') {
stage('C2: HW + Unit Tests') {
steps {
phone_steps("eon", [
["build", "cd selfdrive/manager && ./build.py"],
@@ -201,29 +157,33 @@ pipeline {
}
*/
stage('tici Build') {
stage('C3: build') {
environment {
R3_PUSH = "${env.BRANCH_NAME == 'master' ? '1' : ' '}"
}
steps {
phone_steps("tici", [
["build", "cd selfdrive/manager && ./build.py"],
["build master-ci", "cd $SOURCE_DIR/release && EXTRA_FILES='tools/' ./build_devel.sh"],
["build openpilot", "cd selfdrive/manager && ./build.py"],
["test manager", "python selfdrive/manager/test/test_manager.py"],
["onroad tests", "cd selfdrive/test/ && ./test_onroad.py"],
["test car interfaces", "cd selfdrive/car/tests/ && ./test_car_interfaces.py"],
])
}
}
stage('Unit Tests (tici)') {
stage('C3: HW + Unit Tests') {
steps {
phone_steps("tici2", [
["build", "cd selfdrive/manager && ./build.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"],
])
}
}
stage('EON camerad') {
stage('C2: camerad') {
steps {
phone_steps("eon-party", [
["build", "cd selfdrive/manager && ./build.py"],
@@ -233,7 +193,7 @@ pipeline {
}
}
stage('tici camerad') {
stage('C3: camerad') {
steps {
phone_steps("tici-party", [
["build", "cd selfdrive/manager && ./build.py"],
@@ -243,6 +203,15 @@ pipeline {
}
}
stage('C3: replay') {
steps {
phone_steps("tici-party", [
["build", "cd selfdrive/manager && ./build.py"],
["model replay", "cd selfdrive/test/process_replay && ./model_replay.py"],
])
}
}
}
}

View File

@@ -1,4 +1,4 @@
![](https://user-images.githubusercontent.com/37757984/127420744-89ca219c-8f8e-46d3-bccf-c1cb53b81bb1.png)
![](https://i.imgur.com/b0ZyIx5.jpg)
Table of Contents
=======================
@@ -17,20 +17,20 @@ Table of Contents
What is openpilot?
------
[openpilot](http://github.com/commaai/openpilot) is an open source driver assistance system. Currently, openpilot performs the functions of Adaptive Cruise Control (ACC), Automated Lane Centering (ALC), Forward Collision Warning (FCW) and Lane Departure Warning (LDW) for a growing variety of [supported car makes, models and model years](docs/CARS.md). In addition, while openpilot is engaged, a camera based Driver Monitoring (DM) feature alerts distracted and asleep drivers. See more about [the vehicle integration and limitations here](docs/INTEGRATION.md).
[openpilot](http://github.com/commaai/openpilot) is an open source driver assistance system. Currently, openpilot performs the functions of Adaptive Cruise Control (ACC), Automated Lane Centering (ALC), Forward Collision Warning (FCW) and Lane Departure Warning (LDW) for a growing variety of [supported car makes, models and model years](docs/CARS.md). In addition, while openpilot is engaged, a camera based Driver Monitoring (DM) feature alerts distracted and asleep drivers. See more about [the vehicle integration](docs/INTEGRATION.md) and [limitations](docs/LIMITATIONS.md).
<table>
<tr>
<td><a href="https://www.youtube.com/watch?v=mgAbfr42oI8" title="YouTube" rel="noopener"><img src="https://i.imgur.com/kAtT6Ei.png"></a></td>
<td><a href="https://www.youtube.com/watch?v=394rJKeh76k" title="YouTube" rel="noopener"><img src="https://i.imgur.com/lTt8cS2.png"></a></td>
<td><a href="https://www.youtube.com/watch?v=1iNOc3cq8cs" title="YouTube" rel="noopener"><img src="https://i.imgur.com/ANnuSpe.png"></a></td>
<td><a href="https://www.youtube.com/watch?v=Vr6NgrB-zHw" title="YouTube" rel="noopener"><img src="https://i.imgur.com/Qypanuq.png"></a></td>
<td><a href="https://youtu.be/NmBfgOanCyk" title="Video By Greer Viau"><img src="https://i.imgur.com/1w8c6d2.jpg"></a></td>
<td><a href="https://youtu.be/VHKyqZ7t8Gw" title="Video By Logan LeGrand"><img src="https://i.imgur.com/LnBucik.jpg"></a></td>
<td><a href="https://youtu.be/VxiR4iyBruo" title="Video By Charlie Kim"><img src="https://i.imgur.com/4Qoy48c.jpg"></a></td>
<td><a href="https://youtu.be/-IkImTe1NYE" title="Video By Aragon"><img src="https://i.imgur.com/04VNzPf.jpg"></a></td>
</tr>
<tr>
<td><a href="https://www.youtube.com/watch?v=Ug41KIKF0oo" title="YouTube" rel="noopener"><img src="https://i.imgur.com/3caZ7xM.png"></a></td>
<td><a href="https://www.youtube.com/watch?v=NVR_CdG1FRg" title="YouTube" rel="noopener"><img src="https://i.imgur.com/bAZOwql.png"></a></td>
<td><a href="https://www.youtube.com/watch?v=tkEvIdzdfUE" title="YouTube" rel="noopener"><img src="https://i.imgur.com/EFINEzG.png"></a></td>
<td><a href="https://www.youtube.com/watch?v=_P-N1ewNne4" title="YouTube" rel="noopener"><img src="https://i.imgur.com/gAyAq22.png"></a></td>
<td><a href="https://youtu.be/iIUICQkdwFQ" title="Video By Logan LeGrand"><img src="https://i.imgur.com/b1LHQTy.jpg"></a></td>
<td><a href="https://youtu.be/XOsa0FsVIsg" title="Video By PinoyDrives"><img src="https://i.imgur.com/6FG0Bd8.jpg"></a></td>
<td><a href="https://youtu.be/bCwcJ98R_Xw" title="Video By JS"><img src="https://i.imgur.com/zO18CbW.jpg"></a></td>
<td><a href="https://youtu.be/BQ0tF3MTyyc" title="Video By Tsai-Fi"><img src="https://i.imgur.com/eZzelq3.jpg"></a></td>
</tr>
</table>
@@ -40,7 +40,7 @@ Running in a car
To use openpilot in a car, you need four things
* This software. It's free and available right here.
* One of [the 140+ 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 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.
* A supported device to run this software. This can be a [comma two](https://comma.ai/shop/products/two), [comma three](https://comma.ai/shop/products/three), or if you like to experiment, a [Ubuntu computer with webcams](https://github.com/commaai/openpilot/tree/master/tools/webcam).
* A way to connect to your car. With a comma two or three, you need only a [car harness](https://comma.ai/shop/products/car-harness). With an EON Gold or PC, you also need a [black panda](https://comma.ai/shop/products/panda).
@@ -61,6 +61,8 @@ Community and Contributing
openpilot is developed by [comma](https://comma.ai/) and by users like you. We welcome both pull requests and issues on [GitHub](http://github.com/commaai/openpilot). Bug fixes and new car ports are encouraged. Check out [the contributing docs](docs/CONTRIBUTING.md).
Documentation related to openpilot development can be found on [docs.comma.ai](https://docs.comma.ai). Information about running openpilot (e.g. FAQ, fingerprinting, troubleshooting, custom forks, community hardware) should go on the [wiki](https://github.com/commaai/openpilot/wiki).
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/).

View File

@@ -1,3 +1,36 @@
Version 0.8.12 (2021-12-15)
========================
* New driving model
* Improved behavior around exits
* Better pose accuracy at high speeds, allowing max speed of 90mph
* Fully incorporated comma three data into all parts of training stack
* Improved follow distance
* Better longitudinal policy, especially in low speed traffic
* New alert sounds
* AGNOS 3
* Display burn in mitigation
* Improved audio amplifier configuration
* System reliability improvements
* Update Python to 3.8.10
* Raw logs upload moved to connect.comma.ai
* Fixed HUD alerts on newer Honda Bosch thanks to csouers!
* Audi Q3 2020-21 support thanks to jyoung8607!
* Lexus RC 2020 support thanks to ErichMoraga!
Version 0.8.11 (2021-11-29)
========================
* Support for CAN FD on the red panda
* Support for an external panda on the comma three
* Navigation: Show more detailed instructions when approaching maneuver
* Fixed occasional steering faults on GM cars thanks to jyoung8607!
* Nissan ECU firmware fingerprinting thanks to robin-reckmann, martinl, and razem-io!
* Cadillac Escalade ESV 2016 support thanks to Gibby!
* Genesis G70 2020 support thanks to tecandrew!
* Hyundai Santa Fe Hybrid 2022 support thanks to sunnyhaibin!
* Mazda CX-9 2021 support thanks to Jacar!
* Volkswagen Polo 2020 support thanks to jyoung8607!
* Volkswagen T-Roc 2021 support thanks to jyoung8607!
Version 0.8.10 (2021-11-01)
========================
* New driving model

View File

@@ -15,9 +15,9 @@ AddOption('--test',
action='store_true',
help='build test files')
AddOption('--setup',
AddOption('--extras',
action='store_true',
help='build setup and installer files')
help='build misc extras, like setup and installer files')
AddOption('--kaitai',
action='store_true',
@@ -62,7 +62,6 @@ if arch == "aarch64" and TICI:
arch = "larch64"
USE_WEBCAM = os.getenv("USE_WEBCAM") is not None
USE_FRAME_STREAM = os.getenv("USE_FRAME_STREAM") is not None
USE_MIPI = os.getenv("USE_MIPI") is not None
# use larch64 for now
@@ -75,6 +74,7 @@ lenv = {
"PYTHONPATH": Dir("#").abspath + ":" + Dir("#pyextra/").abspath,
"ACADOS_SOURCE_DIR": Dir("#third_party/acados/acados").abspath,
"ACADOS_PYTHON_INTERFACE_PATH": Dir("#pyextra/acados_template").abspath,
"TERA_PATH": Dir("#").abspath + f"/third_party/acados/{arch}/t_renderer",
}
@@ -101,7 +101,6 @@ if arch == "aarch64" or arch == "larch64":
"/usr/lib",
"/system/vendor/lib64",
"/system/comma/usr/lib",
"#third_party/nanovg",
f"#third_party/acados/{arch}/lib",
]
@@ -208,12 +207,14 @@ env = Environment(
"-O2",
"-Wunused",
"-Werror",
"-Wshadow",
"-Wno-unknown-warning-option",
"-Wno-deprecated-register",
"-Wno-register",
"-Wno-inconsistent-missing-override",
"-Wno-c99-designator",
"-Wno-reorder-init-list",
"-Wno-error=unused-but-set-variable",
] + cflags + ccflags,
CPPPATH=cpppath + [
@@ -234,7 +235,6 @@ env = Environment(
"#third_party/linux/include",
"#third_party/snpe/include",
"#third_party/mapbox-gl-native-qt/include",
"#third_party/nanovg",
"#third_party/qrcode",
"#third_party",
"#cereal",
@@ -294,7 +294,7 @@ def abspath(x):
py_include = sysconfig.get_paths()['include']
envCython = env.Clone()
envCython["CPPPATH"] += [py_include, np.get_include()]
envCython["CCFLAGS"] += ["-Wno-#warnings", "-Wno-deprecated-declarations"]
envCython["CCFLAGS"] += ["-Wno-#warnings", "-Wno-shadow", "-Wno-deprecated-declarations"]
envCython["LIBS"] = []
if arch == "Darwin":
@@ -376,7 +376,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', 'USE_FRAME_STREAM', 'USE_MIPI')
Export('env', 'qt_env', 'arch', 'real_arch', 'SHARED', 'USE_WEBCAM', 'USE_MIPI')
SConscript(['selfdrive/common/SConscript'])
Import('_common', '_gpucommon', '_gpu_libs')
@@ -411,7 +411,7 @@ rednose_config = {
},
}
if arch != "aarch64":
if arch not in ["aarch64", "larch64"]:
rednose_config['to_build'].update({
'gnss': ('#selfdrive/locationd/models/gnss_kf.py', True, []),
'loc_4': ('#selfdrive/locationd/models/loc_kf.py', True, []),
@@ -457,6 +457,9 @@ SConscript(['selfdrive/ui/SConscript'])
if arch != "Darwin":
SConscript(['selfdrive/logcatd/SConscript'])
if GetOption('test'):
SConscript('panda/tests/safety/SConscript')
external_sconscript = GetOption('external_sconscript')
if external_sconscript:
SConscript([external_sconscript])

View File

@@ -104,6 +104,7 @@ struct CarEvent @0x9b1657f34caf3ad3 {
wideRoadCameraError @102;
localizerMalfunction @103;
highCpuUsage @105;
cruiseMismatch @106;
driverMonitorLowAccDEPRECATED @68;
radarCanErrorDEPRECATED @15;
@@ -127,15 +128,12 @@ struct CarEvent @0x9b1657f34caf3ad3 {
startupOneplusDEPRECATED @82;
startupFuzzyFingerprintDEPRECATED @97;
# mapd
#dp
autoLaneChange @107;
manualSteeringRequired @108;
manualSteeringRequiredBlinkersOn @109;
speedLimitActive @110;
speedLimitValueChange @111;
#dp
autoLaneChange @106;
manualSteeringRequired @107;
manualSteeringRequiredBlinkersOn @108;
leadCarMoving @109;
}
}
@@ -160,6 +158,7 @@ struct CarState {
# brake pedal, 0.0-1.0
brake @5 :Float32; # this is user pedal only
brakePressed @6 :Bool; # this is user pedal only
brakeHoldActive @38 :Bool;
# steering wheel
steeringAngleDeg @7 :Float32;
@@ -203,9 +202,10 @@ struct CarState {
rightBlindspot @34 :Bool; # Is there something blocking the right lane change
# dp
lkMode @38 :Bool;
engineRPM @39 :Float32;
cruiseActualEnabled @40 :Bool;
lkMode @39 :Bool;
engineRPM @40 :Float32;
cruiseActualEnabled @41 :Bool;
distanceLines @42 :UInt8;
struct WheelSpeeds {
# optional wheel speeds
@@ -306,6 +306,8 @@ struct CarControl {
active @7 :Bool;
actuators @6 :Actuators;
roll @8 :Float32;
pitch @9 :Float32;
cruiseControl @4 :CruiseControl;
hudControl @5 :HUDControl;
@@ -364,14 +366,17 @@ struct CarControl {
enum AudibleAlert {
none @0;
chimeEngage @1;
chimeDisengage @2;
chimeError @3;
chimeWarning1 @4;
chimeWarning2 @5;
chimeWarningRepeat @6;
chimePrompt @7;
chimeWarning2Repeat @8;
engage @1;
disengage @2;
refuse @3;
warningSoft @4;
warningImmediate @5;
prompt @6;
promptRepeat @7;
promptDistracted @8;
}
}
@@ -392,6 +397,7 @@ struct CarParams {
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
minEnableSpeed @7 :Float32;
minSteerSpeed @8 :Float32;
@@ -455,6 +461,8 @@ struct CarParams {
fingerprintSource @49: FingerprintSource;
networkLocation @50 :NetworkLocation; # Where Panda/C2 is integrated into the car's CAN network
wheelSpeedFactor @63 :Float32; # Multiplier on wheels speeds to computer actual speeds
struct SafetyConfig {
safetyModel @0 :SafetyModel;
safetyParam @1 :Int16;
@@ -533,7 +541,7 @@ struct CarParams {
allOutput @17;
gmAscm @18;
noOutput @19; # like silent but without silent CAN TXs
hondaBoschHarness @20;
hondaBosch @20;
volkswagenPq @21;
subaruLegacy @22; # pre-Global platform
hyundaiLegacy @23;

View File

@@ -19,35 +19,58 @@ struct DragonConf {
dpLaneLessModeCtrl @11 :Bool;
dpLaneLessMode @12 :UInt8;
dpAllowGas @13 :Bool;
dpFollowingProfileCtrl @14 :Bool;
dpFollowingProfile @15 :UInt8;
dpAccelProfileCtrl @16 :Bool;
dpAccelProfile @17 :UInt8;
dpGearCheck @18 :Bool;
dpSpeedCheck @19 :Bool;
dpUiDisplayMode @20 :UInt8;
dpUiSpeed @21 :Bool;
dpUiEvent @22 :Bool;
dpUiMaxSpeed @23 :Bool;
dpUiFace @24 :Bool;
dpUiLane @25 :Bool;
dpUiLead @26 :Bool;
dpUiSide @27 :Bool;
dpUiTop @28 :Bool;
dpUiBlinker @29 :Bool;
dpUiBrightness @30 :UInt8;
dpUiVolume @31 :Int8;
dpToyotaLdw @32 :Bool;
dpToyotaSng @33 :Bool;
dpToyotaCruiseOverride @34 :Bool;
dpToyotaCruiseOverrideVego @35 :Bool;
dpToyotaCruiseOverrideAt @36 :Float32;
dpToyotaCruiseOverrideSpeed @37 :Float32;
dpIpAddr @38 :Text;
dpCameraOffset @39 :Int8;
dpPathOffset @40 :Int8;
dpLocale @41 :Text;
dpSrLearner @42 :Bool;
dpSrCustom @43 :Float32;
dpMapd @44 :Bool;
dpAccelProfileCtrl @14 :Bool;
dpAccelProfile @15 :UInt8;
dpGearCheck @16 :Bool;
dpSpeedCheck @17 :Bool;
dpUiDisplayMode @18 :UInt8;
dpUiSpeed @19 :Bool;
dpUiEvent @20 :Bool;
dpUiMaxSpeed @21 :Bool;
dpUiFace @22 :Bool;
dpUiLane @23 :Bool;
dpUiLead @24 :Bool;
dpUiSide @25 :Bool;
dpUiTop @26 :Bool;
dpUiBlinker @27 :Bool;
dpUiBrightness @28 :UInt8;
dpUiVolume @29 :Int8;
dpToyotaLdw @30 :Bool;
dpToyotaSng @31 :Bool;
dpToyotaCruiseOverride @32 :Bool;
dpToyotaCruiseOverrideVego @33 :Bool;
dpToyotaCruiseOverrideAt @34 :Float32;
dpToyotaCruiseOverrideSpeed @35 :Float32;
dpIpAddr @36 :Text;
dpCameraOffset @37 :Int8;
dpPathOffset @38 :Int8;
dpLocale @39 :Text;
dpSrLearner @40 :Bool;
dpSrCustom @41 :Float32;
dpMapd @42 :Bool;
}
# use on mapd
struct LiveMapData {
speedLimitValid @0 :Bool;
speedLimit @1 :Float32;
speedLimitAheadValid @2 :Bool;
speedLimitAhead @3 :Float32;
speedLimitAheadDistance @4 :Float32;
turnSpeedLimitValid @5 :Bool;
turnSpeedLimit @6 :Float32;
turnSpeedLimitEndDistance @7 :Float32;
turnSpeedLimitSign @8 :Int16;
turnSpeedLimitsAhead @9 :List(Float32);
turnSpeedLimitsAheadDistances @10 :List(Float32);
turnSpeedLimitsAheadSigns @11 :List(Int16);
lastGpsTimestamp @12 :Int64; # Milliseconds since January 1, 1970.
currentRoadName @13 :Text;
lastGpsLatitude @14 :Float64;
lastGpsLongitude @15 :Float64;
lastGpsSpeed @16 :Float32;
lastGpsBearingDeg @17 :Float32;
lastGpsAccuracy @18 :Float32;
lastGpsBearingAccuracyDeg @19 :Float32;
}

View File

@@ -307,8 +307,10 @@ struct DeviceState @0xa4d8b5af2aa492eb {
batteryCurrent @15 :Int32;
chargingError @17 :Bool;
chargingDisabled @18 :Bool;
offroadPowerUsageUwh @23 :UInt32;
# dp, we need Int32 because it could be a negative value
offroadPowerUsageUwh @23 :Int32;
carBatteryCapacityUwh @25 :UInt32;
powerDrawW @40 :Float32;
# device thermals
cpuTempC @26 :List(Float32);
@@ -317,11 +319,18 @@ struct DeviceState @0xa4d8b5af2aa492eb {
ambientTempC @30 :Float32;
nvmeTempC @35 :List(Float32);
modemTempC @36 :List(Float32);
pmicTempC @39 :List(Float32);
thermalZones @38 :List(ThermalZone);
thermalStatus @14 :ThermalStatus;
fanSpeedPercentDesired @10 :UInt16;
screenBrightnessPercent @37 :Int8;
struct ThermalZone {
name @0 :Text;
temp @1 :Float32;
}
enum ThermalStatus {
green @0;
yellow @1;
@@ -605,6 +614,8 @@ struct ControlsState @0x97ff69c53601abf1 {
delta @8 :Float32;
output @9 :Float32;
saturated @10 :Bool;
steeringAngleDesiredDeg @11 :Float32;
steeringRateDesiredDeg @12 :Float32;
}
struct LateralPIDState {
@@ -617,6 +628,7 @@ struct ControlsState @0x97ff69c53601abf1 {
f @6 :Float32;
output @7 :Float32;
saturated @8 :Bool;
steeringAngleDesiredDeg @9 :Float32;
}
struct LateralLQRState {
@@ -626,6 +638,7 @@ struct ControlsState @0x97ff69c53601abf1 {
output @3 :Float32;
lqrOutput @4 :Float32;
saturated @5 :Bool;
steeringAngleDesiredDeg @6 :Float32;
}
struct LateralAngleState {
@@ -633,6 +646,7 @@ struct ControlsState @0x97ff69c53601abf1 {
steeringAngleDeg @1 :Float32;
output @2 :Float32;
saturated @3 :Bool;
steeringAngleDesiredDeg @4 :Float32;
}
struct LateralDebugState {
@@ -687,6 +701,7 @@ struct ModelDataV2 {
orientation @5 :XYZTData;
velocity @6 :XYZTData;
orientationRate @7 :XYZTData;
acceleration @19 :XYZTData;
# prediction lanelines and road edges
laneLines @8 :List(XYZTData);
@@ -812,7 +827,6 @@ struct LongitudinalPlan @0xe00b5b3eba12876c {
accels @32 :List(Float32);
speeds @33 :List(Float32);
jerks @34 :List(Float32);
#mapd
visionTurnControllerState @35 :VisionTurnControllerState;
visionTurnSpeed @36 :Float32;
@@ -912,7 +926,7 @@ struct LateralPlan @0xe1e9318e2ae8b51e {
# dp
dpALCAStartIn @30 :Float32;
dpLaneLessModeStatus @31 :Bool;
dpLaneLessModeIsE2E @31 :Bool;
# 32~33 are being used in mapd
enum Desire {
@@ -1328,6 +1342,7 @@ struct DriverMonitoringState @0xb83cda094a1da284 {
struct Boot {
wallTimeNanos @0 :UInt64;
pstore @4 :Map(Text, Data);
commands @5 :Map(Text, Data);
launchLog @3 :Text;
lastKmsgDEPRECATED @1 :Data;
@@ -1371,29 +1386,6 @@ struct LiveMapDataDEPRECATED {
mapValid @11 :Bool;
}
struct LiveMapData {
speedLimitValid @0 :Bool;
speedLimit @1 :Float32;
speedLimitAheadValid @2 :Bool;
speedLimitAhead @3 :Float32;
speedLimitAheadDistance @4 :Float32;
turnSpeedLimitValid @5 :Bool;
turnSpeedLimit @6 :Float32;
turnSpeedLimitEndDistance @7 :Float32;
turnSpeedLimitSign @8 :Int16;
turnSpeedLimitsAhead @9 :List(Float32);
turnSpeedLimitsAheadDistances @10 :List(Float32);
turnSpeedLimitsAheadSigns @11 :List(Int16);
lastGpsTimestamp @12 :Int64; # Milliseconds since January 1, 1970.
currentRoadName @13 :Text;
lastGpsLatitude @14 :Float64;
lastGpsLongitude @15 :Float64;
lastGpsSpeed @16 :Float32;
lastGpsBearingDeg @17 :Float32;
lastGpsAccuracy @18 :Float32;
lastGpsBearingAccuracyDeg @19 :Float32;
}
struct CameraOdometry {
frameId @4 :UInt32;
timestampEof @5 :UInt64;
@@ -1438,6 +1430,44 @@ struct UploaderState {
lastFilename @6 :Text;
}
struct NavInstruction {
maneuverPrimaryText @0 :Text;
maneuverSecondaryText @1 :Text;
maneuverDistance @2 :Float32; # m
maneuverType @3 :Text; # TODO: Make Enum
maneuverModifier @4 :Text; # TODO: Make Enum
distanceRemaining @5 :Float32; # m
timeRemaining @6 :Float32; # s
timeRemainingTypical @7 :Float32; # s
lanes @8 :List(Lane);
showFull @9 :Bool;
struct Lane {
directions @0 :List(Direction);
active @1 :Bool;
activeDirection @2 :Direction;
}
enum Direction {
none @0;
left @1;
right @2;
straight @3;
}
}
struct NavRoute {
coordinates @0 :List(Coordinate);
struct Coordinate {
latitude @0 :Float32;
longitude @1 :Float32;
}
}
struct Event {
logMonoTime @0 :UInt64; # nanoseconds
valid @67 :Bool = true;
@@ -1495,6 +1525,10 @@ struct Event {
deviceState @6 :DeviceState;
logMessage @18 :Text;
# navigation
navInstruction @82 :NavInstruction;
navRoute @83 :NavRoute;
navThumbnail @84: Thumbnail;
# *********** debug ***********
testJoystick @52 :Joystick;
@@ -1537,7 +1571,7 @@ struct Event {
gpsLocationDEPRECATED @21 :GpsLocationData;
uiLayoutStateDEPRECATED @57 :Legacy.UiLayoutState;
pandaStateDEPRECATED @12 :PandaState;
dragonConf @82 :Dp.DragonConf;
liveMapData @83: LiveMapData; # 82 is for dp
dragonConf @85 :Dp.DragonConf;
liveMapData @86 :Dp.LiveMapData;
}
}

View File

@@ -62,7 +62,9 @@ services = {
"modelV2": (True, 20., 40),
"managerState": (True, 2., 1),
"uploaderState": (True, 0., 1),
"liveMapData": (True, 0.),
"navInstruction": (True, 0.),
"navRoute": (True, 0.),
"navThumbnail": (True, 0.),
# debug
"testJoystick": (False, 0.),
@@ -70,6 +72,7 @@ services = {
# dp
"thermal": (True, 2., 1),
"dragonConf": (False, 1.),
"liveMapData": (True, 0.), # mapd
}
service_list = {name: Service(new_port(idx), *vals) for # type: ignore
idx, (name, vals) in enumerate(services.items())}

View File

@@ -22,19 +22,28 @@ void visionbuf_compute_aligned_width_and_height(int width, int height, int *alig
#endif
}
void VisionBuf::init_rgb(size_t width, size_t height, size_t stride) {
void VisionBuf::init_rgb(size_t init_width, size_t init_height, size_t init_stride) {
this->rgb = true;
this->width = width;
this->height = height;
this->stride = stride;
this->width = init_width;
this->height = init_height;
this->stride = init_stride;
}
void VisionBuf::init_yuv(size_t width, size_t height){
void VisionBuf::init_yuv(size_t init_width, size_t init_height){
this->rgb = false;
this->width = width;
this->height = height;
this->width = init_width;
this->height = init_height;
this->y = (uint8_t *)this->addr;
this->u = this->y + (width * height);
this->v = this->u + (width / 2 * height / 2);
this->u = this->y + (this->width * this->height);
this->v = this->u + (this->width / 2 * this->height / 2);
}
uint64_t VisionBuf::get_frame_id() {
return *frame_id;
}
void VisionBuf::set_frame_id(uint64_t id) {
*frame_id = id;
}

View File

@@ -15,9 +15,10 @@ enum VisionStreamType {
VISION_STREAM_RGB_BACK,
VISION_STREAM_RGB_FRONT,
VISION_STREAM_RGB_WIDE,
VISION_STREAM_YUV_BACK,
VISION_STREAM_YUV_FRONT,
VISION_STREAM_YUV_WIDE,
VISION_STREAM_ROAD,
VISION_STREAM_DRIVER,
VISION_STREAM_WIDE_ROAD,
VISION_STREAM_RGB_MAP,
VISION_STREAM_MAX,
};
@@ -26,6 +27,7 @@ class VisionBuf {
size_t len = 0;
size_t mmap_len = 0;
void * addr = nullptr;
uint64_t *frame_id;
int fd = 0;
bool rgb = false;
@@ -57,6 +59,9 @@ class VisionBuf {
void init_yuv(size_t width, size_t height);
int sync(int dir);
int free();
void set_frame_id(uint64_t id);
uint64_t get_frame_id();
};
void visionbuf_compute_aligned_width_and_height(int width, int height, int *aligned_w, int *aligned_h);

View File

@@ -32,14 +32,11 @@ static void *malloc_with_fd(size_t len, int *fd) {
return addr;
}
void VisionBuf::allocate(size_t len) {
int fd;
void *addr = malloc_with_fd(len, &fd);
this->len = len;
this->mmap_len = len;
this->addr = addr;
this->fd = fd;
void VisionBuf::allocate(size_t length) {
this->len = length;
this->mmap_len = this->len;
this->addr = malloc_with_fd(this->len, &this->fd);
this->frame_id = (uint64_t*)((uint8_t*)this->addr + this->len);
}
void VisionBuf::init_cl(cl_device_id device_id, cl_context ctx){
@@ -57,6 +54,8 @@ void VisionBuf::import(){
assert(this->fd >= 0);
this->addr = mmap(NULL, this->mmap_len, PROT_READ | PROT_WRITE, MAP_SHARED, this->fd, 0);
assert(this->addr != MAP_FAILED);
this->frame_id = (uint64_t*)((uint8_t*)this->addr + this->len);
}

View File

@@ -47,13 +47,13 @@ static void ion_init() {
}
}
void VisionBuf::allocate(size_t len) {
void VisionBuf::allocate(size_t length) {
int err;
ion_init();
struct ion_allocation_data ion_alloc = {0};
ion_alloc.len = len + PADDING_CL;
ion_alloc.len = length + PADDING_CL + sizeof(uint64_t);
ion_alloc.align = 4096;
ion_alloc.heap_id_mask = 1 << ION_IOMMU_HEAP_ID;
ion_alloc.flags = ION_FLAG_CACHED;
@@ -66,18 +66,19 @@ void VisionBuf::allocate(size_t len) {
err = HANDLE_EINTR(ioctl(ion_fd, ION_IOC_SHARE, &ion_fd_data));
assert(err == 0);
void *addr = mmap(NULL, ion_alloc.len,
PROT_READ | PROT_WRITE,
MAP_SHARED, ion_fd_data.fd, 0);
assert(addr != MAP_FAILED);
void *mmap_addr = mmap(NULL, ion_alloc.len,
PROT_READ | PROT_WRITE,
MAP_SHARED, ion_fd_data.fd, 0);
assert(mmap_addr != MAP_FAILED);
memset(addr, 0, ion_alloc.len);
memset(mmap_addr, 0, ion_alloc.len);
this->len = len;
this->len = length;
this->mmap_len = ion_alloc.len;
this->addr = addr;
this->addr = mmap_addr;
this->handle = ion_alloc.handle;
this->fd = ion_fd_data.fd;
this->frame_id = (uint64_t*)((uint8_t*)this->addr + this->len + PADDING_CL);
}
void VisionBuf::import(){
@@ -95,6 +96,8 @@ void VisionBuf::import(){
this->handle = fd_data.handle;
this->addr = mmap(NULL, this->mmap_len, PROT_READ | PROT_WRITE, MAP_SHARED, this->fd, 0);
assert(this->addr != MAP_FAILED);
this->frame_id = (uint64_t*)((uint8_t*)this->addr + this->len + PADDING_CL);
}
void VisionBuf::init_cl(cl_device_id device_id, cl_context ctx) {

View File

@@ -55,7 +55,7 @@ bool VisionIpcClient::connect(bool blocking){
VisionBuf bufs[VISIONIPC_MAX_FDS];
r = ipc_sendrecv_with_fds(false, socket_fd, &bufs, sizeof(bufs), fds, VISIONIPC_MAX_FDS, &num_buffers);
assert(num_buffers > 0);
assert(num_buffers >= 0);
assert(r == sizeof(VisionBuf) * num_buffers);
// Import buffers

View File

@@ -19,9 +19,9 @@ cpdef enum VisionStreamType:
VISION_STREAM_RGB_BACK
VISION_STREAM_RGB_FRONT
VISION_STREAM_RGB_WIDE
VISION_STREAM_YUV_BACK
VISION_STREAM_YUV_FRONT
VISION_STREAM_YUV_WIDE
VISION_STREAM_ROAD
VISION_STREAM_DRIVER
VISION_STREAM_WIDE_ROAD
cdef class VisionIpcServer:

View File

@@ -45,7 +45,6 @@ void VisionIpcServer::create_buffers(VisionStreamType type, size_t num_buffers,
size = width * height * 3 / 2;
}
// Create map + alloc requested buffers
for (size_t i = 0; i < num_buffers; i++){
VisionBuf* buf = new VisionBuf();

View File

@@ -13,10 +13,10 @@ static void zmq_sleep(int milliseconds=1000){
TEST_CASE("Connecting"){
VisionIpcServer server("camerad");
server.create_buffers(VISION_STREAM_YUV_BACK, 1, false, 100, 100);
server.create_buffers(VISION_STREAM_ROAD, 1, false, 100, 100);
server.start_listener();
VisionIpcClient client = VisionIpcClient("camerad", VISION_STREAM_YUV_BACK, false);
VisionIpcClient client = VisionIpcClient("camerad", VISION_STREAM_ROAD, false);
REQUIRE(client.connect());
REQUIRE(client.connected);
@@ -25,10 +25,10 @@ TEST_CASE("Connecting"){
TEST_CASE("Check buffers"){
size_t width = 100, height = 200, num_buffers = 5;
VisionIpcServer server("camerad");
server.create_buffers(VISION_STREAM_YUV_BACK, num_buffers, false, width, height);
server.create_buffers(VISION_STREAM_ROAD, num_buffers, false, width, height);
server.start_listener();
VisionIpcClient client = VisionIpcClient("camerad", VISION_STREAM_YUV_BACK, false);
VisionIpcClient client = VisionIpcClient("camerad", VISION_STREAM_ROAD, false);
REQUIRE(client.connect());
REQUIRE(client.buffers[0].width == width);
@@ -39,11 +39,11 @@ TEST_CASE("Check buffers"){
TEST_CASE("Check yuv/rgb"){
VisionIpcServer server("camerad");
server.create_buffers(VISION_STREAM_YUV_BACK, 1, false, 100, 100);
server.create_buffers(VISION_STREAM_ROAD, 1, false, 100, 100);
server.create_buffers(VISION_STREAM_RGB_BACK, 1, true, 100, 100);
server.start_listener();
VisionIpcClient client_yuv = VisionIpcClient("camerad", VISION_STREAM_YUV_BACK, false);
VisionIpcClient client_yuv = VisionIpcClient("camerad", VISION_STREAM_ROAD, false);
VisionIpcClient client_rgb = VisionIpcClient("camerad", VISION_STREAM_RGB_BACK, false);
client_yuv.connect();
client_rgb.connect();
@@ -54,20 +54,21 @@ TEST_CASE("Check yuv/rgb"){
TEST_CASE("Send single buffer"){
VisionIpcServer server("camerad");
server.create_buffers(VISION_STREAM_YUV_BACK, 1, true, 100, 100);
server.create_buffers(VISION_STREAM_ROAD, 1, true, 100, 100);
server.start_listener();
VisionIpcClient client = VisionIpcClient("camerad", VISION_STREAM_YUV_BACK, false);
VisionIpcClient client = VisionIpcClient("camerad", VISION_STREAM_ROAD, false);
REQUIRE(client.connect());
zmq_sleep();
VisionBuf * buf = server.get_buffer(VISION_STREAM_YUV_BACK);
VisionBuf * buf = server.get_buffer(VISION_STREAM_ROAD);
REQUIRE(buf != nullptr);
*((uint64_t*)buf->addr) = 1234;
VisionIpcBufExtra extra = {0};
extra.frame_id = 1337;
buf->set_frame_id(extra.frame_id);
server.send(buf, &extra);
@@ -76,19 +77,20 @@ TEST_CASE("Send single buffer"){
REQUIRE(recv_buf != nullptr);
REQUIRE(*(uint64_t*)recv_buf->addr == 1234);
REQUIRE(extra_recv.frame_id == extra.frame_id);
REQUIRE(recv_buf->get_frame_id() == extra.frame_id);
}
TEST_CASE("Test no conflate"){
VisionIpcServer server("camerad");
server.create_buffers(VISION_STREAM_YUV_BACK, 1, true, 100, 100);
server.create_buffers(VISION_STREAM_ROAD, 1, true, 100, 100);
server.start_listener();
VisionIpcClient client = VisionIpcClient("camerad", VISION_STREAM_YUV_BACK, false);
VisionIpcClient client = VisionIpcClient("camerad", VISION_STREAM_ROAD, false);
REQUIRE(client.connect());
zmq_sleep();
VisionBuf * buf = server.get_buffer(VISION_STREAM_YUV_BACK);
VisionBuf * buf = server.get_buffer(VISION_STREAM_ROAD);
REQUIRE(buf != nullptr);
VisionIpcBufExtra extra = {0};
@@ -109,14 +111,14 @@ TEST_CASE("Test no conflate"){
TEST_CASE("Test conflate"){
VisionIpcServer server("camerad");
server.create_buffers(VISION_STREAM_YUV_BACK, 1, true, 100, 100);
server.create_buffers(VISION_STREAM_ROAD, 1, true, 100, 100);
server.start_listener();
VisionIpcClient client = VisionIpcClient("camerad", VISION_STREAM_YUV_BACK, true);
VisionIpcClient client = VisionIpcClient("camerad", VISION_STREAM_ROAD, true);
REQUIRE(client.connect());
zmq_sleep();
VisionBuf * buf = server.get_buffer(VISION_STREAM_YUV_BACK);
VisionBuf * buf = server.get_buffer(VISION_STREAM_ROAD);
REQUIRE(buf != nullptr);
VisionIpcBufExtra extra = {0};

View File

@@ -3,7 +3,7 @@ import os
import requests
from datetime import datetime, timedelta
from common.basedir import PERSIST
from selfdrive.version import version
from selfdrive.version import get_version
from common.params import Params
API_HOST = os.getenv('API_HOST', 'https://api.commadotai.com') if not Params().get_bool("dp_api_custom") else Params().get("dp_api_custom_url", encoding='utf-8')
@@ -37,13 +37,13 @@ class Api():
if isinstance(token, bytes):
token = token.decode('utf8')
return token
def api_get(endpoint, method='GET', timeout=None, access_token=None, **params):
headers = {}
if access_token is not None:
headers['Authorization'] = "JWT "+access_token
headers['Authorization'] = "JWT " + access_token
headers['User-Agent'] = "openpilot-" + version
headers['User-Agent'] = "openpilot-" + get_version()
return requests.request(method, API_HOST + "/" + endpoint, timeout=timeout, headers=headers, params=params)

View File

@@ -1,23 +0,0 @@
import os
import sysconfig
from Cython.Distutils import build_ext
def get_ext_filename_without_platform_suffix(filename):
name, ext = os.path.splitext(filename)
ext_suffix = sysconfig.get_config_var('EXT_SUFFIX')
if ext_suffix == ext:
return filename
ext_suffix = ext_suffix.replace(ext, '')
idx = name.find(ext_suffix)
if idx == -1:
return filename
else:
return name[:idx] + ext
class BuildExtWithoutPlatformSuffix(build_ext):
def get_ext_filename(self, ext_name):
filename = super().get_ext_filename(ext_name)
return get_ext_filename_without_platform_suffix(filename)

View File

@@ -4,6 +4,7 @@ import sys
import json
import time
from math import floor
from selfdrive.hardware import TICI
'''
* type: Bool, Int8, UInt8, UInt16, Float32
@@ -41,8 +42,8 @@ confs = [
{'name': 'dp_lane_less_mode', 'default': 2, 'type': 'UInt8', 'min': 0, 'max': 2, 'depends': [{'name': 'dp_lane_less_mode_ctrl', 'vals': [True]}], 'conf_type': ['param', 'struct']},
# long ctrl
{'name': 'dp_allow_gas', 'default': False, 'type': 'Bool', 'depends': [{'name': 'dp_atl', 'vals': [False]}], 'conf_type': ['param', 'struct']},
{'name': 'dp_following_profile_ctrl', 'default': False, 'type': 'Bool', 'conf_type': ['param', 'struct']},
{'name': 'dp_following_profile', 'default': 0, 'type': 'UInt8', 'min': 0, 'max': 3, 'depends': [{'name': 'dp_following_profile_ctrl', 'vals': [True]}], 'conf_type': ['param', 'struct']},
#{'name': 'dp_following_profile_ctrl', 'default': False, 'type': 'Bool', 'conf_type': ['param', 'struct']},
#{'name': 'dp_following_profile', 'default': 0, 'type': 'UInt8', 'min': 0, 'max': 3, 'depends': [{'name': 'dp_following_profile_ctrl', 'vals': [True]}], 'conf_type': ['param', 'struct']},
{'name': 'dp_accel_profile_ctrl', 'default': False, 'type': 'Bool', 'conf_type': ['param', 'struct']},
{'name': 'dp_accel_profile', 'default': 0, 'type': 'UInt8', 'min': 0, 'max': 2, 'depends': [{'name': 'dp_accel_profile_ctrl', 'vals': [True]}], 'conf_type': ['param', 'struct']},
# safety
@@ -63,7 +64,7 @@ confs = [
{'name': 'dp_ui_brightness', 'default': 0, 'type': 'UInt8', 'min': 0, 'max': 100, 'conf_type': ['param', 'struct']},
{'name': 'dp_ui_volume', 'default': -5, 'type': 'Int8', 'min': -5, 'max': 100, 'conf_type': ['param', 'struct']},
# toyota
{'name': 'dp_lexus_rx_rpm_fix', 'default': False, 'type': 'Bool', 'conf_type': ['param']},
{'name': 'dp_toyota_no_min_acc_limit', 'default': False, 'type': 'Bool', 'conf_type': ['param']},
{'name': 'dp_toyota_ldw', 'default': True, 'type': 'Bool', 'conf_type': ['param', 'struct']},
{'name': 'dp_toyota_sng', 'default': False, 'type': 'Bool', 'conf_type': ['param', 'struct']},
{'name': 'dp_toyota_zss', 'default': False, 'type': 'Bool', 'conf_type': ['param']},
@@ -80,16 +81,16 @@ confs = [
{'name': 'dp_honda_eps_mod', 'default': False, 'type': 'Bool', 'conf_type': ['param']},
{'name': 'dp_honda_kmh_display', 'default': False, 'type': 'Bool', 'conf_type': ['param']},
# volkswagen
{'name': 'dp_vw_panda', 'default': False, 'type': 'Bool', 'conf_type': ['param']},
# {'name': 'dp_vw_panda', 'default': False, 'type': 'Bool', 'conf_type': ['param']},
#misc
{'name': 'dp_ip_addr', 'default': '', 'type': 'Text', 'conf_type': ['struct']},
{'name': 'dp_fan_mode', 'default': 0, 'type': 'UInt8', 'min': 0, 'max': 2, 'conf_type': ['param']},
{'name': 'dp_last_modified', 'default': str(floor(time.time())), 'type': 'Text', 'conf_type': ['param']},
{'name': 'dp_camera_offset', 'default': 6, 'type': 'Int8', 'min': -100, 'max': 100, 'conf_type': ['param', 'struct']},
{'name': 'dp_path_offset', 'default': 0, 'type': 'Int8', 'min': -100, 'max': 100, 'conf_type': ['param', 'struct']},
{'name': 'dp_camera_offset', 'default': -4 if TICI else 6, 'type': 'Int8', 'min': -100, 'max': 100, 'conf_type': ['param', 'struct']},
{'name': 'dp_path_offset', 'default': -4 if TICI else 0, 'type': 'Int8', 'min': -100, 'max': 100, 'conf_type': ['param', 'struct']},
{'name': 'dp_locale', 'default': 'en-US', 'type': 'Text', 'conf_type': ['param', 'struct'], 'update_once': True},
{'name': 'dp_reg', 'default': True, 'type': 'Bool', 'conf_type': ['param']},
{'name': 'dp_reg', 'default': False, 'type': 'Bool', 'conf_type': ['param']},
# sr learner related
{'name': 'dp_sr_learner', 'default': True, 'type': 'Bool', 'conf_type': ['param', 'struct']},
{'name': 'dp_sr_custom', 'default': 9.99, 'min': 9.99, 'max': 30., 'type': 'Float32', 'depends': [{'name': 'dp_sr_learner', 'vals': [False]}], 'conf_type': ['param', 'struct']},
@@ -98,7 +99,6 @@ confs = [
{'name': 'dp_lqr', 'default': False, 'type': 'Bool', 'conf_type': ['param']},
{'name': 'dp_reset_live_param_on_start', 'default': False, 'type': 'Bool', 'conf_type': ['param']},
# {'name': 'dp_appd', 'default': False, 'type': 'Bool', 'conf_type': ['param', 'struct']},
{'name': 'dp_jetson', 'default': False, 'type': 'Bool', 'conf_type': ['param']},
{'name': 'dp_car_assigned', 'default': '', 'type': 'Text', 'conf_type': ['param']},
{'name': 'dp_car_list', 'default': '', 'type': 'Text', 'conf_type': ['param']},
@@ -108,13 +108,9 @@ confs = [
{'name': 'dp_gpxd', 'default': False, 'type': 'Bool', 'conf_type': ['param']},
{'name': 'dp_mapd', 'default': False, 'type': 'Bool', 'conf_type': ['param', 'struct']},
{'name': 'dp_otisserv', 'default': False, 'type': 'Bool', 'conf_type': ['param']},
# deprecated
# {'name': 'dp_mapbox_token_pk', 'default': '', 'type': 'Text', 'conf_type': ['param']},
# {'name': 'dp_mapbox_token_sk', 'default': '', 'type': 'Text', 'conf_type': ['param']},
# {'name': 'dp_mapbox_full_screen', 'default': False, 'type': 'Bool', 'conf_type': ['param']},
# {'name': 'dp_mapbox_traffic', 'default': False, 'type': 'Bool', 'conf_type': ['param']},
# {'name': 'dp_mapbox_gmap_enable', 'default': False, 'type': 'Bool', 'conf_type': ['param']},
# {'name': 'dp_mapbox_gmap_key', 'default': '', 'type': 'Text', 'conf_type': ['param']},
# no gps is for mr. one's harness + black panda in one solution (without GPS chip)
{'name': 'dp_panda_no_gps', 'default': False, 'type': 'Bool', 'conf_type': ['param']},
{'name': 'dp_nav_mapbox_token_pk', 'default': '', 'type': 'Text', 'conf_type': ['param']},
{'name': 'dp_nav_mapbox_token_sk', 'default': '', 'type': 'Text', 'conf_type': ['param']},
{'name': 'dp_nav_full_screen', 'default': False, 'type': 'Bool', 'conf_type': ['param']},
@@ -126,6 +122,7 @@ confs = [
{'name': 'dp_nav_style_day', 'default': 'mapbox://styles/rav4kumar/ckv7dtfba6oik15r0w8dh1c1q', 'type': 'Text', 'conf_type': ['param']},
{'name': 'dp_nav_style_night', 'default': 'mapbox://styles/rav4kumar/ckvsf3f4u0zb414tcz9vof5jc', 'type': 'Text', 'conf_type': ['param']},
{'name': 'dp_no_offroad_fix', 'default': False, 'type': 'Bool', 'conf_type': ['param']},
{'name': 'dp_ftpd', 'default': False, 'type': 'Bool', 'conf_type': ['param']},
]
# from 0.8.9 to 0.8.10

48
common/markdown.py Executable file
View File

@@ -0,0 +1,48 @@
from typing import List
HTML_REPLACEMENTS = [
(r'&', r'&amp;'),
(r'"', r'&quot;'),
]
def parse_markdown(text: str, tab_length: int = 2) -> str:
lines = text.split("\n")
output: List[str] = []
list_level = 0
def end_outstanding_lists(level: int, end_level: int) -> int:
while level > end_level:
level -= 1
output.append("</ul>")
if level > 0:
output.append("</li>")
return end_level
for i, line in enumerate(lines):
if i + 1 < len(lines) and lines[i + 1].startswith("==="): # heading
output.append(f"<h1>{line}</h1>")
elif line.startswith("==="):
pass
elif line.lstrip().startswith("* "): # list
line_level = 1 + line.count(" " * tab_length, 0, line.index("*"))
if list_level >= line_level:
list_level = end_outstanding_lists(list_level, line_level)
else:
list_level += 1
if list_level > 1:
output[-1] = output[-1].replace("</li>", "")
output.append("<ul>")
output.append(f"<li>{line.replace('*', '', 1).lstrip()}</li>")
else:
list_level = end_outstanding_lists(list_level, 0)
if len(line) > 0:
output.append(line)
end_outstanding_lists(list_level, 0)
output_str = "\n".join(output) + "\n"
for (fr, to) in HTML_REPLACEMENTS:
output_str = output_str.replace(fr, to)
return output_str

View File

@@ -1,30 +0,0 @@
from libcpp.string cimport string
from libcpp cimport bool
cdef extern from "selfdrive/common/params.cc":
pass
cdef extern from "selfdrive/common/util.cc":
pass
cdef extern from "selfdrive/common/params.h":
cpdef enum ParamKeyType:
PERSISTENT
CLEAR_ON_MANAGER_START
CLEAR_ON_PANDA_DISCONNECT
CLEAR_ON_IGNITION_ON
CLEAR_ON_IGNITION_OFF
ALL
cdef cppclass Params:
Params() nogil
Params(string) nogil
string get(string, bool) nogil
bool getBool(string) nogil
int remove(string) nogil
int put(string, string) nogil
int putBool(string, bool) nogil
bool checkKey(string) nogil
void clearAll(ParamKeyType)
string get_params_path()

View File

@@ -2,27 +2,31 @@
# cython: language_level = 3
from libcpp cimport bool
from libcpp.string cimport string
from common.params_pxd cimport Params as c_Params, ParamKeyType as c_ParamKeyType
import os
import threading
from common.basedir import BASEDIR
cdef extern from "selfdrive/common/params.h":
cpdef enum ParamKeyType:
PERSISTENT
CLEAR_ON_MANAGER_START
CLEAR_ON_PANDA_DISCONNECT
CLEAR_ON_IGNITION_ON
CLEAR_ON_IGNITION_OFF
ALL
cdef cppclass c_Params "Params":
c_Params(string) nogil
string get(string, bool) nogil
bool getBool(string) nogil
int remove(string) nogil
int put(string, string) nogil
int putBool(string, bool) nogil
bool checkKey(string) nogil
void clearAll(ParamKeyType)
string get_params_path()
cdef class ParamKeyType:
PERSISTENT = c_ParamKeyType.PERSISTENT
CLEAR_ON_MANAGER_START = c_ParamKeyType.CLEAR_ON_MANAGER_START
CLEAR_ON_PANDA_DISCONNECT = c_ParamKeyType.CLEAR_ON_PANDA_DISCONNECT
CLEAR_ON_IGNITION_ON = c_ParamKeyType.CLEAR_ON_IGNITION_ON
CLEAR_ON_IGNITION_OFF = c_ParamKeyType.CLEAR_ON_IGNITION_OFF
ALL = c_ParamKeyType.ALL
def ensure_bytes(v):
if isinstance(v, str):
return v.encode()
else:
return v
return v.encode() if isinstance(v, str) else v;
class UnknownKeyName(Exception):
pass
@@ -30,36 +34,25 @@ class UnknownKeyName(Exception):
cdef class Params:
cdef c_Params* p
def __cinit__(self, d=None):
cdef string path
if d is None:
with nogil:
self.p = new c_Params()
else:
path = <string>d.encode()
with nogil:
self.p = new c_Params(path)
def __cinit__(self, d=""):
cdef string path = <string>d.encode()
with nogil:
self.p = new c_Params(path)
def __dealloc__(self):
del self.p
def clear_all(self, tx_type=None):
if tx_type is None:
tx_type = ParamKeyType.ALL
def clear_all(self, tx_type=ParamKeyType.ALL):
self.p.clearAll(tx_type)
def check_key(self, key):
key = ensure_bytes(key)
if not self.p.checkKey(key):
raise UnknownKeyName(key)
return key
def get(self, key, bool block=False, encoding=None):
cdef string k = self.check_key(key)
cdef string val
with nogil:
val = self.p.get(k, block)
@@ -72,10 +65,7 @@ cdef class Params:
else:
return None
if encoding is not None:
return val.decode(encoding)
else:
return val
return val if encoding is None else val.decode(encoding)
def get_bool(self, key):
cdef string k = self.check_key(key)
@@ -109,7 +99,7 @@ cdef class Params:
def get_params_path(self):
return self.p.get_params_path().decode("utf-8")
def put_nonblocking(key, val, d=None):
def put_nonblocking(key, val, d=""):
def f(key, val):
params = Params(d)
cdef string k = ensure_bytes(key)

View File

@@ -81,6 +81,15 @@ model_frame_from_road_frame = np.dot(model_intrinsics,
bigmodel_frame_from_road_frame = np.dot(bigmodel_intrinsics,
get_view_frame_from_road_frame(0, 0, 0, model_height))
bigmodel_frame_from_calib_frame = np.dot(bigmodel_intrinsics,
get_view_frame_from_calib_frame(0, 0, 0, 0))
sbigmodel_frame_from_road_frame = np.dot(sbigmodel_intrinsics,
get_view_frame_from_road_frame(0, 0, 0, model_height))
sbigmodel_frame_from_calib_frame = np.dot(sbigmodel_intrinsics,
get_view_frame_from_calib_frame(0, 0, 0, 0))
medmodel_frame_from_road_frame = np.dot(medmodel_intrinsics,
get_view_frame_from_road_frame(0, 0, 0, model_height))

View File

@@ -1,13 +1,14 @@
Supported Cars
------
# Supported Cars
## comma.ai supported cars
| Make | Model (US Market Reference) | Supported Package | ACC | No ACC accel below | No ALC below |
| ----------| ------------------------------| ------------------| -----------------| -------------------| ------------------|
| Acura | ILX 2016-19 | AcuraWatch Plus | openpilot | 25mph<sup>1</sup> | 25mph |
| Acura | RDX 2016-18 | AcuraWatch Plus | openpilot | 25mph<sup>1</sup> | 12mph |
| Acura | RDX 2019-21 | All | Stock | 0mph | 3mph |
| Honda | Accord 2018-20 | All | Stock | 0mph | 3mph |
| Honda | Accord Hybrid 2018-20 | All | Stock | 0mph | 3mph |
| Honda | Accord 2018-21 | All | Stock | 0mph | 3mph |
| Honda | Accord Hybrid 2018-21 | All | Stock | 0mph | 3mph |
| Honda | Civic Hatchback 2017-21 | Honda Sensing | Stock | 0mph | 12mph |
| Honda | Civic Coupe 2016-18 | Honda Sensing | openpilot | 0mph | 12mph |
| Honda | Civic Coupe 2019-20 | All | Stock | 0mph | 2mph<sup>2</sup> |
@@ -23,19 +24,20 @@ Supported Cars
| Honda | Insight 2019-21 | All | Stock | 0mph | 3mph |
| Honda | Inspire 2018 | All | Stock | 0mph | 3mph |
| Honda | Odyssey 2018-20 | Honda Sensing | openpilot | 25mph<sup>1</sup> | 0mph |
| Honda | Passport 2019 | All | openpilot | 25mph<sup>1</sup> | 12mph |
| Honda | Passport 2019-21 | All | openpilot | 25mph<sup>1</sup> | 12mph |
| Honda | Pilot 2016-21 | Honda Sensing | openpilot | 25mph<sup>1</sup> | 12mph |
| Honda | Ridgeline 2017-21 | Honda Sensing | openpilot | 25mph<sup>1</sup> | 12mph |
| Hyundai | Palisade 2020-21 | All | Stock | 0mph | 0mph |
| Hyundai | Sonata 2020-21 | All | Stock | 0mph | 0mph |
| Hyundai | Sonata 2020-22 | All | Stock | 0mph | 0mph |
| Lexus | CT Hybrid 2017-18 | LSS | Stock<sup>3</sup>| 0mph | 0mph |
| Lexus | ES 2019-21 | All | openpilot | 0mph | 0mph |
| Lexus | ES Hybrid 2017-18 | LSS | Stock<sup>3</sup>| 0mph | 0mph |
| Lexus | ES Hybrid 2019-21 | All | openpilot | 0mph | 0mph |
| Lexus | IS 2017-2019 | All | Stock | 22mph | 0mph |
| Lexus | NX 2018 | All | Stock<sup>3</sup>| 0mph | 0mph |
| Lexus | NX 2018-2019 | All | Stock<sup>3</sup>| 0mph | 0mph |
| Lexus | NX 2020 | All | openpilot | 0mph | 0mph |
| Lexus | NX Hybrid 2018-19 | All | Stock<sup>3</sup>| 0mph | 0mph |
| Lexus | RC 2020 | All | Stock | 22mph | 0mph |
| Lexus | RX 2016-18 | All | Stock<sup>3</sup>| 0mph | 0mph |
| Lexus | RX 2020-21 | All | openpilot | 0mph | 0mph |
| Lexus | RX Hybrid 2016-19 | All | Stock<sup>3</sup>| 0mph | 0mph |
@@ -45,24 +47,24 @@ Supported Cars
| Toyota | Avalon 2016-21 | TSS-P | Stock<sup>3</sup>| 20mph<sup>1</sup> | 0mph |
| Toyota | Avalon Hybrid 2019-21 | TSS-P | Stock<sup>3</sup>| 20mph<sup>1</sup> | 0mph |
| Toyota | Camry 2018-20 | All | Stock | 0mph<sup>4</sup> | 0mph |
| Toyota | Camry 2021 | All | openpilot | 0mph<sup>4</sup> | 0mph |
| Toyota | Camry 2021-22 | All | openpilot | 0mph<sup>4</sup> | 0mph |
| Toyota | Camry Hybrid 2018-20 | All | Stock | 0mph<sup>4</sup> | 0mph |
| Toyota | Camry Hybrid 2021-22 | All | openpilot | 0mph | 0mph |
| Toyota | C-HR 2017-20 | All | Stock | 0mph | 0mph |
| Toyota | C-HR 2017-21 | All | Stock | 0mph | 0mph |
| Toyota | C-HR Hybrid 2017-19 | All | Stock | 0mph | 0mph |
| Toyota | Corolla 2017-19 | All | Stock<sup>3</sup>| 20mph<sup>1</sup> | 0mph |
| Toyota | Corolla 2020-22 | All | openpilot | 0mph | 0mph |
| Toyota | Corolla Hatchback 2019-22 | All | openpilot | 0mph | 0mph |
| Toyota | Corolla Hybrid 2020-22 | All | openpilot | 0mph | 0mph |
| Toyota | Highlander 2017-19 | All | Stock<sup>3</sup>| 0mph | 0mph |
| Toyota | Highlander 2020-21 | All | openpilot | 0mph | 0mph |
| Toyota | Highlander 2020-22 | All | openpilot | 0mph | 0mph |
| Toyota | Highlander Hybrid 2017-19 | All | Stock<sup>3</sup>| 0mph | 0mph |
| Toyota | Highlander Hybrid 2020-21 | All | openpilot | 0mph | 0mph |
| Toyota | Highlander Hybrid 2020-22 | All | openpilot | 0mph | 0mph |
| Toyota | Mirai 2021 | All | openpilot | 0mph | 0mph |
| Toyota | Prius 2016-20 | TSS-P | Stock<sup>3</sup>| 0mph | 0mph |
| Toyota | Prius 2021 | All | openpilot | 0mph | 0mph |
| Toyota | Prius Prime 2017-20 | All | Stock<sup>3</sup>| 0mph | 0mph |
| Toyota | Prius Prime 2021 | All | openpilot | 0mph | 0mph |
| Toyota | Prius Prime 2021-22 | All | openpilot | 0mph | 0mph |
| Toyota | Rav4 2016-18 | TSS-P | Stock<sup>3</sup>| 20mph<sup>1</sup> | 0mph |
| Toyota | Rav4 2019-21 | All | openpilot | 0mph | 0mph |
| Toyota | Rav4 Hybrid 2016-18 | TSS-P | Stock<sup>3</sup>| 0mph | 0mph |
@@ -74,17 +76,18 @@ Supported Cars
<sup>3</sup>When disconnecting the Driver Support Unit (DSU), openpilot ACC will replace stock ACC. ***NOTE: disconnecting the DSU disables Automatic Emergency Braking (AEB).*** <br />
<sup>4</sup>28mph for Camry 4CYL L, 4CYL LE and 4CYL SE which don't have Full-Speed Range Dynamic Radar Cruise Control. <br />
Community Maintained Cars and Features
------
## Community Maintained Cars and Features
| Make | Model (US Market Reference) | Supported Package | ACC | No ACC accel below | No ALC below |
| ----------| ------------------------------| ------------------| -----------------| -------------------| -------------|
| Audi | A3 2014-19 | ACC + Lane Assist | Stock | 0mph | 0mph |
| Audi | A3 Sportback e-tron 2017-18 | ACC + Lane Assist | Stock | 0mph | 0mph |
| Audi | Q2 2018 | ACC + Lane Assist | Stock | 0mph | 0mph |
| Audi | S3 2015-17 | ACC + Lane Assist | Stock | 0mph | 0mph |
| Audi | Q3 2020-21 | ACC + Lane Assist | Stock | 0mph | 0mph |
| Audi | S3 2015 | ACC + Lane Assist | Stock | 0mph | 0mph |
| Buick | Regal 2018<sup>1</sup> | Adaptive Cruise | openpilot | 0mph | 7mph |
| Cadillac | ATS 2018<sup>1</sup> | Adaptive Cruise | openpilot | 0mph | 7mph |
| Cadillac | Escalade ESV 2016<sup>1</sup> | ACC + LKAS | openpilot | 0mph | 7mph |
| Chevrolet | Malibu 2017<sup>1</sup> | Adaptive Cruise | openpilot | 0mph | 7mph |
| Chevrolet | Volt 2017-18<sup>1</sup> | Adaptive Cruise | openpilot | 0mph | 7mph |
| Chrysler | Pacifica 2017-18 | Adaptive Cruise | Stock | 0mph | 9mph |
@@ -92,6 +95,7 @@ Community Maintained Cars and Features
| Chrysler | Pacifica Hybrid 2017-18 | Adaptive Cruise | Stock | 0mph | 9mph |
| Chrysler | Pacifica Hybrid 2019-21 | Adaptive Cruise | Stock | 0mph | 39mph |
| Genesis | G70 2018 | All | Stock | 0mph | 0mph |
| Genesis | G70 2020 | All | Stock | 0mph | 0mph |
| Genesis | G80 2018 | All | Stock | 0mph | 0mph |
| Genesis | G90 2018 | All | Stock | 0mph | 0mph |
| GMC | Acadia 2018<sup>1</sup> | Adaptive Cruise | openpilot | 0mph | 7mph |
@@ -110,6 +114,7 @@ Community Maintained Cars and Features
| Hyundai | Kona Hybrid 2020 | SCC + LKAS | Stock | 0mph | 0mph |
| Hyundai | Santa Fe 2019-20 | All | Stock | 0mph | 0mph |
| Hyundai | Santa Fe 2021-22 | All | Stock | 0mph | 0mph |
| Hyundai | Santa Fe Hybrid 2022 | All | Stock | 0mph | 0mph |
| Hyundai | Sonata 2018-2019 | SCC + LKAS | Stock | 0mph | 0mph |
| Hyundai | Sonata Hybrid 2021-22 | All | Stock | 0mph | 0mph |
| Hyundai | Veloster 2019-20 | SCC + LKAS | Stock | 5mph | 0mph |
@@ -117,7 +122,7 @@ Community Maintained Cars and Features
| Jeep | Grand Cherokee 2019-20 | Adaptive Cruise | Stock | 0mph | 39mph |
| Kia | Ceed 2019 | SCC + LKAS | Stock | 0mph | 0mph |
| Kia | Forte 2018-21 | SCC + LKAS | Stock | 0mph | 0mph |
| Kia | K5 2021 | SCC + LFA | Stock | 0mph | 0mph |
| Kia | K5 2021-22 | SCC + LFA | Stock | 0mph | 0mph |
| Kia | Niro EV 2019-21 | SCC + LKAS | Stock | 0mph | 0mph |
| Kia | Niro Hybrid 2021 | SCC + LKAS | Stock | 0mph | 0mph |
| Kia | Niro PHEV 2019 | SCC + LKAS | Stock | 10mph | 32mph |
@@ -127,6 +132,7 @@ Community Maintained Cars and Features
| Kia | Sorento 2018-19 | SCC + LKAS | Stock | 0mph | 0mph |
| Kia | Stinger 2018 | SCC + LKAS | Stock | 0mph | 0mph |
| Kia | Telluride 2020 | SCC + LKAS | Stock | 0mph | 0mph |
| Mazda | CX-9 2021 | All | Stock | 0mph | 28mph |
| Nissan | Altima 2019-20 | ProPILOT | Stock | 0mph | 0mph |
| Nissan | Leaf 2018-22 | ProPILOT | Stock | 0mph | 0mph |
| Nissan | Rogue 2018-20 | ProPILOT | Stock | 0mph | 0mph |
@@ -158,7 +164,9 @@ Community Maintained Cars and Features
| Volkswagen| Jetta 2018-20 | Driver Assistance | Stock | 0mph | 0mph |
| Volkswagen| Jetta GLI 2021 | Driver Assistance | Stock | 0mph | 0mph |
| Volkswagen| Passat 2016-18<sup>3</sup> | Driver Assistance | Stock | 0mph | 0mph |
| Volkswagen| Polo 2020 | Driver Assistance | Stock | 0mph | 0mph |
| Volkswagen| T-Cross 2021<sup>4</sup> | Driver Assistance | Stock | 0mph | 0mph |
| Volkswagen| T-Roc 2021<sup>4</sup> | Driver Assistance | Stock | 0mph | 0mph |
| Volkswagen| Taos 2022<sup>4</sup> | Driver Assistance | Stock | 0mph | 0mph |
| Volkswagen| Tiguan 2020 | Driver Assistance | Stock | 0mph | 0mph |
| Volkswagen| Touran 2017 | Driver Assistance | Stock | 0mph | 0mph |
@@ -169,7 +177,7 @@ Community Maintained Cars and Features
<sup>4</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). For the newer design,
in the interim, choose "VW J533 Development" from the vehicle drop-down for a harness that integrates at the CAN gateway inside the dashboard.<br />
Community Maintained Cars and Features are not verified by comma to meet our [safety model](SAFETY.md). Be extra cautious using them. They are only available after enabling the toggle in `Settings->Developer->Enable Community Features`.
Community Maintained Cars and Features are not verified by comma to meet our [safety model](SAFETY.md). Be extra cautious using them.
To promote a car from community maintained, it must meet a few requirements. We must own one from the brand, we must sell the harness for it, has full ISO26262 in both panda and openpilot, there must be a path forward for longitudinal control, it must have AEB still enabled, and it must support fingerprinting 2.0

View File

@@ -1,16 +1,35 @@
# How to contribute
Our software is open source so you can solve your own problems without needing help from others. And if you solve a problem and are so kind, you can upstream it for the rest of the world to use.
Our software is open source so you can solve your own problems without needing help from others. And if you solve a problem and are so kind, you can upstream it for the rest of the world to use. Check out our [post about externalization](https://blog.comma.ai/a-2020-theme-externalization/).
Most open source development activity is coordinated through our [GitHub Discussions](https://github.com/commaai/openpilot/discussions) and [Discord](https://discord.comma.ai). A lot of documentation is available on our [blog](https://blog.comma.ai/).
Most open source development activity is coordinated through our [GitHub Discussions](https://github.com/commaai/openpilot/discussions) and [Discord](https://discord.comma.ai). A lot of documentation is available at https://docs.comma.ai and on our [blog](https://blog.comma.ai/).
## Getting Started
### Getting Started
* Setup your [development environment](../tools/)
* Join our [Discord](https://discord.comma.ai)
* Make sure you have a [GitHub account](https://github.com/signup/free)
* Fork [our repositories](https://github.com/commaai) on GitHub
## Pull Requests
Pull requests should be against the master branch. Welcomed contributions include bug reports, car ports, and any [open issue](https://github.com/commaai/openpilot/issues). If you're unsure about a contribution, feel free to open a discussion, issue, or draft PR to discuss the problem you're trying to solve.
A good pull request has all of the following:
* a clearly stated purpose
* every line changed directly contributes to the stated purpose
* verification, i.e. how did you test your PR?
* justification
* if you've optimized something, post benchmarks to prove it's better
* if you've improved your car's tuning, post before and after plots
* passes the CI tests
### Car Ports
We've released a [Model Port guide](https://blog.comma.ai/openpilot-port-guide-for-toyota-models/) for porting to Toyota/Lexus models.
If you port openpilot to a substantially new car brand, see this more generic [Brand Port guide](https://blog.comma.ai/how-to-write-a-car-port-for-openpilot/).
## Testing
### Automated Testing
@@ -20,27 +39,3 @@ All PRs and commits are automatically checked by GitHub Actions. Check out `.git
### Code Style and Linting
Code is automatically checked for style by GitHub Actions as part of the automated tests. You can also run these tests yourself by running `pre-commit run --all`.
## Car Ports
We've released a [Model Port guide](https://blog.comma.ai/openpilot-port-guide-for-toyota-models/) for porting to Toyota/Lexus models.
If you port openpilot to a substantially new car brand, see this more generic [Brand Port guide](https://blog.comma.ai/how-to-write-a-car-port-for-openpilot/).
## Pull Requests
Pull requests should be against the master branch. Before running master on in-car hardware, you'll need to clone the submodules too. That can be done by recursively cloning the repository:
```
git clone https://github.com/commaai/openpilot.git --recursive
```
Or alternatively, when on the master branch:
```
git submodule update --init
```
The reasons for having submodules on a dedicated repository and our new development philosophy can be found in our [post about externalization](https://blog.comma.ai/a-2020-theme-externalization/).
Modules that are in seperate repositories include:
* cereal
* laika
* opendbc
* panda
* rednose

View File

@@ -1,5 +1,4 @@
Integration with Stock Features
------
# Integration with Stock Features
In all supported cars:
* Stock Lane Keep Assist (LKA) and stock ALC are replaced by openpilot ALC, which only functions when openpilot is engaged by the user.
@@ -10,64 +9,3 @@ Additionally, on specific supported cars (see ACC column in [supported cars](CAR
* 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.
Limitations of openpilot ALC and LDW
------
openpilot ALC and openpilot LDW do not automatically drive the vehicle or reduce the amount of attention that must be paid to operate your vehicle. The driver must always keep control of the steering wheel and be ready to correct the openpilot ALC action at all times.
While changing lanes, openpilot is not capable of looking next to you or checking your blind spot. Only nudge the wheel to initiate a lane change after you have confirmed it's safe to do so.
Many factors can impact the performance of openpilot ALC and openpilot LDW, causing them to be unable to function as intended. These include, but are not limited to:
* Poor visibility (heavy rain, snow, fog, etc.) or weather conditions that may interfere with sensor operation.
* The road facing camera is obstructed, covered or damaged by mud, ice, snow, etc.
* Obstruction caused by applying excessive paint or adhesive products (such as wraps, stickers, rubber coating, etc.) onto the vehicle.
* The device is mounted incorrectly.
* When in sharp curves, like on-off ramps, intersections etc...; openpilot is designed to be limited in the amount of steering torque it can produce.
* In the presence of restricted lanes or construction zones.
* When driving on highly banked roads or in presence of strong cross-wind.
* Extremely hot or cold temperatures.
* Bright light (due to oncoming headlights, direct sunlight, etc.).
* Driving on hills, narrow, or winding roads.
The list above does not represent an exhaustive list of situations that may interfere with proper operation of openpilot components. It is the driver's responsibility to be in control of the vehicle at all times.
Limitations of openpilot ACC and FCW
------
openpilot ACC and openpilot FCW are not systems that allow careless or inattentive driving. It is still necessary for the driver to pay close attention to the vehicles surroundings and to be ready to re-take control of the gas and the brake at all times.
Many factors can impact the performance of openpilot ACC and openpilot FCW, causing them to be unable to function as intended. These include, but are not limited to:
* Poor visibility (heavy rain, snow, fog, etc.) or weather conditions that may interfere with sensor operation.
* The road facing camera or radar are obstructed, covered, or damaged by mud, ice, snow, etc.
* Obstruction caused by applying excessive paint or adhesive products (such as wraps, stickers, rubber coating, etc.) onto the vehicle.
* The device is mounted incorrectly.
* Approaching a toll booth, a bridge or a large metal plate.
* When driving on roads with pedestrians, cyclists, etc...
* In presence of traffic signs or stop lights, which are not detected by openpilot at this time.
* When the posted speed limit is below the user selected set speed. openpilot does not detect speed limits at this time.
* In presence of vehicles in the same lane that are not moving.
* When abrupt braking maneuvers are required. openpilot is designed to be limited in the amount of deceleration and acceleration that it can produce.
* When surrounding vehicles perform close cut-ins from neighbor lanes.
* Driving on hills, narrow, or winding roads.
* Extremely hot or cold temperatures.
* Bright light (due to oncoming headlights, direct sunlight, etc.).
* Interference from other equipment that generates radar waves.
The list above does not represent an exhaustive list of situations that may interfere with proper operation of openpilot components. It is the driver's responsibility to be in control of the vehicle at all times.
Limitations of openpilot DM
------
openpilot DM should not be considered an exact measurement of the alertness of the driver.
Many factors can impact the performance of openpilot DM, causing it to be unable to function as intended. These include, but are not limited to:
* Low light conditions, such as driving at night or in dark tunnels.
* Bright light (due to oncoming headlights, direct sunlight, etc.).
* The driver's face is partially or completely outside field of view of the driver facing camera.
* The driver facing camera is obstructed, covered, or damaged.
The list above does not represent an exhaustive list of situations that may interfere with proper operation of openpilot components. A driver should not rely on openpilot DM to assess their level of attention.

58
docs/LIMITATIONS.md Normal file
View File

@@ -0,0 +1,58 @@
# Limitations
## Limitations of openpilot ALC and LDW
openpilot ALC and openpilot LDW do not automatically drive the vehicle or reduce the amount of attention that must be paid to operate your vehicle. The driver must always keep control of the steering wheel and be ready to correct the openpilot ALC action at all times.
While changing lanes, openpilot is not capable of looking next to you or checking your blind spot. Only nudge the wheel to initiate a lane change after you have confirmed it's safe to do so.
Many factors can impact the performance of openpilot ALC and openpilot LDW, causing them to be unable to function as intended. These include, but are not limited to:
* Poor visibility (heavy rain, snow, fog, etc.) or weather conditions that may interfere with sensor operation.
* The road facing camera is obstructed, covered or damaged by mud, ice, snow, etc.
* Obstruction caused by applying excessive paint or adhesive products (such as wraps, stickers, rubber coating, etc.) onto the vehicle.
* The device is mounted incorrectly.
* When in sharp curves, like on-off ramps, intersections etc...; openpilot is designed to be limited in the amount of steering torque it can produce.
* In the presence of restricted lanes or construction zones.
* When driving on highly banked roads or in presence of strong cross-wind.
* Extremely hot or cold temperatures.
* Bright light (due to oncoming headlights, direct sunlight, etc.).
* Driving on hills, narrow, or winding roads.
The list above does not represent an exhaustive list of situations that may interfere with proper operation of openpilot components. It is the driver's responsibility to be in control of the vehicle at all times.
## Limitations of openpilot ACC and FCW
openpilot ACC and openpilot FCW are not systems that allow careless or inattentive driving. It is still necessary for the driver to pay close attention to the vehicles surroundings and to be ready to re-take control of the gas and the brake at all times.
Many factors can impact the performance of openpilot ACC and openpilot FCW, causing them to be unable to function as intended. These include, but are not limited to:
* Poor visibility (heavy rain, snow, fog, etc.) or weather conditions that may interfere with sensor operation.
* The road facing camera or radar are obstructed, covered, or damaged by mud, ice, snow, etc.
* Obstruction caused by applying excessive paint or adhesive products (such as wraps, stickers, rubber coating, etc.) onto the vehicle.
* The device is mounted incorrectly.
* Approaching a toll booth, a bridge or a large metal plate.
* When driving on roads with pedestrians, cyclists, etc...
* In presence of traffic signs or stop lights, which are not detected by openpilot at this time.
* When the posted speed limit is below the user selected set speed. openpilot does not detect speed limits at this time.
* In presence of vehicles in the same lane that are not moving.
* When abrupt braking maneuvers are required. openpilot is designed to be limited in the amount of deceleration and acceleration that it can produce.
* When surrounding vehicles perform close cut-ins from neighbor lanes.
* Driving on hills, narrow, or winding roads.
* Extremely hot or cold temperatures.
* Bright light (due to oncoming headlights, direct sunlight, etc.).
* Interference from other equipment that generates radar waves.
The list above does not represent an exhaustive list of situations that may interfere with proper operation of openpilot components. It is the driver's responsibility to be in control of the vehicle at all times.
## Limitations of openpilot DM
openpilot DM should not be considered an exact measurement of the alertness of the driver.
Many factors can impact the performance of openpilot DM, causing it to be unable to function as intended. These include, but are not limited to:
* Low light conditions, such as driving at night or in dark tunnels.
* Bright light (due to oncoming headlights, direct sunlight, etc.).
* The driver's face is partially or completely outside field of view of the driver facing camera.
* The driver facing camera is obstructed, covered, or damaged.
The list above does not represent an exhaustive list of situations that may interfere with proper operation of openpilot components. A driver should not rely on openpilot DM to assess their level of attention.

View File

@@ -1,34 +0,0 @@
openpilot Safety
======
openpilot is an Adaptive Cruise Control (ACC) and Automated Lane Centering (ALC) system.
Like other ACC and ALC systems, openpilot is a failsafe passive system and it requires the
driver to be alert and to pay attention at all times.
In order to enforce driver alertness, openpilot includes a driver monitoring feature
that alerts the driver when distracted.
However, even with an attentive driver, we must make further efforts for the system to be
safe. We repeat, **driver alertness is necessary, but not sufficient, for openpilot to be
used safely** and openpilot is provided with no warranty of fitness for any purpose.
openpilot is developed in good faith to be compliant with FMVSS requirements and to follow
industry standards of safety for Level 2 Driver Assistance Systems. In particular, we observe
ISO26262 guidelines, including those from [pertinent documents](https://www.nhtsa.gov/sites/nhtsa.dot.gov/files/documents/13498a_812_573_alcsystemreport.pdf)
released by NHTSA. In addition, we impose strict coding guidelines (like [MISRA C : 2012](https://www.misra.org.uk/what-is-misra/))
on parts of openpilot that are safety relevant. We also perform software-in-the-loop,
hardware-in-the-loop and in-vehicle tests before each software release.
Following Hazard and Risk Analysis and FMEA, at a very high level, we have designed openpilot
ensuring two main safety requirements.
1. The driver must always be capable to immediately retake manual control of the vehicle,
by stepping on either pedal or by pressing the cancel button.
2. The vehicle must not alter its trajectory too quickly for the driver to safely
react. This means that while the system is engaged, the actuators are constrained
to operate within reasonable limits.
For additional safety implementation details, refer to [panda safety model](https://github.com/commaai/panda#safety-model). For vehicle specific implementation of the safety concept, refer to [panda/board/safety/](https://github.com/commaai/panda/tree/master/board/safety).
**Extra note**: comma.ai strongly discourages the use of openpilot forks with safety code either missing or
not fully meeting the above requirements.

View File

@@ -9,6 +9,7 @@ source "$BASEDIR/launch_env.sh"
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
function two_init {
export LD_LIBRARY_PATH="$BASEDIR/third_party/mapbox-gl-native-qt/aarch64:$LD_LIBRARY_PATH"
python /data/openpilot/scripts/installers/language_installer.py
python /data/openpilot/scripts/installers/sshkey_installer.py
python /data/openpilot/scripts/installers/font_installer.py
@@ -30,6 +31,11 @@ function two_init {
echo noop > $f
done
# set vol to 100 when boot
service call audio 3 i32 2 i32 100
service call audio 3 i32 3 i32 100
service call audio 3 i32 4 i32 100
# *** shield cores 2-3 ***
# TODO: should we enable this?
@@ -160,7 +166,7 @@ function tici_init {
# jetpack 4.6
function jetson_init {
# modeld need this
export LD_LIBRARY_PATH="/usr/lib/aarch64-linux-gnu:$LD_LIBRARY_PATH"
export LD_LIBRARY_PATH="/usr/lib/aarch64-linux-gnu:$BASEDIR/third_party/mapbox-gl-native-qt/jarch64:$LD_LIBRARY_PATH"
# jetpack 4.6 has mode 8
sudo nvpmodel -m 8
@@ -206,6 +212,19 @@ function jetson_init {
# hide mouse cursor
unclutter -idle 0 &
# prep for model
rm -fr $DIR/models/*.dlc
if [ -f "$DIR/models/supercombo.onnx" ]; then
file_check_sum=$(md5sum $DIR/models/supercombo.onnx | cut -d " " -f1)
if [[ $file_check_sum != "e9e19c5127f717dd94e8182201a08ab8" ]]; then
rm -fr $DIR/models/supercombo.onnx
fi
fi
# make sure we have right models
if [ ! -f "$DIR/models/supercombo.onnx" ]; then
wget https://github.com/commaai/openpilot/raw/be89044c51406eccb7ce7ae7678004a8fc774a7a/models/supercombo.onnx -O "$DIR/models/supercombo.onnx"
fi
}
function launch {
@@ -268,11 +287,6 @@ function launch {
tici_init
elif [ -f /JETSON ]; then
jetson_init
# make sure we have right models
if [ ! -f "$DIR/models/supercombo.onnx" ]; then
rm -fr $DIR/models/*.dlc
wget https://github.com/commaai/openpilot/raw/72a736f90e57a7d5845891ea34b17360b6f684d0/models/supercombo.onnx -O "$DIR/models/supercombo.onnx"
fi
fi
# write tmux scrollback to a file

View File

@@ -11,7 +11,7 @@ if [ -z "$REQUIRED_NEOS_VERSION" ]; then
fi
if [ -z "$AGNOS_VERSION" ]; then
export AGNOS_VERSION="2"
export AGNOS_VERSION="3"
fi
if [ -z "$PASSIVE" ]; then

Binary file not shown.

View File

@@ -323,4 +323,3 @@ VAL_ 506 FCW 3 "fcw" 2 "fcw" 1 "fcw" 0 "no_fcw" ;
VAL_ 780 HUD_LEAD 3 "no_car" 2 "solid_car" 1 "dashed_car" 0 "no_car" ;
VAL_ 829 BEEP 3 "single_beep" 2 "triple_beep" 1 "repeated_beep" 0 "no_beep" ;
CM_ "CHFFR_METRIC 342 STEER_ANGLE STEER_ANGLE 0.36 180; CHFFR_METRIC 380 ENGINE_RPM ENGINE_RPM 1 0; CHFFR_METRIC 804 ENGINE_TEMPERATURE ENGINE_TEMPERATURE 1 0";

View File

@@ -310,4 +310,3 @@ VAL_ 392 GEAR 26 "S" 4 "D" 3 "N" 2 "R" 1 "P" ;
VAL_ 399 STEER_STATUS 6 "tmp_fault" 5 "fault_1" 4 "no_torque_alert_2" 3 "low_speed_lockout" 2 "no_torque_alert_1" 0 "normal" ;
VAL_ 422 CRUISE_BUTTONS 7 "tbd" 6 "tbd" 5 "tbd" 4 "accel_res" 3 "decel_set" 2 "cancel" 1 "main" 0 "none" ;
CM_ "CHFFR_METRIC 342 STEER_ANGLE STEER_ANGLE 0.36 180; CHFFR_METRIC 380 ENGINE_RPM ENGINE_RPM 1 0; CHFFR_METRIC 804 ENGINE_TEMPERATURE ENGINE_TEMPERATURE 1 0";

View File

@@ -432,4 +432,3 @@ VAL_ 806 CMBS_BUTTON 3 "pressed" 0 "released" ;
VAL_ 891 WIPERS 4 "High" 2 "Low" 0 "Off" ;
VAL_ 829 BEEP 3 "single_beep" 2 "triple_beep" 1 "repeated_beep" 0 "no_beep" ;
CM_ "CHFFR_METRIC 330 STEER_ANGLE STEER_ANGLE 0.36 180; CHFFR_METRIC 380 ENGINE_RPM ENGINE_RPM 1 0; CHFFR_METRIC 804 ENGINE_TEMPERATURE ENGINE_TEMPERATURE 1 0";

View File

@@ -144,6 +144,9 @@ unsigned int volkswagen_crc(unsigned int address, uint64_t d, int l) {
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];
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];
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];
break;
@@ -172,7 +175,6 @@ unsigned int volkswagen_crc(unsigned int address, uint64_t d, int l) {
return crc ^ 0xFF; // Return after standard final XOR for CRC8 8H2F/AUTOSAR
}
unsigned int pedal_checksum(uint64_t d, int l) {
uint8_t crc = 0xFF;
uint8_t poly = 0xD5; // standard crc8

View File

@@ -489,4 +489,3 @@ VAL_ 806 CMBS_BUTTON 3 "pressed" 0 "released" ;
VAL_ 891 WIPERS 4 "High" 2 "Low" 0 "Off" ;
VAL_ 829 BEEP 3 "single_beep" 2 "triple_beep" 1 "repeated_beep" 0 "no_beep" ;
CM_ "CHFFR_METRIC 330 STEER_ANGLE STEER_ANGLE 0.36 180; CHFFR_METRIC 380 ENGINE_RPM ENGINE_RPM 1 0; CHFFR_METRIC 804 ENGINE_TEMPERATURE ENGINE_TEMPERATURE 1 0";

View File

@@ -492,4 +492,3 @@ VAL_ 806 CMBS_BUTTON 3 "pressed" 0 "released" ;
VAL_ 891 WIPERS 4 "High" 2 "Low" 0 "Off" ;
VAL_ 829 BEEP 3 "single_beep" 2 "triple_beep" 1 "repeated_beep" 0 "no_beep" ;
CM_ "CHFFR_METRIC 330 STEER_ANGLE STEER_ANGLE 0.36 180; CHFFR_METRIC 380 ENGINE_RPM ENGINE_RPM 1 0; CHFFR_METRIC 804 ENGINE_TEMPERATURE ENGINE_TEMPERATURE 1 0";

View File

@@ -485,4 +485,3 @@ VAL_ 806 CMBS_BUTTON 3 "pressed" 0 "released" ;
VAL_ 891 WIPERS 4 "High" 2 "Low" 0 "Off" ;
VAL_ 829 BEEP 3 "single_beep" 2 "triple_beep" 1 "repeated_beep" 0 "no_beep" ;
CM_ "CHFFR_METRIC 330 STEER_ANGLE STEER_ANGLE 0.36 180; CHFFR_METRIC 380 ENGINE_RPM ENGINE_RPM 1 0; CHFFR_METRIC 804 ENGINE_TEMPERATURE ENGINE_TEMPERATURE 1 0";

View File

@@ -394,4 +394,3 @@ VAL_ 884 DASHBOARD_ALERT 0 "none" 51 "acc_problem" 55 "cmbs_problem" 75 "key_not
VAL_ 891 WIPERS 4 "High" 2 "Low" 0 "Off" ;
VAL_ 927 ACC_ALERTS 29 "esp_active_acc_canceled" 10 "b_pedal_applied" 9 "speed_too_low" 8 "speed_too_high" 7 "p_brake_applied" 6 "gear_no_d" 5 "seatbelt" 4 "too_steep_downhill" 3 "too_steep_uphill" 2 "too_close" 1 "no_vehicle_ahead" ;
CM_ "CHFFR_METRIC 330 STEER_ANGLE STEER_ANGLE 0.36 180; CHFFR_METRIC 380 ENGINE_RPM ENGINE_RPM 1 0; CHFFR_METRIC 804 ENGINE_TEMPERATURE ENGINE_TEMPERATURE 1 0";

View File

@@ -496,4 +496,3 @@ VAL_ 806 CMBS_BUTTON 3 "pressed" 0 "released" ;
VAL_ 891 WIPERS 4 "High" 2 "Low" 0 "Off" ;
VAL_ 829 BEEP 3 "single_beep" 2 "triple_beep" 1 "repeated_beep" 0 "no_beep" ;
CM_ "CHFFR_METRIC 330 STEER_ANGLE STEER_ANGLE 0.36 180; CHFFR_METRIC 380 ENGINE_RPM ENGINE_RPM 1 0; CHFFR_METRIC 804 ENGINE_TEMPERATURE ENGINE_TEMPERATURE 1 0";

View File

@@ -316,4 +316,3 @@ VAL_ 422 LIGHTS_SETTING 3 "high_beam" 2 "low_beam" 1 "position" 0 "no_lights" ;
VAL_ 422 CRUISE_SETTING 3 "distance_adj" 2 "tbd" 1 "lkas_button" 0 "none" ;
VAL_ 891 WIPERS 4 "High" 2 "Low" 0 "Off" ;
CM_ "CHFFR_METRIC 342 STEER_ANGLE STEER_ANGLE 0.36 180; CHFFR_METRIC 380 ENGINE_RPM ENGINE_RPM 1 0; CHFFR_METRIC 804 ENGINE_TEMPERATURE ENGINE_TEMPERATURE 1 0";

View File

@@ -480,4 +480,3 @@ VAL_ 806 CMBS_BUTTON 3 "pressed" 0 "released" ;
VAL_ 891 WIPERS 4 "High" 2 "Low" 0 "Off" ;
VAL_ 829 BEEP 3 "single_beep" 2 "triple_beep" 1 "repeated_beep" 0 "no_beep" ;
CM_ "CHFFR_METRIC 330 STEER_ANGLE STEER_ANGLE 0.36 180; CHFFR_METRIC 380 ENGINE_RPM ENGINE_RPM 1 0; CHFFR_METRIC 804 ENGINE_TEMPERATURE ENGINE_TEMPERATURE 1 0";

View File

@@ -320,4 +320,3 @@ VAL_ 422 LIGHTS_SETTING 3 "high_beam" 2 "low_beam" 1 "position" 0 "no_lights" ;
VAL_ 422 CRUISE_SETTING 3 "distance_adj" 2 "tbd" 1 "lkas_button" 0 "none" ;
VAL_ 891 WIPERS 4 "High" 2 "Low" 0 "Off" ;
CM_ "CHFFR_METRIC 342 STEER_ANGLE STEER_ANGLE 0.36 180; CHFFR_METRIC 380 ENGINE_RPM ENGINE_RPM 1 0; CHFFR_METRIC 804 ENGINE_TEMPERATURE ENGINE_TEMPERATURE 1 0";

View File

@@ -345,4 +345,3 @@ VAL_ 422 CRUISE_BUTTONS 7 "tbd" 6 "tbd" 5 "tbd" 4 "accel_res" 3 "decel_set" 2 "c
VAL_ 422 LIGHTS_SETTING 3 "high_beam" 2 "low_beam" 1 "position" 0 "no_lights" ;
VAL_ 422 CRUISE_SETTING 3 "distance_adj" 2 "tbd" 1 "lkas_button" 0 "none" ;
CM_ "CHFFR_METRIC 342 STEER_ANGLE STEER_ANGLE 0.36 180; CHFFR_METRIC 380 ENGINE_RPM ENGINE_RPM 1 0; CHFFR_METRIC 804 ENGINE_TEMPERATURE ENGINE_TEMPERATURE 1 0";

View File

@@ -474,4 +474,3 @@ BO_ 1029 DOORS_STATUS: 8 BDY
VAL_ 419 GEAR 10 "R" 1 "D" 0 "P";
VAL_ 419 GEAR_SHIFTER 32 "D" 16 "N" 8 "R" 4 "P" ;
CM_ "CHFFR_METRIC 330 STEER_ANGLE STEER_ANGLE 0.36 180; CHFFR_METRIC 380 ENGINE_RPM ENGINE_RPM 1 0; CHFFR_METRIC 804 ENGINE_TEMPERATURE ENGINE_TEMPERATURE 1 0";

View File

@@ -357,4 +357,3 @@ VAL_ 891 WIPERS 4 "High" 2 "Low" 0 "Off" ;
VAL_ 927 ACC_ALERTS 29 "esp_active_acc_canceled" 10 "b_pedal_applied" 9 "speed_too_low" 8 "speed_too_high" 7 "p_brake_applied" 6 "gear_no_d" 5 "seatbelt" 4 "too_steep_downhill" 3 "too_steep_uphill" 2 "too_close" 1 "no_vehicle_ahead" ;
VAL_ 806 CMBS_BUTTON 3 "pressed" 0 "released" ;
CM_ "CHFFR_METRIC 342 STEER_ANGLE STEER_ANGLE 0.36 180; CHFFR_METRIC 380 ENGINE_RPM ENGINE_RPM 1 0; CHFFR_METRIC 804 ENGINE_TEMPERATURE ENGINE_TEMPERATURE 1 0";

View File

@@ -313,4 +313,3 @@ VAL_ 422 CRUISE_BUTTONS 7 "tbd" 6 "tbd" 5 "tbd" 4 "accel_res" 3 "decel_set" 2 "c
VAL_ 422 LIGHTS_SETTING 3 "high_beam" 2 "low_beam" 1 "position" 0 "no_lights" ;
VAL_ 422 CRUISE_SETTING 3 "distance_adj" 2 "tbd" 1 "lkas_button" 0 "none" ;
CM_ "CHFFR_METRIC 342 STEER_ANGLE STEER_ANGLE 0.36 180; CHFFR_METRIC 380 ENGINE_RPM ENGINE_RPM 1 0; CHFFR_METRIC 804 ENGINE_TEMPERATURE ENGINE_TEMPERATURE 1 0";

View File

@@ -308,4 +308,3 @@ VAL_ 422 CRUISE_BUTTONS 7 "tbd" 6 "tbd" 5 "tbd" 4 "accel_res" 3 "decel_set" 2 "c
VAL_ 422 LIGHTS_SETTING 3 "high_beam" 2 "low_beam" 1 "position" 0 "no_lights" ;
VAL_ 422 CRUISE_SETTING 3 "distance_adj" 2 "tbd" 1 "lkas_button" 0 "none" ;
CM_ "CHFFR_METRIC 342 STEER_ANGLE STEER_ANGLE 0.36 180; CHFFR_METRIC 380 ENGINE_RPM ENGINE_RPM 1 0; CHFFR_METRIC 804 ENGINE_TEMPERATURE ENGINE_TEMPERATURE 1 0";

View File

@@ -370,7 +370,6 @@ VAL_ 1162 TSGN3 0 "none" 1 "speed sign" 2 "0 unlimited" 7 "unlimited" 16 "highwa
VAL_ 1162 SPLSGN3 15 "conditional blank" 4 "wet road" 5 "rain" 0 "none";
CM_ "CHFFR_METRIC 37 STEER_ANGLE STEER_ANGLE 0.36 180";
CM_ "Imported file _comma.dbc starts here";

View File

@@ -370,7 +370,6 @@ VAL_ 1162 TSGN3 0 "none" 1 "speed sign" 2 "0 unlimited" 7 "unlimited" 16 "highwa
VAL_ 1162 SPLSGN3 15 "conditional blank" 4 "wet road" 5 "rain" 0 "none";
CM_ "CHFFR_METRIC 37 STEER_ANGLE STEER_ANGLE 0.36 180";
CM_ "Imported file _comma.dbc starts here";

View File

@@ -370,7 +370,6 @@ VAL_ 1162 TSGN3 0 "none" 1 "speed sign" 2 "0 unlimited" 7 "unlimited" 16 "highwa
VAL_ 1162 SPLSGN3 15 "conditional blank" 4 "wet road" 5 "rain" 0 "none";
CM_ "CHFFR_METRIC 37 STEER_ANGLE STEER_ANGLE 0.36 180";
CM_ "Imported file _comma.dbc starts here";

View File

@@ -370,7 +370,6 @@ VAL_ 1162 TSGN3 0 "none" 1 "speed sign" 2 "0 unlimited" 7 "unlimited" 16 "highwa
VAL_ 1162 SPLSGN3 15 "conditional blank" 4 "wet road" 5 "rain" 0 "none";
CM_ "CHFFR_METRIC 37 STEER_ANGLE STEER_ANGLE 0.36 180";
CM_ "Imported file _comma.dbc starts here";

View File

@@ -1,7 +1,37 @@
CM_ "AUTOGENERATED FILE, DO NOT EDIT";
CM_ "AUTOGENERATED FILE, DO NOT EDIT"
CM_ "Imported file _toyota_2017.dbc starts here";
CM_ "Imported file _comma.dbc starts here"
BO_ 359 STEERING_IPAS_COMMA: 8 IPAS
SG_ STATE : 7|4@0+ (1,0) [0|15] "" XXX
SG_ ANGLE : 3|12@0- (1.5,0) [-510|510] "deg" XXX
SG_ SET_ME_X10 : 23|8@0+ (1,0) [0|255] "" XXX
SG_ SET_ME_X00 : 31|8@0+ (1,0) [0|255] "" XXX
SG_ DIRECTION_CMD : 38|2@0+ (1,0) [0|3] "" XXX
SG_ SET_ME_X40 : 47|8@0+ (1,0) [0|255] "" XXX
SG_ SET_ME_X00 : 55|8@0+ (1,0) [0|255] "" XXX
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
CM BO_ STEERING_IPAS_COMMA "Copy of msg 614 so we can do angle control while the Park Assist ECU is connected (Panda spoofs 614 with 359 on connector J70). Note that addresses 0x266 and 0x167 are checksum-invariant";
BO_ 512 GAS_COMMAND: 6 EON
SG_ GAS_COMMAND : 7|16@0+ (0.159375,-75.555) [0|1] "" INTERCEPTOR
SG_ GAS_COMMAND2 : 23|16@0+ (0.159375,-151.111) [0|1] "" INTERCEPTOR
SG_ ENABLE : 39|1@0+ (1,0) [0|1] "" INTERCEPTOR
SG_ COUNTER_PEDAL : 35|4@0+ (1,0) [0|15] "" INTERCEPTOR
SG_ CHECKSUM_PEDAL : 47|8@0+ (1,0) [0|255] "" INTERCEPTOR
BO_ 513 GAS_SENSOR: 6 INTERCEPTOR
SG_ INTERCEPTOR_GAS : 7|16@0+ (0.159375,-75.555) [0|1] "" EON
SG_ INTERCEPTOR_GAS2 : 23|16@0+ (0.159375,-151.111) [0|1] "" EON
SG_ STATE : 39|4@0+ (1,0) [0|15] "" EON
SG_ COUNTER_PEDAL : 35|4@0+ (1,0) [0|15] "" EON
SG_ CHECKSUM_PEDAL : 47|8@0+ (1,0) [0|255] "" EON
VAL_ 513 STATE 5 "FAULT_TIMEOUT" 4 "FAULT_STARTUP" 3 "FAULT_SCE" 2 "FAULT_SEND" 1 "FAULT_BAD_CHECKSUM" 0 "NO_FAULT" ;
CM_ "Imported file _toyota_2017.dbc starts here"
VERSION ""
@@ -64,12 +94,12 @@ BO_ 180 SPEED: 8 XXX
SG_ SPEED : 47|16@0+ (0.01,0) [0|250] "kph" XXX
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
BO_ 353 DSU_SPEED: 7 XXX
BO_ 353 DSU_SPEED: 8 XXX
SG_ FORWARD_SPEED : 15|16@0- (0.00390625,-30) [0|255] "kph" XXX
BO_ 452 ENGINE_RPM: 8 CGW
SG_ RPM : 7|16@0- (0.78125,0) [0|0] "rpm" SCS
BO_ 466 PCM_CRUISE: 8 XXX
SG_ GAS_RELEASED : 4|1@0+ (1,0) [0|1] "" XXX
SG_ CRUISE_ACTIVE : 5|1@0+ (1,0) [0|1] "" XXX
@@ -166,16 +196,11 @@ BO_ 951 ESP_CONTROL: 8 ESP
SG_ BRAKE_HOLD_ENABLED : 33|1@1+ (1,0) [0|1] "" XXX
SG_ BRAKE_HOLD_ACTIVE : 36|1@0+ (1,0) [0|1] "" XXX
BO_ 1020 SOLAR_SENSOR: 8 XXX
SG_ LUX_SENSOR : 55|13@0+ (1,0) [0|0] "" XXX
BO_ 1041 ACC_HUD: 8 DSU
SG_ PCS_INDICATOR : 7|2@0+ (1,0) [0|3] "" XXX
SG_ FCW : 4|1@0+ (1,0) [0|1] "" XXX
SG_ SET_ME_X20 : 15|8@0+ (1,0) [0|1] "" XXX
SG_ SET_ME_X10 : 39|8@0+ (1,0) [0|1] "" XXX
SG_ PCS_OFF : 40|1@0+ (1,0) [0|0] "" XXX
SG_ PCS_SENSITIVITY : 55|8@0+ (1,0) [0|1] "" XXX
SG_ SET_ME_X80 : 55|8@0+ (1,0) [0|1] "" XXX
BO_ 1042 LKAS_HUD: 8 XXX
SG_ BARRIERS : 1|2@0+ (1,0) [0|3] "" XXX
@@ -229,15 +254,11 @@ BO_ 1410 VIN_PART_3: 8 CGW
BO_ 1553 UI_SETTING: 8 XXX
SG_ UNITS : 26|2@0+ (1,0) [0|3] "" XXX
SG_ ODOMETER : 43|20@0+ (1,0) [0|1048575] "" XXX
BO_ 1556 STEERING_LEVERS: 8 XXX
SG_ TURN_SIGNALS : 29|2@0+ (1,0) [0|3] "" XXX
SG_ HAZARD_LIGHT : 27|1@0+ (1,0) [0|1] "" XXX
BO_ 1568 SEATS_DOORS: 8 XXX
SG_ METER_DIMMED : 38|1@0+ (1,0) [0|1] "" XXX
SG_ PARKING_BRAKE : 60|1@0+ (1,0) [0|1] "" XXX
SG_ SEATBELT_DRIVER_UNLATCHED : 62|1@0+ (1,0) [0|1] "" XXX
SG_ DOOR_OPEN_FL : 45|1@0+ (1,0) [0|1] "" XXX
SG_ DOOR_OPEN_RL : 42|1@0+ (1,0) [0|1] "" XXX
@@ -246,11 +267,6 @@ BO_ 1568 SEATS_DOORS: 8 XXX
BO_ 1570 LIGHT_STALK: 8 SCM
SG_ AUTO_HIGH_BEAM : 37|1@0+ (1,0) [0|1] "" XXX
SG_ FRONT_FOG : 27|1@0+ (1,0) [0|1] "" XXX
SG_ PARKING_LIGHT : 28|1@0+ (1,0) [0|1] "" XXX
SG_ LOW_BEAM : 29|1@0+ (1,0) [0|1] "" XXX
SG_ HIGH_BEAM : 30|1@0+ (1,0) [0|1] "" XXX
SG_ DAYTIME_RUNNING_LIGHT : 31|1@0+ (1,0) [0|1] "" XXX
BO_ 1161 RSA1: 8 FCM
SG_ TSGN1 : 7|8@0+ (1,0) [0|0] "" XXX
@@ -294,18 +310,12 @@ BO_ 1163 RSA3: 8 FCM
SG_ OVSPVALH : 27|4@0+ (1,-5) [0|0] "" XXX
SG_ TSRSPU : 33|2@0+ (1,0) [0|0] "" XXX
BO_ 1571 CENTRAL_GATEWAY_UNIT: 8 CGW
SG_ DOOR_LOCK_FEEDBACK_LIGHT : 15|1@0+ (1,0) [0|0] "" XXX
SG_ KEYFOB_LOCKING_FEEDBACK_LIGHT : 61|1@0+ (1,0) [0|0] "" XXX
SG_ KEYFOB_UNLOCKING_FEEDBACK_LIGHT : 62|1@0+ (1,0) [0|0] "" XXX
CM_ SG_ 36 ACCEL_Y "unit is tbd";
CM_ SG_ 36 YAW_RATE "verify";
CM_ SG_ 36 STEERING_TORQUE "does not seem the steer torque, tbd";
CM_ SG_ 37 STEER_FRACTION "1/15th of the signal STEER_ANGLE, which is 1.5 deg; note that 0x8 is never set";
CM_ SG_ 37 STEER_RATE "factor is tbd";
CM_ SG_ 466 ACCEL_NET "net acceleration produced by the system, given ACCEL_CMD, road grade and other factors";
CM_ SG_ 466 CRUISE_STATE "Active state is 8, if standstill is requested will switch to state 11(3 sec timer), after timer is elapsed will switch into state 7(standstill). If plus button was pressed - status 9, minus button pressed - status 10";
CM_ SG_ 467 SET_SPEED "43 kph are shown as 28mph, so conversion isn't perfect";
CM_ SG_ 467 LOW_SPEED_LOCKOUT "in low speed lockout, system would always disengage below 28mph";
CM_ SG_ 560 BRAKE_PRESSED "another brake pressed?";
@@ -315,23 +325,13 @@ CM_ SG_ 614 ANGLE "set to measured angle when ipas control isn't active";
CM_ SG_ 643 COUNTER "only used on cars that use this msg for cruise control";
CM_ SG_ 643 BRAKE_STATUS "only used on cars that use this msg for cruise control";
CM_ SG_ 643 PRECOLLISION_ACTIVE "set 0.5s before any braking";
CM_ SG_ 835 ACC_TYPE "if 2, car is likely to have a permanent low speed lockout. 1 is ok";
CM_ SG_ 835 RADAR_DIRTY "Display Clean Radar Sensor message on HUD";
CM_ SG_ 835 ACC_MALFUNCTION "display ACC fault on dash if set to 1";
CM_ SG_ 835 ACC_CUT_IN "Display blinking yellow lead if set to 1";
CM_ SG_ 835 DISTANCE "Display Distance Bars on HUD Permanently";
CM_ SG_ 835 ALLOW_LONG_PRESS "Enable Toyota's factory set speed increment behaviour, available on both metrics cars and imperial unit cars";
CM_ SG_ 835 PERMIT_BRAKING "Original ACC has this going high when a car in front is detected. In openpilot and before the PERMIT_BRAKING name, this was 'SET_ME_1' and is hardcoded to be high. Unsure if only informational or has an effect though existing usage in openpilot is to always set it to 1. Originally 'PMTBRKG' in the leaked toyota_2017_ref_pt.dbc file and name expansion speculated to be PerMiT BRaKinG.";
CM_ SG_ 835 ACCEL_CMD_ALT "Copy of main ACCEL_CMD, but across 8 bits instead of 16 bits like ACCEL_CMD. Unsure if only informational or has an effect. Likely informational as existing openpilot sets this to 0 and no loss of functionality observed. Originally 'AT_RAW' in leaked toyota_2017_ref_pt.dbc file.";
CM_ SG_ 921 UI_SET_SPEED "set speed shown in UI with user set unit";
CM_ SG_ 951 BRAKE_LIGHTS_ACC "brake lights when ACC commands decel";
CM_ SG_ 1041 PCS_INDICATOR "Pre-Collision System Indicator";
CM_ SG_ 1041 PCS_SENSITIVITY "Pre-Collision System Sensitivity";
CM_ SG_ 1042 SET_ME_1 "unclear what this is, but it's always 1 in drive traces";
CM_ SG_ 1042 REPEATED_BEEPS "recommended for fcw and other important alerts";
CM_ SG_ 1161 SPDVAL1 "Numbers 0-199 is displayed, 200-254 displays circle without number and 255 is for no limit.";
CM_ SG_ 1161 SYNCID1 "counter from 1 to f at 1 Hz";
CM_ SG_ 1161 SPDVAL2 "conditional speed value 70";
CM_ SG_ 1161 SPDVAL2 "conditional speed value 70"
CM_ SG_ 1162 SGNNUMP "1 if SPDVAL1 is set, otherwise 0";
CM_ SG_ 1162 SYNCID2 "counter from 1 to f at 1 Hz";
CM_ SG_ 1163 TSREQPD "always 1";
@@ -343,20 +343,13 @@ CM_ SG_ 1163 OVSPVALL "-5 at start then 2 after 2 seconds";
CM_ SG_ 1163 OVSPVALM "-5 at start then 5 after 2 seconds";
CM_ SG_ 1163 OVSPVALH "-5 at start then 10 after 2 seconds";
CM_ SG_ 1163 TSRSPU "always 1";
CM_ SG_ 1553 ODOMETER "Unit is dependent upon units signal";
VAL_ 466 CRUISE_STATE 11 "timer_3sec" 10 "adaptive click down" 9 "adaptive click up" 8 "adaptive engaged" 7 "standstill" 6 "non-adaptive click up" 5 "non-adaptive click down" 4 "non-adaptive hold down" 3 "non-adaptive hold up" 2 "non-adaptive being engaged" 1 "non-adaptive engaged" 0 "off";
VAL_ 466 CRUISE_STATE 8 "active" 7 "standstill" 1 "off";
VAL_ 467 LOW_SPEED_LOCKOUT 2 "low speed locked" 1 "ok";
VAL_ 614 STATE 3 "enabled" 1 "disabled";
VAL_ 614 DIRECTION_CMD 3 "right" 2 "center" 1 "left";
VAL_ 643 STATE 0 "normal" 1 "adaptive_cruise_control" 3 "emergency_braking";
VAL_ 835 ACC_TYPE 2 "permanent low speed lockout" 1 "ok";
VAL_ 835 ACC_MALFUNCTION 1 "faulted" 0 "ok";
VAL_ 835 ACC_CUT_IN 1 "CUT-IN Detected" 0 "clear";
VAL_ 835 ALLOW_LONG_PRESS 2 "set speed increase by 5 speed units regardless" 1 "set speed increase by 1 speed unit on short press, 5 speed units on long press";
VAL_ 921 CRUISE_CONTROL_STATE 2 "disabled" 11 "hold" 10 "hold_waiting_user_cmd" 6 "enabled" 5 "faulted";
VAL_ 1041 PCS_INDICATOR 2 "PCS Faulted" 1 "PCS Turned Off By User" 0 "PCS Enabled";
VAL_ 1041 PCS_SENSITIVITY 64 "high sensitivity" 128 "mid sensitivity" 192 "low sensitivity" 0 "off";
VAL_ 1042 LDA_ALERT 3 "hold with continuous beep" 2 "LDA unavailable" 1 "hold" 0 "none";
VAL_ 1042 BARRIERS 3 "both" 2 "right" 1 "left" 0 "none";
VAL_ 1042 RIGHT_LINE 3 "orange" 2 "faded" 1 "solid" 0 "none";
@@ -366,55 +359,13 @@ VAL_ 1556 TURN_SIGNALS 3 "none" 2 "right" 1 "left";
VAL_ 1161 TSGN1 1 "speed sign" 0 "none";
VAL_ 1161 TSGN2 1 "speed sign" 0 "none";
VAL_ 1161 SPLSGN2 15 "conditional blank" 4 "wet road" 5 "rain" 0 "none";
VAL_ 1162 TSGN3 0 "none" 1 "speed sign" 2 "0 unlimited" 7 "unlimited" 16 "highway" 17 "no highway" 18 "motorway" 19 "no motorway" 20 "in city" 21 "outside city" 22 "pedestrian area" 23 "no pedestrian area" 65 "no overtaking left" 66 "no overtaking right" 67 "overtaking allowed again" 81 "no right turn" 97 "stop" 105 "yield" 113 "stop" 114 "yield us" 129 "no entry" 138 "no entry tss2" 145 "do not enter";
VAL_ 1162 TSGN3 0 "none" 1 "speed sign" 2 "0 unlimited" 7 "unlimited" 16 "highway" 17 "no highway" 18 "motorway" 19 "no motorway" 20 "in city" 21 "outside city" 22 "pedestrian area" 23 "no pedestrian area" 65 "no overtaking left" 66 "no overtaking right" 67 "overtaking allowed again" 129 "no entry";
VAL_ 1162 SPLSGN3 15 "conditional blank" 4 "wet road" 5 "rain" 0 "none";
CM_ "CHFFR_METRIC 37 STEER_ANGLE STEER_ANGLE 0.36 180";
CM_ "Imported file _comma.dbc starts here";
BO_ 359 STEERING_IPAS_COMMA: 8 IPAS
SG_ STATE : 7|4@0+ (1,0) [0|15] "" XXX
SG_ ANGLE : 3|12@0- (1.5,0) [-510|510] "deg" XXX
SG_ SET_ME_X10 : 23|8@0+ (1,0) [0|255] "" XXX
SG_ SET_ME_X00 : 31|8@0+ (1,0) [0|255] "" XXX
SG_ DIRECTION_CMD : 38|2@0+ (1,0) [0|3] "" XXX
SG_ SET_ME_X40 : 47|8@0+ (1,0) [0|255] "" XXX
SG_ SET_ME_X00_1 : 55|8@0+ (1,0) [0|255] "" XXX
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
CM_ "BO_ STEERING_IPAS_COMMA: Copy of msg 614 so we can do angle control while the Park Assist ECU is connected (Panda spoofs 614 with 359 on connector J70). Note that addresses 0x266 and 0x167 are checksum-invariant";
BO_ 512 GAS_COMMAND: 6 EON
SG_ GAS_COMMAND : 7|16@0+ (0.159375,-75.555) [0|1] "" INTERCEPTOR
SG_ GAS_COMMAND2 : 23|16@0+ (0.159375,-151.111) [0|1] "" INTERCEPTOR
SG_ ENABLE : 39|1@0+ (1,0) [0|1] "" INTERCEPTOR
SG_ COUNTER_PEDAL : 35|4@0+ (1,0) [0|15] "" INTERCEPTOR
SG_ CHECKSUM_PEDAL : 47|8@0+ (1,0) [0|255] "" INTERCEPTOR
BO_ 513 GAS_SENSOR: 6 INTERCEPTOR
SG_ INTERCEPTOR_GAS : 7|16@0+ (0.159375,-75.555) [0|1] "" EON
SG_ INTERCEPTOR_GAS2 : 23|16@0+ (0.159375,-151.111) [0|1] "" EON
SG_ STATE : 39|4@0+ (1,0) [0|15] "" EON
SG_ COUNTER_PEDAL : 35|4@0+ (1,0) [0|15] "" EON
SG_ CHECKSUM_PEDAL : 47|8@0+ (1,0) [0|255] "" EON
VAL_ 513 STATE 5 "FAULT_TIMEOUT" 4 "FAULT_STARTUP" 3 "FAULT_SCE" 2 "FAULT_SEND" 1 "FAULT_BAD_CHECKSUM" 0 "NO_FAULT" ;
BO_ 35 SECONDARY_STEER_ANGLE: 8 XXX
SG_ ZORRO_STEER : 7|24@0- (0.004901594652,0) [-500|500] "" XXX
CM_ "BO_ SECONDARY_STEER_ANGLE: ZSS is a high-precision steering angle sensor that can replace the lower resolution sensor in most TSS1 Toyotas. Learn more: https://github.com/commaai/openpilot/wiki/Toyota-Lexus#zorro-steering-sensor-zss";
BO_ 767 SDSU: 8 XXX
SG_ FD_BUTTON : 7|1@0+ (1,0) [0|1] "" XXX
CM_ "BO_ SDSU: The sDSU is a modified DSU for use in TSS1 Toyotas. Learn more: https://github.com/wocsor/panda/tree/smart_dsu";
CM_ SG_ 767 FD_BUTTON "The follow distance button signal as forwarded by the sdsu";
CM_ "lexus_gs300h_2017_pt.dbc starts here";
CM_ "lexus_nxt_2015_pt.dbc starts here"
@@ -423,11 +374,15 @@ BO_ 550 BRAKE_MODULE: 8 XXX
SG_ BRAKE_POSITION : 16|9@0+ (1,0) [0|511] "" XXX
SG_ BRAKE_PRESSED : 37|1@0+ (1,0) [0|1] "" XXX
BO_ 581 GAS_PEDAL: 5 XXX
BO_ 581 GAS_PEDAL_ALT: 5 XXX
SG_ GAS_PEDAL : 23|8@0+ (0.005,0) [0|1] "" XXX
BO_ 705 GAS_PEDAL: 8 XXX
SG_ GAS_RELEASED : 3|1@0+ (1,0) [0|1] "" XXX
SG_ GAS_PEDAL : 55|8@0+ (0.005,0) [0|1] "" XXX
BO_ 608 STEER_TORQUE_SENSOR: 8 XXX
SG_ STEER_TORQUE_EPS : 47|16@0- (0.73,0) [-20000|20000] "" XXX
SG_ STEER_TORQUE_EPS : 47|16@0- (1.0,0) [-20000|20000] "" XXX
SG_ STEER_TORQUE_DRIVER : 15|16@0- (1,0) [-32768|32767] "" XXX
SG_ STEER_OVERRIDE : 0|1@0+ (1,0) [0|1] "" XXX
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
@@ -442,15 +397,18 @@ BO_ 610 EPS_STATUS: 5 EPS
BO_ 956 GEAR_PACKET: 8 XXX
SG_ GEAR : 13|6@0+ (1,0) [0|63] "" XXX
BO_ 1009 PCM_CRUISE_3: 8 XXX
BO_ 1009 PCM_CRUISE_ALT: 8 XXX
SG_ MAIN_ON : 13|1@0+ (1,0) [0|3] "" XXX
SG_ CRUISE_STATE : 10|1@0+ (1,0) [0|1] "" XXX
SG_ SET_SPEED : 23|8@0+ (1,0) [0|255] "mph" XXX
SG_ CRUISE_STATE : 10|1@0+ (1,0) [0|15] "" XXX
BO_ 1599 LIGHT_STALK_ISH: 8 SCM
SG_ AUTO_HIGH_BEAM : 19|1@0+ (1,0) [0|1] "" XXX
CM_ SG_ 550 BRAKE_PRESSURE "seems prop to pedal force";
CM_ SG_ 550 BRAKE_POSITION "seems proportional to pedal displacement, unclear the max value of 0x1c8";
CM_ SG_ 581 GAS_PEDAL "it seems slightly filtered";
CM_ SG_ 610 TYPE "seems 1 on Corolla, 0 on all others";
CM_ SG_ 1009 SET_SPEED "units seem to be whatever the car is set to";
VAL_ 956 GEAR 0 "D" 1 "S" 8 "N" 16 "R" 32 "P";
VAL_ 610 IPAS_STATE 5 "override" 3 "enabled" 1 "disabled";
VAL_ 610 LKA_STATE 25 "temporary_fault" 9 "temporary_fault2" 5 "active" 1 "standby";
VAL_ 956 GEAR 0 "D" 1 "S" 8 "N" 16 "R" 32 "P";

View File

@@ -370,7 +370,6 @@ VAL_ 1162 TSGN3 0 "none" 1 "speed sign" 2 "0 unlimited" 7 "unlimited" 16 "highwa
VAL_ 1162 SPLSGN3 15 "conditional blank" 4 "wet road" 5 "rain" 0 "none";
CM_ "CHFFR_METRIC 37 STEER_ANGLE STEER_ANGLE 0.36 180";
CM_ "Imported file _comma.dbc starts here";

View File

@@ -370,7 +370,6 @@ VAL_ 1162 TSGN3 0 "none" 1 "speed sign" 2 "0 unlimited" 7 "unlimited" 16 "highwa
VAL_ 1162 SPLSGN3 15 "conditional blank" 4 "wet road" 5 "rain" 0 "none";
CM_ "CHFFR_METRIC 37 STEER_ANGLE STEER_ANGLE 0.36 180";
CM_ "Imported file _comma.dbc starts here";

View File

@@ -83,7 +83,7 @@ BO_ 569 CRUISE_THROTTLE: 8 XXX
SG_ FOLLOW_DISTANCE_BUTTON : 26|1@0+ (1,0) [0|1] "" XXX
SG_ CANCEL_BUTTON : 25|1@0+ (1,0) [0|1] "" XXX
SG_ PROPILOT_BUTTON : 24|1@0+ (1,0) [0|1] "" XXX
SG_ unsure4 : 39|6@0+ (1,0) [0|63] "" XXX
SG_ USER_BRAKE_PRESSED : 37|1@0+ (1,0) [0|1] "" XXX
SG_ COUNTER : 32|2@1+ (1,0) [0|3] "" XXX
SG_ unsure5 : 47|8@0+ (1,0) [0|255] "" XXX
SG_ unsure6 : 55|8@0+ (1,0) [0|255] "" XXX

View File

@@ -748,4 +748,3 @@ VAL_ 1160 DAS_steeringControlType 1 "ANGLE_CONTROL" 3 "DISABLED" 0 "NONE" 2 "RES
VAL_ 1160 DAS_steeringHapticRequest 1 "ACTIVE" 0 "IDLE" ;
CM_ "CHFFR_METRIC 1160 DAS_steeringAngleRequest STEER_ANGLE 0.1098666 180; CHFFR_METRIC 264 DI_motorRPM ENGINE_RPM 1 0";

View File

@@ -0,0 +1,179 @@
VERSION ""
NS_ :
NS_DESC_
CM_
BA_DEF_
BA_
VAL_
CAT_DEF_
CAT_
FILTER
BA_DEF_DEF_
EV_DATA_
ENVVAR_DATA_
SGTYPE_
SGTYPE_VAL_
BA_DEF_SGTYPE_
BA_SGTYPE_
SIG_TYPE_REF_
VAL_TABLE_
SIG_GROUP_
SIG_VALTYPE_
SIGTYPE_VALTYPE_
BO_TX_BU_
BA_DEF_REL_
BA_REL_
BA_DEF_DEF_REL_
BU_SG_REL_
BU_EV_REL_
BU_BO_REL_
SG_MUL_VAL_
BS_:
BU_:
NEO
MCU
GTW
EPAS
DI
ESP
SBW
STW
APP
DAS
XXX
BO_ 262 DI_torque1: 8 DI
SG_ DI_torqueDriver : 0|13@1- (0.25,0) [-750|750] "Nm" NEO
SG_ DI_torque1Counter : 13|3@1+ (1,0) [0|0] "" NEO
SG_ DI_torqueMotor : 16|13@1- (0.25,0) [-750|750] "Nm" NEO
SG_ DI_soptState : 29|3@1+ (1,0) [0|0] "" NEO
SG_ DI_motorRPM : 32|16@1- (1,0) [-17000|17000] "RPM" NEO
SG_ DI_pedalPos : 48|8@1+ (0.4,0) [0|100] "%" NEO
SG_ DI_torque1Checksum : 56|8@1+ (1,0) [0|0] "" NEO
BO_ 278 DI_torque2: 6 DI
SG_ DI_torqueEstimate : 0|12@1- (0.5,0) [-750|750] "Nm" NEO
SG_ DI_gear : 12|3@1+ (1,0) [0|0] "" NEO
SG_ DI_brakePedal : 15|1@1+ (1,0) [0|0] "" NEO
SG_ DI_vehicleSpeed : 16|12@1+ (0.05,-25) [-25|179.75] "MPH" NEO
SG_ DI_gearRequest : 28|3@1+ (1,0) [0|0] "" NEO
SG_ DI_torqueInterfaceFailure : 31|1@1+ (1,0) [0|0] "" NEO
SG_ DI_torque2Counter : 32|4@1+ (1,0) [0|0] "" NEO
SG_ DI_brakePedalState : 36|2@1+ (1,0) [0|0] "" NEO
SG_ DI_epbParkRequest : 38|1@1+ (1,0) [0|0] "" NEO
SG_ DI_epbInterfaceReady : 39|1@1+ (1,0) [0|0] "" NEO
SG_ DI_torque2Checksum : 40|8@1+ (1,0) [0|0] "" NEO
BO_ 504 BrakeMessage: 8 XXX
SG_ driverBrakeStatus : 2|2@1+ (1,0) [0|3] "" XXX
BO_ 568 STW_ACTN_RQ: 8 STW
SG_ SpdCtrlLvr_Stat : 0|6@1+ (1,0) [0|0] "" NEO
SG_ VSL_Enbl_Rq : 6|1@1+ (1,0) [0|0] "" NEO
SG_ SpdCtrlLvrStat_Inv : 7|1@1+ (1,0) [0|0] "" NEO
SG_ DTR_Dist_Rq : 8|8@1+ (1,0) [0|200] "" NEO
SG_ TurnIndLvr_Stat : 16|2@1+ (1,0) [0|0] "" NEO
SG_ HiBmLvr_Stat : 18|2@1+ (1,0) [0|0] "" NEO
SG_ WprWashSw_Psd : 20|2@1+ (1,0) [0|0] "" NEO
SG_ WprWash_R_Sw_Posn_V2 : 22|2@1+ (1,0) [0|0] "" NEO
SG_ StW_Lvr_Stat : 24|3@1+ (1,0) [0|0] "" NEO
SG_ StW_Cond_Flt : 27|1@1+ (1,0) [0|0] "" NEO
SG_ StW_Cond_Psd : 28|2@1+ (1,0) [0|0] "" NEO
SG_ HrnSw_Psd : 30|2@1+ (1,0) [0|0] "" NEO
SG_ StW_Sw00_Psd : 32|1@1+ (1,0) [0|0] "" NEO
SG_ StW_Sw01_Psd : 33|1@1+ (1,0) [0|0] "" NEO
SG_ StW_Sw02_Psd : 34|1@1+ (1,0) [0|0] "" NEO
SG_ StW_Sw03_Psd : 35|1@1+ (1,0) [0|0] "" NEO
SG_ StW_Sw04_Psd : 36|1@1+ (1,0) [0|0] "" NEO
SG_ StW_Sw05_Psd : 37|1@1+ (1,0) [0|0] "" NEO
SG_ StW_Sw06_Psd : 38|1@1+ (1,0) [0|0] "" NEO
SG_ StW_Sw07_Psd : 39|1@1+ (1,0) [0|0] "" NEO
SG_ StW_Sw08_Psd : 40|1@1+ (1,0) [0|0] "" NEO
SG_ StW_Sw09_Psd : 41|1@1+ (1,0) [0|0] "" NEO
SG_ StW_Sw10_Psd : 42|1@1+ (1,0) [0|0] "" NEO
SG_ StW_Sw11_Psd : 43|1@1+ (1,0) [0|0] "" NEO
SG_ StW_Sw12_Psd : 44|1@1+ (1,0) [0|0] "" NEO
SG_ StW_Sw13_Psd : 45|1@1+ (1,0) [0|0] "" NEO
SG_ StW_Sw14_Psd : 46|1@1+ (1,0) [0|0] "" NEO
SG_ StW_Sw15_Psd : 47|1@1+ (1,0) [0|0] "" NEO
SG_ WprSw6Posn : 48|3@1+ (1,0) [0|0] "" NEO
SG_ MC_STW_ACTN_RQ : 52|4@1+ (1,0) [0|15] "" NEO
SG_ CRC_STW_ACTN_RQ : 56|8@1+ (1,0) [0|0] "" NEO
BO_ 598 DI_state: 8 DI
SG_ DI_systemState : 0|3@1+ (1,0) [0|0] "" NEO
SG_ DI_vehicleHoldState : 3|3@1+ (1,0) [0|0] "" NEO
SG_ DI_proximity : 6|1@1+ (1,0) [0|0] "" NEO
SG_ DI_driveReady : 7|1@1+ (1,0) [0|0] "" NEO
SG_ DI_regenLight : 8|1@1+ (1,0) [0|0] "" NEO
SG_ DI_state : 9|3@1+ (1,0) [0|0] "" NEO
SG_ DI_cruiseState : 12|4@1+ (1,0) [0|0] "" NEO
SG_ DI_analogSpeed : 16|12@1+ (0.1,0) [0|150] "speed" NEO
SG_ DI_immobilizerState : 28|3@1+ (1,0) [0|0] "" NEO
SG_ DI_speedUnits : 31|1@1+ (1,0) [0|1] "" NEO
SG_ DI_cruiseSet : 32|9@1+ (0.5,0) [0|255.5] "speed" NEO
SG_ DI_aebState : 41|3@1+ (1,0) [0|0] "" NEO
SG_ DI_stateCounter : 44|4@1+ (1,0) [0|0] "" NEO
SG_ DI_digitalSpeed : 48|8@1+ (1,0) [0|250] "" NEO
SG_ DI_stateChecksum : 56|8@1+ (1,0) [0|0] "" NEO
BO_ 703 DAS_control: 8 GTW
SG_ DAS_setSpeed : 0|12@1+ (0.1,0) [0|409.4] "kph" DI,PM,APS
SG_ DAS_accState : 12|4@1+ (1,0) [0|0] "" DI,PM,APS
SG_ DAS_aebEvent : 16|2@1+ (1,0) [0|3] "" DI,PM,APS
SG_ DAS_jerkMin : 18|9@1+ (0.03,-15.232) [-15.232|0.098] "m/s^3" DI,PM,APS
SG_ DAS_jerkMax : 27|8@1+ (0.059,0) [0|15.045] "m/s^3" DI,PM,APS
SG_ DAS_accelMin : 35|9@1+ (0.04,-15) [-15|5.44] "m/s^2" DI,PM,APS
SG_ DAS_accelMax : 44|9@1+ (0.04,-15) [-15|5.44] "m/s^2" DI,PM,APS
SG_ DAS_controlCounter : 53|3@1+ (1,0) [0|0] "" DI,PM,APS
SG_ DAS_controlChecksum : 56|8@1+ (1,0) [0|0] "" DI,PM,APS
VAL_ 262 DI_torqueDriver -4096 "SNA" ;
VAL_ 262 DI_torqueMotor -4096 "SNA" ;
VAL_ 262 DI_soptState 7 "SOPT_TEST_SNA" 4 "SOPT_TEST_NOT_RUN" 3 "SOPT_TEST_PASSED" 2 "SOPT_TEST_FAILED" 1 "SOPT_TEST_IN_PROGRESS" 0 "SOPT_PRE_TEST" ;
VAL_ 262 DI_motorRPM -32768 "SNA" ;
VAL_ 262 DI_pedalPos 255 "SNA" ;
VAL_ 278 DI_torqueEstimate -2048 "SNA" ;
VAL_ 278 DI_gear 7 "DI_GEAR_SNA" 4 "DI_GEAR_D" 3 "DI_GEAR_N" 2 "DI_GEAR_R" 1 "DI_GEAR_P" 0 "DI_GEAR_INVALID" ;
VAL_ 278 DI_brakePedal 1 "Applied" 0 "Not_applied" ;
VAL_ 278 DI_vehicleSpeed 4095 "SNA" ;
VAL_ 278 DI_gearRequest 7 "DI_GEAR_SNA" 4 "DI_GEAR_D" 3 "DI_GEAR_N" 2 "DI_GEAR_R" 1 "DI_GEAR_P" 0 "DI_GEAR_INVALID" ;
VAL_ 278 DI_torqueInterfaceFailure 1 "TORQUE_INTERFACE_FAILED" 0 "TORQUE_INTERFACE_NORMAL" ;
VAL_ 278 DI_brakePedalState 3 "SNA" 2 "INVALID" 1 "ON" 0 "OFF" ;
VAL_ 278 DI_epbParkRequest 1 "Park_requested" 0 "No_request" ;
VAL_ 278 DI_epbInterfaceReady 1 "EPB_INTERFACE_READY" 0 "EPB_INTERFACE_NOT_READY" ;
VAL_ 504 driverBrakeStatus 2 "APPLIED" 1 "NOT_APPLIED" ;
VAL_ 568 SpdCtrlLvr_Stat 32 "DN_1ST" 16 "UP_1ST" 8 "DN_2ND" 4 "UP_2ND" 2 "RWD" 1 "FWD" 0 "IDLE" ;
VAL_ 568 DTR_Dist_Rq 255 "SNA" 200 "ACC_DIST_7" 166 "ACC_DIST_6" 133 "ACC_DIST_5" 100 "ACC_DIST_4" 66 "ACC_DIST_3" 33 "ACC_DIST_2" 0 "ACC_DIST_1" ;
VAL_ 568 TurnIndLvr_Stat 3 "SNA" 2 "RIGHT" 1 "LEFT" 0 "IDLE" ;
VAL_ 568 HiBmLvr_Stat 3 "SNA" 2 "HIBM_FLSH_ON_PSD" 1 "HIBM_ON_PSD" 0 "IDLE" ;
VAL_ 568 WprWashSw_Psd 3 "SNA" 2 "WASH" 1 "TIPWIPE" 0 "NPSD" ;
VAL_ 568 WprWash_R_Sw_Posn_V2 3 "SNA" 2 "WASH" 1 "INTERVAL" 0 "OFF" ;
VAL_ 568 StW_Lvr_Stat 4 "STW_BACK" 3 "STW_FWD" 2 "STW_DOWN" 1 "STW_UP" 0 "NPSD" ;
VAL_ 568 StW_Cond_Psd 3 "SNA" 2 "DOWN" 1 "UP" 0 "NPSD" ;
VAL_ 568 HrnSw_Psd 3 "SNA" 2 "NDEF2" 1 "PSD" 0 "NPSD" ;
VAL_ 568 StW_Sw00_Psd 1 "PRESSED" 0 "NOT_PRESSED_SNA" ;
VAL_ 568 StW_Sw01_Psd 1 "PRESSED" 0 "NOT_PRESSED_SNA" ;
VAL_ 568 StW_Sw03_Psd 1 "PRESSED" 0 "NOT_PRESSED_SNA" ;
VAL_ 568 StW_Sw04_Psd 1 "PRESSED" 0 "NOT_PRESSED_SNA" ;
VAL_ 568 WprSw6Posn 7 "SNA" 6 "STAGE2" 5 "STAGE1" 4 "INTERVAL4" 3 "INTERVAL3" 2 "INTERVAL2" 1 "INTERVAL1" 0 "OFF" ;
VAL_ 598 DI_aebState 2 "ENABLED" 4 "FAULT" 7 "SNA" 1 "STANDBY" 3 "STANDSTILL" 0 "UNAVAILABLE" ;
VAL_ 598 DI_analogSpeed 4095 "SNA" ;
VAL_ 598 DI_cruiseState 2 "ENABLED" 5 "FAULT" 0 "OFF" 4 "OVERRIDE" 7 "PRE_CANCEL" 6 "PRE_FAULT" 1 "STANDBY" 3 "STANDSTILL" ;
VAL_ 598 DI_digitalSpeed 255 "SNA" ;
VAL_ 598 DI_immobilizerState 2 "AUTHENTICATING" 3 "DISARMED" 6 "FAULT" 4 "IDLE" 0 "INIT_SNA" 1 "REQUEST" 5 "RESET" ;
VAL_ 598 DI_speedUnits 1 "KPH" 0 "MPH" ;
VAL_ 598 DI_state 3 "ABORT" 4 "ENABLE" 2 "FAULT" 1 "STANDBY" 0 "UNAVAILABLE" ;
VAL_ 598 DI_systemState 3 "ABORT" 4 "ENABLE" 2 "FAULT" 1 "STANDBY" 0 "UNAVAILABLE" ;
VAL_ 598 DI_vehicleHoldState 2 "BLEND_IN" 4 "BLEND_OUT" 6 "FAULT" 7 "INIT" 5 "PARK" 1 "STANDBY" 3 "STANDSTILL" 0 "UNAVAILABLE" ;
VAL_ 703 DAS_setSpeed 4095 "SNA" ;
VAL_ 703 DAS_accState 15 "FAULT_SNA" 13 "ACC_CANCEL_GENERIC_SILENT" 11 "APC_SELFPARK_START" 10 "APC_UNPARK_COMPLETE" 9 "APC_PAUSE" 8 "APC_ABORT" 7 "APC_COMPLETE" 6 "APC_FORWARD" 5 "APC_BACKWARD" 4 "ACC_ON" 3 "ACC_HOLD" 0 "ACC_CANCEL_GENERIC" ;
VAL_ 703 DAS_aebEvent 3 "AEB_SNA" 2 "AEB_FAULT" 1 "AEB_ACTIVE" 0 "AEB_NOT_ACTIVE" ;
VAL_ 703 DAS_jerkMin 511 "SNA" ;
VAL_ 703 DAS_jerkMax 255 "SNA" ;
VAL_ 703 DAS_accelMin 511 "SNA" ;
VAL_ 703 DAS_accelMax 511 "SNA" ;

View File

@@ -370,7 +370,6 @@ VAL_ 1162 TSGN3 0 "none" 1 "speed sign" 2 "0 unlimited" 7 "unlimited" 16 "highwa
VAL_ 1162 SPLSGN3 15 "conditional blank" 4 "wet road" 5 "rain" 0 "none";
CM_ "CHFFR_METRIC 37 STEER_ANGLE STEER_ANGLE 0.36 180";
CM_ "Imported file _comma.dbc starts here";

View File

@@ -370,7 +370,6 @@ VAL_ 1162 TSGN3 0 "none" 1 "speed sign" 2 "0 unlimited" 7 "unlimited" 16 "highwa
VAL_ 1162 SPLSGN3 15 "conditional blank" 4 "wet road" 5 "rain" 0 "none";
CM_ "CHFFR_METRIC 37 STEER_ANGLE STEER_ANGLE 0.36 180";
CM_ "Imported file _comma.dbc starts here";

View File

@@ -370,7 +370,6 @@ VAL_ 1162 TSGN3 0 "none" 1 "speed sign" 2 "0 unlimited" 7 "unlimited" 16 "highwa
VAL_ 1162 SPLSGN3 15 "conditional blank" 4 "wet road" 5 "rain" 0 "none";
CM_ "CHFFR_METRIC 37 STEER_ANGLE STEER_ANGLE 0.36 180";
CM_ "Imported file _comma.dbc starts here";

View File

@@ -370,7 +370,6 @@ VAL_ 1162 TSGN3 0 "none" 1 "speed sign" 2 "0 unlimited" 7 "unlimited" 16 "highwa
VAL_ 1162 SPLSGN3 15 "conditional blank" 4 "wet road" 5 "rain" 0 "none";
CM_ "CHFFR_METRIC 37 STEER_ANGLE STEER_ANGLE 0.36 180";
CM_ "Imported file _comma.dbc starts here";

View File

@@ -370,7 +370,6 @@ VAL_ 1162 TSGN3 0 "none" 1 "speed sign" 2 "0 unlimited" 7 "unlimited" 16 "highwa
VAL_ 1162 SPLSGN3 15 "conditional blank" 4 "wet road" 5 "rain" 0 "none";
CM_ "CHFFR_METRIC 37 STEER_ANGLE STEER_ANGLE 0.36 180";
CM_ "Imported file _comma.dbc starts here";

View File

@@ -380,7 +380,6 @@ VAL_ 1162 TSGN3 0 "none" 1 "speed sign" 2 "0 unlimited" 7 "unlimited" 16 "highwa
VAL_ 1162 SPLSGN3 15 "conditional blank" 4 "wet road" 5 "rain" 0 "none";
CM_ "CHFFR_METRIC 37 STEER_ANGLE STEER_ANGLE 0.36 180";
CM_ "Imported file _comma.dbc starts here";

View File

@@ -370,7 +370,6 @@ VAL_ 1162 TSGN3 0 "none" 1 "speed sign" 2 "0 unlimited" 7 "unlimited" 16 "highwa
VAL_ 1162 SPLSGN3 15 "conditional blank" 4 "wet road" 5 "rain" 0 "none";
CM_ "CHFFR_METRIC 37 STEER_ANGLE STEER_ANGLE 0.36 180";
CM_ "Imported file _comma.dbc starts here";

View File

@@ -370,7 +370,6 @@ VAL_ 1162 TSGN3 0 "none" 1 "speed sign" 2 "0 unlimited" 7 "unlimited" 16 "highwa
VAL_ 1162 SPLSGN3 15 "conditional blank" 4 "wet road" 5 "rain" 0 "none";
CM_ "CHFFR_METRIC 37 STEER_ANGLE STEER_ANGLE 0.36 180";
CM_ "Imported file _comma.dbc starts here";

View File

@@ -128,15 +128,18 @@ BO_ 742 LEAD_INFO: 8 DSU
BO_ 835 ACC_CONTROL: 8 DSU
SG_ ACCEL_CMD : 7|16@0- (0.001,0) [-20|20] "m/s2" HCU
SG_ ACC_MALFUNCTION : 18|1@0+ (1,0) [0|0] "" XXX
SG_ ACC_CUT_IN : 25|1@0+ (1,0) [0|1] "" XXX
SG_ ALLOW_LONG_PRESS : 17|2@0+ (1,0) [0|2] "" XXX
SG_ ACC_TYPE : 23|2@0+ (1,0) [0|3] "" HCU
SG_ DISTANCE : 20|1@0+ (1,0) [0|1] "" XXX
SG_ MINI_CAR : 21|1@0+ (1,0) [0|1] "" XXX
SG_ SET_ME_X3 : 19|4@0+ (1,0) [0|15] "" XXX
SG_ PERMIT_BRAKING : 30|1@0+ (1,0) [0|1] "" HCU
SG_ RELEASE_STANDSTILL : 31|1@0+ (1,0) [0|1] "" HCU
SG_ CANCEL_REQ : 24|1@0+ (1,0) [0|1] "" HCU
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
SG_ ACCEL_CMD_ALT : 47|8@0- (0.05,0) [0|0] "m/s^2" XXX
SG_ RADAR_DIRTY : 19|1@0+ (1,0) [0|1] "" XXX
BO_ 836 PRE_COLLISION_2: 8 DSU
SG_ CHECKSUM : 63|8@0+ (1,0) [0|0] "" XXX
@@ -160,6 +163,8 @@ BO_ 951 ESP_CONTROL: 8 ESP
SG_ TC_DISABLED : 13|1@0+ (1,0) [0|1] "" XXX
SG_ VSC_DISABLED : 12|2@0+ (1,0) [0|1] "" XXX
SG_ BRAKE_LIGHTS_ACC : 18|1@0+ (1,0) [0|1] "" XXX
SG_ BRAKE_HOLD_ENABLED : 33|1@1+ (1,0) [0|1] "" XXX
SG_ BRAKE_HOLD_ACTIVE : 36|1@0+ (1,0) [0|1] "" XXX
BO_ 1020 SOLAR_SENSOR: 8 XXX
SG_ LUX_SENSOR : 55|13@0+ (1,0) [0|0] "" XXX

View File

@@ -370,7 +370,6 @@ VAL_ 1162 TSGN3 0 "none" 1 "speed sign" 2 "0 unlimited" 7 "unlimited" 16 "highwa
VAL_ 1162 SPLSGN3 15 "conditional blank" 4 "wet road" 5 "rain" 0 "none";
CM_ "CHFFR_METRIC 37 STEER_ANGLE STEER_ANGLE 0.36 180";
CM_ "Imported file _comma.dbc starts here";

View File

@@ -370,7 +370,6 @@ VAL_ 1162 TSGN3 0 "none" 1 "speed sign" 2 "0 unlimited" 7 "unlimited" 16 "highwa
VAL_ 1162 SPLSGN3 15 "conditional blank" 4 "wet road" 5 "rain" 0 "none";
CM_ "CHFFR_METRIC 37 STEER_ANGLE STEER_ANGLE 0.36 180";
CM_ "Imported file _comma.dbc starts here";

View File

@@ -370,7 +370,6 @@ VAL_ 1162 TSGN3 0 "none" 1 "speed sign" 2 "0 unlimited" 7 "unlimited" 16 "highwa
VAL_ 1162 SPLSGN3 15 "conditional blank" 4 "wet road" 5 "rain" 0 "none";
CM_ "CHFFR_METRIC 37 STEER_ANGLE STEER_ANGLE 0.36 180";
CM_ "Imported file _comma.dbc starts here";

View File

@@ -33,7 +33,7 @@ NS_ :
BS_:
BU_: Airbag_MQB BAP_Tester_MQB BMS_MQB Datenlogger_MQB Gateway_MQB Getriebe_DQ_Hybrid_MQB Getriebe_DQ_MQB LEH_MQB Motor_Diesel_MQB Motor_Hybrid_MQB Motor_Otto_MQB SAK_MQB Waehlhebel_MQB Vector__XXX 9 l c i XXX
BU_: Airbag_MQB BAP_Tester_MQB BMS_MQB Datenlogger_MQB Gateway_MQB Getriebe_DQ_Hybrid_MQB Getriebe_DQ_MQB LEH_MQB Motor_Diesel_MQB Motor_Hybrid_MQB Motor_Otto_MQB SAK_MQB Waehlhebel_MQB Vector__XXX l c i XXX
BO_ 290 ACC_06: 8 Gateway_MQB
@@ -1253,8 +1253,17 @@ BO_ 780 ACC_02: 8 XXX
SG_ ACC_Status_Anzeige : 61|3@1+ (1.0,0.0) [0.0|7] "" XXX
BO_ 302 ACC_07: 8 XXX
SG_ ACC_07_BZ : 8|4@1+ (1,0) [0|15] "" XXX
SG_ ACC_07_CRC : 0|8@1+ (1,0) [0|255] "" XXX
SG_ CHECKSUM : 0|8@1+ (1,0) [0|255] "" XXX
SG_ COUNTER : 8|4@1+ (1,0) [0|15] "" XXX
SG_ ACC_Distance_to_Stop : 12|11@1+ (0.01,0) [0|1] "m" XXX
SG_ ACC_Hold_Request : 23|1@1+ (1,0) [0|1] "x" XXX
SG_ ACC_Boost_Request : 24|1@1+ (1,0) [0|1] "" XXX
SG_ ACC_Freewheel_Request : 25|1@1+ (1,0) [0|1] "" XXX
SG_ ACC_Freewheel_Type : 26|2@1+ (1,0) [0|3] "enum" XXX
SG_ ACC_Hold_Type : 28|3@1+ (1,0) [0|15] "enum" XXX
SG_ ACC_Hold_Release : 31|1@1+ (1,0) [0|1] "" XXX
SG_ ACC_Accel_Secondary : 32|8@1+ (0.03,-4.6) [-4.6|2.99] "m/s2" XXX
SG_ ACC_Accel_TSK : 53|11@1+ (0.005,-7.22) [-7.22|3.005] "m/s2" XXX
BO_ 264 Fahrwerk_01: 8 XXX
SG_ Fahrwerk_01_BZ : 8|4@1+ (1,0) [0|15] "" XXX
@@ -1360,18 +1369,24 @@ BO_ 391 EV_Gearshift: 8 XXX
SG_ RegenBrakingMode : 12|2@1+ (1,0) [0|3] "" XXX
CM_ SG_ 134 LWI_Lenkradwinkel "Steering angle WITH variable ratio effect included";
CM_ SG_ 159 EPS_HCA_Status "Status of Heading Control Assist feature"
CM_ SG_ 159 EPS_HCA_Status "Status of Heading Control Assist feature";
CM_ SG_ 159 EPS_Lenkmoment "Steering input by driver, torque";
CM_ SG_ 159 EPS_VZ_Lenkmoment "Steering input by driver, direction";
CM_ SG_ 159 EPS_Berechneter_LW "Raw steering angle, degrees";
CM_ SG_ 159 EPS_VZ_BLW "Raw steering angle, direction"
CM_ SG_ 159 EPS_VZ_BLW "Raw steering angle, direction";
CM_ SG_ 173 COUNTERXX "Message not renamed to COUNTER because J533 rate-limiting makes it look like messages are being lost";
CM_ SG_ 294 3 "May be zero when sent by older cameras";
CM_ SG_ 294 7 "May be zero when sent by older cameras";
CM_ SG_ 294 254 "May be zero when sent by older cameras";
CM_ SG_ 294 SET_ME_0X3 "May be zero when sent by older cameras";
CM_ SG_ 294 SET_ME_0X07 "May be zero when sent by older cameras";
CM_ SG_ 294 SET_ME_0XFE "May be zero when sent by older cameras";
CM_ SG_ 294 Assist_Torque "Heading control input, torque";
CM_ SG_ 294 Assist_VZ "Heading control input, direction (sign)";
CM_ SG_ 294 HCA_Available "Must be 1 for steering rack to accept HCA commands";
CM_ SG_ 302 ACC_Hold_Request "Active request for ABS brake hold in ACC_Hold_Type";
CM_ SG_ 302 ACC_Boost_Request "Hybrid engine start related";
CM_ SG_ 302 ACC_Freewheel_Request "Active request for DSG sailing/coasting in ACC_Freewheel_Type";
CM_ SG_ 302 ACC_Hold_Release "Request to ABS to release brake hold";
CM_ SG_ 302 ACC_Accel_Secondary "Target acceleration of the secondary controller";
CM_ SG_ 302 ACC_Accel_TSK "Mirror of request to TSK to implement a target acceleration";
CM_ SG_ 870 Hazard_Switch "Four-way flashers active";
CM_ SG_ 870 Comfort_Signal_Left "Comfort turn signal active, left";
CM_ SG_ 870 Comfort_Signal_Right "Comfort turn signal active, right";
@@ -1397,6 +1412,9 @@ CM_ SG_ 391 GearPosition "Traditional PRND plus B-mode aggressive regen, B-mode
CM_ SG_ 960 ZAS_Kl_15 "Indicates ignition on";
VAL_ 159 EPS_HCA_Status 0 "disabled" 1 "initializing" 2 "fault" 3 "ready" 4 "rejected" 5 "active";
VAL_ 173 GE_Fahrstufe 5 "P" 6 "R" 7 "N" 8 "D" 9 "S" 10 "E" 14 "T";
VAL_ 288 TSK_Status 0 "init" 1 "disabled" 2 "enabled" 3 "regulating" 4 "accel_pedal_override" 5 "brake_only" 6 "temp_fault" 7 "perm_fault";
VAL_ 302 ACC_Freewheel_Type 0 "freewheel_released" 1 "freewheel_not_permitted" 2 "freewheel_not_released" 3 "freewheel_requested" ;
VAL_ 302 ACC_Hold_Type 0 "no_request" 1 "hold" 2 "park" 3 "hold_standby" 4 "startup" 5 "loosen_over_ramp" ;
VAL_ 391 GearPosition 2 "P" 3 "R" 4 "N" 5 "D" 6 "D";
VAL_ 391 RegenBrakingMode 0 "default" 1 "B1" 2 "B2" 3 "B3";
VAL_ 870 Fast_Send_Rate_Active 0 "1 Hz" 1 "50 Hz";

View File

@@ -1,8 +1,8 @@
# flake8: noqa
# pylint: skip-file
from .python import Panda, PandaWifiStreaming, PandaDFU, flash_release, \
BASEDIR, ensure_st_up_to_date, PandaSerial, \
DEFAULT_FW_FN, DEFAULT_H7_FW_FN, MCU_TYPE_H7, MCU_TYPE_F4
BASEDIR, ensure_st_up_to_date, PandaSerial, pack_can_buffer, unpack_can_buffer, \
DEFAULT_FW_FN, DEFAULT_H7_FW_FN, MCU_TYPE_H7, MCU_TYPE_F4, DLC_TO_LEN, LEN_TO_DLC
from .python.config import BOOTSTUB_ADDRESS, BLOCK_SIZE_FX, APP_ADDRESS_FX, \
BLOCK_SIZE_H7, APP_ADDRESS_H7, DEVICE_SERIAL_NUMBER_ADDR_H7, \

View File

@@ -23,10 +23,10 @@ if os.getenv("PEDAL"):
],
}
if FindFile('dp_vw_panda', '/data/params/d') != None:
with open('/data/params/d/dp_vw_panda') as f:
if (int(f.read().strip())) == 1:
build_projects["pedal_usb"]["PROJECT_FLAGS"].append('-Dvw')
# if FindFile('dp_vw_panda', '/data/params/d') != None:
# with open('/data/params/d/dp_vw_panda') as f:
# if (int(f.read().strip())) == 1:
# build_projects["pedal_usb"]["PROJECT_FLAGS"].append('-Dvw')
if os.getenv("PEDAL_USB"):
build_projects["pedal_usb"] = build_projects.pop("pedal")

View File

@@ -0,0 +1,29 @@
#include "dlc_to_len.h"
#define CAN_PACKET_VERSION 2
typedef struct {
unsigned char reserved : 1;
unsigned char bus : 3;
unsigned char data_len_code : 4;
unsigned char rejected : 1;
unsigned char returned : 1;
unsigned char extended : 1;
unsigned int addr : 29;
unsigned char data[CANPACKET_DATA_SIZE_MAX];
} __attribute__((packed, aligned(4))) CANPacket_t;
#define GET_BUS(msg) ((msg)->bus)
#define GET_LEN(msg) (dlc_to_len[(msg)->data_len_code])
#define GET_ADDR(msg) ((msg)->addr)
// Flasher and pedal use raw mailbox access
#define GET_MAILBOX_BYTE(msg, b) (((int)(b) > 3) ? (((msg)->RDHR >> (8U * ((unsigned int)(b) % 4U))) & 0xFFU) : (((msg)->RDLR >> (8U * (unsigned int)(b))) & 0xFFU))
#define GET_MAILBOX_BYTES_04(msg) ((msg)->RDLR)
#define GET_MAILBOX_BYTES_48(msg) ((msg)->RDHR)
#define CAN_INIT_TIMEOUT_MS 500U
#define CANPACKET_HEAD_SIZE 5U
#define WORD_TO_BYTE_ARRAY(dst8, src32) 0[dst8] = ((src32) & 0xFFU); 1[dst8] = (((src32) >> 8U) & 0xFFU); 2[dst8] = (((src32) >> 16U) & 0xFFU); 3[dst8] = (((src32) >> 24U) & 0xFFU)
#define BYTE_ARRAY_TO_WORD(dst32, src8) ((dst32) = 0[src8] | (1[src8] << 8U) | (2[src8] << 16U) | (3[src8] << 24U))

View File

@@ -34,16 +34,6 @@
#define MAX_RESP_LEN 0x40U
#define GET_BUS(msg) (((msg)->RDTR >> 4) & 0xFF)
#define GET_LEN(msg) ((msg)->RDTR & 0xF)
#define GET_ADDR(msg) ((((msg)->RIR & 4) != 0) ? ((msg)->RIR >> 3) : ((msg)->RIR >> 21))
#define GET_BYTE(msg, b) (((int)(b) > 3) ? (((msg)->RDHR >> (8U * ((unsigned int)(b) % 4U))) & 0xFFU) : (((msg)->RDLR >> (8U * (unsigned int)(b))) & 0xFFU))
#define GET_BYTES_04(msg) ((msg)->RDLR)
#define GET_BYTES_48(msg) ((msg)->RDHR)
#define GET_FLAG(value, mask) (((__typeof__(mask))(value) & (mask)) == (mask))
#define CAN_INIT_TIMEOUT_MS 500U
#include <stdbool.h>
#ifdef STM32H7
#include "stm32h7/stm32h7_config.h"

1
panda/board/dlc_to_len.h Normal file
View File

@@ -0,0 +1 @@
unsigned char dlc_to_len[] = {0U, 1U, 2U, 3U, 4U, 5U, 6U, 7U, 8U, 12U, 16U, 20U, 24U, 32U, 48U, 64U};

View File

@@ -9,7 +9,7 @@ bool can_set_speed(uint8_t can_number) {
CAN_TypeDef *CAN = CANIF_FROM_CAN_NUM(can_number);
uint8_t bus_number = BUS_NUM_FROM_CAN_NUM(can_number);
ret &= llcan_set_speed(CAN, can_speed[bus_number], can_loopback, (unsigned int)(can_silent) & (1U << can_number));
ret &= llcan_set_speed(CAN, bus_config[bus_number].can_speed, can_loopback, (unsigned int)(can_silent) & (1U << can_number));
return ret;
}
@@ -17,7 +17,7 @@ bool can_set_speed(uint8_t can_number) {
void can_set_gmlan(uint8_t bus) {
if(current_board->has_hw_gmlan){
// first, disable GMLAN on prev bus
uint8_t prev_bus = can_num_lookup[3];
uint8_t prev_bus = bus_config[3].can_num_lookup;
if (bus != prev_bus) {
switch (prev_bus) {
case 1:
@@ -26,9 +26,9 @@ void can_set_gmlan(uint8_t bus) {
puth(prev_bus + 1U);
puts("\n");
current_board->set_can_mode(CAN_MODE_NORMAL);
bus_lookup[prev_bus] = prev_bus;
can_num_lookup[prev_bus] = prev_bus;
can_num_lookup[3] = -1;
bus_config[prev_bus].bus_lookup = prev_bus;
bus_config[prev_bus].can_num_lookup = prev_bus;
bus_config[3].can_num_lookup = -1;
bool ret = can_init(prev_bus);
UNUSED(ret);
break;
@@ -46,9 +46,9 @@ void can_set_gmlan(uint8_t bus) {
puth(bus + 1U);
puts("\n");
current_board->set_can_mode((bus == 1U) ? CAN_MODE_GMLAN_CAN2 : CAN_MODE_GMLAN_CAN3);
bus_lookup[bus] = 3;
can_num_lookup[bus] = -1;
can_num_lookup[3] = bus;
bus_config[bus].bus_lookup = 3;
bus_config[bus].can_num_lookup = -1;
bus_config[3].can_num_lookup = bus;
bool ret = can_init(bus);
UNUSED(ret);
break;
@@ -101,18 +101,23 @@ void process_can(uint8_t can_number) {
uint8_t bus_number = BUS_NUM_FROM_CAN_NUM(can_number);
// check for empty mailbox
CAN_FIFOMailBox_TypeDef to_send;
CANPacket_t to_send;
if ((CAN->TSR & CAN_TSR_TME0) == CAN_TSR_TME0) {
// add successfully transmitted message to my fifo
if ((CAN->TSR & CAN_TSR_RQCP0) == CAN_TSR_RQCP0) {
can_txd_cnt += 1;
if ((CAN->TSR & CAN_TSR_TXOK0) == CAN_TSR_TXOK0) {
CAN_FIFOMailBox_TypeDef to_push;
to_push.RIR = CAN->sTxMailBox[0].TIR;
to_push.RDTR = (CAN->sTxMailBox[0].TDTR & 0xFFFF000FU) | ((CAN_BUS_RET_FLAG | bus_number) << 4);
to_push.RDLR = CAN->sTxMailBox[0].TDLR;
to_push.RDHR = CAN->sTxMailBox[0].TDHR;
CANPacket_t to_push;
to_push.returned = 1U;
to_push.rejected = 0U;
to_push.extended = (CAN->sTxMailBox[0].TIR >> 2) & 0x1U;
to_push.addr = (to_push.extended != 0U) ? (CAN->sTxMailBox[0].TIR >> 3) : (CAN->sTxMailBox[0].TIR >> 21);
to_push.data_len_code = CAN->sTxMailBox[0].TDTR & 0xFU;
to_push.bus = bus_number;
WORD_TO_BYTE_ARRAY(&to_push.data[0], CAN->sTxMailBox[0].TDLR);
WORD_TO_BYTE_ARRAY(&to_push.data[4], CAN->sTxMailBox[0].TDHR);
can_send_errs += can_push(&can_rx_q, &to_push) ? 0U : 1U;
}
@@ -136,10 +141,12 @@ void process_can(uint8_t can_number) {
if (can_pop(can_queues[bus_number], &to_send)) {
can_tx_cnt += 1;
// only send if we have received a packet
CAN->sTxMailBox[0].TDLR = to_send.RDLR;
CAN->sTxMailBox[0].TDHR = to_send.RDHR;
CAN->sTxMailBox[0].TDTR = to_send.RDTR;
CAN->sTxMailBox[0].TIR = to_send.RIR;
CAN->sTxMailBox[0].TIR = ((to_send.extended != 0U) ? (to_send.addr << 3) : (to_send.addr << 21)) | (to_send.extended << 2);
CAN->sTxMailBox[0].TDTR = to_send.data_len_code;
BYTE_ARRAY_TO_WORD(CAN->sTxMailBox[0].TDLR, &to_send.data[0]);
BYTE_ARRAY_TO_WORD(CAN->sTxMailBox[0].TDHR, &to_send.data[4]);
// Send request TXRQ
CAN->sTxMailBox[0].TIR |= 0x1U;
usb_cb_ep3_out_complete();
}
@@ -161,23 +168,29 @@ void can_rx(uint8_t can_number) {
pending_can_live = 1;
// add to my fifo
CAN_FIFOMailBox_TypeDef to_push;
to_push.RIR = CAN->sFIFOMailBox[0].RIR;
to_push.RDTR = CAN->sFIFOMailBox[0].RDTR;
to_push.RDLR = CAN->sFIFOMailBox[0].RDLR;
to_push.RDHR = CAN->sFIFOMailBox[0].RDHR;
CANPacket_t to_push;
// modify RDTR for our API
to_push.RDTR = (to_push.RDTR & 0xFFFF000F) | (bus_number << 4);
to_push.returned = 0U;
to_push.rejected = 0U;
to_push.extended = (CAN->sFIFOMailBox[0].RIR >> 2) & 0x1U;
to_push.addr = (to_push.extended != 0U) ? (CAN->sFIFOMailBox[0].RIR >> 3) : (CAN->sFIFOMailBox[0].RIR >> 21);
to_push.data_len_code = CAN->sFIFOMailBox[0].RDTR & 0xFU;
to_push.bus = bus_number;
WORD_TO_BYTE_ARRAY(&to_push.data[0], CAN->sFIFOMailBox[0].RDLR);
WORD_TO_BYTE_ARRAY(&to_push.data[4], CAN->sFIFOMailBox[0].RDHR);
// forwarding (panda only)
int bus_fwd_num = (can_forwarding[bus_number] != -1) ? can_forwarding[bus_number] : safety_fwd_hook(bus_number, &to_push);
int bus_fwd_num = safety_fwd_hook(bus_number, &to_push);
if (bus_fwd_num != -1) {
CAN_FIFOMailBox_TypeDef to_send;
to_send.RIR = to_push.RIR | 1; // TXRQ
to_send.RDTR = to_push.RDTR;
to_send.RDLR = to_push.RDLR;
to_send.RDHR = to_push.RDHR;
CANPacket_t to_send;
to_send.returned = 0U;
to_send.rejected = 0U;
to_send.extended = to_push.extended; // TXRQ
to_send.addr = to_push.addr;
to_send.bus = to_push.bus;
to_send.data_len_code = to_push.data_len_code;
(void)memcpy(to_send.data, to_push.data, dlc_to_len[to_push.data_len_code]);
can_send(&to_send, bus_fwd_num, true);
}

View File

@@ -2,11 +2,19 @@ typedef struct {
volatile uint32_t w_ptr;
volatile uint32_t r_ptr;
uint32_t fifo_size;
CAN_FIFOMailBox_TypeDef *elems;
CANPacket_t *elems;
} can_ring;
#define CAN_BUS_RET_FLAG 0x80U
#define CAN_BUS_NUM_MASK 0x7FU
typedef struct {
uint8_t bus_lookup;
uint8_t can_num_lookup;
uint32_t can_speed;
uint32_t can_data_speed;
bool canfd_enabled;
bool brs_enabled;
} bus_config_t;
#define CAN_BUS_NUM_MASK 0x3FU
#define BUS_MAX 4U
@@ -21,8 +29,6 @@ extern int pending_can_live;
// must reinit after changing these
extern int can_loopback;
extern int can_silent;
extern uint32_t can_speed[4];
extern uint32_t can_data_speed[3];
// Ignition detected from CAN meessages
bool ignition_can = false;
@@ -43,14 +49,19 @@ void process_can(uint8_t can_number);
// ********************* instantiate queues *********************
#define can_buffer(x, size) \
CAN_FIFOMailBox_TypeDef elems_##x[size]; \
can_ring can_##x = { .w_ptr = 0, .r_ptr = 0, .fifo_size = (size), .elems = (CAN_FIFOMailBox_TypeDef *)&(elems_##x) };
CANPacket_t elems_##x[size]; \
can_ring can_##x = { .w_ptr = 0, .r_ptr = 0, .fifo_size = (size), .elems = (CANPacket_t *)&(elems_##x) };
#ifdef STM32H7
__attribute__((section(".ram_d1"))) can_buffer(rx_q, 0x1000)
__attribute__((section(".ram_d1"))) can_buffer(txgmlan_q, 0x1A0)
#else
can_buffer(rx_q, 0x1000)
can_buffer(tx1_q, 0x100)
can_buffer(tx2_q, 0x100)
can_buffer(tx3_q, 0x100)
can_buffer(txgmlan_q, 0x100)
can_buffer(txgmlan_q, 0x1A0)
#endif
can_buffer(tx1_q, 0x1A0)
can_buffer(tx2_q, 0x1A0)
can_buffer(tx3_q, 0x1A0)
// FIXME:
// cppcheck-suppress misra-c2012-9.3
can_ring *can_queues[] = {&can_tx1_q, &can_tx2_q, &can_tx3_q, &can_txgmlan_q};
@@ -63,7 +74,7 @@ int can_err_cnt = 0;
int can_overflow_cnt = 0;
// ********************* interrupt safe queue *********************
bool can_pop(can_ring *q, CAN_FIFOMailBox_TypeDef *elem) {
bool can_pop(can_ring *q, CANPacket_t *elem) {
bool ret = 0;
ENTER_CRITICAL();
@@ -81,7 +92,7 @@ bool can_pop(can_ring *q, CAN_FIFOMailBox_TypeDef *elem) {
return ret;
}
bool can_push(can_ring *q, CAN_FIFOMailBox_TypeDef *elem) {
bool can_push(can_ring *q, CANPacket_t *elem) {
bool ret = false;
uint32_t next_w_ptr;
@@ -150,20 +161,21 @@ void can_clear(can_ring *q) {
// can number: numeric lookup for MCU CAN interfaces (0 = CAN1, 1 = CAN2, etc);
// bus_lookup: Translates from 'can number' to 'bus number'.
// can_num_lookup: Translates from 'bus number' to 'can number'.
// can_forwarding: Given a bus num, lookup bus num to forward to. -1 means no forward.
// Helpers
// Panda: Bus 0=CAN1 Bus 1=CAN2 Bus 2=CAN3
uint8_t bus_lookup[] = {0,1,2};
uint8_t can_num_lookup[] = {0,1,2,-1};
int8_t can_forwarding[] = {-1,-1,-1,-1};
uint32_t can_speed[] = {5000, 5000, 5000, 333};
uint32_t can_data_speed[] = {5000, 5000, 5000}; //For CAN FD with BRS only
bus_config_t bus_config[] = {
{ .bus_lookup = 0U, .can_num_lookup = 0U, .can_speed = 5000U, .can_data_speed = 5000U, .canfd_enabled = false, .brs_enabled = false },
{ .bus_lookup = 1U, .can_num_lookup = 1U, .can_speed = 5000U, .can_data_speed = 5000U, .canfd_enabled = false, .brs_enabled = false },
{ .bus_lookup = 2U, .can_num_lookup = 2U, .can_speed = 5000U, .can_data_speed = 5000U, .canfd_enabled = false, .brs_enabled = false },
{ .bus_lookup = 0xFFU, .can_num_lookup = 0xFFU, .can_speed = 333U, .can_data_speed = 333U, .canfd_enabled = false, .brs_enabled = false },
};
#define CAN_MAX 3U
#define CANIF_FROM_CAN_NUM(num) (cans[num])
#define BUS_NUM_FROM_CAN_NUM(num) (bus_lookup[num])
#define CAN_NUM_FROM_BUS_NUM(num) (can_num_lookup[num])
#define BUS_NUM_FROM_CAN_NUM(num) (bus_config[num].bus_lookup)
#define CAN_NUM_FROM_BUS_NUM(num) (bus_config[num].can_num_lookup)
void can_init_all(void) {
bool ret = true;
@@ -175,13 +187,13 @@ void can_init_all(void) {
}
void can_flip_buses(uint8_t bus1, uint8_t bus2){
bus_lookup[bus1] = bus2;
bus_lookup[bus2] = bus1;
can_num_lookup[bus1] = bus2;
can_num_lookup[bus2] = bus1;
bus_config[bus1].bus_lookup = bus2;
bus_config[bus2].bus_lookup = bus1;
bus_config[bus1].can_num_lookup = bus2;
bus_config[bus2].can_num_lookup = bus1;
}
void ignition_can_hook(CAN_FIFOMailBox_TypeDef *to_push) {
void ignition_can_hook(CANPacket_t *to_push) {
int bus = GET_BUS(to_push);
int addr = GET_ADDR(to_push);
int len = GET_LEN(to_push);
@@ -189,23 +201,30 @@ void ignition_can_hook(CAN_FIFOMailBox_TypeDef *to_push) {
ignition_can_cnt = 0U; // reset counter
if (bus == 0) {
// GM exception
// TODO: verify on all supported GM models that we can reliably detect ignition using only this signal,
// since the 0x1F1 signal can briefly go low immediately after ignition
if ((addr == 0x160) && (len == 5)) {
// this message isn't all zeros when ignition is on
ignition_cadillac = GET_BYTES_04(to_push) != 0;
ignition_cadillac = GET_BYTES_04(to_push) != 0U;
}
// GM exception
if ((addr == 0x1F1) && (len == 8)) {
// Bit 5 is ignition "on"
bool ignition_gm = ((GET_BYTE(to_push, 0) & 0x20) != 0);
bool ignition_gm = ((GET_BYTE(to_push, 0) & 0x20U) != 0U);
ignition_can = ignition_gm || ignition_cadillac;
}
// Tesla exception
if ((addr == 0x348) && (len == 8)) {
// GTW_status
ignition_can = (GET_BYTE(to_push, 0) & 0x1) != 0;
ignition_can = (GET_BYTE(to_push, 0) & 0x1U) != 0U;
}
// Mazda exception
if ((addr == 0x9E) && (len == 8)) {
ignition_can = (GET_BYTE(to_push, 0) >> 4) == 0xDU;
}
}
}
@@ -217,22 +236,19 @@ bool can_tx_check_min_slots_free(uint32_t min) {
(can_slots_empty(&can_txgmlan_q) >= min);
}
void can_send(CAN_FIFOMailBox_TypeDef *to_push, uint8_t bus_number, bool skip_tx_hook) {
void can_send(CANPacket_t *to_push, uint8_t bus_number, bool skip_tx_hook) {
if (skip_tx_hook || safety_tx_hook(to_push) != 0) {
if (bus_number < BUS_MAX) {
// add CAN packet to send queue
// bus number isn't passed through
to_push->RDTR &= 0xF;
if ((bus_number == 3U) && (can_num_lookup[3] == 0xFFU)) {
if ((bus_number == 3U) && (bus_config[3].can_num_lookup == 0xFFU)) {
gmlan_send_errs += bitbang_gmlan(to_push) ? 0U : 1U;
} else {
can_fwd_errs += can_push(can_queues[bus_number], to_push) ? 0U : 1U;
process_can(CAN_NUM_FROM_BUS_NUM(bus_number));
}
}
} else {
to_push->rejected = 1U;
can_send_errs += can_push(&can_rx_q, to_push) ? 0U : 1U;
}
}
void can_set_forwarding(int from, int to) {
can_forwarding[from] = to;
}

View File

@@ -5,6 +5,11 @@
#define BUS_OFF_FAIL_LIMIT 2U
uint8_t bus_off_err[] = {0U, 0U, 0U};
typedef struct {
volatile uint32_t header[2];
volatile uint32_t data_word[CANPACKET_DATA_SIZE_MAX/4U];
} canfd_fifo;
FDCAN_GlobalTypeDef *cans[] = {FDCAN1, FDCAN2, FDCAN3};
bool can_set_speed(uint8_t can_number) {
@@ -12,7 +17,7 @@ bool can_set_speed(uint8_t can_number) {
FDCAN_GlobalTypeDef *CANx = CANIF_FROM_CAN_NUM(can_number);
uint8_t bus_number = BUS_NUM_FROM_CAN_NUM(can_number);
ret &= llcan_set_speed(CANx, can_speed[bus_number], can_data_speed[bus_number], can_loopback, (unsigned int)(can_silent) & (1U << can_number));
ret &= llcan_set_speed(CANx, bus_config[bus_number].can_speed, bus_config[bus_number].can_data_speed, can_loopback, (unsigned int)(can_silent) & (1U << can_number));
return ret;
}
@@ -42,36 +47,41 @@ void process_can(uint8_t can_number) {
FDCAN_GlobalTypeDef *CANx = CANIF_FROM_CAN_NUM(can_number);
uint8_t bus_number = BUS_NUM_FROM_CAN_NUM(can_number);
CANx->IR |= FDCAN_IR_TFE; // Clear Tx FIFO Empty flag
if ((CANx->TXFQS & FDCAN_TXFQS_TFQF) == 0) {
CAN_FIFOMailBox_TypeDef to_send;
CANPacket_t to_send;
if (can_pop(can_queues[bus_number], &to_send)) {
can_tx_cnt += 1;
uint32_t TxFIFOSA = FDCAN_START_ADDRESS + (can_number * FDCAN_OFFSET) + (FDCAN_RX_FIFO_0_EL_CNT * FDCAN_RX_FIFO_0_EL_SIZE);
uint8_t tx_index = (CANx->TXFQS >> FDCAN_TXFQS_TFQPI_Pos) & 0x1F;
// only send if we have received a packet
CAN_FIFOMailBox_TypeDef *fifo;
fifo = (CAN_FIFOMailBox_TypeDef *)(TxFIFOSA + (tx_index * FDCAN_TX_FIFO_EL_SIZE));
canfd_fifo *fifo;
fifo = (canfd_fifo *)(TxFIFOSA + (tx_index * FDCAN_TX_FIFO_EL_SIZE));
// Convert from "mailbox type"
fifo->RIR = ((to_send.RIR & 0x6) << 28) | (to_send.RIR >> 3); // identifier format and frame type | identifier
//REDEBUG: enable CAN FD and BRS for test purposes
//fifo->RDTR = ((to_send.RDTR & 0xF) << 16) | ((to_send.RDTR) >> 16) | (1U << 21) | (1U << 20); // DLC (length) | timestamp | enable CAN FD | enable BRS
fifo->RDTR = ((to_send.RDTR & 0xF) << 16) | ((to_send.RDTR) >> 16); // DLC (length) | timestamp
fifo->RDLR = to_send.RDLR;
fifo->RDHR = to_send.RDHR;
CANx->TXBAR = (1UL << tx_index);
fifo->header[0] = (to_send.extended << 30) | ((to_send.extended != 0U) ? (to_send.addr) : (to_send.addr << 18));
fifo->header[1] = (to_send.data_len_code << 16) | (bus_config[can_number].canfd_enabled << 21) | (bus_config[can_number].brs_enabled << 20);
uint8_t data_len_w = (dlc_to_len[to_send.data_len_code] / 4U);
data_len_w += ((dlc_to_len[to_send.data_len_code] % 4U) > 0U) ? 1U : 0U;
for (unsigned int i = 0; i < data_len_w; i++) {
BYTE_ARRAY_TO_WORD(fifo->data_word[i], &to_send.data[i*4U]);
}
CANx->TXBAR = (1UL << tx_index);
// Send back to USB
can_txd_cnt += 1;
CAN_FIFOMailBox_TypeDef to_push;
to_push.RIR = to_send.RIR;
to_push.RDTR = (to_send.RDTR & 0xFFFF000FU) | ((CAN_BUS_RET_FLAG | bus_number) << 4);
to_push.RDLR = to_send.RDLR;
to_push.RDHR = to_send.RDHR;
CANPacket_t to_push;
to_push.returned = 1U;
to_push.rejected = 0U;
to_push.extended = to_send.extended;
to_push.addr = to_send.addr;
to_push.bus = to_send.bus;
to_push.data_len_code = to_send.data_len_code;
(void)memcpy(to_push.data, to_send.data, dlc_to_len[to_push.data_len_code]);
can_send_errs += can_push(&can_rx_q, &to_push) ? 0U : 1U;
usb_cb_ep3_out_complete();
@@ -123,29 +133,37 @@ void can_rx(uint8_t can_number) {
rx_fifo_idx = (uint8_t)((CANx->RXF0S >> FDCAN_RXF0S_F0GI_Pos) & 0x3F);
uint32_t RxFIFO0SA = FDCAN_START_ADDRESS + (can_number * FDCAN_OFFSET);
CAN_FIFOMailBox_TypeDef to_push;
CAN_FIFOMailBox_TypeDef *fifo;
CANPacket_t to_push;
canfd_fifo *fifo;
// getting address
fifo = (CAN_FIFOMailBox_TypeDef *)(RxFIFO0SA + (rx_fifo_idx * FDCAN_RX_FIFO_0_EL_SIZE));
fifo = (canfd_fifo *)(RxFIFO0SA + (rx_fifo_idx * FDCAN_RX_FIFO_0_EL_SIZE));
// Need to convert real CAN frame format to mailbox "type"
to_push.RIR = ((fifo->RIR >> 28) & 0x6) | (fifo->RIR << 3); // identifier format and frame type | identifier
to_push.RDTR = ((fifo->RDTR >> 16) & 0xF) | (fifo->RDTR << 16); // DLC (length) | timestamp
to_push.RDLR = fifo->RDLR;
to_push.RDHR = fifo->RDHR;
to_push.returned = 0U;
to_push.rejected = 0U;
to_push.extended = (fifo->header[0] >> 30) & 0x1U;
to_push.addr = ((to_push.extended != 0U) ? (fifo->header[0] & 0x1FFFFFFFU) : ((fifo->header[0] >> 18) & 0x7FFU));
to_push.bus = bus_number;
to_push.data_len_code = ((fifo->header[1] >> 16) & 0xFU);
// modify RDTR for our API
to_push.RDTR = (to_push.RDTR & 0xFFFF000F) | (bus_number << 4);
uint8_t data_len_w = (dlc_to_len[to_push.data_len_code] / 4U);
data_len_w += ((dlc_to_len[to_push.data_len_code] % 4U) > 0U) ? 1U : 0U;
for (unsigned int i = 0; i < data_len_w; i++) {
WORD_TO_BYTE_ARRAY(&to_push.data[i*4U], fifo->data_word[i]);
}
// forwarding (panda only)
int bus_fwd_num = (can_forwarding[bus_number] != -1) ? can_forwarding[bus_number] : safety_fwd_hook(bus_number, &to_push);
int bus_fwd_num = safety_fwd_hook(bus_number, &to_push);
if (bus_fwd_num != -1) {
CAN_FIFOMailBox_TypeDef to_send;
to_send.RIR = to_push.RIR;
to_send.RDTR = to_push.RDTR;
to_send.RDLR = to_push.RDLR;
to_send.RDHR = to_push.RDHR;
CANPacket_t to_send;
to_send.returned = 0U;
to_send.rejected = 0U;
to_send.extended = to_push.extended;
to_send.addr = to_push.addr;
to_send.bus = to_push.bus;
to_send.data_len_code = to_push.data_len_code;
(void)memcpy(to_send.data, to_push.data, dlc_to_len[to_push.data_len_code]);
can_send(&to_send, bus_fwd_num, true);
}
@@ -155,7 +173,7 @@ void can_rx(uint8_t can_number) {
current_board->set_led(LED_BLUE, true);
can_send_errs += can_push(&can_rx_q, &to_push) ? 0U : 1U;
// update read index
// update read index
CANx->RXF0A = rx_fifo_idx;
}
@@ -165,10 +183,9 @@ void can_rx(uint8_t can_number) {
#endif
CANx->IR |= (FDCAN_IR_PEA | FDCAN_IR_PED | FDCAN_IR_RF0L | FDCAN_IR_RF0F | FDCAN_IR_EW | FDCAN_IR_MRAF | FDCAN_IR_TOO); // Clean all error flags
can_err_cnt += 1;
} else {
} else {
}
}
void FDCAN1_IT0_IRQ_Handler(void) { can_rx(0); }

View File

@@ -75,7 +75,7 @@ int append_int(char *in, int in_len, int val, int val_len) {
return in_len_copy;
}
int get_bit_message(char *out, CAN_FIFOMailBox_TypeDef *to_bang) {
int get_bit_message(char *out, CANPacket_t *to_bang) {
char pkt[MAX_BITS_CAN_PACKET];
char footer[] = {
1, // CRC delimiter
@@ -88,18 +88,18 @@ int get_bit_message(char *out, CAN_FIFOMailBox_TypeDef *to_bang) {
int len = 0;
// test packet
int dlc_len = to_bang->RDTR & 0xF;
int dlc_len = GET_LEN(to_bang);
len = append_int(pkt, len, 0, 1); // Start-of-frame
if ((to_bang->RIR & 4) != 0) {
if (to_bang->extended != 0U) {
// extended identifier
len = append_int(pkt, len, to_bang->RIR >> 21, 11); // Identifier
len = append_int(pkt, len, GET_ADDR(to_bang) >> 18, 11); // Identifier
len = append_int(pkt, len, 3, 2); // SRR+IDE
len = append_int(pkt, len, (to_bang->RIR >> 3) & ((1U << 18) - 1U), 18); // Identifier
len = append_int(pkt, len, (GET_ADDR(to_bang)) & ((1U << 18) - 1U), 18); // Identifier
len = append_int(pkt, len, 0, 3); // RTR+r1+r0
} else {
// standard identifier
len = append_int(pkt, len, to_bang->RIR >> 21, 11); // Identifier
len = append_int(pkt, len, GET_ADDR(to_bang), 11); // Identifier
len = append_int(pkt, len, 0, 3); // RTR+IDE+reserved
}
@@ -107,8 +107,7 @@ int get_bit_message(char *out, CAN_FIFOMailBox_TypeDef *to_bang) {
// append data
for (int i = 0; i < dlc_len; i++) {
unsigned char dat = ((unsigned char *)(&(to_bang->RDLR)))[i];
len = append_int(pkt, len, dat, 8);
len = append_int(pkt, len, to_bang->data[i], 8);
}
// append crc
@@ -269,7 +268,7 @@ void TIM12_IRQ_Handler(void) {
TIM12->SR = 0;
}
bool bitbang_gmlan(CAN_FIFOMailBox_TypeDef *to_bang) {
bool bitbang_gmlan(CANPacket_t *to_bang) {
gmlan_send_ok = true;
gmlan_alt_mode = BITBANG;

View File

@@ -23,7 +23,8 @@ typedef union _USB_Setup {
}
USB_Setup_TypeDef;
#define MAX_CAN_MSGS_PER_BULK_TRANSFER 4U
#define MAX_CAN_MSGS_PER_BULK_TRANSFER 51U
#define MAX_EP1_CHUNK_PER_BULK_TRANSFER 16256 // max data stream chunk in bytes, shouldn't be higher than 16320 or counter will overflow
bool usb_eopf_detected = false;
@@ -493,7 +494,7 @@ void usb_setup(void) {
USB_OTG_DOEPCTL_SD0PID_SEVNFRM | USB_OTG_DOEPCTL_USBAEP;
USBx_OUTEP(2)->DOEPINT = 0xFF;
USBx_OUTEP(3)->DOEPTSIZ = (1U << 19) | 0x40U;
USBx_OUTEP(3)->DOEPTSIZ = (32U << 19) | 0x800U;
USBx_OUTEP(3)->DOEPCTL = (0x40U & USB_OTG_DOEPCTL_MPSIZ) | (2U << 18) |
USB_OTG_DOEPCTL_SD0PID_SEVNFRM | USB_OTG_DOEPCTL_USBAEP;
USBx_OUTEP(3)->DOEPINT = 0xFF;
@@ -934,7 +935,7 @@ void usb_irqhandler(void) {
void usb_outep3_resume_if_paused(void) {
ENTER_CRITICAL();
if (!outep3_processing && (USBx_OUTEP(3)->DOEPCTL & USB_OTG_DOEPCTL_NAKSTS) != 0) {
USBx_OUTEP(3)->DOEPTSIZ = (1U << 19) | 0x40U;
USBx_OUTEP(3)->DOEPTSIZ = (32U << 19) | 0x800U;
USBx_OUTEP(3)->DOEPCTL |= USB_OTG_DOEPCTL_EPENA | USB_OTG_DOEPCTL_CNAK;
}
EXIT_CRITICAL();

View File

@@ -38,9 +38,9 @@ void early_initialization(void) {
// if wrong chip, reboot
volatile unsigned int id = DBGMCU->IDCODE;
if ((id & 0xFFFU) != MCU_IDCODE) {
enter_bootloader_mode = ENTER_BOOTLOADER_MAGIC;
}
if ((id & 0xFFFU) != MCU_IDCODE) {
enter_bootloader_mode = ENTER_BOOTLOADER_MAGIC;
}
// setup interrupt table
SCB->VTOR = (uint32_t)&g_pfnVectors;

View File

@@ -183,7 +183,7 @@ void CAN1_RX0_IRQ_Handler(void) {
if ((CAN->sFIFOMailBox[0].RIR>>21) == CAN_BL_INPUT) {
uint8_t dat[8];
for (int i = 0; i < 8; i++) {
dat[i] = GET_BYTE(&CAN->sFIFOMailBox[0], i);
dat[i] = GET_MAILBOX_BYTE(&CAN->sFIFOMailBox[0], i);
}
uint8_t odat[8];
uint8_t type = dat[0] & 0xF0;

View File

@@ -1,3 +1,3 @@
#!/bin/bash
sudo apt-get install gcc-arm-none-eabi python-pip
sudo apt-get install dfu-util gcc-arm-none-eabi python3-pip
sudo pip install libusb1 pycryptodome requests

View File

@@ -1,7 +1,7 @@
#!/bin/bash
# Need formula for gcc
sudo easy_install pip
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew tap ArmMbed/homebrew-formulae
brew install python dfu-util arm-none-eabi-gcc
pip install --user libusb1 pycryptodome requests

View File

@@ -14,13 +14,36 @@ void *memset(void *str, int c, unsigned int n) {
return str;
}
void *memcpy(void *dest, const void *src, unsigned int n) {
uint8_t *d = dest;
const uint8_t *s = src;
for (unsigned int i = 0; i < n; i++) {
*d = *s;
d++;
s++;
#define UNALIGNED(X, Y) \
(((uint32_t)(X) & (sizeof(uint32_t) - 1U)) | ((uint32_t)(Y) & (sizeof(uint32_t) - 1U)))
void *memcpy(void *dest, const void *src, unsigned int len) {
unsigned int n = len;
uint8_t *d8 = dest;
const uint8_t *s8 = src;
if ((n >= 4U) && !UNALIGNED(s8, d8)) {
uint32_t *d32 = (uint32_t *)d8; // cppcheck-suppress misra-c2012-11.3 ; already checked that it's properly aligned
const uint32_t *s32 = (const uint32_t *)s8; // cppcheck-suppress misra-c2012-11.3 ; already checked that it's properly aligned
while(n >= 16U) {
*d32 = *s32; d32++; s32++;
*d32 = *s32; d32++; s32++;
*d32 = *s32; d32++; s32++;
*d32 = *s32; d32++; s32++;
n -= 16U;
}
while(n >= 4U) {
*d32 = *s32; d32++; s32++;
n -= 4U;
}
d8 = (uint8_t *)d32;
s8 = (const uint8_t *)s32;
}
while (n-- > 0U) {
*d8 = *s8; d8++; s8++;
}
return dest;
}

View File

@@ -20,11 +20,14 @@
#include "drivers/bxcan.h"
#endif
#include "usb_protocol.h"
#include "obj/gitversion.h"
extern int _app_start[0xc000]; // Only first 3 sectors of size 0x4000 are used
// When changing this struct, boardd and python/__init__.py needs to be kept up to date!
#define HEALTH_PACKET_VERSION 1
struct __attribute__((packed)) health_t {
uint32_t uptime_pkt;
uint32_t voltage_pkt;
@@ -109,24 +112,10 @@ void set_safety_mode(uint16_t mode, int16_t param) {
switch (mode_copy) {
case SAFETY_SILENT:
set_intercept_relay(false);
#ifdef vw
// Volkswagen community port:
// J533 integrations with White/Grey Panda really need Panda to respond
// at all times. Let the CAN transceivers ACK traffic unless this is
// BP/Uno where the physical relay makes it irrelevant. This makes
// SILENT identical to NOOUTPUT for White/Grey Panda.
if (current_board->has_obd) {
current_board->set_can_mode(CAN_MODE_NORMAL);
can_silent = ALL_CAN_SILENT;
} else {
can_silent = ALL_CAN_LIVE;
}
#else
if (current_board->has_obd) {
current_board->set_can_mode(CAN_MODE_NORMAL);
}
can_silent = ALL_CAN_SILENT;
#endif
break;
case SAFETY_NOOUTPUT:
set_intercept_relay(false);
@@ -206,15 +195,7 @@ int get_rtc_pkt(void *dat) {
return sizeof(t);
}
int usb_cb_ep1_in(void *usbdata, int len, bool hardwired) {
UNUSED(hardwired);
CAN_FIFOMailBox_TypeDef *reply = (CAN_FIFOMailBox_TypeDef *)usbdata;
int ilen = 0;
while (ilen < MIN(len/0x10, 4) && can_pop(&can_rx_q, &reply[ilen])) {
ilen++;
}
return ilen*0x10;
}
// send on serial, first byte to select the ring
void usb_cb_ep2_out(void *usbdata, int len, bool hardwired) {
@@ -232,23 +213,6 @@ void usb_cb_ep2_out(void *usbdata, int len, bool hardwired) {
}
}
// send on CAN
void usb_cb_ep3_out(void *usbdata, int len, bool hardwired) {
UNUSED(hardwired);
int dpkt = 0;
uint32_t *d32 = (uint32_t *)usbdata;
for (dpkt = 0; dpkt < (len / 4); dpkt += 4) {
CAN_FIFOMailBox_TypeDef to_push;
to_push.RDHR = d32[dpkt + 3];
to_push.RDLR = d32[dpkt + 2];
to_push.RDTR = d32[dpkt + 1];
to_push.RIR = d32[dpkt];
uint8_t bus_number = (to_push.RDTR >> 4) & CAN_BUS_NUM_MASK;
can_send(&to_push, bus_number, false);
}
}
void usb_cb_ep3_out_complete(void) {
if (can_tx_check_min_slots_free(MAX_CAN_MSGS_PER_BULK_TRANSFER)) {
usb_outep3_resume_if_paused();
@@ -468,24 +432,17 @@ int usb_cb_control_msg(USB_Setup_TypeDef *setup, uint8_t *resp, bool hardwired)
set_safety_mode(setup->b.wValue.w, (uint16_t) setup->b.wIndex.w);
}
break;
// **** 0xdd: enable can forwarding
// **** 0xdd: get healthpacket and CANPacket versions
case 0xdd:
// wValue = Can Bus Num to forward from
// wIndex = Can Bus Num to forward to
if ((setup->b.wValue.w < BUS_MAX) && (setup->b.wIndex.w < BUS_MAX) &&
(setup->b.wValue.w != setup->b.wIndex.w)) { // set forwarding
can_set_forwarding(setup->b.wValue.w, setup->b.wIndex.w & CAN_BUS_NUM_MASK);
} else if((setup->b.wValue.w < BUS_MAX) && (setup->b.wIndex.w == 0xFFU)){ //Clear Forwarding
can_set_forwarding(setup->b.wValue.w, -1);
} else {
puts("Invalid CAN bus forwarding\n");
}
resp[0] = HEALTH_PACKET_VERSION;
resp[1] = CAN_PACKET_VERSION;
resp_len = 2;
break;
// **** 0xde: set can bitrate
case 0xde:
if (setup->b.wValue.w < BUS_MAX) {
// TODO: add sanity check, ideally check if value is correct(from array of correct values)
can_speed[setup->b.wValue.w] = setup->b.wIndex.w;
bus_config[setup->b.wValue.w].can_speed = setup->b.wIndex.w;
bool ret = can_init(CAN_NUM_FROM_BUS_NUM(setup->b.wValue.w));
UNUSED(ret);
}
@@ -642,11 +599,21 @@ int usb_cb_control_msg(USB_Setup_TypeDef *setup, uint8_t *resp, bool hardwired)
case 0xf9:
if (setup->b.wValue.w < CAN_MAX) {
// TODO: add sanity check, ideally check if value is correct(from array of correct values)
can_data_speed[setup->b.wValue.w] = setup->b.wIndex.w;
bus_config[setup->b.wValue.w].can_data_speed = setup->b.wIndex.w;
bus_config[setup->b.wValue.w].canfd_enabled = (setup->b.wIndex.w >= bus_config[setup->b.wValue.w].can_speed) ? true : false;
bus_config[setup->b.wValue.w].brs_enabled = (setup->b.wIndex.w > bus_config[setup->b.wValue.w].can_speed) ? true : false;
bool ret = can_init(CAN_NUM_FROM_BUS_NUM(setup->b.wValue.w));
UNUSED(ret);
}
break;
// **** 0xfa: check if CAN FD and BRS are enabled
case 0xfa:
if (setup->b.wValue.w < CAN_MAX) {
resp[0] = bus_config[setup->b.wValue.w].canfd_enabled;
resp[1] = bus_config[setup->b.wValue.w].brs_enabled;
resp_len = 2;
}
break;
default:
puts("NO HANDLER ");
puth(setup->b.bRequest);

View File

@@ -1,8 +1,8 @@
This is the firmware for the comma pedal. It borrows a lot from panda.
# pedal
The comma pedal is a gas pedal interceptor for Honda/Acura. It allows you to "virtually" press the pedal.
This is the firmware for the comma pedal.
This is the open source software. Note that it is not ready to use yet.
The comma pedal is a gas pedal interceptor for Honda/Acura and Toyota/Lexus. It allows you to "virtually" press the pedal and borrows a lot from panda.
== Test Plan ==

View File

@@ -132,11 +132,11 @@ void CAN1_RX0_IRQ_Handler(void) {
int address = CAN->sFIFOMailBox[0].RIR >> 21;
if (address == CAN_GAS_INPUT) {
// softloader entry
if (GET_BYTES_04(&CAN->sFIFOMailBox[0]) == 0xdeadface) {
if (GET_BYTES_48(&CAN->sFIFOMailBox[0]) == 0x0ab00b1e) {
if (GET_MAILBOX_BYTES_04(&CAN->sFIFOMailBox[0]) == 0xdeadface) {
if (GET_MAILBOX_BYTES_48(&CAN->sFIFOMailBox[0]) == 0x0ab00b1e) {
enter_bootloader_mode = ENTER_SOFTLOADER_MAGIC;
NVIC_SystemReset();
} else if (GET_BYTES_48(&CAN->sFIFOMailBox[0]) == 0x02b00b1e) {
} else if (GET_MAILBOX_BYTES_48(&CAN->sFIFOMailBox[0]) == 0x02b00b1e) {
enter_bootloader_mode = ENTER_BOOTLOADER_MAGIC;
NVIC_SystemReset();
} else {
@@ -147,7 +147,7 @@ void CAN1_RX0_IRQ_Handler(void) {
// normal packet
uint8_t dat[8];
for (int i=0; i<8; i++) {
dat[i] = GET_BYTE(&CAN->sFIFOMailBox[0], i);
dat[i] = GET_MAILBOX_BYTE(&CAN->sFIFOMailBox[0], i);
}
uint16_t value_0 = (dat[0] << 8) | dat[1];
uint16_t value_1 = (dat[2] << 8) | dat[3];

View File

@@ -28,14 +28,7 @@ void set_power_save_state(int state) {
enable = true;
}
#ifdef vw
// Volkswagen community port:
// If this is a White or Grey Panda, always keep the CAN transceivers
// powered up so that transparent forwarding is maintained.
current_board->enable_can_transceivers(current_board->has_obd ? enable : true);
#else
current_board->enable_can_transceivers(enable);
#endif
// Switch EPS/GPS
if (enable) {

View File

@@ -5,7 +5,6 @@
#include "safety/safety_honda.h"
#include "safety/safety_toyota.h"
#include "safety/safety_tesla.h"
#include "safety/safety_gm_ascm.h"
#include "safety/safety_gm.h"
#include "safety/safety_ford.h"
#include "safety/safety_hyundai.h"
@@ -34,31 +33,32 @@
#define SAFETY_ALLOUTPUT 17U
#define SAFETY_GM_ASCM 18U
#define SAFETY_NOOUTPUT 19U
#define SAFETY_HONDA_BOSCH_HARNESS 20U
#define SAFETY_HONDA_BOSCH 20U
#define SAFETY_VOLKSWAGEN_PQ 21U
#define SAFETY_SUBARU_LEGACY 22U
#define SAFETY_HYUNDAI_LEGACY 23U
#define SAFETY_HYUNDAI_COMMUNITY 24U
#define SAFETY_STELLANTIS 25U
uint16_t current_safety_mode = SAFETY_SILENT;
int16_t current_safety_param = 0;
const safety_hooks *current_hooks = &nooutput_hooks;
const addr_checks *current_rx_checks = &default_rx_checks;
int safety_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
int safety_rx_hook(CANPacket_t *to_push) {
return current_hooks->rx(to_push);
}
int safety_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) {
return current_hooks->tx(to_send);
int safety_tx_hook(CANPacket_t *to_send) {
return (relay_malfunction ? -1 : current_hooks->tx(to_send));
}
int safety_tx_lin_hook(int lin_num, uint8_t *data, int len) {
return current_hooks->tx_lin(lin_num, data, len);
}
int safety_fwd_hook(int bus_num, CAN_FIFOMailBox_TypeDef *to_fwd) {
return current_hooks->fwd(bus_num, to_fwd);
int safety_fwd_hook(int bus_num, CANPacket_t *to_fwd) {
return (relay_malfunction ? -1 : current_hooks->fwd(bus_num, to_fwd));
}
// Given a CRC-8 poly, generate a static lookup table to use with a fast CRC-8
@@ -76,7 +76,7 @@ void gen_crc_lookup_table(uint8_t poly, uint8_t crc_lut[]) {
}
}
bool msg_allowed(CAN_FIFOMailBox_TypeDef *to_send, const CanMsg msg_list[], int len) {
bool msg_allowed(CANPacket_t *to_send, const CanMsg msg_list[], int len) {
int addr = GET_ADDR(to_send);
int bus = GET_BUS(to_send);
int length = GET_LEN(to_send);
@@ -97,7 +97,7 @@ uint32_t get_ts_elapsed(uint32_t ts, uint32_t ts_last) {
return ts - ts_last;
}
int get_addr_check_index(CAN_FIFOMailBox_TypeDef *to_push, AddrCheckStruct addr_list[], const int len) {
int get_addr_check_index(CANPacket_t *to_push, AddrCheckStruct addr_list[], const int len) {
int bus = GET_BUS(to_push);
int addr = GET_ADDR(to_push);
int length = GET_LEN(to_push);
@@ -171,11 +171,11 @@ void update_addr_timestamp(AddrCheckStruct addr_list[], int index) {
}
}
bool addr_safety_check(CAN_FIFOMailBox_TypeDef *to_push,
bool addr_safety_check(CANPacket_t *to_push,
const addr_checks *rx_checks,
uint8_t (*get_checksum)(CAN_FIFOMailBox_TypeDef *to_push),
uint8_t (*compute_checksum)(CAN_FIFOMailBox_TypeDef *to_push),
uint8_t (*get_counter)(CAN_FIFOMailBox_TypeDef *to_push)) {
uint8_t (*get_checksum)(CANPacket_t *to_push),
uint8_t (*compute_checksum)(CANPacket_t *to_push),
uint8_t (*get_counter)(CANPacket_t *to_push)) {
int index = get_addr_check_index(to_push, rx_checks->check, rx_checks->len);
update_addr_timestamp(rx_checks->check, index);
@@ -241,8 +241,7 @@ const safety_hook_config safety_hook_registry[] = {
{SAFETY_TOYOTA, &toyota_hooks},
{SAFETY_ELM327, &elm327_hooks},
{SAFETY_GM, &gm_hooks},
{SAFETY_HONDA_BOSCH_GIRAFFE, &honda_bosch_giraffe_hooks},
{SAFETY_HONDA_BOSCH_HARNESS, &honda_bosch_harness_hooks},
{SAFETY_HONDA_BOSCH, &honda_bosch_hooks},
{SAFETY_HYUNDAI, &hyundai_hooks},
{SAFETY_CHRYSLER, &chrysler_hooks},
{SAFETY_SUBARU, &subaru_hooks},
@@ -250,13 +249,12 @@ const safety_hook_config safety_hook_registry[] = {
{SAFETY_NISSAN, &nissan_hooks},
{SAFETY_NOOUTPUT, &nooutput_hooks},
{SAFETY_HYUNDAI_LEGACY, &hyundai_legacy_hooks},
{SAFETY_MAZDA, &mazda_hooks},
#ifdef ALLOW_DEBUG
{SAFETY_TESLA, &tesla_hooks},
{SAFETY_MAZDA, &mazda_hooks},
{SAFETY_SUBARU_LEGACY, &subaru_legacy_hooks},
{SAFETY_VOLKSWAGEN_PQ, &volkswagen_pq_hooks},
{SAFETY_ALLOUTPUT, &alloutput_hooks},
{SAFETY_GM_ASCM, &gm_ascm_hooks},
{SAFETY_FORD, &ford_hooks},
#endif
};
@@ -274,6 +272,7 @@ int set_safety_hooks(uint16_t mode, int16_t param) {
cruise_engaged_prev = false;
vehicle_speed = 0;
vehicle_moving = false;
acc_main_on = false;
desired_torque_last = 0;
rt_torque_last = 0;
ts_angle_last = 0;

View File

@@ -18,12 +18,12 @@ AddrCheckStruct chrysler_addr_checks[] = {
#define CHRYSLER_ADDR_CHECK_LEN (sizeof(chrysler_addr_checks) / sizeof(chrysler_addr_checks[0]))
addr_checks chrysler_rx_checks = {chrysler_addr_checks, CHRYSLER_ADDR_CHECK_LEN};
static uint8_t chrysler_get_checksum(CAN_FIFOMailBox_TypeDef *to_push) {
int checksum_byte = GET_LEN(to_push) - 1;
static uint8_t chrysler_get_checksum(CANPacket_t *to_push) {
int checksum_byte = GET_LEN(to_push) - 1U;
return (uint8_t)(GET_BYTE(to_push, checksum_byte));
}
static uint8_t chrysler_compute_checksum(CAN_FIFOMailBox_TypeDef *to_push) {
static uint8_t chrysler_compute_checksum(CANPacket_t *to_push) {
/* This function does not want the checksum byte in the input data.
jeep chrysler canbus checksum from http://illmatics.com/Remote%20Car%20Hacking.pdf */
uint8_t checksum = 0xFFU;
@@ -56,18 +56,18 @@ static uint8_t chrysler_compute_checksum(CAN_FIFOMailBox_TypeDef *to_push) {
return ~checksum;
}
static uint8_t chrysler_get_counter(CAN_FIFOMailBox_TypeDef *to_push) {
static uint8_t chrysler_get_counter(CANPacket_t *to_push) {
// Well defined counter only for 8 bytes messages
return (uint8_t)(GET_BYTE(to_push, 6) >> 4);
}
static int chrysler_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
static int chrysler_rx_hook(CANPacket_t *to_push) {
bool valid = addr_safety_check(to_push, &chrysler_rx_checks,
chrysler_get_checksum, chrysler_compute_checksum,
chrysler_get_counter);
if (valid && (GET_BUS(to_push) == 0)) {
if (valid && (GET_BUS(to_push) == 0U)) {
int addr = GET_ADDR(to_push);
// Measured eps torque
@@ -80,7 +80,7 @@ static int chrysler_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
// enter controls on rising edge of ACC, exit controls on ACC off
if (addr == 500) {
int cruise_engaged = ((GET_BYTE(to_push, 2) & 0x38) >> 3) == 7;
int cruise_engaged = ((GET_BYTE(to_push, 2) & 0x38U) >> 3) == 7U;
if (cruise_engaged && !cruise_engaged_prev) {
controls_allowed = 1;
}
@@ -100,12 +100,12 @@ static int chrysler_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
// exit controls on rising edge of gas press
if (addr == 308) {
gas_pressed = ((GET_BYTE(to_push, 5) & 0x7F) != 0) && ((int)vehicle_speed > CHRYSLER_GAS_THRSLD);
gas_pressed = ((GET_BYTE(to_push, 5) & 0x7FU) != 0U) && ((int)vehicle_speed > CHRYSLER_GAS_THRSLD);
}
// exit controls on rising edge of brake press
if (addr == 320) {
brake_pressed = (GET_BYTE(to_push, 0) & 0x7) == 5;
brake_pressed = (GET_BYTE(to_push, 0) & 0x7U) == 5U;
if (brake_pressed && (!brake_pressed_prev || vehicle_moving)) {
controls_allowed = 0;
}
@@ -117,7 +117,7 @@ static int chrysler_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
return valid;
}
static int chrysler_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) {
static int chrysler_tx_hook(CANPacket_t *to_send) {
int tx = 1;
int addr = GET_ADDR(to_send);
@@ -126,10 +126,6 @@ static int chrysler_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) {
tx = 0;
}
if (relay_malfunction) {
tx = 0;
}
// LKA STEER
if (addr == 0x292) {
int desired_torque = ((GET_BYTE(to_send, 0) & 0x7U) << 8) + GET_BYTE(to_send, 1) - 1024U;
@@ -178,7 +174,7 @@ static int chrysler_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) {
// FORCE CANCEL: only the cancel button press is allowed
if (addr == 571) {
if ((GET_BYTE(to_send, 0) != 1) || ((GET_BYTE(to_send, 1) & 1) == 1)) {
if ((GET_BYTE(to_send, 0) != 1U) || ((GET_BYTE(to_send, 1) & 1U) == 1U)) {
tx = 0;
}
}
@@ -186,21 +182,21 @@ static int chrysler_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) {
return tx;
}
static int chrysler_fwd_hook(int bus_num, CAN_FIFOMailBox_TypeDef *to_fwd) {
static int chrysler_fwd_hook(int bus_num, CANPacket_t *to_fwd) {
int bus_fwd = -1;
int addr = GET_ADDR(to_fwd);
if (!relay_malfunction) {
// forward CAN 0 -> 2 so stock LKAS camera sees messages
if (bus_num == 0) {
bus_fwd = 2;
}
// forward all messages from camera except LKAS_COMMAND and LKAS_HUD
if ((bus_num == 2) && (addr != 658) && (addr != 678)) {
bus_fwd = 0;
}
// forward CAN 0 -> 2 so stock LKAS camera sees messages
if (bus_num == 0) {
bus_fwd = 2;
}
// forward all messages from camera except LKAS_COMMAND and LKAS_HUD
if ((bus_num == 2) && (addr != 658) && (addr != 678)) {
bus_fwd = 0;
}
return bus_fwd;
}

View File

@@ -3,7 +3,7 @@ const addr_checks default_rx_checks = {
.len = 0,
};
int default_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
int default_rx_hook(CANPacket_t *to_push) {
UNUSED(to_push);
return true;
}
@@ -17,7 +17,7 @@ static const addr_checks* nooutput_init(int16_t param) {
return &default_rx_checks;
}
static int nooutput_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) {
static int nooutput_tx_hook(CANPacket_t *to_send) {
UNUSED(to_send);
return false;
}
@@ -29,33 +29,10 @@ static int nooutput_tx_lin_hook(int lin_num, uint8_t *data, int len) {
return false;
}
static int default_fwd_hook(int bus_num, CAN_FIFOMailBox_TypeDef *to_fwd) {
UNUSED(to_fwd);
#ifdef vw
// Volkswagen community port: Advanced Virtual Relay Technology!
// Make Panda fully transparent from bus 0->2 and bus 2->0 if not otherwise
// instructed by EON/OP, returning the car to stock behavior under NOOUTPUT.
// Don't do this for BP/C2, where we have Advanced Actual Relay Technology.
int bus_fwd = -1;
if(hw_type == HW_TYPE_WHITE_PANDA || hw_type == HW_TYPE_GREY_PANDA) {
switch (bus_num) {
case 0:
bus_fwd = 2;
break;
case 2:
bus_fwd = 0;
break;
default:
bus_fwd = -1;
break;
}
}
return bus_fwd;
#else
static int default_fwd_hook(int bus_num, CANPacket_t *to_fwd) {
UNUSED(bus_num);
UNUSED(to_fwd);
return -1;
#endif
}
const safety_hooks nooutput_hooks = {
@@ -68,14 +45,19 @@ const safety_hooks nooutput_hooks = {
// *** all output safety mode ***
// Enables passthrough mode where relay is open and bus 0 gets forwarded to bus 2 and vice versa
const uint16_t ALLOUTPUT_PARAM_PASSTHROUGH = 1;
bool alloutput_passthrough = false;
static const addr_checks* alloutput_init(int16_t param) {
UNUSED(param);
alloutput_passthrough = GET_FLAG(param, ALLOUTPUT_PARAM_PASSTHROUGH);
controls_allowed = true;
relay_malfunction_reset();
return &default_rx_checks;
}
static int alloutput_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) {
static int alloutput_tx_hook(CANPacket_t *to_send) {
UNUSED(to_send);
return true;
}
@@ -87,10 +69,26 @@ static int alloutput_tx_lin_hook(int lin_num, uint8_t *data, int len) {
return true;
}
static int alloutput_fwd_hook(int bus_num, CANPacket_t *to_fwd) {
UNUSED(to_fwd);
int bus_fwd = -1;
if (alloutput_passthrough) {
if (bus_num == 0) {
bus_fwd = 2;
}
if (bus_num == 2) {
bus_fwd = 0;
}
}
return bus_fwd;
}
const safety_hooks alloutput_hooks = {
.init = alloutput_init,
.rx = default_rx_hook,
.tx = alloutput_tx_hook,
.tx_lin = alloutput_tx_lin_hook,
.fwd = default_fwd_hook,
.fwd = alloutput_fwd_hook,
};

View File

@@ -1,4 +1,4 @@
static int elm327_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) {
static int elm327_tx_hook(CANPacket_t *to_send) {
int tx = 1;
int addr = GET_ADDR(to_send);

View File

@@ -8,7 +8,7 @@
// brake > 0mph
static int ford_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
static int ford_rx_hook(CANPacket_t *to_push) {
int addr = GET_ADDR(to_push);
int bus = GET_BUS(to_push);
@@ -24,8 +24,8 @@ static int ford_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
// state machine to enter and exit controls
if (addr == 0x83) {
bool cancel = GET_BYTE(to_push, 1) & 0x1;
bool set_or_resume = GET_BYTE(to_push, 3) & 0x30;
bool cancel = GET_BYTE(to_push, 1) & 0x1U;
bool set_or_resume = GET_BYTE(to_push, 3) & 0x30U;
if (cancel) {
controls_allowed = 0;
}
@@ -37,7 +37,7 @@ static int ford_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
// exit controls on rising edge of brake press or on brake press when
// speed > 0
if (addr == 0x165) {
brake_pressed = GET_BYTE(to_push, 0) & 0x20;
brake_pressed = GET_BYTE(to_push, 0) & 0x20U;
if (brake_pressed && (!brake_pressed_prev || vehicle_moving)) {
controls_allowed = 0;
}
@@ -46,7 +46,7 @@ static int ford_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
// exit controls on rising edge of gas press
if (addr == 0x204) {
gas_pressed = ((GET_BYTE(to_push, 0) & 0x03) | GET_BYTE(to_push, 1)) != 0;
gas_pressed = ((GET_BYTE(to_push, 0) & 0x03U) | GET_BYTE(to_push, 1)) != 0U;
if (!unsafe_allow_gas && gas_pressed && !gas_pressed_prev) {
controls_allowed = 0;
}
@@ -65,7 +65,7 @@ static int ford_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
// else
// block all commands that produce actuation
static int ford_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) {
static int ford_tx_hook(CANPacket_t *to_send) {
int tx = 1;
int addr = GET_ADDR(to_send);
@@ -79,15 +79,11 @@ static int ford_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) {
}
bool current_controls_allowed = controls_allowed && !(pedal_pressed);
if (relay_malfunction) {
tx = 0;
}
// STEER: safety check
if (addr == 0x3CA) {
if (!current_controls_allowed) {
// bits 7-4 need to be 0xF to disallow lkas commands
if ((GET_BYTE(to_send, 0) & 0xF0) != 0xF0) {
if ((GET_BYTE(to_send, 0) & 0xF0U) != 0xF0U) {
tx = 0;
}
}
@@ -96,7 +92,7 @@ static int ford_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) {
// FORCE CANCEL: safety check only relevant when spamming the cancel button
// ensuring that set and resume aren't sent
if (addr == 0x83) {
if ((GET_BYTE(to_send, 3) & 0x30) != 0) {
if ((GET_BYTE(to_send, 3) & 0x30U) != 0U) {
tx = 0;
}
}

View File

@@ -34,15 +34,15 @@ AddrCheckStruct gm_addr_checks[] = {
#define GM_RX_CHECK_LEN (sizeof(gm_addr_checks) / sizeof(gm_addr_checks[0]))
addr_checks gm_rx_checks = {gm_addr_checks, GM_RX_CHECK_LEN};
static int gm_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
static int gm_rx_hook(CANPacket_t *to_push) {
bool valid = addr_safety_check(to_push, &gm_rx_checks, NULL, NULL, NULL);
if (valid && (GET_BUS(to_push) == 0)) {
if (valid && (GET_BUS(to_push) == 0U)) {
int addr = GET_ADDR(to_push);
if (addr == 388) {
int torque_driver_new = ((GET_BYTE(to_push, 6) & 0x7) << 8) | GET_BYTE(to_push, 7);
int torque_driver_new = ((GET_BYTE(to_push, 6) & 0x7U) << 8) | GET_BYTE(to_push, 7);
torque_driver_new = to_signed(torque_driver_new, 11);
// update array of samples
update_sample(&torque_driver, torque_driver_new);
@@ -56,7 +56,7 @@ static int gm_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
// ACC steering wheel buttons
if (addr == 481) {
int button = (GET_BYTE(to_push, 5) & 0x70) >> 4;
int button = (GET_BYTE(to_push, 5) & 0x70U) >> 4;
switch (button) {
case 2: // resume
case 3: // set
@@ -74,16 +74,16 @@ static int gm_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
if (addr == 241) {
// Brake pedal's potentiometer returns near-zero reading
// even when pedal is not pressed
brake_pressed = GET_BYTE(to_push, 1) >= 10;
brake_pressed = GET_BYTE(to_push, 1) >= 10U;
}
if (addr == 417) {
gas_pressed = GET_BYTE(to_push, 6) != 0;
gas_pressed = GET_BYTE(to_push, 6) != 0U;
}
// exit controls on regen paddle
if (addr == 189) {
bool regen = GET_BYTE(to_push, 0) & 0x20;
bool regen = GET_BYTE(to_push, 0) & 0x20U;
if (regen) {
controls_allowed = 0;
}
@@ -104,7 +104,7 @@ static int gm_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
// else
// block all commands that produce actuation
static int gm_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) {
static int gm_tx_hook(CANPacket_t *to_send) {
int tx = 1;
int addr = GET_ADDR(to_send);
@@ -113,10 +113,6 @@ static int gm_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) {
tx = 0;
}
if (relay_malfunction) {
tx = 0;
}
// disallow actuator commands if gas or brake (with vehicle moving) are pressed
// and the the latching controls_allowed flag is True
int pedal_pressed = brake_pressed_prev && vehicle_moving;

View File

@@ -1,43 +0,0 @@
// BUS 0 is on the LKAS module (ASCM) side
// BUS 2 is on the actuator (EPS) side
static int gm_ascm_fwd_hook(int bus_num, CAN_FIFOMailBox_TypeDef *to_fwd) {
int bus_fwd = -1;
if (bus_num == 0) {
int addr = GET_ADDR(to_fwd);
bus_fwd = 2;
// do not propagate lkas messages from ascm to actuators, unless supercruise is on
// block 0x152 and 0x154, which are the lkas command from ASCM1 and ASCM2
// block 0x315 and 0x2cb, which are the brake and accel commands from ASCM1
//if ((addr == 0x152) || (addr == 0x154) || (addr == 0x315) || (addr == 0x2cb)) {
if ((addr == 0x152) || (addr == 0x154)) {
bool supercruise_on = (GET_BYTE(to_fwd, 4) & 0x10) != 0; // bit 36
if (!supercruise_on) {
bus_fwd = -1;
}
}
if ((addr == 0x151) || (addr == 0x153) || (addr == 0x314)) {
// on the chassis bus, the OBDII port is on the module side, so we need to read
// the lkas messages sent by openpilot (put on unused 0x151 ane 0x153 addrs) and send it to
// the actuator as 0x152 and 0x154
uint32_t fwd_addr = addr + 1;
to_fwd->RIR = (fwd_addr << 21) | (to_fwd->RIR & 0x1fffff);
}
}
if (bus_num == 2) {
bus_fwd = 0;
}
return bus_fwd;
}
const safety_hooks gm_ascm_hooks = {
.init = nooutput_init,
.rx = default_rx_hook,
.tx = alloutput_tx_hook,
.tx_lin = nooutput_tx_lin_hook,
.fwd = gm_ascm_fwd_hook,
};

Some files were not shown because too many files have changed in this diff Show More