Self-driving car 2019 update

About four years ago I made a self-driving car in Unity, which is an implementation of the Hybrid A star algorithm. I update it about once a year, except for last year when I didn't update it, so I decided to give it an extra large update this year. The following improvements have been added:

1. Reeds-Shepp paths. The old version used modified Dubins paths to make something that resembles Reeds-Shepp paths, but now I decide to add the real Reeds-Shepp paths. These were really annoying to make, so I've decided to give away the code for free: Download Reeds-Shepp paths for Unity in C#.


2. Voronoi field. A voronoi field tells, from each cell in the grid, the shortest distance to a voronoi edge (which can be seen as the midpoint between two obstacles) and the closest obstacle. This is useful knowledge to help the car find a path through narrow passages between obstacles and it also speeds up the algorithm when you smooth the path and want to find the distance to closest obstacle.



3. GUI. The old version used different keys to display different textures and paths. But now I've added a real GUI to make it easier to change between the different options by just clicking with the mouse.


4. A semi and a semi with trailer. I've also made a Tesla Simulator, and in the last Tesla Simulator update I added the Tesla Semi truck and a trailer. So I thought it would be interesting to see if I could update the pathfinding for cars algorithm, with pathfinding for cars that also drag something behind them. It was easy to add a model to the algorithm that simulates a trailer, but the problem is to make the real trailer follow the path. So sometimes the drag vehicle is colliding with the trailer even though the algorithm is checking for that, so I will in the future try to find a solution for that.


5. Optimized code. I've learned one or two things since the last update, so I've optimized and cleaned the code.

6. Path following. In the old version of the implementation, the car used to follow the path generated by the Hybrid A* algorithm, which uses the rear wheels to generate the path. But to make the car follow the path with greater accuracy, this path has to be moved forward to the front axle. When the car is reversing this path has to be moved to a "mirrored front axle" to make it easier for the car to follow the path when reversing.


You can test it here: Self-driving car.

Comments