I am looking to make an android application as part of a university project which use's sensors in an android phone to get distance.
After some looking at other question's which are similar in nature 1. and 2. , and some playing around with code, the idea looks really pointless as the accelerometer data is really noisy.
Question
As i am looking for a workable demo of sort's. Would making the app to work in a subway system work? This way i would have the initial velocity and would also only have to deal with linear movement. Or would the noise still make the accelerometer data useless?
Any tips or advice would be greatly appropriated.
If you really have to use they accelerometer, you could make a naive estimate looking at the amount of activity (peaks) in the data.
This could be done by simply saving a window of accelerometer data and count the number of values exceeding a given threshold. Alternatively an more advanced, you could do Fast Fourier Transformation on the data to determine the frequency of the data, low frequency: low activity and vica versa.
The idea could be further improved using Machine Learning and possibly fusing with more sensors such as gyroscope, or compass. This will help more accurately determine the activity but is a rather big topic and will require a lot of time and effort.
Android can detect some user activities but is not that fine grained: http://developer.android.com/training/location/activity-recognition.html
The link can though help to determine when it makes sense to turn on the accelerometer as it is able to determine when the user is on foot:
public class ActivityRecognitionIntentService extends IntentService {
...
/**
* Map detected activity types to strings
*@param activityType The detected activity type
*@return A user-readable name for the type
*/
private String getNameFromType(int activityType) {
switch(activityType) {
case DetectedActivity.IN_VEHICLE:
return "in_vehicle";
case DetectedActivity.ON_BICYCLE:
return "on_bicycle";
case DetectedActivity.ON_FOOT:
return "on_foot";
case DetectedActivity.STILL:
return "still";
case DetectedActivity.UNKNOWN:
return "unknown";
case DetectedActivity.TILTING:
return "tilting";
}
return "unknown";
}
...
}