获取机器人指南针的舵旋转角度

发布于 2025-01-29 04:42:10 字数 755 浏览 3 评论 0原文

有一个具有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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

花间憩 2025-02-05 04:42:10
if (setHDG>=Yaw) 
      rudder=360-(360-setHDG+Yaw);
else 
      rudder=setHDG-Yaw;
    
if (setHDG>=Yaw) 
      rudder=360-(360-setHDG+Yaw);
else 
      rudder=setHDG-Yaw;
    
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文