Cadence Estimator


Introduction

The Cadence Estimator allows you to monitor the cadence of the user carrying the client device using collected accelerometer data. The Cadence Estimator implements a modified version of the peak detection algorithm described in to estimate the cadence of the runner by detecting and counting steps taken. This estimator will continually collect accelerometer data, and the accelerometer data will be processed in order estimate cadence at a specified rate.

This tutorial will cover how to initialize the estimator and read cadence estimates periodically.

Initializing The Cadence Estimator

The Cadence Estimator will continually collect accelerometer data into a buffer, and analysis on this buffered data will be performed at a specified period in order to extract cadence information. However, analysis will only be performed when there is more than half a second of useful accelerometer data, meaning that the specified period should be greater than half a second. The Cadence Estimator can be instantiated with the following lines of code:

Prerequisites and Starting the Cadence Estimator

In order to estimate the cadence of a client, the client device must be equipped with a triaxial accelerometer. Most smartphones and other Android-capable devices come equipped with an accelerometer, so we make the assumption that the current device does as well. In the case that the estimator has some requirements, and it does not meet them, it will throw an  ExtractorPrerequisiteUnsatisfiedException instead of returning void . In the code snippet below, we have a try-catch to demonstrate this. The estimator can be started using the  start()  method of the estimator, and can be terminated using the   terminate()  method.

Lastly, as described in the extractors and estimators page, a  SendDataAtFullListener()  listener can be registered with the Backable Encapsulator that holds the cadence data to send the cadence data points to the server when full.

That’s it!

Running Example

(TODO: complete)

References

Mladenov, Martin, and Michael Mock. 2009. “A Step Counter Service for Java-Enabled Devices Using a Built-in Accelerometer.” In Proceedings of the 1st International Workshop on Context-Aware Middleware and Services: Affiliated with the 4th International Conference on Communication System Software and Middleware (COMSWARE 2009), 1–5. CAMS ’09. New York, NY, USA: ACM. https://doi.org/10.1145/1554233.1554235.