Waiting for a traffic light turning green is never fun! But what if there was a world without any traffic lights? Well, when all cars on our roads are self-driving then it's possible to create an intersection without any traffic lights. This idea is called Autonomous Intersection Management. The basic idea I've used here originates from the report A Multiagent Approach to Autonomous Intersection Management. The authors of the report released this video so that's what we are aiming for here:

But the version you can test here is more complicated as each car is simulated in Unity, which makes it more realistic, so a car is not just a mathematical model of a car as they are in the report mentioned above. So each car in my simulation has an engine torque, braking torque, realistic wheels, drag force, and much more. This makes it much more difficult to simulate future positions of the car, which we have to do to check for collisions in the intersection.

The basic idea is that each car knows where it is going, such as driving forward or turning left, so it has a path through the intersection with waypoints. It can't change lane, and it can drive forward and turn left in one lane and drive forward and turn right in the other lane. To get a smooth curve between the waypoints I used a spline interpolation method called Bezier curve. The intersection looks like this:

When the car is close to the intersection, the intersection checks if the path through the intersection is clear by using the car's velocity and acceleration. To simulate the future positions of the car, I approximate each car with a rectangle and then I'm using an integration method called Forward Euler. At each integration step, I check for rectangle-rectangle collision with the other rectangles that are stored at this future time step which are approximations of other cars. This is happening until the car is outside of the intersection. The rectangles are also a little bit larger than the car to be on the safe side:

If the first car that has arrived to the intersection can't find a clear path, the intersection checks if next car in the queue can find a clear path, and so on until there are no-more cars to check. The problem now is that the first car in the queue might wait for a path for an infinite amount of time. To solve this, there's a timer saying that if the first car in the queue has waited for 10 seconds, then the intersection should prioritize this car until it finds a path through the intersection.

But what if an emergency vehicle arrives? In that case the intersection will prioritize all cars in the same lane as the emergency vehicle until the emergency vehicle has entered the intersection. It will at the same time prioritize all cars in the lane next to the lane the emergency vehicle is in, because those lanes will never cross in the intersection.

The simulation is not yet 100 percent good, so some collisions will happen, but that's just a matter of fine-tuning all the parameters. Anyway, the version described above looks like this:

But is an autonomous traffic intersection faster than traffic lights? It's easy to add traffic lights to the simulation and then calculate the average time it takes for a car to drive through the intersection. According to my studies, the average time it takes a car to drive through an intersection with traffic lights is about 1 minute. You can compare this with the average time it takes a car to drive though an autonomous traffic intersection, which was about 50 seconds.

**Looks interesting?**You can test it here: Automatic traffic intersection.

## Comments

## Post a Comment