I implemented a python lib to parse these packets and the only way I found to reliably identify packets was to find contiguous bytes that start with the start codes and end with a valid CRC. If the CRC is invalid, only drop the first bytes up to the next start condition, even inside the "current" invalid packet.
By reading the code at lines https://github.com/andyblarblar/LD06/blob/69ceb9d973bc2e1cf0147e67304766581d8e8a1a/src/ld06_driver.rs#L125-135 I found that any packet that contains the start byte will be lost, and there can be a lot of these packets.
I implemented a python lib to parse these packets and the only way I found to reliably identify packets was to find contiguous bytes that start with the start codes and end with a valid CRC. If the CRC is invalid, only drop the first bytes up to the next start condition, even inside the "current" invalid packet.
My code is available at gitlab.univ-nantes.fr/equipe-de-robotique-lab-sciren/CDR_2024/-/blob/main/robot/code/robot/lidar/ld06.py with tests at gitlab.univ-nantes.fr/equipe-de-robotique-lab-sciren/CDR_2024/-/blob/main/robot/code/tests/lidar/test_ld06.py if you want to take a look.