Two sensors are available for the same type in Android

I am using a Samsung Galaxy S3. When I removed the available sensors:

I got the result as below:

LSM330DLC 3-axis Accelerometer TYPE_ACCELEROMETER AK8975C 3-axis Magnetic field sensor TYPE_MAGNETIC_FIELD iNemoEngine Orientation sensor TYPE_ORIENTATION CM36651 Light sensor TYPE_LIGHT CM36651 Proximity sensor TYPE_PROXIMITY LSM330DLC Gyroscope sensor TYPE_GYROSCOPE iNemoEngine Gravity sensor TYPE_GRAVITY iNemoEngine Linear Acceleration sensor-S/W TYPE_LINEAR_ACCELERATION iNemoEngine Rotation_Vector sensor TYPE_ROTATION_VECTOR LPS331AP Pressure Sensor TYPE_PRESSURE Rotation Vector Sensor TYPE_ROTATION_VECTOR Gravity Sensor - software sensor TYPE_GRAVITY Linear Acceleration Sensor TYPE_LINEAR_ACCELERATION Orientation Sensor TYPE_ORIENTATION Corrected Gyroscope Sensor TYPE_GYROSCOPE 

STMicroelectronics appears to be the default, and the sensors provided by Google Inc and Samsung Inc may be secondary sensors. When I used the getVendor () method, it returned STMicroelectronics (which is the hardware standard sensor) and Samsung. But when I registered both sensors, onSensorChanged () is called, which with a large difference returned orientation values ​​(step, roll and azimuth).

For example, I received the following values ​​at the same time stamp (with a difference of several seconds).

  pitch: roll: azimuth: Samsung 0.5917465 -4.212 84.583 STMicroelectronics 0.0865345 -3.88854 356.825 

Any idea on why there is a difference in both or should we always monitor hardware and software sensors?

+4
source share
3 answers

2 sensors are supplied by two suppliers as indicated in madhus. It can be obtained using the code:

 List<Sensor> gyro =mSensorManager.getSensorList(Sensor.TYPE_GYROSCOPE); for(int i=0;i<gyro.size();i++) { Log.d(TAG,"The vendor is: " +gyro.get(i).getVendor() + " **" +gyro.get(i).getVersion()); } 

I got suppliers like STMicroElectronics and google Inc for all sensors except orientation (Samsung Inc and STMicroElectronics). However, since the default hardware sensor is STMicroElectronics, I use this.

0
source

Accelerometer, magnet, light, proximity, gyroscope, pressure, gravity, these are hardware sensors.

"iNemoEngine xxx" should be a kind of "virtual sensor" implemented by Google in ICS.

linear accelerometer, rotation vector, orientation, this is a software sensor implemented using a sensor fusion algorithm.

http://electronicdesign.com/ios/understanding-virtual-sensors-sensor-fusion-context-aware-applications http://www.sensorplatforms.com/which-sensors-in-android-gets-direct-input-what -are-virtual-sensors / http://www.thousand-thoughts.com/2012/03/android-sensor-fusion-tutorial/

+2
source

The sensor object will be a list of all available sensors on the device.

To test a specific sensor, use one of the other sensor constants, such as TYPE_TEMPERATURE, TYPE_RELATIVE_HUMIDITY or TYPE_PRESSURE.

There is also a getDefaultSensor () method. The transmission of a specific sensor constant will also determine if the sensor is available on the device.

And if the device has more than one sensor of this type, one of the sensors will be installed as the default sensor. If there is no default sensor set, getDefaultSensor () will return null, which means the sensor is missing.

For example, the code for checking the gyro sensor using the getDefaultSensor () method might look something like this.

 if (mSensorMgr.getDefaultSensor(Sensor.TYPE_GYROSCOPE) != null) { // Yesssss...gyroscope sensor available } else { // There no gyroscope on this device :( } 

Hope this helps.

+2
source

All Articles