Sailboat Autopilot Design for ArduPilotMega

We just finished up modeling sailboat dynamics and implemented a controller. The dynamics were interesting due to the swinging airfoil. We modeled the winch system using a basic spring model that can only pull the sail in. It works well and can simulate irons, tacking, and jibing. All of the drag coefficients etc. are very rough at this point but the overall dynamics seem realistic.


The sailboat we are using is a 1/3 scale laser sailboat and we hope to have it sailing with the autopilot soon. The autopilot will be implemented for ArduPilotMega using the ArduPilotOne library.


For the controller we are using a feedback system on the rudder to hold the commanded course. We are using a lookup table for the desired sail position given the apparent wind direction.


We have rigged up a wind indicator using a coil wound variable resistor that can easily plug into one of the existing 5 v adc slots on the apm. We removed the stopper so it can freely rotate.


E-mail me when people leave their comments –

You need to be a member of diydrones to add comments!

Join diydrones


  • Moderator

    Thanks James, should be a big help to help me learn from all your models :D

  • Developer

    The simulation software is ScicosLab. We wrote all the force moment equations in a ScicosLab C code block and have a block from the arkscicos toolbox for 6DOF dynamics. The controller is also modeled in ScicosLab. The visualization is done using an openscenegraph visualization block (also part of the arkscicos toolbox).

  • Developer

    All the models are open source. You can get them here:

    The sailboat autopilot above has now been added to the arkscicos toolbox demos in ScicosLab.

    The arkscicos toolbox currently works on linux/mac. But the openscenegraph graphics don't work on mac. Building on cygwin for windows should work if you have the time/skill. The build system is cmake.

  • Very interesting. I worked on a similar project about 5 years ago but never got it finished. I made my own wind vane and had an under water pitot tube for boat speed. I'd be interested to know what simulation software is used in the video?

  • Moderator

    Do you share any of the models that you make as I would be itnerested in learning how to do the modeling and simulation with scicoslab or simulink


  • Developer

    Theoretically that should work but I think when you consider you are moving considerably slower than a plane and that the boat won't be yawing significantly when on a tack then I suspect the estimation precision will be too degraded to be of much use. It is definitely worth a shot though since no external sensors are required. We could also have the boat yaw on purpose when using this method.

  • I was thinking about this:

  • Developer

    For a sailboat the wind direction is more important than the magnitude. The variable resistor wind-vane that I have pictured is probably the best sensor for this job. This isn't like an airplane where you can use the heading, pitot airspeed, and gps velocity to compute a wind estimate. There is too much going on (primarily the relative velocity is not from straight ahead) What other sensor combinations did you have in mind? 

    A reason you would want to know the wind magnitude is to regulate the roll angle so the boat doesn't tip too much in a gusts. Instead of measuring the wind magnitude though you could just feed back the roll angle to the sail position. So when you tip it would let the sail out.

  • Interesting.But what about wind?I mean isnt the wind the main variable here.There are already  methods to estimate wind direction and magnitude without an air sensor.With this info you can rotate your airfoil so it can face the wind.

This reply was deleted.