Find out what goes on under the hood in the brain of an autonomous sailboat.
Introduction
People can learn how to sail after only a few lessons. But as an engineering challenge, sailing is not so simple. The aerodynamics and hydrodynamics of the entire system are highly non-linear and difficult to model. There are so many factors to take into account at any single moment: wind direction, ocean wave conditions, boat speed, sail position, rudder angle, avoiding collisions with other boats…
This begs the question: What would it take to build a sailboat that could sail by itself?
In this article, you will learn what goes on under the hood in the brain of an autonomous sailboat.
What would it take to build a sailboat that could sail by itself?
Context and Background
My name is Tyler and I am a Control Software Lead for UBC Sailbot. UBC Sailbot is a student engineering design team that builds fully-autonomous sailboats.
In 2016, our team launched Ada, a fully-autonomous sailboat with the goal of being the first fully-autonomous sailboat to cross the Atlantic Ocean. While she still broke many records, she was not able to complete the full journey. You can read more about Ada’s journey here.
UBC Sailbot decided to go back to the drawing board and continue the endeavor of building ocean-going autonomous vessels. With the wealth of experience gained in the testing and validating of Ada, we began a new project named Raye, which will be the first fully autonomous vessel to ever participate in the Vic-Maui Yacht Race.
With the wealth of experience gained in the testing and validating of Ada, we began a new project named Raye, which will be the first fully autonomous vessel to ever participate in the Vic-Maui Yacht Race.
Problem
Once Raye is built, she must chart her course from Victoria to Maui! How should she approach this problem?
As with any engineering problem, we first look at the simplest solution. Can we just draw a straight line? Unfortunately, it is not that simple.
Challenge 1: Raye needs to avoid colliding with the hundreds of other boats in the same waters.
Challenge 2: Raye needs to take into account the changing wind conditions when charting her course.
Challenge 3: Raye needs to minimize the total length of the path she generates so that she can reach her destination in a timely manner.
Solution
Our solution is to create two connected pathfinding modules: Global Pathfinding and Local Pathfinding.
Global Pathfinding
Global pathfinding works on a large distance scale to chart the overall course from the boat’s current position to Maui. It ensures that the path that has sufficient wind conditions throughout the journey, while also minimizing the total path length. It will run on an onshore server and will send the global path output to the boat through satellite
Local Pathfinding
Local pathfinding works on a smaller distance scale to find the best path from the boat’s current position to the next global waypoint. It ensures that the path avoids obstacles and avoids upwind/downwind sailing, while also minimizing the total path length. It will run on the boat, using the boat sensors and global path as input.
Note before continuing: True pathfinding in a continuous space is very hard! The general problem is a PSPACE problem, which means that the problem scales very poorly with more dimensions and complexity.
However, things need to get done! To solve this problem, we turn to approximate pathfinding solutions that help us achieve the pathfinding quality that we need while remaining computationally tractable.
To solve this problem, we turn to approximate pathfinding solutions that help us achieve the pathfinding quality that we need while remaining computationally tractable.
Global Pathfinding
Algorithm
Global Pathfinding uses the A* search algorithm, which looks very similar to a breadth-first search in that it creates a graph by discretizing the world into grid cells and then performs a search through the graph. The key difference is that it has an admissible heuristic function that helps guide the search in the right direction. A heuristic function is admissible when it is optimistic, in that it will never overestimate the cost to reach the goal from a given position. If the heuristic function is chosen correctly, it will always find the optimal path. One thing to note is that A* does not scale well to more complex problems with more dimensions.
The A* search algorithm looks very similar to a breadth-first search in that it creates a graph by discretizing the world into grid cells and then performs a search through the graph. The key difference is that it has an admissible heuristic function that helps guide the search in the right direction.
Cost Function Objectives
Global pathfinding’s cost function is set up so that it minimizes path length and optimizes for wind between 10–25 knots. The exact cost functions can be found in the figure below.
Local Pathfinding
Algorithm
Local Pathfinding uses the RRT* search algorithm, which stands for rapidly-exploring random tree. It creates a tree structure rooted from the starting point, then branches outwards towards the goal by sampling random points from the state space and then connecting them to the existing tree. This algorithm asymptotically approaches the optimal solution, which means that it will approach the optimal solution if it is given enough time. RRT*’s simple but effective approach scales well to complex problems with more dimensions.
The RRT* algorithm creates a tree structure rooted from the starting point, then branches outwards towards the goal by sampling random points from the state space and then connecting them to the existing tree
Cost Function Objectives
Local pathfinding’s cost function is set up so that it minimizes path length while avoiding large turns, obstacles, and upwind/downwind sailing (sailing in a direction parallel to the wind).
Closing Thoughts
Raye is a huge engineering project and there is still a large amount of work to be done. On the pathfinding side, this includes integrating the simulation with real AIS data to perform virtual practice Vic-Maui Yacht Races, performing end-to-end testing of the global pathfinding, local pathfinding, and boat controller, and improving the AIS boat representation in local pathfinding to more accurately reflect their effect on available paths. We also need to develop more sophisticated testing for global pathfinding to ensure it will avoid storm situations.
I am excited to continue improving Raye’s pathfinding capabilities and reliability leading up to our launch in the summer of 2021 and sharing more content about how Raye works.
UBC Sailbot is an amazing team of hard-working, talented students that dream big and execute effectively. I am thankful to be a part of this team and to have the opportunity to contribute to this project.
To learn more about UBC Sailbot and Raye’s journey, check out the links below:
UBC Sailbot website: https://www.ubcsailbot.org/
Vic-Maui Yacht Race website: https://www.vicmaui.org/
Local pathfinding