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