In all of our previous tests, the navigation code has been dead simple: calculate the heading from the SolarSurfer to the next waypoint and point in that direction. This works great and should be sufficient to get us across the ocean but we wanted to upgrade to something a little better.
We've modified the code to all the SolarSurfer to track the vector between the last waypoint and the next waypoint so that it stays on single line. If it drifts due to current, it will tend to go back to the line. This should result in better tracking and most importantly, a much prettier live map.
We haven't tested it in the water yet, but here's some simulations so that you can see the difference.
First, here's the original behavior. The blue circle represents the last waypoint and the blue X represents the destination. The vector field shows the desired heading of the SolarSurfer based on where it is. As you can see, it always points straight for the destination, no matter where it is.
Next, here's the new vector tracking behavior. It's still really simple: it just calculates the difference between the heading from the last waypoint and the heading from the current location and tries to make that zero. It's meant to be a fairly gentle correction. There's not need for tight tracking here.
There's a few consequences of doing this purely with angles instead of distances. First, the tracking will be loose far away from the waypoint and tight when near to the waypoint. This seems like a reasonable consequence.
We're going to test this in the next week or so.