sensor

Android Pitch and Roll Issue

♀尐吖头ヾ 提交于 2019-11-30 16:06:13
问题 I am working on a tilt app for Android. I am having an issue with Portrait & landscape mode. When the pitch = 90 degrees (phone on end) and even slightly before the roll value goes crazy when there has been no physical change in roll. I have not been able to find a solution to this problem. If anyone can point me in the right direction, it would be appreciated. Here’s a short code dump, so you know it is not an accelerometer error. final SensorEventListener mEventListener = new

Android Pitch and Roll Issue

被刻印的时光 ゝ 提交于 2019-11-30 15:45:09
I am working on a tilt app for Android. I am having an issue with Portrait & landscape mode. When the pitch = 90 degrees (phone on end) and even slightly before the roll value goes crazy when there has been no physical change in roll. I have not been able to find a solution to this problem. If anyone can point me in the right direction, it would be appreciated. Here’s a short code dump, so you know it is not an accelerometer error. final SensorEventListener mEventListener = new SensorEventListener(){ public void onAccuracyChanged(Sensor sensor, int accuracy) {} public void onSensorChanged

Android: Problems calculating the Orientation of the Device

微笑、不失礼 提交于 2019-11-30 13:21:21
问题 i'am trying to build a simple Augmented Reality App, so I start working with sensor Data. According to this thread (Android compass example) and example (http://www.codingforandroid.com/2011/01/using-orientation-sensors-simple.html), the calculation of the orientation using the Sensor.TYPE_ACCELEROMETER and Sensor.TYPE_MAGNETIC_FIELD doesn't really fit. So I'm not able to get "good" values. The azimut values doesn't make any sense at all, so if I just move the Phone upside the value changes

Get device angle by using getOrientation() function

别说谁变了你拦得住时间么 提交于 2019-11-30 13:18:28
问题 I was using Sensor.TYPE_ORIENTATION to determine current angle of device but TYPE_ORIENTATION is deprecated on API version 8 . In SensorManager manual it refers to getOrientation() function in order to use TYPE_ORIENTATION . Here is the manual Here is my old code : public void onSensorChanged(SensorEvent event) { Log.d("debug","Sensor Changed"); if (event.sensor.getType()==Sensor.TYPE_ORIENTATION) { Log.d("debug",Float.toString(event.values[0])); float mAzimuth = event.values[0]; float mPitch

Android - How to approach fall detection algorithm

风格不统一 提交于 2019-11-30 10:49:31
问题 I want to be able to feature a fairly simple fall detection algorithm in my application. At the moment in onSensorChanged(), I am getting the absolute value of the current x,x,z values and subtracting SensorManager.GRAVITY_EARTH (9.8 m/s) from this. The resulting value has to be bigger than a threshold value 10 times in a row to set a flag saying a fall has been detected by the accelerometer, the threshold value is about 8m/s. Also I'm comparing the orientation of the phone as soon as the

Sensor fusioning with Kalman filter

天涯浪子 提交于 2019-11-30 10:41:23
问题 I'm interested, how is the dual input in a sensor fusioning setup in a Kalman filter modeled? Say for instance that you have an accelerometer and a gyro and want to present the "horizon level", like in an airplane, a good demo of something like this here. How do you actually harvest the two sensors positive properties and minimize the negative? Is this modeled in the Observation Model matrix (usually symbolized by capital H)? Remark: This question was also asked without any answers at math

How to get sensor data over TCP/IP in nodejs?

一笑奈何 提交于 2019-11-30 10:36:36
I have a nodejs app with socket.io. To test this, save the below listing as app.js. Install node, then npm install socket.io and finally run on command prompt: node app.js var http = require('http'), fs = require('fs'), // NEVER use a Sync function except at start-up! index = fs.readFileSync(__dirname + '/index.html'); // Send index.html to all requests var app = http.createServer(function(req, res) { res.writeHead(200, {'Content-Type': 'text/html'}); res.end(index); }); // Socket.io server listens to our app var io = require('socket.io').listen(app); // Send current time to all connected

Android Accelerometer Profiling

感情迁移 提交于 2019-11-30 10:19:44
问题 I have written a simple Activity which is a SensorEventListener for Sensor.TYPE_ACCELEROMETER . In my onSensorChanged(SensorEvent event) i just pick the values in X,Y,Z format and write them on to a file. Added to this X,Y,Z is a label, the label is specific to the activity i am performing. so its X,Y,Z,label Like this i obtain my activity profile. Would like to have suggestions on what operations to perform after data collection so as to remove noise and get the best data for an activity.

CMDeviceMotion yaw values unstable when iPhone is vertical

点点圈 提交于 2019-11-30 08:46:49
In a iOS prototype I use a combination of CMDeviceMotion.deviceMotion.yaw and CLHeading.trueHeading to make stable compass heading that is responsive and accurate. This works well when the iPhone is held flat, where I have a graphical arrow that point to a stable compass heading. The problem appear when the iPhone is held vertical in portait mode. The UIDeviceOrientation constantly changes from UIDeviceOrientationFaceDown to UIDeviceOrientationFaceUp and back. This makes the yaw value to skip back and forth +/-180 degrees based on small changes of the pitch. Is it possible to lock the device

Android sensor: getRotationMatrix() returns wrong values, why?

人走茶凉 提交于 2019-11-30 07:41:23
It's past several days since I started using this function and have not yet succeeded in obtaining valid results. What i want is basically convert acceleration vector from device's coordinates system, to real world coordinates . I' know that is possible because i have acceleration in relative coordinates and i know the orientation of the device in real world system. Reading Android developers seems that using getRotationMatrix() i get R = rotation matrix. So if i want A (acceleration vector in world system) from A' (acceleration vector in phone system) i must do simply: A=R*A' But i cant'n