accelerometer

android: moving shape/image with values from accelerometer

大兔子大兔子 提交于 2019-12-08 11:03:26
问题 ive managed to get out the accelerometers values (x,y,z). Is there an easy way to make a circle move with those values? I would also like it to stop at the edges of the screen. Thanks! 回答1: I think you can do something like this ( note: partially pseudocode): public void onSensorChanged (int sensor, float[] values) { //adjust someNumber to desired speed //values[1] can be -180 to 180 float xChange = someNumber * values[1]; //values[2] can be -90 to 90 float yChange = someNumber * 2 * values[2

User Activity Static/running/Walking/Driving based on CoreMotion data only

扶醉桌前 提交于 2019-12-08 09:52:30
问题 How can we detect user is driving/walking/running/static with CoreMotion data. We can get user activity in iPhone 5s using CMMotionActivityManager. But how to get in lower version devices. With the help of CLLocationManager I can get the device speed and based on speed I can decide the user state, which drain battery life of device. Is there any possibility to detect Device State based on Core motion only? Some application like like Place me app does, It detect user activity based on

accelerometers uses- smartphone

随声附和 提交于 2019-12-08 09:12:59
问题 It is known that the raw accelerometer data is combination of both linear acceleration and gravity. In order to isolate them w need to apply appropriate filters. I would like to know the real time applications where we would need only "gravity" or only "linear acceleration". 回答1: Gravity is used when you are trying to figure out the orientation of the phone. In other words, when you are trying to figure out how the user holds the phone. It is good for tilt games, for example you use the phone

How can my IntentService in background always listen to device's shake?

▼魔方 西西 提交于 2019-12-08 08:28:32
问题 I am developing an app which is basically one widget and one service. The widget is only a button which I want it to run the service in the device's background. So the user just clicks the button and nothing happens in the UI, the service starts in the background. But I want the background service, which I have implemented using IntentService, to ALWAYS listen to my device's shake in the background after the widget's button is clicked. It has to monitor the accelerometer sensor for any change

Find distance , speed and acceleration using geolocation api cordova/phonegap

随声附和 提交于 2019-12-08 08:03:48
问题 I want to develop one mobile app using cordova/phonegap which will find distance traveled , avg. speed and acceleration for particular fixed time frame say 20 sec. provided by user. I have read that geolocation or accelerometer api of phonegap can be used over there , but I am confused and unable to understand which formula or method to use and how to calculate those values? Please help me to achieve this functionality. 回答1: The Javascript library at the bottom of this page is really useful

How to detect that the phone (WP7) has stopped shaking

爱⌒轻易说出口 提交于 2019-12-08 06:41:33
I can get the phone to react to a shake, but what is the best way to tell that it has stopped shaking? This example worked for me. At the very bottom of the page you'll see: if (!_shaking && CheckForShake(_lastReading, reading, ShakeThreshold) && _shakeCount >= 1) { //We are shaking _shaking = true; _shakeCount = 0; OnShakeDetected(); } else if (CheckForShake(_lastReading, reading, ShakeThreshold)) { _shakeCount++; } else if (!CheckForShake(_lastReading, reading, 0.2)) { _shakeCount = 0; _shaking = false; } Do like #Daniel Pereira said, but in the void ShakeDetected(object sender, EventArgs e)

Orientation type of the sensor

ぐ巨炮叔叔 提交于 2019-12-08 06:31:54
问题 What data are used by orientation sensor in the android Samsung Galaxy S 2. Gyroscope's data or accelerometer's data? 回答1: I have recently answered a similar question (you can have a look here). The brief answer is this: "The methods included in the Android APIs to get the orientation does not include readings from the gyroscope sensor. Gyroscope does not provide information about orientation, since it only has information about rotation speed" . 回答2: Samsung Galaxy S2 has a boatload of

Android: Magnetometer data deviates

时光怂恿深爱的人放手 提交于 2019-12-08 06:11:39
问题 I am trying to estimate heading from the accelerometer, gyro and magnetometer data. I have implemented A Complementary Filter from here. What I am trying is that I am holding the phone in my hand and I walked 15 steps in a straight line and I am trying to estimate Euler angles as given in the link above. But when I plot the raw data, I observe that the magnetometer data deviates. Here are the images of raw sensor data. My question is: how do I estimate Euler angles so that they indicate I am

Accelerometer with FFT - strange output

老子叫甜甜 提交于 2019-12-08 05:38:37
问题 After reading a lot of research and works on subject I still have got problems applying FFT to my accelerometer data. Most of my code is taken from official MATLAB example: FFT for one dimension. After more reading I've found this question: FFT and accelerometer data: why am I getting this output? where there was suggestion to use windowing. So after some more reading I've added hamming window to my code. My data looks like that on plot: And this is the code that I am using for FFT: fs = 1/0

Device motion detection in iOS

别说谁变了你拦得住时间么 提交于 2019-12-08 03:47:54
问题 I want to detect the device motion like Panorama i.e. motion from my left side to Right side . I tried with the accelerometer but i can't able to do it. I like to move one image in a straight line as the device move. My code is as follow: - (void)viewDidLoad { [super viewDidLoad]; [[UIAccelerometer sharedAccelerometer] setUpdateInterval:1/60]; [[UIAccelerometer sharedAccelerometer]setDelegate:self]; } pragma mark - Accelerometer Delegate - (void)accelerometer:(UIAccelerometer *)accelerometer