Skip to content

This is an algorithm to predict the steering angle of a car from a Unity simulation

Notifications You must be signed in to change notification settings

niallmandal/car-sim-steering

Repository files navigation

car-sim-steering

This is an algorithm to predict the steering angle of a car from a Unity simulation. This simulation is based on a project called DonkeyCar in which teams create a RC car to autonomously drive. This is a virtual solution to this problem using Computer Vision. Dataset for training images can be found here: https://www.kaggle.com/niallmandal/car-data-from-a-unity-simulation

Unity

The github to the simulator used can be found here: https://github.com/tawnkramer/sdsandbox.

~10K images were captured on frame data, with the steering angle and throttle recorded in the actual name of each image.

Each image is unaltered, and is just pure pixel data.

Breakdown of each file:

  1. my_cv.py: holds most of the OpenCV2 files that manipulate the image and ultimately creates the lines
  2. lines.py: runs the functions set up in my_cv.py defined as one overall function
  3. formula.py: creates a dataset from the lines of each simulation image, with the columns as left_line_y_int,left_line_slope,left_line_angle,right_line_y_int,right_line_slope,right_line_angle,steering, and throttle
  4. formula_rho_theta.py: creates a dataset from the lines of each simulation image, with the columns as left_line_rho,left_line_theta,right_line_rho,right_line_theta,steering, and throttle

The ρ function is a numpy version of this function:

\operatorname {distance}(P_{1},P_{2},(x_{0},y_{0}))={\frac  {|(y_{2}-y_{1})x_{0}-(x_{2}-x_{1})y_{0}+x_{2}y_{1}-y_{2}x_{1}|}{{\sqrt  {(y_{2}-y_{1})^{2}+(x_{2}-x_{1})^{2}}}}}.

The θ is calculated as so:

m=\frac{y_2-y_1}{x_2-x_1}.

m = \tan (\theta)

Note: raw_log is the name of the folder used where all of the images are proccessed. The folder "example images" is used purely to show what each image may look like.

About

This is an algorithm to predict the steering angle of a car from a Unity simulation

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published