I'm trying to make motion controller using the values from android sensors. Currently sending/receiving data to/from PC is almost done, and also already gone a trial to rotate cube using orientation sensor values, and it seemed usable.
The problem is, as orientation sensor uses magnetic sensor to calculate orientation, the actual values islikely to different from the desired values. For instance, one will expect the cube stays unrotated when he or she directs the controller straight to the PC monitor. Actually, cube will be rotated for such as (27, 59, 107), unless the PC is strictly placed on the north poll.
I've already searched for some references, but only I could found was remapping开发者_Python百科 the reference by predefined constants, such as ROTATE_X_90.
Is there any way to remap reference coordinate by custom values?
Before statrting your motion sensing mode, enter a callibration mode.
Have the user, hold the device in the "default" according your requirement.
Have the user press a "callibrate" button.
Monitor the orientation-sensor values at this instant.
(Save them as reference).Now enter normal operation mode. While running you motion-sensor app,
always subtarct the x,y,z values obtained in "default" position
from the data obtained using the orientation-sensor.
This way you can have any amount of custom-offsets as reqd.
Good LUCK!!
Regards
CVS@2600Hertz
Create your desired calibration values, then add/subtract this value to/from the read values from the sensor.
精彩评论