Inspiration

Emergency vehicles lose precious time at intersections due to fixed traffic light cycles and human reaction delays. Even a few seconds at each red light can add up to minutes when responding to a life-critical emergency.

We wanted to explore how event-driven systems and AI agents could dynamically adapt city infrastructure in real time to prioritize emergency vehicles, not through preprogrammed schedules, but through live signals reacting to events as they happen.

What it does

GreenWave is an intelligent traffic management system that uses real-time data to control traffic lights for ambulances. By leveraging Solace’s Agent Mesh (SAM), the backend calculates the ambulance's direction, speed, and estimated arrival time at intersections. Based on this data, the backend communicates with the traffic control system to adjust traffic signals, ensuring green lights when the ambulance approaches.

The frontend simply displays this real-time information, showing the current state of traffic lights, the ambulance’s route, and the status of the intersection. This helps dispatchers, traffic operators, or even the general public understand the system's real-time operations and the ambulance's progress through the city.

How we built it

Backend: The backend is powered by Solace’s SAM (Agent Mesh), which calculates the ambulance's position and predicts when it will arrive at intersections. It ensures that traffic lights are adjusted in real time based on the ambulance’s position.

Frontend: Built using JavaScript with Leaflet for mapping, the frontend visualizes the ambulance's movement, traffic signal states, and simulation data.

Integration: The frontend communicates with the backend through WebSockets to receive real-time updates about traffic lights and ambulance status.

Challenges we ran into

Real-time communication: Ensuring reliable and low-latency communication between the frontend and the Solace backend was challenging. We had to optimize WebSocket connections to ensure seamless data flow without delays.

Ambulance prediction: Calculating the precise moment when an ambulance will reach an intersection and ensuring the lights adjust in time was tricky, especially considering traffic congestion and unpredictable movement patterns.

Working with Solace Agent Mesh agents was one of our biggest challenges. Coordinating multiple event-driven agents, debugging message flows, and managing timing and state across agents required significant iteration. While powerful, the distributed nature of SAM made debugging more complex than a traditional backend, but once it worked, it unlocked a scalable and flexible architecture.

Accomplishments that we're proud of

Dynamic traffic light control: Successfully implemented a system that can adjust traffic lights based on real-time data from the backend, optimizing ambulance routes.

Real-time simulation: Built an interactive map that tracks the ambulance’s position and updates traffic light states in real time.

Backend logic: The integration of Solace’s SAM for traffic control is a major accomplishment. The backend effectively calculates when traffic lights need to change to allow the ambulance to pass smoothly.

What we learned

Solace SAM: Gained a deeper understanding of Solace’s Agent Mesh and how it can be used to build scalable event-driven applications.

Real-time traffic management: Learned the complexities of managing and controlling traffic signals dynamically in a busy urban environment.

What's next for GreenWave

Scalability: We plan to expand the system to handle multiple ambulances and more complex intersection networks, enabling the system to scale to larger cities with heavy traffic.

Integration with other emergency services: Next, we’ll integrate other emergency services (e.g., fire trucks, police) into the system to prioritize their movement as well.

Advanced machine learning: To further improve the system’s ability to predict ambulance arrival times, we want to incorporate machine learning algorithms that analyze traffic patterns and adjust lights even more accurately.

Built With

Share this project:

Updates