android-sensors

Compass give me crazy data, is calibration needed or it's the sensor broken?

霸气de小男生 提交于 2019-11-28 02:56:25
问题 I'm working with android sensor data. My application use SensorManager.getRotationMatrixFromVector( mRotationMatrix , event.values); and it has been working well until this morning, when the rotation matrix started to send a lot of noise data (Change N to W in a second). It's not a problem with my code, because on friday was working and no changes have been done. I have used a compass app from the market, and the compass is giving random data. I have tested my app on another tablet, and it is

Reference coordinate system changes between OpenCV, OpenGL and Android Sensor

梦想与她 提交于 2019-11-27 19:29:33
I am working with OpenCV , Android and OpenGL for an Augmented Reality project. As far as I know the coordintate system in OpenGL is The OpenCV coordinate system is: When combining these devices with android sensors how can I do the coordinate system conversions and [R|t] matrix conversion? Is there a good tutorial or documentation were all of this conffusing stuff is explained? If you look at the picture, then you see, that the both coordinate systems have the same handednes, but the OpenCV one is rotated by pi around the x axis. This can be represented by the following rotation matrix: 1 0 0

Calculating distance using Linear acceleration android [duplicate]

血红的双手。 提交于 2019-11-27 19:11:48
Possible Duplicate: Android accelerometer accuracy (Inertial navigation) I am using the following code to calculate the distance. tnew and anew are arraylists containing timestamps and accelerations respectively. double distance=0; double init_vel=0; long time_prev=tnew.next(); while(anew.hasNext()) { float temp_acc=anew.next(); long temp_time=tnew.next(); interval=(temp_time-time_prev)/1000f; //milliseconds to seconds double fin_vel=init_vel+(temp_acc*interval); distance+=(init_vel*interval)+0.5f*temp_acc*interval*interval; init_vel=fin_vel; time_prev=temp_time; } Is there any logical mistake

How to read Android accelerometer values in a stable and accurate way?

二次信任 提交于 2019-11-27 18:59:56
问题 In a my project I am trying to control a car using data obtained through the accelerometer of an Android device. (Left, Right, Forward, Reverse). Even though I have managed to read values from the accelerometer the readings are subject to frequent changes even the device is in a stable position. Can someone provide me a better way to do this? Following is the code that I have used import android.content.Context; import android.hardware.Sensor; import android.hardware.SensorEvent; import

Get Android rotation angle in x-axis

不想你离开。 提交于 2019-11-27 16:55:14
问题 I'm experimenting with some Android functions. Right now, I'm trying to get the rotation angle of the device, so when I show a happy face bitmap on a canvas, it always looks "straight". All I would need for this, is to get the x-axis rotation angle (I guess) but I can't find how to achieve it. Hope you can help me. Thank you. 回答1: There is azimuth, pitch and roll available to you. Not sure which one relates to your "x-axis" but I think its azimuth. Time for helpful links: http://www

Turn off screen programmatically when face is close the screen on Android

人走茶凉 提交于 2019-11-27 11:36:12
My app is a dialer and when user holding the phone near his head I need to turn screen off and prevent clicking on the controls - like native Android dialer behavior. What API level I need and how can I do this in right way? I found solution by disassembling one very famous VoIP application. This activity after pressing button1 will disable screen and hardware keys when you close sensors. After pressing button2 this function will be switched off. Also, this function required permission: <uses-permission android:name="android.permission.WAKE_LOCK" /> Activity. Try it. public class MainActivity

How can I get the magnetic field vector, independent of the device rotation?

醉酒当歌 提交于 2019-11-27 07:47:23
问题 What I want to archieve is a sort of "magnetic fingerprint" of a location. I use the MAGNETIC_FIELD sensor and in the event I get the 3 values for the (unfortunately not further explained) X, Y and Z axis. Problem is, that the values change as I rotate the device, so I guess the 3 axis are relative to the device. What I'd need is to compensate the device rotation so that I get the same 3 values, regardless of how the device is rotated. I tried to multiply with the rotation matrix (I know how

Android 4.3: BLE: Filtering behaviour of startLeScan()

限于喜欢 提交于 2019-11-27 06:41:36
I'm working on a BluetoothLE sensor device, for which I need to form a one-to-many broadcast of data. As per the spec, peripherals may only have a single master, and due to limitations of the chip and stack I'm designing on, a master can only have three slaves. From what I understand, Android cannot become a BLE slave anyway, so having my device as a master is not an option. Both the BT4 spec and manufacturer documentation talk about another mode of operation, referred to as Broadcast mode. In broadcast mode, a connection is never made, and the application data is transmitted as part of the

Android proximity sensor issue only in Samsung devices

浪尽此生 提交于 2019-11-27 06:02:43
问题 Specific scenario to avoid problems: Behaviour for Activity in Samsung devices was different in the manner that every time there was a change detected, for proximity, it resulted in a call to onPause()/onResume() ONLY on SAMSUNG devices. I was clearing the proximity sensors in onPause() which resulted in a behaviour unique to Samsung devices. Hope this saves some time for anybody who's facing this. I removed the call of clearing proximity listeners from onPause() and now it works as expected

android compass seems unreliable

狂风中的少年 提交于 2019-11-27 05:30:20
问题 I have been working on a small compass app the past couple of days, and have gotten the code up and running, but it seems that the compass reading is not accurate. After calibrating both phones, my first test that i found this in what that i simply held the phone against and flat surface looked at the reading then flipped it horizontally and put it against the same flat surface (a 180* turn) and the value did not change 180* it was closer to 240*. I then tested the reading vs a compass, at