Sailboat Support

@iampete Nice work

I would study the possibility of mounting the wind sensors and vane on the top of the mast. It’s the best location for it.

@LuisVale. I totally agree. This is how I will set the boat up once I’m at the point of converting the boat to Ardupilot. Two reasons. The air 4 or 5 feet above the water is often a different speed and direction somewhat. On the bow, although easier to wire and implement, it is in harms way. A boat wake or wave when the boat is going windward will soak it down. Back a few years ago when I was first putting together my power catamaran and testing it I had a bit of a problem. I had a servo extension wire that was exposed to water coming over the deck. This was unknown to me. I went through a boat wake in salt water. Immediately one rudder went hard over, the one that was associated with the servo extension, and stayed there. It took me about 15-20 minutes to get back to shore. When I did the pins on the servo extension were gone. Not corroded a bit but gone with a little bit of green powder laying around. A lot of weight at the top of the mast is not exactly ideal but the wind instruments should be better off than on deck for sure.

Let me be clear. Initially for testing the wind vane on deck is O.K… For some type of boat intended to sail in rough conditions it needs to be on the masthead. But, that’s up to the builder of the vessel.

@rmackay9 my wind sensor has just shown up, the question is do we support it under the wind vane library or under the airspeed library. I think it makes scene to use the airspeed library, there is no reason why a ‘traditional’ airspeed sensor couldn’t be used. Although we would have to turn off all the ekf learning features.

You are both correct about the mounting of the wind vane, it would be better on the mast, the only practical place to put it would be right on the top. For my sheltered bit of water and small car the bow is actually less exposed than the top of the mast would be. Hopefully when we support magnetic encoder windveans the ‘flag’ will be much smaller and less delicate. I have finished a more permanent vane, I can proved stl files or the cad if that would be useful.

I have swapped to a pixhawk lite and now have no more annoying issues hopefully. I have mended the tacking code so it no longer tacks ever 6 foot and can do auto missions properly. I coded in tacking on geo-fence but I only saw it work once, not sure whats going on as it triggers the same code as the transmitter switch, it could be that the wind was getting abit light and it was struggling to get round, I have raked the rig back to upright and moved the jibe back a inch or so to make more room for the vane, this has also make it more prone to getting stuck head to wind. I also added takcing to acro but this doesn’t work at all, must have made a maths error, hopefully i can get it sorted tomorrow. I think I will add a maximum cross track error parameter for auto modes upwind.

Then I think the windvane needs abit of filtering on its output, currently the boat quite aggressively changes heading in wind shifts, also we could try and get it to spot if the vane is not moving due to lack of wind. The other option would just be to lower the maximum rates allowed when keeping a straight upwind course.

The next thing i think is some sort of stability control to sheet out if there is too much heel. Then I think I will have alook at the wind speed sensor.

3 Likes

Pete,

Wow, really great progress! I agree that implementing support for the wind speed sensor is probably best put into the airspeed library and, as you say, we can figure out a way to stop the EKF from attempting to use it.

I’m sure you’re right about the filtering required on the windvane… we have an AP_Filter library that could help with that.

At this stage we could probably look at merging it to master…

Just fantastic! I’m so looking forward to get my boat out there too!

1 Like

Ah, I forgot to mention, regarding when to automatically tack, I was originally thinking we could use the WP_OVERSHOOT parameter… which is used in regular Rover/Boats to decide when it should slowdown because it’s getting too far from the line between waypoints. The default for that parameter is far too small for sailboats (2m) but we could increase the default (or ask users to set it to a higher value for now).

Good idea to allow triggering the tack from an auxiliary switch.

Very nice video. That is great to see.

Thanks for all this work!! A filter on the wind vane is a good idea. I plan to have mine on the masthead and, at 6 feet above the water ,the apparent will move around a lot when going up and down waves. Cross track parameters for both max and min is probably a good idea. As the boat gets closer to the windward waypoint you don’t want it tacking to much if it is a sluggish tacking boat like mine.

