These docs are public and open source.Edit on GitHub
RC.LIDAR
The Lidar module provides the LiDAR's current scan, number of samples, and distances.
METHODS
HELPERS
The racecar_utils module converts an angle to an index and averages a window.
EXAMPLE USAGE
pythonimport sys sys.path.insert(0, "../library") # the racecar-neo library on the car import racecar_core import racecar_utils rc = racecar_core.create_racecar() def start(): print("start: capping speed at 0.4") rc.drive.set_max_speed(0.4) def update(): scan = rc.lidar.get_samples() # ~1440 distances on the car, cm # average distance in a 10-degree window straight ahead front = racecar_utils.get_lidar_average_distance(scan, 0, 10) print(f"wall ahead at {front:.0f} cm") rc.drive.set_speed_angle(0.0 if front < 50 else 0.3, 0) rc.set_start_update(start, update) rc.go()
For full documentation, visit the racecar-neo-library documentation.
