使用自定义值重新映射传感器的参考坐标
我正在尝试使用 Android 传感器的值制作运动控制器。目前与PC发送/接收数据已经基本完成,并且已经尝试使用方向传感器值旋转立方体,并且似乎可用。
问题是,由于方向传感器使用磁传感器来计算方向,因此实际值可能与期望值不同。例如,当他或她将控制器直接指向 PC 显示器时,他或她会期望立方体保持不旋转。实际上,立方体将旋转为例如(27,59,107),除非PC严格放置在北轮询上。
我已经搜索了一些引用,但只有我能找到通过预定义常量重新映射引用,例如 ROTATE_X_90。
有没有办法通过自定义值重新映射参考坐标?
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 the reference by predefined constants, such as ROTATE_X_90.
Is there any way to remap reference coordinate by custom values?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
启动体感模式前,请进入校准模式。
让用户根据您的要求将设备保持在“默认”状态。
让用户按“校准”按钮。
监控此时的方向传感器值。
(将它们保存为参考)。
现在进入正常操作模式。运行运动传感器应用程序时,
始终减去在“默认”位置获得的 x、y、z 值
根据使用方向传感器获得的数据。
这样您就可以根据需要获得任意数量的自定义偏移量。
祝你好运!!
问候
CVS@2600赫兹
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.