获取机器人指南针的舵旋转角度
有一个具有1-360度角度的电子指南针(或0-359,无论如何)
https:// i.sstatic.net/q7rmh.jpg
有变量
- yaw - 指南针读数学位
- hdg - 建立的方向方向舵度
- rudder -转向方向盘的学位(需要获得)
变量检查
hdg:20 偏航:340 =需要获得舵= 40
HDG:50 偏航:90 =需要获得方向舵= -40
获得旋转角度的公式是什么?
问题是找到正确的方向上最短的转弯。.
这似乎很简单,但我的想法使我想到了
。
if (Yaw<=180) {
rudder=set HDG-Yaw;
} else {
rudder=360-Yaw+setHDG;
}
但是,如果sethdg为350并且yaw = 20 ...给出330,这是一个错误,应该是30
there is an electronic compass with angles of 1-360 degrees (or 0-359, whatever)
https://i.sstatic.net/Q7RmH.jpg
there are variables
- Yaw - compass readings degrees
- HDG - established direction rudder degrees
- rudder - the degrees to turn the steering wheel (need to get)
variables to check
HDG:20
Yaw:340
=need to get rudder=40
HDG:50
Yaw:90
=need to get rudder=-40
What is the formula to get the angle by which to rotate?
the problem is to find the shortest turn in the right direction..
it seems simple, but it broke my mind
something like
if (Yaw<=180) {
rudder=set HDG-Yaw;
} else {
rudder=360-Yaw+setHDG;
}
but here is an error if setHDG is 350 and Yaw=20 ... gives 330 and it should be 30
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)