diff --git a/components/lane_follower/src/Follower_Consts.toml b/components/lane_follower/src/Follower_Consts.toml index 19ec3d466..0c60b0047 100644 --- a/components/lane_follower/src/Follower_Consts.toml +++ b/components/lane_follower/src/Follower_Consts.toml @@ -8,3 +8,20 @@ LANE_POLY_SIZE = 2 BOX_COLOR = [0, 255, 0] LANE_COLOR = [255, 0, 0] DRAW_THICKNESS = 2 + +[Lane_Follower] +GUI = true +# TODO: Move these into a conf +KERNEL = 31 +LANE_TOLERANCE = 10 +MISSING_IMAGE_TOLERANCE = 100 +EMPTY_WINDOWS_THRESHOLD = 3 +OVERFLOW = 1000.0 +FORMAT = [640, 480] +TOLERANCE = 100 +PIXELS_TO_METERS = 260.8269125 +lower_hsv = [100, 0, 220] +upper_hsv = [255, 255, 255] +# Alignment points +bottom_coordinates = [[12, 472], [499, 475]] +top_coordinates = [[90, 8], [435, 24]] diff --git a/components/lane_follower/src/lane_follower.py b/components/lane_follower/src/lane_follower.py new file mode 100644 index 000000000..429ca8901 --- /dev/null +++ b/components/lane_follower/src/lane_follower.py @@ -0,0 +1,20 @@ +import toml +import cv2 + +# import numpy as np + + +class LaneFollower: + + def __init__( + self, odom_sub, cam_left, cam_right, toml_path='Follower_Consts.toml' + ): + self.vidcap_left = cv2.VideoCapture(cam_left) + self.vidcap_right = cv2.VideoCapture(cam_right) + self.const = toml.load(toml_path)["Lane_Follower"] + # LOWER = np.array(self.const['lower_hsv']) + # UPPER = np.array(self.const['upper_hsv']) + # PTS1 = np.float32([tl, bl, tr, br]) + # PTS2 = np.float32([[0, 0], [0, 480], [640, 0], [640, 480]]) + # # Matrix to warp the image for birdseye window + # UNWARP = cv2.getPerspectiveTransform(pts1, pts2)