Skip to content

Commit

Permalink
Added Lane Follower constants to .toml, beginning effort to move this…
Browse files Browse the repository at this point in the history
… full module to dev
  • Loading branch information
Vaibhav-Hariani committed Oct 14, 2024
1 parent e5fd3d1 commit d0c80ed
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
17 changes: 17 additions & 0 deletions components/lane_follower/src/Follower_Consts.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]]
20 changes: 20 additions & 0 deletions components/lane_follower/src/lane_follower.py
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit d0c80ed

Please sign in to comment.