The LiDAR Driver in the obstacle avoidance repository is specifically designed for the Lightware SF45/b LiDAR that WARG owns. The driver allows two-way communication between the LiDAR and a computer. Use this driver to configure the LiDAR’s settings including minimum/maximum angle, rotation speed, and output frequency.
Usage:
connect the lidar to a serial port on the computer.
get the port name and baudrate.
initialize an instance of the LidarDriver class.
import lidar_driver lidar = LidarDriver(lidar_serial_port_name, baudrate, timeout)
configure settings
self.lidar.set_update_rate(lidar.serial_port, update_rate) self.lidar.set_default_distance_output(lidar.serial_port) self.lidar.set_low_angle(lidar.serial_port, low_angle) self.lidar.set_high_angle(lidar.serial_port, high_angle) self.lidar.set_speed(lidar.serial_port, rotate_speed)
note: update rates follow the following chart
Update rate value | Frequency (readings per second) |
---|---|
1 | 50 Hz |
2 | 100 Hz |
3 | 200 Hz |
4 | 400 Hz |
5 | 500 Hz |
6 | 625 Hz |
7 | 1000 Hz |
8 | 1250 Hz |
9 | 1538 Hz |
10 | 2000 Hz |
11 | 2500 Hz |
12 | 5000 Hz |
enable output streaming
lidar.set_distance_stream_enable(lidar.serial_port, True)
get lidar readings
distance, angle = lidar.wait_for_reading(lidar.serial_port)