The London Traffic Challenge

OpenXC is a combination of open source hardware and software that allows developers to read car telemetry data in real time. This work is being led by Ford.

OpenXC software is primarily focused on Android developers and uses a bluetooth or USB connection. As part of the London Traffic Tamer App Challenge, a contest to design applications that help alleviate traffic congestion in the streets of London, we developed Cloudant CommuteTamer.

This HTML5 Chrome application used WebWorkers, the Chrome TextToSpeech engine, the Leaflet JavaScript library for interactive maps, and PouchDB, the in-browser database that syncs.

About the App

Our Traffic Tamer app collects car telemetry data. Every time a car stops, this event is synchronized with IBM Cloudant, a JSON document store, to enable crowd-sourced traffic information.

Every five minutes, the application executes a server-side geospatial radius search, and congestion alerts are sent to the device. To avoid distractions, this alert is spoken to the driver. In development mode, Leaflet is used to display a map of the driver’s location and path.

Cloudant CommuteTamer is an Offline First application – it’s designed to work in areas of low connectivity or when no connection is available at all. Everything is stored locally in the web browser (PouchDB). Vehicles have spotty mobile connectivity while in transit, so we designed the app to transmit only lightweight, individual JSON documents over the network in this scenario. The entire database is only synchronized with the cloud (Cloudant) when the user has a Wi-Fi connection. Synchronizing the entire database allows analysis of driving patterns to provide route recommendations.

We chose Chrome as an application technology because:

  • It works offline
  • It can run in the background
  • It can read USB devices
  • Text-to-speech engine
  • Can run on any device
  • Easy deployment on Chrome Web Store

Using the Code

The code is available on GitHub under the Cloudant repo openxc-js and is licensed under the Apache 2.0 Software License. A vehicle simulator has been provided that runs a WebWorker thread and updates the development display.

The OpenXC Platform provides car telemetry data on a line-by-line basis, and this data is JSON, e.g.

{"name":"vehicle_speed","value":0,"timestamp":1364323939.468000}
{"name":"accelerator_pedal_position","value":0,"timestamp":1364323939.474000}
{"name":"engine_speed","value":774,"timestamp":1364323939.475000}
{"name":"latitude","value":40.77092,"timestamp":1364323939.476000}
{"name":"longitude","value":-73.953773,"timestamp":1364323939.478000}
{"name":"fuel_level","value":89.674202,"timestamp":1364323939.482000}
{"name":"torque_at_transmission","value":3,"timestamp":1364323939.483000}

The application aggregates this data, and every 10 seconds stores it into PouchDB as GeoJSON, e.g.

{
  "geometry": {
    "type": "Point",
    "coordinates": [125.6, 10.1]
  },
  "properties": {
    ...
  }
}

N.B.: As per the GeoJSON spec, the “properties” field above could contain any number of nested telemetry objects, such as those given in the preceding code block.

This can be seen in the Chrome Development Console:


PouchDB
The application can be installed from the Chrome Web Store here

App

Save

Join The Discussion

Your email address will not be published. Required fields are marked *