mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-10-19 18:23:43 +08:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7ca1257fd5 |
+1
-11
@@ -1,14 +1,4 @@
|
||||
Version 0.11.3 (2026-XX-XX)
|
||||
========================
|
||||
* Autospeed
|
||||
* On supported cars, openpilot will intelligently decide what speed to drive based on the scene, including:
|
||||
* stopping at red lights, and going at green lights
|
||||
* slowing down for curves
|
||||
* adjusting speed based on surrounding traffic
|
||||
* This behavior was previously available with openpilot's "Experimental mode", but is now out of beta and always enabled
|
||||
* With openpilot deciding which speed to drive, the car's cruise speed is treated as a maximum speed openpilot will not exceed
|
||||
|
||||
Version 0.11.2 (2026-10-14)
|
||||
Version 0.11.2 (2026-08-12)
|
||||
=======================
|
||||
* New driving model
|
||||
* Big model with 880M parameters
|
||||
|
||||
+10
-10
@@ -150,61 +150,61 @@
|
||||
"output": "/data/openpilot/openpilot/cereal/messaging/socketmaster.o"
|
||||
},
|
||||
{
|
||||
"command": "arm-none-eabi-gcc -mcpu=cortex-m7 -mhard-float -DSTM32H7 -DSTM32H725xx -Iboard/stm32h7/inc -mfpu=fpv5-d16 -DALLOW_DEBUG -DHEALTH_PACKET_VERSION=0xCA8F9EAFU -DCAN_PACKET_VERSION_HASH=0x75ABF276U -Wall -Wextra -Wstrict-prototypes -Werror -mlittle-endian -mthumb -nostdlib -fno-builtin -std=gnu11 -fmax-errors=1 -Tpanda/board/stm32h7/stm32h7x5_flash.ld -fsingle-precision-constant -Os -g -o panda/board/stm32h7/board/obj/panda_h7startup_stm32h7x5xx.o -c panda/board/stm32h7/startup_stm32h7x5xx.s",
|
||||
"command": "arm-none-eabi-gcc -mcpu=cortex-m7 -mhard-float -DSTM32H7 -DSTM32H725xx -Iboard/stm32h7/inc -mfpu=fpv5-d16 -DALLOW_DEBUG -DHEALTH_PACKET_VERSION=0xCC90A31EU -DCAN_PACKET_VERSION_HASH=0x75ABF276U -Wall -Wextra -Wstrict-prototypes -Werror -mlittle-endian -mthumb -nostdlib -fno-builtin -std=gnu11 -fmax-errors=1 -Tpanda/board/stm32h7/stm32h7x5_flash.ld -fsingle-precision-constant -Os -g -o panda/board/stm32h7/board/obj/panda_h7startup_stm32h7x5xx.o -c panda/board/stm32h7/startup_stm32h7x5xx.s",
|
||||
"directory": "/data/openpilot",
|
||||
"file": "/data/openpilot/panda/board/stm32h7/startup_stm32h7x5xx.s",
|
||||
"output": "/data/openpilot/panda/board/stm32h7/board/obj/panda_h7startup_stm32h7x5xx.o"
|
||||
},
|
||||
{
|
||||
"command": "arm-none-eabi-gcc -o panda/board/crypto/board/obj/panda_h7rsa.o -c -mcpu=cortex-m7 -mhard-float -DSTM32H7 -DSTM32H725xx -Iboard/stm32h7/inc -mfpu=fpv5-d16 -DALLOW_DEBUG -DHEALTH_PACKET_VERSION=0xCA8F9EAFU -DCAN_PACKET_VERSION_HASH=0x75ABF276U -Wall -Wextra -Wstrict-prototypes -Werror -mlittle-endian -mthumb -nostdlib -fno-builtin -std=gnu11 -fmax-errors=1 -Tpanda/board/stm32h7/stm32h7x5_flash.ld -fsingle-precision-constant -Os -g -DBOOTSTUB -Ipanda -Ipanda/board/stm32h7/inc -Iopendbc_repo panda/board/crypto/rsa.c",
|
||||
"command": "arm-none-eabi-gcc -o panda/board/crypto/board/obj/panda_h7rsa.o -c -mcpu=cortex-m7 -mhard-float -DSTM32H7 -DSTM32H725xx -Iboard/stm32h7/inc -mfpu=fpv5-d16 -DALLOW_DEBUG -DHEALTH_PACKET_VERSION=0xCC90A31EU -DCAN_PACKET_VERSION_HASH=0x75ABF276U -Wall -Wextra -Wstrict-prototypes -Werror -mlittle-endian -mthumb -nostdlib -fno-builtin -std=gnu11 -fmax-errors=1 -Tpanda/board/stm32h7/stm32h7x5_flash.ld -fsingle-precision-constant -Os -g -DBOOTSTUB -Ipanda -Ipanda/board/stm32h7/inc -Iopendbc_repo panda/board/crypto/rsa.c",
|
||||
"directory": "/data/openpilot",
|
||||
"file": "/data/openpilot/panda/board/crypto/rsa.c",
|
||||
"output": "/data/openpilot/panda/board/crypto/board/obj/panda_h7rsa.o"
|
||||
},
|
||||
{
|
||||
"command": "arm-none-eabi-gcc -o panda/board/crypto/board/obj/panda_h7sha.o -c -mcpu=cortex-m7 -mhard-float -DSTM32H7 -DSTM32H725xx -Iboard/stm32h7/inc -mfpu=fpv5-d16 -DALLOW_DEBUG -DHEALTH_PACKET_VERSION=0xCA8F9EAFU -DCAN_PACKET_VERSION_HASH=0x75ABF276U -Wall -Wextra -Wstrict-prototypes -Werror -mlittle-endian -mthumb -nostdlib -fno-builtin -std=gnu11 -fmax-errors=1 -Tpanda/board/stm32h7/stm32h7x5_flash.ld -fsingle-precision-constant -Os -g -DBOOTSTUB -Ipanda -Ipanda/board/stm32h7/inc -Iopendbc_repo panda/board/crypto/sha.c",
|
||||
"command": "arm-none-eabi-gcc -o panda/board/crypto/board/obj/panda_h7sha.o -c -mcpu=cortex-m7 -mhard-float -DSTM32H7 -DSTM32H725xx -Iboard/stm32h7/inc -mfpu=fpv5-d16 -DALLOW_DEBUG -DHEALTH_PACKET_VERSION=0xCC90A31EU -DCAN_PACKET_VERSION_HASH=0x75ABF276U -Wall -Wextra -Wstrict-prototypes -Werror -mlittle-endian -mthumb -nostdlib -fno-builtin -std=gnu11 -fmax-errors=1 -Tpanda/board/stm32h7/stm32h7x5_flash.ld -fsingle-precision-constant -Os -g -DBOOTSTUB -Ipanda -Ipanda/board/stm32h7/inc -Iopendbc_repo panda/board/crypto/sha.c",
|
||||
"directory": "/data/openpilot",
|
||||
"file": "/data/openpilot/panda/board/crypto/sha.c",
|
||||
"output": "/data/openpilot/panda/board/crypto/board/obj/panda_h7sha.o"
|
||||
},
|
||||
{
|
||||
"command": "arm-none-eabi-gcc -o panda/board/board/obj/panda_h7bootstub.o -c -mcpu=cortex-m7 -mhard-float -DSTM32H7 -DSTM32H725xx -Iboard/stm32h7/inc -mfpu=fpv5-d16 -DALLOW_DEBUG -DHEALTH_PACKET_VERSION=0xCA8F9EAFU -DCAN_PACKET_VERSION_HASH=0x75ABF276U -Wall -Wextra -Wstrict-prototypes -Werror -mlittle-endian -mthumb -nostdlib -fno-builtin -std=gnu11 -fmax-errors=1 -Tpanda/board/stm32h7/stm32h7x5_flash.ld -fsingle-precision-constant -Os -g -DBOOTSTUB -Ipanda -Ipanda/board/stm32h7/inc -Iopendbc_repo panda/board/bootstub.c",
|
||||
"command": "arm-none-eabi-gcc -o panda/board/board/obj/panda_h7bootstub.o -c -mcpu=cortex-m7 -mhard-float -DSTM32H7 -DSTM32H725xx -Iboard/stm32h7/inc -mfpu=fpv5-d16 -DALLOW_DEBUG -DHEALTH_PACKET_VERSION=0xCC90A31EU -DCAN_PACKET_VERSION_HASH=0x75ABF276U -Wall -Wextra -Wstrict-prototypes -Werror -mlittle-endian -mthumb -nostdlib -fno-builtin -std=gnu11 -fmax-errors=1 -Tpanda/board/stm32h7/stm32h7x5_flash.ld -fsingle-precision-constant -Os -g -DBOOTSTUB -Ipanda -Ipanda/board/stm32h7/inc -Iopendbc_repo panda/board/bootstub.c",
|
||||
"directory": "/data/openpilot",
|
||||
"file": "/data/openpilot/panda/board/bootstub.c",
|
||||
"output": "/data/openpilot/panda/board/board/obj/panda_h7bootstub.o"
|
||||
},
|
||||
{
|
||||
"command": "arm-none-eabi-gcc -o panda/board/board/obj/panda_h7main.o -c -mcpu=cortex-m7 -mhard-float -DSTM32H7 -DSTM32H725xx -Iboard/stm32h7/inc -mfpu=fpv5-d16 -DALLOW_DEBUG -DHEALTH_PACKET_VERSION=0xCA8F9EAFU -DCAN_PACKET_VERSION_HASH=0x75ABF276U -Wall -Wextra -Wstrict-prototypes -Werror -mlittle-endian -mthumb -nostdlib -fno-builtin -std=gnu11 -fmax-errors=1 -Tpanda/board/stm32h7/stm32h7x5_flash.ld -fsingle-precision-constant -Os -g -Ipanda -Ipanda/board/stm32h7/inc -Iopendbc_repo panda/board/main.c",
|
||||
"command": "arm-none-eabi-gcc -o panda/board/board/obj/panda_h7main.o -c -mcpu=cortex-m7 -mhard-float -DSTM32H7 -DSTM32H725xx -Iboard/stm32h7/inc -mfpu=fpv5-d16 -DALLOW_DEBUG -DHEALTH_PACKET_VERSION=0xCC90A31EU -DCAN_PACKET_VERSION_HASH=0x75ABF276U -Wall -Wextra -Wstrict-prototypes -Werror -mlittle-endian -mthumb -nostdlib -fno-builtin -std=gnu11 -fmax-errors=1 -Tpanda/board/stm32h7/stm32h7x5_flash.ld -fsingle-precision-constant -Os -g -Ipanda -Ipanda/board/stm32h7/inc -Iopendbc_repo panda/board/main.c",
|
||||
"directory": "/data/openpilot",
|
||||
"file": "/data/openpilot/panda/board/main.c",
|
||||
"output": "/data/openpilot/panda/board/board/obj/panda_h7main.o"
|
||||
},
|
||||
{
|
||||
"command": "arm-none-eabi-gcc -mcpu=cortex-m7 -mhard-float -DSTM32H7 -DSTM32H725xx -Iboard/stm32h7/inc -mfpu=fpv5-d16 -DPANDA_BODY -DALLOW_DEBUG -DHEALTH_PACKET_VERSION=0xCA8F9EAFU -DCAN_PACKET_VERSION_HASH=0x75ABF276U -Wall -Wextra -Wstrict-prototypes -Werror -mlittle-endian -mthumb -nostdlib -fno-builtin -std=gnu11 -fmax-errors=1 -Tpanda/board/stm32h7/stm32h7x5_flash.ld -fsingle-precision-constant -Os -g -o panda/board/stm32h7/board/obj/body_h7startup_stm32h7x5xx.o -c panda/board/stm32h7/startup_stm32h7x5xx.s",
|
||||
"command": "arm-none-eabi-gcc -mcpu=cortex-m7 -mhard-float -DSTM32H7 -DSTM32H725xx -Iboard/stm32h7/inc -mfpu=fpv5-d16 -DPANDA_BODY -DALLOW_DEBUG -DHEALTH_PACKET_VERSION=0xCC90A31EU -DCAN_PACKET_VERSION_HASH=0x75ABF276U -Wall -Wextra -Wstrict-prototypes -Werror -mlittle-endian -mthumb -nostdlib -fno-builtin -std=gnu11 -fmax-errors=1 -Tpanda/board/stm32h7/stm32h7x5_flash.ld -fsingle-precision-constant -Os -g -o panda/board/stm32h7/board/obj/body_h7startup_stm32h7x5xx.o -c panda/board/stm32h7/startup_stm32h7x5xx.s",
|
||||
"directory": "/data/openpilot",
|
||||
"file": "/data/openpilot/panda/board/stm32h7/startup_stm32h7x5xx.s",
|
||||
"output": "/data/openpilot/panda/board/stm32h7/board/obj/body_h7startup_stm32h7x5xx.o"
|
||||
},
|
||||
{
|
||||
"command": "arm-none-eabi-gcc -o panda/board/crypto/board/obj/body_h7rsa.o -c -mcpu=cortex-m7 -mhard-float -DSTM32H7 -DSTM32H725xx -Iboard/stm32h7/inc -mfpu=fpv5-d16 -DPANDA_BODY -DALLOW_DEBUG -DHEALTH_PACKET_VERSION=0xCA8F9EAFU -DCAN_PACKET_VERSION_HASH=0x75ABF276U -Wall -Wextra -Wstrict-prototypes -Werror -mlittle-endian -mthumb -nostdlib -fno-builtin -std=gnu11 -fmax-errors=1 -Tpanda/board/stm32h7/stm32h7x5_flash.ld -fsingle-precision-constant -Os -g -DBOOTSTUB -Ipanda -Ipanda/board/stm32h7/inc -Iopendbc_repo panda/board/crypto/rsa.c",
|
||||
"command": "arm-none-eabi-gcc -o panda/board/crypto/board/obj/body_h7rsa.o -c -mcpu=cortex-m7 -mhard-float -DSTM32H7 -DSTM32H725xx -Iboard/stm32h7/inc -mfpu=fpv5-d16 -DPANDA_BODY -DALLOW_DEBUG -DHEALTH_PACKET_VERSION=0xCC90A31EU -DCAN_PACKET_VERSION_HASH=0x75ABF276U -Wall -Wextra -Wstrict-prototypes -Werror -mlittle-endian -mthumb -nostdlib -fno-builtin -std=gnu11 -fmax-errors=1 -Tpanda/board/stm32h7/stm32h7x5_flash.ld -fsingle-precision-constant -Os -g -DBOOTSTUB -Ipanda -Ipanda/board/stm32h7/inc -Iopendbc_repo panda/board/crypto/rsa.c",
|
||||
"directory": "/data/openpilot",
|
||||
"file": "/data/openpilot/panda/board/crypto/rsa.c",
|
||||
"output": "/data/openpilot/panda/board/crypto/board/obj/body_h7rsa.o"
|
||||
},
|
||||
{
|
||||
"command": "arm-none-eabi-gcc -o panda/board/crypto/board/obj/body_h7sha.o -c -mcpu=cortex-m7 -mhard-float -DSTM32H7 -DSTM32H725xx -Iboard/stm32h7/inc -mfpu=fpv5-d16 -DPANDA_BODY -DALLOW_DEBUG -DHEALTH_PACKET_VERSION=0xCA8F9EAFU -DCAN_PACKET_VERSION_HASH=0x75ABF276U -Wall -Wextra -Wstrict-prototypes -Werror -mlittle-endian -mthumb -nostdlib -fno-builtin -std=gnu11 -fmax-errors=1 -Tpanda/board/stm32h7/stm32h7x5_flash.ld -fsingle-precision-constant -Os -g -DBOOTSTUB -Ipanda -Ipanda/board/stm32h7/inc -Iopendbc_repo panda/board/crypto/sha.c",
|
||||
"command": "arm-none-eabi-gcc -o panda/board/crypto/board/obj/body_h7sha.o -c -mcpu=cortex-m7 -mhard-float -DSTM32H7 -DSTM32H725xx -Iboard/stm32h7/inc -mfpu=fpv5-d16 -DPANDA_BODY -DALLOW_DEBUG -DHEALTH_PACKET_VERSION=0xCC90A31EU -DCAN_PACKET_VERSION_HASH=0x75ABF276U -Wall -Wextra -Wstrict-prototypes -Werror -mlittle-endian -mthumb -nostdlib -fno-builtin -std=gnu11 -fmax-errors=1 -Tpanda/board/stm32h7/stm32h7x5_flash.ld -fsingle-precision-constant -Os -g -DBOOTSTUB -Ipanda -Ipanda/board/stm32h7/inc -Iopendbc_repo panda/board/crypto/sha.c",
|
||||
"directory": "/data/openpilot",
|
||||
"file": "/data/openpilot/panda/board/crypto/sha.c",
|
||||
"output": "/data/openpilot/panda/board/crypto/board/obj/body_h7sha.o"
|
||||
},
|
||||
{
|
||||
"command": "arm-none-eabi-gcc -o panda/board/board/obj/body_h7bootstub.o -c -mcpu=cortex-m7 -mhard-float -DSTM32H7 -DSTM32H725xx -Iboard/stm32h7/inc -mfpu=fpv5-d16 -DPANDA_BODY -DALLOW_DEBUG -DHEALTH_PACKET_VERSION=0xCA8F9EAFU -DCAN_PACKET_VERSION_HASH=0x75ABF276U -Wall -Wextra -Wstrict-prototypes -Werror -mlittle-endian -mthumb -nostdlib -fno-builtin -std=gnu11 -fmax-errors=1 -Tpanda/board/stm32h7/stm32h7x5_flash.ld -fsingle-precision-constant -Os -g -DBOOTSTUB -Ipanda -Ipanda/board/stm32h7/inc -Iopendbc_repo panda/board/bootstub.c",
|
||||
"command": "arm-none-eabi-gcc -o panda/board/board/obj/body_h7bootstub.o -c -mcpu=cortex-m7 -mhard-float -DSTM32H7 -DSTM32H725xx -Iboard/stm32h7/inc -mfpu=fpv5-d16 -DPANDA_BODY -DALLOW_DEBUG -DHEALTH_PACKET_VERSION=0xCC90A31EU -DCAN_PACKET_VERSION_HASH=0x75ABF276U -Wall -Wextra -Wstrict-prototypes -Werror -mlittle-endian -mthumb -nostdlib -fno-builtin -std=gnu11 -fmax-errors=1 -Tpanda/board/stm32h7/stm32h7x5_flash.ld -fsingle-precision-constant -Os -g -DBOOTSTUB -Ipanda -Ipanda/board/stm32h7/inc -Iopendbc_repo panda/board/bootstub.c",
|
||||
"directory": "/data/openpilot",
|
||||
"file": "/data/openpilot/panda/board/bootstub.c",
|
||||
"output": "/data/openpilot/panda/board/board/obj/body_h7bootstub.o"
|
||||
},
|
||||
{
|
||||
"command": "arm-none-eabi-gcc -o panda/board/body/board/obj/body_h7main.o -c -mcpu=cortex-m7 -mhard-float -DSTM32H7 -DSTM32H725xx -Iboard/stm32h7/inc -mfpu=fpv5-d16 -DPANDA_BODY -DALLOW_DEBUG -DHEALTH_PACKET_VERSION=0xCA8F9EAFU -DCAN_PACKET_VERSION_HASH=0x75ABF276U -Wall -Wextra -Wstrict-prototypes -Werror -mlittle-endian -mthumb -nostdlib -fno-builtin -std=gnu11 -fmax-errors=1 -Tpanda/board/stm32h7/stm32h7x5_flash.ld -fsingle-precision-constant -Os -g -Ipanda -Ipanda/board/stm32h7/inc -Iopendbc_repo panda/board/body/main.c",
|
||||
"command": "arm-none-eabi-gcc -o panda/board/body/board/obj/body_h7main.o -c -mcpu=cortex-m7 -mhard-float -DSTM32H7 -DSTM32H725xx -Iboard/stm32h7/inc -mfpu=fpv5-d16 -DPANDA_BODY -DALLOW_DEBUG -DHEALTH_PACKET_VERSION=0xCC90A31EU -DCAN_PACKET_VERSION_HASH=0x75ABF276U -Wall -Wextra -Wstrict-prototypes -Werror -mlittle-endian -mthumb -nostdlib -fno-builtin -std=gnu11 -fmax-errors=1 -Tpanda/board/stm32h7/stm32h7x5_flash.ld -fsingle-precision-constant -Os -g -Ipanda -Ipanda/board/stm32h7/inc -Iopendbc_repo panda/board/body/main.c",
|
||||
"directory": "/data/openpilot",
|
||||
"file": "/data/openpilot/panda/board/body/main.c",
|
||||
"output": "/data/openpilot/panda/board/body/board/obj/body_h7main.o"
|
||||
|
||||
@@ -56,8 +56,6 @@ function launch {
|
||||
mv "$DIR" /data/safe_staging/old_openpilot
|
||||
mv "${STAGING_ROOT}/finalized" "$DIR"
|
||||
cd "$DIR"
|
||||
# releases before the openpilot/ move can't swap AGNOS on newer AGNOS, use ours
|
||||
[ ! -L system/hardware/tici/agnos.json ] && /data/safe_staging/old_openpilot/openpilot/common/hardware/comma/agnos.py --verify system/hardware/tici/agnos.json && sudo reboot
|
||||
|
||||
echo "Restarting launch script ${LAUNCHER_LOCATION}"
|
||||
unset AGNOS_VERSION
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ export VECLIB_MAXIMUM_THREADS=1
|
||||
export QCOM_PRIORITY=12
|
||||
|
||||
if [ -z "$AGNOS_VERSION" ]; then
|
||||
export AGNOS_VERSION="19.9"
|
||||
export AGNOS_VERSION="19.7"
|
||||
fi
|
||||
|
||||
export STAGING_ROOT="/data/safe_staging"
|
||||
|
||||
Binary file not shown.
Vendored
-4
@@ -23,10 +23,6 @@ body:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: 'opendbc/car/body/**'
|
||||
|
||||
byd:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: 'opendbc/car/byd/**'
|
||||
|
||||
chrysler:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: 'opendbc/car/chrysler/**'
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<!--- AUTOGENERATED FROM selfdrive/car/CARS_template.md, DO NOT EDIT. --->
|
||||
|
||||
# Support Information for 406 Known Cars
|
||||
# Support Information for 402 Known Cars
|
||||
|
||||
|Make|Model|Package|Support Level|
|
||||
|---|---|---|:---:|
|
||||
|Acura|ADX 2025-26|All|[Upstream](#upstream)|
|
||||
|Acura|ADX 2025-26|All|[Community](#community)|
|
||||
|Acura|ILX 2016-18|Technology Plus Package or AcuraWatch Plus|[Upstream](#upstream)|
|
||||
|Acura|ILX 2019|All|[Upstream](#upstream)|
|
||||
|Acura|Integra 2023-25|All|[Community](#community)|
|
||||
@@ -34,7 +34,6 @@
|
||||
|Audi|Q5 2017-24|All|[Not compatible](#flexray)|
|
||||
|Audi|RS3 2018|Adaptive Cruise Control (ACC) & Lane Assist|[Upstream](#upstream)|
|
||||
|Audi|S3 2015-17|Adaptive Cruise Control (ACC) & Lane Assist|[Upstream](#upstream)|
|
||||
|BYD|Atto 3 2022-25|All|[Dashcam mode](#dashcam)|
|
||||
|Chevrolet|Bolt EUV 2022-23|Premier or Premier Redline Trim, without Super Cruise Package|[Upstream](#upstream)|
|
||||
|Chevrolet|Bolt EV 2022-23|2LT Trim with Adaptive Cruise Control Package|[Upstream](#upstream)|
|
||||
|Chevrolet|Equinox 2019-22|Adaptive Cruise Control (ACC)|[Upstream](#upstream)|
|
||||
@@ -102,7 +101,7 @@
|
||||
|Honda|Civic 2022-26|All|[Upstream](#upstream)|
|
||||
|Honda|Civic Hatchback 2017-18|Honda Sensing|[Upstream](#upstream)|
|
||||
|Honda|Civic Hatchback 2019-21|All|[Upstream](#upstream)|
|
||||
|Honda|Civic Hatchback 2022-26|All|[Upstream](#upstream)|
|
||||
|Honda|Civic Hatchback 2022-24|All|[Upstream](#upstream)|
|
||||
|Honda|Civic Hatchback Hybrid 2025-26|All|[Upstream](#upstream)|
|
||||
|Honda|Civic Hatchback Hybrid (Europe only) 2023|All|[Upstream](#upstream)|
|
||||
|Honda|Civic Hybrid 2025-26|All|[Upstream](#upstream)|
|
||||
@@ -111,7 +110,7 @@
|
||||
|Honda|CR-V 2017-22|Honda Sensing|[Upstream](#upstream)|
|
||||
|Honda|CR-V 2023-26|All|[Upstream](#upstream)|
|
||||
|Honda|CR-V Hybrid 2017-22|Honda Sensing|[Upstream](#upstream)|
|
||||
|Honda|CR-V Hybrid 2023-27|All|[Upstream](#upstream)|
|
||||
|Honda|CR-V Hybrid 2023-26|All|[Upstream](#upstream)|
|
||||
|Honda|e 2020|All|[Upstream](#upstream)|
|
||||
|Honda|Fit 2018-20|Honda Sensing|[Upstream](#upstream)|
|
||||
|Honda|Freed 2020|Honda Sensing|[Upstream](#upstream)|
|
||||
@@ -128,10 +127,10 @@
|
||||
|Honda|Passport 2026|All|[Upstream](#upstream)|
|
||||
|Honda|Pilot 2016-22|Honda Sensing|[Upstream](#upstream)|
|
||||
|Honda|Pilot 2023-25|All|[Upstream](#upstream)|
|
||||
|Honda|Pilot 2026|All|[Upstream](#upstream)|
|
||||
|Honda|Prelude 2026|All|[Upstream](#upstream)|
|
||||
|Honda|Pilot 2026|All|[Community](#community)|
|
||||
|Honda|Prologue 2024-26|All|[Not compatible](#can-bus-security)|
|
||||
|Honda|Ridgeline 2017-26|Honda Sensing|[Upstream](#upstream)|
|
||||
|Honda|Ridgeline 2017-25|Honda Sensing|[Upstream](#upstream)|
|
||||
|Honda|Ridgeline 2026|All|[Community](#community)|
|
||||
|Hyundai|Azera 2022|All|[Upstream](#upstream)|
|
||||
|Hyundai|Azera Hybrid 2019|All|[Upstream](#upstream)|
|
||||
|Hyundai|Azera Hybrid 2020|All|[Upstream](#upstream)|
|
||||
@@ -185,7 +184,6 @@
|
||||
|Kia|Carnival 2022-24|Smart Cruise Control (SCC)|[Upstream](#upstream)|
|
||||
|Kia|Carnival (China only) 2023|Smart Cruise Control (SCC)|[Upstream](#upstream)|
|
||||
|Kia|Ceed 2019-21|Smart Cruise Control (SCC)|[Upstream](#upstream)|
|
||||
|Kia|Ceed Plug-in Hybrid 2021|Smart Cruise Control (SCC)|[Upstream](#upstream)|
|
||||
|Kia|EV6 (Southeast Asia only) 2022-24|All|[Upstream](#upstream)|
|
||||
|Kia|EV6 (with HDA II) 2022-24|Highway Driving Assist II|[Upstream](#upstream)|
|
||||
|Kia|EV6 (without HDA II) 2022-24|Highway Driving Assist|[Upstream](#upstream)|
|
||||
@@ -221,7 +219,6 @@
|
||||
|Kia|Sorento Plug-in Hybrid 2022-23|All|[Upstream](#upstream)|
|
||||
|Kia|Sportage 2023-24|Smart Cruise Control (SCC)|[Upstream](#upstream)|
|
||||
|Kia|Sportage Hybrid 2023|Smart Cruise Control (SCC)|[Upstream](#upstream)|
|
||||
|Kia|Sportage Plug-in Hybrid 2023|Smart Cruise Control (SCC)|[Upstream](#upstream)|
|
||||
|Kia|Stinger 2018-20|Smart Cruise Control (SCC)|[Upstream](#upstream)|
|
||||
|Kia|Stinger 2022-23|All|[Upstream](#upstream)|
|
||||
|Kia|Telluride 2020-22|All|[Upstream](#upstream)|
|
||||
@@ -304,7 +301,6 @@
|
||||
|Škoda|Octavia Scout 2017-19|Adaptive Cruise Control (ACC) & Lane Assist|[Upstream](#upstream)|
|
||||
|Škoda|Scala 2020-23|Adaptive Cruise Control (ACC) & Lane Assist|[Upstream](#upstream)|
|
||||
|Škoda|Superb 2015-22|Adaptive Cruise Control (ACC) & Lane Assist|[Upstream](#upstream)|
|
||||
|Tesla|Model 3 (with HW2.5) 2019|All|[Upstream](#upstream)|
|
||||
|Tesla|Model 3 (with HW3) 2019-23|All|[Upstream](#upstream)|
|
||||
|Tesla|Model 3 (with HW4) 2024-25|All|[Upstream](#upstream)|
|
||||
|Tesla|Model X (with HW4) 2024|All|[Dashcam mode](#dashcam)|
|
||||
|
||||
@@ -16,11 +16,7 @@ from opendbc.car.volkswagen.mlbcan import volkswagen_mlb_checksum
|
||||
from opendbc.car.volkswagen.mqbcan import volkswagen_meb_alt_crc_checksum, volkswagen_mqb_meb_checksum, xor_checksum
|
||||
from opendbc.car.tesla.teslacan import tesla_checksum
|
||||
from opendbc.car.body.bodycan import body_checksum
|
||||
from opendbc.car.byd.bydcan import byd_checksum
|
||||
from opendbc.car.psa.psacan import psa_checksum
|
||||
from opendbc.car.rivian.riviancan import rivian_checksum
|
||||
from opendbc.car.ford.fordcan import FORD_CHECKSUM_FIELDS, ford_checksum
|
||||
from opendbc.car.mg.mgcan import mg_checksum
|
||||
|
||||
|
||||
class SignalType:
|
||||
@@ -38,10 +34,6 @@ class SignalType:
|
||||
TESLA_CHECKSUM = 11
|
||||
PSA_CHECKSUM = 12
|
||||
VOLKSWAGEN_MLB_CHECKSUM = 13
|
||||
BYD_CHECKSUM = 14
|
||||
RIVIAN_CHECKSUM = 15
|
||||
FORD_CHECKSUM = 16
|
||||
MG_CHECKSUM = 17
|
||||
|
||||
|
||||
@dataclass
|
||||
@@ -57,21 +49,6 @@ class Signal:
|
||||
is_little_endian: bool
|
||||
type: int = SignalType.DEFAULT
|
||||
calc_checksum: 'Callable[[int, Signal, bytearray], int] | None' = None
|
||||
checksum_fields: tuple['Signal', ...] = ()
|
||||
|
||||
def get_raw_value(self, dat: bytes | bytearray) -> int:
|
||||
ret = 0
|
||||
i = self.msb // 8
|
||||
bits = self.size
|
||||
while 0 <= i < len(dat) and bits > 0:
|
||||
lsb = self.lsb if (self.lsb // 8) == i else i * 8
|
||||
msb = self.msb if (self.msb // 8) == i else (i + 1) * 8 - 1
|
||||
size = msb - lsb + 1
|
||||
d = (dat[i] >> (lsb - (i * 8))) & ((1 << size) - 1)
|
||||
ret |= d << (bits - size)
|
||||
bits -= size
|
||||
i = i - 1 if self.is_little_endian else i + 1
|
||||
return ret
|
||||
|
||||
|
||||
@dataclass
|
||||
@@ -170,7 +147,7 @@ class DBC:
|
||||
msb = start_bit
|
||||
|
||||
sig = Signal(sig_name, start_bit, msb, lsb, size, is_signed, factor, offset_val, is_little_endian)
|
||||
set_signal_type(sig, checksum_state, self.name, line_num, address)
|
||||
set_signal_type(sig, checksum_state, self.name, line_num)
|
||||
signals_temp[address][sig_name] = sig
|
||||
elif line.startswith("VAL_ "):
|
||||
m = VAL_RE.search(line)
|
||||
@@ -185,11 +162,6 @@ class DBC:
|
||||
self.vals.append(Val(sgname, val_addr, val_def))
|
||||
for addr, sigs in signals_temp.items():
|
||||
self.msgs[addr].sigs = sigs
|
||||
if checksum_state and checksum_state.checksum_fields and addr in checksum_state.checksum_fields:
|
||||
fields = tuple(sigs[name] for name in checksum_state.checksum_fields[addr])
|
||||
for sig in sigs.values():
|
||||
if sig.calc_checksum:
|
||||
sig.checksum_fields = fields
|
||||
|
||||
|
||||
# ***** checksum functions *****
|
||||
@@ -202,18 +174,11 @@ def tesla_setup_signal(sig: Signal, dbc_name: str, line_num: int) -> None:
|
||||
sig.calc_checksum = tesla_checksum
|
||||
|
||||
|
||||
def ford_setup_signal(sig: Signal, dbc_name: str, line_num: int) -> None:
|
||||
if sig.name in ("VehVActlBrk_No_Cnt", "VehVActlEng_No_Cnt", "VehRollYaw_No_Cnt"):
|
||||
sig.type = SignalType.COUNTER
|
||||
|
||||
|
||||
@dataclass
|
||||
class ChecksumState:
|
||||
checksum_type: int
|
||||
calc_checksum: Callable[[int, Signal, bytearray], int] | None
|
||||
setup_signal: Callable[[Signal, str, int], None] | None = None
|
||||
checksum_pattern: str = r"^CHECKSUM$"
|
||||
checksum_fields: dict[int, tuple[str, ...]] | None = None
|
||||
|
||||
|
||||
def get_checksum_state(dbc_name: str) -> ChecksumState | None:
|
||||
@@ -243,26 +208,15 @@ def get_checksum_state(dbc_name: str) -> ChecksumState | None:
|
||||
return ChecksumState(SignalType.TESLA_CHECKSUM, tesla_checksum, tesla_setup_signal)
|
||||
elif dbc_name.startswith("psa_"):
|
||||
return ChecksumState(SignalType.PSA_CHECKSUM, psa_checksum)
|
||||
elif dbc_name.startswith("byd_"):
|
||||
return ChecksumState(SignalType.BYD_CHECKSUM, byd_checksum)
|
||||
elif dbc_name == "ford_lincoln_base_pt":
|
||||
# Other _Cs fields are optional or use model-specific checksum algorithms.
|
||||
return ChecksumState(SignalType.FORD_CHECKSUM, ford_checksum, ford_setup_signal, checksum_pattern=r"_Cs$",
|
||||
checksum_fields=FORD_CHECKSUM_FIELDS)
|
||||
elif dbc_name == "mg":
|
||||
return ChecksumState(SignalType.MG_CHECKSUM, mg_checksum, checksum_pattern=r"Chksm|^ChLKARespToqPVHSC2$")
|
||||
elif dbc_name == "rivian_primary_actuator":
|
||||
return ChecksumState(SignalType.RIVIAN_CHECKSUM, rivian_checksum, checksum_pattern=r"_Checksum$")
|
||||
return None
|
||||
|
||||
|
||||
def set_signal_type(sig: Signal, chk: ChecksumState | None, dbc_name: str, line_num: int, address: int) -> None:
|
||||
def set_signal_type(sig: Signal, chk: ChecksumState | None, dbc_name: str, line_num: int) -> None:
|
||||
sig.calc_checksum = None
|
||||
if chk:
|
||||
if chk.setup_signal:
|
||||
chk.setup_signal(sig, dbc_name, line_num)
|
||||
if (re.search(chk.checksum_pattern, sig.name) and
|
||||
(chk.checksum_fields is None or address in chk.checksum_fields)):
|
||||
if sig.name == "CHECKSUM":
|
||||
sig.type = chk.checksum_type
|
||||
sig.calc_checksum = chk.calc_checksum
|
||||
elif sig.name == "COUNTER":
|
||||
|
||||
@@ -11,6 +11,21 @@ MAX_BAD_COUNTER = 5
|
||||
CAN_INVALID_CNT = 5
|
||||
|
||||
|
||||
def get_raw_value(dat: bytes | bytearray, sig: Signal) -> int:
|
||||
ret = 0
|
||||
i = sig.msb // 8
|
||||
bits = sig.size
|
||||
while 0 <= i < len(dat) and bits > 0:
|
||||
lsb = sig.lsb if (sig.lsb // 8) == i else i * 8
|
||||
msb = sig.msb if (sig.msb // 8) == i else (i + 1) * 8 - 1
|
||||
size = msb - lsb + 1
|
||||
d = (dat[i] >> (lsb - (i * 8))) & ((1 << size) - 1)
|
||||
ret |= d << (bits - size)
|
||||
bits -= size
|
||||
i = i - 1 if sig.is_little_endian else i + 1
|
||||
return ret
|
||||
|
||||
|
||||
@dataclass
|
||||
class MessageState:
|
||||
address: int
|
||||
@@ -44,7 +59,7 @@ class MessageState:
|
||||
self.first_seen_nanos = nanos
|
||||
|
||||
for i, sig in enumerate(self.signals):
|
||||
tmp = sig.get_raw_value(dat)
|
||||
tmp = get_raw_value(dat, sig)
|
||||
if sig.is_signed:
|
||||
tmp -= ((tmp >> (sig.size - 1)) & 0x1) * (1 << sig.size)
|
||||
|
||||
|
||||
@@ -10,6 +10,9 @@ from opendbc.car.docs_definitions import CarDocs, ExtraCarDocs
|
||||
|
||||
DT_CTRL = 0.01 # car state and control loop timestep (s)
|
||||
|
||||
# kg of standard extra cargo to count for drive, gas, etc...
|
||||
STD_CARGO_KG = 136.
|
||||
|
||||
ACCELERATION_DUE_TO_GRAVITY = 9.81 # m/s^2
|
||||
|
||||
ButtonType = structs.CarState.ButtonEvent.Type
|
||||
@@ -44,7 +47,7 @@ def gen_empty_fingerprint():
|
||||
|
||||
# these params were derived for the Civic and used to calculate params for other cars
|
||||
class VehicleDynamicsParams:
|
||||
MASS = 1462. # kg, reference Civic curb mass (1326) plus cargo (136)
|
||||
MASS = 1326. + STD_CARGO_KG
|
||||
WHEELBASE = 2.70
|
||||
CENTER_TO_FRONT = WHEELBASE * 0.4
|
||||
CENTER_TO_REAR = WHEELBASE - CENTER_TO_FRONT
|
||||
@@ -54,19 +57,19 @@ class VehicleDynamicsParams:
|
||||
|
||||
|
||||
# TODO: get actual value, for now starting with reasonable value for
|
||||
# civic and scaling by wheelbase
|
||||
def scale_rot_inertia_per_mass(wheelbase):
|
||||
return VehicleDynamicsParams.ROTATIONAL_INERTIA * wheelbase ** 2 / (VehicleDynamicsParams.MASS * VehicleDynamicsParams.WHEELBASE ** 2)
|
||||
# civic and scaling by mass and wheelbase
|
||||
def scale_rot_inertia(mass, wheelbase):
|
||||
return VehicleDynamicsParams.ROTATIONAL_INERTIA * mass * wheelbase ** 2 / (VehicleDynamicsParams.MASS * VehicleDynamicsParams.WHEELBASE ** 2)
|
||||
|
||||
|
||||
# TODO: start from empirically derived lateral slip stiffness for the civic and scale by
|
||||
# CG position, so all cars will have approximately similar dyn behaviors
|
||||
def scale_tire_stiffness_per_mass(wheelbase, center_to_front, tire_stiffness_factor):
|
||||
# mass and CG position, so all cars will have approximately similar dyn behaviors
|
||||
def scale_tire_stiffness(mass, wheelbase, center_to_front, tire_stiffness_factor):
|
||||
center_to_rear = wheelbase - center_to_front
|
||||
tire_stiffness_front = (VehicleDynamicsParams.TIRE_STIFFNESS_FRONT * tire_stiffness_factor) / VehicleDynamicsParams.MASS * \
|
||||
tire_stiffness_front = (VehicleDynamicsParams.TIRE_STIFFNESS_FRONT * tire_stiffness_factor) * mass / VehicleDynamicsParams.MASS * \
|
||||
(center_to_rear / wheelbase) / (VehicleDynamicsParams.CENTER_TO_REAR / VehicleDynamicsParams.WHEELBASE)
|
||||
|
||||
tire_stiffness_rear = (VehicleDynamicsParams.TIRE_STIFFNESS_REAR * tire_stiffness_factor) / VehicleDynamicsParams.MASS * \
|
||||
tire_stiffness_rear = (VehicleDynamicsParams.TIRE_STIFFNESS_REAR * tire_stiffness_factor) * mass / VehicleDynamicsParams.MASS * \
|
||||
(center_to_front / wheelbase) / (VehicleDynamicsParams.CENTER_TO_FRONT / VehicleDynamicsParams.WHEELBASE)
|
||||
|
||||
return tire_stiffness_front, tire_stiffness_rear
|
||||
@@ -144,6 +147,7 @@ class CanSignalRateCalculator:
|
||||
|
||||
@dataclass(frozen=True, kw_only=True)
|
||||
class CarSpecs:
|
||||
mass: float # kg, curb weight
|
||||
wheelbase: float # meters
|
||||
steerRatio: float
|
||||
centerToFrontRatio: float = 0.5
|
||||
@@ -209,7 +213,7 @@ class PlatformConfig(PlatformConfigBase):
|
||||
@dataclass
|
||||
class ExtraPlatformConfig(PlatformConfigBase):
|
||||
car_docs: list[ExtraCarDocs]
|
||||
specs: CarSpecs = CarSpecs(wheelbase=0., steerRatio=0.)
|
||||
specs: CarSpecs = CarSpecs(mass=0., wheelbase=0., steerRatio=0.)
|
||||
dbc_dict: DbcDict = field(default_factory=lambda: dict())
|
||||
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ class CarControllerParams:
|
||||
class CAR(Platforms):
|
||||
COMMA_BODY = PlatformConfig(
|
||||
[CarDocs("comma body", package="All", video="https://youtu.be/VT-i3yRsX2s?t=2736")],
|
||||
CarSpecs(wheelbase=0.406, steerRatio=0.5, centerToFrontRatio=0.44),
|
||||
CarSpecs(mass=9, wheelbase=0.406, steerRatio=0.5, centerToFrontRatio=0.44),
|
||||
{Bus.main: 'comma_body'},
|
||||
)
|
||||
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
def byd_checksum(address: int, sig, d: bytearray) -> int:
|
||||
return (~sum(d[:7])) & 0xFF
|
||||
|
||||
|
||||
def create_steering_control(packer, apply_angle: float, lat_active: bool, counter: int):
|
||||
# Stock saturates the rate limits at ±299 when engaged, 0 when disengaged
|
||||
rate_limit = 299 if lat_active else 0
|
||||
values = {
|
||||
"STEER_REQ": 1 if lat_active else 0,
|
||||
"STEER_REQ_ACTIVE_LOW": 0 if lat_active else 1,
|
||||
"STEER_ANGLE": apply_angle,
|
||||
"ANGLE_RATE_LIMIT_UPPER": rate_limit,
|
||||
"ANGLE_RATE_LIMIT_LOWER": -rate_limit,
|
||||
"E2E_ALIVE_1": 1,
|
||||
"E2E_ALIVE_2": 1,
|
||||
"SET_ME_FF": 0xFF,
|
||||
"SET_ME_F": 0xF,
|
||||
"COUNTER": counter,
|
||||
}
|
||||
return packer.make_can_msg("STEERING_MODULE_ADAS", 0, values)
|
||||
|
||||
|
||||
def create_buttons(packer, cancel: bool):
|
||||
values = {
|
||||
"SET_ME_1_1": 1,
|
||||
"SET_ME_1_2": 1,
|
||||
"ACC_ON_BTN": 1 if cancel else 0,
|
||||
}
|
||||
return packer.make_can_msg("PCM_BUTTONS", 0, values)
|
||||
|
||||
|
||||
def create_lkas_hud(packer, lat_active: bool, counter: int, stock_lkas_hud: dict, hud_control):
|
||||
values = {**stock_lkas_hud, "COUNTER": counter, "HANDS_ON_WHEEL_REQ": 0}
|
||||
if lat_active:
|
||||
values["LKS_MODE"] = 2 # green lane line icon
|
||||
values["LKAS_STATE"] = 2 # green steering wheel icon
|
||||
# LANE_STATE: 0=Grey, 1=Green, 2=Orange
|
||||
values["LEFT_LANE_STATE"] = 1 if hud_control.leftLaneVisible else 0
|
||||
values["RIGHT_LANE_STATE"] = 1 if hud_control.rightLaneVisible else 0
|
||||
|
||||
if hud_control.leftLaneDepart:
|
||||
values["LEFT_LANE_STATE"] = 2
|
||||
if hud_control.rightLaneDepart:
|
||||
values["RIGHT_LANE_STATE"] = 2
|
||||
|
||||
return packer.make_can_msg("LKAS_HUD_ADAS", 0, values)
|
||||
@@ -1,44 +0,0 @@
|
||||
from opendbc.can.packer import CANPacker
|
||||
from opendbc.car import Bus
|
||||
from opendbc.car.lateral import apply_steer_angle_limits_vm
|
||||
from opendbc.car.interfaces import CarControllerBase
|
||||
from opendbc.car.byd import bydcan
|
||||
from opendbc.car.byd.values import CarControllerParams
|
||||
from opendbc.car.vehicle_model import VehicleModel
|
||||
|
||||
|
||||
def get_safety_CP():
|
||||
from opendbc.car.byd.interface import CarInterface
|
||||
return CarInterface.get_non_essential_params("BYD_ATTO_3")
|
||||
|
||||
|
||||
class CarController(CarControllerBase):
|
||||
def __init__(self, dbc_names, CP, CP_SP=None):
|
||||
super().__init__(dbc_names, CP, CP_SP)
|
||||
self.packer = CANPacker(dbc_names[Bus.pt])
|
||||
self.apply_angle_last = 0.0
|
||||
|
||||
# Vehicle model used for lateral limiting
|
||||
self.VM = VehicleModel(get_safety_CP())
|
||||
|
||||
def update(self, CC, CC_SP, CS, now_nanos):
|
||||
can_sends = []
|
||||
actuators = CC.actuators
|
||||
hud_control = CC.hudControl
|
||||
|
||||
if self.frame % 2:
|
||||
self.apply_angle_last = apply_steer_angle_limits_vm(actuators.steeringAngleDeg, self.apply_angle_last, CS.out.vEgoRaw,
|
||||
CS.out.steeringAngleDeg, CC.latActive, CarControllerParams, self.VM)
|
||||
|
||||
cntr = (self.frame // 2) % 16
|
||||
can_sends.append(bydcan.create_steering_control(self.packer, self.apply_angle_last, CC.latActive, cntr))
|
||||
can_sends.append(bydcan.create_lkas_hud(self.packer, CC.latActive, cntr, CS.lkas_hud, hud_control))
|
||||
|
||||
if CC.cruiseControl.cancel and self.frame % 10 == 0:
|
||||
can_sends.append(bydcan.create_buttons(self.packer, cancel=True))
|
||||
|
||||
new_actuators = actuators.as_builder()
|
||||
new_actuators.steeringAngleDeg = float(self.apply_angle_last)
|
||||
|
||||
self.frame += 1
|
||||
return new_actuators, can_sends
|
||||
@@ -1,92 +0,0 @@
|
||||
import copy
|
||||
|
||||
from opendbc.car import Bus, structs
|
||||
from opendbc.can.parser import CANParser
|
||||
from opendbc.car.common.conversions import Conversions as CV
|
||||
from opendbc.car.byd.values import DBC, CarControllerParams as CCP
|
||||
from opendbc.car.interfaces import CarStateBase
|
||||
|
||||
GearShifter = structs.CarState.GearShifter
|
||||
|
||||
# BYD gear enum from DRIVE_STATE.GEAR
|
||||
GEAR_MAP = {
|
||||
1: GearShifter.park,
|
||||
2: GearShifter.reverse,
|
||||
3: GearShifter.neutral,
|
||||
4: GearShifter.drive,
|
||||
}
|
||||
|
||||
|
||||
class CarState(CarStateBase):
|
||||
def __init__(self, CP, CP_SP=None):
|
||||
super().__init__(CP, CP_SP)
|
||||
self.lkas_hud = {}
|
||||
|
||||
def update(self, can_parsers) -> structs.CarState:
|
||||
cp = can_parsers[Bus.pt]
|
||||
cp_cam = can_parsers[Bus.cam]
|
||||
ret = structs.CarState()
|
||||
|
||||
# speed
|
||||
speed_kph = cp.vl["WHEELSPEED_CLEAN"]["WHEELSPEED_CLEAN"]
|
||||
ret.vEgoRaw = speed_kph * CV.KPH_TO_MS
|
||||
ret.vEgo, ret.aEgo = self.update_speed_kf(ret.vEgoRaw)
|
||||
ret.standstill = speed_kph < 0.1
|
||||
ret.vEgoCluster = ret.vEgo
|
||||
|
||||
# steering wheel
|
||||
ret.steeringAngleDeg = cp.vl["STEER_MODULE_2"]["STEER_ANGLE_2"]
|
||||
ret.steeringTorque = cp.vl["STEERING_TORQUE"]["MAIN_TORQUE"]
|
||||
ret.steeringTorqueEps = cp.vl["STEER_MODULE_2"]["DRIVER_EPS_TORQUE"]
|
||||
ret.steeringPressed = self.update_steering_pressed(abs(ret.steeringTorqueEps) > CCP.STEER_DRIVER_OVERRIDE, 5)
|
||||
ret.steeringDisengage = abs(ret.steeringTorqueEps) > CCP.STEER_DRIVER_DISENGAGE
|
||||
|
||||
# LKAS_STATE follows the BYD TJA_STATE_* enum: 0=Off, 1=Passive, 2/3=Active, 4=Fault.
|
||||
# LKS_PREPARED on the EPS is also 1 at route start before any engagement, so it can't be
|
||||
# used directly as a fault flag - the camera-side fault state is the reliable indicator.
|
||||
ret.steerFaultTemporary = int(cp_cam.vl["LKAS_HUD_ADAS"]["LKAS_STATE"]) == 4
|
||||
|
||||
# gas / brake
|
||||
ret.gasPressed = cp.vl["DRIVE_STATE"]["RAW_THROTTLE"] > 0
|
||||
ret.brakePressed = bool(cp.vl["DRIVE_STATE"]["BRAKE_PRESSED"])
|
||||
|
||||
# gear
|
||||
ret.gearShifter = GEAR_MAP.get(int(cp.vl["DRIVE_STATE"]["GEAR"]), GearShifter.unknown)
|
||||
|
||||
# blinkers
|
||||
ret.leftBlinker = bool(cp.vl["STALKS"]["LEFT_BLINKER"])
|
||||
ret.rightBlinker = bool(cp.vl["STALKS"]["RIGHT_BLINKER"])
|
||||
|
||||
# blind spot monitor
|
||||
ret.leftBlindspot = cp.vl["BSD_RADAR"]["LEFT_APPROACH"] != 0
|
||||
ret.rightBlindspot = cp.vl["BSD_RADAR"]["RIGHT_APPROACH"] != 0
|
||||
|
||||
# doors / belt
|
||||
ret.doorOpen = any((
|
||||
cp.vl["METER_CLUSTER"]["FRONT_LEFT_DOOR"],
|
||||
cp.vl["METER_CLUSTER"]["FRONT_RIGHT_DOOR"],
|
||||
cp.vl["METER_CLUSTER"]["BACK_LEFT_DOOR"],
|
||||
cp.vl["METER_CLUSTER"]["BACK_RIGHT_DOOR"],
|
||||
))
|
||||
ret.seatbeltUnlatched = not bool(cp.vl["METER_CLUSTER"]["SEATBELT_DRIVER"])
|
||||
|
||||
# cruise state: ACC messages come from camera bus on Atto 3
|
||||
# ACC_STATE: 0=OFF, 2=ACC_ON (available), 3=ACC_ACTIVE (enabled), 5=FORCE_ACCEL, 7=ERROR
|
||||
ret.cruiseState.speed = cp_cam.vl["ACC_HUD_ADAS"]["SET_SPEED"] * CV.KPH_TO_MS
|
||||
acc_state = int(cp_cam.vl["ACC_HUD_ADAS"]["ACC_STATE"])
|
||||
ret.cruiseState.available = acc_state in (2, 3, 5)
|
||||
ret.cruiseState.enabled = acc_state in (3, 5)
|
||||
ret.cruiseState.standstill = bool(cp_cam.vl["ACC_CMD"]["STANDSTILL_STATE"])
|
||||
|
||||
# forward stock LKAS HUD
|
||||
self.lkas_hud = copy.copy(cp_cam.vl["LKAS_HUD_ADAS"])
|
||||
|
||||
ret_sp = structs.CarStateSP()
|
||||
return ret, ret_sp
|
||||
|
||||
@staticmethod
|
||||
def get_can_parsers(CP, CP_SP=None):
|
||||
return {
|
||||
Bus.pt: CANParser(DBC[CP.carFingerprint][Bus.pt], [], 0),
|
||||
Bus.cam: CANParser(DBC[CP.carFingerprint][Bus.pt], [], 2),
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
FW_VERSIONS = {}
|
||||
@@ -1,26 +0,0 @@
|
||||
from opendbc.car import get_safety_config, structs
|
||||
from opendbc.car.interfaces import CarInterfaceBase
|
||||
from opendbc.car.byd.carcontroller import CarController
|
||||
from opendbc.car.byd.carstate import CarState
|
||||
|
||||
|
||||
class CarInterface(CarInterfaceBase):
|
||||
CarState = CarState
|
||||
CarController = CarController
|
||||
|
||||
@staticmethod
|
||||
def _get_params(ret: structs.CarParams, candidate, fingerprint, car_fw, alpha_long, is_release, docs) -> structs.CarParams:
|
||||
ret.brand = "byd"
|
||||
|
||||
ret.safetyConfigs = [get_safety_config(structs.CarParams.SafetyModel.byd)]
|
||||
|
||||
ret.dashcamOnly = True
|
||||
|
||||
ret.steerControlType = structs.CarParams.SteerControlType.angle
|
||||
ret.steerActuatorDelay = 0.2
|
||||
ret.steerLimitTimer = 0.4
|
||||
|
||||
ret.radarUnavailable = True
|
||||
ret.alphaLongitudinalAvailable = False
|
||||
|
||||
return ret
|
||||
@@ -1,60 +0,0 @@
|
||||
from dataclasses import dataclass, field
|
||||
|
||||
from opendbc.car import ACCELERATION_DUE_TO_GRAVITY, Bus, CarSpecs, DbcDict, PlatformConfig, Platforms
|
||||
from opendbc.car.lateral import AngleSteeringLimitsVM, ISO_LATERAL_ACCEL
|
||||
from opendbc.car.docs_definitions import CarDocs, CarHarness, CarParts
|
||||
from opendbc.car.fw_query_definitions import FwQueryConfig
|
||||
|
||||
|
||||
# Add extra tolerance for average banked road since safety doesn't have the roll
|
||||
AVERAGE_ROAD_ROLL = 0.06 # ~3.4 degrees, 6% superelevation. higher actual roll lowers lateral acceleration
|
||||
|
||||
|
||||
class CarControllerParams:
|
||||
STEER_STEP = 2 # Angle command is sent at 50 Hz
|
||||
|
||||
# On a fault STEERING_TORQUE.LKS_PREPARED goes from 0 to 1.
|
||||
# STEERING_TORQUE.MAIN_TORQUE is saturated at -300 for around 900ms,
|
||||
# while the wheel sits 15-26 deg past the commanded TARGET_ANGLE.
|
||||
ANGLE_LIMITS: AngleSteeringLimitsVM = AngleSteeringLimitsVM(
|
||||
390, # deg
|
||||
# Vehicle model angle limits
|
||||
# Add extra tolerance for average banked road since safety doesn't have the roll
|
||||
MAX_LATERAL_ACCEL=ISO_LATERAL_ACCEL + (ACCELERATION_DUE_TO_GRAVITY * AVERAGE_ROAD_ROLL), # ~3.6 m/s^2
|
||||
MAX_LATERAL_JERK=3.0 + (ACCELERATION_DUE_TO_GRAVITY * AVERAGE_ROAD_ROLL), # ~3.6 m/s^3
|
||||
|
||||
# limit angle rate to both prevent a fault and for low speed comfort
|
||||
MAX_ANGLE_RATE=5, # deg/20ms frame
|
||||
)
|
||||
|
||||
STEER_DRIVER_OVERRIDE = 10 # EPS torque threshold for soft override
|
||||
STEER_DRIVER_DISENGAGE = 30 # EPS torque threshold for hard disengage
|
||||
|
||||
|
||||
@dataclass
|
||||
class BydCarDocs(CarDocs):
|
||||
package: str = "All"
|
||||
car_parts: CarParts = field(default_factory=CarParts.common([CarHarness.custom]))
|
||||
|
||||
|
||||
@dataclass
|
||||
class BydPlatformConfig(PlatformConfig):
|
||||
dbc_dict: DbcDict = field(default_factory=lambda: {
|
||||
Bus.pt: 'byd_atto3',
|
||||
})
|
||||
|
||||
|
||||
class CAR(Platforms):
|
||||
BYD_ATTO_3 = BydPlatformConfig(
|
||||
[BydCarDocs("BYD Atto 3 2022-25")],
|
||||
CarSpecs(wheelbase=2.72, steerRatio=14.8),
|
||||
)
|
||||
|
||||
|
||||
FW_QUERY_CONFIG = FwQueryConfig(
|
||||
requests=[],
|
||||
fw_version_regex=b"",
|
||||
)
|
||||
|
||||
|
||||
DBC = CAR.create_dbc_map()
|
||||
@@ -469,6 +469,7 @@ struct CarParams {
|
||||
notCar @66 :Bool; # flag for non-car robotics platforms
|
||||
|
||||
pcmCruise @3 :Bool; # is openpilot's state tied to the PCM's cruise state?
|
||||
enableBsm @56 :Bool; # blind spot monitoring
|
||||
flags @64 :UInt32; # flags for car specific quirks
|
||||
alphaLongitudinalAvailable @71 :Bool;
|
||||
|
||||
@@ -483,17 +484,20 @@ struct CarParams {
|
||||
autoResumeSng @69 :Bool; # describes whether car can resume from a stop automatically
|
||||
|
||||
# things about the car in the manual
|
||||
mass @17 :Float32; # [kg] curb weight: all fluids no cargo
|
||||
wheelbase @18 :Float32; # [m] distance from rear axle to front axle
|
||||
centerToFront @19 :Float32; # [m] distance from center of mass to front axle
|
||||
steerRatio @20 :Float32; # [] ratio of steering wheel angle to front wheel angle
|
||||
steerRatioRear @21 :Float32; # [] ratio of steering wheel angle to rear wheel angle (usually 0)
|
||||
|
||||
# mass-normalized vehicle dynamics parameters
|
||||
rotationalInertiaPerMass @22 :Float32; # [m^2] rotational inertia per unit mass
|
||||
# things we can derive
|
||||
rotationalInertia @22 :Float32; # [kg*m2] body rotational inertia
|
||||
tireStiffnessFactor @72 :Float32; # scaling factor used in calculating tireStiffness[Front,Rear]
|
||||
tireStiffnessFrontPerMass @23 :Float32; # [N/(rad*kg)] front tire stiffness per unit mass
|
||||
tireStiffnessRearPerMass @24 :Float32; # [N/(rad*kg)] rear tire stiffness per unit mass
|
||||
tireStiffnessFront @23 :Float32; # [N/rad] front tire coeff of stiff
|
||||
tireStiffnessRear @24 :Float32; # [N/rad] rear tire coeff of stiff
|
||||
|
||||
longitudinalTuning @25 :LongitudinalPIDTuning;
|
||||
lateralParams @48 :LateralParams;
|
||||
lateralTuning :union {
|
||||
pid @26 :LateralPIDTuning;
|
||||
indiDEPRECATED @27 :LateralINDITuningDEPRECATED;
|
||||
@@ -722,9 +726,6 @@ struct CarParams {
|
||||
}
|
||||
|
||||
deprecated :group {
|
||||
mass @17 :Float32;
|
||||
steerRatioRear @21 :Float32;
|
||||
lateralParams @48 :LateralParams;
|
||||
enableGasInterceptor @2 :Bool;
|
||||
enableCamera @4 :Bool;
|
||||
enableApgs @6 :Bool;
|
||||
@@ -750,7 +751,6 @@ struct CarParams {
|
||||
stoppingControl @31 :Bool; # Does the car allow full control even at lows speeds when stopping
|
||||
radarTimeStep @45: Float32 = 0.05; # time delta between radar updates, 20Hz is very standard
|
||||
enableDsu @5 :Bool; # driving support unit
|
||||
enableBsm @56 :Bool; # blind spot monitoring
|
||||
vEgoStarting @59 :Float32; # Speed at which the car goes into starting state
|
||||
startAccel @32 :Float32; # Required acceleration to get car moving
|
||||
startingState @70 :Bool; # Does this car make use of special starting state
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from opendbc.can import CANDefine, CANParser
|
||||
from opendbc.car import Bus, create_button_events, structs
|
||||
from opendbc.car.chrysler.values import CUSW_CARS, DBC, STEER_THRESHOLD, RAM_CARS, ChryslerFlags
|
||||
from opendbc.car.chrysler.values import CUSW_CARS, DBC, STEER_THRESHOLD, RAM_CARS
|
||||
from opendbc.car.common.conversions import Conversions as CV
|
||||
from opendbc.car.interfaces import CarStateBase
|
||||
|
||||
@@ -96,7 +96,7 @@ class CarState(CarStateBase, MadsCarState, CarStateExt):
|
||||
ret.steerFaultPermanent = cp.vl["EPS_2"]["LKAS_STATE"] == 4
|
||||
|
||||
# blindspot sensors
|
||||
if self.CP.flags & ChryslerFlags.HAS_BSM:
|
||||
if self.CP.enableBsm:
|
||||
ret.leftBlindspot = cp.vl["BSM_1"]["LEFT_STATUS"] == 1
|
||||
ret.rightBlindspot = cp.vl["BSM_1"]["RIGHT_STATUS"] == 1
|
||||
|
||||
@@ -154,7 +154,7 @@ class CarState(CarStateBase, MadsCarState, CarStateExt):
|
||||
ret.steeringPressed = abs(ret.steeringTorque) > STEER_THRESHOLD
|
||||
ret.steerFaultPermanent = bool(cp.vl["EPS_STATUS"]["LKAS_FAULT"])
|
||||
|
||||
if self.CP.flags & ChryslerFlags.HAS_BSM:
|
||||
if self.CP.enableBsm:
|
||||
ret.leftBlindspot = bool(cp.vl["BSM_LEFT"]["LEFT_DETECTED"])
|
||||
ret.rightBlindspot = bool(cp.vl["BSM_RIGHT"]["RIGHT_DETECTED"])
|
||||
|
||||
|
||||
@@ -78,12 +78,28 @@ def create_cruise_buttons(packer, frame, bus, cancel=False, resume=False, accel=
|
||||
|
||||
|
||||
def chrysler_checksum(address: int, sig, d: bytearray) -> int:
|
||||
# standard CRC-8 SAE J1850 (poly 0x1D, init 0xFF, final XOR 0xFF)
|
||||
crc = 0xFF
|
||||
for i in range(len(d) - 1):
|
||||
crc ^= d[i]
|
||||
crc = CRC8J1850[crc]
|
||||
return crc ^ 0xFF
|
||||
checksum = 0xFF
|
||||
for j in range(len(d) - 1):
|
||||
curr = d[j]
|
||||
shift = 0x80
|
||||
for _ in range(8):
|
||||
bit_sum = curr & shift
|
||||
temp_chk = checksum & 0x80
|
||||
if bit_sum:
|
||||
bit_sum = 0x1C
|
||||
if temp_chk:
|
||||
bit_sum = 1
|
||||
checksum = (checksum << 1) & 0xFF
|
||||
temp_chk = checksum | 1
|
||||
bit_sum ^= temp_chk
|
||||
else:
|
||||
if temp_chk:
|
||||
bit_sum = 0x1D
|
||||
checksum = (checksum << 1) & 0xFF
|
||||
bit_sum ^= checksum
|
||||
checksum = bit_sum & 0xFF
|
||||
shift >>= 1
|
||||
return (~checksum) & 0xFF
|
||||
|
||||
|
||||
def fca_giorgio_checksum(address: int, sig, d: bytearray) -> int:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
from opendbc.car import get_safety_config, scale_tire_stiffness_per_mass, structs
|
||||
from opendbc.car import get_safety_config, structs
|
||||
from opendbc.car.chrysler.carcontroller import CarController
|
||||
from opendbc.car.chrysler.carstate import CarState
|
||||
from opendbc.car.chrysler.radar_interface import RadarInterface
|
||||
@@ -83,8 +83,7 @@ class CarInterface(CarInterfaceBase):
|
||||
ret.minSteerSpeed = 17.5 # m/s 17 on the way up, 13 on the way down once engaged.
|
||||
|
||||
ret.centerToFront = ret.wheelbase * 0.44
|
||||
if (0x62cc033 if candidate in CUSW_CARS else 0x2d0) in fingerprint[0]:
|
||||
ret.flags |= ChryslerFlags.HAS_BSM.value
|
||||
ret.enableBsm = (0x62cc033 if candidate in CUSW_CARS else 0x2d0) in fingerprint[0]
|
||||
|
||||
return ret
|
||||
|
||||
@@ -101,9 +100,9 @@ class CarInterface(CarInterfaceBase):
|
||||
if candidate == CAR.RAM_HD_5TH_GEN:
|
||||
stock_cp.dashcamOnly = False
|
||||
# https://github.com/commaai/openpilot/issues/25389
|
||||
stock_cp.tireStiffnessFactor = 0.15
|
||||
stock_cp.tireStiffnessFrontPerMass, stock_cp.tireStiffnessRearPerMass = \
|
||||
scale_tire_stiffness_per_mass(stock_cp.wheelbase, stock_cp.centerToFront, stock_cp.tireStiffnessFactor)
|
||||
stock_cp.tireStiffnessFactor = 1.0
|
||||
stock_cp.tireStiffnessFront = 65155.
|
||||
stock_cp.tireStiffnessRear = 80926.
|
||||
stock_cp.wheelbase = 3.79
|
||||
stock_cp.steerRatio = 19.
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@ class ChryslerSafetyFlags(IntFlag):
|
||||
class ChryslerFlags(IntFlag):
|
||||
# Detected flags
|
||||
HIGHER_MIN_STEERING_SPEED = 1
|
||||
HAS_BSM = 2 # blind spot monitoring
|
||||
|
||||
|
||||
@dataclass
|
||||
@@ -43,7 +42,7 @@ class CAR(Platforms):
|
||||
# Chrysler
|
||||
CHRYSLER_PACIFICA_2018_HYBRID = ChryslerPlatformConfig(
|
||||
[ChryslerCarDocs("Chrysler Pacifica Hybrid 2017-18")],
|
||||
ChryslerCarSpecs(wheelbase=3.089, steerRatio=16.2),
|
||||
ChryslerCarSpecs(mass=2242., wheelbase=3.089, steerRatio=16.2),
|
||||
)
|
||||
CHRYSLER_PACIFICA_2019_HYBRID = ChryslerPlatformConfig(
|
||||
[ChryslerCarDocs("Chrysler Pacifica Hybrid 2019-25")],
|
||||
@@ -70,12 +69,12 @@ class CAR(Platforms):
|
||||
# Jeep
|
||||
JEEP_CHEROKEE_5TH_GEN = ChryslerPlatformConfig(
|
||||
[ChryslerCarDocs("Jeep Cherokee 2019-23")],
|
||||
ChryslerCarSpecs(wheelbase=2.70, steerRatio=17.0, minSteerSpeed=18.5),
|
||||
ChryslerCarSpecs(mass=1747., wheelbase=2.70, steerRatio=17.0, minSteerSpeed=18.5),
|
||||
{Bus.pt: 'chrysler_cusw'},
|
||||
)
|
||||
JEEP_GRAND_CHEROKEE = ChryslerPlatformConfig( # includes 2017 Trailhawk
|
||||
[ChryslerCarDocs("Jeep Grand Cherokee 2016-18", video="https://www.youtube.com/watch?v=eLR9o2JkuRk")],
|
||||
ChryslerCarSpecs(wheelbase=2.71, steerRatio=16.7),
|
||||
ChryslerCarSpecs(mass=1778., wheelbase=2.71, steerRatio=16.7),
|
||||
)
|
||||
|
||||
JEEP_GRAND_CHEROKEE_2019 = ChryslerPlatformConfig( # includes 2020 Trailhawk
|
||||
@@ -86,7 +85,7 @@ class CAR(Platforms):
|
||||
# Ram
|
||||
RAM_1500_5TH_GEN = ChryslerPlatformConfig(
|
||||
[ChryslerCarDocs("Ram 1500 2019-24", car_parts=CarParts.common([CarHarness.ram]))],
|
||||
ChryslerCarSpecs(wheelbase=3.88, steerRatio=16.3, minSteerSpeed=14.5),
|
||||
ChryslerCarSpecs(mass=2493., wheelbase=3.88, steerRatio=16.3, minSteerSpeed=14.5),
|
||||
{Bus.pt: 'chrysler_ram_dt_generated'},
|
||||
)
|
||||
RAM_HD_5TH_GEN = ChryslerPlatformConfig(
|
||||
@@ -94,7 +93,7 @@ class CAR(Platforms):
|
||||
ChryslerCarDocs("Ram 2500 2020-24", car_parts=CarParts.common([CarHarness.ram])),
|
||||
ChryslerCarDocs("Ram 3500 2019-22", car_parts=CarParts.common([CarHarness.ram])),
|
||||
],
|
||||
ChryslerCarSpecs(wheelbase=3.785, steerRatio=15.61, minSteerSpeed=16.),
|
||||
ChryslerCarSpecs(mass=3405., wheelbase=3.785, steerRatio=15.61, minSteerSpeed=16.),
|
||||
{Bus.pt: 'chrysler_ram_hd_generated'},
|
||||
)
|
||||
|
||||
|
||||
@@ -246,8 +246,6 @@ class CarDocs:
|
||||
|
||||
# all the parts needed for the supported car
|
||||
car_parts: CarParts = field(default_factory=CarParts)
|
||||
# Mazda requires comma power
|
||||
requires_comma_power: bool = False
|
||||
|
||||
merged: bool = True
|
||||
support_type: SupportType = SupportType.UPSTREAM
|
||||
@@ -367,7 +365,7 @@ class CarDocs:
|
||||
|
||||
# experimental mode
|
||||
exp_link = "<a href='https://blog.comma.ai/090release/#experimental-mode' target='_blank' class='highlight'>Experimental mode</a>"
|
||||
if CP.openpilotLongitudinalControl and not CP.alphaLongitudinalAvailable and CP.autoResumeSng:
|
||||
if CP.openpilotLongitudinalControl and not CP.alphaLongitudinalAvailable:
|
||||
sentence_builder += f" Traffic light and stop sign handling is also available in {exp_link}."
|
||||
|
||||
return sentence_builder.format(car_model=f"{self.make} {self.model}", alc=alc, acc=acc)
|
||||
|
||||
@@ -37,6 +37,7 @@ class CAR(Platforms):
|
||||
|
||||
EXTRA_HONDA = ExtraPlatformConfig(
|
||||
[
|
||||
CommunityCarDocs("Acura ADX 2025-26"),
|
||||
CommunityCarDocs("Acura Integra 2023-25"),
|
||||
CommunityCarDocs("Acura MDX 2015-16", "Advance Package"),
|
||||
CommunityCarDocs("Acura MDX 2017-20"),
|
||||
@@ -50,7 +51,9 @@ class CAR(Platforms):
|
||||
CommunityCarDocs("Honda Accord 2016-17", "Honda Sensing"),
|
||||
CommunityCarDocs("Honda Accord Hybrid 2017"),
|
||||
CommunityCarDocs("Honda Clarity 2018-21"),
|
||||
CommunityCarDocs("Honda Pilot 2026"),
|
||||
GMSecurityCarDocs("Honda Prologue 2024-26"),
|
||||
CommunityCarDocs("Honda Ridgeline 2026"),
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ class CarState(CarStateBase, MadsCarState):
|
||||
ret.seatbeltUnlatched = cp.vl["RCMStatusMessage2_FD1"]["FirstRowBuckleDriver"] == 2
|
||||
|
||||
# blindspot sensors
|
||||
if self.CP.flags & FordFlags.HAS_BSM:
|
||||
if self.CP.enableBsm:
|
||||
cp_bsm = cp_cam if self.CP.flags & FordFlags.CANFD else cp
|
||||
ret.leftBlindspot = cp_bsm.vl["Side_Detect_L_Stat"]["SodDetctLeft_D_Stat"] != 0
|
||||
ret.rightBlindspot = cp_bsm.vl["Side_Detect_R_Stat"]["SodDetctRight_D_Stat"] != 0
|
||||
|
||||
@@ -18,6 +18,19 @@ class CanBus(CanBusBase):
|
||||
return self.offset + 2
|
||||
|
||||
|
||||
def calculate_lat_ctl2_checksum(mode: int, counter: int, dat: bytearray) -> int:
|
||||
curvature = (dat[2] << 3) | ((dat[3]) >> 5)
|
||||
curvature_rate = (dat[6] << 3) | ((dat[7]) >> 5)
|
||||
path_angle = ((dat[3] & 0x1F) << 6) | ((dat[4]) >> 2)
|
||||
path_offset = ((dat[4] & 0x3) << 8) | dat[5]
|
||||
|
||||
checksum = mode + counter
|
||||
for sig_val in (curvature, curvature_rate, path_angle, path_offset):
|
||||
checksum += sig_val + (sig_val >> 8)
|
||||
|
||||
return 0xFF - (checksum & 0xFF)
|
||||
|
||||
|
||||
def create_lka_msg(packer, CAN: CanBus):
|
||||
"""
|
||||
Creates an empty CAN message for the Ford LKA Command.
|
||||
@@ -92,8 +105,13 @@ def create_lat_ctl2_msg(packer, CAN: CanBus, mode: int, path_offset: float, path
|
||||
"LatCtlCrv_NoRate2_Actl": curvature_rate, # [-0.001024|0.001023] 1/meter^2
|
||||
"HandsOffCnfm_B_Rq": 0, # 0=Inactive, 1=Active [0|1]
|
||||
"LatCtlPath_No_Cnt": counter, # [0|15]
|
||||
"LatCtlPath_No_Cs": 0, # [0|255]
|
||||
}
|
||||
|
||||
# calculate checksum
|
||||
dat = packer.make_can_msg("LateralMotionControl2", 0, values)[1]
|
||||
values["LatCtlPath_No_Cs"] = calculate_lat_ctl2_checksum(mode, counter, dat)
|
||||
|
||||
return packer.make_can_msg("LateralMotionControl2", CAN.main, values)
|
||||
|
||||
|
||||
@@ -320,26 +338,3 @@ def create_button_msg(packer, bus: int, stock_values: dict, cancel=False, resume
|
||||
"TjaButtnOnOffPress": 1 if tja_toggle else 0, # LCA/TJA toggle button
|
||||
})
|
||||
return packer.make_can_msg("Steering_Data_FD1", bus, values)
|
||||
|
||||
|
||||
FORD_CHECKSUM_FIELDS = {
|
||||
0x7d: ("BrkTot_Tq_RqArb", "BrkTotTqRqArb_No_Cnt"),
|
||||
0x91: ("VehRol_W_Actl", "VehYaw_W_Actl", "VehRollYaw_No_Cnt", "VehRolWActl_D_Qf", "VehYawWActl_D_Qf"),
|
||||
0x92: ("VehLat2_A_Actl", "VehLong2_A_Actl", "VehVert2_A_Actl",
|
||||
"VehLatAActl_D_Qf", "VehLongAActl_D_Qf", "VehVertAActl_D_Qf", "VehLatLongVert_No_Cnt"),
|
||||
0x202: ("Veh_V_ActlEng", "VehVActlEng_No_Cnt", "VehVActlEng_D_Qf"),
|
||||
0x214: ("PrplWhlTot_Tq_RqMn", "PrplWhlTqRqMn_No_Cnt"),
|
||||
0x3d6: ("LatCtl_D2_Rq", "LatCtlPath_No_Cnt", "LatCtlCurv_No_Actl", "LatCtlCrv_NoRate2_Actl", "LatCtlPath_An_Actl", "LatCtlPathOffst_L_Actl"),
|
||||
0x414: ("StePinOffst_An_Est", "StePinOffst_No_Cnt", "StePinOffst_D_Stat"),
|
||||
0x415: ("Veh_V_ActlBrk", "VehVActlBrk_No_Cnt", "VehVActlBrk_D_Qf"),
|
||||
0x450: ("DrvEngageLevel_D_Stat", "DrvEngLvlConfid_D_Stat", "DrvEngageLevel_No_Cnt"),
|
||||
0x4b0: ("BrkHold_D_Stat", "BrkTot_Tq_RqDrv", "BrkTotTqRqDrv_No_Cnt"),
|
||||
}
|
||||
|
||||
|
||||
def ford_checksum(address: int, sig, d: bytearray) -> int:
|
||||
checksum = 0
|
||||
for field in sig.checksum_fields:
|
||||
value = field.get_raw_value(d)
|
||||
checksum += value + (value >> 8)
|
||||
return ~checksum & 0xFF
|
||||
|
||||
@@ -90,8 +90,7 @@ class CarInterface(CarInterfaceBase):
|
||||
|
||||
# BSM: Side_Detect_L_Stat, Side_Detect_R_Stat
|
||||
# TODO: detect bsm in car_fw?
|
||||
if 0x3A6 in fingerprint[CAN.main] and 0x3A7 in fingerprint[CAN.main]:
|
||||
ret.flags |= FordFlags.HAS_BSM.value
|
||||
ret.enableBsm = 0x3A6 in fingerprint[CAN.main] and 0x3A7 in fingerprint[CAN.main]
|
||||
|
||||
# LCA can steer down to zero
|
||||
ret.minSteerSpeed = 0.
|
||||
|
||||
@@ -45,9 +45,6 @@ class FordSafetyFlags(IntFlag):
|
||||
|
||||
|
||||
class FordFlags(IntFlag):
|
||||
# Detected flags
|
||||
HAS_BSM = 2 # blind spot monitoring
|
||||
|
||||
# Static flags
|
||||
CANFD = 1
|
||||
|
||||
@@ -122,14 +119,14 @@ class FordF150LightningPlatform(FordCANFDPlatformConfig):
|
||||
class CAR(Platforms):
|
||||
FORD_BRONCO_SPORT_MK1 = FordPlatformConfig(
|
||||
[FordCarDocs("Ford Bronco Sport 2021-24")],
|
||||
CarSpecs(wheelbase=2.67, steerRatio=17.7),
|
||||
CarSpecs(mass=1625, wheelbase=2.67, steerRatio=17.7),
|
||||
)
|
||||
FORD_ESCAPE_MK4 = FordPlatformConfig(
|
||||
[
|
||||
FordCarDocs("Ford Escape 2020-22", hybrid=True, plug_in_hybrid=True),
|
||||
FordCarDocs("Ford Kuga 2020-23", "Adaptive Cruise Control with Lane Centering", hybrid=True, plug_in_hybrid=True),
|
||||
],
|
||||
CarSpecs(wheelbase=2.71, steerRatio=16.7),
|
||||
CarSpecs(mass=1750, wheelbase=2.71, steerRatio=16.7),
|
||||
)
|
||||
FORD_ESCAPE_MK4_5 = FordCANFDPlatformConfig(
|
||||
[
|
||||
@@ -137,45 +134,45 @@ class CAR(Platforms):
|
||||
FordCarDocs("Ford Kuga Hybrid 2024", "All"),
|
||||
FordCarDocs("Ford Kuga Plug-in Hybrid 2024", "All"),
|
||||
],
|
||||
CarSpecs(wheelbase=2.71, steerRatio=16.7),
|
||||
CarSpecs(mass=1750, wheelbase=2.71, steerRatio=16.7),
|
||||
)
|
||||
FORD_EXPLORER_MK6 = FordPlatformConfig(
|
||||
[
|
||||
FordCarDocs("Ford Explorer 2020-24", hybrid=True), # Hybrid: Limited and Platinum only
|
||||
FordCarDocs("Lincoln Aviator 2020-24", "Co-Pilot360 Plus", plug_in_hybrid=True), # Hybrid: Grand Touring only
|
||||
],
|
||||
CarSpecs(wheelbase=3.025, steerRatio=16.8),
|
||||
CarSpecs(mass=2050, wheelbase=3.025, steerRatio=16.8),
|
||||
)
|
||||
FORD_EXPEDITION_MK4 = FordCANFDPlatformConfig(
|
||||
[FordCarDocs("Ford Expedition 2022-24", "Co-Pilot360 Assist 2.0", hybrid=False)],
|
||||
CarSpecs(wheelbase=3.69, steerRatio=17.0),
|
||||
CarSpecs(mass=2000, wheelbase=3.69, steerRatio=17.0),
|
||||
)
|
||||
FORD_F_150_MK14 = FordCANFDPlatformConfig(
|
||||
[FordCarDocs("Ford F-150 2021-23", "Co-Pilot360 Assist 2.0", hybrid=True)],
|
||||
CarSpecs(wheelbase=3.69, steerRatio=17.0),
|
||||
CarSpecs(mass=2000, wheelbase=3.69, steerRatio=17.0),
|
||||
)
|
||||
FORD_F_150_LIGHTNING_MK1 = FordF150LightningPlatform(
|
||||
[FordCarDocs("Ford F-150 Lightning 2022-23", "Co-Pilot360 Assist 2.0")],
|
||||
CarSpecs(wheelbase=3.70, steerRatio=16.9),
|
||||
CarSpecs(mass=2948, wheelbase=3.70, steerRatio=16.9),
|
||||
)
|
||||
FORD_FOCUS_MK4 = FordPlatformConfig(
|
||||
[FordCarDocs("Ford Focus 2018-22", "Adaptive Cruise Control with Lane Centering", footnotes=[Footnote.FOCUS], hybrid=True)], # mHEV only
|
||||
CarSpecs(wheelbase=2.7, steerRatio=15.0),
|
||||
CarSpecs(mass=1350, wheelbase=2.7, steerRatio=15.0),
|
||||
)
|
||||
FORD_MAVERICK_MK1 = FordPlatformConfig(
|
||||
[
|
||||
FordCarDocs("Ford Maverick 2022", "LARIAT Luxury", hybrid=True),
|
||||
FordCarDocs("Ford Maverick 2023-24", "Co-Pilot360 Assist", hybrid=True),
|
||||
],
|
||||
CarSpecs(wheelbase=3.076, steerRatio=17.0),
|
||||
CarSpecs(mass=1650, wheelbase=3.076, steerRatio=17.0),
|
||||
)
|
||||
FORD_MUSTANG_MACH_E_MK1 = FordCANFDPlatformConfig(
|
||||
[FordCarDocs("Ford Mustang Mach-E 2021-24", "All", setup_video="https://www.youtube.com/watch?v=AR4_eTF3b_A")],
|
||||
CarSpecs(wheelbase=2.984, steerRatio=17.0), # TODO: check steer ratio
|
||||
CarSpecs(mass=2200, wheelbase=2.984, steerRatio=17.0), # TODO: check steer ratio
|
||||
)
|
||||
FORD_RANGER_MK2 = FordCANFDPlatformConfig(
|
||||
[FordCarDocs("Ford Ranger 2024", "Adaptive Cruise Control with Lane Centering", setup_video="https://www.youtube.com/watch?v=2oJlXCKYOy0")],
|
||||
CarSpecs(wheelbase=3.27, steerRatio=17.0),
|
||||
CarSpecs(mass=2000, wheelbase=3.27, steerRatio=17.0),
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ from opendbc.can import CANDefine, CANParser
|
||||
from opendbc.car import Bus, create_button_events, structs
|
||||
from opendbc.car.common.conversions import Conversions as CV
|
||||
from opendbc.car.interfaces import CarStateBase
|
||||
from opendbc.car.gm.values import DBC, AccState, CruiseButtons, STEER_THRESHOLD, SDGM_CAR, ALT_ACCS, GMFlags
|
||||
from opendbc.car.gm.values import DBC, AccState, CruiseButtons, STEER_THRESHOLD, SDGM_CAR, ALT_ACCS
|
||||
|
||||
from opendbc.sunnypilot.car.gm.carstate_ext import CarStateExt
|
||||
from opendbc.sunnypilot.car.gm.values_ext import GMFlagsSP
|
||||
@@ -146,7 +146,7 @@ class CarState(CarStateBase, CarStateExt):
|
||||
if self.CP.carFingerprint not in SDGM_CAR:
|
||||
ret.stockAeb = cam_cp.vl["AEBCmd"]["AEBCmdActive"] != 0
|
||||
|
||||
if self.CP.flags & GMFlags.HAS_BSM:
|
||||
if self.CP.enableBsm:
|
||||
ret.leftBlindspot = pt_cp.vl["BCMBlindSpotMonitor"]["LeftBSM"] == 1
|
||||
ret.rightBlindspot = pt_cp.vl["BCMBlindSpotMonitor"]["RightBSM"] == 1
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ from opendbc.car.common.conversions import Conversions as CV
|
||||
from opendbc.car.gm.carcontroller import CarController
|
||||
from opendbc.car.gm.carstate import CarState
|
||||
from opendbc.car.gm.radar_interface import RadarInterface, RADAR_HEADER_MSG, CAMERA_DATA_HEADER_MSG
|
||||
from opendbc.car.gm.values import CAR, CarControllerParams, EV_CAR, CAMERA_ACC_CAR, SDGM_CAR, ALT_ACCS, CanBus, GMFlags, GMSafetyFlags
|
||||
from opendbc.car.gm.values import CAR, CarControllerParams, EV_CAR, CAMERA_ACC_CAR, SDGM_CAR, ALT_ACCS, CanBus, GMSafetyFlags
|
||||
from opendbc.car.interfaces import CarInterfaceBase, TorqueFromLateralAccelCallbackType, LateralAccelFromTorqueCallbackType
|
||||
|
||||
from opendbc.sunnypilot.car.gm.interface_ext import CarInterfaceExt
|
||||
@@ -103,8 +103,7 @@ class CarInterface(CarInterfaceBase, CarInterfaceExt):
|
||||
ret.brand = "gm"
|
||||
ret.safetyConfigs = [get_safety_config(structs.CarParams.SafetyModel.gm)]
|
||||
ret.autoResumeSng = False
|
||||
if 0x142 in fingerprint[CanBus.POWERTRAIN]:
|
||||
ret.flags |= GMFlags.HAS_BSM.value
|
||||
ret.enableBsm = 0x142 in fingerprint[CanBus.POWERTRAIN]
|
||||
|
||||
if candidate in EV_CAR:
|
||||
ret.transmissionType = TransmissionType.direct
|
||||
|
||||
@@ -67,11 +67,6 @@ class GMSafetyFlags(IntFlag):
|
||||
EV = 4
|
||||
|
||||
|
||||
class GMFlags(IntFlag):
|
||||
# Detected flags
|
||||
HAS_BSM = 1 # blind spot monitoring
|
||||
|
||||
|
||||
class Footnote(Enum):
|
||||
SETUP = CarFootnote(
|
||||
"See more setup details for <a href=\"https://github.com/commaai/openpilot/wiki/gm\" target=\"_blank\">GM</a>.",
|
||||
@@ -137,39 +132,39 @@ class GMNonSccPlatformConfig(GMPlatformConfig):
|
||||
class CAR(Platforms):
|
||||
HOLDEN_ASTRA = GMASCMPlatformConfig(
|
||||
[GMCarDocs("Holden Astra 2017")],
|
||||
GMCarSpecs(wheelbase=2.662, steerRatio=15.7, centerToFrontRatio=0.4),
|
||||
GMCarSpecs(mass=1363, wheelbase=2.662, steerRatio=15.7, centerToFrontRatio=0.4),
|
||||
)
|
||||
CHEVROLET_VOLT = GMASCMPlatformConfig(
|
||||
[GMCarDocs("Chevrolet Volt 2017-18", min_enable_speed=0, video="https://youtu.be/QeMCN_4TFfQ")],
|
||||
GMCarSpecs(wheelbase=2.69, steerRatio=17.7, centerToFrontRatio=0.45, tireStiffnessFactor=0.469),
|
||||
GMCarSpecs(mass=1607, wheelbase=2.69, steerRatio=17.7, centerToFrontRatio=0.45, tireStiffnessFactor=0.469),
|
||||
)
|
||||
CADILLAC_ATS = GMASCMPlatformConfig(
|
||||
[GMCarDocs("Cadillac ATS Premium Performance 2018")],
|
||||
GMCarSpecs(wheelbase=2.78, steerRatio=15.3),
|
||||
GMCarSpecs(mass=1601, wheelbase=2.78, steerRatio=15.3),
|
||||
)
|
||||
CHEVROLET_MALIBU = GMASCMPlatformConfig(
|
||||
[GMCarDocs("Chevrolet Malibu Premier 2017")],
|
||||
GMCarSpecs(wheelbase=2.83, steerRatio=15.8, centerToFrontRatio=0.4),
|
||||
GMCarSpecs(mass=1496, wheelbase=2.83, steerRatio=15.8, centerToFrontRatio=0.4),
|
||||
)
|
||||
GMC_ACADIA = GMASCMPlatformConfig(
|
||||
[GMCarDocs("GMC Acadia 2018", video="https://www.youtube.com/watch?v=0ZN6DdsBUZo")],
|
||||
GMCarSpecs(wheelbase=2.86, steerRatio=14.4, centerToFrontRatio=0.4),
|
||||
GMCarSpecs(mass=1975, wheelbase=2.86, steerRatio=14.4, centerToFrontRatio=0.4),
|
||||
)
|
||||
BUICK_LACROSSE = GMASCMPlatformConfig(
|
||||
[GMCarDocs("Buick LaCrosse 2017-19", "Driver Confidence Package 2")],
|
||||
GMCarSpecs(wheelbase=2.91, steerRatio=15.8, centerToFrontRatio=0.4),
|
||||
GMCarSpecs(mass=1712, wheelbase=2.91, steerRatio=15.8, centerToFrontRatio=0.4),
|
||||
)
|
||||
BUICK_REGAL = GMASCMPlatformConfig(
|
||||
[GMCarDocs("Buick Regal Essence 2018")],
|
||||
GMCarSpecs(wheelbase=2.83, steerRatio=14.4, centerToFrontRatio=0.4),
|
||||
GMCarSpecs(mass=1714, wheelbase=2.83, steerRatio=14.4, centerToFrontRatio=0.4),
|
||||
)
|
||||
CADILLAC_ESCALADE = GMASCMPlatformConfig(
|
||||
[GMCarDocs("Cadillac Escalade 2017", "Driver Assist Package")],
|
||||
GMCarSpecs(wheelbase=2.95, steerRatio=17.3),
|
||||
GMCarSpecs(mass=2564, wheelbase=2.95, steerRatio=17.3),
|
||||
)
|
||||
CADILLAC_ESCALADE_ESV = GMASCMPlatformConfig(
|
||||
[GMCarDocs("Cadillac Escalade ESV 2016", "Adaptive Cruise Control (ACC) & LKAS")],
|
||||
GMCarSpecs(wheelbase=3.302, steerRatio=17.3, tireStiffnessFactor=1.0),
|
||||
GMCarSpecs(mass=2739, wheelbase=3.302, steerRatio=17.3, tireStiffnessFactor=1.0),
|
||||
)
|
||||
CADILLAC_ESCALADE_ESV_2019 = GMASCMPlatformConfig(
|
||||
[GMCarDocs("Cadillac Escalade ESV 2019", "Adaptive Cruise Control (ACC) & LKAS")],
|
||||
@@ -180,38 +175,38 @@ class CAR(Platforms):
|
||||
GMCarDocs("Chevrolet Bolt EUV 2022-23", "Premier or Premier Redline Trim, without Super Cruise Package", video="https://youtu.be/xvwzGMUA210"),
|
||||
GMCarDocs("Chevrolet Bolt EV 2022-23", "2LT Trim with Adaptive Cruise Control Package"),
|
||||
],
|
||||
GMCarSpecs(wheelbase=2.63779, steerRatio=16.8, centerToFrontRatio=0.4, tireStiffnessFactor=1.0),
|
||||
GMCarSpecs(mass=1669, wheelbase=2.63779, steerRatio=16.8, centerToFrontRatio=0.4, tireStiffnessFactor=1.0),
|
||||
)
|
||||
CHEVROLET_SILVERADO = GMPlatformConfig(
|
||||
[
|
||||
GMCarDocs("Chevrolet Silverado 1500 2020-21", "Safety Package II"),
|
||||
GMCarDocs("GMC Sierra 1500 2020-21", "Driver Alert Package II", video="https://youtu.be/5HbNoBLzRwE"),
|
||||
],
|
||||
GMCarSpecs(wheelbase=3.75, steerRatio=16.3, tireStiffnessFactor=1.0),
|
||||
GMCarSpecs(mass=2450, wheelbase=3.75, steerRatio=16.3, tireStiffnessFactor=1.0),
|
||||
)
|
||||
CHEVROLET_EQUINOX = GMPlatformConfig(
|
||||
[GMCarDocs("Chevrolet Equinox 2019-22")],
|
||||
GMCarSpecs(wheelbase=2.72, steerRatio=14.4, centerToFrontRatio=0.4),
|
||||
GMCarSpecs(mass=1588, wheelbase=2.72, steerRatio=14.4, centerToFrontRatio=0.4),
|
||||
)
|
||||
CHEVROLET_TRAILBLAZER = GMPlatformConfig(
|
||||
[GMCarDocs("Chevrolet Trailblazer 2021-22")],
|
||||
GMCarSpecs(wheelbase=2.64, steerRatio=16.8, centerToFrontRatio=0.4, tireStiffnessFactor=1.0),
|
||||
GMCarSpecs(mass=1345, wheelbase=2.64, steerRatio=16.8, centerToFrontRatio=0.4, tireStiffnessFactor=1.0),
|
||||
)
|
||||
CADILLAC_XT4 = GMSDGMPlatformConfig(
|
||||
[GMCarDocs("Cadillac XT4 2023", "Driver Assist Package")],
|
||||
GMCarSpecs(wheelbase=2.78, steerRatio=14.4, centerToFrontRatio=0.4),
|
||||
GMCarSpecs(mass=1660, wheelbase=2.78, steerRatio=14.4, centerToFrontRatio=0.4),
|
||||
)
|
||||
CHEVROLET_VOLT_2019 = GMSDGMPlatformConfig(
|
||||
[GMCarDocs("Chevrolet Volt 2019", "Adaptive Cruise Control (ACC) & LKAS")],
|
||||
GMCarSpecs(wheelbase=2.69, steerRatio=15.7, centerToFrontRatio=0.45),
|
||||
GMCarSpecs(mass=1607, wheelbase=2.69, steerRatio=15.7, centerToFrontRatio=0.45),
|
||||
)
|
||||
CHEVROLET_TRAVERSE = GMSDGMPlatformConfig(
|
||||
[GMCarDocs("Chevrolet Traverse 2022-23", "RS, Premier, or High Country Trim")],
|
||||
GMCarSpecs(wheelbase=3.07, steerRatio=17.9, centerToFrontRatio=0.4),
|
||||
GMCarSpecs(mass=1955, wheelbase=3.07, steerRatio=17.9, centerToFrontRatio=0.4),
|
||||
)
|
||||
GMC_YUKON = GMPlatformConfig(
|
||||
[GMCarDocs("GMC Yukon 2019-20", "Adaptive Cruise Control (ACC) & LKAS")],
|
||||
GMCarSpecs(wheelbase=2.94, steerRatio=17.3, centerToFrontRatio=0.5, tireStiffnessFactor=1.0),
|
||||
GMCarSpecs(mass=2490, wheelbase=2.94, steerRatio=17.3, centerToFrontRatio=0.5, tireStiffnessFactor=1.0),
|
||||
)
|
||||
|
||||
# port extensions
|
||||
@@ -242,11 +237,11 @@ class CAR(Platforms):
|
||||
)
|
||||
CHEVROLET_SUBURBAN_NON_ACC_11TH_GEN = GMNonSccPlatformConfig(
|
||||
[GMNonAccCarDocs("Chevrolet Suburban Non-ACC 2016-20")],
|
||||
CarSpecs(wheelbase=3.302, steerRatio=17.3, centerToFrontRatio=0.49),
|
||||
CarSpecs(mass=2731, wheelbase=3.302, steerRatio=17.3, centerToFrontRatio=0.49),
|
||||
)
|
||||
CADILLAC_CT6_NON_ACC_1ST_GEN = GMNonSccPlatformConfig(
|
||||
[GMNonAccCarDocs("Cadillac CT6 Non-ACC 2017-18")],
|
||||
CarSpecs(wheelbase=3.11, steerRatio=17.7, centerToFrontRatio=0.4),
|
||||
CarSpecs(mass=2358, wheelbase=3.11, steerRatio=17.7, centerToFrontRatio=0.4),
|
||||
)
|
||||
CHEVROLET_TRAILBLAZER_NON_ACC_2ND_GEN = GMNonSccPlatformConfig(
|
||||
[GMNonAccCarDocs("Chevrolet Trailblazer Non-ACC 2021-22")],
|
||||
@@ -254,11 +249,11 @@ class CAR(Platforms):
|
||||
)
|
||||
CHEVROLET_MALIBU_NON_ACC_9TH_GEN = GMNonSccPlatformConfig(
|
||||
[GMNonAccCarDocs("Chevrolet Malibu Non-ACC 2016-23")],
|
||||
CarSpecs(wheelbase=2.8, steerRatio=15.8, centerToFrontRatio=0.4),
|
||||
CarSpecs(mass=1450, wheelbase=2.8, steerRatio=15.8, centerToFrontRatio=0.4),
|
||||
)
|
||||
CADILLAC_XT5_NON_ACC_1ST_GEN = GMNonSccPlatformConfig(
|
||||
[GMNonAccCarDocs("Cadillac XT5 Non-ACC 2018")],
|
||||
CarSpecs(wheelbase=2.86, steerRatio=16.34, centerToFrontRatio=0.5),
|
||||
CarSpecs(mass=1810, wheelbase=2.86, steerRatio=16.34, centerToFrontRatio=0.5),
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ from opendbc.car.interfaces import CarControllerBase
|
||||
from opendbc.sunnypilot.car.honda.mads import MadsCarController
|
||||
from opendbc.sunnypilot.car.honda.gas_interceptor import GasInterceptorCarController
|
||||
from opendbc.sunnypilot.car.honda.icbm import IntelligentCruiseButtonManagementInterface
|
||||
from opendbc.sunnypilot.car.honda.eps_mod import EpsModCarController
|
||||
|
||||
VisualAlert = structs.CarControl.HUDControl.VisualAlert
|
||||
LongCtrlState = structs.CarControl.Actuators.LongControlState
|
||||
@@ -92,14 +91,12 @@ def process_hud_alert(hud_alert):
|
||||
return alert_fcw, alert_steer_required
|
||||
|
||||
|
||||
class CarController(CarControllerBase, MadsCarController, GasInterceptorCarController, IntelligentCruiseButtonManagementInterface,
|
||||
EpsModCarController):
|
||||
class CarController(CarControllerBase, MadsCarController, GasInterceptorCarController, IntelligentCruiseButtonManagementInterface):
|
||||
def __init__(self, dbc_names, CP, CP_SP):
|
||||
CarControllerBase.__init__(self, dbc_names, CP, CP_SP)
|
||||
MadsCarController.__init__(self)
|
||||
GasInterceptorCarController.__init__(self, CP, CP_SP)
|
||||
IntelligentCruiseButtonManagementInterface.__init__(self, CP, CP_SP)
|
||||
EpsModCarController.__init__(self, CP, CP_SP)
|
||||
self.packer = CANPacker(dbc_names[Bus.pt])
|
||||
self.params = CarControllerParams(CP)
|
||||
self.CAN = hondacan.CanBus(CP)
|
||||
@@ -149,9 +146,8 @@ class CarController(CarControllerBase, MadsCarController, GasInterceptorCarContr
|
||||
# **** process the car messages ****
|
||||
|
||||
# steer torque is converted back to CAN reference (positive when steering right)
|
||||
apply_torque = int(np.clip(-limited_torque, -1.0, 1.0) * self.params.STEER_MAX)
|
||||
if self.eps_mod_lookup is not None:
|
||||
apply_torque = EpsModCarController.get_apply_torque(self, limited_torque)
|
||||
apply_torque = int(np.interp(-limited_torque * self.params.STEER_MAX,
|
||||
self.params.STEER_LOOKUP_BP, self.params.STEER_LOOKUP_V))
|
||||
|
||||
# Send CAN commands
|
||||
can_sends = []
|
||||
|
||||
@@ -56,7 +56,7 @@ class CarState(CarStateBase, CarStateExt):
|
||||
def update(self, can_parsers) -> tuple[structs.CarState, structs.CarStateSP]:
|
||||
cp = can_parsers[Bus.pt]
|
||||
cp_cam = can_parsers[Bus.cam]
|
||||
if self.CP.flags & HondaFlags.HAS_BSM:
|
||||
if self.CP.enableBsm:
|
||||
cp_body = can_parsers[Bus.body]
|
||||
|
||||
ret = structs.CarState()
|
||||
@@ -222,7 +222,7 @@ class CarState(CarStateBase, CarStateExt):
|
||||
if self.CP.flags & HondaFlags.BOSCH_RADARLESS:
|
||||
self.lkas_hud = cp_cam.vl["LKAS_HUD"]
|
||||
|
||||
if self.CP.flags & HondaFlags.HAS_BSM:
|
||||
if self.CP.enableBsm:
|
||||
# BSM messages are on B-CAN, requires a panda forwarding B-CAN messages to CAN 0
|
||||
# more info here: https://github.com/commaai/openpilot/pull/1867
|
||||
ret.leftBlindspot = cp_body.vl["BSM_STATUS_LEFT"]["BSM_ALERT"] == 1
|
||||
@@ -242,7 +242,7 @@ class CarState(CarStateBase, CarStateExt):
|
||||
Bus.pt: CANParser(DBC[CP.carFingerprint][Bus.pt], [], CanBus(CP).pt),
|
||||
Bus.cam: CANParser(DBC[CP.carFingerprint][Bus.pt], [], CanBus(CP).camera),
|
||||
}
|
||||
if CP.flags & HondaFlags.HAS_BSM:
|
||||
if CP.enableBsm:
|
||||
parsers[Bus.body] = CANParser(DBC[CP.carFingerprint][Bus.body], [], CanBus(CP).radar)
|
||||
|
||||
return parsers
|
||||
|
||||
@@ -123,7 +123,6 @@ FW_VERSIONS = {
|
||||
b'36802-TWA-A070\x00\x00',
|
||||
b'36802-TWA-A080\x00\x00',
|
||||
b'36802-TWA-A210\x00\x00',
|
||||
b'36802-TWA-A220\x00\x00',
|
||||
b'36802-TWA-A330\x00\x00',
|
||||
b'36802-TWB-H060\x00\x00',
|
||||
],
|
||||
@@ -405,7 +404,6 @@ FW_VERSIONS = {
|
||||
b'36802-TLA-A050\x00\x00',
|
||||
b'36802-TLA-A060\x00\x00',
|
||||
b'36802-TLA-A070\x00\x00',
|
||||
b'36802-TLA-A080\x00\x00',
|
||||
b'36802-TMC-Q040\x00\x00',
|
||||
b'36802-TMC-Q070\x00\x00',
|
||||
b'36802-TNY-A030\x00\x00',
|
||||
@@ -699,7 +697,6 @@ FW_VERSIONS = {
|
||||
},
|
||||
CAR.HONDA_PILOT: {
|
||||
(Ecu.shiftByWire, 0x18da0bf1, None): [
|
||||
b'54008-T6Z-A610\x00\x00',
|
||||
b'54008-TG7-A520\x00\x00',
|
||||
b'54008-TG7-A530\x00\x00',
|
||||
],
|
||||
@@ -719,7 +716,6 @@ FW_VERSIONS = {
|
||||
b'28101-5EZ-A500\x00\x00',
|
||||
b'28101-5EZ-A600\x00\x00',
|
||||
b'28101-5EZ-A700\x00\x00',
|
||||
b'28101-5EZ-A800\x00\x00',
|
||||
b'28103-5EY-A110\x00\x00',
|
||||
b'28103-5EZ-A010\x00\x00',
|
||||
],
|
||||
@@ -736,7 +732,6 @@ FW_VERSIONS = {
|
||||
b'39990-TG7-A070\x00\x00',
|
||||
b'39990-TGS-A230\x00\x00',
|
||||
b'39990-TGS-A320\x00\x00',
|
||||
b'39990-TGS-A410\x00\x00',
|
||||
],
|
||||
(Ecu.fwdRadar, 0x18dab0f1, None): [
|
||||
b'36161-TG7-A310\x00\x00',
|
||||
@@ -758,7 +753,6 @@ FW_VERSIONS = {
|
||||
b'36161-TGS-A130\x00\x00',
|
||||
b'36161-TGS-A220\x00\x00',
|
||||
b'36161-TGS-A320\x00\x00',
|
||||
b'36161-TGS-A610\x00\x00',
|
||||
b'36161-TGT-A030\x00\x00',
|
||||
b'36161-TGT-A130\x00\x00',
|
||||
],
|
||||
@@ -783,7 +777,6 @@ FW_VERSIONS = {
|
||||
b'57114-TG8-A630\x00\x00',
|
||||
b'57114-TG8-A730\x00\x00',
|
||||
b'57114-TGS-A530\x00\x00',
|
||||
b'57114-TGS-A710\x00\x00',
|
||||
b'57114-TGT-A530\x00\x00',
|
||||
],
|
||||
},
|
||||
@@ -849,12 +842,33 @@ FW_VERSIONS = {
|
||||
},
|
||||
# mid-model refresh
|
||||
CAR.ACURA_RDX_3G_MMR: {
|
||||
(Ecu.vsa, 0x18da28f1, None): [
|
||||
b'57114-TJB-A120\x00\x00',
|
||||
],
|
||||
(Ecu.fwdRadar, 0x18dab0f1, None): [
|
||||
b'36802-TJB-A540\x00\x00',
|
||||
],
|
||||
(Ecu.fwdCamera, 0x18dab5f1, None): [
|
||||
b'36161-TJB-A530\x00\x00',
|
||||
],
|
||||
(Ecu.shiftByWire, 0x18da0bf1, None): [
|
||||
b'54008-TJB-A530\x00\x00',
|
||||
],
|
||||
(Ecu.transmission, 0x18da1ef1, None): [
|
||||
b'28102-5YK-A800\x00\x00',
|
||||
],
|
||||
(Ecu.srs, 0x18da53f1, None): [
|
||||
b'77959-TJB-A120\x00\x00',
|
||||
],
|
||||
(Ecu.electricBrakeBooster, 0x18da2bf1, None): [
|
||||
b'46114-TJB-A120\x00\x00',
|
||||
],
|
||||
(Ecu.gateway, 0x18daeff1, None): [
|
||||
b'38897-TJB-A220\x00\x00',
|
||||
],
|
||||
(Ecu.eps, 0x18da30f1, None): [
|
||||
b'39990-TJB-A070\x00\x00',
|
||||
],
|
||||
},
|
||||
CAR.HONDA_RIDGELINE: {
|
||||
(Ecu.eps, 0x18da30f1, None): [
|
||||
@@ -865,7 +879,6 @@ FW_VERSIONS = {
|
||||
],
|
||||
(Ecu.fwdRadar, 0x18dab0f1, None): [
|
||||
b'36161-T6Z-A020\x00\x00',
|
||||
b'36161-T6Z-A220\x00\x00',
|
||||
b'36161-T6Z-A310\x00\x00',
|
||||
b'36161-T6Z-A420\x00\x00',
|
||||
b'36161-T6Z-A520\x00\x00',
|
||||
@@ -879,7 +892,6 @@ FW_VERSIONS = {
|
||||
],
|
||||
(Ecu.srs, 0x18da53f1, None): [
|
||||
b'77959-T6Z-A020\x00\x00',
|
||||
b'77959-T6Z-A030\x00\x00',
|
||||
],
|
||||
(Ecu.vsa, 0x18da28f1, None): [
|
||||
b'57114-T6Z-A120\x00\x00',
|
||||
@@ -944,7 +956,6 @@ FW_VERSIONS = {
|
||||
(Ecu.gateway, 0x18daeff1, None): [
|
||||
b'38897-3M0-M110\x00\x00',
|
||||
b'38897-3M0-M210\x00\x00',
|
||||
b'38897-3M0-T610\x00\x00',
|
||||
b'38897-3M0-Z010\x00\x00',
|
||||
b'38897-3W1-A010\x00\x00',
|
||||
b'38897-3W1-A620\x00\x00',
|
||||
@@ -961,10 +972,8 @@ FW_VERSIONS = {
|
||||
b'8S102-3M1-T050\x00\x00',
|
||||
b'8S102-3M3-T050\x00\x00',
|
||||
b'8S102-3M6-P030\x00\x00',
|
||||
b'8S102-3M6-PA10\x00\x00',
|
||||
b'8S102-3M6-PA20\x00\x00',
|
||||
b'8S102-3W0-A060\x00\x00',
|
||||
b'8S102-3W0-A230\x00\x00',
|
||||
b'8S102-3W0-AB10\x00\x00',
|
||||
b'8S102-3W0-AB20\x00\x00',
|
||||
b'8S102-3W0-A240\x00\x00',
|
||||
@@ -980,12 +989,10 @@ FW_VERSIONS = {
|
||||
b'28101-6EH-A110\x00\x00',
|
||||
b'28101-6EH-A520\x00\x00',
|
||||
b'28101-6JC-M310\x00\x00',
|
||||
b'28101-6JH-M010\x00\x00',
|
||||
b'28101-6JH-M110\x00\x00',
|
||||
],
|
||||
(Ecu.electricBrakeBooster, 0x18da2bf1, None): [
|
||||
b'39494-3L4-P030\x00\x00',
|
||||
b'39494-T20-A010\x00\x00',
|
||||
b'46114-3W0-A020\x00\x00',
|
||||
b'46114-3W0-A050\x00\x00',
|
||||
b'46114-3W0-A110\x00\x00',
|
||||
@@ -1041,9 +1048,7 @@ FW_VERSIONS = {
|
||||
CAR.HONDA_CIVIC_2022: {
|
||||
(Ecu.eps, 0x18da30f1, None): [
|
||||
b'39990-T24-T120\x00\x00',
|
||||
b'39990-T24-T520\x00\x00',
|
||||
b'39990-T38-A040\x00\x00',
|
||||
b'39990-T38-A140\x00\x00',
|
||||
b'39990-T39-A130\x00\x00',
|
||||
b'39990-T43-J020\x00\x00',
|
||||
b'39990-T43-J030\x00\x00',
|
||||
@@ -1059,15 +1064,12 @@ FW_VERSIONS = {
|
||||
b'38897-T20-A510\x00\x00',
|
||||
b'38897-T21-A010\x00\x00',
|
||||
b'38897-T22-A110\x00\x00',
|
||||
b'38897-T22-A520\x00\x00',
|
||||
b'38897-T24-Z120\x00\x00',
|
||||
b'38897-T47-AA20\x00\x00',
|
||||
b'38897-T50-E310\x00\x00',
|
||||
b'38897-T50-EA10\x00\x00',
|
||||
b'38897-T60-A110\x00\x00',
|
||||
b'38897-T61-A320\x00\x00',
|
||||
b'38897-T61-Z110\x00\x00',
|
||||
b'38897-T64-A220\x00\x00',
|
||||
],
|
||||
(Ecu.srs, 0x18da53f1, None): [
|
||||
b'77959-T20-A970\x00\x00',
|
||||
@@ -1078,11 +1080,8 @@ FW_VERSIONS = {
|
||||
b'77959-T47-A950\x00\x00',
|
||||
b'77959-T50-G010\x00\x00',
|
||||
b'77959-T50-G930\x00\x00',
|
||||
b'77959-T54-Z120\x00\x00',
|
||||
b'77959-T56-A920\x00\x00',
|
||||
b'77959-T60-A920\x00\x00',
|
||||
b'77959-T61-A920\x00\x00',
|
||||
b'77959-T64-A930\x00\x00',
|
||||
b'77959-T65-A920\x00\x00',
|
||||
],
|
||||
(Ecu.fwdRadar, 0x18dab0f1, None): [
|
||||
@@ -1091,15 +1090,11 @@ FW_VERSIONS = {
|
||||
b'36161-T20-A080\x00\x00',
|
||||
b'36161-T24-T070\x00\x00',
|
||||
b'36161-T38-A060\x00\x00',
|
||||
b'8S102-T38-AA10\x00\x00',
|
||||
b'36161-T47-A050\x00\x00',
|
||||
b'36161-T47-A060\x00\x00',
|
||||
b'36161-T47-A070\x00\x00',
|
||||
b'8S102-T20-AA10\x00\x00',
|
||||
b'8S102-T20-AA20\x00\x00',
|
||||
b'8S102-T29-T020\x00\x00',
|
||||
b'8S102-T38-A040\x00\x00',
|
||||
b'8S102-T38-A050\x00\x00',
|
||||
b'8S102-T43-J540\x00\x00',
|
||||
b'8S102-T47-AA10\x00\x00',
|
||||
b'8S102-T47-AA20\x00\x00',
|
||||
@@ -1117,9 +1112,6 @@ FW_VERSIONS = {
|
||||
b'57114-T43-JA30\x00\x00',
|
||||
b'57114-T43-JB30\x00\x00',
|
||||
b'57114-T50-JC20\x00\x00',
|
||||
b'57114-T54-TJ20\x00\x00',
|
||||
b'57114-T56-AG30\x00\x00',
|
||||
b'57114-T56-AH30\x00\x00',
|
||||
b'57114-T60-AA20\x00\x00',
|
||||
b'57114-T61-AJ30\x00\x00',
|
||||
],
|
||||
@@ -1129,7 +1121,6 @@ FW_VERSIONS = {
|
||||
b'28101-65H-A020\x00\x00',
|
||||
b'28101-65H-A120\x00\x00',
|
||||
b'28101-65J-N010\x00\x00',
|
||||
b'28101-6J4-A110\x00\x00',
|
||||
],
|
||||
},
|
||||
CAR.HONDA_PILOT_4G: {
|
||||
@@ -1142,14 +1133,6 @@ FW_VERSIONS = {
|
||||
b'8S302-T90-A040\x00\x00',
|
||||
],
|
||||
},
|
||||
CAR.HONDA_PILOT_4G_MMR: {
|
||||
(Ecu.fwdCamera, 0x18dab5f1, None): [
|
||||
b'8S102-T90-A120\x00\x00',
|
||||
],
|
||||
(Ecu.fwdRadar, 0x18dab0f1, None): [
|
||||
b'8S302-T90-A120\x00\x00',
|
||||
],
|
||||
},
|
||||
CAR.HONDA_ACCORD_11G: {
|
||||
(Ecu.fwdRadar, 0x18dab0f1, None): [
|
||||
b'8S302-30A-A040\x00\x00',
|
||||
@@ -1165,7 +1148,6 @@ FW_VERSIONS = {
|
||||
(Ecu.fwdRadar, 0x18dab0f1, None): [
|
||||
b'8S302-3A0-A060\x00\x00',
|
||||
b'8S302-3A0-A220\x00\x00',
|
||||
b'8S302-3A0-A230\x00\x00',
|
||||
b'8S302-3C0-Q050\x00\x00',
|
||||
b'8S302-3D4-A050\x00\x00',
|
||||
b'8S302-3D4-A060\x00\x00',
|
||||
@@ -1213,35 +1195,13 @@ FW_VERSIONS = {
|
||||
b'8S102-3BM-A020\x00\x00',
|
||||
],
|
||||
},
|
||||
CAR.HONDA_PRELUDE_6G: {
|
||||
(Ecu.eps, 0x18da30f1, None): [
|
||||
b'39990-36W-J020\x00\x00',
|
||||
],
|
||||
(Ecu.gateway, 0x18daeff1, None): [
|
||||
b'38897-36W-G010\x00\x00',
|
||||
],
|
||||
(Ecu.srs, 0x18da53f1, None): [
|
||||
b'77959-36W-G430\x00\x00',
|
||||
],
|
||||
(Ecu.fwdRadar, 0x18dab0f1, None): [
|
||||
b'8S102-36W-J040\x00\x00',
|
||||
],
|
||||
(Ecu.vsa, 0x18da28f1, None): [
|
||||
b'57114-36W-J020\x00\x00',
|
||||
],
|
||||
(Ecu.shiftByWire, 0x18da0bf1, None): [
|
||||
b'54008-36W-A410\x00\x00',
|
||||
],
|
||||
},
|
||||
CAR.ACURA_TLX_2G: {
|
||||
(Ecu.fwdRadar, 0x18dab0f1, None): [
|
||||
b'36802-TGV-A060\x00\x00',
|
||||
b'36802-TGZ-A020\x00\x00',
|
||||
],
|
||||
(Ecu.fwdCamera, 0x18dab5f1, None): [
|
||||
b'36161-TGV-A030\x00\x00',
|
||||
b'36161-TGV-A040\x00\x00',
|
||||
b'36161-TGZ-A020\x00\x00',
|
||||
],
|
||||
},
|
||||
CAR.ACURA_TLX_2G_MMR: {
|
||||
@@ -1252,30 +1212,6 @@ FW_VERSIONS = {
|
||||
b'8S102-TGV-A030\x00\x00',
|
||||
],
|
||||
},
|
||||
CAR.ACURA_ADX: {
|
||||
(Ecu.fwdRadar, 0x18dab0f1, None): [
|
||||
b'8S102-3BH-A020\x00\x00',
|
||||
b'8S102-3BH-A030\x00\x00',
|
||||
],
|
||||
(Ecu.gateway, 0x18daeff1, None): [
|
||||
b'38897-3BH-A320\x00\x00',
|
||||
],
|
||||
(Ecu.transmission, 0x18da1ef1, None): [
|
||||
b'28101-6VM-A020\x00\x00',
|
||||
],
|
||||
(Ecu.vsa, 0x18da28f1, None): [
|
||||
b'57114-3BH-A020\x00\x00',
|
||||
],
|
||||
(Ecu.electricBrakeBooster, 0x18da2bf1, None): [
|
||||
b'46114-3BH-A020\x00\x00',
|
||||
],
|
||||
(Ecu.eps, 0x18da30f1, None): [
|
||||
b'39990-3BH-A020\x00\x00',
|
||||
],
|
||||
(Ecu.srs, 0x18da53f1, None): [
|
||||
b'77959-3BH-A830\x00\x00',
|
||||
],
|
||||
},
|
||||
}
|
||||
|
||||
FW_VERSIONS = merge_fw_versions(FW_VERSIONS, FW_VERSIONS_EXT)
|
||||
|
||||
@@ -61,8 +61,8 @@ class CarInterface(CarInterfaceBase):
|
||||
|
||||
ret.pcmCruise = True
|
||||
|
||||
if candidate == CAR.HONDA_CRV_5G and 0x12f8bfa7 in fingerprint[CAN.radar]:
|
||||
ret.flags |= HondaFlags.HAS_BSM.value
|
||||
if candidate == CAR.HONDA_CRV_5G:
|
||||
ret.enableBsm = 0x12f8bfa7 in fingerprint[CAN.radar]
|
||||
|
||||
# Detect Bosch cars with new HUD msgs
|
||||
if any(0x33DA in f for f in fingerprint.values()):
|
||||
@@ -80,6 +80,7 @@ class CarInterface(CarInterfaceBase):
|
||||
# Traditional autos, direct-drive EVs and eCVTs, gearshift position in GEARBOX_AUTO
|
||||
ret.transmissionType = TransmissionType.automatic
|
||||
|
||||
ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0], [0]]
|
||||
ret.lateralTuning.pid.kiBP, ret.lateralTuning.pid.kpBP = [[0.], [0.]]
|
||||
ret.lateralTuning.pid.kf = 0.00006 # conservative feed-forward
|
||||
ret.steerActuatorDelay = 0.1
|
||||
@@ -99,42 +100,53 @@ class CarInterface(CarInterfaceBase):
|
||||
ret.dashcamOnly = True
|
||||
|
||||
if candidate == CAR.HONDA_CIVIC:
|
||||
ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 2560], [0, 2560]]
|
||||
ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[1.1], [0.33]]
|
||||
|
||||
elif candidate in (CAR.HONDA_CIVIC_BOSCH, CAR.HONDA_CIVIC_BOSCH_DIESEL):
|
||||
ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 4096], [0, 4096]] # TODO: determine if there is a dead zone at the top end
|
||||
ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.8], [0.24]]
|
||||
if candidate == CAR.HONDA_CIVIC_BOSCH:
|
||||
CarControllerParams.BOSCH_GAS_LOOKUP_V = [0, 750]
|
||||
|
||||
elif candidate in (CAR.HONDA_CIVIC_2022, CAR.HONDA_PRELUDE_6G):
|
||||
elif candidate == CAR.HONDA_CIVIC_2022:
|
||||
ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 4096], [0, 4096]] # TODO: determine if there is a dead zone at the top end
|
||||
ret.lateralTuning.pid.kpBP, ret.lateralTuning.pid.kpV = [[0, 10], [0.05, 0.5]]
|
||||
ret.lateralTuning.pid.kiBP, ret.lateralTuning.pid.kiV = [[0, 10], [0.0125, 0.125]]
|
||||
|
||||
elif candidate == CAR.HONDA_ACCORD:
|
||||
ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 4096], [0, 4096]] # TODO: determine if there is a dead zone at the top end
|
||||
ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.6], [0.18]]
|
||||
|
||||
elif candidate == CAR.ACURA_ILX:
|
||||
ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 3840], [0, 3840]] # TODO: determine if there is a dead zone at the top end
|
||||
ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.8], [0.24]]
|
||||
|
||||
elif candidate in (CAR.HONDA_CRV, CAR.HONDA_CRV_EU):
|
||||
ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 1000], [0, 1000]] # TODO: determine if there is a dead zone at the top end
|
||||
ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.8], [0.24]]
|
||||
ret.wheelSpeedFactor = 1.025
|
||||
|
||||
elif candidate == CAR.HONDA_CRV_5G:
|
||||
ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 3840], [0, 3840]]
|
||||
ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.64], [0.192]]
|
||||
ret.wheelSpeedFactor = 1.025
|
||||
|
||||
elif candidate == CAR.HONDA_CRV_HYBRID:
|
||||
ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 4096], [0, 4096]] # TODO: determine if there is a dead zone at the top end
|
||||
ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.6], [0.18]]
|
||||
ret.wheelSpeedFactor = 1.025
|
||||
|
||||
elif candidate == CAR.HONDA_FIT:
|
||||
ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 4096], [0, 4096]] # TODO: determine if there is a dead zone at the top end
|
||||
ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.2], [0.05]]
|
||||
|
||||
elif candidate == CAR.HONDA_FREED:
|
||||
ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 4096], [0, 4096]]
|
||||
ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.2], [0.05]]
|
||||
|
||||
elif candidate in (CAR.HONDA_HRV, CAR.HONDA_HRV_3G):
|
||||
ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 4096], [0, 4096]]
|
||||
if candidate == CAR.HONDA_HRV:
|
||||
ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.16], [0.025]]
|
||||
ret.wheelSpeedFactor = 1.025
|
||||
@@ -142,30 +154,42 @@ class CarInterface(CarInterfaceBase):
|
||||
ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.8], [0.24]] # TODO: can probably use some tuning
|
||||
|
||||
elif candidate == CAR.ACURA_RDX:
|
||||
ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 1000], [0, 1000]] # TODO: determine if there is a dead zone at the top end
|
||||
ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.8], [0.24]]
|
||||
|
||||
elif candidate == CAR.ACURA_RDX_3G:
|
||||
ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 3840], [0, 3840]]
|
||||
ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.2], [0.06]]
|
||||
|
||||
elif candidate == CAR.HONDA_ODYSSEY:
|
||||
ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.28], [0.08]]
|
||||
ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 4096], [0, 4096]] # TODO: determine if there is a dead zone at the top end
|
||||
|
||||
elif candidate == CAR.HONDA_ODYSSEY_TWN:
|
||||
ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.28], [0.08]]
|
||||
ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 32767], [0, 32767]] # TODO: determine if there is a dead zone at the top end
|
||||
|
||||
elif candidate == CAR.HONDA_PILOT:
|
||||
ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 4096], [0, 4096]] # TODO: determine if there is a dead zone at the top end
|
||||
ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.38], [0.11]]
|
||||
|
||||
elif candidate == CAR.HONDA_RIDGELINE:
|
||||
ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 4096], [0, 4096]] # TODO: determine if there is a dead zone at the top end
|
||||
ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.38], [0.11]]
|
||||
|
||||
elif candidate in (CAR.HONDA_INSIGHT, CAR.HONDA_NBOX_2G):
|
||||
ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 4096], [0, 4096]] # TODO: determine if there is a dead zone at the top end
|
||||
ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.6], [0.18]]
|
||||
|
||||
elif candidate in (CAR.HONDA_E, CAR.HONDA_E_ADVANCE):
|
||||
ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 4096], [0, 4096]] # TODO: determine if there is a dead zone at the top end
|
||||
ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.6], [0.18]] # TODO: can probably use some tuning
|
||||
|
||||
elif candidate == CAR.HONDA_ODYSSEY_5G_MMR:
|
||||
# Stock camera sends up to 2560 during LKA operation and up to 3840 during RDM operation
|
||||
# Steer motor torque does rise a little above 2560, but not linearly, RDM also applies one-sided brake drag
|
||||
#ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 2560, 3072], [0, 2560, 3840]]
|
||||
ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 2560], [0, 2560]]
|
||||
CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning)
|
||||
ret.steerActuatorDelay = 0.15
|
||||
CarControllerParams.BOSCH_GAS_LOOKUP_V = [0, 2000]
|
||||
@@ -173,12 +197,18 @@ class CarInterface(CarInterfaceBase):
|
||||
# When using stock ACC, the radar intercepts and filters steering commands the EPS would otherwise accept
|
||||
ret.minSteerSpeed = 70. * CV.KPH_TO_MS
|
||||
|
||||
elif candidate in (CAR.ACURA_TLX_2G_MMR, CAR.ACURA_MDX_4G):
|
||||
ret.steerActuatorDelay = 0.15
|
||||
ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 3840], [0, 3840]]
|
||||
CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning)
|
||||
|
||||
# TODO-SP: remove when https://github.com/commaai/opendbc/pull/2687 is merged
|
||||
elif candidate == CAR.HONDA_CLARITY:
|
||||
pass
|
||||
|
||||
else:
|
||||
ret.steerActuatorDelay = 0.15
|
||||
ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 2560], [0, 2560]]
|
||||
CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning)
|
||||
|
||||
if candidate == CAR.ACURA_RDX_3G_MMR:
|
||||
@@ -186,7 +216,7 @@ class CarInterface(CarInterfaceBase):
|
||||
ret.dashcamOnly = is_release # TODO: release from dashcam when there's enough driving data for torqued/paramsd to converge
|
||||
|
||||
# These cars use alternate user brake msg (0x1BE)
|
||||
if 0x1BE in fingerprint[CAN.pt] and (candidate in (CAR.HONDA_ACCORD, CAR.HONDA_HRV_3G, CAR.ACURA_RDX_3G, CAR.ACURA_MDX_4G, CAR.ACURA_ADX) or
|
||||
if 0x1BE in fingerprint[CAN.pt] and (candidate in (CAR.HONDA_ACCORD, CAR.HONDA_HRV_3G, CAR.ACURA_RDX_3G, CAR.ACURA_MDX_4G) or
|
||||
ret.flags & HondaFlags.BOSCH_CANFD):
|
||||
ret.flags |= HondaFlags.BOSCH_ALT_BRAKE.value
|
||||
|
||||
@@ -236,14 +266,23 @@ class CarInterface(CarInterfaceBase):
|
||||
|
||||
if candidate == CAR.HONDA_CIVIC:
|
||||
if ret.flags & HondaFlagsSP.EPS_MODIFIED:
|
||||
# stock request input values: 0x0000, 0x00DE, 0x014D, 0x01EF, 0x0290, 0x0377, 0x0454, 0x0610, 0x06EE
|
||||
# stock request output values: 0x0000, 0x0917, 0x0DC5, 0x1017, 0x119F, 0x140B, 0x1680, 0x1680, 0x1680
|
||||
# modified request output values: 0x0000, 0x0917, 0x0DC5, 0x1017, 0x119F, 0x140B, 0x1680, 0x2880, 0x3180
|
||||
# stock filter output values: 0x009F, 0x0108, 0x0108, 0x0108, 0x0108, 0x0108, 0x0108, 0x0108, 0x0108
|
||||
# modified filter output values: 0x009F, 0x0108, 0x0108, 0x0108, 0x0108, 0x0108, 0x0108, 0x0400, 0x0480
|
||||
# note: max request allowed is 4096, but request is capped at 3840 in firmware, so modifications result in 2x max
|
||||
stock_cp.lateralParams.torqueBP, stock_cp.lateralParams.torqueV = [[0, 2560, 8000], [0, 2560, 3840]]
|
||||
stock_cp.lateralTuning.pid.kpV, stock_cp.lateralTuning.pid.kiV = [[0.3], [0.1]]
|
||||
|
||||
elif candidate in (CAR.HONDA_CIVIC_BOSCH, CAR.HONDA_CIVIC_BOSCH_DIESEL):
|
||||
if ret.flags & HondaFlagsSP.EPS_MODIFIED:
|
||||
stock_cp.lateralParams.torqueBP, stock_cp.lateralParams.torqueV = [[0, 2564, 8000], [0, 2564, 3840]]
|
||||
stock_cp.lateralTuning.pid.kpV, stock_cp.lateralTuning.pid.kiV = [[0.3], [0.09]] # 2.5x Modded EPS
|
||||
|
||||
elif candidate == CAR.HONDA_CIVIC_2022:
|
||||
if ret.flags & HondaFlagsSP.EPS_MODIFIED:
|
||||
stock_cp.lateralParams.torqueBP, stock_cp.lateralParams.torqueV = [[0, 2564, 8000], [0, 2564, 3840]]
|
||||
stock_cp.lateralTuning.pid.kpV, stock_cp.lateralTuning.pid.kiV = [[0.3], [0.09]] # 2.5x Modded EPS
|
||||
|
||||
elif candidate == CAR.HONDA_ACCORD:
|
||||
@@ -252,6 +291,10 @@ class CarInterface(CarInterfaceBase):
|
||||
|
||||
elif candidate == CAR.HONDA_CRV_5G:
|
||||
if ret.flags & HondaFlagsSP.EPS_MODIFIED:
|
||||
# stock request input values: 0x0000, 0x00DB, 0x01BB, 0x0296, 0x0377, 0x0454, 0x0532, 0x0610, 0x067F
|
||||
# stock request output values: 0x0000, 0x0500, 0x0A15, 0x0E6D, 0x1100, 0x1200, 0x129A, 0x134D, 0x1400
|
||||
# modified request output values: 0x0000, 0x0500, 0x0A15, 0x0E6D, 0x1100, 0x1200, 0x1ACD, 0x239A, 0x2800
|
||||
stock_cp.lateralParams.torqueBP, stock_cp.lateralParams.torqueV = [[0, 2560, 10000], [0, 2560, 3840]]
|
||||
stock_cp.lateralTuning.pid.kpV, stock_cp.lateralTuning.pid.kiV = [[0.21], [0.07]]
|
||||
|
||||
elif candidate == CAR.HONDA_CLARITY:
|
||||
@@ -261,10 +304,13 @@ class CarInterface(CarInterfaceBase):
|
||||
for fw in car_fw:
|
||||
if fw.ecu == "eps" and b"-" not in fw.fwVersion and b"," in fw.fwVersion:
|
||||
stock_cp.lateralTuning.pid.kf = 0.00004
|
||||
stock_cp.lateralParams.torqueBP, stock_cp.lateralParams.torqueV = [[0, 5760, 15360], [0, 2560, 3840]]
|
||||
stock_cp.lateralTuning.pid.kpV, stock_cp.lateralTuning.pid.kiV = [[0.1575], [0.05175]]
|
||||
elif fw.ecu == "eps" and b"-" in fw.fwVersion and b"," in fw.fwVersion:
|
||||
stock_cp.lateralParams.torqueBP, stock_cp.lateralParams.torqueV = [[0, 5760, 10240], [0, 2560, 3840]]
|
||||
stock_cp.lateralTuning.pid.kpV, stock_cp.lateralTuning.pid.kiV = [[0.3], [0.1]]
|
||||
else:
|
||||
stock_cp.lateralParams.torqueBP, stock_cp.lateralParams.torqueV = [[0, 2560], [0, 2560]]
|
||||
stock_cp.lateralTuning.pid.kpV, stock_cp.lateralTuning.pid.kiV = [[0.8], [0.24]]
|
||||
|
||||
if candidate in HONDA_BOSCH:
|
||||
|
||||
@@ -41,24 +41,13 @@ class CarControllerParams:
|
||||
STEER_GLOBAL_MIN_SPEED = 3 * CV.MPH_TO_MS
|
||||
|
||||
def __init__(self, CP):
|
||||
if CP.carFingerprint in (CAR.HONDA_CRV, CAR.HONDA_CRV_EU, CAR.ACURA_RDX):
|
||||
self.STEER_MAX = 1000 # TODO: determine if there is a dead zone at the top end
|
||||
elif CP.carFingerprint in (CAR.ACURA_ILX, CAR.HONDA_CRV_5G, CAR.ACURA_RDX_3G, CAR.ACURA_TLX_2G_MMR, CAR.ACURA_MDX_4G,
|
||||
CAR.ACURA_ADX):
|
||||
self.STEER_MAX = 3840 # TODO: determine if there is a dead zone at the top end (ACURA_ILX)
|
||||
elif CP.carFingerprint in (CAR.HONDA_CIVIC_BOSCH, CAR.HONDA_CIVIC_BOSCH_DIESEL, CAR.HONDA_CIVIC_2022, CAR.HONDA_ACCORD,
|
||||
CAR.HONDA_CRV_HYBRID, CAR.HONDA_FIT, CAR.HONDA_FREED, CAR.HONDA_HRV, CAR.HONDA_HRV_3G,
|
||||
CAR.HONDA_ODYSSEY, CAR.HONDA_PILOT, CAR.HONDA_RIDGELINE, CAR.HONDA_INSIGHT, CAR.HONDA_NBOX_2G,
|
||||
CAR.HONDA_E, CAR.HONDA_E_ADVANCE, CAR.HONDA_PRELUDE_6G):
|
||||
# TODO: determine if there is a dead zone at the top end (except HONDA_FREED, HONDA_HRV, HONDA_HRV_3G)
|
||||
self.STEER_MAX = 4096
|
||||
elif CP.carFingerprint == CAR.HONDA_ODYSSEY_TWN:
|
||||
self.STEER_MAX = 32767 # TODO: determine if there is a dead zone at the top end
|
||||
elif CP.carFingerprint == CAR.HONDA_PILOT_4G_MMR:
|
||||
self.STEER_MAX = 3628
|
||||
else:
|
||||
# Odyssey MMR uses up to 2560 for LKA; higher RDM commands are nonlinear and also apply brake drag.
|
||||
self.STEER_MAX = 2560
|
||||
self.STEER_MAX = CP.lateralParams.torqueBP[-1]
|
||||
# mirror of list (assuming first item is zero) for interp of signed request
|
||||
# values and verify that both arrays begin at zero
|
||||
assert CP.lateralParams.torqueBP[0] == 0
|
||||
assert CP.lateralParams.torqueV[0] == 0
|
||||
self.STEER_LOOKUP_BP = [v * -1 for v in CP.lateralParams.torqueBP][1:][::-1] + list(CP.lateralParams.torqueBP)
|
||||
self.STEER_LOOKUP_V = [v * -1 for v in CP.lateralParams.torqueV][1:][::-1] + list(CP.lateralParams.torqueV)
|
||||
|
||||
|
||||
class HondaSafetyFlags(IntFlag):
|
||||
@@ -87,7 +76,7 @@ class HondaFlags(IntFlag):
|
||||
|
||||
HAS_ALL_DOOR_STATES = 256 # Some Hondas have all door states, others only driver door
|
||||
BOSCH_ALT_RADAR = 512
|
||||
HAS_BSM = 1024 # blind spot monitoring
|
||||
# 1024 is available
|
||||
HYBRID = 2048
|
||||
BOSCH_TJA_CONTROL = 4096
|
||||
|
||||
@@ -178,7 +167,7 @@ class CAR(Platforms):
|
||||
[
|
||||
HondaCarDocs("Honda N-Box 2018", "All", min_steer_speed=5.),
|
||||
],
|
||||
CarSpecs(wheelbase=2.520, steerRatio=18.64),
|
||||
CarSpecs(mass=890., wheelbase=2.520, steerRatio=18.64),
|
||||
{Bus.pt: 'acura_rdx_2020_can_generated'},
|
||||
)
|
||||
HONDA_ACCORD = HondaBoschPlatformConfig(
|
||||
@@ -188,7 +177,7 @@ class CAR(Platforms):
|
||||
HondaCarDocs("Honda Accord Hybrid 2018-22", "All", min_steer_speed=3. * CV.MPH_TO_MS),
|
||||
],
|
||||
# steerRatio: 11.82 is spec end-to-end
|
||||
CarSpecs(wheelbase=2.83, steerRatio=16.33, centerToFrontRatio=0.39, tireStiffnessFactor=0.8467),
|
||||
CarSpecs(mass=3279 * CV.LB_TO_KG, wheelbase=2.83, steerRatio=16.33, centerToFrontRatio=0.39, tireStiffnessFactor=0.8467),
|
||||
{Bus.pt: 'honda_civic_hatchback_ex_2017_can_generated'},
|
||||
)
|
||||
HONDA_ACCORD_11G = HondaBoschCANFDPlatformConfig(
|
||||
@@ -196,7 +185,7 @@ class CAR(Platforms):
|
||||
HondaCarDocs("Honda Accord 2023-25", "All"),
|
||||
HondaCarDocs("Honda Accord Hybrid 2023-26", "All"),
|
||||
],
|
||||
CarSpecs(wheelbase=2.83, steerRatio=16.0, centerToFrontRatio=0.39),
|
||||
CarSpecs(mass=3477 * CV.LB_TO_KG, wheelbase=2.83, steerRatio=16.0, centerToFrontRatio=0.39),
|
||||
)
|
||||
HONDA_CIVIC_BOSCH = HondaBoschPlatformConfig(
|
||||
[
|
||||
@@ -205,7 +194,7 @@ class CAR(Platforms):
|
||||
HondaCarDocs("Honda Civic Hatchback 2017-18", min_steer_speed=12. * CV.MPH_TO_MS),
|
||||
HondaCarDocs("Honda Civic Hatchback 2019-21", "All", min_steer_speed=12. * CV.MPH_TO_MS),
|
||||
],
|
||||
CarSpecs(wheelbase=2.7, steerRatio=15.38, centerToFrontRatio=0.4), # steerRatio: 10.93 is end-to-end spec
|
||||
CarSpecs(mass=1326, wheelbase=2.7, steerRatio=15.38, centerToFrontRatio=0.4), # steerRatio: 10.93 is end-to-end spec
|
||||
{Bus.pt: 'honda_civic_hatchback_ex_2017_can_generated'},
|
||||
)
|
||||
HONDA_CIVIC_BOSCH_DIESEL = HondaBoschPlatformConfig(
|
||||
@@ -217,7 +206,7 @@ class CAR(Platforms):
|
||||
[
|
||||
HondaCarDocs("Honda Civic 2022-26", "All", video="https://youtu.be/ytiOT5lcp6Q"),
|
||||
HondaCarDocs("Honda Civic Hybrid 2025-26", "All"),
|
||||
HondaCarDocs("Honda Civic Hatchback 2022-26", "All", video="https://youtu.be/ytiOT5lcp6Q"),
|
||||
HondaCarDocs("Honda Civic Hatchback 2022-24", "All", video="https://youtu.be/ytiOT5lcp6Q"),
|
||||
HondaCarDocs("Honda Civic Hatchback Hybrid (Europe only) 2023", "All"),
|
||||
# TODO: Confirm 2024
|
||||
HondaCarDocs("Honda Civic Hatchback Hybrid 2025-26", "All"),
|
||||
@@ -229,114 +218,97 @@ class CAR(Platforms):
|
||||
HONDA_CRV_5G = HondaBoschPlatformConfig(
|
||||
[HondaCarDocs("Honda CR-V 2017-22", min_steer_speed=15. * CV.MPH_TO_MS)],
|
||||
# steerRatio: 12.3 is spec end-to-end
|
||||
CarSpecs(wheelbase=2.66, steerRatio=16.0, centerToFrontRatio=0.41, tireStiffnessFactor=0.677),
|
||||
CarSpecs(mass=3410 * CV.LB_TO_KG, wheelbase=2.66, steerRatio=16.0, centerToFrontRatio=0.41, tireStiffnessFactor=0.677),
|
||||
{Bus.pt: 'honda_civic_hatchback_ex_2017_can_generated', Bus.body: 'honda_crv_ex_2017_body_generated'},
|
||||
flags=HondaFlags.BOSCH_ALT_BRAKE,
|
||||
)
|
||||
HONDA_CRV_6G = HondaBoschCANFDPlatformConfig(
|
||||
[
|
||||
HondaCarDocs("Honda CR-V 2023-26", "All"),
|
||||
HondaCarDocs("Honda CR-V Hybrid 2023-27", "All"),
|
||||
HondaCarDocs("Honda CR-V Hybrid 2023-26", "All"),
|
||||
],
|
||||
CarSpecs(wheelbase=2.7, steerRatio=16.2, centerToFrontRatio=0.42),
|
||||
CarSpecs(mass=1703, wheelbase=2.7, steerRatio=16.2, centerToFrontRatio=0.42),
|
||||
)
|
||||
HONDA_CRV_HYBRID = HondaBoschPlatformConfig(
|
||||
[HondaCarDocs("Honda CR-V Hybrid 2017-22", min_steer_speed=12. * CV.MPH_TO_MS)],
|
||||
# steerRatio: 12.3 is spec end-to-end
|
||||
CarSpecs(wheelbase=2.66, steerRatio=16, centerToFrontRatio=0.41, tireStiffnessFactor=0.677),
|
||||
# mass: mean of 4 models in kg, steerRatio: 12.3 is spec end-to-end
|
||||
CarSpecs(mass=1667, wheelbase=2.66, steerRatio=16, centerToFrontRatio=0.41, tireStiffnessFactor=0.677),
|
||||
{Bus.pt: 'honda_civic_hatchback_ex_2017_can_generated'},
|
||||
)
|
||||
HONDA_HRV_3G = HondaBoschPlatformConfig(
|
||||
[HondaCarDocs("Honda HR-V 2023-27", "All")],
|
||||
CarSpecs(wheelbase=2.61, steerRatio=15.2, centerToFrontRatio=0.41, tireStiffnessFactor=0.5),
|
||||
CarSpecs(mass=3125 * CV.LB_TO_KG, wheelbase=2.61, steerRatio=15.2, centerToFrontRatio=0.41, tireStiffnessFactor=0.5),
|
||||
{Bus.pt: 'honda_bosch_radarless_generated'},
|
||||
flags=HondaFlags.BOSCH_RADARLESS,
|
||||
)
|
||||
HONDA_CITY_7G = HondaBoschPlatformConfig(
|
||||
[HondaCarDocs("Honda City (Brazil only) 2023-25", "All")],
|
||||
CarSpecs(wheelbase=2.6, steerRatio=19.0, centerToFrontRatio=0.41, minSteerSpeed=23. * CV.KPH_TO_MS),
|
||||
CarSpecs(mass=3125 * CV.LB_TO_KG, wheelbase=2.6, steerRatio=19.0, centerToFrontRatio=0.41, minSteerSpeed=23. * CV.KPH_TO_MS),
|
||||
{Bus.pt: 'honda_bosch_radarless_generated'},
|
||||
flags=HondaFlags.BOSCH_RADARLESS,
|
||||
)
|
||||
ACURA_RDX_3G = HondaBoschPlatformConfig(
|
||||
[HondaCarDocs("Acura RDX 2019-21", "All", min_steer_speed=3. * CV.MPH_TO_MS)],
|
||||
CarSpecs(wheelbase=2.75, steerRatio=11.95, centerToFrontRatio=0.41, tireStiffnessFactor=0.677), # as spec
|
||||
CarSpecs(mass=4068 * CV.LB_TO_KG, wheelbase=2.75, steerRatio=11.95, centerToFrontRatio=0.41, tireStiffnessFactor=0.677), # as spec
|
||||
{Bus.pt: 'acura_rdx_2020_can_generated'},
|
||||
flags=HondaFlags.BOSCH_ALT_BRAKE,
|
||||
)
|
||||
ACURA_RDX_3G_MMR = HondaBoschPlatformConfig(
|
||||
[HondaCarDocs("Acura RDX 2022-24", "All", min_steer_speed=70. * CV.KPH_TO_MS)],
|
||||
CarSpecs(wheelbase=2.75, centerToFrontRatio=0.41, steerRatio=16.2),
|
||||
CarSpecs(mass=4079 * CV.LB_TO_KG, wheelbase=2.75, centerToFrontRatio=0.41, steerRatio=16.2),
|
||||
{Bus.pt: 'acura_rdx_2020_can_generated'},
|
||||
flags=HondaFlags.BOSCH_ALT_BRAKE | HondaFlags.BOSCH_ALT_RADAR,
|
||||
)
|
||||
HONDA_INSIGHT = HondaBoschPlatformConfig(
|
||||
[HondaCarDocs("Honda Insight 2019-22", "All", min_steer_speed=3. * CV.MPH_TO_MS)],
|
||||
CarSpecs(wheelbase=2.7, steerRatio=15.0, centerToFrontRatio=0.39, tireStiffnessFactor=0.82), # as spec
|
||||
CarSpecs(mass=2987 * CV.LB_TO_KG, wheelbase=2.7, steerRatio=15.0, centerToFrontRatio=0.39, tireStiffnessFactor=0.82), # as spec
|
||||
{Bus.pt: 'honda_insight_ex_2019_can_generated'},
|
||||
)
|
||||
HONDA_E = HondaBoschPlatformConfig(
|
||||
[HondaCarDocs("Honda e 2020", "All", min_steer_speed=3. * CV.MPH_TO_MS)],
|
||||
CarSpecs(wheelbase=2.5, centerToFrontRatio=0.5, steerRatio=16.71, tireStiffnessFactor=0.82),
|
||||
CarSpecs(mass=3338.8 * CV.LB_TO_KG, wheelbase=2.5, centerToFrontRatio=0.5, steerRatio=16.71, tireStiffnessFactor=0.82),
|
||||
{Bus.pt: 'acura_rdx_2020_can_generated'},
|
||||
)
|
||||
HONDA_E_ADVANCE = HondaBoschPlatformConfig(
|
||||
[], # don't show in docs, base trim already in docs
|
||||
CarSpecs(wheelbase=2.5, centerToFrontRatio=0.5, steerRatio=16.71, tireStiffnessFactor=0.82),
|
||||
CarSpecs(mass=1527, wheelbase=2.5, centerToFrontRatio=0.5, steerRatio=16.71, tireStiffnessFactor=0.82),
|
||||
{Bus.pt: 'honda_e_advance_2020_can_generated'}, # 8 bit LKAS_HUD in Advance trim
|
||||
)
|
||||
HONDA_PILOT_4G = HondaBoschCANFDPlatformConfig(
|
||||
[HondaCarDocs("Honda Pilot 2023-25", "All")],
|
||||
CarSpecs(wheelbase=2.89, centerToFrontRatio=0.442, steerRatio=17.5),
|
||||
)
|
||||
# Mid-Model Refresh has more powerful EPS
|
||||
HONDA_PILOT_4G_MMR = HondaBoschCANFDPlatformConfig(
|
||||
[HondaCarDocs("Honda Pilot 2026", "All")],
|
||||
CarSpecs(wheelbase=2.89, centerToFrontRatio=0.442, steerRatio=19.2),
|
||||
CarSpecs(mass=4660 * CV.LB_TO_KG, wheelbase=2.89, centerToFrontRatio=0.442, steerRatio=17.5),
|
||||
)
|
||||
HONDA_PASSPORT_4G = HondaBoschCANFDPlatformConfig(
|
||||
[HondaCarDocs("Honda Passport 2026", "All")],
|
||||
CarSpecs(wheelbase=2.89, centerToFrontRatio=0.442, steerRatio=18.5),
|
||||
)
|
||||
HONDA_PRELUDE_6G = HondaBoschPlatformConfig(
|
||||
[HondaCarDocs("Honda Prelude 2026", "All")],
|
||||
CarSpecs(wheelbase=2.605, steerRatio=13.65, centerToFrontRatio=0.37),
|
||||
{Bus.pt: 'honda_bosch_radarless_generated'},
|
||||
flags=HondaFlags.BOSCH_RADARLESS,
|
||||
CarSpecs(mass=4620 * CV.LB_TO_KG, wheelbase=2.89, centerToFrontRatio=0.442, steerRatio=18.5),
|
||||
)
|
||||
ACURA_MDX_4G = HondaBoschPlatformConfig(
|
||||
[HondaCarDocs("Acura MDX 2022-24", "All", min_steer_speed=70. * CV.KPH_TO_MS)],
|
||||
CarSpecs(wheelbase=2.89, steerRatio=15.8, centerToFrontRatio=0.428), # as spec
|
||||
CarSpecs(mass=4788 * CV.LB_TO_KG, wheelbase=2.89, steerRatio=15.8, centerToFrontRatio=0.428), # as spec
|
||||
{Bus.pt: 'honda_common_canfd_generated'}, # not CANFD car but shares same dbc
|
||||
flags=HondaFlags.BOSCH_ALT_RADAR,
|
||||
)
|
||||
# mid-model refresh
|
||||
ACURA_MDX_4G_MMR = HondaBoschCANFDPlatformConfig(
|
||||
[HondaCarDocs("Acura MDX 2025-26", "All except Type S")],
|
||||
CarSpecs(wheelbase=2.89, centerToFrontRatio=0.428, steerRatio=16.2),
|
||||
CarSpecs(mass=4544 * CV.LB_TO_KG, wheelbase=2.89, centerToFrontRatio=0.428, steerRatio=16.2),
|
||||
)
|
||||
HONDA_ODYSSEY_5G_MMR = HondaBoschPlatformConfig(
|
||||
[HondaCarDocs("Honda Odyssey 2021-26", "All", min_steer_speed=70. * CV.KPH_TO_MS)],
|
||||
CarSpecs(wheelbase=3.00, steerRatio=19.4, centerToFrontRatio=0.41),
|
||||
CarSpecs(mass=4590 * CV.LB_TO_KG, wheelbase=3.00, steerRatio=19.4, centerToFrontRatio=0.41),
|
||||
{Bus.pt: 'acura_rdx_2020_can_generated'},
|
||||
flags=HondaFlags.BOSCH_ALT_BRAKE | HondaFlags.BOSCH_ALT_RADAR,
|
||||
)
|
||||
ACURA_TLX_2G = HondaBoschPlatformConfig(
|
||||
[HondaCarDocs("Acura TLX 2021-22", "All")],
|
||||
CarSpecs(wheelbase=2.87, steerRatio=14.0, centerToFrontRatio=0.43),
|
||||
CarSpecs(mass=3982 * CV.LB_TO_KG, wheelbase=2.87, steerRatio=14.0, centerToFrontRatio=0.43),
|
||||
{Bus.pt: 'honda_civic_hatchback_ex_2017_can_generated'},
|
||||
flags=HondaFlags.BOSCH_ALT_RADAR,
|
||||
)
|
||||
# mid-model refresh
|
||||
ACURA_TLX_2G_MMR = HondaBoschCANFDPlatformConfig(
|
||||
[HondaCarDocs("Acura TLX 2025", "All")],
|
||||
CarSpecs(wheelbase=2.87, centerToFrontRatio=0.43, steerRatio=13.7),
|
||||
)
|
||||
ACURA_ADX = HondaBoschPlatformConfig(
|
||||
[HondaCarDocs("Acura ADX 2025-26", "All")],
|
||||
CarSpecs(wheelbase=2.65, steerRatio=17.6, centerToFrontRatio=0.43),
|
||||
{Bus.pt: 'honda_bosch_radarless_generated'},
|
||||
flags=HondaFlags.BOSCH_RADARLESS
|
||||
CarSpecs(mass=3990 * CV.LB_TO_KG, wheelbase=2.87, centerToFrontRatio=0.43, steerRatio=13.7),
|
||||
)
|
||||
|
||||
# Nidec Cars
|
||||
@@ -345,13 +317,13 @@ class CAR(Platforms):
|
||||
HondaCarDocs("Acura ILX 2016-18", "Technology Plus Package or AcuraWatch Plus", min_steer_speed=25. * CV.MPH_TO_MS),
|
||||
HondaCarDocs("Acura ILX 2019", "All", min_steer_speed=25. * CV.MPH_TO_MS),
|
||||
],
|
||||
CarSpecs(wheelbase=2.67, steerRatio=18.61, centerToFrontRatio=0.37, tireStiffnessFactor=0.72), # 15.3 is spec end-to-end
|
||||
CarSpecs(mass=3095 * CV.LB_TO_KG, wheelbase=2.67, steerRatio=18.61, centerToFrontRatio=0.37, tireStiffnessFactor=0.72), # 15.3 is spec end-to-end
|
||||
radar_dbc_dict('acura_ilx_2016_can_generated'),
|
||||
flags=HondaFlags.NIDEC_ALT_SCM_MESSAGES | HondaFlags.HAS_ALL_DOOR_STATES,
|
||||
)
|
||||
HONDA_CRV = HondaNidecPlatformConfig(
|
||||
[HondaCarDocs("Honda CR-V 2015-16", "Touring Trim", min_steer_speed=12. * CV.MPH_TO_MS)],
|
||||
CarSpecs(wheelbase=2.62, steerRatio=16.89, centerToFrontRatio=0.41, tireStiffnessFactor=0.444), # as spec
|
||||
CarSpecs(mass=3572 * CV.LB_TO_KG, wheelbase=2.62, steerRatio=16.89, centerToFrontRatio=0.41, tireStiffnessFactor=0.444), # as spec
|
||||
radar_dbc_dict('honda_crv_touring_2016_can_generated'),
|
||||
flags=HondaFlags.NIDEC_ALT_SCM_MESSAGES | HondaFlags.HAS_ALL_DOOR_STATES,
|
||||
)
|
||||
@@ -363,13 +335,13 @@ class CAR(Platforms):
|
||||
)
|
||||
HONDA_FIT = HondaNidecPlatformConfig(
|
||||
[HondaCarDocs("Honda Fit 2018-20", min_steer_speed=12. * CV.MPH_TO_MS)],
|
||||
CarSpecs(wheelbase=2.53, steerRatio=13.06, centerToFrontRatio=0.39, tireStiffnessFactor=0.75),
|
||||
CarSpecs(mass=2644 * CV.LB_TO_KG, wheelbase=2.53, steerRatio=13.06, centerToFrontRatio=0.39, tireStiffnessFactor=0.75),
|
||||
radar_dbc_dict('acura_ilx_2016_can_generated'),
|
||||
flags=HondaFlags.NIDEC_ALT_SCM_MESSAGES,
|
||||
)
|
||||
HONDA_FREED = HondaNidecPlatformConfig(
|
||||
[HondaCarDocs("Honda Freed 2020", min_steer_speed=12. * CV.MPH_TO_MS)],
|
||||
CarSpecs(wheelbase=2.74, steerRatio=13.06, centerToFrontRatio=0.39, tireStiffnessFactor=0.75), # mostly copied from FIT
|
||||
CarSpecs(mass=3086. * CV.LB_TO_KG, wheelbase=2.74, steerRatio=13.06, centerToFrontRatio=0.39, tireStiffnessFactor=0.75), # mostly copied from FIT
|
||||
radar_dbc_dict('acura_ilx_2016_can_generated'),
|
||||
flags=HondaFlags.NIDEC_ALT_SCM_MESSAGES,
|
||||
)
|
||||
@@ -381,7 +353,7 @@ class CAR(Platforms):
|
||||
)
|
||||
HONDA_ODYSSEY = HondaNidecPlatformConfig(
|
||||
[HondaCarDocs("Honda Odyssey 2018-20")],
|
||||
CarSpecs(wheelbase=3.0, steerRatio=14.35, centerToFrontRatio=0.41, tireStiffnessFactor=0.82),
|
||||
CarSpecs(mass=1900, wheelbase=3.0, steerRatio=14.35, centerToFrontRatio=0.41, tireStiffnessFactor=0.82),
|
||||
radar_dbc_dict('honda_odyssey_exl_2018_generated'),
|
||||
flags=HondaFlags.NIDEC_ALT_PCM_ACCEL | HondaFlags.HAS_ALL_DOOR_STATES,
|
||||
)
|
||||
@@ -390,13 +362,13 @@ class CAR(Platforms):
|
||||
HondaCarDocs("Honda Odyssey (Taiwan) 2018-19"),
|
||||
HondaCarDocs("Honda Odyssey (Singapore) 2021")
|
||||
],
|
||||
CarSpecs(wheelbase=2.9, steerRatio=14.35, centerToFrontRatio=0.44, tireStiffnessFactor=0.82),
|
||||
CarSpecs(mass=1865, wheelbase=2.9, steerRatio=14.35, centerToFrontRatio=0.44, tireStiffnessFactor=0.82),
|
||||
radar_dbc_dict('honda_odyssey_twn_2018_generated'),
|
||||
flags=HondaFlags.NIDEC_ALT_SCM_MESSAGES,
|
||||
)
|
||||
ACURA_RDX = HondaNidecPlatformConfig(
|
||||
[HondaCarDocs("Acura RDX 2016-18", "AcuraWatch Plus or Advance Package", min_steer_speed=12. * CV.MPH_TO_MS)],
|
||||
CarSpecs(wheelbase=2.68, steerRatio=15.0, centerToFrontRatio=0.38, tireStiffnessFactor=0.444), # as spec
|
||||
CarSpecs(mass=3925 * CV.LB_TO_KG, wheelbase=2.68, steerRatio=15.0, centerToFrontRatio=0.38, tireStiffnessFactor=0.444), # as spec
|
||||
radar_dbc_dict('acura_rdx_2018_can_generated'),
|
||||
flags=HondaFlags.NIDEC_ALT_SCM_MESSAGES | HondaFlags.HAS_ALL_DOOR_STATES,
|
||||
)
|
||||
@@ -410,14 +382,14 @@ class CAR(Platforms):
|
||||
flags=HondaFlags.NIDEC_ALT_SCM_MESSAGES | HondaFlags.HAS_ALL_DOOR_STATES,
|
||||
)
|
||||
HONDA_RIDGELINE = HondaNidecPlatformConfig(
|
||||
[HondaCarDocs("Honda Ridgeline 2017-26", min_steer_speed=12. * CV.MPH_TO_MS)],
|
||||
CarSpecs(wheelbase=3.18, centerToFrontRatio=0.41, steerRatio=15.59, tireStiffnessFactor=0.444), # as spec
|
||||
[HondaCarDocs("Honda Ridgeline 2017-25", min_steer_speed=12. * CV.MPH_TO_MS)],
|
||||
CarSpecs(mass=4515 * CV.LB_TO_KG, wheelbase=3.18, centerToFrontRatio=0.41, steerRatio=15.59, tireStiffnessFactor=0.444), # as spec
|
||||
radar_dbc_dict('acura_ilx_2016_can_generated'),
|
||||
flags=HondaFlags.NIDEC_ALT_SCM_MESSAGES | HondaFlags.HAS_ALL_DOOR_STATES,
|
||||
)
|
||||
HONDA_CIVIC = HondaNidecPlatformConfig(
|
||||
[HondaCarDocs("Honda Civic 2016-18", min_steer_speed=12. * CV.MPH_TO_MS, video="https://youtu.be/-IkImTe1NYE")],
|
||||
CarSpecs(wheelbase=2.70, centerToFrontRatio=0.4, steerRatio=15.38), # 10.93 is end-to-end spec
|
||||
CarSpecs(mass=1326, wheelbase=2.70, centerToFrontRatio=0.4, steerRatio=15.38), # 10.93 is end-to-end spec
|
||||
radar_dbc_dict('honda_civic_touring_2016_can_generated'),
|
||||
flags=HondaFlags.HAS_ALL_DOOR_STATES
|
||||
)
|
||||
@@ -425,7 +397,7 @@ class CAR(Platforms):
|
||||
# port extensions
|
||||
HONDA_CLARITY = HondaNidecPlatformConfig(
|
||||
[HondaCarDocs("Honda Clarity 2018-21", "All", min_steer_speed=3. * CV.MPH_TO_MS)],
|
||||
CarSpecs(wheelbase=2.75, centerToFrontRatio=0.4, steerRatio=16.5),
|
||||
CarSpecs(mass=1838, wheelbase=2.75, centerToFrontRatio=0.4, steerRatio=16.5),
|
||||
radar_dbc_dict('honda_clarity_hybrid_2018_can_generated'),
|
||||
flags=HondaFlags.HAS_ALL_DOOR_STATES,
|
||||
)
|
||||
@@ -445,7 +417,6 @@ STEER_THRESHOLD = {
|
||||
CAR.HONDA_CRV_EU: 400,
|
||||
CAR.HONDA_ACCORD_11G: 600,
|
||||
CAR.HONDA_PILOT_4G: 600,
|
||||
CAR.HONDA_PILOT_4G_MMR: 600,
|
||||
CAR.HONDA_PASSPORT_4G: 600,
|
||||
CAR.ACURA_MDX_4G_MMR: 600,
|
||||
CAR.HONDA_CRV_6G: 600,
|
||||
|
||||
@@ -180,7 +180,7 @@ class CarState(CarStateBase, EsccCarStateBase, MadsCarState, CarStateExt):
|
||||
ret.stockFcw = (aeb_warning or scc_warning) and not aeb_braking
|
||||
ret.stockAeb = aeb_warning and aeb_braking
|
||||
|
||||
if self.CP.flags & HyundaiFlags.HAS_BSM:
|
||||
if self.CP.enableBsm:
|
||||
ret.leftBlindspot = cp.vl["LCA11"]["CF_Lca_IndLeft"] != 0
|
||||
ret.rightBlindspot = cp.vl["LCA11"]["CF_Lca_IndRight"] != 0
|
||||
|
||||
@@ -262,7 +262,7 @@ class CarState(CarStateBase, EsccCarStateBase, MadsCarState, CarStateExt):
|
||||
left_blinker_sig, right_blinker_sig = "LEFT_LAMP_ALT", "RIGHT_LAMP_ALT"
|
||||
ret.leftBlinker, ret.rightBlinker = self.update_blinker_from_lamp(50, cp.vl["BLINKERS"][left_blinker_sig],
|
||||
cp.vl["BLINKERS"][right_blinker_sig])
|
||||
if self.CP.flags & HyundaiFlags.HAS_BSM:
|
||||
if self.CP.enableBsm:
|
||||
ret.leftBlindspot = bool(cp.vl["ADAS_CMD_50_50ms"]["BCW_LtIndSta"])
|
||||
ret.rightBlindspot = bool(cp.vl["ADAS_CMD_50_50ms"]["BCW_RtIndSta"])
|
||||
|
||||
|
||||
@@ -377,7 +377,6 @@ FW_VERSIONS = {
|
||||
b'\xf1\x00CK__ SCC F_CUP 1.00 1.03 96400-J5100 ',
|
||||
],
|
||||
(Ecu.eps, 0x7d4, None): [
|
||||
b'\xf1\x00CK MDPS R 1.00 1.02 56310-XX000 4C2VR102',
|
||||
b'\xf1\x00CK MDPS R 1.00 1.04 57700-J5200 4C2CL104',
|
||||
b'\xf1\x00CK MDPS R 1.00 1.04 57700-J5220 4C2VL104',
|
||||
b'\xf1\x00CK MDPS R 1.00 1.04 57700-J5420 4C4VL104',
|
||||
@@ -387,7 +386,6 @@ FW_VERSIONS = {
|
||||
],
|
||||
(Ecu.fwdCamera, 0x7c4, None): [
|
||||
b'\xf1\x00CK MFC AT EUR LHD 1.00 1.03 95740-J5000 170822',
|
||||
b'\xf1\x00CK MFC AT EUR RHD 1.00 1.02 95740-J5000 170607',
|
||||
b'\xf1\x00CK MFC AT KOR LHD 1.00 1.04 95740-J5000 180504',
|
||||
b'\xf1\x00CK MFC AT USA LHD 1.00 1.03 95740-J5000 170822',
|
||||
b'\xf1\x00CK MFC AT USA LHD 1.00 1.04 95740-J5000 180504',
|
||||
@@ -547,7 +545,6 @@ FW_VERSIONS = {
|
||||
],
|
||||
(Ecu.fwdCamera, 0x7c4, None): [
|
||||
b'\xf1\x00RG3 MFC AT USA LHD 1.00 1.01 99211-T1200 230607',
|
||||
b'\xf1\x00RG3 MFC AT USA LHD 1.00 1.01 99211-T1210 230607',
|
||||
],
|
||||
},
|
||||
CAR.GENESIS_G90: {
|
||||
@@ -591,18 +588,6 @@ FW_VERSIONS = {
|
||||
b'\xf1\x00CD ESC \x0b 101 \x10\x03 58910-J7AC0',
|
||||
],
|
||||
},
|
||||
CAR.KIA_CEED_PHEV: {
|
||||
(Ecu.fwdRadar, 0x7d0, None): [
|
||||
b'\xf1\x00CDph SCC F-CUP 1.00 1.01 99110-CR100 ',
|
||||
],
|
||||
(Ecu.eps, 0x7d4, None): [
|
||||
b'\xf1\x00CDe MDPS C 1.00 1.01 56310-XX000 4CDHC101',
|
||||
],
|
||||
(Ecu.fwdCamera, 0x7c4, None): [
|
||||
b'\xf1\x00CD2 LKAS AT EUR LHD 1.00 1.01 99211-CR010 621',
|
||||
b'\xf1\x00CDP LKAS AT EUR LHD 1.00 1.01 99211-CR000 q31',
|
||||
],
|
||||
},
|
||||
CAR.KIA_FORTE: {
|
||||
(Ecu.eps, 0x7d4, None): [
|
||||
b'\xf1\x00BD MDPS C 1.00 1.02 56310-XX000 4BD2C102',
|
||||
@@ -941,7 +926,6 @@ FW_VERSIONS = {
|
||||
b'\xf1\x00CN7 MDPS C 1.00 1.06 56310/AA070 4CNDC106',
|
||||
b'\xf1\x00CN7 MDPS C 1.00 1.06 56310AA050\x00 4CNDC106',
|
||||
b'\xf1\x00CN7 MDPS C 1.00 1.07 56310AA050\x00 4CNDC107',
|
||||
b'\xf1\x00CN7 MDPS C 1.00 1.07 56310AA040\x00 4CNDC107',
|
||||
],
|
||||
(Ecu.fwdCamera, 0x7c4, None): [
|
||||
b'\xf1\x00CN7 MFC AT USA LHD 1.00 1.00 99210-AB000 200819',
|
||||
@@ -953,7 +937,6 @@ FW_VERSIONS = {
|
||||
b'\xf1\x00CN7 MFC AT USA LHD 1.00 1.07 99210-AA000 220426',
|
||||
b'\xf1\x00CN7 MFC AT USA LHD 1.00 1.08 99210-AA000 220728',
|
||||
b'\xf1\x00CN7 MFC AT USA LHD 1.00 1.09 99210-AA000 221108',
|
||||
b'\xf1\x00CN7 MFC AT EUR LHD 1.00 1.09 99210-AA000 221108',
|
||||
],
|
||||
(Ecu.abs, 0x7d1, None): [
|
||||
b'\xf1\x00CN ESC \t 101 \x10\x03 58910-AB800',
|
||||
@@ -1138,9 +1121,7 @@ FW_VERSIONS = {
|
||||
CAR.KIA_SPORTAGE_5TH_GEN: {
|
||||
(Ecu.fwdCamera, 0x7c4, None): [
|
||||
b'\xf1\x00NQ5 FR_CMR AT AUS RHD 1.00 1.00 99211-P1040 663',
|
||||
b'\xf1\x00NQ5 FR_CMR AT AUS RHD 1.00 1.00 99211-P1070 690',
|
||||
b'\xf1\x00NQ5 FR_CMR AT EUR LHD 1.00 1.00 99211-P1040 663',
|
||||
b'\xf1\x00NQ5 FR_CMR AT EUR LHD 1.00 1.00 99211-P1070 690',
|
||||
b'\xf1\x00NQ5 FR_CMR AT GEN LHD 1.00 1.00 99211-P1040 663',
|
||||
b'\xf1\x00NQ5 FR_CMR AT GEN LHD 1.00 1.00 99211-P1060 665',
|
||||
b'\xf1\x00NQ5 FR_CMR AT USA LHD 1.00 1.00 99211-P1030 662',
|
||||
|
||||
@@ -42,7 +42,7 @@ def create_lkas11(packer, frame, CP, apply_torque, steer_req,
|
||||
CAR.HYUNDAI_IONIQ_EV_2020, CAR.HYUNDAI_IONIQ_PHEV, CAR.KIA_SELTOS, CAR.HYUNDAI_ELANTRA_2021, CAR.GENESIS_G70_2020,
|
||||
CAR.HYUNDAI_ELANTRA_HEV_2021, CAR.HYUNDAI_SONATA_HYBRID, CAR.HYUNDAI_KONA_EV, CAR.HYUNDAI_KONA_HEV, CAR.HYUNDAI_KONA_EV_2022,
|
||||
CAR.HYUNDAI_SANTA_FE_2022, CAR.KIA_K5_2021, CAR.HYUNDAI_IONIQ_HEV_2022, CAR.HYUNDAI_SANTA_FE_HEV_2022,
|
||||
CAR.HYUNDAI_SANTA_FE_PHEV_2022, CAR.KIA_STINGER_2022, CAR.KIA_K5_HEV_2020, CAR.KIA_CEED, CAR.KIA_CEED_PHEV,
|
||||
CAR.HYUNDAI_SANTA_FE_PHEV_2022, CAR.KIA_STINGER_2022, CAR.KIA_K5_HEV_2020, CAR.KIA_CEED,
|
||||
CAR.HYUNDAI_AZERA_6TH_GEN, CAR.HYUNDAI_AZERA_HEV_6TH_GEN, CAR.HYUNDAI_CUSTIN_1ST_GEN, CAR.HYUNDAI_KONA_2022,
|
||||
CAR.KIA_CEED_PHEV_2022_NON_SCC, CAR.HYUNDAI_KONA_EV_NON_SCC, CAR.HYUNDAI_ELANTRA_2022_NON_SCC,
|
||||
CAR.GENESIS_G70_2021_NON_SCC, CAR.KIA_SELTOS_2023_NON_SCC, CAR.HYUNDAI_BAYON_1ST_GEN_NON_SCC):
|
||||
|
||||
@@ -46,8 +46,7 @@ class CarInterface(CarInterfaceBase):
|
||||
# this needs to be figured out for cars without an ADAS ECU
|
||||
ret.alphaLongitudinalAvailable = False
|
||||
|
||||
if 0x1ba in fingerprint[CAN.ECAN]:
|
||||
ret.flags |= HyundaiFlags.HAS_BSM.value
|
||||
ret.enableBsm = 0x1ba in fingerprint[CAN.ECAN]
|
||||
|
||||
# Check if the car is hybrid. Only HEV/PHEV cars have 0xFA on E-CAN.
|
||||
if 0xFA in fingerprint[CAN.ECAN]:
|
||||
@@ -90,8 +89,7 @@ class CarInterface(CarInterfaceBase):
|
||||
else:
|
||||
# Shared configuration for non CAN-FD cars
|
||||
ret.alphaLongitudinalAvailable = not (ret.flags & (HyundaiFlags.LEGACY | HyundaiFlags.UNSUPPORTED_LONGITUDINAL))
|
||||
if 0x58b in fingerprint[0]:
|
||||
ret.flags |= HyundaiFlags.HAS_BSM.value
|
||||
ret.enableBsm = 0x58b in fingerprint[0]
|
||||
|
||||
# Send LFA message on cars with HDA
|
||||
if 0x485 in fingerprint[2]:
|
||||
|
||||
@@ -27,7 +27,6 @@ NO_DATES_PLATFORMS = {
|
||||
CAR.HYUNDAI_ELANTRA,
|
||||
CAR.HYUNDAI_ELANTRA_GT_I30,
|
||||
CAR.KIA_CEED,
|
||||
CAR.KIA_CEED_PHEV,
|
||||
CAR.KIA_FORTE,
|
||||
CAR.KIA_OPTIMA_G4,
|
||||
CAR.KIA_OPTIMA_G4_FL,
|
||||
|
||||
@@ -149,8 +149,6 @@ class HyundaiFlags(IntFlag):
|
||||
|
||||
ALT_LIMITS_2 = 2 ** 26
|
||||
|
||||
HAS_BSM = 2 ** 27 # blind spot monitoring
|
||||
|
||||
|
||||
@dataclass
|
||||
class HyundaiCarDocs(CarDocs):
|
||||
@@ -199,14 +197,14 @@ class CAR(Platforms):
|
||||
# Hyundai
|
||||
HYUNDAI_AZERA_6TH_GEN = HyundaiPlatformConfig(
|
||||
[HyundaiCarDocs("Hyundai Azera 2022", "All", car_parts=CarParts.common([CarHarness.hyundai_k]))],
|
||||
CarSpecs(wheelbase=2.885, steerRatio=14.5),
|
||||
CarSpecs(mass=1600, wheelbase=2.885, steerRatio=14.5),
|
||||
)
|
||||
HYUNDAI_AZERA_HEV_6TH_GEN = HyundaiPlatformConfig(
|
||||
[
|
||||
HyundaiCarDocs("Hyundai Azera Hybrid 2019", "All", car_parts=CarParts.common([CarHarness.hyundai_c])),
|
||||
HyundaiCarDocs("Hyundai Azera Hybrid 2020", "All", car_parts=CarParts.common([CarHarness.hyundai_k])),
|
||||
],
|
||||
CarSpecs(wheelbase=2.885, steerRatio=14.5),
|
||||
CarSpecs(mass=1675, wheelbase=2.885, steerRatio=14.5),
|
||||
flags=HyundaiFlags.HYBRID,
|
||||
)
|
||||
HYUNDAI_ELANTRA = HyundaiPlatformConfig(
|
||||
@@ -216,7 +214,7 @@ class CAR(Platforms):
|
||||
HyundaiCarDocs("Hyundai Elantra 2019", min_enable_speed=19 * CV.MPH_TO_MS, car_parts=CarParts.common([CarHarness.hyundai_g])),
|
||||
],
|
||||
# steerRatio: 14 is Stock | Settled Params Learner values are steerRatio: 15.401566348670535, stiffnessFactor settled on 1.0081302973865127
|
||||
CarSpecs(wheelbase=2.7, steerRatio=15.4, tireStiffnessFactor=0.385),
|
||||
CarSpecs(mass=1275, wheelbase=2.7, steerRatio=15.4, tireStiffnessFactor=0.385),
|
||||
flags=HyundaiFlags.LEGACY | HyundaiFlags.CLUSTER_GEARS | HyundaiFlags.MIN_STEER_32_MPH,
|
||||
)
|
||||
HYUNDAI_ELANTRA_GT_I30 = HyundaiPlatformConfig(
|
||||
@@ -229,13 +227,13 @@ class CAR(Platforms):
|
||||
)
|
||||
HYUNDAI_ELANTRA_2021 = HyundaiPlatformConfig(
|
||||
[HyundaiCarDocs("Hyundai Elantra 2021-23", video="https://youtu.be/_EdYQtV52-c", car_parts=CarParts.common([CarHarness.hyundai_k]))],
|
||||
CarSpecs(wheelbase=2.72, steerRatio=12.9, tireStiffnessFactor=0.65),
|
||||
CarSpecs(mass=2800 * CV.LB_TO_KG, wheelbase=2.72, steerRatio=12.9, tireStiffnessFactor=0.65),
|
||||
flags=HyundaiFlags.CHECKSUM_CRC8,
|
||||
)
|
||||
HYUNDAI_ELANTRA_HEV_2021 = HyundaiPlatformConfig(
|
||||
[HyundaiCarDocs("Hyundai Elantra Hybrid 2021-23", video="https://youtu.be/_EdYQtV52-c",
|
||||
car_parts=CarParts.common([CarHarness.hyundai_k]))],
|
||||
CarSpecs(wheelbase=2.72, steerRatio=12.9, tireStiffnessFactor=0.65),
|
||||
CarSpecs(mass=3017 * CV.LB_TO_KG, wheelbase=2.72, steerRatio=12.9, tireStiffnessFactor=0.65),
|
||||
flags=HyundaiFlags.CHECKSUM_CRC8 | HyundaiFlags.HYBRID,
|
||||
)
|
||||
HYUNDAI_GENESIS = HyundaiPlatformConfig(
|
||||
@@ -244,79 +242,79 @@ class CAR(Platforms):
|
||||
HyundaiCarDocs("Hyundai Genesis 2015-16", min_enable_speed=19 * CV.MPH_TO_MS, car_parts=CarParts.common([CarHarness.hyundai_j])),
|
||||
HyundaiCarDocs("Genesis G80 2017", "All", min_enable_speed=19 * CV.MPH_TO_MS, car_parts=CarParts.common([CarHarness.hyundai_j])),
|
||||
],
|
||||
CarSpecs(wheelbase=3.01, steerRatio=16.5, minSteerSpeed=60 * CV.KPH_TO_MS),
|
||||
CarSpecs(mass=2060, wheelbase=3.01, steerRatio=16.5, minSteerSpeed=60 * CV.KPH_TO_MS),
|
||||
flags=HyundaiFlags.CHECKSUM_6B | HyundaiFlags.LEGACY,
|
||||
)
|
||||
HYUNDAI_IONIQ = HyundaiPlatformConfig(
|
||||
[HyundaiCarDocs("Hyundai Ioniq Hybrid 2017-19", car_parts=CarParts.common([CarHarness.hyundai_c]))],
|
||||
CarSpecs(wheelbase=2.7, steerRatio=13.73, tireStiffnessFactor=0.385),
|
||||
CarSpecs(mass=1490, wheelbase=2.7, steerRatio=13.73, tireStiffnessFactor=0.385),
|
||||
flags=HyundaiFlags.HYBRID | HyundaiFlags.MIN_STEER_32_MPH,
|
||||
)
|
||||
HYUNDAI_IONIQ_HEV_2022 = HyundaiPlatformConfig(
|
||||
[HyundaiCarDocs("Hyundai Ioniq Hybrid 2020-22", car_parts=CarParts.common([CarHarness.hyundai_h]))],
|
||||
CarSpecs(wheelbase=2.7, steerRatio=13.73, tireStiffnessFactor=0.385),
|
||||
CarSpecs(mass=1490, wheelbase=2.7, steerRatio=13.73, tireStiffnessFactor=0.385),
|
||||
flags=HyundaiFlags.HYBRID | HyundaiFlags.LEGACY,
|
||||
)
|
||||
HYUNDAI_IONIQ_EV_LTD = HyundaiPlatformConfig(
|
||||
[HyundaiCarDocs("Hyundai Ioniq Electric 2019", car_parts=CarParts.common([CarHarness.hyundai_c]))],
|
||||
CarSpecs(wheelbase=2.7, steerRatio=13.73, tireStiffnessFactor=0.385),
|
||||
CarSpecs(mass=1490, wheelbase=2.7, steerRatio=13.73, tireStiffnessFactor=0.385),
|
||||
flags=HyundaiFlags.MANDO_RADAR | HyundaiFlags.EV | HyundaiFlags.LEGACY | HyundaiFlags.MIN_STEER_32_MPH,
|
||||
)
|
||||
HYUNDAI_IONIQ_EV_2020 = HyundaiPlatformConfig(
|
||||
[HyundaiCarDocs("Hyundai Ioniq Electric 2020", "All", car_parts=CarParts.common([CarHarness.hyundai_h]))],
|
||||
CarSpecs(wheelbase=2.7, steerRatio=13.73, tireStiffnessFactor=0.385),
|
||||
CarSpecs(mass=1490, wheelbase=2.7, steerRatio=13.73, tireStiffnessFactor=0.385),
|
||||
flags=HyundaiFlags.EV,
|
||||
)
|
||||
HYUNDAI_IONIQ_PHEV_2019 = HyundaiPlatformConfig(
|
||||
[HyundaiCarDocs("Hyundai Ioniq Plug-in Hybrid 2019", car_parts=CarParts.common([CarHarness.hyundai_c]))],
|
||||
CarSpecs(wheelbase=2.7, steerRatio=13.73, tireStiffnessFactor=0.385),
|
||||
CarSpecs(mass=1490, wheelbase=2.7, steerRatio=13.73, tireStiffnessFactor=0.385),
|
||||
flags=HyundaiFlags.HYBRID | HyundaiFlags.MIN_STEER_32_MPH,
|
||||
)
|
||||
HYUNDAI_IONIQ_PHEV = HyundaiPlatformConfig(
|
||||
[HyundaiCarDocs("Hyundai Ioniq Plug-in Hybrid 2020-22", "All", car_parts=CarParts.common([CarHarness.hyundai_h]))],
|
||||
CarSpecs(wheelbase=2.7, steerRatio=13.73, tireStiffnessFactor=0.385),
|
||||
CarSpecs(mass=1490, wheelbase=2.7, steerRatio=13.73, tireStiffnessFactor=0.385),
|
||||
flags=HyundaiFlags.HYBRID,
|
||||
)
|
||||
HYUNDAI_KONA = HyundaiPlatformConfig(
|
||||
[HyundaiCarDocs("Hyundai Kona 2020", min_enable_speed=6 * CV.MPH_TO_MS, car_parts=CarParts.common([CarHarness.hyundai_b]))],
|
||||
CarSpecs(wheelbase=2.6, steerRatio=13.42, tireStiffnessFactor=0.385),
|
||||
CarSpecs(mass=1275, wheelbase=2.6, steerRatio=13.42, tireStiffnessFactor=0.385),
|
||||
flags=HyundaiFlags.CLUSTER_GEARS | HyundaiFlags.ALT_LIMITS,
|
||||
)
|
||||
HYUNDAI_KONA_2022 = HyundaiPlatformConfig(
|
||||
[HyundaiCarDocs("Hyundai Kona 2022-23", car_parts=CarParts.common([CarHarness.hyundai_o]))],
|
||||
CarSpecs(wheelbase=2.6, steerRatio=13.42, tireStiffnessFactor=0.385),
|
||||
CarSpecs(mass=1491, wheelbase=2.6, steerRatio=13.42, tireStiffnessFactor=0.385),
|
||||
flags=HyundaiFlags.CAMERA_SCC | HyundaiFlags.ALT_LIMITS_2,
|
||||
)
|
||||
HYUNDAI_KONA_EV = HyundaiPlatformConfig(
|
||||
[HyundaiCarDocs("Hyundai Kona Electric 2018-21", car_parts=CarParts.common([CarHarness.hyundai_g]))],
|
||||
CarSpecs(wheelbase=2.6, steerRatio=13.42, tireStiffnessFactor=0.385),
|
||||
CarSpecs(mass=1685, wheelbase=2.6, steerRatio=13.42, tireStiffnessFactor=0.385),
|
||||
flags=HyundaiFlags.EV | HyundaiFlags.ALT_LIMITS,
|
||||
)
|
||||
HYUNDAI_KONA_EV_2022 = HyundaiPlatformConfig(
|
||||
[HyundaiCarDocs("Hyundai Kona Electric 2022-23", car_parts=CarParts.common([CarHarness.hyundai_o]))],
|
||||
CarSpecs(wheelbase=2.6, steerRatio=13.42, tireStiffnessFactor=0.385),
|
||||
CarSpecs(mass=1743, wheelbase=2.6, steerRatio=13.42, tireStiffnessFactor=0.385),
|
||||
flags=HyundaiFlags.CAMERA_SCC | HyundaiFlags.EV | HyundaiFlags.ALT_LIMITS,
|
||||
)
|
||||
HYUNDAI_KONA_EV_2ND_GEN = HyundaiCanFDPlatformConfig(
|
||||
[HyundaiCarDocs("Hyundai Kona Electric (with HDA II, Korea only) 2023", video="https://www.youtube.com/watch?v=U2fOCmcQ8hw",
|
||||
car_parts=CarParts.common([CarHarness.hyundai_r]))],
|
||||
CarSpecs(wheelbase=2.66, steerRatio=13.6, tireStiffnessFactor=0.385),
|
||||
CarSpecs(mass=1740, wheelbase=2.66, steerRatio=13.6, tireStiffnessFactor=0.385),
|
||||
flags=HyundaiFlags.EV | HyundaiFlags.CANFD_NO_RADAR_DISABLE,
|
||||
)
|
||||
HYUNDAI_KONA_HEV = HyundaiPlatformConfig(
|
||||
[HyundaiCarDocs("Hyundai Kona Hybrid 2020", car_parts=CarParts.common([CarHarness.hyundai_i]))], # TODO: check packages,
|
||||
CarSpecs(wheelbase=2.6, steerRatio=13.42, tireStiffnessFactor=0.385),
|
||||
CarSpecs(mass=1425, wheelbase=2.6, steerRatio=13.42, tireStiffnessFactor=0.385),
|
||||
flags=HyundaiFlags.HYBRID | HyundaiFlags.ALT_LIMITS,
|
||||
)
|
||||
HYUNDAI_NEXO_1ST_GEN = HyundaiPlatformConfig(
|
||||
[HyundaiCarDocs("Hyundai Nexo 2021", "All", car_parts=CarParts.common([CarHarness.hyundai_h]))],
|
||||
CarSpecs(wheelbase=2.79, steerRatio=14.19), # https://www.hyundainews.com/assets/documents/original/42768-2021NEXOProductGuideSpecs.pdf
|
||||
CarSpecs(mass=3990 * CV.LB_TO_KG, wheelbase=2.79, steerRatio=14.19), # https://www.hyundainews.com/assets/documents/original/42768-2021NEXOProductGuideSpecs.pdf
|
||||
flags=HyundaiFlags.FCEV,
|
||||
)
|
||||
HYUNDAI_SANTA_FE = HyundaiPlatformConfig(
|
||||
[HyundaiCarDocs("Hyundai Santa Fe 2019-20", "All", video="https://youtu.be/bjDR0YjM__s",
|
||||
car_parts=CarParts.common([CarHarness.hyundai_d]))],
|
||||
CarSpecs(wheelbase=2.766, steerRatio=16.55, tireStiffnessFactor=0.82),
|
||||
CarSpecs(mass=3982 * CV.LB_TO_KG, wheelbase=2.766, steerRatio=16.55, tireStiffnessFactor=0.82),
|
||||
flags=HyundaiFlags.MANDO_RADAR | HyundaiFlags.CHECKSUM_CRC8,
|
||||
)
|
||||
HYUNDAI_SANTA_FE_2022 = HyundaiPlatformConfig(
|
||||
@@ -338,24 +336,24 @@ class CAR(Platforms):
|
||||
HYUNDAI_SONATA = HyundaiPlatformConfig(
|
||||
[HyundaiCarDocs("Hyundai Sonata 2020-23", "All", video="https://www.youtube.com/watch?v=ix63r9kE3Fw",
|
||||
car_parts=CarParts.common([CarHarness.hyundai_a]))],
|
||||
CarSpecs(wheelbase=2.84, steerRatio=13.27 * 1.15, tireStiffnessFactor=0.65), # 15% higher at the center seems reasonable
|
||||
CarSpecs(mass=1513, wheelbase=2.84, steerRatio=13.27 * 1.15, tireStiffnessFactor=0.65), # 15% higher at the center seems reasonable
|
||||
flags=HyundaiFlags.MANDO_RADAR | HyundaiFlags.CHECKSUM_CRC8,
|
||||
)
|
||||
HYUNDAI_SONATA_LF = HyundaiPlatformConfig(
|
||||
[HyundaiCarDocs("Hyundai Sonata 2018-19", car_parts=CarParts.common([CarHarness.hyundai_e]))],
|
||||
CarSpecs(wheelbase=2.804, steerRatio=13.27 * 1.15), # 15% higher at the center seems reasonable
|
||||
CarSpecs(mass=1536, wheelbase=2.804, steerRatio=13.27 * 1.15), # 15% higher at the center seems reasonable
|
||||
flags=HyundaiFlags.UNSUPPORTED_LONGITUDINAL | HyundaiFlags.TCU_GEARS,
|
||||
)
|
||||
HYUNDAI_STARIA_4TH_GEN = HyundaiCanFDPlatformConfig(
|
||||
[HyundaiCarDocs("Hyundai Staria 2023", "All", car_parts=CarParts.common([CarHarness.hyundai_k]))],
|
||||
CarSpecs(wheelbase=3.273, steerRatio=11.94), # https://www.hyundai.com/content/dam/hyundai/au/en/models/staria-load/premium-pip-update-2023/spec-sheet/STARIA_Load_Spec-Table_March_2023_v3.1.pdf
|
||||
CarSpecs(mass=2205, wheelbase=3.273, steerRatio=11.94), # https://www.hyundai.com/content/dam/hyundai/au/en/models/staria-load/premium-pip-update-2023/spec-sheet/STARIA_Load_Spec-Table_March_2023_v3.1.pdf
|
||||
)
|
||||
HYUNDAI_TUCSON = HyundaiPlatformConfig(
|
||||
[
|
||||
HyundaiCarDocs("Hyundai Tucson 2021", min_enable_speed=19 * CV.MPH_TO_MS, car_parts=CarParts.common([CarHarness.hyundai_l])),
|
||||
HyundaiCarDocs("Hyundai Tucson Diesel 2019", car_parts=CarParts.common([CarHarness.hyundai_l])),
|
||||
],
|
||||
CarSpecs(wheelbase=2.67, steerRatio=16.1, tireStiffnessFactor=0.385),
|
||||
CarSpecs(mass=3520 * CV.LB_TO_KG, wheelbase=2.67, steerRatio=16.1, tireStiffnessFactor=0.385),
|
||||
flags=HyundaiFlags.TCU_GEARS,
|
||||
)
|
||||
HYUNDAI_PALISADE = HyundaiPlatformConfig(
|
||||
@@ -363,12 +361,12 @@ class CAR(Platforms):
|
||||
HyundaiCarDocs("Hyundai Palisade 2020-22", "All", video="https://youtu.be/TAnDqjF4fDY?t=456", car_parts=CarParts.common([CarHarness.hyundai_h])),
|
||||
HyundaiCarDocs("Kia Telluride 2020-22", "All", car_parts=CarParts.common([CarHarness.hyundai_h])),
|
||||
],
|
||||
CarSpecs(wheelbase=2.9, steerRatio=15.6 * 1.15, tireStiffnessFactor=0.63),
|
||||
CarSpecs(mass=1999, wheelbase=2.9, steerRatio=15.6 * 1.15, tireStiffnessFactor=0.63),
|
||||
flags=HyundaiFlags.MANDO_RADAR | HyundaiFlags.CHECKSUM_CRC8,
|
||||
)
|
||||
HYUNDAI_VELOSTER = HyundaiPlatformConfig(
|
||||
[HyundaiCarDocs("Hyundai Veloster 2019-20", min_enable_speed=5. * CV.MPH_TO_MS, car_parts=CarParts.common([CarHarness.hyundai_e]))],
|
||||
CarSpecs(wheelbase=2.8, steerRatio=13.75 * 1.15, tireStiffnessFactor=0.5),
|
||||
CarSpecs(mass=2917 * CV.LB_TO_KG, wheelbase=2.8, steerRatio=13.75 * 1.15, tireStiffnessFactor=0.5),
|
||||
flags=HyundaiFlags.LEGACY | HyundaiFlags.TCU_GEARS,
|
||||
)
|
||||
HYUNDAI_SONATA_HYBRID = HyundaiPlatformConfig(
|
||||
@@ -382,7 +380,7 @@ class CAR(Platforms):
|
||||
HyundaiCarDocs("Hyundai Ioniq 5 (without HDA II) 2022-24", "Highway Driving Assist", car_parts=CarParts.common([CarHarness.hyundai_k])),
|
||||
HyundaiCarDocs("Hyundai Ioniq 5 (with HDA II) 2022-24", "Highway Driving Assist II", car_parts=CarParts.common([CarHarness.hyundai_q])),
|
||||
],
|
||||
CarSpecs(wheelbase=2.97, steerRatio=14.26, tireStiffnessFactor=0.65),
|
||||
CarSpecs(mass=1948, wheelbase=2.97, steerRatio=14.26, tireStiffnessFactor=0.65),
|
||||
flags=HyundaiFlags.EV,
|
||||
)
|
||||
HYUNDAI_IONIQ_6 = HyundaiCanFDPlatformConfig(
|
||||
@@ -400,16 +398,16 @@ class CAR(Platforms):
|
||||
HyundaiCarDocs("Hyundai Tucson Hybrid 2022-24", "All", car_parts=CarParts.common([CarHarness.hyundai_n])),
|
||||
HyundaiCarDocs("Hyundai Tucson Plug-in Hybrid 2024", "All", car_parts=CarParts.common([CarHarness.hyundai_n])),
|
||||
],
|
||||
CarSpecs(wheelbase=2.756, steerRatio=13.7, tireStiffnessFactor=0.385),
|
||||
CarSpecs(mass=1630, wheelbase=2.756, steerRatio=13.7, tireStiffnessFactor=0.385),
|
||||
)
|
||||
HYUNDAI_SANTA_CRUZ_1ST_GEN = HyundaiCanFDPlatformConfig(
|
||||
[HyundaiCarDocs("Hyundai Santa Cruz 2022-24", car_parts=CarParts.common([CarHarness.hyundai_n]))],
|
||||
# weight from Limited trim - the only supported trim, steering ratio according to Hyundai News https://www.hyundainews.com/assets/documents/original/48035-2022SantaCruzProductGuideSpecsv2081521.pdf
|
||||
CarSpecs(wheelbase=3, steerRatio=14.2),
|
||||
CarSpecs(mass=1870, wheelbase=3, steerRatio=14.2),
|
||||
)
|
||||
HYUNDAI_CUSTIN_1ST_GEN = HyundaiPlatformConfig(
|
||||
[HyundaiCarDocs("Hyundai Custin 2023", "All", car_parts=CarParts.common([CarHarness.hyundai_k]))],
|
||||
CarSpecs(wheelbase=3.055, steerRatio=17), # steerRatio: from learner
|
||||
CarSpecs(mass=1690, wheelbase=3.055, steerRatio=17), # mass: from https://www.hyundai-motor.com.tw/clicktobuy/custin#spec_0, steerRatio: from learner
|
||||
flags=HyundaiFlags.CHECKSUM_CRC8,
|
||||
)
|
||||
|
||||
@@ -419,11 +417,11 @@ class CAR(Platforms):
|
||||
HyundaiCarDocs("Kia Forte 2019-21", min_enable_speed=6 * CV.MPH_TO_MS, car_parts=CarParts.common([CarHarness.hyundai_g])),
|
||||
HyundaiCarDocs("Kia Forte 2022-23", car_parts=CarParts.common([CarHarness.hyundai_e])),
|
||||
],
|
||||
CarSpecs(wheelbase=2.8, steerRatio=13.75, tireStiffnessFactor=0.5)
|
||||
CarSpecs(mass=2878 * CV.LB_TO_KG, wheelbase=2.8, steerRatio=13.75, tireStiffnessFactor=0.5)
|
||||
)
|
||||
KIA_K5_2021 = HyundaiPlatformConfig(
|
||||
[HyundaiCarDocs("Kia K5 2021-24", car_parts=CarParts.common([CarHarness.hyundai_a]))],
|
||||
CarSpecs(wheelbase=2.85, steerRatio=13.27, tireStiffnessFactor=0.5), # 2021 Kia K5 Steering Ratio (all trims)
|
||||
CarSpecs(mass=3381 * CV.LB_TO_KG, wheelbase=2.85, steerRatio=13.27, tireStiffnessFactor=0.5), # 2021 Kia K5 Steering Ratio (all trims)
|
||||
flags=HyundaiFlags.CHECKSUM_CRC8,
|
||||
)
|
||||
KIA_K5_HEV_2020 = HyundaiPlatformConfig(
|
||||
@@ -433,12 +431,12 @@ class CAR(Platforms):
|
||||
)
|
||||
KIA_K7_2017 = HyundaiPlatformConfig(
|
||||
[HyundaiCarDocs("Kia K7 2017", car_parts=CarParts.common([CarHarness.hyundai_c]))],
|
||||
CarSpecs(wheelbase=2.86, steerRatio=16.8),
|
||||
CarSpecs(mass=1648, wheelbase=2.86, steerRatio=16.8),
|
||||
)
|
||||
KIA_K8_HEV_1ST_GEN = HyundaiCanFDPlatformConfig(
|
||||
[HyundaiCarDocs("Kia K8 Hybrid (with HDA II) 2023", "Highway Driving Assist II", car_parts=CarParts.common([CarHarness.hyundai_q]))],
|
||||
# steerRatio: guesstimate from K5 platform
|
||||
CarSpecs(wheelbase=2.895, steerRatio=13.27)
|
||||
# mass: https://carprices.ae/brands/kia/2023/k8/1.6-turbo-hybrid, steerRatio: guesstimate from K5 platform
|
||||
CarSpecs(mass=1630, wheelbase=2.895, steerRatio=13.27)
|
||||
)
|
||||
KIA_NIRO_EV = HyundaiPlatformConfig(
|
||||
[
|
||||
@@ -447,7 +445,7 @@ class CAR(Platforms):
|
||||
HyundaiCarDocs("Kia Niro EV 2021", "All", video="https://www.youtube.com/watch?v=lT7zcG6ZpGo", car_parts=CarParts.common([CarHarness.hyundai_c])),
|
||||
HyundaiCarDocs("Kia Niro EV 2022", "All", video="https://www.youtube.com/watch?v=lT7zcG6ZpGo", car_parts=CarParts.common([CarHarness.hyundai_h])),
|
||||
],
|
||||
CarSpecs(wheelbase=2.7, steerRatio=13.6, tireStiffnessFactor=0.385), # average of all the cars
|
||||
CarSpecs(mass=3543 * CV.LB_TO_KG, wheelbase=2.7, steerRatio=13.6, tireStiffnessFactor=0.385), # average of all the cars
|
||||
flags=HyundaiFlags.MANDO_RADAR | HyundaiFlags.EV,
|
||||
)
|
||||
KIA_NIRO_EV_2ND_GEN = HyundaiCanFDPlatformConfig(
|
||||
@@ -490,38 +488,37 @@ class CAR(Platforms):
|
||||
KIA_OPTIMA_G4 = HyundaiPlatformConfig(
|
||||
[HyundaiCarDocs("Kia Optima 2017", "Advanced Smart Cruise Control",
|
||||
car_parts=CarParts.common([CarHarness.hyundai_b]))], # TODO: may support 2016, 2018
|
||||
CarSpecs(wheelbase=2.8, steerRatio=13.75, tireStiffnessFactor=0.5),
|
||||
CarSpecs(mass=3558 * CV.LB_TO_KG, wheelbase=2.8, steerRatio=13.75, tireStiffnessFactor=0.5),
|
||||
flags=HyundaiFlags.LEGACY | HyundaiFlags.TCU_GEARS | HyundaiFlags.MIN_STEER_32_MPH,
|
||||
)
|
||||
KIA_OPTIMA_G4_FL = HyundaiPlatformConfig(
|
||||
[HyundaiCarDocs("Kia Optima 2019-20", car_parts=CarParts.common([CarHarness.hyundai_g]))],
|
||||
CarSpecs(wheelbase=2.8, steerRatio=13.75, tireStiffnessFactor=0.5),
|
||||
CarSpecs(mass=3558 * CV.LB_TO_KG, wheelbase=2.8, steerRatio=13.75, tireStiffnessFactor=0.5),
|
||||
flags=HyundaiFlags.UNSUPPORTED_LONGITUDINAL | HyundaiFlags.TCU_GEARS,
|
||||
)
|
||||
# TODO: may support adjacent years. may have a non-zero minimum steering speed
|
||||
KIA_OPTIMA_H = HyundaiPlatformConfig(
|
||||
[HyundaiCarDocs("Kia Optima Hybrid 2017", "Advanced Smart Cruise Control", car_parts=CarParts.common([CarHarness.hyundai_c]))],
|
||||
CarSpecs(wheelbase=2.8, steerRatio=13.75, tireStiffnessFactor=0.5),
|
||||
CarSpecs(mass=3558 * CV.LB_TO_KG, wheelbase=2.8, steerRatio=13.75, tireStiffnessFactor=0.5),
|
||||
flags=HyundaiFlags.HYBRID | HyundaiFlags.LEGACY,
|
||||
)
|
||||
KIA_OPTIMA_H_G4_FL = HyundaiPlatformConfig(
|
||||
[HyundaiCarDocs("Kia Optima Hybrid 2019", car_parts=CarParts.common([CarHarness.hyundai_h]))],
|
||||
CarSpecs(wheelbase=2.8, steerRatio=13.75, tireStiffnessFactor=0.5),
|
||||
flags=HyundaiFlags.HYBRID | HyundaiFlags.UNSUPPORTED_LONGITUDINAL,
|
||||
CarSpecs(mass=3558 * CV.LB_TO_KG, wheelbase=2.8, steerRatio=13.75, tireStiffnessFactor=0.5),
|
||||
flags=HyundaiFlags.HYBRID,
|
||||
)
|
||||
KIA_SELTOS = HyundaiPlatformConfig(
|
||||
[HyundaiCarDocs("Kia Seltos 2021", car_parts=CarParts.common([CarHarness.hyundai_a]))],
|
||||
CarSpecs(wheelbase=2.63, steerRatio=14.56),
|
||||
CarSpecs(mass=1337, wheelbase=2.63, steerRatio=14.56),
|
||||
flags=HyundaiFlags.CHECKSUM_CRC8,
|
||||
)
|
||||
KIA_SPORTAGE_5TH_GEN = HyundaiCanFDPlatformConfig(
|
||||
[
|
||||
HyundaiCarDocs("Kia Sportage 2023-24", car_parts=CarParts.common([CarHarness.hyundai_n])),
|
||||
HyundaiCarDocs("Kia Sportage Hybrid 2023", car_parts=CarParts.common([CarHarness.hyundai_n])),
|
||||
HyundaiCarDocs("Kia Sportage Plug-in Hybrid 2023", car_parts=CarParts.common([CarHarness.hyundai_n])),
|
||||
],
|
||||
# weight from SX and above trims, average of FWD and AWD version, steering ratio according to Kia News https://www.kiamedia.com/us/en/models/sportage/2023/specifications
|
||||
CarSpecs(wheelbase=2.756, steerRatio=13.6),
|
||||
CarSpecs(mass=1725, wheelbase=2.756, steerRatio=13.6),
|
||||
)
|
||||
KIA_SORENTO = HyundaiPlatformConfig(
|
||||
[
|
||||
@@ -529,12 +526,12 @@ class CAR(Platforms):
|
||||
car_parts=CarParts.common([CarHarness.hyundai_e])),
|
||||
HyundaiCarDocs("Kia Sorento 2019", video="https://www.youtube.com/watch?v=Fkh3s6WHJz8", car_parts=CarParts.common([CarHarness.hyundai_e])),
|
||||
],
|
||||
CarSpecs(wheelbase=2.78, steerRatio=14.4 * 1.1), # 10% higher at the center seems reasonable
|
||||
CarSpecs(mass=1985, wheelbase=2.78, steerRatio=14.4 * 1.1), # 10% higher at the center seems reasonable
|
||||
flags=HyundaiFlags.CHECKSUM_6B | HyundaiFlags.UNSUPPORTED_LONGITUDINAL,
|
||||
)
|
||||
KIA_SORENTO_4TH_GEN = HyundaiCanFDPlatformConfig(
|
||||
[HyundaiCarDocs("Kia Sorento 2021-23", car_parts=CarParts.common([CarHarness.hyundai_k]))],
|
||||
CarSpecs(wheelbase=2.81, steerRatio=13.5), # average of the platforms
|
||||
CarSpecs(mass=3957 * CV.LB_TO_KG, wheelbase=2.81, steerRatio=13.5), # average of the platforms
|
||||
flags=HyundaiFlags.CANFD_RADAR_SCC,
|
||||
)
|
||||
KIA_SORENTO_HEV_4TH_GEN = HyundaiCanFDPlatformConfig(
|
||||
@@ -542,13 +539,13 @@ class CAR(Platforms):
|
||||
HyundaiCarDocs("Kia Sorento Hybrid 2021-23", "All", car_parts=CarParts.common([CarHarness.hyundai_a])),
|
||||
HyundaiCarDocs("Kia Sorento Plug-in Hybrid 2022-23", "All", car_parts=CarParts.common([CarHarness.hyundai_a])),
|
||||
],
|
||||
CarSpecs(wheelbase=2.81, steerRatio=13.5), # average of the platforms
|
||||
CarSpecs(mass=4395 * CV.LB_TO_KG, wheelbase=2.81, steerRatio=13.5), # average of the platforms
|
||||
flags=HyundaiFlags.CANFD_RADAR_SCC,
|
||||
)
|
||||
KIA_STINGER = HyundaiPlatformConfig(
|
||||
[HyundaiCarDocs("Kia Stinger 2018-20", video="https://www.youtube.com/watch?v=MJ94qoofYw0",
|
||||
car_parts=CarParts.common([CarHarness.hyundai_c]))],
|
||||
CarSpecs(wheelbase=2.78, steerRatio=14.4 * 1.15) # 15% higher at the center seems reasonable
|
||||
CarSpecs(mass=1825, wheelbase=2.78, steerRatio=14.4 * 1.15) # 15% higher at the center seems reasonable
|
||||
)
|
||||
KIA_STINGER_2022 = HyundaiPlatformConfig(
|
||||
[HyundaiCarDocs("Kia Stinger 2022-23", "All", car_parts=CarParts.common([CarHarness.hyundai_k]))],
|
||||
@@ -556,21 +553,16 @@ class CAR(Platforms):
|
||||
)
|
||||
KIA_CEED = HyundaiPlatformConfig(
|
||||
[HyundaiCarDocs("Kia Ceed 2019-21", car_parts=CarParts.common([CarHarness.hyundai_e]))],
|
||||
CarSpecs(wheelbase=2.65, steerRatio=13.75, tireStiffnessFactor=0.5),
|
||||
CarSpecs(mass=1450, wheelbase=2.65, steerRatio=13.75, tireStiffnessFactor=0.5),
|
||||
flags=HyundaiFlags.LEGACY,
|
||||
)
|
||||
KIA_CEED_PHEV = HyundaiPlatformConfig(
|
||||
[HyundaiCarDocs("Kia Ceed Plug-in Hybrid 2021", car_parts=CarParts.common([CarHarness.hyundai_b]))],
|
||||
CarSpecs(wheelbase=2.65, steerRatio=13.75, tireStiffnessFactor=0.5),
|
||||
flags=HyundaiFlags.LEGACY | HyundaiFlags.HYBRID,
|
||||
)
|
||||
KIA_EV6 = HyundaiCanFDPlatformConfig(
|
||||
[
|
||||
HyundaiCarDocs("Kia EV6 (Southeast Asia only) 2022-24", "All", car_parts=CarParts.common([CarHarness.hyundai_p])),
|
||||
HyundaiCarDocs("Kia EV6 (without HDA II) 2022-24", "Highway Driving Assist", car_parts=CarParts.common([CarHarness.hyundai_l])),
|
||||
HyundaiCarDocs("Kia EV6 (with HDA II) 2022-24", "Highway Driving Assist II", car_parts=CarParts.common([CarHarness.hyundai_p]))
|
||||
],
|
||||
CarSpecs(wheelbase=2.9, steerRatio=16, tireStiffnessFactor=0.65),
|
||||
CarSpecs(mass=2055, wheelbase=2.9, steerRatio=16, tireStiffnessFactor=0.65),
|
||||
flags=HyundaiFlags.EV,
|
||||
)
|
||||
KIA_CARNIVAL_4TH_GEN = HyundaiCanFDPlatformConfig(
|
||||
@@ -578,7 +570,7 @@ class CAR(Platforms):
|
||||
HyundaiCarDocs("Kia Carnival 2022-24", car_parts=CarParts.common([CarHarness.hyundai_a])),
|
||||
HyundaiCarDocs("Kia Carnival (China only) 2023", car_parts=CarParts.common([CarHarness.hyundai_k]))
|
||||
],
|
||||
CarSpecs(wheelbase=3.09, steerRatio=14.23),
|
||||
CarSpecs(mass=2087, wheelbase=3.09, steerRatio=14.23),
|
||||
flags=HyundaiFlags.CANFD_RADAR_SCC,
|
||||
)
|
||||
|
||||
@@ -588,12 +580,12 @@ class CAR(Platforms):
|
||||
HyundaiCarDocs("Genesis GV60 (Advanced Trim) 2023", "All", car_parts=CarParts.common([CarHarness.hyundai_a])),
|
||||
HyundaiCarDocs("Genesis GV60 (Performance Trim) 2022-23", "All", car_parts=CarParts.common([CarHarness.hyundai_k])),
|
||||
],
|
||||
CarSpecs(wheelbase=2.9, steerRatio=17.6),
|
||||
CarSpecs(mass=2205, wheelbase=2.9, steerRatio=17.6),
|
||||
flags=HyundaiFlags.EV,
|
||||
)
|
||||
GENESIS_G70 = HyundaiPlatformConfig(
|
||||
[HyundaiCarDocs("Genesis G70 2018", "All", car_parts=CarParts.common([CarHarness.hyundai_f]))],
|
||||
CarSpecs(wheelbase=2.84, steerRatio=13.56),
|
||||
CarSpecs(mass=1640, wheelbase=2.84, steerRatio=13.56),
|
||||
flags=HyundaiFlags.LEGACY,
|
||||
)
|
||||
GENESIS_G70_2020 = HyundaiPlatformConfig(
|
||||
@@ -612,7 +604,7 @@ class CAR(Platforms):
|
||||
HyundaiCarDocs("Genesis GV70 (2.5T Trim, without HDA II) 2022-24", "All", car_parts=CarParts.common([CarHarness.hyundai_l])),
|
||||
HyundaiCarDocs("Genesis GV70 (3.5T Trim, without HDA II) 2022-23", "All", car_parts=CarParts.common([CarHarness.hyundai_m])),
|
||||
],
|
||||
CarSpecs(wheelbase=2.87, steerRatio=14.6),
|
||||
CarSpecs(mass=1950, wheelbase=2.87, steerRatio=14.6),
|
||||
flags=HyundaiFlags.CANFD_RADAR_SCC,
|
||||
)
|
||||
GENESIS_GV70_ELECTRIFIED_1ST_GEN = HyundaiCanFDPlatformConfig(
|
||||
@@ -620,32 +612,32 @@ class CAR(Platforms):
|
||||
HyundaiCarDocs("Genesis GV70 Electrified (Australia Only) 2022", "All", car_parts=CarParts.common([CarHarness.hyundai_q])),
|
||||
HyundaiCarDocs("Genesis GV70 Electrified (with HDA II) 2023-24", "Highway Driving Assist II", car_parts=CarParts.common([CarHarness.hyundai_q])),
|
||||
],
|
||||
CarSpecs(wheelbase=2.87, steerRatio=17.1),
|
||||
CarSpecs(mass=2260, wheelbase=2.87, steerRatio=17.1),
|
||||
flags=HyundaiFlags.EV,
|
||||
)
|
||||
GENESIS_G80 = HyundaiPlatformConfig(
|
||||
[HyundaiCarDocs("Genesis G80 2018-19", "All", car_parts=CarParts.common([CarHarness.hyundai_h]))],
|
||||
CarSpecs(wheelbase=3.01, steerRatio=16.5),
|
||||
CarSpecs(mass=2060, wheelbase=3.01, steerRatio=16.5),
|
||||
flags=HyundaiFlags.LEGACY,
|
||||
)
|
||||
GENESIS_G80_2ND_GEN_FL = HyundaiCanFDPlatformConfig(
|
||||
[HyundaiCarDocs("Genesis G80 (2.5T Advanced Trim, with HDA II) 2024", "Highway Driving Assist II", car_parts=CarParts.common([CarHarness.hyundai_p]))],
|
||||
CarSpecs(wheelbase=3.00, steerRatio=14.0),
|
||||
CarSpecs(mass=2060, wheelbase=3.00, steerRatio=14.0),
|
||||
)
|
||||
GENESIS_G90 = HyundaiPlatformConfig(
|
||||
[HyundaiCarDocs("Genesis G90 2017-20", "All", car_parts=CarParts.common([CarHarness.hyundai_c]))],
|
||||
CarSpecs(wheelbase=3.15, steerRatio=12.069),
|
||||
CarSpecs(mass=2200, wheelbase=3.15, steerRatio=12.069),
|
||||
)
|
||||
GENESIS_GV80 = HyundaiCanFDPlatformConfig(
|
||||
[HyundaiCarDocs("Genesis GV80 2023", "All", car_parts=CarParts.common([CarHarness.hyundai_m]))],
|
||||
CarSpecs(wheelbase=2.95, steerRatio=14.14),
|
||||
CarSpecs(mass=2258, wheelbase=2.95, steerRatio=14.14),
|
||||
flags=HyundaiFlags.CANFD_RADAR_SCC,
|
||||
)
|
||||
|
||||
# port extensions
|
||||
HYUNDAI_BAYON_1ST_GEN_NON_SCC = HyundaiNonSccPlatformConfig(
|
||||
[HyundaiNonSccCarDocs("Hyundai Bayon Non-SCC 2021", car_parts=CarParts.common([CarHarness.hyundai_n]))],
|
||||
CarSpecs(wheelbase=2.58, steerRatio=13.27 * 1.15),
|
||||
CarSpecs(mass=1150, wheelbase=2.58, steerRatio=13.27 * 1.15),
|
||||
flags=HyundaiFlags.CHECKSUM_CRC8,
|
||||
)
|
||||
HYUNDAI_ELANTRA_2022_NON_SCC = HyundaiNonSccPlatformConfig(
|
||||
@@ -665,7 +657,7 @@ class CAR(Platforms):
|
||||
)
|
||||
KIA_CEED_PHEV_2022_NON_SCC = HyundaiNonSccPlatformConfig(
|
||||
[HyundaiNonSccCarDocs("Kia Ceed Plug-in Hybrid Non-SCC 2022", car_parts=CarParts.common([CarHarness.hyundai_i]))],
|
||||
CarSpecs(wheelbase=2.65, steerRatio=13.75, tireStiffnessFactor=0.5),
|
||||
CarSpecs(mass=1650, wheelbase=2.65, steerRatio=13.75, tireStiffnessFactor=0.5),
|
||||
flags=HyundaiFlags.HYBRID,
|
||||
)
|
||||
KIA_FORTE_2019_NON_SCC = HyundaiNonSccPlatformConfig(
|
||||
|
||||
@@ -8,7 +8,7 @@ from typing import Any
|
||||
from collections.abc import Callable
|
||||
from functools import cache
|
||||
|
||||
from opendbc.car import DT_CTRL, apply_hysteresis, gen_empty_fingerprint, scale_rot_inertia_per_mass, scale_tire_stiffness_per_mass
|
||||
from opendbc.car import DT_CTRL, apply_hysteresis, gen_empty_fingerprint, scale_rot_inertia, scale_tire_stiffness, STD_CARGO_KG
|
||||
from opendbc.car import structs
|
||||
from opendbc.car.can_definitions import CanData, CanRecvCallable, CanSendCallable
|
||||
from opendbc.car.common.basedir import BASEDIR
|
||||
@@ -142,6 +142,7 @@ class CarInterfaceBase(ABC, CarInterfaceBaseSP):
|
||||
ret = CarInterfaceBase.get_std_params(candidate)
|
||||
|
||||
platform = PLATFORMS[candidate]
|
||||
ret.mass = platform.config.specs.mass
|
||||
ret.wheelbase = platform.config.specs.wheelbase
|
||||
ret.steerRatio = platform.config.specs.steerRatio
|
||||
ret.centerToFront = ret.wheelbase * platform.config.specs.centerToFrontRatio
|
||||
@@ -152,10 +153,13 @@ class CarInterfaceBase(ABC, CarInterfaceBaseSP):
|
||||
|
||||
ret = cls._get_params(ret, candidate, fingerprint, car_fw, alpha_long, is_release, docs)
|
||||
|
||||
# Vehicle mass is published curb weight plus assumed payload such as a human driver; notCars have no assumed payload
|
||||
if not ret.notCar:
|
||||
ret.mass = ret.mass + STD_CARGO_KG
|
||||
|
||||
# Set params dependent on values set by the car interface
|
||||
ret.rotationalInertiaPerMass = scale_rot_inertia_per_mass(ret.wheelbase)
|
||||
ret.tireStiffnessFrontPerMass, ret.tireStiffnessRearPerMass = scale_tire_stiffness_per_mass(ret.wheelbase, ret.centerToFront,
|
||||
ret.tireStiffnessFactor)
|
||||
ret.rotationalInertia = scale_rot_inertia(ret.mass, ret.wheelbase)
|
||||
ret.tireStiffnessFront, ret.tireStiffnessRear = scale_tire_stiffness(ret.mass, ret.wheelbase, ret.centerToFront, ret.tireStiffnessFactor)
|
||||
|
||||
return ret
|
||||
|
||||
@@ -239,6 +243,7 @@ class CarInterfaceBase(ABC, CarInterfaceBaseSP):
|
||||
|
||||
ret.pcmCruise = True # openpilot's state is tied to the PCM's cruise state on most cars
|
||||
ret.minEnableSpeed = -1. # enable is done by stock ACC, so ignore this
|
||||
ret.steerRatioRear = 0. # no rear steering, at least on the listed cars aboveA
|
||||
ret.openpilotLongitudinalControl = False
|
||||
ret.stopAccel = -2.0
|
||||
ret.longitudinalTuning.kiBP = [0.]
|
||||
|
||||
@@ -224,7 +224,6 @@ FW_VERSIONS = {
|
||||
],
|
||||
(Ecu.engine, 0x7e0, None): [
|
||||
b'PA34-188K2-A\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00',
|
||||
b'PX4C-188K2-A\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00',
|
||||
b'PX4F-188K2-D\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00',
|
||||
b'PYH7-188K2-C\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00',
|
||||
b'PYH7-188K2-E\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00',
|
||||
@@ -241,14 +240,12 @@ FW_VERSIONS = {
|
||||
(Ecu.fwdCamera, 0x706, None): [
|
||||
b'B61L-67XK2-S\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00',
|
||||
b'B61L-67XK2-T\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00',
|
||||
b'GSH7-67XK2-K\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00',
|
||||
b'GSH7-67XK2-P\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00',
|
||||
],
|
||||
(Ecu.transmission, 0x7e1, None): [
|
||||
b'PA28-21PS1-A\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00',
|
||||
b'PYH3-21PS1-D\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00',
|
||||
b'PYH7-21PS1-B\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00',
|
||||
b'PYH7-21PS1-D\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00',
|
||||
],
|
||||
},
|
||||
CAR.MAZDA_CX9_2021: {
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
from dataclasses import dataclass, field
|
||||
from enum import Enum, IntFlag
|
||||
from enum import IntFlag
|
||||
|
||||
from opendbc.car import Bus, CarSpecs, DbcDict, PlatformConfig, Platforms
|
||||
from opendbc.car.common.conversions import Conversions as CV
|
||||
from opendbc.car.structs import CarParams
|
||||
from opendbc.car.docs_definitions import CarFootnote, CarHarness, CarDocs, CarParts, Column
|
||||
from opendbc.car.docs_definitions import CarHarness, CarDocs, CarParts
|
||||
from opendbc.car.fw_query_definitions import FwQueryConfig, Request, StdQueries
|
||||
|
||||
Ecu = CarParams.Ecu
|
||||
@@ -28,14 +29,6 @@ class CarControllerParams:
|
||||
class MazdaCarDocs(CarDocs):
|
||||
package: str = "All"
|
||||
car_parts: CarParts = field(default_factory=CarParts.common([CarHarness.mazda]))
|
||||
footnotes: list[Enum] = field(default_factory=lambda: [Footnote.COMMA_POWER_REQUIRED])
|
||||
requires_comma_power: bool = True
|
||||
|
||||
|
||||
class Footnote(Enum):
|
||||
COMMA_POWER_REQUIRED = CarFootnote(
|
||||
"Mazda vehicles <b>require</b> comma power installation.",
|
||||
Column.MAKE, setup_note=True)
|
||||
|
||||
|
||||
@dataclass(frozen=True, kw_only=True)
|
||||
@@ -58,19 +51,19 @@ class MazdaPlatformConfig(PlatformConfig):
|
||||
class CAR(Platforms):
|
||||
MAZDA_CX5 = MazdaPlatformConfig(
|
||||
[MazdaCarDocs("Mazda CX-5 2017-21")],
|
||||
MazdaCarSpecs(wheelbase=2.7, steerRatio=15.5)
|
||||
MazdaCarSpecs(mass=3655 * CV.LB_TO_KG, wheelbase=2.7, steerRatio=15.5)
|
||||
)
|
||||
MAZDA_CX9 = MazdaPlatformConfig(
|
||||
[MazdaCarDocs("Mazda CX-9 2016-20")],
|
||||
MazdaCarSpecs(wheelbase=3.1, steerRatio=17.6)
|
||||
MazdaCarSpecs(mass=4217 * CV.LB_TO_KG, wheelbase=3.1, steerRatio=17.6)
|
||||
)
|
||||
MAZDA_3 = MazdaPlatformConfig(
|
||||
[MazdaCarDocs("Mazda 3 2017-18")],
|
||||
MazdaCarSpecs(wheelbase=2.7, steerRatio=14.0)
|
||||
MazdaCarSpecs(mass=2875 * CV.LB_TO_KG, wheelbase=2.7, steerRatio=14.0)
|
||||
)
|
||||
MAZDA_6 = MazdaPlatformConfig(
|
||||
[MazdaCarDocs("Mazda 6 2017-20")],
|
||||
MazdaCarSpecs(wheelbase=2.83, steerRatio=15.5)
|
||||
MazdaCarSpecs(mass=3443 * CV.LB_TO_KG, wheelbase=2.83, steerRatio=15.5)
|
||||
)
|
||||
MAZDA_CX9_2021 = MazdaPlatformConfig(
|
||||
[MazdaCarDocs("Mazda CX-9 2021-23", video="https://youtu.be/dA3duO4a0O4")],
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
from opendbc.car.crc import CRC8J1850
|
||||
|
||||
|
||||
def calc_checksum(values):
|
||||
lka_req_toq = values['LKAReqToqHSC2'] + 0x400
|
||||
lka_req_toq_sts = values['LKAReqToqStsHSC2']
|
||||
@@ -29,17 +26,3 @@ def create_lka_steering(packer, counter, apply_torque, active):
|
||||
|
||||
values["LKAReqToqPVHSC2"] = calc_checksum(values)
|
||||
return packer.make_can_msg("FVCM_HSC2_FrP03", 0, values)
|
||||
|
||||
|
||||
def mg_checksum(address: int, sig, d: bytearray) -> int:
|
||||
if address == 0x1EC:
|
||||
torque = ((d[0] & 0x7) << 8) | d[1]
|
||||
valid = (d[0] >> 3) & 1
|
||||
status = (d[6] >> 4) & 0x7
|
||||
counter = d[0] >> 4
|
||||
return -((torque << 1) + (status << 12) + valid + counter) & 0x7FFF
|
||||
|
||||
crc = 0xFF
|
||||
for byte in d[:-1]:
|
||||
crc = CRC8J1850[crc ^ byte]
|
||||
return crc ^ 0xFF
|
||||
|
||||
@@ -17,7 +17,7 @@ class MgPlatformConfig(PlatformConfig):
|
||||
|
||||
|
||||
class CAR(Platforms):
|
||||
MG_5_EV = MgPlatformConfig([MgCarDocs("MG 5 EV 2021")], CarSpecs(wheelbase=2.66, steerRatio=15.8))
|
||||
MG_5_EV = MgPlatformConfig([MgCarDocs("MG 5 EV 2021")], CarSpecs(mass=1640., wheelbase=2.66, steerRatio=15.8))
|
||||
|
||||
|
||||
FW_QUERY_CONFIG = FwQueryConfig(
|
||||
|
||||
@@ -4,6 +4,6 @@ from opendbc.car import CarSpecs, PlatformConfig, Platforms
|
||||
class CAR(Platforms):
|
||||
MOCK = PlatformConfig(
|
||||
[],
|
||||
CarSpecs(wheelbase=2.7, steerRatio=13),
|
||||
CarSpecs(mass=1700, wheelbase=2.7, steerRatio=13),
|
||||
{}
|
||||
)
|
||||
|
||||
@@ -58,27 +58,27 @@ class NissanPlatformConfig(PlatformConfig):
|
||||
class CAR(Platforms):
|
||||
NISSAN_XTRAIL = NissanPlatformConfig(
|
||||
[NissanCarDocs("Nissan X-Trail 2017")],
|
||||
NissanCarSpecs(wheelbase=2.705)
|
||||
NissanCarSpecs(mass=1610, wheelbase=2.705)
|
||||
)
|
||||
NISSAN_LEAF = NissanPlatformConfig(
|
||||
[NissanCarDocs("Nissan Leaf 2018-23", video="https://youtu.be/vaMbtAh_0cY")],
|
||||
NissanCarSpecs(wheelbase=2.705),
|
||||
NissanCarSpecs(mass=1610, wheelbase=2.705),
|
||||
{Bus.pt: 'nissan_leaf_2018_generated'},
|
||||
)
|
||||
# Leaf with ADAS ECU found behind instrument cluster instead of glovebox
|
||||
# Currently the only known difference between them is the inverted seatbelt signal.
|
||||
NISSAN_LEAF_IC = NissanPlatformConfig(
|
||||
[NissanCarDocs("Nissan Leaf IC 2018-23", video="https://youtu.be/vaMbtAh_0cY")],
|
||||
NissanCarSpecs(wheelbase=2.705),
|
||||
NissanCarSpecs(mass=1610, wheelbase=2.705),
|
||||
{Bus.pt: 'nissan_leaf_2018_generated'},
|
||||
)
|
||||
NISSAN_ROGUE = NissanPlatformConfig(
|
||||
[NissanCarDocs("Nissan Rogue 2018-20")],
|
||||
NissanCarSpecs(wheelbase=2.705)
|
||||
NissanCarSpecs(mass=1610, wheelbase=2.705)
|
||||
)
|
||||
NISSAN_ALTIMA = NissanPlatformConfig(
|
||||
[NissanCarDocs("Nissan Altima 2019-24", car_parts=CarParts.common([CarHarness.nissan_b]))],
|
||||
NissanCarSpecs(wheelbase=2.824)
|
||||
NissanCarSpecs(mass=1492, wheelbase=2.824)
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ class PSAPlatformConfig(PlatformConfig):
|
||||
class CAR(Platforms):
|
||||
PSA_PEUGEOT_208 = PSAPlatformConfig(
|
||||
[PSACarDocs("Peugeot 208 2019-25")],
|
||||
CarSpecs(wheelbase=2.54, steerRatio=17.6),
|
||||
CarSpecs(mass=1530, wheelbase=2.54, steerRatio=17.6),
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import copy
|
||||
from opendbc.can import CANParser
|
||||
from opendbc.car import Bus, structs
|
||||
from opendbc.car.interfaces import CarStateBase, V_CRUISE_MAX
|
||||
from opendbc.car.interfaces import CarStateBase
|
||||
from opendbc.car.rivian.values import DBC, GEAR_MAP, RivianFlags
|
||||
from opendbc.car.common.conversions import Conversions as CV
|
||||
from opendbc.sunnypilot.car.rivian.carstate_ext import CarStateExt
|
||||
@@ -13,7 +13,7 @@ class CarState(CarStateBase, CarStateExt):
|
||||
def __init__(self, CP, CP_SP):
|
||||
CarStateBase.__init__(self, CP, CP_SP)
|
||||
CarStateExt.__init__(self, CP, CP_SP)
|
||||
self.last_speed = V_CRUISE_MAX
|
||||
self.last_speed = 30
|
||||
|
||||
self.acm_lka_hba_cmd: dict | None = None
|
||||
self.sccm_wheel_touch: dict | None = None
|
||||
@@ -48,9 +48,11 @@ class CarState(CarStateBase, CarStateExt):
|
||||
ret.steerFaultTemporary = cp.vl["EPAS_AdasStatus"]["EPAS_EacErrorCode"] != 0
|
||||
|
||||
# Cruise state
|
||||
speed = min(int(cp_adas.vl["ACM_tsrCmd"]["ACM_tsrSpdDisClsMain"]), 85)
|
||||
self.last_speed = speed if speed != 0 else self.last_speed
|
||||
ret.cruiseState.enabled = cp_cam.vl["ACM_Status"]["ACM_FeatureStatus"] == 1
|
||||
# TODO: find cruise set speed on CAN
|
||||
ret.cruiseState.speed = self.last_speed * CV.KPH_TO_MS
|
||||
ret.cruiseState.speed = self.last_speed * CV.MPH_TO_MS # detected speed limit
|
||||
if not self.CP.openpilotLongitudinalControl:
|
||||
ret.cruiseState.speed = -1
|
||||
ret.cruiseState.available = True # cp.vl["VDM_AdasSts"]["VDM_AdasInterfaceStatus"] == 1
|
||||
|
||||
@@ -29,9 +29,9 @@ class CarInterface(CarInterfaceBase):
|
||||
ret.steerControlType = structs.CarParams.SteerControlType.torque
|
||||
ret.radarUnavailable = True
|
||||
|
||||
# TODO is GEN2 the same?
|
||||
ret.alphaLongitudinalAvailable = docs or not (ret.flags & RivianFlags.GEN2)
|
||||
if alpha_long and ret.alphaLongitudinalAvailable:
|
||||
# TODO: pending finding/handling missing set speed
|
||||
ret.alphaLongitudinalAvailable = False
|
||||
if alpha_long:
|
||||
ret.openpilotLongitudinalControl = True
|
||||
ret.safetyConfigs[0].safetyParam |= RivianSafetyFlags.LONG_CONTROL.value
|
||||
|
||||
@@ -46,6 +46,7 @@ class CarInterface(CarInterfaceBase):
|
||||
if 0x131a in fingerprint[1]:
|
||||
ret.flags |= RivianFlagsSP.LONGITUDINAL_HARNESS_UPGRADE.value
|
||||
stock_cp.radarUnavailable = False
|
||||
stock_cp.enableBsm = True
|
||||
stock_cp.alphaLongitudinalAvailable = True
|
||||
|
||||
if alpha_long and stock_cp.alphaLongitudinalAvailable:
|
||||
|
||||
@@ -1,4 +1,14 @@
|
||||
from opendbc.car.crc import CRC8J1850
|
||||
def checksum(data, poly, xor_output):
|
||||
crc = 0
|
||||
for byte in data:
|
||||
crc ^= byte
|
||||
for _ in range(8):
|
||||
if crc & 0x80:
|
||||
crc = (crc << 1) ^ poly
|
||||
else:
|
||||
crc <<= 1
|
||||
crc &= 0xFF
|
||||
return crc ^ xor_output
|
||||
|
||||
|
||||
def create_lka_steering(packer, frame, acm_lka_hba_cmd, apply_torque, enabled, active, mads):
|
||||
@@ -28,6 +38,8 @@ def create_lka_steering(packer, frame, acm_lka_hba_cmd, apply_torque, enabled, a
|
||||
#"ACM_lkaHandsoffDisplayWarning": 1, # TODO: we can send this when openpilot wants you to pay attention
|
||||
}
|
||||
|
||||
data = packer.make_can_msg("ACM_lkaHbaCmd", 0, values)[1]
|
||||
values["ACM_lkaHbaCmd_Checksum"] = checksum(data[1:], 0x1D, 0x63)
|
||||
return packer.make_can_msg("ACM_lkaHbaCmd", 0, values)
|
||||
|
||||
|
||||
@@ -46,6 +58,8 @@ def create_wheel_touch(packer, sccm_wheel_touch, enabled):
|
||||
values["SCCM_WheelTouch_HandsOn"] = 1
|
||||
values["SCCM_WheelTouch_CapacitiveValue"] = 100 # only need to send this value, but both are set for consistency
|
||||
|
||||
data = packer.make_can_msg("SCCM_WheelTouch", 2, values)[1]
|
||||
values["SCCM_WheelTouch_Checksum"] = checksum(data[1:], 0x1D, 0x97)
|
||||
return packer.make_can_msg("SCCM_WheelTouch", 2, values)
|
||||
|
||||
|
||||
@@ -58,11 +72,14 @@ def create_longitudinal(packer, frame, accel, enabled):
|
||||
"ACM_VehicleHoldRequest": 0,
|
||||
}
|
||||
|
||||
data = packer.make_can_msg("ACM_longitudinalRequest", 0, values)[1]
|
||||
values["ACM_longitudinalRequest_Checksum"] = checksum(data[1:], 0x1D, 0x12)
|
||||
return packer.make_can_msg("ACM_longitudinalRequest", 0, values)
|
||||
|
||||
|
||||
def create_adas_status(packer, vdm_adas_status, interface_status):
|
||||
values = {s: vdm_adas_status[s] for s in (
|
||||
"VDM_AdasStatus_Checksum",
|
||||
"VDM_AdasStatus_Counter",
|
||||
"VDM_AdasDecelLimit",
|
||||
"VDM_AdasDriverAccelPriorityStatus",
|
||||
@@ -78,12 +95,6 @@ def create_adas_status(packer, vdm_adas_status, interface_status):
|
||||
if interface_status is not None:
|
||||
values["VDM_AdasInterfaceStatus"] = interface_status
|
||||
|
||||
data = packer.make_can_msg("VDM_AdasSts", 2, values)[1]
|
||||
values["VDM_AdasStatus_Checksum"] = checksum(data[1:], 0x1D, 0xD1)
|
||||
return packer.make_can_msg("VDM_AdasSts", 2, values)
|
||||
|
||||
|
||||
def rivian_checksum(address: int, sig, d: bytearray) -> int:
|
||||
# CRC-8 with the little-endian CAN address prepended to the payload.
|
||||
crc = 0
|
||||
for byte in address.to_bytes(2, "little") + d[1:]:
|
||||
crc = CRC8J1850[crc ^ byte]
|
||||
return crc
|
||||
|
||||
@@ -57,7 +57,7 @@ class CAR(Platforms):
|
||||
car_parts=CarParts.common([CarHarness.rivian_a])),
|
||||
RivianCarDocs("Rivian R1T 2025", car_parts=CarParts.common([CarHarness.rivian_b])),
|
||||
],
|
||||
CarSpecs(wheelbase=3.08, steerRatio=15.2),
|
||||
CarSpecs(mass=3206., wheelbase=3.08, steerRatio=15.2),
|
||||
wmis={WMI.RIVIAN_TRUCK, WMI.RIVIAN_MPV},
|
||||
lines={ModelLine.R1T, ModelLine.R1S},
|
||||
years={ModelYear.N_2022, ModelYear.P_2023, ModelYear.R_2024, ModelYear.S_2025},
|
||||
|
||||
@@ -58,7 +58,7 @@ class CarState(CarStateBase, MadsCarState, SnGCarState):
|
||||
ret.leftBlinker, ret.rightBlinker = self.update_blinker_from_lamp(50, cp.vl["Dashlights"]["LEFT_BLINKER"],
|
||||
cp.vl["Dashlights"]["RIGHT_BLINKER"])
|
||||
|
||||
if self.CP.flags & SubaruFlags.HAS_BSM:
|
||||
if self.CP.enableBsm:
|
||||
ret.leftBlindspot = (cp.vl["BSD_RCTA"]["L_ADJACENT"] == 1) or (cp.vl["BSD_RCTA"]["L_APPROACHING"] == 1)
|
||||
ret.rightBlindspot = (cp.vl["BSD_RCTA"]["R_ADJACENT"] == 1) or (cp.vl["BSD_RCTA"]["R_APPROACHING"] == 1)
|
||||
|
||||
|
||||
@@ -516,7 +516,6 @@ FW_VERSIONS = {
|
||||
b'\xe2"`q\x07',
|
||||
b'\xe2"`t\x07',
|
||||
b'\xe2,\xa0p\x07',
|
||||
b'\xe2,\xa0@\x07',
|
||||
b'\xe3,\xa0@\x07',
|
||||
],
|
||||
(Ecu.transmission, 0x7e1, None): [
|
||||
|
||||
@@ -26,12 +26,10 @@ class CarInterface(CarInterfaceBase):
|
||||
ret.flags |= SubaruFlags.SEND_INFOTAINMENT.value
|
||||
|
||||
if ret.flags & SubaruFlags.PREGLOBAL:
|
||||
if 0x25c in fingerprint[0]:
|
||||
ret.flags |= SubaruFlags.HAS_BSM.value
|
||||
ret.enableBsm = 0x25c in fingerprint[0]
|
||||
ret.safetyConfigs = [get_safety_config(structs.CarParams.SafetyModel.subaruPreglobal)]
|
||||
else:
|
||||
if 0x228 in fingerprint[0]:
|
||||
ret.flags |= SubaruFlags.HAS_BSM.value
|
||||
ret.enableBsm = 0x228 in fingerprint[0]
|
||||
ret.safetyConfigs = [get_safety_config(structs.CarParams.SafetyModel.subaru)]
|
||||
if ret.flags & SubaruFlags.GLOBAL_GEN2:
|
||||
ret.safetyConfigs[0].safetyParam |= SubaruSafetyFlags.GEN2.value
|
||||
|
||||
@@ -62,7 +62,6 @@ class SubaruFlags(IntFlag):
|
||||
# Detected flags
|
||||
SEND_INFOTAINMENT = 1
|
||||
DISABLE_EYESIGHT = 2
|
||||
HAS_BSM = 128 # blind spot monitoring
|
||||
|
||||
# Static flags
|
||||
GLOBAL_GEN2 = 4
|
||||
@@ -127,11 +126,11 @@ class CAR(Platforms):
|
||||
# Global platform
|
||||
SUBARU_ASCENT = SubaruPlatformConfig(
|
||||
[SubaruCarDocs("Subaru Ascent 2019-21", "All")],
|
||||
CarSpecs(wheelbase=2.89, steerRatio=13.5),
|
||||
CarSpecs(mass=2031, wheelbase=2.89, steerRatio=13.5),
|
||||
)
|
||||
SUBARU_OUTBACK = SubaruGen2PlatformConfig(
|
||||
[SubaruCarDocs("Subaru Outback 2020-22", "All", car_parts=CarParts.common([CarHarness.subaru_b]))],
|
||||
CarSpecs(wheelbase=2.67, steerRatio=17),
|
||||
CarSpecs(mass=1568, wheelbase=2.67, steerRatio=17),
|
||||
)
|
||||
SUBARU_LEGACY = SubaruGen2PlatformConfig(
|
||||
[SubaruCarDocs("Subaru Legacy 2020-22", "All", car_parts=CarParts.common([CarHarness.subaru_b]))],
|
||||
@@ -143,7 +142,7 @@ class CAR(Platforms):
|
||||
SubaruCarDocs("Subaru Crosstrek 2018-19", video="https://youtu.be/Agww7oE1k-s?t=26"),
|
||||
SubaruCarDocs("Subaru XV 2018-19", video="https://youtu.be/Agww7oE1k-s?t=26"),
|
||||
],
|
||||
CarSpecs(wheelbase=2.67, steerRatio=15),
|
||||
CarSpecs(mass=1568, wheelbase=2.67, steerRatio=15),
|
||||
)
|
||||
SUBARU_IMPREZA_2020 = SubaruPlatformConfig(
|
||||
[
|
||||
@@ -151,18 +150,18 @@ class CAR(Platforms):
|
||||
SubaruCarDocs("Subaru Crosstrek 2020-23"),
|
||||
SubaruCarDocs("Subaru XV 2020-21"),
|
||||
],
|
||||
CarSpecs(wheelbase=2.67, steerRatio=17),
|
||||
CarSpecs(mass=1480, wheelbase=2.67, steerRatio=17),
|
||||
flags=SubaruFlags.STEER_RATE_LIMITED,
|
||||
)
|
||||
# TODO: is there an XV and Impreza too?
|
||||
SUBARU_CROSSTREK_HYBRID = SubaruPlatformConfig(
|
||||
[SubaruCarDocs("Subaru Crosstrek Hybrid 2020", car_parts=CarParts.common([CarHarness.subaru_b]))],
|
||||
CarSpecs(wheelbase=2.67, steerRatio=17),
|
||||
CarSpecs(mass=1668, wheelbase=2.67, steerRatio=17),
|
||||
flags=SubaruFlags.HYBRID,
|
||||
)
|
||||
SUBARU_FORESTER = SubaruPlatformConfig(
|
||||
[SubaruCarDocs("Subaru Forester 2019-21", "All")],
|
||||
CarSpecs(wheelbase=2.67, steerRatio=17),
|
||||
CarSpecs(mass=1568, wheelbase=2.67, steerRatio=17),
|
||||
flags=SubaruFlags.STEER_RATE_LIMITED,
|
||||
)
|
||||
SUBARU_FORESTER_HYBRID = SubaruPlatformConfig(
|
||||
@@ -173,13 +172,13 @@ class CAR(Platforms):
|
||||
# Pre-global
|
||||
SUBARU_FORESTER_PREGLOBAL = SubaruPlatformConfig(
|
||||
[SubaruCarDocs("Subaru Forester 2017-18")],
|
||||
CarSpecs(wheelbase=2.67, steerRatio=20),
|
||||
CarSpecs(mass=1568, wheelbase=2.67, steerRatio=20),
|
||||
{Bus.pt: 'subaru_forester_2017_generated'},
|
||||
flags=SubaruFlags.PREGLOBAL,
|
||||
)
|
||||
SUBARU_LEGACY_PREGLOBAL = SubaruPlatformConfig(
|
||||
[SubaruCarDocs("Subaru Legacy 2015-18")],
|
||||
CarSpecs(wheelbase=2.67, steerRatio=12.5),
|
||||
CarSpecs(mass=1568, wheelbase=2.67, steerRatio=12.5),
|
||||
{Bus.pt: 'subaru_outback_2015_generated'},
|
||||
flags=SubaruFlags.PREGLOBAL,
|
||||
)
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import copy
|
||||
from opendbc.can import CANDefine, CANParser
|
||||
from opendbc.car import Bus, structs
|
||||
from opendbc.car.carlog import carlog
|
||||
from opendbc.car.common.conversions import Conversions as CV
|
||||
from opendbc.car.interfaces import CarStateBase
|
||||
from opendbc.car.tesla.teslacan import get_steer_ctrl_type
|
||||
from opendbc.car.tesla.values import DBC, CANBUS, GEAR_MAP, STEER_THRESHOLD, TeslaFlags
|
||||
|
||||
from opendbc.sunnypilot.car.tesla.carstate_ext import CarStateExt
|
||||
@@ -20,6 +22,8 @@ class CarState(CarStateBase, CarStateExt):
|
||||
self.autopark = False
|
||||
self.autopark_prev = False
|
||||
self.cruise_enabled_prev = False
|
||||
self.fsd14_error_logged = False
|
||||
self.suspected_fsd14 = False
|
||||
|
||||
self.hands_on_level = 0
|
||||
self.das_control = None
|
||||
@@ -108,13 +112,30 @@ class CarState(CarStateBase, CarStateExt):
|
||||
ret.stockAeb = cp_ap_party.vl["DAS_control"]["DAS_aebEvent"] == 1
|
||||
|
||||
# LKAS
|
||||
ret.stockLkas = cp_ap_party.vl["DAS_steeringControl"]["DAS_steeringControlType"] == 2 # LANE_KEEP_ASSIST
|
||||
# On FSD 14+, ANGLE_CONTROL behavior changed to allow user winddown while actuating.
|
||||
# FSD switched from using ANGLE_CONTROL to LANE_KEEP_ASSIST to likely keep the old steering override disengage logic.
|
||||
# LKAS switched from LANE_KEEP_ASSIST to ANGLE_CONTROL to likely allow overriding LKAS events smoothly
|
||||
lkas_ctrl_type = get_steer_ctrl_type(self.CP.flags, 2)
|
||||
ret.stockLkas = cp_ap_party.vl["DAS_steeringControl"]["DAS_steeringControlType"] == lkas_ctrl_type # LANE_KEEP_ASSIST
|
||||
|
||||
# Stock Autosteer should be off (includes FSD)
|
||||
# TODO: find for TESLA_MODEL_X and HW2.5 vehicles
|
||||
if not (self.CP.flags & TeslaFlags.MISSING_DAS_SETTINGS):
|
||||
ret.invalidLkasSetting = cp_ap_party.vl["DAS_settings"]["DAS_autosteerEnabled"] != 0
|
||||
|
||||
# Because we don't have FSD 14 detection outside of a set of FW, we should check if this FW is accidentally missing from FSD_14_FW
|
||||
# 1. If in Autosteer or FSD, already caught by invalidLkasSetting
|
||||
# 2. If in TACC and DAS ever sends ANGLE_CONTROL (1), we can infer it's trying to do LKAS on FSD 14+
|
||||
angle_control = cp_ap_party.vl["DAS_steeringControl"]["DAS_steeringControlType"] == 1 # ANGLE_CONTROL
|
||||
if not ret.invalidLkasSetting and angle_control and not self.CP.flags & TeslaFlags.FSD_14:
|
||||
self.suspected_fsd14 = True
|
||||
|
||||
if self.suspected_fsd14:
|
||||
ret.invalidLkasSetting = True
|
||||
if not self.fsd14_error_logged:
|
||||
carlog.error("FSD 14 detected, but FW not in FSD_14_FW set")
|
||||
self.fsd14_error_logged = True
|
||||
|
||||
# Buttons # ToDo: add Gap adjust button
|
||||
|
||||
# Messages needed by carcontroller
|
||||
|
||||
@@ -13,7 +13,6 @@ FW_VERSIONS = {
|
||||
b'TeM3_E014p10_0.0.0 (16),EL014.17.00',
|
||||
b'TeM3_ES014p11_0.0.0 (25),ES014.19.0',
|
||||
b'TeM3_E014p10_0.0.0 (24),E014.20.2',
|
||||
b'TeM3_E014p10_0.0.0 (24),EL014.20.2',
|
||||
b'TeMYG4_DCS_Update_0.0.0 (13),E4014.28.1',
|
||||
b'TeMYG4_DCS_Update_0.0.0 (9),E4014.26.0',
|
||||
b'TeMYG4_Legacy3Y_0.0.0 (2),E4015.02.0',
|
||||
@@ -27,18 +26,12 @@ FW_VERSIONS = {
|
||||
b'TeMYG4_Main_0.0.0 (78),E4HP015.05.0',
|
||||
b'TeMYG4_SingleECU_0.0.0 (33),E4S014.27',
|
||||
b'TeMYG4_Main_0.0.0 (78),E4H015.05.0',
|
||||
b'TeMYG4_Main_0.0.0 (78),E4015.06.0',
|
||||
b'TeMYG4_Main_0.0.0 (87),E4L015.09.3',
|
||||
b'TeMYG4_Main_0.0.0 (87),E4H015.08.3',
|
||||
b'TeMYG4_Main_0.0.0 (92),E4H015.09.2',
|
||||
b'TeMYG4_Main_0.0.0 (92),E4L015.10.2',
|
||||
],
|
||||
},
|
||||
CAR.TESLA_MODEL_Y: {
|
||||
(Ecu.eps, 0x730, None): [
|
||||
b'TeM3_E014p10_0.0.0 (16),Y002.18.00',
|
||||
b'TeM3_E014p10_0.0.0 (16),YP002.18.00',
|
||||
b'TeM3_E014p10_0.0.0 (24),Y002.21.2',
|
||||
b'TeM3_E014p10_0.0.0 (24),YP002.21.2',
|
||||
b'TeM3_ES014p11_0.0.0 (16),YS002.17',
|
||||
b'TeM3_ES014p11_0.0.0 (25),YS002.19.0',
|
||||
@@ -52,10 +45,8 @@ FW_VERSIONS = {
|
||||
b'TeMYG4_Legacy3Y_0.0.0 (6),Y4003.04.0',
|
||||
b'TeMYG4_Main_0.0.0 (77),Y4003.05.4',
|
||||
b'TeMYG4_Main_0.0.0 (78),Y4003.06.0',
|
||||
b'TeMYG4_Main_0.0.0 (78),Y4OC003.08.1',
|
||||
b'TeMYG4_SingleECU_0.0.0 (28),Y4S002.23.0',
|
||||
b'TeMYG4_SingleECU_0.0.0 (33),Y4S002.26',
|
||||
b'TeMYG4_Main_0.0.0 (87),Y4003.09.3',
|
||||
],
|
||||
},
|
||||
CAR.TESLA_MODEL_X: {
|
||||
|
||||
@@ -2,7 +2,7 @@ from opendbc.car import Bus, get_safety_config, structs
|
||||
from opendbc.car.interfaces import CarInterfaceBase
|
||||
from opendbc.car.tesla.carcontroller import CarController
|
||||
from opendbc.car.tesla.carstate import CarState
|
||||
from opendbc.car.tesla.values import TeslaSafetyFlags, TeslaFlags, CANBUS, CAR, DBC
|
||||
from opendbc.car.tesla.values import TeslaSafetyFlags, TeslaFlags, CANBUS, CAR, DBC, FSD_14_FW, Ecu
|
||||
from opendbc.car.tesla.radar_interface import RadarInterface, RADAR_START_ADDR
|
||||
|
||||
from opendbc.sunnypilot.car.tesla.values import TeslaFlagsSP, TeslaSafetyFlagsSP
|
||||
@@ -41,16 +41,12 @@ class CarInterface(CarInterfaceBase):
|
||||
ret.openpilotLongitudinalControl = True
|
||||
ret.safetyConfigs[0].safetyParam |= TeslaSafetyFlags.LONG_CONTROL.value
|
||||
|
||||
# Tesla expanded DAS_steeringControl->DAS_steeringControlType to 3 bits: first in the FSD 14 builds for HW4 around 10-26-2025,
|
||||
# then in the other HW4 builds around 03-02-2026, and for HW3 and HW2.5 with 2026.8.6 around 04-03-2026.
|
||||
# The values were pushed to the right by 1 bit and kept the same definitions, plus 4 = FSD was added.
|
||||
# These messages are only sent by the 3-bit firmware:
|
||||
# - HW3/HW4: DAS_redundantBrakingControl (0x489)
|
||||
# - HW2.5/HW3/HW4: DI_autonomyHealth (0x054)
|
||||
das_steering_3_bit = 0x489 in fingerprint[CANBUS.autopilot_party] or 0x054 in fingerprint[CANBUS.party]
|
||||
fsd_14 = any(fw.ecu == Ecu.eps and fw.fwVersion in FSD_14_FW.get(candidate, []) for fw in car_fw)
|
||||
if fsd_14:
|
||||
ret.flags |= TeslaFlags.FSD_14.value
|
||||
ret.safetyConfigs[0].safetyParam |= TeslaSafetyFlags.FSD_14.value
|
||||
|
||||
ret.dashcamOnly = (candidate in (CAR.TESLA_MODEL_X,) or # dashcam only, pending find invalidLkasSetting signal
|
||||
(not das_steering_3_bit and not docs)) # the car's software needs to be updated
|
||||
ret.dashcamOnly = candidate in (CAR.TESLA_MODEL_X,) # dashcam only, pending find invalidLkasSetting signal
|
||||
|
||||
return ret
|
||||
|
||||
@@ -58,6 +54,8 @@ class CarInterface(CarInterfaceBase):
|
||||
def _get_params_sp(stock_cp: structs.CarParams, ret: structs.CarParamsSP, candidate, fingerprint: dict[int, dict[int, int]],
|
||||
car_fw: list[structs.CarParams.CarFw], alpha_long: bool, is_release_sp: bool, docs: bool) -> structs.CarParamsSP:
|
||||
|
||||
stock_cp.enableBsm = True
|
||||
|
||||
if candidate == CAR.TESLA_MODEL_X:
|
||||
stock_cp.dashcamOnly = False
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ from opendbc.car.tesla.values import CANBUS, CarControllerParams, TeslaFlags
|
||||
|
||||
|
||||
def get_steer_ctrl_type(flags: int, ctrl_type: int) -> int:
|
||||
# Returns the flipped signal value for DAS_steeringControlType on FSD 14
|
||||
if flags & TeslaFlags.FSD_14:
|
||||
return {1: 2, 2: 1}.get(ctrl_type, ctrl_type)
|
||||
else:
|
||||
|
||||
@@ -6,7 +6,7 @@ from opendbc.car.structs import CarParams
|
||||
from opendbc.car.tesla.interface import CarInterface
|
||||
from opendbc.car.tesla.fingerprints import FW_VERSIONS
|
||||
from opendbc.car.tesla.radar_interface import RADAR_START_ADDR
|
||||
from opendbc.car.tesla.values import CAR
|
||||
from opendbc.car.tesla.values import CAR, FSD_14_FW
|
||||
|
||||
Ecu = CarParams.Ecu
|
||||
|
||||
@@ -47,6 +47,15 @@ PLATFORM_TO_CAR = {
|
||||
b'X': CAR.TESLA_MODEL_X,
|
||||
}
|
||||
|
||||
# Hypothesized FSD 14 profile, in terms of variant_code bookends (given software_major >= 4):
|
||||
# M3: variant_code starts with '4H', ends with '015'
|
||||
# MY: variant_code starts with '4', ends with '003'
|
||||
# Older series (M3 '014', MY '002') are never FSD 14.
|
||||
FSD_14_FW_RULE = {
|
||||
CAR.TESLA_MODEL_3: (b'4H', b'015'),
|
||||
CAR.TESLA_MODEL_Y: (b'4', b'003'),
|
||||
}
|
||||
|
||||
|
||||
class TestTeslaFingerprint(unittest.TestCase):
|
||||
def test_fw_platform_code(self):
|
||||
@@ -58,6 +67,24 @@ class TestTeslaFingerprint(unittest.TestCase):
|
||||
assert m is not None, f"Unparsable FW: {fw}"
|
||||
assert PLATFORM_TO_CAR[m['platform']] == car_model, f"Platform letter {m['platform']!r} != {car_model.value}: {fw}"
|
||||
|
||||
def test_fsd_14_fw(self):
|
||||
for car_model, ecus in FW_VERSIONS.items():
|
||||
if car_model not in FSD_14_FW_RULE:
|
||||
continue
|
||||
|
||||
variant_prefix, variant_suffix = FSD_14_FW_RULE[car_model]
|
||||
for fw in ecus.get((Ecu.eps, 0x730, None), []):
|
||||
m = FW_RE.match(fw)
|
||||
assert m is not None, f"Unparsable FW: {fw}"
|
||||
|
||||
is_fsd_14 = fw in FSD_14_FW.get(car_model, [])
|
||||
expected = (
|
||||
m['variant_code'].startswith(variant_prefix)
|
||||
and m['variant_code'].endswith(variant_suffix)
|
||||
and int(m['software_major']) >= 4
|
||||
)
|
||||
assert is_fsd_14 == expected, f"{fw}"
|
||||
|
||||
def test_radar_detection(self):
|
||||
# Test radar availability detection for cars with radar DBC defined
|
||||
for radar in (True, False):
|
||||
|
||||
@@ -11,7 +11,7 @@ Ecu = CarParams.Ecu
|
||||
|
||||
class Footnote(Enum):
|
||||
HW_TYPE = CarFootnote(
|
||||
"Model year 2019 can have HW2.5 or HW3, and model years 2023 and 2024 can have HW3 or HW4, depending on build date and factory. " +
|
||||
"Model years 2023 and 2024 can have either hardware type, depending on build date and factory. " +
|
||||
"To check which hardware type your vehicle has, look for " +
|
||||
"<b>Autopilot computer</b> under <b>Software -> Additional Vehicle Information</b> on your vehicle's touchscreen. </br></br>" +
|
||||
"See <a href=\"https://www.notateslaapp.com/news/2173/how-to-check-if-your-tesla-has-hardware-4-ai4-or-hardware-3\">this page</a> for more information.",
|
||||
@@ -49,11 +49,11 @@ class TeslaPlatformConfig(PlatformConfig):
|
||||
class CAR(Platforms):
|
||||
TESLA_MODEL_3 = TeslaPlatformConfig(
|
||||
[
|
||||
TeslaCarDocsHW3("Tesla Model 3 (with HW2.5) 2019"),
|
||||
# TODO: do we support 2017? It's HW3
|
||||
TeslaCarDocsHW3("Tesla Model 3 (with HW3) 2019-23"),
|
||||
TeslaCarDocsHW4("Tesla Model 3 (with HW4) 2024-25"),
|
||||
],
|
||||
CarSpecs(wheelbase=2.875, steerRatio=12.0),
|
||||
CarSpecs(mass=1899., wheelbase=2.875, steerRatio=12.0),
|
||||
{Bus.party: 'tesla_model3_party', Bus.radar: 'tesla_radar_continental_generated', Bus.adas: 'tesla_model3_vehicle'},
|
||||
)
|
||||
TESLA_MODEL_Y = TeslaPlatformConfig(
|
||||
@@ -61,12 +61,12 @@ class CAR(Platforms):
|
||||
TeslaCarDocsHW3("Tesla Model Y (with HW3) 2020-24"),
|
||||
TeslaCarDocsHW4("Tesla Model Y (with HW4) 2023-25"),
|
||||
],
|
||||
CarSpecs(wheelbase=2.890, steerRatio=12.0),
|
||||
CarSpecs(mass=2072., wheelbase=2.890, steerRatio=12.0),
|
||||
{Bus.party: 'tesla_model3_party', Bus.radar: 'tesla_radar_continental_generated', Bus.adas: 'tesla_model3_vehicle'},
|
||||
)
|
||||
TESLA_MODEL_X = TeslaPlatformConfig(
|
||||
[TeslaCarHW4ModelSXDocs("Tesla Model X (with HW4) 2024")],
|
||||
CarSpecs(wheelbase=2.960, steerRatio=12.0),
|
||||
CarSpecs(mass=2495., wheelbase=2.960, steerRatio=12.0),
|
||||
)
|
||||
|
||||
|
||||
@@ -132,19 +132,12 @@ class TeslaSafetyFlags(IntFlag):
|
||||
LONG_CONTROL = 1
|
||||
FSD_14 = 2
|
||||
|
||||
# deprecated flags
|
||||
DAS_STEERING_3_BIT_DEPRECATED = 2
|
||||
|
||||
|
||||
class TeslaFlags(IntFlag):
|
||||
LONG_CONTROL = 1
|
||||
FSD_14 = 2
|
||||
MISSING_DAS_SETTINGS = 4
|
||||
|
||||
# deprecated flags
|
||||
# old 2-bit FW is now dashcammed
|
||||
DAS_STEERING_3_BIT_DEPRECATED = 2
|
||||
|
||||
|
||||
DBC = CAR.create_dbc_map()
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@ from opendbc.car.toyota.values import CAR as TOYOTA
|
||||
from opendbc.car.values import Platform
|
||||
from opendbc.car.volkswagen.values import CAR as VOLKSWAGEN
|
||||
from opendbc.car.body.values import CAR as COMMA
|
||||
from opendbc.car.byd.values import CAR as BYD
|
||||
from opendbc.car.psa.values import CAR as PSA
|
||||
from opendbc.car.mg.values import CAR as MG
|
||||
|
||||
@@ -36,9 +35,6 @@ non_tested_cars = [
|
||||
TOYOTA.TOYOTA_COROLLA,
|
||||
TOYOTA.TOYOTA_RAV4H,
|
||||
|
||||
# These are on the 2-bit DAS_steeringControlType firmware, which is dashcam only, need new routes
|
||||
TESLA.TESLA_MODEL_X,
|
||||
|
||||
# port extensions
|
||||
HYUNDAI.HYUNDAI_KONA_EV_NON_SCC,
|
||||
HYUNDAI.HYUNDAI_BAYON_1ST_GEN_NON_SCC,
|
||||
@@ -148,7 +144,6 @@ routes = [
|
||||
CarTestRoute("f44aa96ace22f34a/2021-12-22--06-22-31", HONDA.HONDA_CIVIC_2022),
|
||||
CarTestRoute("1f032f5173c8ad99/00000006--573b3fcaf5", HONDA.HONDA_CIVIC_2022), # Civic Type R with manual transmission
|
||||
CarTestRoute("b1c832ad56b6bc9d/00000010--debfcf5867", HONDA.HONDA_CIVIC_2022), # 2025 Civic Hatch Hybrid with new eCVT transmission
|
||||
CarTestRoute("49d0fc1df3e7320b/00000002--d2df953add", HONDA.HONDA_PRELUDE_6G), # EU-market e:HEV
|
||||
CarTestRoute("f9c43864cf057d05/2024-01-15--23-01-20", HONDA.HONDA_PILOT_4G), # TODO: Replace with a newer route
|
||||
CarTestRoute("f39cf149898833ff/0000002b--54f3fae045", HONDA.HONDA_ACCORD_11G),
|
||||
CarTestRoute("56b2cf1dacdcd033/00000017--d24ffdb376", HONDA.HONDA_CITY_7G), # Brazilian model
|
||||
@@ -158,8 +153,6 @@ routes = [
|
||||
CarTestRoute("ad9840558640c31d/0000001a--d6cd4871c2", HONDA.ACURA_MDX_4G_MMR), # 2025 MDX
|
||||
CarTestRoute("ad9840558640c31d/000001f2--026c4f6275", HONDA.ACURA_TLX_2G_MMR),
|
||||
CarTestRoute("619b464263ab23f2/00000025--ece505fdfc", HONDA.ACURA_MDX_4G),
|
||||
CarTestRoute("f2d6180c6007adc2/00000041--75a01c0fb1", HONDA.ACURA_ADX),
|
||||
CarTestRoute("023b97f3d8c08c33/00000007--18cc650bdd", HONDA.HONDA_PILOT_4G_MMR),
|
||||
|
||||
CarTestRoute("87d7f06ade479c2e/2023-09-11--23-30-11", HYUNDAI.HYUNDAI_AZERA_6TH_GEN),
|
||||
CarTestRoute("66189dd8ec7b50e6/2023-09-20--07-02-12", HYUNDAI.HYUNDAI_AZERA_HEV_6TH_GEN),
|
||||
@@ -180,7 +173,6 @@ routes = [
|
||||
CarTestRoute("de59124955b921d8/2023-06-24--00-12-50", HYUNDAI.KIA_CARNIVAL_4TH_GEN),
|
||||
CarTestRoute("409c9409979a8abc/2023-07-11--09-06-44", HYUNDAI.KIA_CARNIVAL_4TH_GEN), # Chinese model
|
||||
CarTestRoute("e0e98335f3ebc58f/2021-03-07--16-38-29", HYUNDAI.KIA_CEED),
|
||||
CarTestRoute("26064e18b24ae44c/00000000--4eb95fc137", HYUNDAI.KIA_CEED_PHEV),
|
||||
CarTestRoute("7653b2bce7bcfdaa/2020-03-04--15-34-32", HYUNDAI.KIA_OPTIMA_G4),
|
||||
CarTestRoute("018654717bc93d7d/2022-09-19--23-11-10", HYUNDAI.KIA_OPTIMA_G4_FL, segment=0),
|
||||
CarTestRoute("f9716670b2481438/2023-08-23--14-49-50", HYUNDAI.KIA_OPTIMA_H),
|
||||
@@ -373,13 +365,13 @@ routes = [
|
||||
|
||||
CarTestRoute("6a7075a4fdd765ee/0000004e--1f612006dd", PSA.PSA_PEUGEOT_208),
|
||||
|
||||
CarTestRoute("148fa33c79475c93/00000002--bb5e1aa449", BYD.BYD_ATTO_3),
|
||||
|
||||
CarTestRoute("bc095dc92e101734/000000db--ee9fe46e57", RIVIAN.RIVIAN_R1),
|
||||
CarTestRoute("c70d59e4150956fc/0000006e--48bfbfda01", RIVIAN.RIVIAN_R1), # GEN2
|
||||
|
||||
CarTestRoute("79d0f04c82980004/00000003--fb0b5d9cfc", TESLA.TESLA_MODEL_3), # HW4 2025
|
||||
CarTestRoute("aebd8f1d4ea16066/000002d8--5850d3ea5c", TESLA.TESLA_MODEL_Y), # openpilot longitudinal
|
||||
CarTestRoute("7dc058789994da80/00000112--adb970f6a8", TESLA.TESLA_MODEL_3),
|
||||
CarTestRoute("c8a98e58647765ad/00000002--84e4746136", TESLA.TESLA_MODEL_Y),
|
||||
CarTestRoute("2c912ca5de3b1ee9/0000025d--6eb6bcbca4", TESLA.TESLA_MODEL_Y, segment=4),
|
||||
CarTestRoute("bdda168c0c35fad7/00000001--5c5a36ec06", TESLA.TESLA_MODEL_X), # openpilot longitudinal
|
||||
|
||||
CarTestRoute("5d61e2f6e1f247f3/00000054--d3dfb01b34", MG.MG_5_EV),
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ def _make_car_test(car_name):
|
||||
car_params = car_interface.CP.as_reader()
|
||||
car_params_sp = car_interface.CP_SP
|
||||
|
||||
assert car_params.rotationalInertiaPerMass > 0
|
||||
assert car_params.mass > 1
|
||||
assert car_params.wheelbase > 0
|
||||
# centerToFront is center of gravity to front wheels, assert a reasonable range
|
||||
assert car_params.wheelbase * 0.3 < car_params.centerToFront < car_params.wheelbase * 0.7
|
||||
|
||||
@@ -275,7 +275,6 @@ class TestFwFingerprintTiming(unittest.TestCase):
|
||||
brand_ref_times = {
|
||||
'gm': 1.0,
|
||||
'body': 0.1,
|
||||
'byd': 0.0,
|
||||
'chrysler': 0.3,
|
||||
'ford': 1.5,
|
||||
'honda': 0.45,
|
||||
|
||||
@@ -203,7 +203,7 @@ class TestCarModelBase(unittest.TestCase):
|
||||
if self.CP.dashcamOnly:
|
||||
self.skipTest("no need to check carParams for dashcamOnly")
|
||||
|
||||
self.assertGreater(self.CP.rotationalInertiaPerMass, 0)
|
||||
self.assertGreater(self.CP.mass, 1)
|
||||
if self.CP.steerControlType not in (SteerControlType.angle, SteerControlType.curvature):
|
||||
tuning = self.CP.lateralTuning.which()
|
||||
if tuning == "pid":
|
||||
@@ -267,7 +267,7 @@ class TestCarModelBase(unittest.TestCase):
|
||||
self.safety.safety_rx_hook(packet)
|
||||
self.safety.set_relay_malfunction(relay_malfunction)
|
||||
|
||||
self.safety.safety_tick()
|
||||
self.safety.safety_tick_current_safety_config()
|
||||
if t > 1e6:
|
||||
self.assertTrue(self.safety.safety_config_valid())
|
||||
|
||||
@@ -289,7 +289,7 @@ class TestCarModelBase(unittest.TestCase):
|
||||
|
||||
self.assertFalse(failed_addrs, f"panda safety RX check failed: {failed_addrs}")
|
||||
self.safety.set_timer(int(t + 2e6))
|
||||
self.safety.safety_tick()
|
||||
self.safety.safety_tick_current_safety_config()
|
||||
self.assertFalse(self.safety.safety_config_valid())
|
||||
|
||||
def test_panda_safety_tx_cases(self):
|
||||
|
||||
@@ -10,9 +10,6 @@ legend = ["LAT_ACCEL_FACTOR", "MAX_LAT_ACCEL_MEASURED", "FRICTION"]
|
||||
# PSA angle based controllers
|
||||
"PSA_PEUGEOT_208" = [nan, 2.0, nan]
|
||||
|
||||
# BYD angle based controllers
|
||||
"BYD_ATTO_3" = [nan, 2.0, nan]
|
||||
|
||||
# New subarus angle based controllers
|
||||
"SUBARU_FORESTER_2022" = [nan, 3.0, nan]
|
||||
"SUBARU_OUTBACK_2023" = [nan, 3.0, nan]
|
||||
@@ -108,8 +105,6 @@ legend = ["LAT_ACCEL_FACTOR", "MAX_LAT_ACCEL_MEASURED", "FRICTION"]
|
||||
"JEEP_CHEROKEE_5TH_GEN" = [1.5, 1.5, 0.15]
|
||||
"ACURA_MDX_4G" = [1.4, 1.4, 0.17]
|
||||
"ACURA_RDX_3G_MMR" = [1.5, 1.5, 0.16]
|
||||
"ACURA_ADX" = [1.5, 1.5, 0.22]
|
||||
"HONDA_PILOT_4G_MMR" = [2.0, 2.0, 0.13]
|
||||
|
||||
# Dashcam or fallback configured as ideal car
|
||||
"MOCK" = [10.0, 10, 0.0]
|
||||
|
||||
@@ -23,7 +23,6 @@ legend = ["LAT_ACCEL_FACTOR", "MAX_LAT_ACCEL_MEASURED", "FRICTION"]
|
||||
"KIA_OPTIMA_H_G4_FL" = "HYUNDAI_SONATA"
|
||||
"KIA_FORTE" = "HYUNDAI_SONATA"
|
||||
"KIA_CEED" = "HYUNDAI_SONATA"
|
||||
"KIA_CEED_PHEV" = "HYUNDAI_SONATA"
|
||||
"KIA_SELTOS" = "HYUNDAI_SONATA"
|
||||
"KIA_NIRO_PHEV" = "KIA_NIRO_EV"
|
||||
"KIA_NIRO_PHEV_2022" = "KIA_NIRO_EV"
|
||||
@@ -53,7 +52,6 @@ legend = ["LAT_ACCEL_FACTOR", "MAX_LAT_ACCEL_MEASURED", "FRICTION"]
|
||||
"HONDA_E" = "HONDA_CIVIC_BOSCH"
|
||||
"HONDA_E_ADVANCE" = "HONDA_CIVIC_BOSCH"
|
||||
"HONDA_ODYSSEY_TWN" = "HONDA_ODYSSEY"
|
||||
"HONDA_PRELUDE_6G" = "HONDA_CIVIC_2022"
|
||||
|
||||
"BUICK_LACROSSE" = "CHEVROLET_VOLT"
|
||||
"BUICK_REGAL" = "CHEVROLET_VOLT"
|
||||
|
||||
@@ -178,7 +178,7 @@ class CarState(CarStateBase, CarStateExt):
|
||||
ret.genericToggle = bool(cp.vl["LIGHT_STALK"]["AUTO_HIGH_BEAM"])
|
||||
ret.espDisabled = cp.vl["ESP_CONTROL"]["TC_DISABLED"] != 0
|
||||
|
||||
if self.CP.flags & ToyotaFlags.HAS_BSM:
|
||||
if self.CP.enableBsm:
|
||||
ret.leftBlindspot = (cp.vl["BSM"]["L_ADJACENT"] == 1) or (cp.vl["BSM"]["L_APPROACHING"] == 1)
|
||||
ret.rightBlindspot = (cp.vl["BSM"]["R_ADJACENT"] == 1) or (cp.vl["BSM"]["R_APPROACHING"] == 1)
|
||||
|
||||
|
||||
@@ -1307,17 +1307,14 @@ FW_VERSIONS = {
|
||||
(Ecu.engine, 0x700, None): [
|
||||
b'\x01896630841000\x00\x00\x00\x00',
|
||||
b'\x01896630857101\x00\x00\x00\x00',
|
||||
b'\x01896630862000\x00\x00\x00\x00',
|
||||
b'\x01896630864000\x00\x00\x00\x00',
|
||||
],
|
||||
(Ecu.abs, 0x7b0, None): [
|
||||
b'\x01F15260815100\x00\x00\x00\x00',
|
||||
b'\x01F15260815300\x00\x00\x00\x00',
|
||||
b'\x01F15260823000\x00\x00\x00\x00',
|
||||
],
|
||||
(Ecu.eps, 0x7a1, None): [
|
||||
b'\x018965B4509100\x00\x00\x00\x00',
|
||||
b'\x018965B4514000\x00\x00\x00\x00',
|
||||
],
|
||||
(Ecu.fwdRadar, 0x750, 0xf): [
|
||||
b'\x018821F3301500\x00\x00\x00\x00',
|
||||
@@ -1326,7 +1323,6 @@ FW_VERSIONS = {
|
||||
b'\x028646F0802200\x00\x00\x00\x008646G4202100\x00\x00\x00\x00',
|
||||
b'\x028646F0802300\x00\x00\x00\x008646G4202100\x00\x00\x00\x00',
|
||||
b'\x028646F0802400\x00\x00\x00\x008646G4202100\x00\x00\x00\x00',
|
||||
b'\x028646F0802500\x00\x00\x00\x008646G4202100\x00\x00\x00\x00',
|
||||
],
|
||||
},
|
||||
CAR.LEXUS_CTH: {
|
||||
|
||||
@@ -83,8 +83,7 @@ class CarInterface(CarInterfaceBase):
|
||||
|
||||
# TODO: Some TSS-P platforms have BSM, but are flipped based on region or driving direction.
|
||||
# Detect flipped signals and enable for C-HR and others
|
||||
if 0x3F6 in fingerprint[0] and ret.flags & ToyotaFlags.TSS2:
|
||||
ret.flags |= ToyotaFlags.HAS_BSM.value
|
||||
ret.enableBsm = 0x3F6 in fingerprint[0] and bool(ret.flags & ToyotaFlags.TSS2)
|
||||
|
||||
# No radar dbc for cars without DSU which are not TSS 2.0
|
||||
# TODO: make an adas dbc file for dsu-less models
|
||||
@@ -147,6 +146,7 @@ class CarInterface(CarInterfaceBase):
|
||||
if candidate == CAR.TOYOTA_PRIUS:
|
||||
if ret.flags & ToyotaFlagsSP.ZSS:
|
||||
stock_cp.steerRatio = 15.0
|
||||
stock_cp.mass = 3370.
|
||||
|
||||
# reuse logic from _get_params
|
||||
# Only give steer angle deadzone to for bad angle sensor prius
|
||||
|
||||
@@ -61,7 +61,6 @@ class ToyotaSafetyFlags(IntFlag):
|
||||
class ToyotaFlags(IntFlag):
|
||||
# Detected flags
|
||||
HYBRID = 1
|
||||
HAS_BSM = 2 # blind spot monitoring
|
||||
DISABLE_RADAR = 4
|
||||
|
||||
# Static flags
|
||||
@@ -132,14 +131,14 @@ class CAR(Platforms):
|
||||
ToyotaCarDocs("Toyota Alphard 2019-20"),
|
||||
ToyotaCarDocs("Toyota Alphard Hybrid 2021"),
|
||||
],
|
||||
CarSpecs(wheelbase=3.0, steerRatio=14.2, tireStiffnessFactor=0.444),
|
||||
CarSpecs(mass=4305. * CV.LB_TO_KG, wheelbase=3.0, steerRatio=14.2, tireStiffnessFactor=0.444),
|
||||
)
|
||||
TOYOTA_AVALON = PlatformConfig(
|
||||
[
|
||||
ToyotaCarDocs("Toyota Avalon 2016", "Toyota Safety Sense P"),
|
||||
ToyotaCarDocs("Toyota Avalon 2017-18"),
|
||||
],
|
||||
CarSpecs(wheelbase=2.82, steerRatio=14.8, tireStiffnessFactor=0.7983),
|
||||
CarSpecs(mass=3505. * CV.LB_TO_KG, wheelbase=2.82, steerRatio=14.8, tireStiffnessFactor=0.7983),
|
||||
dbc_dict('toyota_tnga_k_pt_generated', 'toyota_adas'),
|
||||
)
|
||||
TOYOTA_AVALON_2019 = PlatformConfig(
|
||||
@@ -162,8 +161,8 @@ class CAR(Platforms):
|
||||
ToyotaCarDocs("Toyota Camry 2018-20", video="https://www.youtube.com/watch?v=fkcjviZY9CM", footnotes=[Footnote.CAMRY]),
|
||||
ToyotaCarDocs("Toyota Camry Hybrid 2018-20", video="https://www.youtube.com/watch?v=Q2DYY0AWKgk"),
|
||||
],
|
||||
CarSpecs(wheelbase=2.82448, steerRatio=13.7, tireStiffnessFactor=0.7933),
|
||||
{Bus.pt: 'toyota_nodsu_pt_generated'},
|
||||
CarSpecs(mass=3400. * CV.LB_TO_KG, wheelbase=2.82448, steerRatio=13.7, tireStiffnessFactor=0.7933),
|
||||
dbc_dict('toyota_nodsu_pt_generated', 'toyota_adas'),
|
||||
flags=ToyotaFlags.NO_DSU,
|
||||
)
|
||||
TOYOTA_CAMRY_TSS2 = ToyotaTSS2PlatformConfig( # TSS 2.5
|
||||
@@ -178,8 +177,8 @@ class CAR(Platforms):
|
||||
ToyotaCarDocs("Toyota C-HR 2017-20"),
|
||||
ToyotaCarDocs("Toyota C-HR Hybrid 2017-20"),
|
||||
],
|
||||
CarSpecs(wheelbase=2.63906, steerRatio=13.6, tireStiffnessFactor=0.7933),
|
||||
{Bus.pt: 'toyota_nodsu_pt_generated'},
|
||||
CarSpecs(mass=3300. * CV.LB_TO_KG, wheelbase=2.63906, steerRatio=13.6, tireStiffnessFactor=0.7933),
|
||||
dbc_dict('toyota_nodsu_pt_generated', 'toyota_adas'),
|
||||
flags=ToyotaFlags.NO_DSU,
|
||||
)
|
||||
TOYOTA_CHR_TSS2 = ToyotaTSS2PlatformConfig(
|
||||
@@ -192,7 +191,7 @@ class CAR(Platforms):
|
||||
)
|
||||
TOYOTA_COROLLA = PlatformConfig(
|
||||
[ToyotaCarDocs("Toyota Corolla 2017-19")],
|
||||
CarSpecs(wheelbase=2.7, steerRatio=18.27, tireStiffnessFactor=0.444),
|
||||
CarSpecs(mass=2860. * CV.LB_TO_KG, wheelbase=2.7, steerRatio=18.27, tireStiffnessFactor=0.444),
|
||||
dbc_dict('toyota_new_mc_pt_generated', 'toyota_adas'),
|
||||
)
|
||||
# LSS2 Lexus UX Hybrid is same as a TSS2 Corolla Hybrid
|
||||
@@ -207,14 +206,14 @@ class CAR(Platforms):
|
||||
ToyotaCarDocs("Toyota Corolla Cross Hybrid (Non-US only) 2020-22", min_enable_speed=7.5),
|
||||
ToyotaCarDocs("Lexus UX Hybrid 2019-24"),
|
||||
],
|
||||
CarSpecs(wheelbase=2.67, steerRatio=13.9, tireStiffnessFactor=0.444),
|
||||
CarSpecs(mass=3060. * CV.LB_TO_KG, wheelbase=2.67, steerRatio=13.9, tireStiffnessFactor=0.444),
|
||||
)
|
||||
TOYOTA_HIGHLANDER = PlatformConfig(
|
||||
[
|
||||
ToyotaCarDocs("Toyota Highlander 2017-19", video="https://www.youtube.com/watch?v=0wS0wXSLzoo"),
|
||||
ToyotaCarDocs("Toyota Highlander Hybrid 2017-19"),
|
||||
],
|
||||
CarSpecs(wheelbase=2.8194, steerRatio=16.0, tireStiffnessFactor=0.8),
|
||||
CarSpecs(mass=4516. * CV.LB_TO_KG, wheelbase=2.8194, steerRatio=16.0, tireStiffnessFactor=0.8),
|
||||
dbc_dict('toyota_tnga_k_pt_generated', 'toyota_adas'),
|
||||
flags=ToyotaFlags.NO_STOP_TIMER,
|
||||
)
|
||||
@@ -231,12 +230,12 @@ class CAR(Platforms):
|
||||
ToyotaCarDocs("Toyota Prius 2017-20", video="https://www.youtube.com/watch?v=8zopPJI8XQ0"),
|
||||
ToyotaCarDocs("Toyota Prius Prime 2017-20", video="https://www.youtube.com/watch?v=8zopPJI8XQ0"),
|
||||
],
|
||||
CarSpecs(wheelbase=2.7, steerRatio=15.74, tireStiffnessFactor=0.6371),
|
||||
CarSpecs(mass=3045. * CV.LB_TO_KG, wheelbase=2.7, steerRatio=15.74, tireStiffnessFactor=0.6371),
|
||||
dbc_dict('toyota_nodsu_pt_generated', 'toyota_adas'),
|
||||
)
|
||||
TOYOTA_PRIUS_V = PlatformConfig(
|
||||
[ToyotaCarDocs("Toyota Prius v 2017", "Toyota Safety Sense P", min_enable_speed=MIN_ACC_SPEED)],
|
||||
CarSpecs(wheelbase=2.78, steerRatio=17.4, tireStiffnessFactor=0.5533),
|
||||
CarSpecs(mass=3340. * CV.LB_TO_KG, wheelbase=2.78, steerRatio=17.4, tireStiffnessFactor=0.5533),
|
||||
dbc_dict('toyota_new_mc_pt_generated', 'toyota_adas'),
|
||||
flags=ToyotaFlags.NO_STOP_TIMER,
|
||||
)
|
||||
@@ -245,14 +244,14 @@ class CAR(Platforms):
|
||||
ToyotaCarDocs("Toyota Prius 2021-22", video="https://www.youtube.com/watch?v=J58TvCpUd4U"),
|
||||
ToyotaCarDocs("Toyota Prius Prime 2021-22", video="https://www.youtube.com/watch?v=J58TvCpUd4U"),
|
||||
],
|
||||
CarSpecs(wheelbase=2.70002, steerRatio=13.4, tireStiffnessFactor=0.6371),
|
||||
CarSpecs(mass=3115. * CV.LB_TO_KG, wheelbase=2.70002, steerRatio=13.4, tireStiffnessFactor=0.6371),
|
||||
)
|
||||
TOYOTA_RAV4 = PlatformConfig(
|
||||
[
|
||||
ToyotaCarDocs("Toyota RAV4 2016", "Toyota Safety Sense P"),
|
||||
ToyotaCarDocs("Toyota RAV4 2017-18")
|
||||
],
|
||||
CarSpecs(wheelbase=2.65, steerRatio=16.88, tireStiffnessFactor=0.5533),
|
||||
CarSpecs(mass=3650. * CV.LB_TO_KG, wheelbase=2.65, steerRatio=16.88, tireStiffnessFactor=0.5533),
|
||||
dbc_dict('toyota_new_mc_pt_generated', 'toyota_adas'),
|
||||
)
|
||||
TOYOTA_RAV4H = PlatformConfig(
|
||||
@@ -270,7 +269,7 @@ class CAR(Platforms):
|
||||
ToyotaCarDocs("Toyota RAV4 2019-21", video="https://www.youtube.com/watch?v=wJxjDd42gGA"),
|
||||
ToyotaCarDocs("Toyota RAV4 Hybrid 2019-21"),
|
||||
],
|
||||
CarSpecs(wheelbase=2.68986, steerRatio=14.3, tireStiffnessFactor=0.7933),
|
||||
CarSpecs(mass=3585. * CV.LB_TO_KG, wheelbase=2.68986, steerRatio=14.3, tireStiffnessFactor=0.7933),
|
||||
)
|
||||
TOYOTA_RAV4_TSS2_2022 = ToyotaTSS2PlatformConfig(
|
||||
[
|
||||
@@ -290,32 +289,32 @@ class CAR(Platforms):
|
||||
)
|
||||
TOYOTA_RAV4_PRIME = ToyotaSecOCPlatformConfig(
|
||||
[ToyotaSecOcCarDocs("Toyota RAV4 Prime 2021-23", min_enable_speed=MIN_ACC_SPEED)],
|
||||
CarSpecs(wheelbase=2.68, steerRatio=16.88, tireStiffnessFactor=0.5533),
|
||||
CarSpecs(mass=4372. * CV.LB_TO_KG, wheelbase=2.68, steerRatio=16.88, tireStiffnessFactor=0.5533),
|
||||
)
|
||||
TOYOTA_YARIS = ToyotaSecOCPlatformConfig(
|
||||
[ToyotaSecOcCarDocs("Toyota Yaris (Non-US only) 2020, 2023", min_enable_speed=MIN_ACC_SPEED)],
|
||||
CarSpecs(wheelbase=2.55, steerRatio=14.80, tireStiffnessFactor=0.5533),
|
||||
CarSpecs(mass=1170, wheelbase=2.55, steerRatio=14.80, tireStiffnessFactor=0.5533),
|
||||
flags=ToyotaFlags.RADAR_ACC,
|
||||
)
|
||||
TOYOTA_MIRAI = ToyotaTSS2PlatformConfig( # TSS 2.5
|
||||
[ToyotaCarDocs("Toyota Mirai 2021")],
|
||||
CarSpecs(wheelbase=2.91, steerRatio=14.8, tireStiffnessFactor=0.8),
|
||||
CarSpecs(mass=4300. * CV.LB_TO_KG, wheelbase=2.91, steerRatio=14.8, tireStiffnessFactor=0.8),
|
||||
)
|
||||
TOYOTA_SIENNA = PlatformConfig(
|
||||
[ToyotaCarDocs("Toyota Sienna 2018-20", video="https://www.youtube.com/watch?v=q1UPOo4Sh68", min_enable_speed=MIN_ACC_SPEED)],
|
||||
CarSpecs(wheelbase=3.03, steerRatio=15.5, tireStiffnessFactor=0.444),
|
||||
CarSpecs(mass=4590. * CV.LB_TO_KG, wheelbase=3.03, steerRatio=15.5, tireStiffnessFactor=0.444),
|
||||
dbc_dict('toyota_tnga_k_pt_generated', 'toyota_adas'),
|
||||
flags=ToyotaFlags.NO_STOP_TIMER,
|
||||
)
|
||||
TOYOTA_SIENNA_4TH_GEN = ToyotaSecOCPlatformConfig(
|
||||
[ToyotaSecOcCarDocs("Toyota Sienna 2021-23", min_enable_speed=MIN_ACC_SPEED)],
|
||||
CarSpecs(wheelbase=3.06, steerRatio=17.8, tireStiffnessFactor=0.444),
|
||||
CarSpecs(mass=4625. * CV.LB_TO_KG, wheelbase=3.06, steerRatio=17.8, tireStiffnessFactor=0.444),
|
||||
)
|
||||
|
||||
# Lexus
|
||||
LEXUS_CTH = PlatformConfig(
|
||||
[ToyotaCarDocs("Lexus CT Hybrid 2017-18", "Lexus Safety System+")],
|
||||
CarSpecs(wheelbase=2.6, steerRatio=18.6, tireStiffnessFactor=0.517),
|
||||
CarSpecs(mass=3108. * CV.LB_TO_KG, wheelbase=2.6, steerRatio=18.6, tireStiffnessFactor=0.517),
|
||||
dbc_dict('toyota_new_mc_pt_generated', 'toyota_adas'),
|
||||
)
|
||||
LEXUS_ES = PlatformConfig(
|
||||
@@ -323,7 +322,7 @@ class CAR(Platforms):
|
||||
ToyotaCarDocs("Lexus ES 2017-18"),
|
||||
ToyotaCarDocs("Lexus ES Hybrid 2017-18"),
|
||||
],
|
||||
CarSpecs(wheelbase=2.8702, steerRatio=16.0, tireStiffnessFactor=0.444),
|
||||
CarSpecs(mass=3677. * CV.LB_TO_KG, wheelbase=2.8702, steerRatio=16.0, tireStiffnessFactor=0.444),
|
||||
dbc_dict('toyota_new_mc_pt_generated', 'toyota_adas'),
|
||||
)
|
||||
LEXUS_ES_TSS2 = ToyotaTSS2PlatformConfig(
|
||||
@@ -335,7 +334,7 @@ class CAR(Platforms):
|
||||
)
|
||||
LEXUS_IS = PlatformConfig(
|
||||
[ToyotaCarDocs("Lexus IS 2017-19")],
|
||||
CarSpecs(wheelbase=2.79908, steerRatio=13.3, tireStiffnessFactor=0.444),
|
||||
CarSpecs(mass=3736.8 * CV.LB_TO_KG, wheelbase=2.79908, steerRatio=13.3, tireStiffnessFactor=0.444),
|
||||
dbc_dict('toyota_tnga_k_pt_generated', 'toyota_adas'),
|
||||
flags=ToyotaFlags.UNSUPPORTED_DSU,
|
||||
)
|
||||
@@ -348,7 +347,7 @@ class CAR(Platforms):
|
||||
ToyotaCarDocs("Lexus NX 2018-19"),
|
||||
ToyotaCarDocs("Lexus NX Hybrid 2018-19"),
|
||||
],
|
||||
CarSpecs(wheelbase=2.66, steerRatio=14.7, tireStiffnessFactor=0.444),
|
||||
CarSpecs(mass=4070. * CV.LB_TO_KG, wheelbase=2.66, steerRatio=14.7, tireStiffnessFactor=0.444),
|
||||
dbc_dict('toyota_tnga_k_pt_generated', 'toyota_adas'),
|
||||
)
|
||||
LEXUS_NX_TSS2 = ToyotaTSS2PlatformConfig(
|
||||
@@ -360,7 +359,7 @@ class CAR(Platforms):
|
||||
)
|
||||
LEXUS_LC_TSS2 = ToyotaTSS2PlatformConfig(
|
||||
[ToyotaCarDocs("Lexus LC 2024-25")],
|
||||
CarSpecs(wheelbase=2.87, steerRatio=13.0, tireStiffnessFactor=0.444),
|
||||
CarSpecs(mass=4500. * CV.LB_TO_KG, wheelbase=2.87, steerRatio=13.0, tireStiffnessFactor=0.444),
|
||||
)
|
||||
LEXUS_RC = PlatformConfig(
|
||||
[ToyotaCarDocs("Lexus RC 2018-20")],
|
||||
@@ -372,7 +371,7 @@ class CAR(Platforms):
|
||||
[
|
||||
ToyotaCarDocs("Lexus RC 2023"),
|
||||
],
|
||||
CarSpecs(wheelbase=2.73, steerRatio=13.9, tireStiffnessFactor=0.444),
|
||||
CarSpecs(mass=3986. * CV.LB_TO_KG, wheelbase=2.73, steerRatio=13.9, tireStiffnessFactor=0.444),
|
||||
)
|
||||
LEXUS_RX = PlatformConfig(
|
||||
[
|
||||
@@ -382,7 +381,7 @@ class CAR(Platforms):
|
||||
ToyotaCarDocs("Lexus RX Hybrid 2016", "Lexus Safety System+"),
|
||||
ToyotaCarDocs("Lexus RX Hybrid 2017-19"),
|
||||
],
|
||||
CarSpecs(wheelbase=2.79, steerRatio=16., tireStiffnessFactor=0.5533),
|
||||
CarSpecs(mass=4481. * CV.LB_TO_KG, wheelbase=2.79, steerRatio=16., tireStiffnessFactor=0.5533),
|
||||
dbc_dict('toyota_tnga_k_pt_generated', 'toyota_adas'),
|
||||
)
|
||||
LEXUS_RX_TSS2 = ToyotaTSS2PlatformConfig(
|
||||
@@ -394,13 +393,13 @@ class CAR(Platforms):
|
||||
)
|
||||
LEXUS_GS_F = PlatformConfig(
|
||||
[ToyotaCarDocs("Lexus GS F 2016")],
|
||||
CarSpecs(wheelbase=2.84988, steerRatio=13.3, tireStiffnessFactor=0.444),
|
||||
CarSpecs(mass=4034. * CV.LB_TO_KG, wheelbase=2.84988, steerRatio=13.3, tireStiffnessFactor=0.444),
|
||||
dbc_dict('toyota_new_mc_pt_generated', 'toyota_adas'),
|
||||
flags=ToyotaFlags.UNSUPPORTED_DSU,
|
||||
)
|
||||
LEXUS_LS = PlatformConfig(
|
||||
[ToyotaCarDocs("Lexus LS 2018", "All except Lexus Safety System+ A")],
|
||||
CarSpecs(wheelbase=3.125, steerRatio=15.0, tireStiffnessFactor=0.444),
|
||||
CarSpecs(mass=4905. * CV.LB_TO_KG, wheelbase=3.125, steerRatio=15.0, tireStiffnessFactor=0.444),
|
||||
dbc_dict('toyota_nodsu_pt_generated', 'toyota_adas'),
|
||||
)
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
from typing import get_args
|
||||
from opendbc.car.body.values import CAR as BODY
|
||||
from opendbc.car.byd.values import CAR as BYD
|
||||
from opendbc.car.chrysler.values import CAR as CHRYSLER
|
||||
from opendbc.car.ford.values import CAR as FORD
|
||||
from opendbc.car.gm.values import CAR as GM
|
||||
@@ -17,7 +16,7 @@ from opendbc.car.tesla.values import CAR as TESLA
|
||||
from opendbc.car.toyota.values import CAR as TOYOTA
|
||||
from opendbc.car.volkswagen.values import CAR as VOLKSWAGEN
|
||||
|
||||
Platform = BODY | BYD | CHRYSLER | FORD | GM | HONDA | HYUNDAI | MAZDA | MOCK | MG | NISSAN | PSA | RIVIAN | SUBARU | TESLA | TOYOTA | VOLKSWAGEN
|
||||
Platform = BODY | CHRYSLER | FORD | GM | HONDA | HYUNDAI | MAZDA | MOCK | MG | NISSAN | PSA | RIVIAN | SUBARU | TESLA | TOYOTA | VOLKSWAGEN
|
||||
BRANDS = get_args(Platform)
|
||||
|
||||
PLATFORMS: dict[str, Platform] = {str(platform): platform for brand in BRANDS for platform in brand}
|
||||
|
||||
@@ -27,17 +27,15 @@ class VehicleModel:
|
||||
CP: Car Parameters
|
||||
"""
|
||||
# for math readability, convert long names car params into short names
|
||||
# Tire stiffness and rotational inertia are already divided by vehicle mass, which cancels out of the model.
|
||||
# Use unit mass to preserve the standard bicycle-model equations below.
|
||||
self.m: float = 1.0
|
||||
self.j: float = CP.rotationalInertiaPerMass
|
||||
self.m: float = CP.mass
|
||||
self.j: float = CP.rotationalInertia
|
||||
self.l: float = CP.wheelbase
|
||||
self.aF: float = CP.centerToFront
|
||||
self.aR: float = CP.wheelbase - CP.centerToFront
|
||||
self.chi: float = 0. # no rear steering
|
||||
self.chi: float = CP.steerRatioRear
|
||||
|
||||
self.cF_orig: float = CP.tireStiffnessFrontPerMass
|
||||
self.cR_orig: float = CP.tireStiffnessRearPerMass
|
||||
self.cF_orig: float = CP.tireStiffnessFront
|
||||
self.cR_orig: float = CP.tireStiffnessRear
|
||||
self.update_params(1.0, CP.steerRatio)
|
||||
|
||||
def update_params(self, stiffness_factor: float, steer_ratio: float) -> None:
|
||||
@@ -180,12 +178,12 @@ def create_dyn_state_matrices(u: float, VM: VehicleModel) -> tuple[np.ndarray, n
|
||||
A tuple with the 2x2 A matrix, and 2x2 B matrix
|
||||
|
||||
Parameters in the vehicle model:
|
||||
cF: Tire stiffness front per unit mass [N/(rad*kg)]
|
||||
cR: Tire stiffness rear per unit mass [N/(rad*kg)]
|
||||
cF: Tire stiffness Front [N/rad]
|
||||
cR: Tire stiffness Rear [N/rad]
|
||||
aF: Distance from CG to front wheels [m]
|
||||
aR: Distance from CG to rear wheels [m]
|
||||
m: Unit mass (1); stiffness and inertia are mass-normalized
|
||||
j: Rotational inertia per unit mass [m^2]
|
||||
m: Mass [kg]
|
||||
j: Rotational inertia [kg m^2]
|
||||
sR: Steering ratio [-]
|
||||
chi: Steer ratio rear [-]
|
||||
"""
|
||||
|
||||
@@ -17,7 +17,6 @@ class CarState(CarStateBase):
|
||||
self.CCP = CarControllerParams(CP)
|
||||
self.button_states = {button.event_type: False for button in self.CCP.BUTTONS}
|
||||
self.esp_hold_confirmation = False
|
||||
self.esp_standstill = False
|
||||
self.upscale_lead_car_signal = False
|
||||
self.eps_stock_values = False
|
||||
self.acc_type = 0
|
||||
@@ -99,7 +98,7 @@ class CarState(CarStateBase):
|
||||
pt_cp.vl["Gateway_72"]["ZV_HBFS_offen"],
|
||||
pt_cp.vl["Gateway_72"]["ZV_HD_offen"]])
|
||||
|
||||
if self.CP.flags & VolkswagenFlags.HAS_BSM:
|
||||
if self.CP.enableBsm:
|
||||
# Infostufe: BSM LED on, Warnung: BSM LED flashing
|
||||
ret.leftBlindspot = bool(ext_cp.vl["SWA_01"]["SWA_Infostufe_SWA_li"]) or bool(ext_cp.vl["SWA_01"]["SWA_Warnung_SWA_li"])
|
||||
ret.rightBlindspot = bool(ext_cp.vl["SWA_01"]["SWA_Infostufe_SWA_re"]) or bool(ext_cp.vl["SWA_01"]["SWA_Warnung_SWA_re"])
|
||||
@@ -191,7 +190,7 @@ class CarState(CarStateBase):
|
||||
|
||||
# Consume blind-spot monitoring info/warning LED states, if available.
|
||||
# Infostufe: BSM LED on, Warnung: BSM LED flashing
|
||||
if self.CP.flags & VolkswagenFlags.HAS_BSM:
|
||||
if self.CP.enableBsm:
|
||||
ret.leftBlindspot = bool(ext_cp.vl["SWA_1"]["SWA_Infostufe_SWA_li"]) or bool(ext_cp.vl["SWA_1"]["SWA_Warnung_SWA_li"])
|
||||
ret.rightBlindspot = bool(ext_cp.vl["SWA_1"]["SWA_Infostufe_SWA_re"]) or bool(ext_cp.vl["SWA_1"]["SWA_Warnung_SWA_re"])
|
||||
|
||||
@@ -283,11 +282,7 @@ class CarState(CarStateBase):
|
||||
ret.espActive = bool(pt_cp.vl["ESP_21"]["ESP_Eingriff"])
|
||||
|
||||
self.acc_type = ext_cp.vl["ACC_18"]["ACC_Typ"]
|
||||
self.esp_standstill = bool(pt_cp.vl["ESC_50"]["Standstill"])
|
||||
if self.CP.flags & VolkswagenFlags.MEB_GEN2:
|
||||
self.esp_hold_confirmation = pt_cp.vl["VMM_02"]["HMS_Status"] == 1
|
||||
else:
|
||||
self.esp_hold_confirmation = self.esp_standstill
|
||||
self.esp_hold_confirmation = bool(pt_cp.vl["ESC_50"]["Standstill"])
|
||||
self.travel_assist_available = bool(cam_cp.vl["TA_01"]["Travel_Assist_Available"])
|
||||
ret.stockFcw = bool(ext_cp.vl["AWV_03"]["FCW_Active"])
|
||||
ret.stockAeb = bool(ext_cp.vl["AWV_03"]["AEB_Active"])
|
||||
@@ -310,7 +305,7 @@ class CarState(CarStateBase):
|
||||
ret.leftBlinker, ret.rightBlinker = self.update_blinker_from_stalk(240, pt_cp.vl["SMLS_01"]["BH_Blinker_li"],
|
||||
pt_cp.vl["SMLS_01"]["BH_Blinker_re"])
|
||||
|
||||
if self.CP.flags & VolkswagenFlags.HAS_BSM:
|
||||
if self.CP.enableBsm:
|
||||
bsm_cp = pt_cp if self.CP.flags & VolkswagenFlags.MEB_GEN2 else ext_cp
|
||||
ret.leftBlindspot = (bool(bsm_cp.vl["MEB_Side_Assist_01"]["Blind_Spot_Info_Driver"]) or
|
||||
bool(bsm_cp.vl["MEB_Side_Assist_01"]["Blind_Spot_Warn_Driver"]))
|
||||
@@ -368,7 +363,7 @@ class CarState(CarStateBase):
|
||||
|
||||
# Consume blind-spot monitoring info/warning LED states, if available.
|
||||
# Infostufe: BSM LED on, Warnung: BSM LED flashing
|
||||
if self.CP.flags & VolkswagenFlags.HAS_BSM:
|
||||
if self.CP.enableBsm:
|
||||
ret.leftBlindspot = bool(ext_cp.vl["SWA_01"]["SWA_Infostufe_SWA_li"]) or bool(ext_cp.vl["SWA_01"]["SWA_Warnung_SWA_li"])
|
||||
ret.rightBlindspot = bool(ext_cp.vl["SWA_01"]["SWA_Infostufe_SWA_re"]) or bool(ext_cp.vl["SWA_01"]["SWA_Warnung_SWA_re"])
|
||||
|
||||
|
||||
@@ -482,7 +482,6 @@ FW_VERSIONS = {
|
||||
b'\xf1\x870D9300014L \xf1\x895002',
|
||||
b'\xf1\x870D9300018C \xf1\x895297',
|
||||
b'\xf1\x870D9300041A \xf1\x894801',
|
||||
b'\xf1\x870D9300041H \xf1\x894905',
|
||||
b'\xf1\x870D9300042H \xf1\x894901',
|
||||
b'\xf1\x870DD300045T \xf1\x891601',
|
||||
b'\xf1\x870DD300046B \xf1\x891601',
|
||||
@@ -690,7 +689,6 @@ FW_VERSIONS = {
|
||||
b'\xf1\x870DL300013A \xf1\x893005',
|
||||
b'\xf1\x870DL300013G \xf1\x892119',
|
||||
b'\xf1\x870DL300013G \xf1\x892120',
|
||||
b'\xf1\x870DL300013G \xf1\x892620',
|
||||
b'\xf1\x870DL300014C \xf1\x893703',
|
||||
b'\xf1\x870GC300013P \xf1\x892401',
|
||||
b'\xf1\x870GC300018R \xf1\x892802',
|
||||
@@ -706,7 +704,6 @@ FW_VERSIONS = {
|
||||
b'\xf1\x875Q0959655BK\xf1\x890339\xf1\x82\x1331310031333334313132573732379333423100',
|
||||
b'\xf1\x875Q0959655BM\xf1\x890403\xf1\x82\x1316143231313500314641011750179333423100',
|
||||
b'\xf1\x875Q0959655BS\xf1\x890403\xf1\x82\x1312110031333300314240013750379333423100',
|
||||
b'\xf1\x875Q0959655BR\xf1\x890403\xf1\x82\x1312110031333300314240013750379333423100',
|
||||
b'\xf1\x875Q0959655BT\xf1\x890403\xf1\x82\x1312110031333300314240583752379333423100',
|
||||
b'\xf1\x875Q0959655BT\xf1\x890403\xf1\x82\x1331310031333334313140013750379333423100',
|
||||
b'\xf1\x875Q0959655BT\xf1\x890403\xf1\x82\x1331310031333334313140573752379333423100',
|
||||
@@ -741,7 +738,6 @@ FW_VERSIONS = {
|
||||
b'\xf1\x872Q0907567B \xf1\x890534',
|
||||
b'\xf1\x872Q0907572AA\xf1\x890396',
|
||||
b'\xf1\x872Q0907572AB\xf1\x890397',
|
||||
b'\xf1\x872Q0907572AC\xf1\x890401',
|
||||
b'\xf1\x872Q0907572J \xf1\x890156',
|
||||
b'\xf1\x872Q0907572M \xf1\x890233',
|
||||
b'\xf1\x872Q0907572Q \xf1\x890342',
|
||||
|
||||
@@ -21,8 +21,7 @@ class CarInterface(CarInterfaceBase):
|
||||
if ret.flags & VolkswagenFlags.PQ:
|
||||
# Set global PQ35/PQ46/NMS parameters
|
||||
safety_configs = [get_safety_config(structs.CarParams.SafetyModel.volkswagenPq)]
|
||||
if 0x3BA in fingerprint[0]: # SWA_1
|
||||
ret.flags |= VolkswagenFlags.HAS_BSM.value
|
||||
ret.enableBsm = 0x3BA in fingerprint[0] # SWA_1
|
||||
|
||||
if 0x440 in fingerprint[0] or docs: # Getriebe_1
|
||||
ret.transmissionType = TransmissionType.automatic
|
||||
@@ -39,8 +38,7 @@ class CarInterface(CarInterfaceBase):
|
||||
elif ret.flags & VolkswagenFlags.MLB:
|
||||
# Set global MLB parameters
|
||||
safety_configs = [get_safety_config(structs.CarParams.SafetyModel.volkswagenMlb)]
|
||||
if 0x30F in fingerprint[0]: # SWA_01
|
||||
ret.flags |= VolkswagenFlags.HAS_BSM.value
|
||||
ret.enableBsm = 0x30F in fingerprint[0] # SWA_01
|
||||
ret.networkLocation = NetworkLocation.gateway
|
||||
ret.dashcamOnly = is_release # Release support needs HCA timeout fix, safety validation, revised J533 harness
|
||||
|
||||
@@ -67,8 +65,7 @@ class CarInterface(CarInterfaceBase):
|
||||
ret.networkLocation = NetworkLocation.fwdCamera
|
||||
ret.radarUnavailable = True
|
||||
|
||||
if 0x24C in fingerprint[0]: # MEB_Side_Assist_01
|
||||
ret.flags |= VolkswagenFlags.HAS_BSM.value
|
||||
ret.enableBsm = 0x24C in fingerprint[0] # MEB_Side_Assist_01
|
||||
|
||||
if 0x25D in fingerprint[0]: # KLR_01
|
||||
ret.flags |= VolkswagenFlags.STOCK_KLR_PRESENT.value
|
||||
@@ -81,8 +78,7 @@ class CarInterface(CarInterfaceBase):
|
||||
else:
|
||||
# Set global MQB parameters
|
||||
safety_configs = [get_safety_config(structs.CarParams.SafetyModel.volkswagen)]
|
||||
if 0x30F in fingerprint[0]: # SWA_01
|
||||
ret.flags |= VolkswagenFlags.HAS_BSM.value
|
||||
ret.enableBsm = 0x30F in fingerprint[0] # SWA_01
|
||||
|
||||
if 0xAD in fingerprint[0] or docs: # Getriebe_11
|
||||
ret.transmissionType = TransmissionType.automatic
|
||||
|
||||
@@ -98,12 +98,10 @@ class MebLongStateMachine:
|
||||
# warning: car is reacting to hold mechanic even with long control off
|
||||
# HALTEN -> KEINE_ANFORDERUNG causes the car to fault into park, so both branches below put a ramp in
|
||||
# between: disengaging always ramps, and while engaged a release ramps until 5 kph
|
||||
# NOTE: ANFAHREN faults TSK if the hold manager isn't holding
|
||||
# NOTE: this allows KEINE_ANFORDERUNG -> ANFAHREN, but we haven't observed a fault due to this yet
|
||||
# TODO: camera can send 7 on disengage at a stop which we don't fully understand yet
|
||||
stopping = CC.actuators.longControlState == LongCtrlState.stopping
|
||||
# HMS_Status leaves holding as soon as we send anfahren, so keep driving off until we leave standstill
|
||||
driving_off = self.prev_acc_hold_type == self.acc_hold_type_vals['ANFAHREN'] and CS.esp_standstill
|
||||
starting = CC.actuators.longControlState == LongCtrlState.pid and (CS.esp_hold_confirmation or driving_off)
|
||||
starting = CC.actuators.longControlState == LongCtrlState.pid and CS.esp_hold_confirmation
|
||||
long_active = CC.longActive and not CS.out.accFaulted # catches it one frame earlier, not sure if needed
|
||||
|
||||
if not long_active:
|
||||
|
||||
@@ -223,7 +223,6 @@ class VolkswagenFlags(IntFlag):
|
||||
KOMBI_PRESENT = 4
|
||||
ALT_GEAR = 32
|
||||
STOCK_KLR_PRESENT = 64
|
||||
HAS_BSM = 256 # blind spot monitoring
|
||||
|
||||
# Static flags
|
||||
PQ = 2
|
||||
@@ -333,7 +332,7 @@ class CAR(Platforms):
|
||||
VWCarDocs("Volkswagen Arteon Shooting Brake 2020-23", video="https://youtu.be/FAomFKPFlDA"),
|
||||
VWCarDocs("Volkswagen CC 2018-22", video="https://youtu.be/FAomFKPFlDA"),
|
||||
],
|
||||
VolkswagenCarSpecs(wheelbase=2.84),
|
||||
VolkswagenCarSpecs(mass=1733, wheelbase=2.84),
|
||||
chassis_codes={"AN", "3H"},
|
||||
wmis={WMI.VOLKSWAGEN_EUROPE_CAR},
|
||||
)
|
||||
@@ -345,7 +344,7 @@ class CAR(Platforms):
|
||||
VWCarDocs("Volkswagen Teramont Cross Sport 2021-22"),
|
||||
VWCarDocs("Volkswagen Teramont X 2021-22"),
|
||||
],
|
||||
VolkswagenCarSpecs(wheelbase=2.98),
|
||||
VolkswagenCarSpecs(mass=2011, wheelbase=2.98),
|
||||
chassis_codes={"CA"},
|
||||
wmis={WMI.VOLKSWAGEN_USA_SUV, WMI.VOLKSWAGEN_EUROPE_SUV},
|
||||
)
|
||||
@@ -354,7 +353,7 @@ class CAR(Platforms):
|
||||
VWCarDocs("Volkswagen Caddy 2019"),
|
||||
VWCarDocs("Volkswagen Caddy Maxi 2019"),
|
||||
],
|
||||
VolkswagenCarSpecs(wheelbase=2.6, minSteerSpeed=21 * CV.KPH_TO_MS),
|
||||
VolkswagenCarSpecs(mass=1613, wheelbase=2.6, minSteerSpeed=21 * CV.KPH_TO_MS),
|
||||
chassis_codes={"2K"},
|
||||
wmis={WMI.VOLKSWAGEN_COMMERCIAL_BUS_VAN},
|
||||
)
|
||||
@@ -366,7 +365,7 @@ class CAR(Platforms):
|
||||
VWCarDocs("MAN TGE 2017-24", video="https://youtu.be/4100gLeabmo"),
|
||||
VWCarDocs("MAN eTGE 2020-24", video="https://youtu.be/4100gLeabmo"),
|
||||
],
|
||||
VolkswagenCarSpecs(wheelbase=3.64, minSteerSpeed=50 * CV.KPH_TO_MS),
|
||||
VolkswagenCarSpecs(mass=2100, wheelbase=3.64, minSteerSpeed=50 * CV.KPH_TO_MS),
|
||||
chassis_codes={"SY", "SZ", "UY", "UZ"},
|
||||
wmis={WMI.VOLKSWAGEN_COMMERCIAL, WMI.MAN},
|
||||
)
|
||||
@@ -381,7 +380,7 @@ class CAR(Platforms):
|
||||
VWCarDocs("Volkswagen Golf R 2015-19"),
|
||||
VWCarDocs("Volkswagen Golf SportsVan 2015-20"),
|
||||
],
|
||||
VolkswagenCarSpecs(wheelbase=2.62),
|
||||
VolkswagenCarSpecs(mass=1397, wheelbase=2.62),
|
||||
chassis_codes={"5G", "AU", "BA", "BE"},
|
||||
wmis={WMI.VOLKSWAGEN_MEXICO_CAR, WMI.VOLKSWAGEN_EUROPE_CAR},
|
||||
)
|
||||
@@ -389,20 +388,20 @@ class CAR(Platforms):
|
||||
[
|
||||
VWCarDocs("Volkswagen ID.4 2021-23", car_parts=CarParts.common([CarHarness.vw_meb]), footnotes=[]),
|
||||
],
|
||||
VolkswagenCarSpecs(wheelbase=2.77),
|
||||
VolkswagenCarSpecs(mass=2224, wheelbase=2.77),
|
||||
chassis_codes={"E2"},
|
||||
wmis={WMI.VOLKSWAGEN_USA_SUV, WMI.VOLKSWAGEN_EUROPE_CAR, WMI.VOLKSWAGEN_EUROPE_SUV},
|
||||
)
|
||||
VOLKSWAGEN_ID4_MK2 = VolkswagenMEBPlatformConfig(
|
||||
[VWCarDocs("Volkswagen ID.4 2024-25", car_parts=CarParts.common([CarHarness.vw_meb]), footnotes=[])],
|
||||
VolkswagenCarSpecs(wheelbase=2.77),
|
||||
VolkswagenCarSpecs(mass=2224, wheelbase=2.77),
|
||||
chassis_codes={"E8"},
|
||||
wmis={WMI.VOLKSWAGEN_USA_SUV, WMI.VOLKSWAGEN_EUROPE_CAR, WMI.VOLKSWAGEN_EUROPE_SUV},
|
||||
flags=VolkswagenFlags.MEB_GEN2,
|
||||
)
|
||||
VOLKSWAGEN_JETTA_MK6 = VolkswagenPQPlatformConfig(
|
||||
[VWCarDocs("Volkswagen Jetta 2015-18")],
|
||||
VolkswagenCarSpecs(wheelbase=2.65, minSteerSpeed=50 * CV.KPH_TO_MS, minEnableSpeed=20 * CV.KPH_TO_MS),
|
||||
VolkswagenCarSpecs(mass=1518, wheelbase=2.65, minSteerSpeed=50 * CV.KPH_TO_MS, minEnableSpeed=20 * CV.KPH_TO_MS),
|
||||
chassis_codes={"5K", "AJ"},
|
||||
wmis={WMI.VOLKSWAGEN_MEXICO_CAR},
|
||||
)
|
||||
@@ -411,7 +410,7 @@ class CAR(Platforms):
|
||||
VWCarDocs("Volkswagen Jetta 2019-23"),
|
||||
VWCarDocs("Volkswagen Jetta GLI 2021-23"),
|
||||
],
|
||||
VolkswagenCarSpecs(wheelbase=2.71),
|
||||
VolkswagenCarSpecs(mass=1328, wheelbase=2.71),
|
||||
chassis_codes={"BU"},
|
||||
wmis={WMI.VOLKSWAGEN_MEXICO_CAR, WMI.VOLKSWAGEN_EUROPE_CAR},
|
||||
)
|
||||
@@ -421,13 +420,13 @@ class CAR(Platforms):
|
||||
VWCarDocs("Volkswagen Passat Alltrack 2015-22"),
|
||||
VWCarDocs("Volkswagen Passat GTE 2015-22"),
|
||||
],
|
||||
VolkswagenCarSpecs(wheelbase=2.79),
|
||||
VolkswagenCarSpecs(mass=1551, wheelbase=2.79),
|
||||
chassis_codes={"3C", "3G"},
|
||||
wmis={WMI.VOLKSWAGEN_EUROPE_CAR},
|
||||
)
|
||||
VOLKSWAGEN_PASSAT_NMS = VolkswagenPQPlatformConfig(
|
||||
[VWCarDocs("Volkswagen Passat NMS 2017-22")],
|
||||
VolkswagenCarSpecs(wheelbase=2.80, minSteerSpeed=50 * CV.KPH_TO_MS, minEnableSpeed=20 * CV.KPH_TO_MS),
|
||||
VolkswagenCarSpecs(mass=1503, wheelbase=2.80, minSteerSpeed=50 * CV.KPH_TO_MS, minEnableSpeed=20 * CV.KPH_TO_MS),
|
||||
chassis_codes={"A3"},
|
||||
wmis={WMI.VOLKSWAGEN_USA_CAR},
|
||||
)
|
||||
@@ -436,7 +435,7 @@ class CAR(Platforms):
|
||||
VWCarDocs("Volkswagen Polo 2018-23", footnotes=[Footnote.VW_MQB_A0]),
|
||||
VWCarDocs("Volkswagen Polo GTI 2018-23", footnotes=[Footnote.VW_MQB_A0]),
|
||||
],
|
||||
VolkswagenCarSpecs(wheelbase=2.55),
|
||||
VolkswagenCarSpecs(mass=1230, wheelbase=2.55),
|
||||
chassis_codes={"AW"},
|
||||
wmis={WMI.VOLKSWAGEN_EUROPE_CAR},
|
||||
)
|
||||
@@ -445,19 +444,19 @@ class CAR(Platforms):
|
||||
VWCarDocs("Volkswagen Sharan 2018-22"),
|
||||
VWCarDocs("SEAT Alhambra 2018-20"),
|
||||
],
|
||||
VolkswagenCarSpecs(wheelbase=2.92, minSteerSpeed=50 * CV.KPH_TO_MS),
|
||||
VolkswagenCarSpecs(mass=1639, wheelbase=2.92, minSteerSpeed=50 * CV.KPH_TO_MS),
|
||||
chassis_codes={"7N"},
|
||||
wmis={WMI.VOLKSWAGEN_EUROPE_CAR},
|
||||
)
|
||||
VOLKSWAGEN_TAOS_MK1 = VolkswagenMQBPlatformConfig(
|
||||
[VWCarDocs("Volkswagen Taos 2022-24")],
|
||||
VolkswagenCarSpecs(wheelbase=2.69),
|
||||
VolkswagenCarSpecs(mass=1498, wheelbase=2.69),
|
||||
chassis_codes={"B2"},
|
||||
wmis={WMI.VOLKSWAGEN_MEXICO_SUV, WMI.VOLKSWAGEN_ARGENTINA},
|
||||
)
|
||||
VOLKSWAGEN_TCROSS_MK1 = VolkswagenMQBPlatformConfig(
|
||||
[VWCarDocs("Volkswagen T-Cross 2021", footnotes=[Footnote.VW_MQB_A0])],
|
||||
VolkswagenCarSpecs(wheelbase=2.60),
|
||||
VolkswagenCarSpecs(mass=1150, wheelbase=2.60),
|
||||
chassis_codes={"C1"},
|
||||
wmis={WMI.VOLKSWAGEN_EUROPE_SUV},
|
||||
)
|
||||
@@ -466,13 +465,13 @@ class CAR(Platforms):
|
||||
VWCarDocs("Volkswagen Tiguan 2018-24"),
|
||||
VWCarDocs("Volkswagen Tiguan eHybrid 2021-23"),
|
||||
],
|
||||
VolkswagenCarSpecs(wheelbase=2.74),
|
||||
VolkswagenCarSpecs(mass=1715, wheelbase=2.74),
|
||||
chassis_codes={"5N", "AD", "AX", "BW"},
|
||||
wmis={WMI.VOLKSWAGEN_EUROPE_SUV, WMI.VOLKSWAGEN_MEXICO_SUV},
|
||||
)
|
||||
VOLKSWAGEN_TOURAN_MK2 = VolkswagenMQBPlatformConfig(
|
||||
[VWCarDocs("Volkswagen Touran 2016-23")],
|
||||
VolkswagenCarSpecs(wheelbase=2.79),
|
||||
VolkswagenCarSpecs(mass=1516, wheelbase=2.79),
|
||||
chassis_codes={"1T"},
|
||||
wmis={WMI.VOLKSWAGEN_EUROPE_SUV},
|
||||
)
|
||||
@@ -481,13 +480,13 @@ class CAR(Platforms):
|
||||
VWCarDocs("Volkswagen Caravelle 2020"),
|
||||
VWCarDocs("Volkswagen California 2021-23"),
|
||||
],
|
||||
VolkswagenCarSpecs(wheelbase=3.00, minSteerSpeed=14.0),
|
||||
VolkswagenCarSpecs(mass=1926, wheelbase=3.00, minSteerSpeed=14.0),
|
||||
chassis_codes={"7H", "7L"},
|
||||
wmis={WMI.VOLKSWAGEN_COMMERCIAL_BUS_VAN},
|
||||
)
|
||||
VOLKSWAGEN_TROC_MK1 = VolkswagenMQBPlatformConfig(
|
||||
[VWCarDocs("Volkswagen T-Roc 2018-23")],
|
||||
VolkswagenCarSpecs(wheelbase=2.63),
|
||||
VolkswagenCarSpecs(mass=1413, wheelbase=2.63),
|
||||
chassis_codes={"A1"},
|
||||
wmis={WMI.VOLKSWAGEN_EUROPE_SUV},
|
||||
)
|
||||
@@ -498,31 +497,31 @@ class CAR(Platforms):
|
||||
VWCarDocs("Audi RS3 2018"),
|
||||
VWCarDocs("Audi S3 2015-17"),
|
||||
],
|
||||
VolkswagenCarSpecs(wheelbase=2.61),
|
||||
VolkswagenCarSpecs(mass=1335, wheelbase=2.61),
|
||||
chassis_codes={"8V", "FF"},
|
||||
wmis={WMI.AUDI_GERMANY_CAR, WMI.AUDI_SPORT, WMI.VOLKSWAGEN_CHINA_FAW},
|
||||
)
|
||||
AUDI_Q2_MK1 = VolkswagenMQBPlatformConfig(
|
||||
[VWCarDocs("Audi Q2 2018")],
|
||||
VolkswagenCarSpecs(wheelbase=2.61),
|
||||
VolkswagenCarSpecs(mass=1205, wheelbase=2.61),
|
||||
chassis_codes={"GA"},
|
||||
wmis={WMI.AUDI_GERMANY_CAR, WMI.VOLKSWAGEN_CHINA_FAW},
|
||||
)
|
||||
AUDI_Q3_MK2 = VolkswagenMQBPlatformConfig(
|
||||
[VWCarDocs("Audi Q3 2019-24")],
|
||||
VolkswagenCarSpecs(wheelbase=2.68),
|
||||
VolkswagenCarSpecs(mass=1623, wheelbase=2.68),
|
||||
chassis_codes={"8U", "F3", "FS"},
|
||||
wmis={WMI.AUDI_EUROPE_MPV, WMI.AUDI_GERMANY_CAR, WMI.VOLKSWAGEN_CHINA_FAW},
|
||||
)
|
||||
AUDI_Q5_MK1 = VolkswagenMLBPlatformConfig(
|
||||
[VWCarDocs("Audi Q5 2013-17")],
|
||||
VolkswagenCarSpecs(wheelbase=2.81),
|
||||
VolkswagenCarSpecs(mass=1895, wheelbase=2.81),
|
||||
chassis_codes={"8R"},
|
||||
wmis={WMI.AUDI_EUROPE_MPV, WMI.AUDI_GERMANY_CAR},
|
||||
)
|
||||
PORSCHE_MACAN_MK1 = VolkswagenMLBPlatformConfig(
|
||||
[VWCarDocs("Porsche Macan 2017-24")],
|
||||
VolkswagenCarSpecs(wheelbase=2.81, steerRatio=16.2),
|
||||
VolkswagenCarSpecs(mass=1895, wheelbase=2.81, steerRatio=16.2),
|
||||
chassis_codes={"95", "A5"},
|
||||
wmis={WMI.PORSCHE_SUV},
|
||||
)
|
||||
@@ -532,19 +531,19 @@ class CAR(Platforms):
|
||||
VWCarDocs("SEAT Ateca 2016-23"),
|
||||
VWCarDocs("SEAT Leon 2014-20"),
|
||||
],
|
||||
VolkswagenCarSpecs(wheelbase=2.64),
|
||||
VolkswagenCarSpecs(mass=1300, wheelbase=2.64),
|
||||
chassis_codes={"5F"},
|
||||
wmis={WMI.SEAT},
|
||||
)
|
||||
CUPRA_BORN_MK1 = VolkswagenMEBPlatformConfig(
|
||||
[VWCarDocs("CUPRA Born 2021-23", car_parts=CarParts.common([CarHarness.vw_meb]), footnotes=[])],
|
||||
VolkswagenCarSpecs(wheelbase=2.766),
|
||||
VolkswagenCarSpecs(mass=1956, wheelbase=2.766),
|
||||
chassis_codes={"K1"},
|
||||
wmis={WMI.SEAT},
|
||||
)
|
||||
SKODA_FABIA_MK4 = VolkswagenMQBPlatformConfig(
|
||||
[VWCarDocs("Škoda Fabia 2022-23", footnotes=[Footnote.VW_MQB_A0])],
|
||||
VolkswagenCarSpecs(wheelbase=2.56),
|
||||
VolkswagenCarSpecs(mass=1266, wheelbase=2.56),
|
||||
chassis_codes={"PJ"},
|
||||
wmis={WMI.SKODA},
|
||||
)
|
||||
@@ -553,19 +552,19 @@ class CAR(Platforms):
|
||||
VWCarDocs("Škoda Kamiq 2021-23", footnotes=[Footnote.VW_MQB_A0, Footnote.KAMIQ]),
|
||||
VWCarDocs("Škoda Scala 2020-23", footnotes=[Footnote.VW_MQB_A0]),
|
||||
],
|
||||
VolkswagenCarSpecs(wheelbase=2.66),
|
||||
VolkswagenCarSpecs(mass=1230, wheelbase=2.66),
|
||||
chassis_codes={"NW"},
|
||||
wmis={WMI.SKODA},
|
||||
)
|
||||
SKODA_KAROQ_MK1 = VolkswagenMQBPlatformConfig(
|
||||
[VWCarDocs("Škoda Karoq 2019-23")],
|
||||
VolkswagenCarSpecs(wheelbase=2.66),
|
||||
VolkswagenCarSpecs(mass=1278, wheelbase=2.66),
|
||||
chassis_codes={"NU"},
|
||||
wmis={WMI.SKODA},
|
||||
)
|
||||
SKODA_KODIAQ_MK1 = VolkswagenMQBPlatformConfig(
|
||||
[VWCarDocs("Škoda Kodiaq 2017-23")],
|
||||
VolkswagenCarSpecs(wheelbase=2.79),
|
||||
VolkswagenCarSpecs(mass=1569, wheelbase=2.79),
|
||||
chassis_codes={"NS"},
|
||||
wmis={WMI.SKODA, WMI.VOLKSWAGEN_GROUP_RUS},
|
||||
)
|
||||
@@ -575,13 +574,13 @@ class CAR(Platforms):
|
||||
VWCarDocs("Škoda Octavia RS 2016"),
|
||||
VWCarDocs("Škoda Octavia Scout 2017-19"),
|
||||
],
|
||||
VolkswagenCarSpecs(wheelbase=2.68),
|
||||
VolkswagenCarSpecs(mass=1388, wheelbase=2.68),
|
||||
chassis_codes={"NE"},
|
||||
wmis={WMI.SKODA},
|
||||
)
|
||||
SKODA_SUPERB_MK3 = VolkswagenMQBPlatformConfig(
|
||||
[VWCarDocs("Škoda Superb 2015-22")],
|
||||
VolkswagenCarSpecs(wheelbase=2.84),
|
||||
VolkswagenCarSpecs(mass=1505, wheelbase=2.84),
|
||||
chassis_codes={"3V", "NP"},
|
||||
wmis={WMI.SKODA},
|
||||
)
|
||||
|
||||
@@ -5,7 +5,7 @@ Wondering what's the DBC file format? [Here](http://www.socialledge.com/sjsu/ind
|
||||
|
||||
## How to start reverse engineering cars
|
||||
|
||||
[opendbc](https://github.com/commaai/opendbc) is integrated with [cabana](https://github.com/commaai/openpilot/tree/master/openpilot/tools/cabana).
|
||||
[opendbc](https://github.com/commaai/opendbc) is integrated with [cabana](https://github.com/commaai/openpilot/tree/master/tools/cabana).
|
||||
|
||||
Use [panda](https://github.com/commaai/panda) to connect your car to a computer.
|
||||
|
||||
@@ -22,7 +22,7 @@ DBC files for different models of the same brand have a lot of overlap. Therefor
|
||||
```
|
||||
CM_ SG_ 490 LONG_ACCEL "wheel speed derivative, noisy and zero snapping";
|
||||
```
|
||||
is a comment that refers to signal `LONG_ACCEL` in message `490`. Using comments is highly recommended, especially for doubts and uncertainties. [cabana]([https://commaai.github.io/cabana/?demo=1](https://github.com/commaai/openpilot/tree/master/openpilot/tools/cabana)) can easily display/add/edit comments to signals and messages.
|
||||
is a comment that refers to signal `LONG_ACCEL` in message `490`. Using comments is highly recommended, especially for doubts and uncertainties. [cabana](https://community.comma.ai/cabana/) can easily display/add/edit comments to signals and messages.
|
||||
|
||||
- Units: when applicable, it's recommended to convert signals into physical units, by using a proper signal factor. Using a SI unit is preferred, unless a non-SI unit rounds the signal factor much better.
|
||||
For example:
|
||||
|
||||
@@ -1,194 +0,0 @@
|
||||
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_: EPS ESP_ECU BCM VCU MPC_CAM ADAS_ECU MCU BSD
|
||||
|
||||
|
||||
BO_ 287 STEER_MODULE_2: 5 EPS
|
||||
SG_ STEER_ANGLE_2 : 0|16@1- (0.1,0) [-780|780] "deg" MCU,ADAS_ECU
|
||||
SG_ DRIVER_EPS_TORQUE : 16|8@1+ (1,0) [0|255] "" MCU,ADAS_ECU
|
||||
SG_ COUNTER : 35|4@0+ (1,0) [0|15] "" MCU
|
||||
SG_ CHECKSUM_4BIT : 39|4@0+ (1,0) [0|15] "" MCU
|
||||
|
||||
BO_ 290 WHEEL_SPEED: 8 ESP_ECU
|
||||
SG_ WHEELSPEED_FL : 0|16@1+ (0.1,0) [0|6553.5] "kph" MCU,ADAS_ECU
|
||||
SG_ WHEELSPEED_FR : 16|16@1+ (0.1,0) [0|6553.5] "kph" MCU,ADAS_ECU
|
||||
SG_ WHEELSPEED_BL : 32|16@1+ (0.1,0) [0|6553.5] "kph" MCU,ADAS_ECU
|
||||
SG_ WHEELSPEED_BR : 48|16@1+ (0.1,0) [0|6553.5] "kph" MCU,ADAS_ECU
|
||||
|
||||
BO_ 307 STALKS: 8 BCM
|
||||
SG_ LEFT_BLINKER : 37|1@0+ (1,0) [0|1] "" MCU
|
||||
SG_ RIGHT_BLINKER : 38|1@0+ (1,0) [0|1] "" MCU
|
||||
SG_ COUNTER : 48|4@1+ (1,0) [0|15] "" MCU
|
||||
|
||||
BO_ 482 STEERING_MODULE_ADAS: 8 ADAS_ECU
|
||||
SG_ ANGLE_RATE_LIMIT_UPPER : 0|10@1- (1,0) [-512|511] "" EPS
|
||||
SG_ ANGLE_RATE_LIMIT_LOWER : 10|10@1- (1,0) [-512|511] "" EPS
|
||||
SG_ STEER_REQ_ACTIVE_LOW : 20|1@0+ (1,0) [0|1] "" EPS
|
||||
SG_ STEER_REQ : 21|1@0+ (1,0) [0|1] "" EPS
|
||||
SG_ E2E_ALIVE_2 : 22|1@0+ (1,0) [0|1] "" EPS
|
||||
SG_ E2E_ALIVE_1 : 23|1@0+ (1,0) [0|1] "" EPS
|
||||
SG_ STEER_ANGLE : 24|16@1- (0.1,0) [-3276.8|3276.7] "deg" EPS
|
||||
SG_ SET_ME_FF : 47|8@0+ (1,0) [0|255] "" EPS
|
||||
SG_ SET_ME_F : 48|4@1+ (1,0) [0|15] "" EPS
|
||||
SG_ COUNTER : 55|4@0+ (1,0) [0|15] "" EPS
|
||||
SG_ CHECKSUM : 56|8@1+ (1,0) [0|255] "" EPS
|
||||
|
||||
BO_ 496 WHEELSPEED_CLEAN: 8 ESP_ECU
|
||||
SG_ WHEELSPEED_CLEAN : 0|16@1+ (0.1,0) [0|6553.5] "kph" MCU
|
||||
SG_ COUNTER : 55|4@0+ (1,0) [0|15] "" MCU
|
||||
SG_ CHECKSUM : 56|8@1+ (1,0) [0|255] "" MCU
|
||||
|
||||
BO_ 508 STEERING_TORQUE: 8 EPS
|
||||
SG_ LKS_PREPARED : 0|1@1+ (1,0) [0|1] "" MCU,ADAS_ECU
|
||||
SG_ CRUISE_ACTIVATED : 1|1@1+ (1,0) [0|1] "" MCU,ADAS_ECU
|
||||
SG_ TORQUE_FAILED : 2|1@1+ (1,0) [0|1] "" MCU,ADAS_ECU
|
||||
SG_ DRIVER_TORQUE : 4|12@1- (0.1,0) [-204.8|204.7] "Nm" MCU,ADAS_ECU
|
||||
SG_ TARGET_ANGLE : 16|16@1- (0.1,0) [-3276.8|3276.7] "deg" MCU,ADAS_ECU
|
||||
SG_ MAIN_TORQUE : 32|12@1- (1,0) [-2048|2047] "" MCU,ADAS_ECU
|
||||
SG_ HANDS_ON_WHEEL_WARN : 45|1@1+ (1,0) [0|1] "" MCU,ADAS_ECU
|
||||
SG_ TORQUE_TEMP_FAILED : 46|2@1+ (1,0) [0|3] "" MCU,ADAS_ECU
|
||||
SG_ COUNTER : 52|4@1+ (1,0) [0|15] "" MCU
|
||||
SG_ CHECKSUM : 56|8@1+ (1,0) [0|255] "" MCU
|
||||
|
||||
BO_ 578 DRIVE_STATE: 8 VCU
|
||||
SG_ RAW_THROTTLE : 30|7@0+ (1,0) [0|127] "" MCU
|
||||
SG_ BRAKE_PRESSED : 37|1@0+ (1,0) [0|1] "" MCU,ADAS_ECU
|
||||
SG_ GEAR : 40|3@1+ (1,0) [0|7] "" MCU
|
||||
|
||||
BO_ 660 METER_CLUSTER: 8 BCM
|
||||
SG_ FRONT_RIGHT_DOOR : 1|1@1+ (1,0) [0|1] "" MCU
|
||||
SG_ FRONT_LEFT_DOOR : 3|1@0+ (1,0) [0|1] "" MCU
|
||||
SG_ BACK_LEFT_DOOR : 5|1@1+ (1,0) [0|1] "" MCU
|
||||
SG_ BACK_RIGHT_DOOR : 7|1@0+ (1,0) [0|1] "" MCU
|
||||
SG_ SEATBELT_DRIVER : 17|1@0+ (1,0) [0|1] "" MCU
|
||||
|
||||
BO_ 790 LKAS_HUD_ADAS: 8 MPC_CAM
|
||||
SG_ AUTO_LIGHT : 1|2@0+ (1,0) [0|3] "" XXX
|
||||
SG_ LEFT_LANE_STATE : 4|2@1+ (1,0) [0|3] "" MCU
|
||||
SG_ LKS_MODE : 6|2@1+ (1,0) [0|3] "" MCU
|
||||
SG_ HANDS_ON_WHEEL_REQ : 10|1@1+ (1,0) [0|1] "" MCU
|
||||
SG_ TJA_ICA_STATE : 11|4@1+ (1,0) [0|15] "" MCU
|
||||
SG_ HMA_ON_OFF : 15|1@0+ (1,0) [0|1] "" MCU
|
||||
SG_ LKAS_OUTPUT : 16|11@1- (1,0) [-1024|1023] "" MCU
|
||||
SG_ LKAS_REQ_PREPARE : 27|1@1+ (1,0) [0|1] "" MCU
|
||||
SG_ LKAS_ACTIVE : 28|1@1+ (1,0) [0|1] "" MCU
|
||||
SG_ SLA_STATE : 29|3@1+ (1,0) [0|7] "" MCU
|
||||
SG_ RIGHT_LANE_STATE : 34|2@1+ (1,0) [0|3] "" MCU
|
||||
SG_ LKAS_STATE : 36|4@1+ (1,0) [0|15] "" MCU
|
||||
SG_ SPEED_LIMIT_VALUE : 40|8@1+ (5,-5) [-5|1270] "kph" MCU
|
||||
SG_ LDSW_TYPE : 49|2@0+ (1,0) [0|3] "" MCU
|
||||
SG_ COUNTER : 52|4@1+ (1,0) [0|15] "" MCU
|
||||
SG_ CHECKSUM : 56|8@1+ (1,0) [0|255] "" MCU
|
||||
|
||||
BO_ 813 ACC_HUD_ADAS: 8 ADAS_ECU
|
||||
SG_ SET_SPEED : 0|8@1+ (0.5,0) [0|127.5] "kph" MCU
|
||||
SG_ SET_DISTANCE : 12|3@0+ (1,0) [0|7] "" MCU
|
||||
SG_ ACC_STATE : 19|3@1+ (1,0) [0|7] "" MCU
|
||||
SG_ ACC_ON2 : 20|1@0+ (1,0) [0|1] "" MCU
|
||||
SG_ ACC_ON1 : 22|1@0+ (1,0) [0|1] "" MCU
|
||||
SG_ SET_ME_XFF : 47|8@0+ (1,0) [0|255] "" MCU
|
||||
SG_ COUNTER : 48|4@1+ (1,0) [0|15] "" MCU
|
||||
SG_ SET_ME_XF : 55|4@0+ (1,0) [0|15] "" MCU
|
||||
SG_ CHECKSUM : 56|8@1+ (1,0) [0|255] "" MCU
|
||||
|
||||
BO_ 814 ACC_CMD: 8 ADAS_ECU
|
||||
SG_ ACCEL_CMD : 0|8@1+ (1,-100) [-100|155] "" MCU
|
||||
SG_ ACC_ON_1 : 9|1@0+ (1,0) [0|1] "" MCU
|
||||
SG_ SET_ME_25_1 : 10|6@1+ (1,0) [0|63] "" MCU
|
||||
SG_ ACC_ON_2 : 17|1@0+ (1,0) [0|1] "" MCU
|
||||
SG_ SET_ME_25_2 : 18|6@1+ (1,0) [0|63] "" MCU
|
||||
SG_ DECEL_FACTOR : 24|4@1+ (1,0) [0|15] "" MCU
|
||||
SG_ SET_ME_X8 : 31|4@0+ (1,0) [0|15] "" MCU
|
||||
SG_ ACCEL_FACTOR : 32|4@1+ (1,0) [0|15] "" MCU
|
||||
SG_ CMD_REQ_ACTIVE_LOW : 36|1@0+ (1,0) [0|1] "" MCU
|
||||
SG_ SET_ME_1 : 38|1@0+ (1,0) [0|1] "" MCU
|
||||
SG_ STANDSTILL_RESUME : 39|1@0+ (1,0) [0|1] "" MCU
|
||||
SG_ STANDSTILL_STATE : 40|1@0+ (1,0) [0|1] "" MCU
|
||||
SG_ ACC_REQ_NOT_STANDSTILL : 43|1@0+ (1,0) [0|1] "" MCU
|
||||
SG_ ACC_CONTROLLABLE_AND_ON : 44|1@0+ (1,0) [0|1] "" MCU
|
||||
SG_ ACC_OVERRIDE_OR_STANDSTILL : 45|1@0+ (1,0) [0|1] "" MCU
|
||||
SG_ COUNTER : 48|4@1+ (1,0) [0|15] "" MCU
|
||||
SG_ SET_ME_XF : 55|4@0+ (1,0) [0|15] "" MCU
|
||||
SG_ CHECKSUM : 56|8@1+ (1,0) [0|255] "" MCU
|
||||
|
||||
BO_ 834 PEDAL: 8 VCU
|
||||
SG_ GAS_PEDAL : 0|8@1+ (0.01,0) [0|2.55] "" MCU
|
||||
SG_ BRAKE_PEDAL : 8|8@1+ (0.01,0) [0|2.55] "" MCU
|
||||
SG_ COUNTER : 55|4@0+ (1,0) [0|15] "" MCU
|
||||
SG_ CHECKSUM : 56|8@1+ (1,0) [0|255] "" MCU
|
||||
|
||||
BO_ 944 PCM_BUTTONS: 8 MCU
|
||||
SG_ SET_ME_1_1 : 2|1@0+ (1,0) [0|1] "" MCU
|
||||
SG_ SET_BTN : 3|1@0+ (1,0) [0|1] "" MCU
|
||||
SG_ RES_BTN : 4|1@0+ (1,0) [0|1] "" MCU
|
||||
SG_ LKAS_ON_BTN : 6|1@0+ (1,0) [0|1] "" MCU
|
||||
SG_ SET_ME_1_2 : 12|1@0+ (1,0) [0|1] "" MCU
|
||||
SG_ DEC_DISTANCE_BTN : 15|1@0+ (1,0) [0|1] "" MCU
|
||||
SG_ INC_DISTANCE_BTN : 16|1@0+ (1,0) [0|1] "" MCU
|
||||
SG_ ACC_ON_BTN : 19|1@0+ (1,0) [0|1] "" MCU
|
||||
SG_ COUNTER : 55|4@0+ (1,0) [0|15] "" MCU
|
||||
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" MCU
|
||||
|
||||
BO_ 1048 BSD_RADAR: 8 BSD
|
||||
SG_ LEFT_APPROACH : 9|2@0+ (1,0) [0|3] "" MCU,ADAS_ECU
|
||||
SG_ RIGHT_APPROACH : 11|2@0+ (1,0) [0|3] "" MCU,ADAS_ECU
|
||||
SG_ APPROACH : 17|1@0+ (1,0) [0|1] "" MCU,ADAS_ECU
|
||||
|
||||
CM_ BO_ 287 "EPS steering wheel angle + driver torque. Validated: angle range plausible, DRIVER_EPS_TORQUE stays near 0 when hands-off.";
|
||||
CM_ BO_ 290 "Per-wheel speed from ESP (FL/FR/BL/BR). Scale 0.1 kph/bit. Use WHEELSPEED_CLEAN (0x1F0) for the aggregated filtered value openpilot consumes.";
|
||||
CM_ BO_ 307 "Turn signal / stalk info. Validated: LEFT_BLINKER and RIGHT_BLINKER transition 0->1 during lane change events.";
|
||||
CM_ BO_ 482 "Lateral steering command sent by MPC camera/ADAS ECU to EPS. Blocked by panda on bus 2; panda injects its own on bus 0.";
|
||||
CM_ BO_ 496 "Wheel speed (cleaned average). Validated: 0-127 km/h matching driving speed.";
|
||||
CM_ BO_ 508 "Column steering torque from EPS.";
|
||||
CM_ BO_ 578 "Drivetrain state: gear, brake pressed, raw throttle.";
|
||||
CM_ BO_ 660 "Body/meter cluster: doors + seatbelt.";
|
||||
CM_ BO_ 790 "LKAS HUD ADAS message from camera. Blocked by panda on bus 2; panda re-injects.";
|
||||
CM_ BO_ 813 "ACC HUD ADAS message (cruise set speed, distance, ACC state).";
|
||||
CM_ BO_ 814 "ACC acceleration command from ADAS ECU. Blocked by panda on bus 2 when OP longitudinal active.";
|
||||
CM_ BO_ 834 "Gas/brake pedal percentages.";
|
||||
CM_ BO_ 944 "Steering-wheel cruise control buttons.";
|
||||
VAL_ 508 TORQUE_TEMP_FAILED 1 "TooLarge" 2 "TooFast" 3 "Both";
|
||||
VAL_ 578 GEAR 4 "D" 2 "R" 3 "N" 1 "P";
|
||||
VAL_ 790 AUTO_LIGHT 1 "OFF" 2 "ON";
|
||||
VAL_ 790 LEFT_LANE_STATE 0 "OFF" 1 "GREEN" 2 "ORANGE";
|
||||
VAL_ 790 LKS_MODE 0 "OFF" 1 "DIVERGE" 2 "KEEPING" 3 "ALL";
|
||||
VAL_ 790 TJA_ICA_STATE 0 "OFF" 1 "PASSIVE" 2 "ACTIVE1" 3 "ACTIVE2" 4 "FAULT";
|
||||
VAL_ 790 SLA_STATE 0 "OFF" 1 "FUSION_MODE" 2 "VISION_MODE" 3 "NV_ONLY_MODE" 4 "DEFECT";
|
||||
VAL_ 790 RIGHT_LANE_STATE 0 "OFF" 1 "GREEN" 2 "ORANGE";
|
||||
VAL_ 790 LKAS_STATE 2 "ACTIVE" 1 "OFF";
|
||||
VAL_ 790 LDSW_TYPE 0 "VIBRATE" 1 "SOUND" 2 "ALL";
|
||||
VAL_ 813 SET_DISTANCE 4 "4bar" 3 "3bar" 2 "2bar" 1 "1bar";
|
||||
VAL_ 813 ACC_STATE 0 "OFF" 2 "ACC_ON" 3 "ACC_ACTIVE" 5 "FORCE_ACCEL" 7 "ERROR";
|
||||
@@ -299,7 +299,6 @@ BO_ 313 VMM_02: 32 XXX
|
||||
SG_ FCW_Reaction_2 : 56|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ Brake_Pressure : 76|11@1+ (1,0) [0|100] "" XXX
|
||||
SG_ FCW_Reaction_3 : 88|5@1+ (1,0) [0|31] "" XXX
|
||||
SG_ HMS_Status : 196|4@1+ (1,0) [0|15] "" XXX
|
||||
|
||||
BO_ 317 QFK_01: 32 XXX
|
||||
SG_ CHECKSUM : 0|8@1+ (1,0) [0|255] "" XXX
|
||||
@@ -2028,7 +2027,6 @@ CM_ SG_ 219 Unknown_192 "Constant per platform (0 on all gen1 ID.4/Born, 1 on al
|
||||
CM_ SG_ 219 Unknown_27 "Low bit tracks AWV_Unavailable, but is also set in 20-33% of normal driving";
|
||||
CM_ SG_ 219 Unknown_80 "Low bit is normally 1 and clears with AWV_Unavailable, but also clears in ~1% of normal driving";
|
||||
CM_ SG_ 313 Long_Control_Inhibit "Goes high after user brakes hard, causes temporary TSK_Status fault";
|
||||
CM_ SG_ 313 HMS_Status "Hold manager response to ACC_18.ACC_Anforderung_HMS and auto hold, 2024+ only";
|
||||
CM_ SG_ 333 SET_ME_0x2FE "Only set by stock ACC on 2024+; reads 0 on pre-2024 and is not packed by mebcan";
|
||||
CM_ SG_ 380196013 AWV_Status "Mirrors AWV_03.AWV_Unavailable, at a higher rate";
|
||||
CM_ BO_ 317 "Lenkungssteuergerät";
|
||||
@@ -2157,7 +2155,6 @@ VAL_ 299 GRA_LIM_Taste_verfuegbar 0 "Limiter_Taste_nicht_vorhanden" 1 "Limiter_T
|
||||
VAL_ 299 GRA_Tip_Stufe_2 0 "Tip_Stufe_1__keine_Betaetigung" 1 "Tip_Stufe_2";
|
||||
VAL_ 299 GRA_TravelAssist 0 "nicht_betaetigt" 1 "betaetigt";
|
||||
VAL_ 313 Long_Control_Inhibit 1 "not_inhibited" 2 "inhibited";
|
||||
VAL_ 313 HMS_Status 0 "not_holding" 1 "holding" 5 "starting" 6 "releasing" 9 "stopping";
|
||||
VAL_ 317 LatCon_HCA_Status 0 "disabled" 1 "initializing" 2 "ready" 3 "fault" 4 "active" 5 "preempted" 6 "fault" 7 "rejected";
|
||||
VAL_ 319 PreCrash_Charisma_FahrPr 0 "keine_Funktion" 1 "Programm_1" 2 "Programm_2" 3 "Programm_3" 4 "Programm_4" 5 "Programm_5" 6 "Programm_6" 7 "Programm_7" 8 "Programm_8" 9 "Programm_9" 10 "Programm_10" 11 "Programm_11" 12 "Programm_12" 13 "Programm_13" 14 "Programm_14" 15 "Programm_15";
|
||||
VAL_ 319 PreCrash_Charisma_Status 0 "Init" 1 "verfuegbar" 2 "nicht_verfuegbar" 3 "asynchron_durch_Fahrerwunsch";
|
||||
|
||||
@@ -140,7 +140,6 @@ BO_ 532 SCS_HSC2_FrP09: 6 SCSABS
|
||||
SG_ BrkPdlDrvrAppdPrsVHSC2 : 0|1@0+ (1,0) [0|1] "" FVCM
|
||||
|
||||
BO_ 572 SCS_HSC2_FrP19: 8 SCSABS
|
||||
SG_ VehSpdAvgChksmHSC2 : 63|8@0+ (1,0) [0|255] "" SCSABS
|
||||
SG_ VehSpdAvgHSC2 : 22|15@0+ (0.015625,0) [0|511.984] "km/h" FVCM,FDR
|
||||
SG_ VehSpdAvgAlvRCHSC2 : 39|4@0+ (1,0) [0|15] "" FVCM,FDR
|
||||
SG_ VehSpdAvgPVHSC2 : 7|16@0+ (1,0) [0|65535] "" FVCM,FDR
|
||||
|
||||
@@ -36,22 +36,6 @@ BS_:
|
||||
BU_: CH DIPF DIPR ETH FC HVI HVS PARTY SDCV VEH VIRT
|
||||
|
||||
|
||||
BO_ 84 DI_autonomyHealth: 8 XXX
|
||||
SG_ DI_ah_vehicleSpeedLimit : 0|9@1+ (1,0) [0|511] "" XXX
|
||||
SG_ DI_ah_vehicleReverseSpeedLimit : 9|5@1+ (1,0) [0|31] "" XXX
|
||||
SG_ DI_autonomyBehavior : 14|2@1+ (1,0) [0|3] "" XXX
|
||||
SG_ DI_ah_vehicleNoGradeAccelMax : 16|8@1+ (0.04,0) [0|10.2] "" XXX
|
||||
SG_ DI_ah_vehicleNoGradeDecelMax : 24|9@1+ (0.04,0) [0|20.44] "" XXX
|
||||
SG_ DI_ah_timeToNoPropulsion : 33|12@1+ (1,0) [0|4095] "" XXX
|
||||
SG_ DI_ah_dGearAvailable : 45|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ DI_ah_rGearAvailable : 46|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ DI_ah_pGearAvailable : 47|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ DI_loncDegradedAvailable : 48|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ DI_loncDegradedReason : 49|4@1+ (1,0) [0|15] "" XXX
|
||||
SG_ DI_epbUnavailable : 53|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ DI_opdAvailableForPedalInterface : 54|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ DI_loncInPreFaultStopping : 55|1@1+ (1,0) [0|1] "" XXX
|
||||
|
||||
BO_ 905 DAS_status2: 8 PARTY
|
||||
SG_ DAS_status2Checksum : 56|8@1+ (1,0) [0|255] "" aps
|
||||
SG_ DAS_status2Counter : 52|4@1+ (1,0) [0|15] "" aps
|
||||
@@ -220,22 +204,10 @@ BO_ 605 DAS_road: 6 XXX
|
||||
BO_ 1160 DAS_steeringControl: 4 PARTY
|
||||
SG_ DAS_steeringControlChecksum : 24|8@1+ (1,0) [0|255] "" aps
|
||||
SG_ DAS_steeringControlCounter : 16|4@1+ (1,0) [0|15] "" aps
|
||||
SG_ DAS_steeringControlType : 23|3@0+ (1,0) [0|7] "" aps
|
||||
SG_ DAS_steeringControlType : 23|2@0+ (1,0) [0|3] "" aps
|
||||
SG_ DAS_steeringAngleRequest : 6|15@0+ (0.1,-1638.35) [-1638.35|1638.35] "deg" aps
|
||||
SG_ DAS_steeringHapticRequest : 7|1@0+ (1,0) [0|1] "" aps
|
||||
|
||||
BO_ 1161 DAS_redundantBrakingControl: 8 XXX
|
||||
SG_ DAS_redundantBrakingControlChecksum : 0|8@1+ (1,0) [0|255] "" XXX
|
||||
SG_ DAS_redundantBrakingControlCounter : 8|4@1+ (1,0) [0|15] "" XXX
|
||||
SG_ DAS_useDasFallbackBrakeCommands : 12|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ DAS_brakeTorqueCommand : 13|13@1+ (3,0) [0|24573] "" XXX
|
||||
SG_ DAS_brakeTorqueRequestActive : 26|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ DAS_miaBrakeTorqueCommand : 27|13@1+ (3,0) [0|24573] "" XXX
|
||||
SG_ DAS_preAbbaBrakeTorqueDebug : 40|13@1+ (3,0) [0|24573] "" XXX
|
||||
SG_ DAS_abbaStateDebug : 56|4@1+ (1,0) [0|15] "" XXX
|
||||
SG_ DAS_abbaESPMiaBit : 60|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ DAS_abbaLongStabilityIsUnavailableBit : 61|1@1+ (1,0) [0|1] "" XXX
|
||||
|
||||
BO_ 297 SCCM_steeringAngleSensor: 8 PARTY
|
||||
SG_ SCCM_steeringAngleSensorReservd3 : 56|8@1+ (1,0) [0|255] "" X
|
||||
SG_ SCCM_steeringAngleSensorReservd2 : 48|8@1+ (1,0) [0|255] "" X
|
||||
@@ -348,15 +320,11 @@ BO_ 325 ESP_status: 8 PARTY
|
||||
|
||||
CM_ BO_ 605 "Bytes change when toggling between FSD and AP, as well as Traffic Light and Stop Sign Control in TACC";
|
||||
|
||||
CM_ BO_ 84 "Appears with the 3-bit DAS_steeringControlType firmware on all Autopilot hardware, including HW2.5";
|
||||
CM_ SG_ 659 DAS_autosteerEnabled "1 if Autosteer or FSD is enabled, 0 otherwise";
|
||||
CM_ SG_ 1160 DAS_steeringControlType "Older firmware only used the top 2 bits (bits 7:6), and is not supported";
|
||||
CM_ BO_ 1161 "Sent by HW3/HW4 Autopilot computers only on firmware with the 3-bit DAS_steeringControlType (not by HW2.5)";
|
||||
CM_ SG_ 785 leftBlinkerOn "only describes stalk position if half pressed without auto-cancel blinkers. otherwise acts as expected";
|
||||
CM_ SG_ 785 rightBlinkerOn "only describes stalk position if half pressed without auto-cancel blinkers. otherwise acts as expected";
|
||||
CM_ SG_ 785 scrollWheelPressed "captures either scroll wheel left, right or down press";
|
||||
|
||||
VAL_ 84 DI_ah_vehicleSpeedLimit 511 "SNA" ;
|
||||
VAL_ 545 VCFRONT_uiAudioLVState 1 "LV_ON" 2 "LV_GOING_DOWN" 3 "LV_FAULT" 0 "LV_OFF" ;
|
||||
VAL_ 545 VCFRONT_uiHiCurrentLVState 1 "LV_ON" 2 "LV_GOING_DOWN" 3 "LV_FAULT" 0 "LV_OFF" ;
|
||||
VAL_ 545 VCFRONT_vcrightHiCurrentLVState 1 "LV_ON" 2 "LV_GOING_DOWN" 3 "LV_FAULT" 0 "LV_OFF" ;
|
||||
@@ -458,7 +426,7 @@ VAL_ 599 DI_uiSpeedUnits 0 "DI_SPEED_MPH" 1 "DI_SPEED_KPH" ;
|
||||
VAL_ 599 DI_uiSpeed 255 "DI_UI_SPEED_SNA" ;
|
||||
VAL_ 599 DI_vehicleSpeed 4095 "SNA" ;
|
||||
VAL_ 637 APS_eacAllow 0 "INHIBIT" 1 "ALLOW" 2 "RESERVED" 3 "SNA";
|
||||
VAL_ 1160 DAS_steeringControlType 2 "LANE_KEEP_ASSIST" 0 "NONE" 1 "ANGLE_CONTROL" 3 "EMERGENCY_LANE_KEEP" 4 "FSD" ;
|
||||
VAL_ 1160 DAS_steeringControlType 2 "LANE_KEEP_ASSIST" 0 "NONE" 1 "ANGLE_CONTROL" 3 "EMERGENCY_LANE_KEEP" ;
|
||||
VAL_ 1160 DAS_steeringAngleRequest 16384 "ZERO_ANGLE" ;
|
||||
VAL_ 297 SCCM_steeringAngleValidity 3 "SNA" 2 "INIT" 0 "INVALID" 1 "VALID" ;
|
||||
VAL_ 297 SCCM_steeringAngleSensorStatus 0 "OK" 1 "INIT" 2 "ERROR" 3 "ERROR_INIT" ;
|
||||
|
||||
@@ -87,10 +87,10 @@ BO_ 304 PLA_01: 8 XXX
|
||||
SG_ PLA_LW_Soll : 16|13@1+ (0.1,0) [0.0|819.1] "Unit_DegreOfArc" XXX
|
||||
SG_ PLA_VZ_LW_Soll : 31|1@1+ (1.0,0.0) [0.0|1] "" XXX
|
||||
SG_ PLA_Status_PLA_EPS : 32|4@1+ (1.0,0.0) [0.0|15] "" XXX
|
||||
SG_ PLA_Bremsmoment m0 : 36|13@1+ (4,0) [0|32760] "Unit_NewtoMeter" XXX
|
||||
SG_ PLA_Bremsverzoegerung m1 : 36|7@1+ (0.1,0) [0|12] "Unit_MeterPerSeconSquar" XXX
|
||||
SG_ PLA_Anf_Bremsverzoegerung m1 : 43|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ PLA_BremsMom_Verzoeg M : 50|1@1+ (1,0) [0|1] "" XXX
|
||||
SG_ PLA_Bremsmoment : 36|13@1+ (4,0) [0|32760] "Unit_NewtoMeter" XXX
|
||||
SG_ PLA_Bremsverzoegerung : 36|7@1+ (0.1,0) [0.0|12.0] "Unit_MeterPerSeconSquar" XXX
|
||||
SG_ PLA_Anf_Bremsverzoegerung : 43|1@1+ (1.0,0.0) [0.0|1] "" XXX
|
||||
SG_ PLA_BremsMom_Verzoeg : 50|1@1+ (1.0,0.0) [0.0|1] "" XXX
|
||||
SG_ PLA_Anhalten : 51|1@1+ (1.0,0.0) [0.0|1] "" XXX
|
||||
SG_ PLA_Anhalteweg : 52|11@1+ (0.01,0) [0.01|20.45] "Unit_Meter" XXX
|
||||
SG_ PLA_01_Signal_red_cyclic : 63|1@1+ (1.0,0.0) [0.0|1] "" XXX
|
||||
@@ -1633,7 +1633,6 @@ CM_ SG_ 302 ACC_Freewheel_Request "Active request for DSG sailing/coasting in AC
|
||||
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_ 304 PLA_BremsMom_Verzoeg "0=PLA_Bremsmoment, 1=PLA_Bremsverzoegerung/PLA_Anf_Bremsverzoegerung.";
|
||||
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";
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
#define SAFETY_PSA 31U
|
||||
#define SAFETY_RIVIAN 33U
|
||||
#define SAFETY_VOLKSWAGEN_MEB 34U
|
||||
#define SAFETY_BYD 35U
|
||||
#define SAFETY_MG 38U
|
||||
|
||||
#define GET_BIT(msg, b) ((bool)!!(((msg)->data[((b) / 8U)] >> ((b) % 8U)) & 0x1U))
|
||||
@@ -60,8 +59,7 @@
|
||||
#define UPDATE_VEHICLE_SPEED(val_ms) (update_sample(&vehicle_speed, ROUND((val_ms) * VEHICLE_SPEED_FACTOR)))
|
||||
#define UPDATE_VEHICLE_SPEED_2(val_ms) (update_sample(&vehicle_speed_2, ROUND((val_ms) * VEHICLE_SPEED_FACTOR)))
|
||||
|
||||
uint32_t GET_BYTES_LE(const CANPacket_t *msg, int start, int len);
|
||||
uint64_t GET_BYTES_64_LE(const CANPacket_t *msg, int start, int len);
|
||||
uint32_t GET_BYTES(const CANPacket_t *msg, int start, int len);
|
||||
|
||||
extern const int MAX_WRONG_COUNTERS;
|
||||
#define MAX_ADDR_CHECK_MSGS 3U
|
||||
@@ -255,7 +253,7 @@ bool longitudinal_interceptor_checks(const CANPacket_t *msg); // gas intercepto
|
||||
void pcm_cruise_check(bool cruise_engaged);
|
||||
void speed_mismatch_check(const float speed_2);
|
||||
|
||||
void safety_tick(void);
|
||||
void safety_tick(const safety_config *safety_config);
|
||||
|
||||
// This can be set by the safety hooks
|
||||
extern bool controls_allowed;
|
||||
@@ -370,5 +368,4 @@ extern const safety_hooks volkswagen_meb_hooks;
|
||||
extern const safety_hooks volkswagen_pq_hooks;
|
||||
extern const safety_hooks rivian_hooks;
|
||||
extern const safety_hooks psa_hooks;
|
||||
extern const safety_hooks byd_hooks;
|
||||
extern const safety_hooks mg_hooks;
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
#include "opendbc/safety/declarations.h"
|
||||
|
||||
// cppcheck-suppress-macro misra-c2012-1.2; allow __typeof__ extension
|
||||
@@ -36,36 +34,6 @@
|
||||
|
||||
#define SAFETY_UNUSED(x) ((void)(x))
|
||||
|
||||
// Update an MSB-first CRC8 with one byte; callers choose the initial value and final XOR.
|
||||
static uint8_t crc8_update(uint8_t initial_crc, uint8_t data, uint8_t poly) {
|
||||
uint8_t crc = initial_crc ^ data;
|
||||
for (int i = 0; i < 8; i++) {
|
||||
if ((crc & 0x80U) != 0U) {
|
||||
crc = (crc << 1) ^ poly;
|
||||
} else {
|
||||
crc <<= 1;
|
||||
}
|
||||
}
|
||||
return crc;
|
||||
}
|
||||
|
||||
// Compare address and bus as one key: CANPacket_t has a 29-bit address and 3-bit bus.
|
||||
static bool msg_matches_addr_bus(const CANPacket_t *msg, uint32_t addr, uint32_t bus) {
|
||||
uint32_t actual = ((uint32_t)msg->addr << 3) | (uint32_t)msg->bus;
|
||||
uint32_t expected = (addr << 3) | bus;
|
||||
return actual == expected;
|
||||
}
|
||||
|
||||
// Compare address, bus, and decoded byte length as one key.
|
||||
static bool msg_matches_addr_bus_len(const CANPacket_t *msg, uint32_t addr, uint32_t bus, uint32_t len) {
|
||||
uint64_t actual = ((uint64_t)msg->addr << 10) | ((uint64_t)msg->bus << 7) | (uint64_t)dlc_to_len[msg->data_len_code];
|
||||
uint64_t expected = ((uint64_t)addr << 10) | ((uint64_t)bus << 7) | (uint64_t)len;
|
||||
return actual == expected;
|
||||
}
|
||||
|
||||
#define MSG_MATCHES_SELECT(_msg, _addr, _bus, _len, NAME, ...) NAME
|
||||
#define msg_matches(...) MSG_MATCHES_SELECT(__VA_ARGS__, msg_matches_addr_bus_len, msg_matches_addr_bus)(__VA_ARGS__)
|
||||
|
||||
// compute the time elapsed (in microseconds) from 2 counter samples
|
||||
// case where ts < ts_last is ok: overflow is properly re-casted into uint32_t
|
||||
static inline uint32_t safety_get_ts_elapsed(uint32_t ts, uint32_t ts_last) {
|
||||
|
||||
@@ -4,64 +4,74 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#include "opendbc/safety/can.h"
|
||||
#include "opendbc/safety/helpers.h"
|
||||
|
||||
bool ignition_can = false;
|
||||
uint32_t ignition_can_cnt = 0U;
|
||||
|
||||
void ignition_can_hook(const CANPacket_t *msg) {
|
||||
// GM exception
|
||||
if (msg_matches(msg, 0x1F1U, 0U, 8U)) {
|
||||
// SystemPowerMode (2=Run, 3=Crank Request)
|
||||
ignition_can = (msg->data[0] & 0x2U) != 0U;
|
||||
ignition_can_cnt = 0U;
|
||||
}
|
||||
if (msg->bus == 0U) {
|
||||
int len = GET_LEN(msg);
|
||||
|
||||
// Rivian R1S/T GEN1 exception
|
||||
if (msg_matches(msg, 0x152U, 0U, 8U)) {
|
||||
// 0x152 overlaps with Subaru pre-global which has this bit as the high beam
|
||||
int counter = msg->data[1] & 0xFU; // max is only 14
|
||||
|
||||
static int prev_counter_rivian = -1;
|
||||
if ((counter == ((prev_counter_rivian + 1) % 15)) && (prev_counter_rivian != -1)) {
|
||||
// VDM_OutputSignals->VDM_EpasPowerMode
|
||||
ignition_can = ((msg->data[7] >> 4U) & 0x3U) == 1U; // VDM_EpasPowerMode_Drive_On=1
|
||||
// GM exception
|
||||
if ((msg->addr == 0x1F1U) && (len == 8)) {
|
||||
// SystemPowerMode (2=Run, 3=Crank Request)
|
||||
ignition_can = (msg->data[0] & 0x2U) != 0U;
|
||||
ignition_can_cnt = 0U;
|
||||
}
|
||||
prev_counter_rivian = counter;
|
||||
}
|
||||
|
||||
// Tesla Model 3/Y exception
|
||||
if (msg_matches(msg, 0x221U, 0U, 8U)) {
|
||||
// 0x221 overlaps with Rivian which has random data on byte 0
|
||||
int counter = msg->data[6] >> 4;
|
||||
// Rivian R1S/T GEN1 exception
|
||||
if ((msg->addr == 0x152U) && (len == 8)) {
|
||||
// 0x152 overlaps with Subaru pre-global which has this bit as the high beam
|
||||
int counter = msg->data[1] & 0xFU; // max is only 14
|
||||
|
||||
static int prev_counter_tesla = -1;
|
||||
if ((counter == ((prev_counter_tesla + 1) % 16)) && (prev_counter_tesla != -1)) {
|
||||
// VCFRONT_LVPowerState->VCFRONT_vehiclePowerState
|
||||
int power_state = (msg->data[0] >> 5U) & 0x3U;
|
||||
ignition_can = power_state == 0x3; // VEHICLE_POWER_STATE_DRIVE=3
|
||||
static int prev_counter_rivian = -1;
|
||||
if ((counter == ((prev_counter_rivian + 1) % 15)) && (prev_counter_rivian != -1)) {
|
||||
// VDM_OutputSignals->VDM_EpasPowerMode
|
||||
ignition_can = ((msg->data[7] >> 4U) & 0x3U) == 1U; // VDM_EpasPowerMode_Drive_On=1
|
||||
ignition_can_cnt = 0U;
|
||||
}
|
||||
prev_counter_rivian = counter;
|
||||
}
|
||||
|
||||
// Tesla Model 3/Y exception
|
||||
if ((msg->addr == 0x221U) && (len == 8)) {
|
||||
// 0x221 overlaps with Rivian which has random data on byte 0
|
||||
int counter = msg->data[6] >> 4;
|
||||
|
||||
static int prev_counter_tesla = -1;
|
||||
if ((counter == ((prev_counter_tesla + 1) % 16)) && (prev_counter_tesla != -1)) {
|
||||
// VCFRONT_LVPowerState->VCFRONT_vehiclePowerState
|
||||
int power_state = (msg->data[0] >> 5U) & 0x3U;
|
||||
ignition_can = power_state == 0x3; // VEHICLE_POWER_STATE_DRIVE=3
|
||||
ignition_can_cnt = 0U;
|
||||
}
|
||||
prev_counter_tesla = counter;
|
||||
}
|
||||
|
||||
// Mazda exception
|
||||
if ((msg->addr == 0x9EU) && (len == 8)) {
|
||||
ignition_can = (msg->data[0] >> 5) == 0x6U;
|
||||
ignition_can_cnt = 0U;
|
||||
}
|
||||
prev_counter_tesla = counter;
|
||||
}
|
||||
|
||||
// Mazda exception
|
||||
if (msg_matches(msg, 0x9EU, 0U, 8U)) {
|
||||
ignition_can = (msg->data[0] >> 5) == 0x6U;
|
||||
ignition_can_cnt = 0U;
|
||||
}
|
||||
// Volkswagen MEB exception
|
||||
if ((msg->addr == 0x3C0U) && (len == 4)) {
|
||||
int counter = msg->data[1] & 0xFU;
|
||||
|
||||
// Volkswagen MEB exception
|
||||
if (msg_matches(msg, 0x3C0U, 0U, 4U)) {
|
||||
int counter = msg->data[1] & 0xFU;
|
||||
|
||||
static int prev_counter_vw_meb = -1;
|
||||
if ((counter == ((prev_counter_vw_meb + 1) % 16)) && (prev_counter_vw_meb != -1)) {
|
||||
// Klemmen_Status_01->ZAS_Kl_15
|
||||
ignition_can = ((msg->data[2] >> 1) & 1U) != 0U;
|
||||
ignition_can_cnt = 0U;
|
||||
static int prev_counter_vw_meb = -1;
|
||||
if ((counter == ((prev_counter_vw_meb + 1) % 16)) && (prev_counter_vw_meb != -1)) {
|
||||
// Klemmen_Status_01->ZAS_Kl_15
|
||||
ignition_can = ((msg->data[2] >> 1) & 1U) != 0U;
|
||||
ignition_can_cnt = 0U;
|
||||
}
|
||||
prev_counter_vw_meb = counter;
|
||||
}
|
||||
prev_counter_vw_meb = counter;
|
||||
}
|
||||
|
||||
// TODO: this is too loose, Teslas have 0x222
|
||||
// body v2 exception
|
||||
// if (((msg->bus == 0U) || (msg->bus == 2U)) && (msg->addr == 0x222U)) {
|
||||
// ignition_can = true;
|
||||
// ignition_can_cnt = 0U;
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -2,28 +2,10 @@
|
||||
|
||||
#include "opendbc/safety/declarations.h"
|
||||
|
||||
static uint8_t body_get_counter(const CANPacket_t *msg) {
|
||||
return msg->data[6] & 0xFU;
|
||||
}
|
||||
|
||||
static uint32_t body_get_checksum(const CANPacket_t *msg) {
|
||||
return msg->data[7];
|
||||
}
|
||||
|
||||
static uint32_t body_compute_checksum(const CANPacket_t *msg) {
|
||||
uint8_t checksum = 0xFFU;
|
||||
int len = GET_LEN(msg);
|
||||
for (int i = len - 2; i >= 0; i--) {
|
||||
checksum = crc8_update(checksum, msg->data[i], 0xD5U);
|
||||
}
|
||||
return checksum;
|
||||
}
|
||||
|
||||
static void body_rx_hook(const CANPacket_t *msg) {
|
||||
SAFETY_UNUSED(msg);
|
||||
|
||||
// controls allowed as soon as RX is valid
|
||||
controls_allowed = true;
|
||||
if (msg->addr == 0x201U) {
|
||||
controls_allowed = true;
|
||||
}
|
||||
}
|
||||
|
||||
static bool body_tx_hook(const CANPacket_t *msg) {
|
||||
@@ -35,7 +17,7 @@ static bool body_tx_hook(const CANPacket_t *msg) {
|
||||
|
||||
// Allow going into CAN flashing mode even if controls are not allowed
|
||||
bool flash_msg = (msg->addr == 0x250U) && (GET_LEN(msg) == 8U);
|
||||
if (!controls_allowed && flash_msg && (GET_BYTES_64_LE(msg, 0, 8) == 0x0AB00B1EDEADFACEULL)) {
|
||||
if (!controls_allowed && (GET_BYTES(msg, 0, 4) == 0xdeadfaceU) && (GET_BYTES(msg, 4, 4) == 0x0ab00b1eU) && flash_msg) {
|
||||
tx = true;
|
||||
}
|
||||
|
||||
@@ -44,15 +26,11 @@ static bool body_tx_hook(const CANPacket_t *msg) {
|
||||
|
||||
static safety_config body_init(uint16_t param) {
|
||||
static RxCheck body_rx_checks[] = {
|
||||
{.msg = {{0x201, 0, 8, 100U, .max_counter = 15U, .ignore_quality_flag = true}, { 0 }, { 0 }}},
|
||||
{.msg = {{0x201, 0, 8, 100U, .ignore_checksum = true, .ignore_counter = true, .ignore_quality_flag = true}, { 0 }, { 0 }}},
|
||||
};
|
||||
|
||||
static const CanMsg BODY_TX_MSGS[] = {
|
||||
{0x250, 0, 8, .check_relay = false},
|
||||
{0x250, 0, 6, .check_relay = false},
|
||||
{0x251, 0, 5, .check_relay = false},
|
||||
{0x1, 0, 8, .check_relay = false}, // CAN flasher
|
||||
};
|
||||
static const CanMsg BODY_TX_MSGS[] = {{0x250, 0, 8, .check_relay = false}, {0x250, 0, 6, .check_relay = false}, {0x251, 0, 5, .check_relay = false}, // body
|
||||
{0x1, 0, 8, .check_relay = false}}; // CAN flasher
|
||||
|
||||
SAFETY_UNUSED(param);
|
||||
safety_config ret = BUILD_SAFETY_CFG(body_rx_checks, BODY_TX_MSGS);
|
||||
@@ -64,7 +42,4 @@ const safety_hooks body_hooks = {
|
||||
.init = body_init,
|
||||
.rx = body_rx_hook,
|
||||
.tx = body_tx_hook,
|
||||
.get_counter = body_get_counter,
|
||||
.get_checksum = body_get_checksum,
|
||||
.compute_checksum = body_compute_checksum,
|
||||
};
|
||||
|
||||
@@ -1,119 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "opendbc/safety/declarations.h"
|
||||
|
||||
static uint8_t byd_get_counter(const CANPacket_t *msg) {
|
||||
// Speed uses the high nibble; cruise status uses the low nibble.
|
||||
return (msg->addr == 0x1F0U) ? (msg->data[6] >> 4) : (msg->data[6] & 0xFU);
|
||||
}
|
||||
|
||||
static uint32_t byd_get_checksum(const CANPacket_t *msg) {
|
||||
return msg->data[7];
|
||||
}
|
||||
|
||||
static uint32_t byd_compute_checksum(const CANPacket_t *msg) {
|
||||
uint8_t sum = 0;
|
||||
for (int i = 0; i < 7; i++) {
|
||||
sum += msg->data[i];
|
||||
}
|
||||
return 0xFFU - sum;
|
||||
}
|
||||
|
||||
static void byd_rx_hook(const CANPacket_t *msg) {
|
||||
if (msg->bus == 0U) {
|
||||
// Steering angle: 0.1 deg/LSB, signed
|
||||
if (msg->addr == 0x11FU) {
|
||||
int angle_meas_new = to_signed((msg->data[1] << 8) | msg->data[0], 16); // STEER_ANGLE_2
|
||||
update_sample(&angle_meas, angle_meas_new);
|
||||
}
|
||||
|
||||
// Vehicle speed: 0.1 kph/LSB
|
||||
if (msg->addr == 0x1F0U) {
|
||||
int speed = (msg->data[1] << 8) | msg->data[0]; // WHEELSPEED_CLEAN
|
||||
vehicle_moving = speed > 0;
|
||||
UPDATE_VEHICLE_SPEED(speed * 0.1 * KPH_TO_MS);
|
||||
}
|
||||
|
||||
// Gas and brake pressed
|
||||
if (msg->addr == 0x242U) {
|
||||
brake_pressed = (msg->data[4] >> 5) & 0x1U; // BRAKE_PRESSED
|
||||
gas_pressed = (msg->data[3] & 0x7FU) > 0U; // RAW_THROTTLE
|
||||
}
|
||||
}
|
||||
|
||||
if (msg->bus == 2U) {
|
||||
// Cruise state
|
||||
if (msg->addr == 0x32DU) {
|
||||
// ACC_STATE: 0=OFF, 2=ACC_ON, 3=ACC_ACTIVE, 5=FORCE_ACCEL, 7=ERROR
|
||||
uint8_t acc_state = (msg->data[2] >> 3) & 0x7U;
|
||||
bool acc_on = (acc_state == 3U) || (acc_state == 5U);
|
||||
pcm_cruise_check(acc_on);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static bool byd_tx_hook(const CANPacket_t *msg) {
|
||||
const AngleSteeringLimits BYD_STEERING_LIMITS = {
|
||||
.max_angle = 3900, // 390 deg
|
||||
.angle_deg_to_can = 10,
|
||||
.frequency = 50U,
|
||||
};
|
||||
|
||||
// NOTE: based off BYD_ATTO_3 to match openpilot
|
||||
const AngleSteeringParams BYD_STEERING_PARAMS = {
|
||||
.slip_factor = -0.0006166479109059387, // calc_slip_factor(VM)
|
||||
.steer_ratio = 14.8,
|
||||
.wheelbase = 2.72,
|
||||
};
|
||||
|
||||
bool tx = true;
|
||||
|
||||
// Steering control: 0.1 deg/LSB, signed
|
||||
if (msg->addr == 0x1E2U) {
|
||||
int desired_angle = to_signed((msg->data[4] << 8) | msg->data[3], 16); // STEER_ANGLE
|
||||
bool steer_req = ((msg->data[2] >> 5) & 0x1U) != 0U; // STEER_REQ
|
||||
|
||||
if (steer_angle_cmd_checks_vm(desired_angle, steer_req, BYD_STEERING_LIMITS, BYD_STEERING_PARAMS)) {
|
||||
tx = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Only allow cancel (ACC_ON_BTN) while stock cruise is engaged, or button release.
|
||||
if (msg->addr == 0x3B0U) {
|
||||
bool other_buttons = ((msg->data[0] & 0x58U) != 0U) || // SET, RES, LKAS_ON
|
||||
((msg->data[1] & 0x80U) != 0U) || // DEC_DISTANCE
|
||||
((msg->data[2] & 0x1U) != 0U); // INC_DISTANCE
|
||||
bool cancel = (msg->data[2] & 0x8U) != 0U; // ACC_ON_BTN
|
||||
tx = !other_buttons && (!cancel || cruise_engaged_prev);
|
||||
}
|
||||
|
||||
return tx;
|
||||
}
|
||||
|
||||
static safety_config byd_init(uint16_t param) {
|
||||
SAFETY_UNUSED(param);
|
||||
|
||||
static const CanMsg BYD_TX_MSGS[] = {
|
||||
{0x1E2, 0, 8, .check_relay = true}, // STEERING_MODULE_ADAS (lateral steering command)
|
||||
{0x316, 0, 8, .check_relay = true}, // LKAS_HUD_ADAS (dash HUD)
|
||||
{0x3B0, 0, 8, .check_relay = false}, // PCM_BUTTONS (cruise cancel button spoof)
|
||||
};
|
||||
|
||||
static RxCheck byd_rx_checks[] = {
|
||||
{.msg = {{0x11F, 0, 5, 100U, .ignore_checksum = true, .ignore_counter = true, .ignore_quality_flag = true}, { 0 }, { 0 }}}, // STEER_MODULE_2 (steering angle)
|
||||
{.msg = {{0x1F0, 0, 8, 50U, .max_counter = 15U, .ignore_quality_flag = true}, { 0 }, { 0 }}}, // WHEELSPEED_CLEAN (vehicle speed)
|
||||
{.msg = {{0x242, 0, 8, 50U, .ignore_checksum = true, .ignore_counter = true, .ignore_quality_flag = true}, { 0 }, { 0 }}}, // DRIVE_STATE (gas and brake pressed)
|
||||
{.msg = {{0x32D, 2, 8, 50U, .max_counter = 15U, .ignore_quality_flag = true}, { 0 }, { 0 }}}, // ACC_HUD_ADAS (cruise state)
|
||||
};
|
||||
|
||||
return BUILD_SAFETY_CFG(byd_rx_checks, BYD_TX_MSGS);
|
||||
}
|
||||
|
||||
const safety_hooks byd_hooks = {
|
||||
.init = byd_init,
|
||||
.rx = byd_rx_hook,
|
||||
.tx = byd_tx_hook,
|
||||
.get_counter = byd_get_counter,
|
||||
.get_checksum = byd_get_checksum,
|
||||
.compute_checksum = byd_compute_checksum,
|
||||
};
|
||||
@@ -52,20 +52,21 @@ static ChryslerPlatform chrysler_platform;
|
||||
#define CHRYSLER_ADDR(name) ((uint32_t)((chrysler_platform == CHRYSLER_RAM_DT) ? CHRYSLER_RAM_DT_##name : \
|
||||
((chrysler_platform == CHRYSLER_RAM_HD) ? CHRYSLER_RAM_HD_##name : CHRYSLER_##name)))
|
||||
|
||||
|
||||
static uint8_t chrysler_get_counter(const CANPacket_t *msg) {
|
||||
return (uint8_t)(msg->data[6] >> 4);
|
||||
}
|
||||
|
||||
static void chrysler_rx_hook(const CANPacket_t *msg) {
|
||||
// Measured EPS torque
|
||||
if (msg_matches(msg, CHRYSLER_ADDR(EPS_2), 0U)) {
|
||||
if ((msg->bus == 0U) && (msg->addr == CHRYSLER_ADDR(EPS_2))) {
|
||||
int torque_meas_new = ((msg->data[4] & 0x7U) << 8) + msg->data[5] - 1024U;
|
||||
update_sample(&torque_meas, torque_meas_new);
|
||||
}
|
||||
|
||||
// enter controls on rising edge of ACC, exit controls on ACC off
|
||||
const unsigned int das_3_bus = (chrysler_platform == CHRYSLER_PACIFICA) ? 0U : 2U;
|
||||
if (msg_matches(msg, CHRYSLER_ADDR(DAS_3), das_3_bus)) {
|
||||
if ((msg->bus == das_3_bus) && (msg->addr == CHRYSLER_ADDR(DAS_3))) {
|
||||
bool cruise_engaged = GET_BIT(msg, 21U);
|
||||
pcm_cruise_check(cruise_engaged);
|
||||
acc_main_on = GET_BIT(msg, 20U);
|
||||
@@ -73,22 +74,22 @@ static void chrysler_rx_hook(const CANPacket_t *msg) {
|
||||
|
||||
// TODO: use the same message for both
|
||||
// update vehicle moving
|
||||
if ((chrysler_platform != CHRYSLER_PACIFICA) && msg_matches(msg, CHRYSLER_ADDR(ESP_8), 0U)) {
|
||||
if ((chrysler_platform != CHRYSLER_PACIFICA) && (msg->bus == 0U) && (msg->addr == CHRYSLER_ADDR(ESP_8))) {
|
||||
vehicle_moving = ((msg->data[4] << 8) + msg->data[5]) != 0U;
|
||||
}
|
||||
if ((chrysler_platform == CHRYSLER_PACIFICA) && msg_matches(msg, 514U, 0U)) {
|
||||
if ((chrysler_platform == CHRYSLER_PACIFICA) && (msg->bus == 0U) && (msg->addr == 514U)) {
|
||||
int speed_l = (msg->data[0] << 4) + (msg->data[1] >> 4);
|
||||
int speed_r = (msg->data[2] << 4) + (msg->data[3] >> 4);
|
||||
vehicle_moving = (speed_l | speed_r) != 0;
|
||||
vehicle_moving = (speed_l != 0) || (speed_r != 0);
|
||||
}
|
||||
|
||||
// exit controls on rising edge of gas press
|
||||
if (msg_matches(msg, CHRYSLER_ADDR(ECM_5), 0U)) {
|
||||
if ((msg->bus == 0U) && (msg->addr == CHRYSLER_ADDR(ECM_5))) {
|
||||
gas_pressed = msg->data[0U] != 0U;
|
||||
}
|
||||
|
||||
// exit controls on rising edge of brake press
|
||||
if (msg_matches(msg, CHRYSLER_ADDR(ESP_1), 0U)) {
|
||||
if ((msg->bus == 0U) && (msg->addr == CHRYSLER_ADDR(ESP_1))) {
|
||||
brake_pressed = ((msg->data[0U] & 0xFU) >> 2U) == 1U;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,10 +6,34 @@ static uint32_t chrysler_get_checksum(const CANPacket_t *msg) {
|
||||
}
|
||||
|
||||
static uint32_t chrysler_compute_checksum(const CANPacket_t *msg) {
|
||||
// TODO: clean this up
|
||||
// http://illmatics.com/Remote%20Car%20Hacking.pdf
|
||||
uint8_t checksum = 0xFFU;
|
||||
int len = GET_LEN(msg);
|
||||
for (int j = 0; j < (len - 1); j++) {
|
||||
checksum = crc8_update(checksum, msg->data[j], 0x1DU);
|
||||
uint8_t shift = 0x80U;
|
||||
uint8_t curr = (uint8_t)msg->data[j];
|
||||
for (int i=0; i<8; i++) {
|
||||
uint8_t bit_sum = curr & shift;
|
||||
uint8_t temp_chk = checksum & 0x80U;
|
||||
if (bit_sum != 0U) {
|
||||
bit_sum = 0x1C;
|
||||
if (temp_chk != 0U) {
|
||||
bit_sum = 1;
|
||||
}
|
||||
checksum = checksum << 1;
|
||||
temp_chk = checksum | 1U;
|
||||
bit_sum ^= temp_chk;
|
||||
} else {
|
||||
if (temp_chk != 0U) {
|
||||
bit_sum = 0x1D;
|
||||
}
|
||||
checksum = checksum << 1;
|
||||
bit_sum ^= checksum;
|
||||
}
|
||||
checksum = bit_sum;
|
||||
shift = shift >> 1;
|
||||
}
|
||||
}
|
||||
return (uint8_t)(~checksum);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "opendbc/safety/modes/chrysler_common.h"
|
||||
|
||||
|
||||
static safety_config chrysler_cusw_init(uint16_t param) {
|
||||
SAFETY_UNUSED(param);
|
||||
|
||||
@@ -21,31 +22,33 @@ static safety_config chrysler_cusw_init(uint16_t param) {
|
||||
}
|
||||
|
||||
static void chrysler_cusw_rx_hook(const CANPacket_t *msg) {
|
||||
if (msg_matches(msg, 0x1ECU, 0U)) {
|
||||
// Signal: EPS_STATUS.TORQUE_MOTOR
|
||||
int torque_meas_new = ((msg->data[3] & 0xFU) << 8) + msg->data[4] - 2048U;
|
||||
update_sample(&torque_meas, torque_meas_new);
|
||||
}
|
||||
if (msg->bus == 0U) {
|
||||
if (msg->addr == 0x1ECU) {
|
||||
// Signal: EPS_STATUS.TORQUE_MOTOR
|
||||
int torque_meas_new = ((msg->data[3] & 0xFU) << 8) + msg->data[4] - 2048U;
|
||||
update_sample(&torque_meas, torque_meas_new);
|
||||
}
|
||||
|
||||
if (msg_matches(msg, 0x2ECU, 0U)) {
|
||||
// Signal: ACC_CONTROL.ACC_ACTIVE
|
||||
bool cruise_engaged = GET_BIT(msg, 7U);
|
||||
pcm_cruise_check(cruise_engaged);
|
||||
}
|
||||
if (msg->addr == 0x2ECU) {
|
||||
// Signal: ACC_CONTROL.ACC_ACTIVE
|
||||
bool cruise_engaged = GET_BIT(msg, 7U);
|
||||
pcm_cruise_check(cruise_engaged);
|
||||
}
|
||||
|
||||
if (msg_matches(msg, 0x1E4U, 0U)) {
|
||||
// Signal: BRAKE_1.VEHICLE_SPEED
|
||||
vehicle_moving = (((msg->data[4] & 0x7U) << 8) + msg->data[5]) != 0U;
|
||||
}
|
||||
if (msg->addr == 0x1E4U) {
|
||||
// Signal: BRAKE_1.VEHICLE_SPEED
|
||||
vehicle_moving = (((msg->data[4] & 0x7U) << 8) + msg->data[5]) != 0U;
|
||||
}
|
||||
|
||||
if (msg_matches(msg, 0x1FEU, 0U)) {
|
||||
// Signal: ACCEL_GAS.GAS_HUMAN
|
||||
gas_pressed = msg->data[1] != 0U;
|
||||
}
|
||||
if (msg->addr == 0x1FEU) {
|
||||
// Signal: ACCEL_GAS.GAS_HUMAN
|
||||
gas_pressed = msg->data[1] != 0U;
|
||||
}
|
||||
|
||||
if (msg_matches(msg, 0x1E8U, 0U)) {
|
||||
// Signal: BRAKE_3.DRIVER_BRAKE_SWITCH
|
||||
brake_pressed = GET_BIT(msg, 18U);
|
||||
if (msg->addr == 0x1E8U) {
|
||||
// Signal: BRAKE_3.DRIVER_BRAKE_SWITCH
|
||||
brake_pressed = GET_BIT(msg, 18U);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,9 +10,10 @@ void default_rx_hook(const CANPacket_t *msg) {
|
||||
// GCOV_EXCL_STOP
|
||||
|
||||
// *** no output safety mode ***
|
||||
|
||||
static safety_config nooutput_init(uint16_t param) {
|
||||
SAFETY_UNUSED(param);
|
||||
return (safety_config){NULL, 0, NULL, 0, true}; // NOLINT(readability/braces)
|
||||
return (safety_config){NULL, 0, NULL, 0, true}; // NOLINT(readability/braces)
|
||||
}
|
||||
|
||||
// GCOV_EXCL_START
|
||||
@@ -35,7 +36,7 @@ static safety_config alloutput_init(uint16_t param) {
|
||||
const uint16_t ALLOUTPUT_PARAM_PASSTHROUGH = 1;
|
||||
controls_allowed = true;
|
||||
bool alloutput_passthrough = GET_FLAG(param, ALLOUTPUT_PARAM_PASSTHROUGH);
|
||||
return (safety_config){NULL, 0, NULL, 0, !alloutput_passthrough}; // NOLINT(readability/braces)
|
||||
return (safety_config){NULL, 0, NULL, 0, !alloutput_passthrough}; // NOLINT(readability/braces)
|
||||
}
|
||||
|
||||
static bool alloutput_tx_hook(const CANPacket_t *msg) {
|
||||
|
||||
@@ -29,7 +29,6 @@ static bool elm327_tx_hook(const CANPacket_t *msg) {
|
||||
tx = false;
|
||||
}
|
||||
}
|
||||
|
||||
return tx;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,10 +26,10 @@ static uint8_t ford_get_counter(const CANPacket_t *msg) {
|
||||
if (msg->addr == FORD_BrakeSysFeatures) {
|
||||
// Signal: VehVActlBrk_No_Cnt
|
||||
cnt = (msg->data[2] >> 2) & 0xFU;
|
||||
}
|
||||
if (msg->addr == FORD_Yaw_Data_FD1) {
|
||||
} else if (msg->addr == FORD_Yaw_Data_FD1) {
|
||||
// Signal: VehRollYaw_No_Cnt
|
||||
cnt = msg->data[5];
|
||||
} else {
|
||||
}
|
||||
return cnt;
|
||||
}
|
||||
@@ -39,10 +39,10 @@ static uint32_t ford_get_checksum(const CANPacket_t *msg) {
|
||||
if (msg->addr == FORD_BrakeSysFeatures) {
|
||||
// Signal: VehVActlBrk_No_Cs
|
||||
chksum = msg->data[3];
|
||||
}
|
||||
if (msg->addr == FORD_Yaw_Data_FD1) {
|
||||
} else if (msg->addr == FORD_Yaw_Data_FD1) {
|
||||
// Signal: VehRollYawW_No_Cs
|
||||
chksum = msg->data[4];
|
||||
} else {
|
||||
}
|
||||
return chksum;
|
||||
}
|
||||
@@ -54,14 +54,14 @@ static uint32_t ford_compute_checksum(const CANPacket_t *msg) {
|
||||
chksum += msg->data[2] >> 6; // VehVActlBrk_D_Qf
|
||||
chksum += (msg->data[2] >> 2) & 0xFU; // VehVActlBrk_No_Cnt
|
||||
chksum = 0xFFU - chksum;
|
||||
}
|
||||
if (msg->addr == FORD_Yaw_Data_FD1) {
|
||||
} else if (msg->addr == FORD_Yaw_Data_FD1) {
|
||||
chksum += msg->data[0] + msg->data[1]; // VehRol_W_Actl
|
||||
chksum += msg->data[2] + msg->data[3]; // VehYaw_W_Actl
|
||||
chksum += msg->data[5]; // VehRollYaw_No_Cnt
|
||||
chksum += msg->data[6] >> 6; // VehRolWActl_D_Qf
|
||||
chksum += (msg->data[6] >> 4) & 0x3U; // VehYawWActl_D_Qf
|
||||
chksum = 0xFFU - chksum;
|
||||
} else {
|
||||
}
|
||||
return chksum;
|
||||
}
|
||||
@@ -70,12 +70,11 @@ static bool ford_get_quality_flag_valid(const CANPacket_t *msg) {
|
||||
bool valid = false;
|
||||
if (msg->addr == FORD_BrakeSysFeatures) {
|
||||
valid = (msg->data[2] >> 6) == 0x3U; // VehVActlBrk_D_Qf
|
||||
}
|
||||
if (msg->addr == FORD_EngVehicleSpThrottle2) {
|
||||
} else if (msg->addr == FORD_EngVehicleSpThrottle2) {
|
||||
valid = ((msg->data[4] >> 5) & 0x3U) == 0x3U; // VehVActlEng_D_Qf
|
||||
}
|
||||
if (msg->addr == FORD_Yaw_Data_FD1) {
|
||||
} else if (msg->addr == FORD_Yaw_Data_FD1) {
|
||||
valid = ((msg->data[6] >> 4) & 0x3U) == 0x3U; // VehYawWActl_D_Qf
|
||||
} else {
|
||||
}
|
||||
return valid;
|
||||
}
|
||||
@@ -97,58 +96,60 @@ static const CurvatureSteeringLimits FORD_STEERING_LIMITS = {
|
||||
};
|
||||
|
||||
static void ford_rx_hook(const CANPacket_t *msg) {
|
||||
// Update in motion state from standstill signal
|
||||
if (msg_matches(msg, FORD_DesiredTorqBrk, FORD_MAIN_BUS)) {
|
||||
// Signal: VehStop_D_Stat
|
||||
vehicle_moving = ((msg->data[3] >> 3) & 0x3U) != 1U;
|
||||
}
|
||||
if (msg->bus == FORD_MAIN_BUS) {
|
||||
// Update in motion state from standstill signal
|
||||
if (msg->addr == FORD_DesiredTorqBrk) {
|
||||
// Signal: VehStop_D_Stat
|
||||
vehicle_moving = ((msg->data[3] >> 3) & 0x3U) != 1U;
|
||||
}
|
||||
|
||||
// Update vehicle speed
|
||||
if (msg_matches(msg, FORD_BrakeSysFeatures, FORD_MAIN_BUS)) {
|
||||
// Signal: Veh_V_ActlBrk
|
||||
UPDATE_VEHICLE_SPEED(((msg->data[0] << 8) | msg->data[1]) * 0.01 * KPH_TO_MS);
|
||||
}
|
||||
// Update vehicle speed
|
||||
if (msg->addr == FORD_BrakeSysFeatures) {
|
||||
// Signal: Veh_V_ActlBrk
|
||||
UPDATE_VEHICLE_SPEED(((msg->data[0] << 8) | msg->data[1]) * 0.01 * KPH_TO_MS);
|
||||
}
|
||||
|
||||
// Check vehicle speed against a second source
|
||||
if (msg_matches(msg, FORD_EngVehicleSpThrottle2, FORD_MAIN_BUS)) {
|
||||
// Disable controls if speeds from ABS and PCM ECUs are too far apart.
|
||||
// Signal: Veh_V_ActlEng
|
||||
float filtered_pcm_speed = ((msg->data[6] << 8) | msg->data[7]) * 0.01 * KPH_TO_MS;
|
||||
UPDATE_VEHICLE_SPEED_2(filtered_pcm_speed);
|
||||
}
|
||||
// Check vehicle speed against a second source
|
||||
if (msg->addr == FORD_EngVehicleSpThrottle2) {
|
||||
// Disable controls if speeds from ABS and PCM ECUs are too far apart.
|
||||
// Signal: Veh_V_ActlEng
|
||||
float filtered_pcm_speed = ((msg->data[6] << 8) | msg->data[7]) * 0.01 * KPH_TO_MS;
|
||||
UPDATE_VEHICLE_SPEED_2(filtered_pcm_speed);
|
||||
}
|
||||
|
||||
// Update vehicle yaw rate
|
||||
if (msg_matches(msg, FORD_Yaw_Data_FD1, FORD_MAIN_BUS)) {
|
||||
// FIXME: safety can receive yaw before new vehicle speed, it should recompute meas on either received
|
||||
// Signal: VehYaw_W_Actl
|
||||
// TODO: we should use the speed which results in the closest angle measurement to the desired angle
|
||||
float ford_yaw_rate = (((msg->data[2] << 8U) | msg->data[3]) * 0.0002) - 6.5;
|
||||
float current_curvature = ford_yaw_rate / SAFETY_MAX(vehicle_speed.values[0] / VEHICLE_SPEED_FACTOR, 0.1);
|
||||
// convert current curvature into units on CAN for comparison with desired curvature
|
||||
update_sample(&curvature_state.meas, ROUND(current_curvature * FORD_STEERING_LIMITS.curvature_to_can));
|
||||
}
|
||||
// Update vehicle yaw rate
|
||||
if (msg->addr == FORD_Yaw_Data_FD1) {
|
||||
// FIXME: safety can receive yaw before new vehicle speed, it should recompute meas on either received
|
||||
// Signal: VehYaw_W_Actl
|
||||
// TODO: we should use the speed which results in the closest angle measurement to the desired angle
|
||||
float ford_yaw_rate = (((msg->data[2] << 8U) | msg->data[3]) * 0.0002) - 6.5;
|
||||
float current_curvature = ford_yaw_rate / SAFETY_MAX(vehicle_speed.values[0] / VEHICLE_SPEED_FACTOR, 0.1);
|
||||
// convert current curvature into units on CAN for comparison with desired curvature
|
||||
update_sample(&curvature_state.meas, ROUND(current_curvature * FORD_STEERING_LIMITS.curvature_to_can));
|
||||
}
|
||||
|
||||
// Update gas pedal
|
||||
if (msg_matches(msg, FORD_EngVehicleSpThrottle, FORD_MAIN_BUS)) {
|
||||
// Pedal position: (0.1 * val) in percent
|
||||
// Signal: ApedPos_Pc_ActlArb
|
||||
gas_pressed = (((msg->data[0] & 0x03U) << 8) | msg->data[1]) > 0U;
|
||||
}
|
||||
// Update gas pedal
|
||||
if (msg->addr == FORD_EngVehicleSpThrottle) {
|
||||
// Pedal position: (0.1 * val) in percent
|
||||
// Signal: ApedPos_Pc_ActlArb
|
||||
gas_pressed = (((msg->data[0] & 0x03U) << 8) | msg->data[1]) > 0U;
|
||||
}
|
||||
|
||||
// Update brake pedal and cruise state
|
||||
if (msg_matches(msg, FORD_EngBrakeData, FORD_MAIN_BUS)) {
|
||||
// Signal: BpedDrvAppl_D_Actl
|
||||
brake_pressed = ((msg->data[0] >> 4) & 0x3U) == 2U;
|
||||
// Update brake pedal and cruise state
|
||||
if (msg->addr == FORD_EngBrakeData) {
|
||||
// Signal: BpedDrvAppl_D_Actl
|
||||
brake_pressed = ((msg->data[0] >> 4) & 0x3U) == 2U;
|
||||
|
||||
// Signal: CcStat_D_Actl
|
||||
unsigned int cruise_state = msg->data[1] & 0x07U;
|
||||
bool cruise_engaged = (cruise_state == 4U) || (cruise_state == 5U);
|
||||
pcm_cruise_check(cruise_engaged);
|
||||
acc_main_on = (cruise_state == 3U) || cruise_engaged;
|
||||
}
|
||||
// Signal: CcStat_D_Actl
|
||||
unsigned int cruise_state = msg->data[1] & 0x07U;
|
||||
bool cruise_engaged = (cruise_state == 4U) || (cruise_state == 5U);
|
||||
pcm_cruise_check(cruise_engaged);
|
||||
acc_main_on = (cruise_state == 3U) || cruise_engaged;
|
||||
}
|
||||
|
||||
if (msg_matches(msg, FORD_Steering_Data_FD1, FORD_MAIN_BUS)) {
|
||||
mads_button_press = GET_BIT(msg, 40U) ? MADS_BUTTON_PRESSED : MADS_BUTTON_NOT_PRESSED;
|
||||
if (msg->addr == FORD_Steering_Data_FD1) {
|
||||
mads_button_press = GET_BIT(msg, 40U) ? MADS_BUTTON_PRESSED : MADS_BUTTON_NOT_PRESSED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -181,7 +182,7 @@ static bool ford_tx_hook(const CANPacket_t *msg) {
|
||||
bool cmbb_deny = (msg->data[4] >> 5) & 1U;
|
||||
|
||||
// Signal: AccBrkPrchg_B_Rq & AccBrkDecel_B_Rq
|
||||
bool brake_actuation = (msg->data[6] & 0xC0U) != 0U;
|
||||
bool brake_actuation = ((msg->data[6] >> 6) & 1U) || ((msg->data[6] >> 7) & 1U);
|
||||
|
||||
bool violation = false;
|
||||
violation |= longitudinal_accel_checks(accel, FORD_LONG_LIMITS);
|
||||
@@ -189,7 +190,7 @@ static bool ford_tx_hook(const CANPacket_t *msg) {
|
||||
violation |= longitudinal_gas_checks(gas_pred, FORD_LONG_LIMITS);
|
||||
|
||||
// Safety check for stock AEB
|
||||
violation |= cmbb_deny; // do not prevent stock AEB actuation
|
||||
violation |= cmbb_deny; // do not prevent stock AEB actuation
|
||||
|
||||
violation |= !get_longitudinal_allowed() && brake_actuation;
|
||||
|
||||
|
||||
@@ -39,71 +39,73 @@ static bool gm_non_acc = false;
|
||||
static void gm_rx_hook(const CANPacket_t *msg) {
|
||||
const int GM_STANDSTILL_THRSLD = 10; // 0.311kph
|
||||
|
||||
if (msg_matches(msg, 0x184U, 0U)) {
|
||||
int torque_driver_new = ((msg->data[6] & 0x7U) << 8) | msg->data[7];
|
||||
torque_driver_new = to_signed(torque_driver_new, 11);
|
||||
// update array of samples
|
||||
update_sample(&torque_driver, torque_driver_new);
|
||||
}
|
||||
|
||||
// sample rear wheel speeds
|
||||
if (msg_matches(msg, 0x34AU, 0U)) {
|
||||
int left_rear_speed = (msg->data[0] << 8) | msg->data[1];
|
||||
int right_rear_speed = (msg->data[2] << 8) | msg->data[3];
|
||||
vehicle_moving = (left_rear_speed > GM_STANDSTILL_THRSLD) || (right_rear_speed > GM_STANDSTILL_THRSLD);
|
||||
}
|
||||
|
||||
// ACC steering wheel buttons (GM_CAM is tied to the PCM)
|
||||
if (msg_matches(msg, 0x1E1U, 0U) && !gm_pcm_cruise) {
|
||||
int button = (msg->data[5] & 0x70U) >> 4;
|
||||
|
||||
// enter controls on falling edge of set or rising edge of resume (avoids fault)
|
||||
bool set = (button != GM_BTN_SET) && (cruise_button_prev == GM_BTN_SET);
|
||||
bool res = (button == GM_BTN_RESUME) && (cruise_button_prev != GM_BTN_RESUME);
|
||||
if (set || res) {
|
||||
controls_allowed = true;
|
||||
if (msg->bus == 0U) {
|
||||
if (msg->addr == 0x184U) {
|
||||
int torque_driver_new = ((msg->data[6] & 0x7U) << 8) | msg->data[7];
|
||||
torque_driver_new = to_signed(torque_driver_new, 11);
|
||||
// update array of samples
|
||||
update_sample(&torque_driver, torque_driver_new);
|
||||
}
|
||||
|
||||
// exit controls on cancel press
|
||||
if (button == GM_BTN_CANCEL) {
|
||||
controls_allowed = false;
|
||||
// sample rear wheel speeds
|
||||
if (msg->addr == 0x34AU) {
|
||||
int left_rear_speed = (msg->data[0] << 8) | msg->data[1];
|
||||
int right_rear_speed = (msg->data[2] << 8) | msg->data[3];
|
||||
vehicle_moving = (left_rear_speed > GM_STANDSTILL_THRSLD) || (right_rear_speed > GM_STANDSTILL_THRSLD);
|
||||
}
|
||||
|
||||
cruise_button_prev = button;
|
||||
}
|
||||
// ACC steering wheel buttons (GM_CAM is tied to the PCM)
|
||||
if ((msg->addr == 0x1E1U) && !gm_pcm_cruise) {
|
||||
int button = (msg->data[5] & 0x70U) >> 4;
|
||||
|
||||
// Reference for brake pressed signals:
|
||||
// https://github.com/commaai/openpilot/blob/master/selfdrive/car/gm/carstate.py
|
||||
if (msg_matches(msg, 0xBEU, 0U) && (gm_hw == GM_ASCM)) {
|
||||
brake_pressed = msg->data[1] >= 8U;
|
||||
}
|
||||
// enter controls on falling edge of set or rising edge of resume (avoids fault)
|
||||
bool set = (button != GM_BTN_SET) && (cruise_button_prev == GM_BTN_SET);
|
||||
bool res = (button == GM_BTN_RESUME) && (cruise_button_prev != GM_BTN_RESUME);
|
||||
if (set || res) {
|
||||
controls_allowed = true;
|
||||
}
|
||||
|
||||
if (msg_matches(msg, 0xC9U, 0U) && (gm_hw == GM_CAM)) {
|
||||
brake_pressed = GET_BIT(msg, 40U);
|
||||
}
|
||||
// exit controls on cancel press
|
||||
if (button == GM_BTN_CANCEL) {
|
||||
controls_allowed = false;
|
||||
}
|
||||
|
||||
if (msg_matches(msg, 0x1C4U, 0U)) {
|
||||
gas_pressed = msg->data[5] != 0U;
|
||||
cruise_button_prev = button;
|
||||
}
|
||||
|
||||
// enter controls on rising edge of ACC, exit controls when ACC off
|
||||
if (gm_pcm_cruise && !gm_non_acc) {
|
||||
bool cruise_engaged = (msg->data[1] >> 5) != 0U;
|
||||
// Reference for brake pressed signals:
|
||||
// https://github.com/commaai/openpilot/blob/master/selfdrive/car/gm/carstate.py
|
||||
if ((msg->addr == 0xBEU) && (gm_hw == GM_ASCM)) {
|
||||
brake_pressed = msg->data[1] >= 8U;
|
||||
}
|
||||
|
||||
if ((msg->addr == 0xC9U) && (gm_hw == GM_CAM)) {
|
||||
brake_pressed = GET_BIT(msg, 40U);
|
||||
}
|
||||
|
||||
if (msg->addr == 0x1C4U) {
|
||||
gas_pressed = msg->data[5] != 0U;
|
||||
|
||||
// enter controls on rising edge of ACC, exit controls when ACC off
|
||||
if (gm_pcm_cruise && !gm_non_acc) {
|
||||
bool cruise_engaged = (msg->data[1] >> 5) != 0U;
|
||||
pcm_cruise_check(cruise_engaged);
|
||||
}
|
||||
}
|
||||
|
||||
if (msg->addr == 0xBDU) {
|
||||
regen_braking = (msg->data[0] >> 4) != 0U;
|
||||
}
|
||||
|
||||
if (msg->addr == 0xC9U) {
|
||||
acc_main_on = GET_BIT(msg, 29U);
|
||||
}
|
||||
|
||||
if (msg->addr == 0x3D1U) {
|
||||
bool cruise_engaged = GET_BIT(msg, 39U);
|
||||
pcm_cruise_check(cruise_engaged);
|
||||
}
|
||||
}
|
||||
|
||||
if (msg_matches(msg, 0xBDU, 0U)) {
|
||||
regen_braking = (msg->data[0] >> 4) != 0U;
|
||||
}
|
||||
|
||||
if (msg_matches(msg, 0xC9U, 0U)) {
|
||||
acc_main_on = GET_BIT(msg, 29U);
|
||||
}
|
||||
|
||||
if (msg_matches(msg, 0x3D1U, 0U)) {
|
||||
bool cruise_engaged = GET_BIT(msg, 39U);
|
||||
pcm_cruise_check(cruise_engaged);
|
||||
}
|
||||
}
|
||||
|
||||
static bool gm_tx_hook(const CANPacket_t *msg) {
|
||||
@@ -183,18 +185,10 @@ static safety_config gm_init(uint16_t param) {
|
||||
.max_brake = 400,
|
||||
};
|
||||
|
||||
static const CanMsg GM_ASCM_TX_MSGS[] = {
|
||||
{0x180, 0, 4, .check_relay = true},
|
||||
{0x409, 0, 7, .check_relay = false},
|
||||
{0x40A, 0, 7, .check_relay = false},
|
||||
{0x2CB, 0, 8, .check_relay = true},
|
||||
{0x370, 0, 6, .check_relay = false},
|
||||
{0xA1, 1, 7, .check_relay = false},
|
||||
{0x306, 1, 8, .check_relay = false},
|
||||
{0x308, 1, 7, .check_relay = false},
|
||||
{0x310, 1, 2, .check_relay = false},
|
||||
{0x315, 2, 5, .check_relay = false},
|
||||
};
|
||||
static const CanMsg GM_ASCM_TX_MSGS[] = {{0x180, 0, 4, .check_relay = true}, {0x409, 0, 7, .check_relay = false}, {0x40A, 0, 7, .check_relay = false}, {0x2CB, 0, 8, .check_relay = true}, {0x370, 0, 6, .check_relay = false}, // pt bus
|
||||
{0xA1, 1, 7, .check_relay = false}, {0x306, 1, 8, .check_relay = false}, {0x308, 1, 7, .check_relay = false}, {0x310, 1, 2, .check_relay = false}, // obs bus
|
||||
{0x315, 2, 5, .check_relay = false}}; // ch bus
|
||||
|
||||
|
||||
static const LongitudinalLimits GM_CAM_LONG_LIMITS = {
|
||||
.max_gas = 1346 * GM_GAS_TO_CAN,
|
||||
@@ -205,15 +199,11 @@ static safety_config gm_init(uint16_t param) {
|
||||
|
||||
#ifdef ALLOW_DEBUG
|
||||
// block PSCMStatus (0x184); forwarded through openpilot to hide an alert from the camera
|
||||
static const CanMsg GM_CAM_LONG_TX_MSGS[] = {
|
||||
{0x180, 0, 4, .check_relay = true},
|
||||
{0x315, 0, 5, .check_relay = true},
|
||||
{0x2CB, 0, 8, .check_relay = true},
|
||||
{0x370, 0, 6, .check_relay = true},
|
||||
{0x184, 2, 8, .check_relay = true},
|
||||
};
|
||||
static const CanMsg GM_CAM_LONG_TX_MSGS[] = {{0x180, 0, 4, .check_relay = true}, {0x315, 0, 5, .check_relay = true}, {0x2CB, 0, 8, .check_relay = true}, {0x370, 0, 6, .check_relay = true}, // pt bus
|
||||
{0x184, 2, 8, .check_relay = true}}; // camera bus
|
||||
#endif
|
||||
|
||||
|
||||
static RxCheck gm_rx_checks[] = {
|
||||
GM_COMMON_RX_CHECKS
|
||||
};
|
||||
@@ -234,11 +224,8 @@ static safety_config gm_init(uint16_t param) {
|
||||
GM_NON_ACC_ADDR_CHECK
|
||||
};
|
||||
|
||||
static const CanMsg GM_CAM_TX_MSGS[] = {
|
||||
{0x180, 0, 4, .check_relay = true},
|
||||
{0x1E1, 2, 7, .check_relay = false},
|
||||
{0x184, 2, 8, .check_relay = true},
|
||||
};
|
||||
static const CanMsg GM_CAM_TX_MSGS[] = {{0x180, 0, 4, .check_relay = true}, // pt bus
|
||||
{0x1E1, 2, 7, .check_relay = false}, {0x184, 2, 8, .check_relay = true}}; // camera bus
|
||||
|
||||
if (GET_FLAG(param, GM_PARAM_HW_CAM)) {
|
||||
gm_hw = GM_CAM;
|
||||
|
||||
@@ -46,6 +46,7 @@ static bool honda_nidec_hybrid = false;
|
||||
typedef enum {HONDA_NIDEC, HONDA_BOSCH} HondaHw;
|
||||
static HondaHw honda_hw = HONDA_NIDEC;
|
||||
|
||||
|
||||
static unsigned int honda_get_pt_bus(void) {
|
||||
return ((honda_hw == HONDA_BOSCH) && !honda_bosch_radarless && !honda_bosch_canfd) ? 1U : 0U;
|
||||
}
|
||||
@@ -128,7 +129,7 @@ static void honda_rx_hook(const CANPacket_t *msg) {
|
||||
|
||||
// state machine to enter and exit controls for button enabling
|
||||
// 0x1A6 for the ILX, 0x296 for the Civic Touring
|
||||
if (msg_matches(msg, 0x1A6U, pt_bus) || msg_matches(msg, 0x296U, pt_bus)) {
|
||||
if (((msg->addr == 0x1A6U) || (msg->addr == 0x296U)) && (msg->bus == pt_bus)) {
|
||||
int button = (msg->data[0] & 0xE0U) >> 5;
|
||||
|
||||
int cruise_setting = (msg->data[(msg->addr == 0x296U) ? 0U : 5U] & 0x0CU) >> 2U;
|
||||
@@ -193,7 +194,7 @@ static void honda_rx_hook(const CANPacket_t *msg) {
|
||||
|
||||
// disable stock Honda AEB in alternative experience
|
||||
if (!(alternative_experience & ALT_EXP_DISABLE_STOCK_AEB)) {
|
||||
if (msg_matches(msg, 0x1FAU, 2U)) {
|
||||
if ((msg->bus == 2U) && (msg->addr == 0x1FAU)) {
|
||||
bool honda_stock_aeb = GET_BIT(msg, 29U);
|
||||
int honda_stock_brake = (msg->data[0] << 2) | (msg->data[1] >> 6);
|
||||
|
||||
@@ -215,6 +216,7 @@ static void honda_rx_hook(const CANPacket_t *msg) {
|
||||
}
|
||||
|
||||
static bool honda_tx_hook(const CANPacket_t *msg) {
|
||||
|
||||
const LongitudinalLimits HONDA_BOSCH_LONG_LIMITS = {
|
||||
.max_accel = 200, // accel is used for brakes
|
||||
.min_accel = -350,
|
||||
@@ -236,7 +238,7 @@ static bool honda_tx_hook(const CANPacket_t *msg) {
|
||||
unsigned int bus_buttons = (honda_bosch_radarless) ? 2U : bus_pt; // the camera controls ACC on radarless Bosch cars
|
||||
|
||||
// ACC_HUD: safety check (nidec w/o pedal)
|
||||
if (msg_matches(msg, 0x30CU, bus_pt)) {
|
||||
if ((msg->addr == 0x30CU) && (msg->bus == bus_pt)) {
|
||||
int pcm_speed = (msg->data[0] << 8) | msg->data[1];
|
||||
int pcm_gas = msg->data[2];
|
||||
|
||||
@@ -249,7 +251,7 @@ static bool honda_tx_hook(const CANPacket_t *msg) {
|
||||
}
|
||||
|
||||
// BRAKE: safety check (nidec)
|
||||
if (msg_matches(msg, 0x1FAU, bus_pt)) {
|
||||
if ((msg->addr == 0x1FAU) && (msg->bus == bus_pt)) {
|
||||
honda_brake = (msg->data[0] << 2) + ((msg->data[1] >> 6) & 0x3U);
|
||||
|
||||
if (honda_nidec_hybrid) {
|
||||
@@ -273,7 +275,7 @@ static bool honda_tx_hook(const CANPacket_t *msg) {
|
||||
}
|
||||
|
||||
// BRAKE/GAS: safety check (bosch)
|
||||
if (msg_matches(msg, 0x1DFU, bus_pt)) {
|
||||
if ((msg->addr == 0x1DFU) && (msg->bus == bus_pt)) {
|
||||
int accel = (msg->data[3] << 3) | ((msg->data[4] >> 5) & 0x7U);
|
||||
accel = to_signed(accel, 11);
|
||||
|
||||
@@ -294,7 +296,7 @@ static bool honda_tx_hook(const CANPacket_t *msg) {
|
||||
}
|
||||
|
||||
// ACCEL: safety check (radarless)
|
||||
if (msg_matches(msg, 0x1C8U, bus_pt)) {
|
||||
if ((msg->addr == 0x1C8U) && (msg->bus == bus_pt)) {
|
||||
int accel = (msg->data[0] << 4) | (msg->data[1] >> 4);
|
||||
accel = to_signed(accel, 12);
|
||||
|
||||
@@ -322,7 +324,7 @@ static bool honda_tx_hook(const CANPacket_t *msg) {
|
||||
|
||||
// Bosch supplemental control check
|
||||
if (msg->addr == 0xE5U) {
|
||||
if ((GET_BYTES_64_LE(msg, 0, 8) & 0x00FFFFFFFFFFFFFFULL) != 0x0000000010800004ULL) {
|
||||
if ((GET_BYTES(msg, 0, 4) != 0x10800004U) || ((GET_BYTES(msg, 4, 4) & 0x00FFFFFFU) != 0x0U)) {
|
||||
tx = false;
|
||||
}
|
||||
}
|
||||
@@ -330,7 +332,7 @@ static bool honda_tx_hook(const CANPacket_t *msg) {
|
||||
// FORCE CANCEL: safety check only relevant when spamming the cancel button in Bosch HW
|
||||
// ensuring that only the cancel button press is sent (VAL 2) when controls are off.
|
||||
// This avoids unintended engagements while still allowing resume spam
|
||||
if (msg_matches(msg, 0x296U, bus_buttons) && !controls_allowed) {
|
||||
if ((msg->addr == 0x296U) && !controls_allowed && (msg->bus == bus_buttons)) {
|
||||
if (((msg->data[0] >> 5) & 0x7U) != 2U) {
|
||||
tx = false;
|
||||
}
|
||||
@@ -338,7 +340,7 @@ static bool honda_tx_hook(const CANPacket_t *msg) {
|
||||
|
||||
// Only tester present ("\x02\x3E\x80\x00\x00\x00\x00\x00") allowed on diagnostics address
|
||||
if (msg->addr == 0x18DAB0F1U) {
|
||||
if (GET_BYTES_64_LE(msg, 0, 8) != 0x0000000000803E02ULL) {
|
||||
if ((GET_BYTES(msg, 0, 4) != 0x00803E02U) || (GET_BYTES(msg, 4, 4) != 0x0U)) {
|
||||
tx = false;
|
||||
}
|
||||
}
|
||||
@@ -431,52 +433,21 @@ static safety_config honda_nidec_init(uint16_t param) {
|
||||
}
|
||||
|
||||
static safety_config honda_bosch_init(uint16_t param) {
|
||||
// Bosch
|
||||
static CanMsg HONDA_BOSCH_TX_MSGS[] = {
|
||||
{0xE4, 0, 5, .check_relay = true},
|
||||
{0xE5, 0, 8, .check_relay = true},
|
||||
{0x296, 1, 4, .check_relay = false},
|
||||
{0x33D, 0, 5, .check_relay = true},
|
||||
{0x33D, 0, 8, .check_relay = true},
|
||||
{0x33DA, 0, 5, .check_relay = true},
|
||||
{0x33DB, 0, 8, .check_relay = true},
|
||||
};
|
||||
static CanMsg HONDA_BOSCH_TX_MSGS[] = {{0xE4, 0, 5, .check_relay = true}, {0xE5, 0, 8, .check_relay = true}, {0x296, 1, 4, .check_relay = false},
|
||||
{0x33D, 0, 5, .check_relay = true}, {0x33D, 0, 8, .check_relay = true}, {0x33DA, 0, 5, .check_relay = true}, {0x33DB, 0, 8, .check_relay = true}}; // Bosch
|
||||
|
||||
// Bosch w/ gas and brakes
|
||||
static CanMsg HONDA_BOSCH_LONG_TX_MSGS[] = {
|
||||
{0xE4, 1, 5, .check_relay = true},
|
||||
{0x1DF, 1, 8, .check_relay = true},
|
||||
{0x1EF, 1, 8, .check_relay = false},
|
||||
{0x1FA, 1, 8, .check_relay = false},
|
||||
{0x30C, 1, 8, .check_relay = false},
|
||||
{0x33D, 1, 5, .check_relay = true},
|
||||
{0x33D, 1, 8, .check_relay = true},
|
||||
{0x33DA, 1, 5, .check_relay = true},
|
||||
{0x33DB, 1, 8, .check_relay = true},
|
||||
{0x39F, 1, 8, .check_relay = false},
|
||||
{0x18DAB0F1, 1, 8, .check_relay = false},
|
||||
};
|
||||
static CanMsg HONDA_BOSCH_LONG_TX_MSGS[] = {{0xE4, 1, 5, .check_relay = true}, {0x1DF, 1, 8, .check_relay = true}, {0x1EF, 1, 8, .check_relay = false},
|
||||
{0x1FA, 1, 8, .check_relay = false}, {0x30C, 1, 8, .check_relay = false}, {0x33D, 1, 5, .check_relay = true}, {0x33D, 1, 8, .check_relay = true},
|
||||
{0x33DA, 1, 5, .check_relay = true}, {0x33DB, 1, 8, .check_relay = true}, {0x39F, 1, 8, .check_relay = false},
|
||||
{0x18DAB0F1, 1, 8, .check_relay = false}}; // Bosch w/ gas and brakes
|
||||
|
||||
// Bosch radarless
|
||||
static CanMsg HONDA_RADARLESS_TX_MSGS[] = {
|
||||
{0xE4, 0, 5, .check_relay = true},
|
||||
{0x296, 2, 4, .check_relay = false},
|
||||
{0x33D, 0, 8, .check_relay = true},
|
||||
};
|
||||
static CanMsg HONDA_RADARLESS_TX_MSGS[] = {{0xE4, 0, 5, .check_relay = true}, {0x296, 2, 4, .check_relay = false}, {0x33D, 0, 8, .check_relay = true}}; // Bosch radarless
|
||||
|
||||
// Bosch radarless w/ gas and brakes
|
||||
static CanMsg HONDA_RADARLESS_LONG_TX_MSGS[] = {
|
||||
{0xE4, 0, 5, .check_relay = true},
|
||||
{0x33D, 0, 8, .check_relay = true},
|
||||
{0x1C8, 0, 8, .check_relay = true},
|
||||
{0x30C, 0, 8, .check_relay = true},
|
||||
};
|
||||
static CanMsg HONDA_RADARLESS_LONG_TX_MSGS[] = {{0xE4, 0, 5, .check_relay = true}, {0x33D, 0, 8, .check_relay = true}, {0x1C8, 0, 8, .check_relay = true},
|
||||
{0x30C, 0, 8, .check_relay = true}}; // Bosch radarless w/ gas and brakes
|
||||
|
||||
static CanMsg HONDA_CANFD_TX_MSGS[] = {{0xE4, 0, 5, .check_relay = true}, {0x296, 0, 4, .check_relay = false}, {0x33D, 0, 8, .check_relay = true}};
|
||||
|
||||
static CanMsg HONDA_CANFD_TX_MSGS[] = {
|
||||
{0xE4, 0, 5, .check_relay = true},
|
||||
{0x296, 0, 4, .check_relay = false},
|
||||
{0x33D, 0, 8, .check_relay = true},
|
||||
};
|
||||
|
||||
const uint16_t HONDA_PARAM_ALT_BRAKE = 1;
|
||||
const uint16_t HONDA_PARAM_RADARLESS = 8;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user