Data Fields | |
| union { | |
| struct { | |
| float x | |
| float y | |
| float z | |
| } | |
| struct { | |
| float azimuth | |
| float pitch | |
| float roll | |
| } | |
| float v [3] | |
| }; | |
| uint8_t | reserved [3] |
| int8_t | status |
This API is relative to the screen of the device in its default orientation, that is, if the device can be used in portrait or landscape, this API is only relative to the NATURAL orientation of the screen. In other words, the axis are not swapped when the device's screen orientation changes. Higher level services /may/ perform this transformation.
x<0 x>0 ^ | +-----------+--> y>0 | | | | | | | | / z<0 | | / | | / O-----------+/ |[] [ ] []/ +----------/+ y<0 / / |/ z>0 (toward the sky)
O: Origin (x=0,y=0,z=0)
Orientation -----------
All values are angles in degrees.
azimuth: angle between the magnetic north direction and the Y axis, around the Z axis (0<=azimuth<360). 0=North, 90=East, 180=South, 270=West
pitch: Rotation around X axis (-180<=pitch<=180), with positive values when the z-axis moves toward the y-axis.
roll: Rotation around Y axis (-90<=roll<=90), with positive values when the x-axis moves AWAY from the z-axis.
Note: This definition is different from yaw, pitch and roll used in aviation where the X axis is along the long side of the plane (tail to nose).
Acceleration ------------
All values are in SI units (m/s^2) and measure the acceleration of the device minus the force of gravity.
x: Acceleration minus Gx on the x-axis y: Acceleration minus Gy on the y-axis z: Acceleration minus Gz on the z-axis
Examples: When the device lies flat on a table and is pushed on its left side toward the right, the x acceleration value is positive.
When the device lies flat on a table, the acceleration value is +9.81, which correspond to the acceleration of the device (0 m/s^2) minus the force of gravity (-9.81 m/s^2).
When the device lies flat on a table and is pushed toward the sky, the acceleration value is greater than +9.81, which correspond to the acceleration of the device (+A m/s^2) minus the force of gravity (-9.81 m/s^2).
Magnetic Field --------------
All values are in micro-Tesla (uT) and measure the ambient magnetic field in the X, Y and Z axis.
Definition at line 178 of file sensors.h.
| union { ... } |
| float sensors_vec_t::azimuth |
| float sensors_vec_t::pitch |
| uint8_t sensors_vec_t::reserved[3] |
| float sensors_vec_t::roll |
| int8_t sensors_vec_t::status |
| float sensors_vec_t::v[3] |
| float sensors_vec_t::x |
| float sensors_vec_t::y |
| float sensors_vec_t::z |