1

I'm having a pretty interesting dilemma right now, and after looking around on SO and doing some googling, it seems coming up with a solution is not as easy as I thought.

I'm looking to use Android's built in sensors(accelerometer), to gather if a device is in constant motion inside a moving vehicle. The obvious alternative to this would be just to use GPS and then Location.getSpeed(), but unfortunately I need this to work in an environment with zero network connection. Think underground or in a tunnel.

Basically I want to be able to track intervals of change in velocity from

|Consistent Motion|***stop***|Consistent Motion|

Specifically, it seems what I want to do is called Inertial Navigation

I don't need specific values like the speed of the device, etc. I just want to able to differentiate between from when the device is in constant motion and when it comes to a complete stop

Have any of you ever done something like this? Judging from a few answers here, and here, it seems that this is either extremely difficult, with a great margin of error due the sensors fluctuations/inaccuracy, or basically impossible.

Community
  • 1
  • 1
Jade Byfield
  • 4,668
  • 5
  • 30
  • 41
  • 3
    Google Play services Activity Recognition will recognize IN VEHICLE (vs. BICYCLE/WALKING/ON_FOOT/STILL), and will give you a confidence to boot. Not sure if it works with zero network comms, but definitely worth a try rather than reinventing the wheel. http://developer.android.com/training/location/activity-recognition.html – Sam Dozor Sep 03 '14 at 21:37
  • @SamDozor Looks very promising. The docs mention that the data is coming from Location Services, however the common ACCESS_FINE_LOCATION and ACCESS_COARSE_LOCATION permissions aren't need. How would this work without at least a netowork connection? – Jade Byfield Sep 03 '14 at 21:48
  • I imagine it uses inter-process communication with Google Play Services, which I think has just about every permission. You do need to at least add the custom ACTIVITY_RECOGNITION permission. I would suggested trying out the sample that they provide at that link, and seeing how well it works underground etc. – Sam Dozor Sep 03 '14 at 21:50

2 Answers2

1

I'd try implementing something along these lines:

http://www.sfonge.com/forum/topic/measuring-movement-accelerometer-and-gyroscope -

In it, the author describes how, using the gyroscope and accelerometer in Android, he was able to determine the displacement of the phone.

That said, only use this for broad descriptions of whether or not the user's driving. The precision of using a method like this is heavily constrained by the accuracy of both the accelerometer and the gyroscope. DO NOT USE THIS FOR POSITION DETERMINATION

dedual
  • 153
  • 2
  • 10
1

Inertial navigation requires context. A known starting state (e.g. "standing still at the X/Y intersection", and then all the accelerations, directions, and durations thereof. If all you've got is the accelerometer, then you're kind of hosed.

If all you've got is acceleration, then you have no idea what's happening. 5gravities of acceleration due north doesn't say much. Did you start from standing still (0kph)? Were you already moving 50kph and are speeding up? Maybe you're actually doing 50kph and DEcelerating due south. Perhaps you were doing due west and are now turning to head north-west.

Marc B
  • 356,200
  • 43
  • 426
  • 500