summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Powell <kpowell@invensense.com>2010-07-19 19:12:15 -0700
committerKevin Powell <kpowell@invensense.com>2010-08-05 09:51:37 -0700
commitb01a043df41e987321f6c01930ac306befb1d3dc (patch)
treeb841158fb7170242ffdd21fffb57b0c4940b1972
parentda137cc04c2b421b0e1d86d4b75fcd39a1dd6c9d (diff)
downloadlibhardware-tools_r7.tar.gz
add new sensor types for handling gyro data and device orientation more efficiently.android-sdk-tools_r7android-adt-0.9.9android-adt-0.9.8tools_r9tools_r8tools_r7froyo-plus-aosp
Change-Id: I453b7a2e84b885ca207d9d938b923e1624554644
-rw-r--r--include/hardware/sensors.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/include/hardware/sensors.h b/include/hardware/sensors.h
index 610651fc..61e411cc 100644
--- a/include/hardware/sensors.h
+++ b/include/hardware/sensors.h
@@ -59,6 +59,9 @@ __BEGIN_DECLS
#define SENSOR_TYPE_PRESSURE 6
#define SENSOR_TYPE_TEMPERATURE 7
#define SENSOR_TYPE_PROXIMITY 8
+#define SENSOR_TYPE_GRAVITY 9
+#define SENSOR_TYPE_LINEAR_ACCELERATION 10
+#define SENSOR_TYPE_ROTATION_VECTOR 11
/**
* Values returned by the accelerometer in various locations in the universe.
@@ -189,6 +192,17 @@ __BEGIN_DECLS
* All values are in micro-Tesla (uT) and measure the ambient magnetic
* field in the X, Y and Z axis.
*
+ * Gyroscope
+ * ---------
+ * All values are in radians/second and measure the rate of rotation
+ * around the X, Y and Z axis. The coordinate system is the same as is
+ * used for the acceleration sensor. Rotation is positive in the counter-clockwise
+ * direction. That is, an observer looking from some positive location on the x, y.
+ * or z axis at a device positioned on the origin would report positive rotation
+ * if the device appeared to be rotating counter clockwise. Note that this is the
+ * standard mathematical definition of positive rotation and does not agree with the
+ * definition of roll given earlier.
+ *
* Proximity
* ---------
*
@@ -202,7 +216,32 @@ __BEGIN_DECLS
*
* The light sensor value is returned in SI lux units.
*
+ * Gravity
+ * -------
+ * A gravity output indicates the direction of and magnitude of gravity in the devices's
+ * coordinates. On Earth, the magnitude is 9.8. Units are m/s^2. The coordinate system
+ * is the same as is used for the acceleration sensor.
+ *
+ * Linear Acceleration
+ * -------------------
+ * Indicates the linear acceleration of the device in device coordinates, not including gravity.
+ * This output is essentially Acceleration - Gravity. Units are m/s^2. The coordinate system is
+ * the same as is used for the acceleration sensor.
+ *
+ * Rotation Vector
+ * ---------------
+ * A rotation vector represents the orientation of the device as a combination
+ * of an angle and an axis, in which the device has rotated through an angle
+ * theta around an axis <x, y, z>. The three elements of the rotation vector
+ * are <x*sin(theta/2), y*sin(theta/2), z*sin(theta/2)>, such that the magnitude
+ * of the rotation vector is equal to sin(theta/2), and the direction of the
+ * rotation vector is equal to the direction of the axis of rotation. The three
+ * elements of the rotation vector are equal to the last three components of a
+ * unit quaternion <cos(theta/2), x*sin(theta/2), y*sin(theta/2), z*sin(theta/2)>.
+ * Elements of the rotation vector are unitless. The x, y, and z axis are defined
+ * in the same was as for the acceleration sensor.
*/
+
typedef struct {
union {
float v[3];