Accelerometer/GPS in android - android

I am a newbee in android and I have a question.
I surfed a lot in order to find out how to calculate the no of stairs climbed.
Now I came across accelerometer and few applications which ask us to input certain values like tread, raise and so on.
GPS was another option. But to my knowledge GPS does not work indoors.
I just wanted to know is there any way else to find the no of stairs climbed apart from this.
Thanks in advance.

You will need to use accelerometer. There is no other way to do it.
See how to count step using accelerometer in android for possible answers. To avoid asking for tread depth and step height, you could assume one step per step, if you see what I mean :)

I would try to develop a pedometer algorithm specifically for this task, see reference to the general pedometer algorithms at Android accelerometer accuracy (Inertial navigation), under indoor positioning.
Developing a pedometer requires lots of experiments and tweaking, and there will always be a way to fool your application.

Related

How accurate is the getSpeed() [duplicate]

I've been doing a bit of research on a problem we are trying to solve. I think this is the best approach but please add in your opinions
We are trying to calculate reaction times in a real world driving scenario and would like to use a mobile phone as the data collection device. What we are trying to accomplish is how much acceleration and more importantly deceleration a driver exerts when exposed to certain prompts.
I found this paper that has allot of useful information Accelerometer physics
The problem is that we most likely will not have a calibration time to start at zero.. however it is assumed that the driver is starting at 0. We will use GPS positioning to locate the vehicle, tracking the time stamped location data we should calculate the time when the prompt took place then using the time stamped accelerometer data we should be able to calculate their reaction to the prompt.
This is the best way I have found to solve the problem however I'm not sure if the accelerometer data will be rendered useless because of not being able to calibrate it and also the noise seen from vibrations may be too great to use the data... Has anyone tried or used these types of methods before?
Interesting application.
You are missing an important point. You either have to implement the so-called sensor fusion yourself or use the sensor fusion provided on the platform you are using. Both Android and iPhone have one.
The TYPE_LINEAR_ACCELERATION (Android, SensorManager) or userAcceleration (iPhone) should be sufficient for you.
As for the linked PDF, don't try integrating the acceleration, you will get very poor results. Even though that answer is about position, the velocity will already be inaccurate. I would try the GPS instead.
I know it's very old question but since I am recently working on a similar project let me share what we did in our company. We simply used OBD-II dongle to get velocity of car. There are many API's that return information about vehicle.
PID010D returns speed of vehicle. I'm using this PID to calculate distance between points A and B since there is no PID to return Odometer :(
There are few libraries on github that you can find easily by search. This mine. This is not library but after run on your device you can see how it works.

Approaches to accurate 3d compass for finding specific locations

Say an event is being hosted in a large building. There are 20 rooms which are quite difficult to find.
I want to develop an app which points you in the right direction of a specified room or shows on a 3-d map, the location of you, relative to this room. This obviously includes altitude as the building has many floors.
Now, I looked into GPS, which is not very accurate and also depends on the quality of the phone's GPS. I'm not sure if this is really an option for the accuracy I require.
I also looked into Bluetooth beacons, but it is apparently very difficult to add direction to this as well as distance. Plus, this is only accurate at around 20 meters, right?
What other alternatives are out there that I can research myself?
And which options can I definitely eliminate?
I am not looking for a heated debate over the best approach, I know this is against SO rules.
So just a few potential options is all I wasnt, so I can go and research them myself... maybe wifi or something?
GPS you can forget, there is no or very bad receivement indoors.
I would concentrate on blue tooth beacons. Apple provides such iBeacons, too. So this can give you more information what is feasible.
The third possibility is magnetic field analysis, but i dont trust much that solutions. Altough there are demos and even an ios App (Indoor Atlas), this soultion has some drawbacks. Change of magnetic field after change in construction / furniture.

Indoor position tracking using ble

I have some ble beacons using which I need to determine and track the movement of android phones within the given area. I know there would have been a lot of research in this area already and would like to know what are the open source software which I can use to base my application on? Some pointers would help me.
I have a couple of beacons along with their range. Is there any open source algorithm which I can use to determine position?
Well the thing you are talking is perhaps ranging and monitoring. There are no certain algorithms, you need to implement logic as per your requirement in your app. Please check this link. This would be really helpful
https://developer.apple.com/library/ios/documentation/userexperience/conceptual/LocationAwarenessPG/RegionMonitoring/RegionMonitoring.html
If you are going through BLE in NAdroid, check this
http://developer.radiusnetworks.com/ibeacon/android/samples.html
Hope it hepls with your problem

How to detect freefall in android

I'm trying to write an android code that uses the device sensors to detect freefall scenario.
I searched the web a lot for a solution to this problem but I was unable to find anything useful.
I did see that there are several apps that does exactly this so it is possible, but i didn't find any code sample or tutorial on how to do that.
Can anyone please help me with a code snippet or even with a mathematical calculation using the sensors data?
Thanks in advance
The device is in free fall if the length of the vector given by TYPE_ACCELEROMETER is approximately zero. In theory, it should be exactly zero, in practice, it well be only near zero. So you need to come up with some threshold by trial and error and declare that the device is in free fall if the length of that vector is below this threshold.
Check out the API here SensorEvent Values and the math behind FreeFall here Wikipedia.
You are trying to detect speed in some direction. Look at the motion equations on wikipedia. You are detecting acceleration over time that is normalized for the gyroscopic rotation of the device.
Also see: How to approach Fall Detection Algorithm
From what I've read, the accelerometer normally measures gravity. Thus, if you're in freefall and the device is not being moved laterally, all accelerometer readings should be zero. (Disclaimer: I have not written any accelerometer code.)
Google the iFall project by a group at Florida State University. The have published a paper describiing the approach they took for their Android iFall application, which gives a host of references for further/extended study. They also have an API available and explain how to use it, if you want a fast shortcut approach. (To use their API, I believe you just need to download and install their iFall app form the Playstore)

Using accelerometer to calculate speeds

I've been doing a bit of research on a problem we are trying to solve. I think this is the best approach but please add in your opinions
We are trying to calculate reaction times in a real world driving scenario and would like to use a mobile phone as the data collection device. What we are trying to accomplish is how much acceleration and more importantly deceleration a driver exerts when exposed to certain prompts.
I found this paper that has allot of useful information Accelerometer physics
The problem is that we most likely will not have a calibration time to start at zero.. however it is assumed that the driver is starting at 0. We will use GPS positioning to locate the vehicle, tracking the time stamped location data we should calculate the time when the prompt took place then using the time stamped accelerometer data we should be able to calculate their reaction to the prompt.
This is the best way I have found to solve the problem however I'm not sure if the accelerometer data will be rendered useless because of not being able to calibrate it and also the noise seen from vibrations may be too great to use the data... Has anyone tried or used these types of methods before?
Interesting application.
You are missing an important point. You either have to implement the so-called sensor fusion yourself or use the sensor fusion provided on the platform you are using. Both Android and iPhone have one.
The TYPE_LINEAR_ACCELERATION (Android, SensorManager) or userAcceleration (iPhone) should be sufficient for you.
As for the linked PDF, don't try integrating the acceleration, you will get very poor results. Even though that answer is about position, the velocity will already be inaccurate. I would try the GPS instead.
I know it's very old question but since I am recently working on a similar project let me share what we did in our company. We simply used OBD-II dongle to get velocity of car. There are many API's that return information about vehicle.
PID010D returns speed of vehicle. I'm using this PID to calculate distance between points A and B since there is no PID to return Odometer :(
There are few libraries on github that you can find easily by search. This mine. This is not library but after run on your device you can see how it works.

Categories

Resources