commaai / openpilot

openpilot is an operating system for robotics. Currently, it upgrades the driver assistance system in 275+ supported cars.
https://comma.ai/openpilot
MIT License
49.22k stars 8.97k forks source link

tools/replay/can_replay.py not working with Panda Jungle #33164

Open ep1cman opened 1 month ago

ep1cman commented 1 month ago

Describe the bug

I am attempting to use the CAN replay script provided in tools/replay/can_replay.py. I have a panda jungle board connected to my PC and a Comma 3X connected to the panda jungle.

The ignition signal is correctly sent and detected by the Comma 3X but after this I face multiple issues:

Firstly I will often see this error which then hangs, forcing me to restart the script:

~/git/openpilot$ tools/replay/can_replay.py
Loading log...
carFingerprint (for hardcoding fingerprint): 'TOYOTA COROLLA TSS2 2019'
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:04<00:00,  2.11s/it]
Finished loading...
starting send thread for 140020000d51333038363231
failed to get serial number of panda
Traceback (most recent call last):
  File "/home/seb/git/openpilot/panda/python/__init__.py", line 362, in usb_connect
    this_serial = device.getSerialNumber()
                  ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/seb/git/openpilot/.venv/lib/python3.12/site-packages/usb1/__init__.py", line 2019, in getSerialNumber
    return self.open().getSerialNumber()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/seb/git/openpilot/.venv/lib/python3.12/site-packages/usb1/__init__.py", line 1132, in getSerialNumber
    return self.getASCIIStringDescriptor(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/seb/git/openpilot/.venv/lib/python3.12/site-packages/usb1/__init__.py", line 1288, in getASCIIStringDescriptor
    received = mayRaiseUSBError(libusb1.libusb_get_string_descriptor_ascii(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/seb/git/openpilot/.venv/lib/python3.12/site-packages/usb1/__init__.py", line 127, in mayRaiseUSBError
    __raiseUSBError(value)
  File "/home/seb/git/openpilot/.venv/lib/python3.12/site-packages/usb1/__init__.py", line 119, in raiseUSBError
    raise __STATUS_TO_EXCEPTION_DICT.get(value, __USBError)(value)
usb1.USBErrorPipe: LIBUSB_ERROR_PIPE [-9]

When it does work, using the default route, the Comma 3X just displays the following message: "openpilot Unavailable. Waiting for controls to start", however I can see the LEDs on the panda jungle flashing.

I also tried to use the demo route from tools/replay/replay (a2a0ccea32023010|2023-07-27--13-01-19), this gets me a bit further but now instead I see the message "Dashcam Mode. Car Unrecognized"

OS Version

Ubuntu 24.04

openpilot version or commit

No response

Additional info

No response

adeebshihadeh commented 1 month ago

Have you tried reflashing your jungle with the latest fw?

https://github.com/commaai/panda/tree/master/board/jungle

ep1cman commented 1 month ago

I tried this but get the same results:

seb@ava:~/git/openpilot$ source .venv/bin/activate
(.venv) seb@ava:~/git/openpilot$ cd panda/board/jungle/
(.venv) seb@ava:~/git/openpilot/panda/board/jungle$ ./flash.py
scons: Entering directory `/home/seb/git/openpilot/panda'
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
arm-none-eabi-gcc -o board/jungle/bootstub-panda_jungle.o -c -mcpu=cortex-m4 -mhard-float -DSTM32F4 -DSTM32F413xx -Iboard/stm32f4/inc -mfpu=fpv4-sp-d16 -fsingle-precision-constant -Os -g -DPANDA_JUNGLE -DALLOW_DEBUG -Wall -Wextra -Wstrict-prototypes -Werror -mlittle-endian -mthumb -nostdlib -fno-builtin -std=gnu11 -fmax-errors=1 -Tboard/stm32f4/stm32f4_flash.ld -Iboard/jungle -Iboard -I. -Iboard board/bootstub.c
arm-none-eabi-gcc -o board/jungle/bootstub-panda_jungle_h7.o -c -mcpu=cortex-m7 -mhard-float -DSTM32H7 -DSTM32H725xx -Iboard/stm32h7/inc -mfpu=fpv5-d16 -fsingle-precision-constant -Os -g -DPANDA_JUNGLE -DALLOW_DEBUG -Wall -Wextra -Wstrict-prototypes -Werror -mlittle-endian -mthumb -nostdlib -fno-builtin -std=gnu11 -fmax-errors=1 -Tboard/stm32h7/stm32h7x5_flash.ld -Iboard/jungle -Iboard -I. -Iboard board/bootstub.c
arm-none-eabi-gcc -o board/jungle/main-panda_jungle.o -c -mcpu=cortex-m4 -mhard-float -DSTM32F4 -DSTM32F413xx -Iboard/stm32f4/inc -mfpu=fpv4-sp-d16 -fsingle-precision-constant -Os -g -DPANDA_JUNGLE -DALLOW_DEBUG -Wall -Wextra -Wstrict-prototypes -Werror -mlittle-endian -mthumb -nostdlib -fno-builtin -std=gnu11 -fmax-errors=1 -Tboard/stm32f4/stm32f4_flash.ld -Iboard/jungle -Iboard -I. -Iboard board/jungle/main.c
arm-none-eabi-gcc -o board/jungle/main-panda_jungle_h7.o -c -mcpu=cortex-m7 -mhard-float -DSTM32H7 -DSTM32H725xx -Iboard/stm32h7/inc -mfpu=fpv5-d16 -fsingle-precision-constant -Os -g -DPANDA_JUNGLE -DALLOW_DEBUG -Wall -Wextra -Wstrict-prototypes -Werror -mlittle-endian -mthumb -nostdlib -fno-builtin -std=gnu11 -fmax-errors=1 -Tboard/stm32h7/stm32h7x5_flash.ld -Iboard/jungle -Iboard -I. -Iboard board/jungle/main.c
arm-none-eabi-gcc -mcpu=cortex-m4 -mhard-float -DSTM32F4 -DSTM32F413xx -Iboard/stm32f4/inc -mfpu=fpv4-sp-d16 -fsingle-precision-constant -Os -g -DPANDA_JUNGLE -DALLOW_DEBUG -Wall -Wextra -Wstrict-prototypes -Werror -mlittle-endian -mthumb -nostdlib -fno-builtin -std=gnu11 -fmax-errors=1 -Tboard/stm32f4/stm32f4_flash.ld -o board/jungle/obj/startup_panda_jungle.o -c board/stm32f4/startup_stm32f413xx.s
arm-none-eabi-gcc -o board/jungle/rsa-panda_jungle.o -c -mcpu=cortex-m4 -mhard-float -DSTM32F4 -DSTM32F413xx -Iboard/stm32f4/inc -mfpu=fpv4-sp-d16 -fsingle-precision-constant -Os -g -DPANDA_JUNGLE -DALLOW_DEBUG -Wall -Wextra -Wstrict-prototypes -Werror -mlittle-endian -mthumb -nostdlib -fno-builtin -std=gnu11 -fmax-errors=1 -Tboard/stm32f4/stm32f4_flash.ld -Iboard/jungle -Iboard -I. -Iboard crypto/rsa.c
arm-none-eabi-gcc -o board/jungle/sha-panda_jungle.o -c -mcpu=cortex-m4 -mhard-float -DSTM32F4 -DSTM32F413xx -Iboard/stm32f4/inc -mfpu=fpv4-sp-d16 -fsingle-precision-constant -Os -g -DPANDA_JUNGLE -DALLOW_DEBUG -Wall -Wextra -Wstrict-prototypes -Werror -mlittle-endian -mthumb -nostdlib -fno-builtin -std=gnu11 -fmax-errors=1 -Tboard/stm32f4/stm32f4_flash.ld -Iboard/jungle -Iboard -I. -Iboard crypto/sha.c
arm-none-eabi-gcc -mcpu=cortex-m7 -mhard-float -DSTM32H7 -DSTM32H725xx -Iboard/stm32h7/inc -mfpu=fpv5-d16 -fsingle-precision-constant -Os -g -DPANDA_JUNGLE -DALLOW_DEBUG -Wall -Wextra -Wstrict-prototypes -Werror -mlittle-endian -mthumb -nostdlib -fno-builtin -std=gnu11 -fmax-errors=1 -Tboard/stm32h7/stm32h7x5_flash.ld -o board/jungle/obj/startup_panda_jungle_h7.o -c board/stm32h7/startup_stm32h7x5xx.s
arm-none-eabi-gcc -o board/jungle/rsa-panda_jungle_h7.o -c -mcpu=cortex-m7 -mhard-float -DSTM32H7 -DSTM32H725xx -Iboard/stm32h7/inc -mfpu=fpv5-d16 -fsingle-precision-constant -Os -g -DPANDA_JUNGLE -DALLOW_DEBUG -Wall -Wextra -Wstrict-prototypes -Werror -mlittle-endian -mthumb -nostdlib -fno-builtin -std=gnu11 -fmax-errors=1 -Tboard/stm32h7/stm32h7x5_flash.ld -Iboard/jungle -Iboard -I. -Iboard crypto/rsa.c
arm-none-eabi-gcc -o board/jungle/sha-panda_jungle_h7.o -c -mcpu=cortex-m7 -mhard-float -DSTM32H7 -DSTM32H725xx -Iboard/stm32h7/inc -mfpu=fpv5-d16 -fsingle-precision-constant -Os -g -DPANDA_JUNGLE -DALLOW_DEBUG -Wall -Wextra -Wstrict-prototypes -Werror -mlittle-endian -mthumb -nostdlib -fno-builtin -std=gnu11 -fmax-errors=1 -Tboard/stm32h7/stm32h7x5_flash.ld -Iboard/jungle -Iboard -I. -Iboard crypto/sha.c
arm-none-eabi-gcc -o board/jungle/obj/bootstub.panda_jungle.elf -mcpu=cortex-m4 -mhard-float -DSTM32F4 -DSTM32F413xx -Iboard/stm32f4/inc -mfpu=fpv4-sp-d16 -fsingle-precision-constant -Os -g -DPANDA_JUNGLE -DALLOW_DEBUG -Wall -Wextra -Wstrict-prototypes -Werror -mlittle-endian -mthumb -nostdlib -fno-builtin -std=gnu11 -fmax-errors=1 -Tboard/stm32f4/stm32f4_flash.ld board/jungle/obj/startup_panda_jungle.o board/jungle/rsa-panda_jungle.o board/jungle/sha-panda_jungle.o board/jungle/bootstub-panda_jungle.o
arm-none-eabi-objcopy -O binary board/jungle/obj/bootstub.panda_jungle.elf board/jungle/obj/bootstub.panda_jungle.bin
arm-none-eabi-gcc -o board/jungle/obj/bootstub.panda_jungle_h7.elf -mcpu=cortex-m7 -mhard-float -DSTM32H7 -DSTM32H725xx -Iboard/stm32h7/inc -mfpu=fpv5-d16 -fsingle-precision-constant -Os -g -DPANDA_JUNGLE -DALLOW_DEBUG -Wall -Wextra -Wstrict-prototypes -Werror -mlittle-endian -mthumb -nostdlib -fno-builtin -std=gnu11 -fmax-errors=1 -Tboard/stm32h7/stm32h7x5_flash.ld board/jungle/obj/startup_panda_jungle_h7.o board/jungle/rsa-panda_jungle_h7.o board/jungle/sha-panda_jungle_h7.o board/jungle/bootstub-panda_jungle_h7.o
arm-none-eabi-objcopy -O binary board/jungle/obj/bootstub.panda_jungle_h7.elf board/jungle/obj/bootstub.panda_jungle_h7.bin
arm-none-eabi-gcc -o board/jungle/obj/panda_jungle.elf -Wl,--section-start,.isr_vector=0x8004000 -mcpu=cortex-m4 -mhard-float -DSTM32F4 -DSTM32F413xx -Iboard/stm32f4/inc -mfpu=fpv4-sp-d16 -fsingle-precision-constant -Os -g -DPANDA_JUNGLE -DALLOW_DEBUG -Wall -Wextra -Wstrict-prototypes -Werror -mlittle-endian -mthumb -nostdlib -fno-builtin -std=gnu11 -fmax-errors=1 -Tboard/stm32f4/stm32f4_flash.ld board/jungle/obj/startup_panda_jungle.o board/jungle/main-panda_jungle.o
arm-none-eabi-objcopy -O binary board/jungle/obj/panda_jungle.elf board/jungle/obj/panda_jungle.bin
SETLEN=1 crypto/sign.py board/jungle/obj/panda_jungle.bin board/jungle/obj/panda_jungle.bin.signed certs/debug
signing 50748 bytes
hash: 8976febe3916de9c8f69b573fe6d2ece225149d8
arm-none-eabi-gcc -o board/jungle/obj/panda_jungle_h7.elf -Wl,--section-start,.isr_vector=0x8020000 -mcpu=cortex-m7 -mhard-float -DSTM32H7 -DSTM32H725xx -Iboard/stm32h7/inc -mfpu=fpv5-d16 -fsingle-precision-constant -Os -g -DPANDA_JUNGLE -DALLOW_DEBUG -Wall -Wextra -Wstrict-prototypes -Werror -mlittle-endian -mthumb -nostdlib -fno-builtin -std=gnu11 -fmax-errors=1 -Tboard/stm32h7/stm32h7x5_flash.ld board/jungle/obj/startup_panda_jungle_h7.o board/jungle/main-panda_jungle_h7.o
arm-none-eabi-objcopy -O binary board/jungle/obj/panda_jungle_h7.elf board/jungle/obj/panda_jungle_h7.bin
SETLEN=1 crypto/sign.py board/jungle/obj/panda_jungle_h7.bin board/jungle/obj/panda_jungle_h7.bin.signed certs/debug
signing 59808 bytes
hash: 830cddd5bc4529e2fb107e56a752de9a392b87b6
scons: done building targets.
found 1 panda jungle(s) - ['140020000d51333038363231']
flashing 140020000d51333038363231
failed to get serial number of panda
Traceback (most recent call last):
  File "/home/seb/git/openpilot/panda/python/__init__.py", line 362, in usb_connect
    this_serial = device.getSerialNumber()
                  ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/seb/git/openpilot/.venv/lib/python3.12/site-packages/usb1/__init__.py", line 2019, in getSerialNumber
    return self.open().getSerialNumber()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/seb/git/openpilot/.venv/lib/python3.12/site-packages/usb1/__init__.py", line 1132, in getSerialNumber
    return self.getASCIIStringDescriptor(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/seb/git/openpilot/.venv/lib/python3.12/site-packages/usb1/__init__.py", line 1288, in getASCIIStringDescriptor
    received = mayRaiseUSBError(libusb1.libusb_get_string_descriptor_ascii(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/seb/git/openpilot/.venv/lib/python3.12/site-packages/usb1/__init__.py", line 127, in mayRaiseUSBError
    __raiseUSBError(value)
  File "/home/seb/git/openpilot/.venv/lib/python3.12/site-packages/usb1/__init__.py", line 119, in raiseUSBError
    raise __STATUS_TO_EXCEPTION_DICT.get(value, __USBError)(value)
usb1.USBErrorPipe: LIBUSB_ERROR_PIPE [-9]
flash: unlocking
flash: erasing sectors 1 - 1
flash: flashing
flash: resetting
(.venv) seb@ava:~/git/openpilot/panda/board/jungle$ cd ../../../tools/replay/
(.venv) seb@ava:~/git/openpilot/tools/replay$ python can_replay.py a2a0ccea32023010/2023-07-27--13-01-19
Loading log...
carFingerprint (for hardcoding fingerprint): 'TOYOTA COROLLA TSS2 2019'
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 13/13 [00:15<00:00,  1.21s/it]
Finished loading...
starting send thread for 140020000d51333038363231
failed to get serial number of panda
Traceback (most recent call last):
  File "/home/seb/git/openpilot/panda/python/__init__.py", line 362, in usb_connect
    this_serial = device.getSerialNumber()
                  ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/seb/git/openpilot/.venv/lib/python3.12/site-packages/usb1/__init__.py", line 2019, in getSerialNumber
    return self.open().getSerialNumber()
           ^^^^^^^^^^^
  File "/home/seb/git/openpilot/.venv/lib/python3.12/site-packages/usb1/__init__.py", line 2055, in open
    mayRaiseUSBError(libusb1.libusb_open(self.device_p, byref(handle)))
  File "/home/seb/git/openpilot/.venv/lib/python3.12/site-packages/usb1/__init__.py", line 127, in mayRaiseUSBError
    __raiseUSBError(value)
  File "/home/seb/git/openpilot/.venv/lib/python3.12/site-packages/usb1/__init__.py", line 119, in raiseUSBError
    raise __STATUS_TO_EXCEPTION_DICT.get(value, __USBError)(value)
usb1.USBErrorIO: LIBUSB_ERROR_IO [-1]

On a second attempt I don't get the above error but the Comma 3X says "openpilot Unavailable. Waiting for controls to start" - however I can see the LEDs blinking on the panda jungle for a short while