Autonomous sail boat part three. Simulation

3689555690?profile=original

This is the third update about my attempts to build an autonomous sailboat with the goal to have it sail by itself next spring.

My first plan for simulation and hardware in the loop simulation was to use the Sail simulator game.You can read more about that in my last blog post. This solution works but the setup with two computers and a number of small programs working together was not a solution to use when you do most of your test on the subway to and from work (Yes with small children you need to use all free time). 

The solution was to write a simple sailboat simulator myself. I am using processing for the task. One reason is it's portability between operation systems and another is the similarities to Arduino. 

The simulator also act as a network server sending NMEA data and receiving boat control commands from my autopilot application also written in processing. When my algorithms are robust enough i will implement them in the APM and use the simulator for HIL simulations. the screen shot shows the boat beating to reach the waypoint. distance between waypoints is about 70 meters.

The simulator

The simulator implements a really simple model for simulating a sailboat. The target speed for the boat is generated from a simple polar chart. the boat will accelerate to the giver target speed and if the wind disagrees or the boat points into the wind it will slow down until it stops. The simulator uses google maps for backdrop.

The wind is always blowing at the same speed but varies a little in direction over time. 

It is really simple but it works for my purposes. 

The autopilot

The boat is controlled by an autopilot program that actually manages to sail the boat between waypoints even if it requires beating against the wind. there is much work to be done in optimizing the navigation and sometimes it shows almost scary behaviors  i really can't explain. Not AI, but more likely bugs in the navigation algorithms...

The autopilot receives SOG, COG, position, boat heading, apparent wind speed (AWS) and apparent wind angle (AWA) from the simulator. this is the same sensor data i get from my RC-boat. 

This is still early stages but it is quite amazing to see the boat tack to get to the next mark... 

/Magnus

E-mail me when people leave their comments –

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

Join diydrones

Comments

  • I know it's been a while since your blog post, but has there been any progress?

    I have created my own drone boat and will sail it at the World Robotic Sailing Champs in a couple of weeks.  The source for the simulator is available here: https://github.com/psiphi75/SailBoatSim

    You can find more details and follow the progress here: http://blog.anemoi.nz

    psiphi75/SailBoatSim
    Sailboat Simulator. Contribute to psiphi75/SailBoatSim development by creating an account on GitHub.
  • This is awesome. What is your objective in terms of making hte boat run? Does it need to complete a course or just sail without crashing? If you need an info on RC Boats you might find this site beneficial

    http://blog.remotorboater.com/
  • Found some example code for truewind calculation on the same site too:

    http://coaps.fsu.edu/woce/truewind/true-C.html

  • @Magnus, @Matthew

    Just a few thoughts from my navigation Lessons and sailing experience.

    True Wind estimation may be not of great influence in shallow conditions.

    But considering the fact that the apparent Wind changes are strong in gusty conditions, when also the boat starts to react with speed and direction changes, it might be of great significance to have a good algorithm, else you wouldn't be able to sail a course beat to the wind. 
    Wind astern isn't such a big matter under heavy conditions too, because the vectors just add to each other.

    Found this paper, which might be of some interest when developing an algorithm:
    http://coaps.fsu.edu/WOCE/truewind/paper/#tab1

  • The aircraft windspeed estimate algorithms use the delta groundspeed with a change in direction.  Your boat sideslips which a fixed wing doesn't.  Could be tricky.  Interesting stuff :-)

  • Mathtew. I think it is possible if i use a theoretical speed of the boat. A boat my size will never go very fast and reach maximum speed at a relatively low wind speed. For my simulator i am using a simple polar chart to predict the boat speed and it's probably possible to create one for the real boat and use that to "guess" the speed based on wind speed, end wind angle. It might even be possible to use heel to estimate wind speed and thereby current. Actually i will estimate the sum of drift and current.

  • Magnus,  Can you estimate water currents or do you need a water speed sensor to do that?

  • @Miguel 

    On my real boat i am currently measuring wind angle but in my simulator i "measure" wind speed and use it to calculate wind direction. I will see what i can find out this winter before i decide to put a wind speed meter on the boat.

  • Nice work Magnus.

    You measure wind intensity or only direction to compute the sail position and or ruder position?

  • That look cool, but at the same time to advanced for my math skills. I really need some more "randomness" to make the simulation more realistic. Next step is to add current and drift to the model. 

This reply was deleted.