• Stars
    star
    394
  • Rank 109,295 (Top 3 %)
  • Language
    C#
  • License
    MIT License
  • Created over 5 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Simulation of path planning for self-driving vehicles in Unity. This is also an implementation of the Hybrid A* pathfinding algorithm which is useful if you are interested in pathfinding for vehicles.

Self Driving Vehicle

Let's say you are standing somewhere in a room and would like to find the shortest path to a goal. You can see a few obstacles, such as a table, that you would like to avoid. The easiest way to solve the problem (if you are a computer) is to divide the room into many small squares (cells) and then use the common A* (A Star) search algorithm to find the shortest path.

But what if you are a car and can't turn around 360 degrees like a human can, then you have a problem! Well, at least until you learn the Hybrid A Star search algorithm. With that algorithm you will be able to find a fully drivable path to the goal!

Click for YouTube video of the algorithm in action:

Link to youtube video

If you just want to play around with it you can download a build of the project here for Windows: https://habrador.itch.io/hybrid-a-star

Tell me how the algorithm works

You can read more about it here: https://blog.habrador.com/2015/11/explaining-hybrid-star-pathfinding.html

Is this something actually being used by car companies?

Yes! Tesla mentioned the algorithm in a Tesla AI Day presentation (roughly at 1 hour 20 minutes). So if you ever wondered how the Tesla "Smart Summon" feature works then now you know! Tesla has included a short description of the Smart Summon feature (which is part of the Full Self-Driving Capability (FSD) version of Tesla Autopilot) in the Model Y Manual. We can assume it's the same implementation for other Tesla models, such as Model S.

  • "Smart Summon works with the Tesla mobile app when your phone is located within approximately 6 meters of Model Y." My implementation works over distances of greater than 6 meters.

  • "Smart Summon may not stop for all objects (especially very low objects such as some curbs, or very high objects such as a shelf) and may not react to all traffic. Smart Summon does not recognize the direction of traffic, does not navigate around empty parking spaces, and may not anticipate crossing traffic." My implementation has fixed obstacles only, and they all have the same height. I actually planned to add moving objects and traffic lanes with direction, but will not do so because Tesla's implementation can't handle them.

  • "Touch the crosshair icon then drag the map to position the pin on a chosen destination. Press and hold the GO TO TARGET button. Model Y moves to the destination." My implementation is not just moving to a destination, but also with a specific target direction, such as the left door ends up infront of you.

FAQ

  • What software do I need? To make this project work you need Unity. I've used Unity 2017-2021 but other versions should work as well.

  • Is it working on a navmesh? No, it's not! The algorithm needs a grid with cells to be able to remove unnecessary nodes, or you will end up with an infinite amount of nodes.

TODO

  • The car can follow the generated paths with great accuracy, but the truck with trailer is not that good at following the path. That has to be fixed!

More Repositories

1

Unity-Programming-Patterns

Implementations of programming design patterns in Unity with examples in C# when to use them.
C#
1,885
star
2

Computational-geometry

Computational Geometry Unity library with implementations of intersection algorithms, triangulations like delaunay, voronoi diagrams, polygon clipping, bezier curves, ear clipping, convex hulls, mesh simplification, etc
C#
1,221
star
3

Ten-Minute-Physics-Unity

Implementations in Unity of the Ten Minute Physics YouTube channel. Instead of using Unity's built-in physics engine, you will learn how to make your own. This is useful if you want to simulate ropes, cloth, tires, etc. You will also learn how to make fluid simulations and soft body physics.
C#
243
star
4

Unity-Boat-physics-Tutorial

Learn how to implement boat physics in Unity
C#
98
star
5

Unity-Rope-Tutorial

Learn how to make a rope in Unity by using several methods such as springs. You will also find a procedural spring mesh.
C#
63
star
6

Unity-Ballistics-Tutorial

Learn how to make realistic bullets with bullet drop in Unity
C#
61
star
7

Unity-Advanced-Shaders-Tutorial

Implementation of advanced shaders in Unity like raytracing, interior mapping, parallax mapping
ShaderLab
52
star
8

Unity-Custom-Tools-Tutorial

Source code for my custom tools tutorials in Unity
C#
33
star
9

Unity-Tornado-Simulator

Implementation of a tornado (twister) in Unity that can interact with the environment (including the clouds)
C#
26
star
10

Unity-Select-Units-Within-Rectangle-Tutorial

Unity tutorial on how to select units within rectangle
C#
25
star
11

Unity-Control-systems-Tutorial

Learn about an engineering area called Control systems by building quadcopters, etc
C#
18
star
12

Random-Terrain

Generate random terrain with Python
Python
13
star
13

Unity-Stuff-on-grid-Tutorial

Place stuff on a grid Unity tutorial
C#
12
star
14

Earthquake-Simulator

Simulation of how buildings behave during an earthquake
C#
11
star
15

Copypasta

Standardized code I copy paste into all my Unity projects
C#
10
star
16

Bitcoin-price-visualization

Visualizing the ups and downs of bitcoin from the beginning with ALL price data available which you can download
5
star
17

Kaggle-competitions

Code from Kaggle competitions
Python
2
star
18

Habrador

2
star
19

programming-collective-intelligence-php

Examples from the book Programming Collective Intelligence translated from Python to PHP
PHP
2
star
20

Advent-Of-Code-2021

Advent of code 2021
C#
2
star