参考网址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