Does Android Rotation Vector Sensor use the magnetometer readings? - android

As known, the so-called "Rotation Vector Sensor" is a virtual sensor.
I know for sure that it takes the readings from accelerometer and gyroscope for computation.
However, now I wish to know whether the magnetometer readings are also take into the calculation of the Rotation Vector Sensor?

The relation constitutes to
The rotation vector sensor reports the orientation of the device relative to the East-North-Up coordinates frame.
The underlying physical sensors are Accelerometer, Magnetometer, and Gyroscope, while the latter is used as the main orientation change input.
Furthermore source.android.com says
This sensor also uses accelerometer and magnetometer input to make up for gyroscope drift, and it cannot be implemented using only the accelerometer and magnetometer.
In contrary the Game rotation vector explicitly only uses the Accelerometer and Gyroscope. I asked a similar question on how the data is acutally fused, yet to be answered.
The link also directs to this table

Yes, rotation vector is a combination of the accelerometer, the magnetometer, and sometimes the gyroscope to determine the three-dimensional angle along which the Android device lays with respect to the Earth frame coordinates.

Related

Sensor Fusion: Which sensors are required for finding Rotation Vector?

Background: My aim is to figure out the tilted angles of a phone, for example for a game where tilting the phone backwards implies "stepping on the gas" and tilting left/right implies turning a steering wheel left and right.
I was watching this talk about sensor fusion between different Android sensors.
Based on the very end of the talk, it appears that I can use "vectors from rotation matrix to figure out which way I'm pointing".
Question: By that, are they implying that the correct approach for getting these angles would be by "Using the Rotation Vector Sensor"/TYPE_ROTATION_VECTOR?
If yes, my question is now specifically: which sensors does a device require to use sensor TYPE_ROTATION_VECTOR? My guess is accelerometer for initial values plus gyroscope for correction (plus optionally compass for additional correction)?
Extra credit question: Is anywhere I can find a list of devices that meet that criteria? and/or does anyone have a suggestion for a super cheap device that has the required sensors?
Short answer:
Rotation vector sensor: accelerometer, gyroscope, and geomagnetic field.
Game rotation vector sensor: accelerometer, and gyroscope.
Geomagnetic rotation vector sensor: accelerometer, and geomagnetic field.
Long answer:
According to the Sensor Documentation, the rotation vector sensor uses accelerometer, and both the gyroscope and geomagnetic field for absolute rotation calibration.
They also provided game rotation vector sensor and geomagnetic rotation vector sensor, which are very similar to it, but are different and are often used for other purposes.
The game rotation vector sensor only uses gyroscope for calibration, and is better at measuring relative rotations, and are not impacted by magnetic field changes.
The geomagnetic rotation vector sensor uses a magnetometer instead of a gyroscope for calibration, so the power consumption is reduced. And it’s suggested to be used in the background, and in conjunction with batching.
Now, most devices have 9-axis IMU, which includes accelerometer, gyroscope, and magnetometer x 3-axis each. So you should be fine using that sensor. The only concern is that, maybe some of the devices doesn't provide the above "software sensors" implementation, so you might need to do the sensor fusion yourself.
Hope this helps!

calculating android device moving speed (Using accelerometer and gyroscope)

I need to create an app that Calculates the device's velocity, with x/y/z speed.
My idea is using device's accelerometer and gyroscope,
like this pipeline
I wanted to know that whether accelerometer and gyroscope right sensor choice for this ?
(in the pipeline).
What Rotation table should i use for this?

Android Sensors - Which of them get direct input?

