Core Motion - 将局部欧拉角转换为另一个参考系
我在将局部欧拉角转换为另一个参考系的角度时遇到了数学问题。假设我们有一部 iPhone 与车辆的轴线对齐,并且我想测量滚动角,那么 iPhone 的滚动角等于设备的滚动角。但如果 iPhone 倾斜安装怎么办?在这种情况下,我必须将局部欧拉角转换为另一个参考系(例如汽车)。有人可以指出我正确的方向吗?
I got a problem with the maths involved in converting local Euler angles into the angles of another reference system. Lets say we have an iPhone aligned with the axis of an vehicle and I want to measure the roll angle, then the roll angle of the iPhone equals the roll angle of the device. But what if the iPhone is mounted tilt. In this case I would have to convert the local Euler angles to another reference frame (e.g. the cars). Could someone please point me in the right direction?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我假设您想知道汽车的滚动情况,而不是电话。手机需要知道初始参考系。因此,假设您一开始就将手机与汽车对齐。然后按手机上的按钮。按下按钮后,您的代码中会存储从 CMDeviceMotion 获得的态度。
如果您想了解此后任何时刻汽车的滚动情况,请采用 CMDeviceMotion 的当前态度。然后对其调用
multiplyByInverseOfAttitude:
,并提供初始参考系作为参数。这将为您提供初始参考系和当前参考系之间的差异。如果从中获取滚动属性,它应该是汽车的滚动角。
I assume you want to know the roll of the car, rather than the phone. The phone needs to known the initial reference frame. So, suppose you line up the phone with the car at the start. Then press a button on the phone. At that button press, in your code store the attitude that you get from CMDeviceMotion.
If you want to know the roll of the car at any point after that, take the current attitude from CMDeviceMotion. Then call
multiplyByInverseOfAttitude:
on it, supplying the initial reference frame as parameter. That will give you the difference between the initial reference frame and the current one.If you take the roll property from that, it should be the roll angle of the car.