Slamtec/rplidar_sdk

Proper way to reconnect to the lidar after a crash.

unrealwill opened this issue · 0 comments

I'm using RPLidar A1 with v1.12.0 sdk.

When my program crash leaving the lidar spinning (in an undefined state), the next time I relaunch my program it fails to connect to the Lidar and hangs.
But if I relaunch it a second time, it works again.

It can be replicated with
./simple_grabber /dev/ttyUSB0 115200
then stopping it with ctrl+c

relaunching then hangs :
./simple_grabber /dev/ttyUSB0 115200

But relaunching a second time works again.
./simple_grabber /dev/ttyUSB0 115200

Is there a way to catch this behavior with code so that it never hangs while connecting ?

Thanks