accelerometer

How to get the rotation between accelerometer's axis and motion vector?

谁说胖子不能爱 提交于 2019-11-28 06:17:46
问题 I'm working on a Pedestrian Navigation System on Android. I am currently trying to get the rotation matrix between the 3-axis accelerometer referential and the motion that is applied to the device. Let's say you are walking straight forward with the device in your hand, but the Y axis of the accelerometer (thus the device's Y axis) is not oriented in the same direction as the one you're heading yourself (basically you're holding the device in an awkward way). Then if I want to apply distances

Detect when an iphone has been bumped

荒凉一梦 提交于 2019-11-28 05:08:55
I want to be able to detect if an iphone has been bumped into something...would it be best to listen to the gyroscope / accelerometer and judge how fast its moved or if its moved and stopped suddenly. In fact how would I judge if the device has moved then stopped suddenly? This answer is great but in reverse iOS: Accurately determining energy of a bump from accelerometer output - it smooths out the movement, if anything I want to detect a sharp movement. Also are both the Gyroscope and Accelerometer available for 3GS ? UPDATED WITH CODE From the Apple doc http://developer.apple.com/library/iOS

Accelerometer stops delivering samples when the screen is off on Droid/Nexus One even with a WakeLock

谁说胖子不能爱 提交于 2019-11-28 04:59:37
I have some code that extends a service and records onSensorChanged(SensorEvent event) accelerometer sensor readings on Android. I would like to be able to record these sensor readings even when the device is off (I'm careful with battery life and it's made obvious when it's running). While the screen is on the logging works fine on a 2.0.1 Motorola Droid and a 2.1 Nexus One. However, when the phone goes to sleep (by pushing the power button) the screen turns off and the onSensorChanged events stop being delivered (verified by using a Log.e message every N times onSensorChanged gets called).

Rotate marker as per user direction on Google Maps V2 Android

点点圈 提交于 2019-11-28 04:45:37
I want to rotate marker as per bearing or sensor value received from Accelerometer to show the user where actually he is moving. I have set marker icon and flat value to true but its not working as required. mCurrentLocationMarker.position(new LatLng( LocationUtils.sLatitude, LocationUtils.sLongitude)); mCurrentLocationMarker.icon(icon); mCurrentLocationMarker.flat(true); mCurrentLocationMarker.rotation(LocationUtils.sBearing); if (currentMarker != null) { currentMarker.setPosition(new LatLng( LocationUtils.sLatitude, LocationUtils.sLongitude)); } else { currentMarker = mGoogleMap .addMarker

Which Android phones out there do have a gyroscope? [closed]

一笑奈何 提交于 2019-11-28 04:23:07
I find it very hard to get any consolidating information about which Android phones do have a gyroscope, or if there are Android phones with this sensor at all. I read about some (especially Samsung) phone models that have at least a 6-axis accelerometer, but I also read that this is different to a real gyroscope. So my questions are: Which Android phones do have a gyroscope? (Should be usable with the Android API's Sensor.TYPE_GYROSCOPE which is available since API 3) Which Android phones do have a 6-axis accelerometer? Any references like links, specs etc. are greatly appreciated and of

Detecting Acceleration in a car (iPhone Accelerometer)

隐身守侯 提交于 2019-11-28 03:52:18
I am working on an iPhone app where we are trying to calculate the acceleration of a moving car. Similar apps have accomplished this (Dynolicious), but the difference is that this app is designed to be used during general city driving, not on a drag strip. This leads us to one big concern that Dynolicious was luckily able to avoid: hills. Yes, hills. There are two important stages to this: calibration, and actual driving. Our initial run was simple and suffered the consequences. During the calibration stage, I took the average force on the phone, and during running, I just subtracted the

how to calculate exact foot step count using accelerometer in android?

帅比萌擦擦* 提交于 2019-11-28 03:02:18
I am developing some application like Runtastic Pedometer using the algorithm but I am not getting any similarity between the results. my code is as follows: public void onSensorChanged(SensorEvent event) { Sensor sensor = event.sensor; synchronized (this) { if (sensor.getType() == Sensor.TYPE_ORIENTATION) {} else { int j = (sensor.getType() == Sensor.TYPE_ACCELEROMETER) ? 1 : 0; if (j == 1) { float vSum = 0; for (int i=0 ; i<3 ; i++) { final float v = mYOffset + event.values[i] * mScale[j]; vSum += v; } int k = 0; float v = vSum / 3; //Log.e("data", "data"+v); float direction = (v >

Detect a speed in android

你说的曾经没有我的故事 提交于 2019-11-28 02:09:49
问题 is it possible to detect a speed of a car using GPS or accelerometer in android phone ? can anyone give me the road map to implement this ? 回答1: Yes, it's possible using GPS via object of Location class. There is getSpeed() method in this class. It's very easy to find code of getting location. Check this link for example. 来源: https://stackoverflow.com/questions/4497234/detect-a-speed-in-android

Rotate object in Unity 3D

醉酒当歌 提交于 2019-11-28 01:11:31
问题 I can use the following code to rotate object using accelerometer. transform.rotation = Quaternion.LookRotation(Input.acceleration.normalized, Vector3.up); But i would like to rotate object like for example screen is rotating - 0, 90, 180 and 360 degrees. How can I do it using Unity 3D? 回答1: You can use transform.rotation like this: transform.rotation = new Quaternion(rotx, roty, rotz, rotw); OR You can use transform.Rotate like this: transform.Rotate(rotx, roty, rotz); Documentation for

How can I get the direction of movement using an accelerometer?

两盒软妹~` 提交于 2019-11-27 19:28:41
I'm developing a Android application and I would like to know if is possible detect the direction of movement with one axis fixed. For example, I want put my phone on the table and detect the direction when I move it (left, right, up and down). The distance is not necessary, I just want know the accurate direction. Yes. Using the SensorEventListener.onSensorChanged(SensorEvent event) you can determine the values provided along the X & Y axis. You would need to record these values and then compare them to any new values that you receive on subsequent calls to the onSensorChanged method to get a