the Android SDK actually offers a nice interface to access the sensors.
But e.g. the linear acceleration-sensor can be evaluated as the documentation describes from gravity and acceleration - so there is no real physical counterpart for this Sensor, it is rather a - let's call it - "virtual sensor".
For the proximity-sensor things are rather clear, i can't imagine it is influenced by some other values.
But the GPS-sensor could be influenced by the accleremoter sensor when the GPS-signal is rather weaks I think values are somehow estimated supported by other sensors.
So basically my question is: which sensors do get direct input from physical sensors and which are somehow altered or totally calculated by the Android-SDK?
And how do I get raw input from the sensors?
I appended a list of the sensors available through the Sensor-class. GPS, W-LAN, Camera, etc. missing
//API-Level: 3
TYPE_ACCELEROMETER
TYPE_GYROSCOPE
TYPE_LIGHT
TYPE_MAGNETIC_FIELD
TYPE_PRESSURE
TYPE_PROXIMITY
TYPE_TEMPERATURE
//API-Level: 9 (2.3)
TYPE_GRAVITY
TYPE_LINEAR_ACCELERATION // can be calculated via acc. and grav. (link above)
TYPE_ROTATION_VECTOR
I am pretty sure the GPS at the moment is a stand alone or give raw data output.
The orientation sensor is one that I know that is not a raw from a single sensor but is actually the fusion of 2 sensors and in the future possibly more (gyro). As of now the orientation is a combination of the magnetic field sensor (compass) and the accelerometer. Any modern day compass will use both the compass and accelerometer to calculate its final direction and to compensate for drift, noise and other interference. If you notice when calculating the orientation with get rotation matrix and get orientation it requires you to listen for both magnetic field and accelerometer sensors.
I would say the gravity, linear acceleration and rotation vector sensors are not actual sensors and just parts of data from other sensors separated out, mostly from accelerometer and compass.
Lastly the pressure and temperature sensor are actually calculated through a single sensor.

Mobile phone sensors

