Archive for November, 2008
Taking A Beating
In accordance with a new task sharing initiave between myself and one of the engineering students who is working on the control systems of the boat, I am now going to tackle one of the simplest, and yet most infuriating problems that needs a solution before we can take on a pond, let alone the Atlantic. The issue is beating, and not your wife.
Beating is the action carried out in order to sail upwind. That’s my definition, and I’m sticking to it. It’s simple, very simple. Here’s the problem:

This is a graphic displaying the simplest type of beat to compute, where the desired heading is directly into the wind.
You’re at point A, and you want to sail to point B. Unfortunately, the vector BA is parralel to wind direction, and you can’t sail upwind! Luckily, you can sail right up to 45 degrees to the wind direction, so the solution is to set waypoints (which are marked in red in the above graphic) and beat or zig-zag, towards your destination.
I call this the Simple Beating Algorithm:
- Turn 45 degrees to port
- Sail 10 meters
- Turn 90 degrees in the opposite direction to the previous turn
- Sail 10 meters
- If arrived at desired location, break
- Goto line 3
This is quite simple to implement: the boat already has a compass and a wind direction meter, and it will soon have a paddle wheel to determine relative speed to the water. That’s enough information, with the aid of an accurate timer, to sail a five or ten meter leg 45 degrees either side of the desired heading, before tacking ninety degrees and continuing the beat. Simple, as I said.
Unfortunately, that ain’t all there is to it, folks.
The complex part comes when the desired heading isn’t directly upwind, but is still within the dead zone. That is to say, the desired heading is greater than 315 degrees and less than 45, assuming the dead zone is 45 degrees either side of the wind direction. In this scenario, a simple equal length leg zig-zag approach is not suitable, as for every second leg, the bow would be pointing into the dead zone.

In this graphic, it can be seen why it is ineffective to follow a simple beating algorithm when the desired heading is inside the dead zone but not parralel to the wind direction.
The above graphic is an example of a heading inside the dead zone, but not parralel to the wind direction. For clarity, the desired heading is just inside the 45 degree dead zone, although the principle holds for all headings not parralel to wind direction. (I do feel I’m using the phrase parralel to wind direction an awful lot, but it’s necessary for clarity.) In the above graphic, the simple beating algorithm is used, however, it can be seen that the legs where the boat should be in a starboard tack, it is in fact in irons, or stuck in the dead zone. This displays why the simple beating algorithm is insufficient. It’s a shame, too, because the simple beating algorithm is damn simple!
This leads me into what I’ll imaginatively call the Complex Beating Algorithm. It’s clear that the angle to the wind must be taken into account to avoid deliberately tacking into the dead zone.

In this graphic, the desired heading is inside the dead zone. Theta is the angle between the desired heading and the wind direction Theta is positive if the desired heading is starboard of wind direction.
The above graphic shows the angles of the port and starboard tacks when beating. By using these angles, which are always at the edge of the dead zone (handy, that!), we can be sure that the boat never gets stuck in irons while while beating. So, we have fixed angles, which are the same as the simple beating algorithm, so what’s different?
Variable length legs while beating, that’s what. Using some good old fashioned trigonometry, the correct lengths can be ascertained.

This graphic show the course dictated by the Complex Beating Algorithm.
If the angle Theta is positive, the port tack leg can be the lengthened. To keep the boat on it’s overall course, the algorithm then also shortens the starboard tack. The situation is simply reserved is Theta is negative. Pseudocode time:
if (Theta <= 0) {
port_tack = 10/Cos(Theta);
starboard_ tack = 10 * Cos (Theta);
}
else {
port_tack = 10 * Cos(-Theta);
starboard_tack = 10/Cos(Theta):
}
The above algorithm falls down when Theta is +/- 45 degrees, as there is a divide-by-zero error. However, when the boat is at +/- 45 degrees, the boat should be out of the dead zone, and so the complex beating algorithm would not be invoked.
I apologise if the above post is overly simple. I have tried to explain my logic clearly. - D.N.T. (01/11/08)
Engineering Seamen
Today, I had my first meeting with the engineers who are involved in the overreaching robotboat project. I was very impressed with their work to date, and especially with the model boat.
They have sensibly and authoritively divided the larger Roboboat project into roles, where each student has a clearly defined goal and they are focusing consistantly on integration and information sharing. I know from my own previous experience with autonomous vehicles that this is an emminently sensible approach.
Following the meeting, I was very kindly allowed the opportunity to observe the yacht sail under remote control and to even attempt (with some interference from UCD’s swans) to sail it myself. This experience has very much allowed me to properly appreciate the dynamics of the boat. The electronic engineers have done a very good job of installing the servos to control the main sheet and and rudder. In fact, that alone has solved some issues for me:
- The mainsheet is controlled by a servo motor. It has accurate stepping, and you can be sure of the length of the mainsheet once you’ve set it.
- The rudder is controlled, as expected, by a servo. It too can be set accurately, and the servo is more than strong enough to hold it in place.
The most important outcome of this meeting, and subsequent discussions with the very helpful engineers (No, I haven’t backtracked on my stance on engineers, but they may have their uses after all!) is that it became clear that there is a another student, Caoimhín O’Briain, who has been working on very similar elements to those that I was. We even had independently developed, but damn near identical, algorithms for the same problems. Great minds, and all that…
To avoid wasteful duplication of effort, we have agreed a dividing line and self-assigned tasks that suit our respective skill sets. In keeping with this, expect a post on a somewhat interesting problem quite soon. - D.N.T. (1/11/08)