For Uasing RPlidar A1 right now the only Python library properly owrking is Adafrutir_CircuitPython_RPLIDAR.
Please let me know fithere is any other one taht you have teste and is working.
Python version must by 3.7
I personally prefer working with conda. So from my conda enviromenent with python just run:
pip install Adafruit_CircuitPython_RPLIDAR
Example for windows in COM4:
import osfrom math import floorfrom adafruit_rplidar import RPLidar
# Setup the RPLidarPORT_NAME = ‘COM4’lidar = RPLidar(None, PORT_NAME, timeout=3)
# used to scale data to fit on the screenmax_distance = 0
def process_data(data): print(data)
scan_data = *360
try: print(lidar.info) for scan in lidar.iter_scans(): for (_, angle, distance) in scan: scan_data[min([359, floor(angle)])] = distance process_data(scan_data)
except KeyboardInterrupt: print(‘Stopping.’)lidar.stop()lidar.disconnect()