Introduction

Knowing the exact location of a vehicle in real-time can be invaluable. Whether it’s for deliveries, transportation, or personal use, a delay can raise questions. Is the vehicle stuck in traffic? Has there been a mechanical issue? Or is it just a short distance away?

Modern vehicles are often equipped with GPS devices that provide continuous location updates. This data is essential not just for the vehicle operators but also for those who are dependent on its timely arrival.

In this blog post, we’ll explore how to use these location updates to determine if a vehicle is stuck or delayed for some reason. Our aim is to enhance the transparency and predictability of vehicle movements, ensuring that everyone involved is well-informed. We’ll break down the challenges, propose a solution, and discuss the intricacies of a real-time vehicle tracking system.

Problem: Uncertainties in Vehicle Tracking

At Cityflo, we offer premium bus services in Mumbai and Hyderabad. Despite our real-time tracking feature, customers frequently contact our support asking, “Where is the bus?” when they notice it’s not moving. This isn’t due to tracking issues but common city delays like traffic, signals, or occasional breakdowns. The influx of such queries increase the workload for our support team, especially on days when traffic situations are the worst. Our goal is to proactively inform customers about the reasons for standstills, reducing uncertainty and support calls.

Solution: Implementing the Minimum Bounding Circle Algorithm

To address the concerns related to vehicle standstills, we implemented a simple approach using the minimum bounding circle algorithm. Here’s how it works:

  • Tracking Movement Over Time: We continuously capture the location updates of our buses every few seconds. Our focus is on the movement patterns observed within the last few minutes.

  • Applying the Algorithm: The minimum bounding circle algorithm calculates the smallest possible circle that can encompass all the location points of the bus within the aforementioned window.

  • Determining Standstill: If the radius of this circle is less than a threshold, it indicates that the vehicle hasn’t moved significantly. We classify this as a standstill situation.

Once a standstill is detected, our system can then proactively notify customers about the status, offering insights into potential reasons such as traffic congestion or a stop at a signal. This not only reduces the strain on our support team but also ensures that our customers remain informed and at ease during their commute.

Vehicle Moving Without Traffic

The following diagram showcases a series of location points spread out over a larger area, representing the vehicle’s movement. In this case the radius of the minimum bounding circle is sufficiently large to discard it as a standstill.

vehicle-happy-path

Vehicle Stuck in Traffic

This diagram presents a cluster of closely-knit location points within a confined space, indicating frequent GPS updates from a bus that’s barely moving. The dense gathering of these points within a small radius illustrates a vehicle’s standstill or very slow movement, typically a result of traffic congestion or other delays.

vehicle-happy-path

Code implementation

Here’s an implemenation of just the minimum bounding circle problem using Welzl’s algorithm in golang.

Caveats

While the minimum bounding circle algorithm offers a robust solution for detecting standstills, it’s crucial to acknowledge certain nuances and challenges:

  • False Positives: The algorithm might occasionally misinterpret a vehicle waiting at a traffic signal or experiencing a breakdown as being stuck in traffic congestion. Such scenarios highlight the importance of refining our detection methods to minimize inaccuracies.

  • Tuning Parameters: The choice of threshold time and radius values directly affects the algorithm’s accuracy. It’s essential to continuously evaluate and adjust these parameters based on real-world data to find the optimal values that deliver the most reliable results.

  • Breakdowns vs. Traffic Delays: A vehicle breakdown is a more critical situation compared to routine traffic delays. Therefore, before such a significant event gets communicated to the end users, a secondary verification involving human intervention is recommended. This step ensures that users receive accurate and contextually relevant information, preventing potential confusion or panic.

Incorporating these considerations will help in enhancing the efficacy of our tracking system, ensuring it remains both accurate and user-friendly.

Conclusion

This simple yet effective approach has proven invaluable in proactively addressing customer concerns and reducing unnecessary queries directed at our support team. By promptly identifying and communicating standstills, we empower our customers with real-time insights, enhancing their overall experience.

Moreover, this feature has been introduced as part of our recent redesign of the tracking system at Cityflo. While it stands as a significant improvement on its own, it’s just one of the many enhancements we’ve integrated. We’re enthusiastic about the potential of these combined features and are keenly looking forward to the positive impact they’ll have on our services.

As we move forward, our goal remains clear: to make commuting a seamless and stress-free experience for all Cityflo users, while also ensuring our support team can operate efficiently. Here’s to the journey ahead and the innovations it will bring!