LiDAR Driver
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 baud rate.
Initialize an instance of the LidarDriver class. See example below.
import lidar_driver
lidar = LidarDriver(lidar_serial_port_name, baudrate, timeout)
Configure the lidar’s settings. See example below.
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 LiDAR output streaming.
lidar.set_distance_stream_enable(lidar.serial_port, True)
Get lidar readings. See example below.