Method: PhidgetsNative::Spatial#compass

Defined in:

#compassArray

This method returns an array of Float(s) which represent the relative magnetic attraction of each axis. These values are merely those which were most recently reported via the CPhidgetSpatial_set_OnSpatialData_Handler event handler.

NOTE: Sometimes the phidget library won't have values to report on this measurement due to "EPHIDGET_UNKNOWNVAL" errors. When we come up against this case, we return the last values that were reported successfully.

NOTE: You probably want this value in degrees. This is difficult, primarily due to the pre-requisite of knowing what the cross-product is of the ground plane (aka, the ground's surface normal). I might add a 'bad estimate' of this vector in a future version of the library. E-mail the author if you need some sample code based on the accelerometer's inverse vector.

Returns:

  • (Array)