Traffic congestion poses a problem for everyone; it’s annoying at best and potentially dangerous at its worst. Stop signs and traffic signals are ubiquitous on almost every road today. However, these methods of traffic flow control require drivers to bring their vehicles to a complete stop before they resume driving. When the vehicle at the intersection begins to move again, drivers behind react with a delay which propagates throughout the line of cars. The act of starting and stopping coupled with how the average person drives is the root cause of traffic congestion in cities and highways alike.

What it does

The program takes an input of cars generated constantly. When the cars reach a certain distance from the intersection they are placed into a queue. The first two cars on the queue become regulated by my traffic control functions. When you run the GUI you can see this.

How I built it

I built this app solely in python using the Tkinter GUI library. I have a class to instantiate cars, a class to instantiate intersections, and a class to instantiate the GUI. There is also a file for calculation functions to occur to compute the necessary velocities for the cars. If car's arrive at the same time to the intersection, the function will randomly select a car to be regulated and adjust its velocity by just enough to miss the next incoming car.

Challenges I ran into

The biggest challenge I ran into was finishing in time. I could not get enough information on the GUI to inform user's what their cars were doing. Also I had trouble maintaining space between the cars. Another challenge I faced was learning how to use pythons Tkinter GUI for the first time. I don't have a large amount of experience with GUI's and this was a great learning experience.

Accomplishments that I'm proud of

I am most proud of the fact that algorithm to sort the cars in the interface works perfectly. No cars collide and the cars have almost no disruption to their initial velocities. If we implemented this with real cars it would save so much with fuel cost!

What I learned

I learned that if you put your mind to a task and focus on if in the right environment you can get almost anything done.

What's next for Intersection Management User Interface

Next up is to add more detail to the users GUI to display how fast the car is going.

Built With

Share this project: