Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect Lane has no attribute 'left_fit' #21

Open
lucyivt opened this issue Mar 11, 2024 · 1 comment
Open

Detect Lane has no attribute 'left_fit' #21

lucyivt opened this issue Mar 11, 2024 · 1 comment

Comments

@lucyivt
Copy link

lucyivt commented Mar 11, 2024

Hi, I've been trying to get the lane detection code to work but keep getting this error:

AttributeError: 'DetectLane' object has no attribute 'left_fit'

The problem arises in line number 159 of detect_lane.py:
if yellow_fraction > 3000:
self.left_fitx, self.left_fit = self.fit_from_lines(self.left_fit , cv_yellow_lane)
self.mov_avg_left = np.append(self.mov_avg_left,np.array([self.left_fit]), axis=0)

Where we try to initiate self.left_fit while also using it in the function parameter. I've been struggling to figure out how to fix this problem, I've tried to initiate self.left_fit before this line (making it an array) but more errors occur. (I put the turtlebot between the yellow and white lines.) Any help would be greatly appreciated!

@aidilrx04
Copy link

aidilrx04 commented Apr 2, 2024

self.left_fitx, self.left_fit = self.fit_from_lines(self.left_fit , cv_yellow_lane)

This line tried accessing self.left_fit which doesnt exist yet.

try wrapping the entire block with try except to make this error go away

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants