Slamtec / rplidar_sdk

Open source SDK for Slamtec RPLIDAR series products
BSD 2-Clause "Simplified" License
425 stars 253 forks source link

Reset example is misleading #36

Open topin89 opened 4 years ago

topin89 commented 4 years ago

In sdk/app/ultra_simple/main.cpp, there is this text.

// enable the following code if you want rplidar to be reboot by software
// drv->reset();

And in some cases in won't work as expected, because at the start sequence a lidar can send a plain text, e.g.

RP LIDAR System.
Firmware Ver 1.25 - rc2, HW Ver 5
Model: 18

That lead to garbage in read buffer and any following command won't work. Workaround is to wait a bit and call clearNetSerialRxCache(). One second delay is what we used, but about 20ms should be enough, and 2ms won't be, we checked.