船舶航向计算

这段代码用于计算船舶从一点到另一点的航向角度,基于笛卡尔坐标系和所需航行的角度。它不考虑帆船的横风调整,仅提供两点间直线航向。
摘要由CSDN通过智能技术生成
参考网址http://rebelengineering.blogspot.com/
Here is some of our code- this section is a compound if function written last night that determines the course angle based on the cartesian plane and the angle in degrees that the boat needs to travel.

{
   if((myLat- wp1Lat) < 0) //Top hemispehere
       {
       if((myLong - wp1Long) < 0) //Left Hemishpere
       {float course = 180 - angle;}
      
       else  //Right hemishpere
       {course = angle;}
       }
   else // Lower hemisphere
      {
      if((myLong - wp1Long) > 0) //Left Hemishpere
      {course = 180 + angle;}
     
      else  //Right hemishpere
      {course = 180 - angle;}
     
      Serial.print("        course:       ");
      Serial.print(course,4);
      }
}

This is the final code that calculates the course of the boat. This does NOT include tacking, only the actual angle course from point
  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
船舶航向是指船舶相对于正北方向所指的角度。它可以用来描述船舶在航行中所采取的航向方向。航向角可以使用Matlab来计算,其中需要考虑船舶的位置坐标(x, y)和航向角度(fai)。 在Matlab中,可以使用atan2函数来计算航向角。atan2函数可以返回从正北方向到船舶的方向角度,范围为-π到π。具体计算方法如下: 1. 首先,根据船舶的位置坐标(x, y),可以使用atan2函数计算船舶相对于正北方向的初始角度: theta = atan2(y, x) 2. 然后,将初始角度(theta)与航向角度(fai)相加,即可得到船舶航向角: heading = theta + fai 航向角的范围通常为0到360度,可以通过对结果取模运算来将角度转换为这个范围内。 关于船舶遇到障碍物的处理,根据引用所提到的左舷交叉相遇情况,如果船舶位于本船的左舷侧且相对本船的方位在247.5°到355°之间,那么他船有让路责任,本船可以保持直行。这种情况下,船舶需要避免与障碍物相撞。在Matlab中,可以使用条件语句来实现这一逻辑判断,根据船舶的位置和航向角来判断是否需要采取避障措施。 总结起来,使用Matlab可以计算船舶航向角,并且根据航向角和船舶的位置信息来处理船舶遇到障碍物的情况。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *3* [船舶运动仿真中航迹与船形图的应用(上)](https://blog.csdn.net/weixin_31176789/article/details/115930339)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] - *2* [船舶自动避碰系统(静态避碰和动态避碰-人工势场)——Matlab实现](https://blog.csdn.net/weixin_41406486/article/details/124335952)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值