I started the process of converting my EC12 today. Mostly brain storming how I want to set up the components. I decided I will mount two pieces of aircraft plywood in the hull that can be easily removed. One will be for power management. It will have a few buss bars on it. Easy access for 10 - 12.6 volt from the 3s LiPo, a Castle 20 Amp BEC set to 6 or 6.5 volts for the RMD sail winch and rudder servo, and a 10 Amp BEC set at 5 volts for the later addition of a RFD 900 unit and the ability to power a Gopro off the ships power. The other plywood piece will have the Pixhawk, GPS, basic 100mw telemetry module, and receiver on it. I plan on ordering the wind speed indicator and windvane pot that Randy ordered in the morning. My initial set up will have the wind equipment on the masthead so I will cross that fabrication bridge when the stuff arrives. Hopefully in about two weeks I’m ready to go.

Have I forgotten anything?

1 Like

@David_Boulanger Great! I think that is everything, you don’t need the wind vane if the rest of its ready to go, It should do a reasonable job with constant true wind direction so long its not too shifty. I guess we could calculate the effect of pitch and roll rate in waves on the windvane if we have its height as a parameter, might be some tricky maths tho.

More testing today but no vid. I have added the cross track error parameter and tested it, it works well to tack up my testing river. I have fixed and tested acro tacking, this allows tacking on the aux switch in acro mode, the boat just matches the current angle to the true wind on the new tack.

I thought I had reduced the maximum allowed rate when sailing in a straight line in auto but it seems to not work, will have to have another look at it.

I have added but not yet tested reducing the rudder output scaling when going slowly, I found it will get stuck head to wind because it will just use full rudder to tack even if its going very slowly. Maybe this would be better controled by reducing the target turn rate?

I have been thinking about the best way to filter the wind vane outputs, I think a fast-ish moving average over a second or so, I can’t decide if we should do a slower filter of true wind angle to use just for tacking, but then we would loose out on how quickly it follows the shifts currently, I think the reduced straight line rate, if i can get it working and a faster filter would be better. And if we can detect a stuck vane we could use a faster filter, I was thinking maybe if the apparent wind angle hasn’t changed by some small amount just don’t up date the true wind angle, and use the last one. But then we might lose information where apparent wind is the same because a change in true wind angle or speed had been masked by a change in boat heading or speed. Maybe with the addition of the wind speed sensor we could weight the vane results with wind speed, ie strong wind - vane is defiantly right, light wind - vane is probably close, no wind - vane is useless. Duno i keep changing my mind, any ideas?

Any thoughts on the best way to do loiter mode? I guess we should just define a circle and sail within it. There a couple if ways we could do it, we could go into a hold style head to wind and keep reseting to the upwind side, i think this might result in getting stuck head to wind from some boats, maybe hold mode should not be dead into the wind but more of a tacking angle but the the sails still loose, I think I will add a parameter for this. We could just sail back and forth on a reach at 90deg to the wind, we could sail back and forth upwind and down wind, or we could do a plane style loiter and sail as close as we can to the perimeter of the circle.

Once loiter is done all useful modes should be supported. I don’t think guided should do any automatic heading stuff, I don’t see much point in steering mode for a sailboat and smartRTL would be abit pointless as it wouldn’t necessarily avoid anything if it has to tack up to the next RTL waypoint, duno we could impose the cross track error on it I suppose but I cant see it working that well.

I suspect I keep having issues that would be far less important in a bit of a stronger and steadier wind, there has not been much here recently, If it was windy I would be doing the heel control code.

2 Likes

I would think one of the most important things in Loiter is to keep the boat moving enough so it does not get locked in irons. Beam reach idea would keep the boat controllable. Big problem with sail boats is that in order to tack you need to have some boat speed/momentum.

How is the potentiometer wired to the controller? Wind speed sensor also. I ordered the stuff last night and looks like it will arrive early next week. I better pick up the pace a little.

I think the I will implement the reaching back and forth for loiter, we can always add other methods in the future. I quite like the idea of the plane style circling loiter so I might do that too.

