Rotation Sensor based on BMI160 and BMM150.
More...
In geometry, the Rotation of an object (such as a line, plane or rigid body) is part of the description of how it is placed in the space it is in.
Rotation sensor is applied to detect direction status of the device in two or three dimensions.
Certain methods to describe Rotations of a rigid body in three dimensions have been developed.
They are as follows :
EULER ANGLES :
To describe an Rotation in 3dimensional Euclidean space, three parameters are required.
They can be given in several ways, Euler angles being one of them, which describes the Rotation of a frame of reference (typically, a coordinate system or basis) relative to another.
They are represented by heading (rotation around the Zaxis), pitch (rotation around the Xaxis) and roll (rotation around the Yaxis).
Euler Angles can be represented in degrees or in radians.
QUATERNION :
Unit quaternion provides a convenient mathematical notation for representing Rotations and rotations of objects in three dimensions.
A quaternion represents two things. It has an x, y and z component, which represents the axis about which a rotation will occur.
It also has a w component, which represents the amount of rotation which will occur about this axis.
Quaternion is represented by vector q(q[0],q[1],q[2],q[3]) where in, q[0] = cos(θ/2) , q[1] = u * sin(θ/2) , q[2] = v * sin(θ/2) , q[3] = w * sin(θ/2) ( [u,v,w] is the unit vector parallel to rotation axis )
Rotation Calibration method :
Rotation calibration should be done by leaving the device in flat position a few seconds (for gyroscope calibration) and then making the '8' figure motion (for magnetometer calibration) as in https://www.youtube.com/watch?v=sP3d00Hr14o.
'8' figure motion may be done more than once (maybe 5 times) for a proper calibration.
Limitations of Rotation :
This sensor cannot be used while using virtual sensor fingerPrint.
struct Rotation_EulerData_S 
Data structure for Rotation sensor euler data
heading data  rotation around z axis
pitch data  rotation around x axis
roll data  rotation around y axis
struct Rotation_QuaternionData_S 
Data structure for Rotation sensor quaternion data
Data type used for reading Rotation data
Defines the handle for Rotation sensor
Enum values to represent Rotation sensor initialisation status
Enumerator 

ROTATION_SENSOR_UNINITIALISED 
Specifies rotation sensor is uninitialised

ROTATION_SENSOR_INITIALISED 
Specifies rotation sensor is initialised

 Return values

 Warning
 This API needs to be called when we require to stop the rotation data reading.
 Note
 The return value consist of (First 1 MSByte represents Package ID, Next Byte represents Severity and Last 2 LSBytes represents error code).

Pass the return value of this function to #BCDS_getUserErrorCode() API to know the user type return code present in #BCDS_SensorErrorType.h.
 Parameters

[in]  Orientation_HandlePtr_T  the handle to the rotation object that should be initialized 
 Return values

 Note
 Refer #XdkSensorHandle.h for selecting the proper handle.

The return value consist of (First 1 MSByte represents Package ID, Next Byte represents Severity and Last 2 LSBytes represents error code).

Pass the return value of this function to #BCDS_getUserErrorCode() API to know the user type return code present in #BCDS_SensorErrorType.h.
 Parameters

[out]  Rotation_QuaternionDataPtr_T  quaternionValue, output parameter in which the quaternion value will be written to, from within the function 
 Return values

 Note
 The return value consist of (First 1 MSByte represents Package ID, Next Byte represents Severity and Last 2 LSBytes represents error code).

Pass the return value of this function to #BCDS_getUserErrorCode() API to know the user type return code present in #BCDS_SensorErrorType.h.