sensor

How to Build a Sensor Simulator for Android?

泪湿孤枕 提交于 2019-12-03 01:04:56
I am building a application for the Android platform and I would like to use the accelerometer. Now, I have found a very nice application for sensor simulation ( OpenIntents' SensorSimulator ) but, for what I want to do, a would like to create my own sensor simulator application. I have not found information on how to do this (I do not know if disassembly the jar of the Simulator is correct) and, as I said, I would like to build a smaller and simpler version of a sensor simulator, more suitable for my intents. Do you know where could I start? where can I see what are the pieces of code that I

Compute rotation matrix using the magnetic field

浪子不回头ぞ 提交于 2019-12-03 00:50:46
In get rotation matrix value it contains public static boolean getRotationMatrix (float[] R, float[] I, float[] gravity, float[] geomagnetic) Here how can i calculate the float[] gravity ? I found a sample of code where it calculate the orientation using both Accelerometer and Magnetic field boolean success = SensorManager.getRotationMatrix( matrixR, matrixI, valuesAccelerometer, valuesMagneticField); if(success){ SensorManager.getOrientation(matrixR, matrixValues); double azimuth = Math.toDegrees(matrixValues[0]); double pitch = Math.toDegrees(matrixValues[1]); double roll = Math.toDegrees

Android Accelerometer filtering?

独自空忆成欢 提交于 2019-12-02 20:58:35
I saw many examples about filtering Accelermeter's values, to cancel out the gravity (High-pass filter). But most of them were 1st order one, which is said to be simple, but laggy and not the best one (though I know nothing about the filters or DSP). Somebody in here said that there exists the better solution used in DSP to sense the motion. Regretfully I can't even imagine what it would be, as I am completely outsider to the field. I hope somebody could tell at least the type of filters that can be used when dealing with the sensor. Of course, even brief introduction to the specific algorithm

Sensor fusion implemented on Android?

给你一囗甜甜゛ 提交于 2019-12-02 19:42:01
I listened to this talk: http://www.youtube.com/watch?v=C7JQ7Rpwn2k which is Invensense Inc prototyping their "Sensor fusion" system, which is where they combine gyro, accelerometer, compass measurements in Android, to get better results. Is this currently implemented in any version of Android? The reason I ask is, part of sensor fusion is the "Gravity" sensor and the "Linear Acceleration" sensor, which ARE implemented in Android ever since API Level 9... makes me think that either 1) sensor fusion is implemented 2) sensor fusion is not implemented, but these are just added into Android API in

Display an Android Sensors List

孤者浪人 提交于 2019-12-02 19:08:08
I'm trying to display a list of available sensors but it's like there are not! I was thinking that it was because of the emulator, but i tried it on the phone and the result is the same. private SensorManager mSensorManager; TextView mSensorsTot,mSensorAvailables; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); // Get the texts fields of the layout and setup to invisible mSensorsTot = (TextView) findViewById(R.id.sensoritot); mSensorAvailables = (TextView) findViewById(R.id.sensoridisponibili); // Get the SensorManager

Android Accelerometer Sensor

心不动则不痛 提交于 2019-12-02 19:01:37
问题 I am trying to work with Accelerometer Sensor. So i tried this example: http://blog.androgames.net/85/android-accelerometer-tutorial/ It work perfectly. But when i change AccelerometerManager activity to a service, it doesn't work and i got an error. //this is the activity that i want change public class Accelerometer extends Activity implements AccelerometerListener { private static Context CONTEXT; /** Called when the activity is first created. */ @Override public void onCreate(Bundle

Need to calculate rotation-vector from Sensor.TYPE_ORIENTATION data

☆樱花仙子☆ 提交于 2019-12-02 18:36:05
I need to calculate a rotation vector out of the data i get from Sensor.TYPE_ORIENTATION. The sensor data is defined like this: the values have to be recalculated to become a correct 3d position: values[0]: Azimuth, angle between the magnetic north direction and the Y axis, around the Z axis (0 to 359). 0=North, 90=East, 180=South, 270=West values 1 : Pitch, rotation around X axis (-180 to 180), with positive values when the z-axis moves toward the y-axis. values[2]: Roll, rotation around Y axis (-90 to 90), with positive values when the x-axis moves away from the z-axis I need all three

How to get Android phone orientation matching human orientation?

你说的曾经没有我的故事 提交于 2019-12-02 17:32:10
I'm making a map app, including the location arrow that shows you which way you're facing, like so: I get the orientation directly from SensorManager.getOrientation() , using the first returned value: azimuth. When the phone is held so that the screen is pointing above the horizon, and in portrait, the arrow works fine. However: When the phone is held so the screen is pointing below the horizon, the arrow points 180 degrees away from the direction the user is facing. When the phone is held so the screen's facing is level with the horizon, the arrow has no clue which way it's pointing. Azimuth

gnuplot: Faulty sensor sometimes reading 0.00 - how to convert them to missing?

北城余情 提交于 2019-12-02 12:07:05
问题 I have a combination RPi/Arduino taking readings from several DHT-22 Humidity/Temperature sensors. One of the sensors developed a loose wire and has been giving occasional 0.00 temperature readings for 10-20 minutes in a row. Because of the other data collected at the same time I don't really have the option to just delete the whole line of data like I would if it were the only sensor being recorded. The wire has been fixed now. So my question is, can I do something in the gnuplot code to

How to append fast updating strings to file in swift

早过忘川 提交于 2019-12-02 11:47:07
I want to write sensor data to a file as the sensor updates within the method. I need to append the data as it updates, but my file overwrites with the last sensor output when I try to. func startAccel(fileName: String, fileURL: URL) ->Void{ //Starting accelerometer motionManager.accelerometerUpdateInterval = 1.0 / Double(hz) //determines refresh speed motionManager.startAccelerometerUpdates(to: OperationQueue.current!){ (data, error) in if let myData = data{ do{ let newLine = "Accelerometer, \(myData.acceleration.x), \(myData.acceleration.y),\(myData.acceleration.z)\n" try newLine.write(to: