I was at PennApps last weekend; turns out Philly can get pretty sketch around 3:00am. I was walking to a friend's house through a subdivision, and I wanted to call an Uber, but was too worried about pulling out my phone to stare at a map and lose awareness of my surroundings.
Guardian fixes that. Now you can casually and discreetly order an Uber to a location in front of you and get haptic directions via the Apple Watch
What it does
When you're walking down the street and want to GTFO, open the Guardian Apple Watch app and tap Call a Guardian. Guardian then calls an UberX to a location ahead of you based on how long it will take an Uber to get there and how fast you're walking. It also texts your emergency contact, letting them know you're on your way to an Uber and that you'll update them when you're safe. Guardian also calls the Uber driver to tell them your ETA and to ask that they put their hazard lights on so that identification is easier.
As you're walking, Guardian will prompt you with haptic directions to get you to your Uber. A light tap for forward, a double tap for left and a long buzz for right. No map-staring needed.
When you get into the Uber, Guardian will tell your emergency contact that you're safe and sound.
How I built it
The algorithm works as follows:
- Get the user's speed, heading, and location.
- Consult the Uber API for an estimated wait duration for an UberX
- Scale the user's location&speed vector by that estimate to get a projection of their location in front of them at the time the Uber arrives.
- Add some variation in walking speed and angles to set a set of potential coordinates that a user could walk to before the Uber arrives
- For each of those coordinates, find the nearest road
- For each of those coordinates on roads, consult the Google Maps Directions API for an estimated walking duration
- Find the point whose walking duration matches the Uber wait time the closest.
- Request an UberX ride to that location.
- Get Directions to that location via the Google Maps Directions API
- Send those directions to the user monitor the regions to prompt with haptic directions.
- Call the Uber driver via Twilio and use the
<Say>TwiML to speak to them about the situation.
- Use the Twilio API to send the user's emergency contact a text message.
- Monitor the generated Uber Request
- When it becomes
in_progress, notify the emergency contact that the user is safe and sound.
What's next for Guardian
Cleaning up the code and potentially releasing as a real, grown-up app.