After some hours of searching I'm so confused, so I'll tell now what I learned, so please correct me if I was wrong :
Light Sensor: surrounding light
Magnetic Sensor: I can get the north location.
Accelerometer Sensor: the gravity X Y Z , earth gravity or what ever acceleration .
Proximity Sensor: just like the parking car sensors.
Orientation Sensor: Tells the X Y Z degrees form their axis.
I've tried those sensors using some apps from android market like "My sensors", and I can confirm that accelerometer Sensor can't feel if you rotate your phone in position over a table. While orientation Sensor seems to catch all the moves. Now I can conclude that compass app uses the magnetic sensor to see where is the north, then orientation sensor to know where are you heading with your device, right?
switching between portrait and landscape modes use "Accelerometer Sensor" and checks the earth gravity on which axis.right?
Q1:so if everything is ok, what is "Gyroscope"? is it same as "Orientation Sensor"?
Q2:is Orientation Sensor avalible on most of the devices?
Q3:what other uses of Orientation Sensor?
Q4:why most of the websites even wikipedia says thet Orientation Sensor == Accelerometer Sensor?
-Rami
Ok, first the easy ones...
About Q1, Gyroscope measures the Angular velocity (radians/second) and the Orientation is a different magnitude, telling us how is "placed" the device (I don't really know how to explain something so basic in English).
And about Q2, I would say yes, 3-Axis orientation is avaiable on most of smartphones, at least those running Android.
Q3: Compass actually uses the Orientarion values, Magnetic Field sensor measures that magnitude, (not in degrees) though probably you can calculate the compass values with the magnetic field. Another use... well, you can tell wether the device lies upside or downside, for example.
About Q4, this is more difficult, I'm not that expert in accelerometers, but I think most of these "Sensors" use the same hardware sensor, which measures the magnecit field and makes the necessary calculations, but I insist, maybe it's better to read more detailed and technical information.
If you notice, now OrientarionSensor is deprecated, and this is written in the docs:
Note: This sensor type exists for
legacy reasons, please use
getRotationMatrix() in conjunction
with remapCoordinateSystem() and
getOrientation() to compute these
values instead.
So yes, it seems it calculates Orientation values trough the Accelerometer, but still, Orientation is given in degrees and Acceleration in (m/s^2), different magnitudes. As I told you, I think they measure different magnitudes with the same sensor, that's why they present different kind of Events in the API.
I hope I haven't written many huge mistakes, because well, I would also like to clarify some concepts regarding to these Sensors.
mdelolmo is perfectly right.
I would like to add the following:
About Q4. Everyone addresses the Orientation sensor as accelerometer
because the smartphones use it for the "Auto-Rotate" feature.
The switching between portrait & landscape modes
(often called orientation in layman terms) is done
by determining that the gravity is along which of axis of the phone.
This is done by the accelerometer-IC.
The orientation sensor (in Android) uses the accelerometer data
and the magnetic data to determine the exact positioning of the
device. ie. the angles it makes with all the 3axes. These are
azimuth(or yaw), pitch & roll.
The gyroscope provides the angular velocity of the device.
It is NOT the orientation sensor.
I haven't worked on android phones but may in the future, however accelerometers detect acceleration usually through the motions of a proof mass. So they can be used to orient a device roughly because they sense the g-vector so any orientation is totally unconstrained in angle about the g-vector. Now accelerometers can be utilized as gyroscopes but they are not used that way because they would need to be better than any accelerometer currently made to sense rotation via centripetal acceleration.
Gyroscopes directly measure either angular rate or angle directly. Most measure angular rate and the rate is integrated to get angle, so they can be used to measure orientation but since they are inertial sensors they drift and so do not provide an absolute orientation but are excellent sensors for relative rotations or relative orientation with respect to a very recent orientation. I hope this helps.
The magnetic sensor measures the direction to true north via the earth's magnetic field. The magnetic sensor supplied North with the g-vector via the accelerometeres give full orientation information because it breaks the symmetry of the orientation about the g-vector. This only really true when the phone/sensors are not moving. Since I do not know how this is implemented in the phone I can't say much else, but the fact that you need accelerometers and another orientation to get full orientation may be the reason why there is confusion about this subject.
Barometers measure pressure and can be good sensors to measure changes in height but can be fooled by active air moving systems such as as found in air conditioned homes and in forced hot air systems.
If you are not moving and you have sufficient sensitivity to measure earth rate with your gyroscopes you can do something called gyrocompassing where the gyroscopes and accelerometers become analytically aligned or physically aligned with with the local level coordinate system. This is how much better gyroscopes and accelerometers measure orientation in systems like aircraft, spacecraft and ships/submarines. There are many complications but this is the basic idea.

Android Sensors

I have a very basic question about Sensors:
Do magnetic sensors return readings w.r.t the phone's initial orientation or w.r.t the world coordinates?
What about accelerometers? Do they return values w.r.t their previous readings or is each value an independent acceleration relative to the world coordinate system?
I know that gyros return readings relative to the phone's initial orientation. So, how do I convert the yaw, pitch and roll readings from a gyro into the azimuth, pitch and roll readings from a magnetic sensor of a smartphone (I'm using HTC hero)
Thanks!
As mentioned, the gyroscope measures the angular velocity.
The third value returned (values[2]) is the angular velocity regarding the
z axis. You can use this value together with the initial value from the magnetometer to
calculate current heading: Theta(i+1) = Theta(i) + Wgyro*deltaT
You can receive initial heading orientation from 'Orientation' measurement (values[0])
This measurement is dependent only on the magnetometer. (you can put a magnet or a second phone close to the Smartphone and watch the output going crazy)
The second and third values of the 'Orientation' are dependent on the readings of the
Accelerometer. Since the Accelerometer measures gravity, it is possible to calculate
the pitch and roll angles from the Accelerometer readings in Axis Y and X.
Hope this helps
Ariel
Android Sensors (upto FroYo) provide the application with "raw" data.
There is bare minimum of "cooking" (ie processing) involved.
The accel & compass device provide absolute accel & magnetic data respectively.
The gyroscope provides relative angular velocity.
Gyroscopes do NOT provide relative data wrt any specific state/position.
What you need to understand is that gyroscopic data is angular-velocity.
Angular velocity is simply, how fast the phone is rotating (in degrees-per-second).
So once you hold it still, gyro says (0,0,0) &
as you rotate, you get how fast it is rotating.
This continues until u again hold it back still
when the gyro reading again becomes (0,0,0).
Theoretically the gyro can be used in "callibrate" the compass.
But to do so would require a lot of experimentation on your part.
The ideal place to fiddle around would be the sensor-HAL.
NOTE: You would need to turn-ON all the sensor h/w even if
ONLY compass data is reqd. As you will be cross-referencing
the gyro/accel data for that. This will mean larger power consumption &
extremely poor battery life. All the sensors turned on continuously can
drain the battery of a standard Android phone in 4-5hrs.
You can read more Android Sensors here.

Categories

Resources