The pot is just connected to a analog input pin, on my pixhawk i have used the 6.6v input so I can connect the power for the pot straight to 5v, you can use the 3.3v pins but you will need to add some resistors so you can’t get more then 3.3v on the output. Buy default the pin is defined to be the one usually used for the airspeed sensor. So you have one of the outer pins to 5v (for the 6.6v analog in) or <3.3 (for the 3.3v analog pin), the other outer pin is connected to ground. The central pin then goes to the analog input. Currently the code assumes the voltage increases as the vane moves clockwise so you may find you have to swap the two outer pins to get it to read correctly. The wind speed sensor has not been programmed yet.

2 Likes

Raining here today, so I have done some more work on the code. In the end the loiter code as it is looks like it will work fine for sailboats, it just needs a larger loiter radius, I have added a parameter for this.The code as it is should result in the boat ‘bouncing’ of the edge of the loiter circle and setting is heading to pass through the center and continuing until it hits the other side. I have added a hold mode angle parameter so you can define what angle to try and hold to the wind, this should prevent getting stuck head to wind. I have also enables aux switch and full rudder input hold mode tracking.

I have added a low pass filter to the windvane and put updating the vane in a 50hz loop. Also implemented the heel control PID values. However somewhere in the last lot i think, I have broken the code again, it will compile but not run, hopefully i can get it sorted tomorrow and go and try it out.

http://ardupilot.org/rover/docs/common-pixhawk-overview.html#adc-6-6v.

O.K… I’m not real good at this stuff. You are powering, grounding, and sending analog from the pot all from the ADC 6.6 connection on the Pixhawk?

One more silly question. Does the pot need to be calibrated? How does the code know initially what the analog input should be with the vane directly into the wind? I’m getting a bit ahead of myself being that I don’t have the code yet. Everything should be installed, minus the pot, and ready by the end of Sunday. Pot should be here early next week.

yeah that will work fine, middle pot pin to the ADC.

Yes, we haven’t got a calibration process yet, So its all manual. There are three praamiters, WNDVN_ANA_V_MIN, WNDVN_ANA_V_MAX and WNDVN_ANA_V_HEAD. For the first set up set the min and max volateges to the values you have connected them to. So min = 0, and max = 5. Then you need to check that wind direction changes in the correct direction, clockwise should result in a increasing number, if it does not you need to swap the outer pins on the pot. (you can display the wind directions in the mission planner quick tab) Then you can take a look at the max and minimum voltages. The minimum will probity be fine you may find the maximum needs changeing, if the vane saturates at 360 you should increase the max voltage if it never gets to 360 and jumps back to 0 you need to decrease the max voltage. Once thats set up you need to set the WNDVN_ANA_V_HEAD value, this is the voltage when the vane is set to a head to wind position. You should set the vane to head to wind and alter the paramiter until the wind direction equals the yaw angle.

Hopefully we can get a calibration set up for this at some point. Thinking about it the last parameter could be an angle not a voltage then it would be easier to set up.

I will upload a firmware for you today or tomorrow as i’m away at the weekend, its a pixhawk1 right?

Thanks for the explanation. I’m using a Pixhawk 1

If you can make the code available or tell me where to find that would be great. I’m ready for bench testing and giving the parameters a look over. I have not pulled out the mast or sails yet just looking to test the hardware and do calibrations. This is awesome!

ardurover.apj (746.0 KB)

That is the latest version, just been out and tested it today, all seems to work except loiter, and you have to reboot to change the windvane filter value. The code is on the github, i’m about to change to a new pull request since randy has helped me out with some stuff. That should get you started, I will upload new versions as stuff gets changed, and I will put my latest parameters up.

I think the new parameters should be fairly self explanatory, the windvane params are under WNDVN_… and the sailing one are SAIL_…

The mainsheet is servo output function 89, and tacking is aux switch function 59

Thank you so much. Just loaded on my Pixhawk. However the only WNDVN parameter I see is WNDVN_TYPE. I see the sail parameters.

you have to set it to a type before the rest will show up, 0 is wind vane disabled

// @Values: 0:None,1:Heading when armed,2:RC input offset heading when armed,3:Analog