Hyun-je / pyrplidar

Full-featured python library for Slamtec RPLIDAR series
MIT License
56 stars 24 forks source link

In Windows force_scan does not work and start_scan mangles data after 20000 cycles #9

Open oferbentovim opened 1 year ago

oferbentovim commented 1 year ago

when i run the simple_scan example i get :

PyRPlidar Info : device is connected Traceback (most recent call last): File "pyrlidarneat.py", line 31, in simple_scan() File "pyrlidarneat.py", line 16, in simple_scan scan_generator = lidar.force_scan() File "C:\Users\user 67\AppData\Local\Programs\Python\Python36\lib\site-packages\pyrplidar.py", line 170, in force_scan discriptor = self.receive_discriptor() File "C:\Users\user 67\AppData\Local\Programs\Python\Python36\lib\site-packages\pyrplidar.py", line 42, in receive_discriptor discriptor = PyRPlidarResponse(self.lidar_serial.receive_data(RPLIDAR_DESCRIPTOR_LEN)) File "C:\Users\user 67\AppData\Local\Programs\Python\Python36\lib\site-packages\pyrplidar_protocol.py", line 110, in init self.sync_byte1 = raw_bytes[0] IndexError: index out of range PyRPlidar Info : device is disconnected

if i replace scan_generator = lidar.force_scan() with scan_generator = lidar.start_scan() the program will run well for approximately 20,000 readings and then return start to return quality flags larger than 30 and distances larger than 16000. tried the dtr solution to no avail i have a hunch that the serial buffer is mangled but could not find how any help will be greatly appreciated