Add method for uncalibrated values
@@ -5,6 +5,11 @@ Gyroscope
The gyroscope measures the rate of rotation in rad/s around a device's x, y,
and z axis.
+Rotation is positive in the counter-clockwise direction (right-hand rule).
+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.
+
The :class:`Gyroscope` provides access to public methods to
use gyroscope of your device.
@@ -20,11 +25,19 @@ To disable gyroscope::
>>> gyroscope.disable()
-To get the orientation::
+To get the rate of rotation along the three axes::
- >>> gyroscope.orientation
+ >>> gyroscope.rotation
(-0.0034587313421070576, -0.0073830625042319298, 0.0046892408281564713)
+To get the uncalibrated rate of rotation along the three axes along with the
+drift compensation::
+
+ >>> gyroscope.rotation_uncalib
+ ()
+ where the first three values show the rate of rotation w/o drift
+ compensation and the last three show the estimated drift along the three
+ axes.
'''
@@ -32,17 +45,44 @@ class Gyroscope(object):
'''
Gyroscope facade.
- .. versionadded:: 1.2.0
+ .. versionadded:: 1.3.1
+ '''
+
+ @property
+ def rotation(self):
+ '''
+ Property that returns the rate of rotation around the device's local
+ X, Y and Z axis.
+
+ Along x-axis: angular speed around the X axis in rad/s
+ Along y-axis: angular speed around the Y axis in rad/s
+ Along z-axis: angular speed around the Z axis in rad/s
+
+ Returns (None, None, None) if no data is currently available.
'''
+ return self.get_rotation()
@property
- def orientation(self):
+ def rotation_uncalib(self):
'''
- Property that returns values of the current Gyroscope sensors, as
- a (x, y, z) tuple. Returns (None, None, None) if no data is currently
+ Property that returns the current rate of rotation around the X, Y and
+ Z axis. An estimation of the drift on each axis is reported as well.
+
+ Along x-axis: angular speed (w/o drift compensation) around the X axis
+ in rad/s
+ Along y-axis: angular speed (w/o drift compensation) around the Y axis
+ in rad/s
+ Along z-axis: angular speed (w/o drift compensation) around the Z axis
+ in rad/s
+
+ Along x-axis: estimated drift around X axis in rad/s
+ Along y-axis: estimated drift around Y axis in rad/s
+ Along z-axis: estimated drift around Z axis in rad/s
+
+ Returns (None, None, None, None, None, None) if no data is currently
available.
'''
- return self.get_orientation()
+ return self.get_rotation_uncalib()
def enable(self):
'''
@@ -56,8 +96,11 @@ class Gyroscope(object):
'''
self._disable()
- def get_orientation(self):
- return self._get_orientation()
+ def get_rotation(self):
+ return self._get_rotation()
+
+ def get_rotation_uncalib(self):
+ return self._get_rotation_uncalib()
# private
@@ -67,5 +110,8 @@ class Gyroscope(object):
def _disable(self):
raise NotImplementedError()
- def _get_orientation(self):
+ def _get_rotation(self):
+ raise NotImplementedError()
+
+ def _get_rotation_uncalib(self):
raise NotImplementedError()
