Giter VIP home page Giter VIP logo

lane_follower's Introduction

Lane Follower

This code is for the lane follower, including perception and control, as shown below.

Structure

Environment

  1. Hardware
    • Industrial Camera
    • Intel-NUC(10FNK)
  2. Software
    • Ubuntu18.04
    • Python3.6
    • OpenCV4.2
    • PyTorch1.8.1

    See environment.txt for details.

How to use

A. Offline Testing

The code supports the offline testing, which takes the offline video as input and output the demo video.

python offline_test.py

B. OnLine Testing

The code also supports the online testing, which takes the real-time video streaming from the industrial camera as input and controls the vehicle.

python online_test.py

C. Demo

You can find the offline testing video and the corresponding demo video here [n25o].

demo

Details

Detailed structure

detailed-structure

Code Info

  • offline_test.py --- Offline testing

  • online_test.py --- Online testing

  • basic_function --- Some Basic Function

    • show_img(name, img): Show the image
    • find_files(directory, pattern): Method to find target files in one directory, including subdirectory
    • get_M_Minv(): Get Perspective Transform
    • draw_area(img_origin, img_line, Minv, left_fit, right_fit): Draw the road area in the image
    • draw_demo(img_result, img_bin, img_canny, img_line, img_line_warp, img_bev_result, curvature, distance_from_center, steer): Generate the Demo image
  • lib_camera --- Class for the industrial camera

    • open(): Open the camera
    • grab(): Grab an image from the camera
    • close(): Close the camera
  • mvsdk --- Official lib for the industrial camera

  • lib_can --- Class for the CAN

    • OpenDevice(): Open the CAN device
    • InitCAN(can_idx=0): Init the CAN
    • StartCan(can_idx=0): Start the CAN
    • Send(can_idx, id, frame_len, data): Send messages to CAN
    • Listen(can_idx, id, try_cnt=10): Receive messages from CAN
    • CloseDevice(): Close the CAN device
  • lib_LaneDetector --- Class for the lane detector

    • detect_line(img_input, steer, memory, debug=False): Main Function
    • pre_process(img, debug=False): Image Preprocessing
    • find_line(img, memory, debug=False): Detect the lane using Sliding Windows Methods
    • calculate_curv_and_pos(img_line, left_fit, right_fit): Calculate the curvature & distance from the center
  • lib_ObjectDetector --- Class for the traffic object detector based on YOLO5

    • load_model(): Load Yolo5 model from pytorch hub
    • detect(frame, img_area): Predict and analyze using yolo5
    • class_to_label(idx): Return the corresponding string label for a given label value
    • plot_detections(results, frame): Takes a frame and its results as input, and plots the bounding boxes and label on to the frame
  • lib_vehicle --- Class for the vehicle model and vehicle control

    • steer_cal(curvature, dist_from_center): Calculate the steer according to the curvature of the lane and the distance form the center
    • steer_ctrl(): Control the steer by sending the signal via CAN
    • steer_get(): Get the real steer of the vehicle via the CAN
  • libcontrolcan.so --- DLL for the CAN device

  • libMVSDK.so --- DLL for the industrial camera

lane_follower's People

Contributors

leofansq avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

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.