Coder Social home page Coder Social logo

carlobrok / ebc Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 0.0 169 KB

extremely boring car - autonomous racing car project

License: MIT License

C++ 93.15% Makefile 5.89% C 0.76% Shell 0.20%
arduino autonomous autonomous-car boring camera opencv raspberry-pi ultrasonic-sensor

ebc's People

Contributors

carlobrok avatar

Watchers

 avatar

ebc's Issues

bug in window search

Description:
If a line is outside the field of view, a search thread goes along the wrong line. Example below

input image_screenshot_15 11 2020

m_center calculation

m_center calculation is not right if the search window is out of the image.

bug in this code block:

void WindowBox::find_lane(cv::Mat &line_binary) {
//std::cout << get_window_rect(line_binary) << std::endl;
cv::Mat window_roi = line_binary(get_window_rect(line_binary));
cv::Moments w_moments = cv::moments(window_roi);
if (isnan(w_moments.m10/w_moments.m00)) {
m_lane_found = false;
return;
}
//std::cout << w_moments.m10 / w_moments.m00 + m_center.x - m_width / 2 << std::endl;
m_center.x = (int)(w_moments.m10 / w_moments.m00 + m_center.x - m_width / 2);
m_lane_found = true;
}
cv::Rect WindowBox::get_window_rect(cv::Mat &img) const {
cv::Rect rect(m_center.x - m_width/2, m_center.y - m_height/2, m_width, m_height);
if(rect.x < 0) rect.x = 0;
else if(rect.x > img.cols) rect.x = img.cols;
if(rect.x + rect.width > img.cols) rect.width = img.cols - rect.x;
return rect;
}

especially here:

m_center.x = (int)(w_moments.m10 / w_moments.m00 + m_center.x - m_width / 2);

End unsuccessful search early

Function find_lane_windows should be aborted if no line is found in the last (1 or 2) windows

void find_lane_windows(cv::Mat& binary_img, WindowBox &window_box, std::vector<WindowBox>& wboxes)
{
do {
window_box.find_lane(binary_img);
wboxes.push_back(window_box);
window_box = window_box.next_box();
//std::cout << "next start: " << window_box.center() << std::endl;
} while (window_box.center().y > 0);
return;
}

Motor Arduino: emergency stop

Stop motor in these cases:

  1. obstacle in front of the car; detect with ultrasonic sensors
  2. i2c data stream ends abruptly

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.