accelerometer

android - detect downward acceleration, specifically an elevator

混江龙づ霸主 提交于 2019-12-06 10:31:11
问题 I want to be able to detect a situation where the phone has an acceleration towards the ground (probably means that the Gravity sensor has to be used here also). I have read a lot about this topic in the Android docs, about High and Low pass filters and other posts, and right now what I have is a code sample that gets the acceleration in the X, Y and Z axis after stripping the gravity: if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER) { final float alpha = (float) 0.8; gravity[0] =

How to calculate distance using accelerometer using iphone sdk?

左心房为你撑大大i 提交于 2019-12-06 09:36:57
What is the best way to calculate the distance between two points/Or we can say while we walk calculate distance traveled using accelerometer? My main question is that i'm working on an application in which i need to count distance using two locations but sometimes the core locations fails to update location so at that time how do i calculate the distance traveled? Dave DeLong You can't even get an accurate measurement of velocity from the accelerometer , so you're definitely not going to be able to get an accurate measure of distance traveled. 来源: https://stackoverflow.com/questions/2115288

Calibrate UIAccelerometer?

二次信任 提交于 2019-12-06 08:18:21
In my app I use the accelerometer to control the character in my game. Right now I only allow the portrait orientation so the user has to tilt the device to the right or left in order to move the character. That is working fine so far. What I am trying to accomplish now is to 'calibrate' the accelerometer to account for the current tilt the user is playing on. Lets say the user is laying on their side, the values will be skewed since it didn't account for that starting point so they won't be able to control the character. So I am trying to account for that initial tilt amount and then account

Accelerometer, Gyro, and Magnetometer

和自甴很熟 提交于 2019-12-06 08:12:51
问题 I'm new to Core Motion and I'm very confused. Can somebody please explain what these inputs measure and how they can be useful in simple terms? 回答1: Accelerometers measure movement relative to gravity, by virtue of "feeling" the force of movement applied to the device. Force of movement can be described as the rate of acceleration and deceleration of the device, hence the name of this sensor. Gyroscopes measure changes in rotation by virtue of a suspended element reporting its rotation

Phonegap Accelerometer y value to degrees

大城市里の小女人 提交于 2019-12-06 07:57:47
Phonegap accelerometer seems to return y values as below: // +10 y axis = straight up = 0/360 deg // -10 y axis = straight down = 180 deg // flat y axis = 90/270 deg My question is, how do I convert this y axis to the given degrees? Also, as it's phonegap, I'm assuming these values are the same for all devices. if anyone knows otherwise please let me know. Try this: deg = acceleration.y / 10 * 90; I think that worked for me when I was doing something similar. 来源: https://stackoverflow.com/questions/10758043/phonegap-accelerometer-y-value-to-degrees

How to detect bumps via Apple TV Siri Remote

删除回忆录丶 提交于 2019-12-06 07:12:18
问题 I'm unable to find any documentation relating to right and left bumps on the new Apple TV Siri Remote. You can see this in action at 1:00 of this video, Hands On: Apple TV 2015 Bluetooth Touch, Motion & Siri Remote. Remote and Interactions mentions positional taps, but these bumps are triggered by the accelerometer, suggested by the video. Are these bumps actually positional taps? How can I detect left and right bumps ? 回答1: Tapping (without clicking the physical button) on the edges of the

logic to count steps while walking using accelerometer feature in iphone

蹲街弑〆低调 提交于 2019-12-06 05:21:15
问题 How can I use the accelerometer feature in the iPhone to calculate distances while walking? 回答1: You can't use the accelerometer to determine distance. If I'm at rest, the accelerometer detects only acceleration due to gravity. This obviously set the walking distance to 0. But if I'm walking at constant velocity, and start your app while walking, my acceleration is also zero, thus the accelerometer detects only acceleration due to gravity again. The situation is same as above, and the walking

Android: the range of z-value in the accelerometer sensor are different on different devices

自闭症网瘾萝莉.ら 提交于 2019-12-06 03:55:10
I want to detect if the device is facing up. (Not angled but flat to the ground facing up). On some devices for facing up, z value will return values between 9~10. (Most devices) However, on Nexus 7, for facing up, z value will return values between 6~8. My code was: if(z_value > 9.0) { // device facing up } else { // device is in angled } However, above code doesn't work anymore. Since Nexus7 doesn't reach z_value of 9. How can I detect if the device is facing (entirely) up or not. (not asking z_value > 0) My full code is below: @Override protected void onStart() { super.onStart(); try {

Detecting device orientation

淺唱寂寞╮ 提交于 2019-12-06 02:53:27
问题 I need to detect android device orientation change without playing manually with sensor data, while keeping activity orientation stick to some orientation onConfigurationChange will not work as will stick my activity to not rotate. Playing around with sensor data to detect the orientation change I consider that as an invention of wheel, as android already does have embedded implementation of the algorithm to detect device orientation change. And from another side the detection of orientation

The method findViewById(int) is undefined for the type Get Data Fragment for Accelerometer Sensor

杀马特。学长 韩版系。学妹 提交于 2019-12-06 02:24:52
I'm doing my project for getting data by acceleometer sensor in android platform. I'm having error codes in the 3 last line codes. Exactly the error is the findViewById is not for get data fragment. so, how I can use findviewbyId in Fragment for getting data accelerometer sensor?many thanks for the answer :) import android.app.Activity; import android.app.Fragment; import android.content.Context; import android.hardware.Sensor; import android.hardware.SensorManager; import android.os.Bundle; import android.view.LayoutInflater; import android.view.TextureView; import android.view.View; import