This video demonstrates the development of an autonomous sailboat's heel control system using Ardupilot software, where PID controllers manage sail adjustment based on rudder angle to enable successful tacking and bearing away maneuvers in various wind conditions, with the creator implementing custom code modifications to improve the boat's ability to flatten aggressively when trying to bear away.
Autonomous Sailboat Heel Control: N4N1 Field Tests
Added:well hello there so it's been a while since I published a video on Nani my autonomous sailboat so I thought I'd give you an update on the work I did uh in the last few months of 2024 I took n out to a variety of different locations made some voyages I also made some significant code updates and overall she's working quite well so let's see what we did if you remember the last video at the end of 2021 I sent Nani out to circumnavigate the saale Drone surveyor uh and this worked pretty well uh Nani made it around sail drone a couple of times and navigated fully autonomously almost the whole way there was a slight issue that I address in that video about uh being able to bear away to turn down wind uh when the wind got enough that the boat was tipping over pretty far uh the boat couldn't always bear away uh to follow the autonomous course and I would take over manually and then switch back to autonomous mode so the next steps uh in the evolution of the control is to implement the heel control this is already in the Arup pilot sailboat software and it has a PID control Loop that will control the heel and ease the sails if the boat's tipping too much this is something most monoh boats have to deal with so uh it makes sense that we would have to do it too the first place I took Nani was to a small Lake in Stockton it's a nice protected residential Lake but the day we went it was super windy uh the gusts were over 30 um so I used the small rig which I'd never used before but unfortunately the SD card was corrupted and I couldn't uh arm the boat to do autonomous sailing so I didn't know what was wrong I just knew that I couldn't arm the boat so I sailed around just to see how it would do in the wind and it did pretty well it was definitely overpowered but I managed to sail around and come back so I went home and formatted the SD card and bench tested to make sure everything was working then I implemented the heel pi ID controller and took it out for a test these tests were at Sherman Island which is on the Sacramento River just as it joins the rest of the bay so the very end of the Sacramento River delta you can see the boat sailing up wind pretty well and you might notice there's a significant current running from right to left on the screen it was an e tide uh you can also see a duck running from right to left on your screen so the boat does make aack at the Waypoint and as it tries to turn down wind uh it still can't quite bear away it's stuck going this direction which is a little stressful because it's heading away from me and you can see that it is easing the sail to try to keep it flat but it's not flat enough to make that turn so it either needs a lucky wave or a lull in the breeze to make that turn or I can do it manually by letting the sail out myself so in order to get it to flatten the boat more aggressively I turned up the heal control gains and here you can see it does a nice Tack and you can see how aggressively it's trying to keep that boat flat it's trying to hold 20° of heel so this is a lot of action and I worry a little about how long the servo is going to last uh working the sail that hard but it did improve the bearway it was able to turn down wind and it successfully held that 20° of heel so with these results I went onto the uh arju pilot sailboat forum and asked on the Forum how possible it would be to change the heel control algorithm I wanted it to aggressively flatten the boat if it's trying to bear away so it needed to know which way the rudder is turning um and the responses were positive so I took a crack at changing the code myself so I I hacked it up and added an algorithm uh it uses the rudder which is in a percentage so between -1 and one and basically if the rudder is more than 50% of its throw and trying to turn downwind because turning upwind the heel actually helps you turn up wind um so if it's trying to bear away with more than 50% of the rudder then it will set the heel set point that the p is trying to control the boat to to a lower number it doesn't change the P ID gains it just changes the set point between the original set point at 50% Rudder and then decreases linearly to an amount that's reduced by this kba at 100% rud so in the beginning of December I put those changes to the code into the autopilot and took non on a trip to San Diego so I set up an autonomous course on the Mission Bay model yacht Pond which was a really cool place to sail and the boat sailed autonomously hands off for a long time about an hour and a half I did actually consider making a mission circumnavigating vacation aisle the island that this yacht Pond is on um and sailing out in the main Mission Bay but I ran out of time on that trip so maybe one day so here is some video of the boat on the Mission Bay model yacht Pond it was windy not super windy and it's not very wavy so it wasn't s wasn't super challenging conditions um but it was windy enough to test the heel control and you can see it dumping the sail as it heals when it's going up wind and you can see that it dumps the sail even more as it bears away there was a friendly local sailing his boat out there too it was a lot faster than na uh but fun to sail with other people here's another video with a nice view of tacking and then it sails along and we get the bear away again you can see it dumping the sail as it needs to in the Puffs and during the bearway it eases the sale even more seems to work pretty well so around the end of December I refined my code and added parameters the bearway gain kba is for the heel control um and there are two parameters Tac time and Tac a are uh for the tacking algorithm um basically I need to Tac it tacks following a compass heading so it'll 90° compass change to Tac and I have it hold that for quite a bit longer before it switches back to following the vein because my vein has a transient that I need to have die away uh you can see an old video called non sales the bay part one where I had a lot of issues with the boat completing taxs and I think it's because my wind vein is on the back and the apparent wind as the boat spins uh throws off the tacking here is the new code I wrote It's a function to calculate the target heal for the heel P ID controller and you can see down towards the bottom it's using the um the rudder angle to figure out what the target heel angle should be and I took it to Berkeley at the end of December uh the Berkeley Marina has a nice small boat dock and I sent it out into the bay uh it had no trouble bearing away so the problem seems to be much better and it was pretty windy this day uh it still pumps the sail quite a bit as you can see in these videos but um it I was able to lower the heel P gains a little bit from the Sherman Island tests because now it's more aggressive when it needs to be so I could make it be less aggressive overall although it's still I would say pretty aggressive and I do worry about that sale Servo so it was pretty windy pretty wavy good test conditions um you can see as the boat bears away it is turning successfully um sometimes the clue of the sail the back corner of the sail drags in the water though here's a boat eye view of the same testing in Berkeley and you can see it sails up wind very nicely um TS fine and bears away just fine too I think the boom might be a little bit too long maybe I will shorten it later we'll see here's another video from that test day in Berkeley you can see the Alam cranes in the background and there's a piling at the it's off the end of the dock I had trouble with that piling in the video and you'll see uh when we were sailing as well this video also shows the ground station in a split screen on the left you can see the things like the wind angle and the heel and on the right there's a map view so I'll let you enjoy the sounds of the wind and the squeaky dock for a couple of minutes our single time simp critical this here's the boat po of that same sailing around the bay in Berkeley it sails up wind it's gotten a little bit windier I think as the day went on uh and is able to turn down wind and get a little bit of a surf on the tiny swells that we were seeing right at the end of this video it heads very close to that piling I think I took it over manually just to make sure it wouldn't hit anything uh I had the way points in the wrong place I couldn't see the piling on the map I was using so I kept aiming the boat at that piling um so overall boat's working well and sailing as I hope it would even in decent Breeze um at the end of that that Berkeley test uh I got a warning on the transmitter Telemetry that there was some battery issue that I didn't understand uh so I so I stopped the test and brought the boat home was trying to figure out the battery issue and accidentally corrupted the transmitter's SD card trying to find log files so I couldn't so then I had to reformat the whole transmitter reinstall Edge TX on the transmitter um so I'd like to test the boat some more um cuz I don't know what that error was and I can't reproduce it I think it was uh nothing serious but I'm not sure so I'd like to test the boat some more um eventually I'd like to do a GitHub poll request to get my changes to the main branch as far as I know I don't see any bugs but I would like to test it especially since I had the weird battery thing but if you want to try my Fork of the code with these changes uh it's available on GitHub and I would love to hear what you think so the next thing will be some interesting missions hopefully out on San Francisco Bay or somewhere in the neighborhood uh so let me know if you have any good ideas of where I should send Nani next time
Up Next

Arduino Sailboat Autopilot V2: GPS & Remote Control Guide
@jackedwardsprojects1188
6.2K views•2017-04-25

MathWorks Virtual RoboSub Simulation Environment | Webinar 2026
@RoboNationInc
209 views•2026-03-10

How to Build a Self-Balancing Robot: Arduino Nano & MPU6050
@easytechzones
16.8K views•2022-03-09

Micromouse: The Fastest Maze-Solving Robots on Earth
@veritasium
23.5M views•2023-05-24
Related Study Plans & Knowledge Roadmaps
Structured learning paths in Robotics


































