These docs are public and open source.Edit on GitHub
RACECAR_UTILS
The racecar_utils module provides helper functions for working with numbers, images, and the LiDAR. The LiDAR helpers are on the rc.lidar page.
NUMBERS
IMAGES
COLOR CONTOURS
A contour is the outline of a connected region of one color. These are the functions behind line following and cone tracking.
AR MARKERS
EXAMPLE USAGE
pythonimport racecar_core import racecar_utils rc = racecar_core.create_racecar() BLUE = ((90, 50, 50), (120, 255, 255)) # HSV range def start(): pass def update(): image = rc.camera.get_color_image() contours = racecar_utils.find_contours(image, BLUE[0], BLUE[1]) largest = racecar_utils.get_largest_contour(contours) if largest is not None: center = racecar_utils.get_contour_center(largest) # steer toward the contour: map its column to a steering angle angle = racecar_utils.remap_range(center[1], 0, image.shape[1], -1, 1) rc.drive.set_speed_angle(0.3, angle) else: rc.drive.stop() rc.set_start_update(start, update) rc.go()
For full documentation, visit the racecar-neo-library documentation.
