水平仪方向传感器加速度计
我正在开发水平仪。 目前我使用加速度计的 x 和 y 值。 我不使用 z 值。 一般来说,它可以工作,但不是很顺利。
使用方向传感器或两者都使用会是更好的解决方案吗?
I am developing a spirit level.
Currently I use the x and y values of the accelerometer.
I do not use the z value.
In general it works, but it isnt very smooth.
Would it be a better solution to use the orientation sensor or maybe both?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我使用的解决方案是一个比例因子,这就是 midoalageb 建议的。我使用 0.5 的比例因子,因此传感器值基本上减半。这使得抖动不那么明显。这也会使气泡速度减慢一点,这样当倾斜设备时,气泡看起来就不会从一端跳到另一端。
The solution that I used was a scaling factor which is what midoalageb suggested. I use a scale factor of 0.5 so essentially the sensor value is cut in half. This makes the jitters less noticeable. This also slows the bubble down a bit so that it doesn't seem like it is jumping from one end to the other when tilting the device.