Servers by jDrones

GSOC 2019: Sailboats conclusion

(Peter Hall) #1

Over the last three months I have been been working on improving rovers sailboat support. Although it has not been entirely plain sailing I have been working hand over fist on various improvements.


Before we set sail with a over view of what has been achompised on each of my goals. I will give some background on the above image, this was a sailboat auto mission with only a single waypoint. In order to constrain the boat within the bounds of the river a polygon Geo Fence was draw on the banks. As there is not direct path form the start to the finish Dijkstra’s path planning was used. This mission contained was more or less straight up wind and back so lots of tacking was required.

  1. Add support for commercial wind speed and direction sensors. This will support off the shelf sensors that are both more rugged and accurate than the currently supported ‘quick and dirty’ sensors implemented last year.

This task was accomplished at the start of the GSoC period. Support for NMEA wind sensors allows a wide verity of commercial sensors. This also envoled splitting up the windvane libbary to give a templeate driver, this will allow for much easey implentation of new sensors in the future.


This also required a bit of a wiki update that has now gone live.

  1. Motor sailing. The existing code has been developed with fully sail powered vehicles in mind. Giving the code knowledge that is has a motor and the ability to decide when to use it will allow better control, and give the ability for a boat to complete a mission or get back to base when the wind drops. This will also give the option to add a small ‘booster’ sail to existing power boats allowing more efficient operation.

This task has been completed, although it has not made it into maser yet. This gives sailboat the ability to use motors overcoming the short failings of a 100% sail powered vehicle. A new three position switch RC function as been added, this gives the user to select between never using the motor, always using the motor or allowing the code to pick. A sailboat with the motor disables is what sailboat have always been, no change there. A sailboat with with the switch in the always use the motor position no longer trys to tack and operates just as a normal rover would. Having these options available give a sailboat much greater flexibility. If the switch is left in the middle position the vehicle will fall back to using the motor if the wind speed drops bellow a set value or if its struggling to complete a tack. This has also brought with is several small improvements to the navigation code that when taken as a whole result in a much more capable vehicle.

This functionality will be coming to sailboats soon along with some documentation on the new features.

  1. Improve handling of failed tacks, currently the code can get stuck and confused if it fails to tack due to too much wind or too little. I will improve the way this is handled.

A couple of key improvements have been made to the tacking code in the motoring work. First of all the tacking time out was fixed, this was set to 50 seconds rather than 5 seconds due to a typo. Sailboats now use the pivot turn rate for tacking in all modes, this gives the user the ability to drop the the requested turn rate for smoother tacks. Some dead zone has been added to the code that works out what tack the vehicle is on, this allows the calculated tack to be trusted better. and finally a buffer angle has been added to the no-go-zone angle used to determine if the vehicle should be tacking or not. This results in less sudden swapping between heading and L1 controllers in wind shifts.

More work still needs to be done on improving high wind bearing away, but this is trickier to pin down it would require special behaviour that may not be a good idea at all times.

  1. Support for wing sails with ‘elevator’ controls. These offer a wide range of benefits over soft sails.

I have not done this yet, hopefully it should be a straight forward to add. Thanks to @karla for building one to test with!.

  1. Sea state classification, this will be a benefit to all boats, the code will calculate the wave height and frequency and try to estimate the speed of the tide/current. This will be reported to the operator. We could also set a fail-safe, or trigger different behavior based on the conditions

I have done some work on adding and tides to the built in SITL simulator. This lays the ground work for developing this code, but I have not done the implementation yet.

  1. Add functionality to lean, store and use a boat speed polar. This will allow sailboats to navigate from A to B in the quickest way in a range of conditions. Speed polars are commonly used in yacht racing, basically they a record of how fast the sailboat can travel in any direction for a range of wind speeds.This page gives some more info on what they are and how they are used. Sailboats are the most complex case, a example for a plane would be finding the airspeed that gives best endurance or range. The airspeed for best range will vary with wind speed and direction, just as a sailboats polar diagram does.

This is where I spent a lot of my time, unfortunately with not any great results to show, It turns out this is a very hard thing to do. I focused on using a Kalman Filter to derive the aerodynamic coefficients of aircraft as this problem as been much more widely studded. I spent several weeks getting to grips with Kalman Filters and implementing real time predictor. This, along with more discussion of how it works and its short comings, can be seen here:

I think the conclusion is that yes it is possible but it is very hard to get repeatable results. I think with a fresh look at the formulation of the KF a improvement can be made. But this is hard for aircraft and will be harder for sailboats. Maybe the next step is to allow the sailboat to use polor diagram for navigation but the user must provide the diagram rather than deriving it as we go. Any ideas on this topic would be appreciated.

  1. Tracking wind shifts and probabilistic decision making, again veering off into very sailboat focused stuff here. Given some information about the how the wind has changed in the past we can predict what it is likely to do in the future. If we can successfully do this then we can get from A to B faster.

I ran out of time for this one, I think also that the addition of high quality wind-vanes makes this much less of a issue that I initially thought it was.

  1. Mapping functionality for sailboats (and more). This would allow a polygon to be defined, just like a fence, this area would then be mapped. The code will optimise the path to map the area in the minimum time. This will greatly reduce the complexity of planning mapping missions. The missions should be performed no slower than existing methods, for those vehicles that are more constrained by manoeuvrability and the directions they can travel (planes and sailboats) this should, I hope, provide a significant speed up in mission time.

I have working travailing salesman solver in SITL, this takes in a list of way-points and visits them all with the the minimum path distance time it can find.

This is working well in SITL but is yet to be tested on a real vehicle. This implementation is the more difficult bit of the mapping mode. Some code to convert an area into a number of way-points, possibly on the GCS will enable this. Some work also has to be done on cost functions, clever functions that take into account object avoidance, wind direction ect should make this a very useful feature. I need to do a small amount of work on the implementation, for example restarting missions and missions with two path planning sections in them currently do not work. There should be a pull request for this in the next couple of weeks.

  1. Extras!

I have also been able to implement a few extra things. In particular a few small things that enable avoidance and path-planning to work for sailboats, as shown at the top of the page.

Thanks

Last of all I thank ArduPilot for selecting me as a GSoC student and in particular thanks to my mentors @tridge and @rmackay9 for the great advice and especially for putting up with my bad spelling and abundant typos.

Sailboat development has by no means come to the end of its rope I will continue to plug away at it and add new features. I quite like the idea of doing some work towards long very long range sailboats but if there are any feature requests I could of course try a new tack.

If this update has left you All at Sea you can Learn the Ropes over on the sailboat wiki.

11 Likes
Sailboat Support