The RPLiDAR by Slamtec was placed on top of the car with the intended use of making it object-avoidant. The LiDAR is a 360 degree sensor that is able to detect objects up to 6 meters away. The figure below shows the LiDAR’s ability to detect objects in 360 degrees.
The base of our LiDAR code is from the open source adafruit code by Dave Astels. We expanded on the code and read only the 360th degree–which was facing straight ahead of the car. The output resulted in the distance between the car and any object in front of it and was utilized for the turn in the path. When the LiDAR read that there was an object less than 1500 millimeters away, it indicated to the servo to adjust the steering to a 180 degree angle for a finite amount of time.