Great you got it working! looks like a nice setup you have there with the seats and shade.
I have been having a play with my pot, not sure if its because it got some water in or something, but it cant really do better then ±20deg repeatably. I think the sooner we implement a magnetic encoder the better. I did add a dead zone parameter maybe by adding a resistor between the wiper and ground to stop the wiper pin floating as it moves from fully + to fully - some better accuracy could be gained. My placement on the bow also results in the flag hitting the water when heeling over. There is auto min and max voltage calibration routine now at least.
I had the opposite problem here today, to much wind was good to do some testing in tho, I think it was about 20knots gusting 25+. I tested loiter and checked that Randy’s radians for the rates fixes the rates issue I was having. Also ran a upwind down wind auto mission. Essentially everything worked well, except bearing away and sometimes tacking. It would just slam the rudder to full but doesn’t know to sheet out, so it would just carry on straight. And for tacking it would just get stopped dead by a wave or something and start drifting backwards. Looking at the speeds, speed scaling seems quite pointless for this as it only gets to 2ish m/s when going full speed, gps is not really accurate enough to do the scaling well in such a small range. Maybe some logic based on heading error over time, i guess this is just steering integrator that lets the sail off might work for bearing away.
Heel control PIDS worked well tho, maybe abit smaller P and larger I would have helped smooth it out abit, due to the load the winch lets out fast then takes longer to sheet in, maybe a nicer winch would remove the need to tune up the gains as much.
My pot has arrived. I’ll work on mounting it to the mast head and getting it wired up tomorrow. Then another day to build the pointer I guess. Can you put up a regular speed video of the boat running in auto up and down wind? I’d like to watch what it is doing closer.
In real time, not very a good vid, I forgot to increase the field of view after the loiter bit and the auto stabilization is makeing it to look like its mounted on a piece of spaghetti.
when trying to bear away, @9:20 in the vid you can hear the water going round the rudder but nothing happens because its too powered up.
Could I get the design files for the windvane? The Bourns Potentiometer has arrived so I’m planning on replicating your windvane. I’ll be asking one of the guys at elab.co.jp to modify and print it for me so that I can hopefully attach it to the top of my Thunder Tiger sailboat mast.
EDIT: also I guess the pot was connected to the flight controller’s ADC port. There are two available on a Pixhawk (6.6V and 3.3V) but just one on the Cube (3.3V). I’m wondering which did you use?
The designs for the vane are here, https://a360.co/2x5LoFX , I used the 6.6v ADC but only because of the convenience of having 5v to connect the pot to, if you use 3.3v you need to get 3.3v on the pot using a resistor I guess because i don’t think there are any 3.3v outputs on the cube. A 5.6K resistor will drop the max voltage on the pot to 3.2V if you connect it to 5v. I also think it may be worth trying a pull down on the pot wiper, but much larger about 100k maybe.
You will also need to un-grease the pot to get it spin more freely, maybe some chemical, acetone? (this might also dissolve the plastic) or IPA? would remove it with out having to take it apart.
Thanks for the video Pete. I built a wind vane yesterday. Takes about three mph of wind to get it to move. the mount just drops down inside my mast. It may be bigger than necessary. Only a set screw holds it to the pot so it is easy to replace if I try a smaller one. I’ll be giving it a try out in a few hours. https://1drv.ms/u/s!AgqdUNhfFlnDgbNyLoH5IkSDKvmq0Q
Turned out today my model sailing club had 15 Soling 1 Meters sailing at the pond so I choose to not sail. I did take the wind vane out in the air and it worked surprisingly well. I think it will be good for my boat even at 12 inches long and 70 grams.
I noticed something on your video on the heavy air day. It looked like at some times your booms were coming in to far. With these smaller boats, even the 8 foot 100 pound J boats, the jib boom should point to the shroud and the main boom should point to the corner of the transom when fully sheeted in. In heavy air it is common to set the jib the same but adjust the main so it is hanging out a little more and use the vang to induce more twist in the main sail. This allows air to dump out of the top part of the main, and the jib also backwinds the main a bit causing the main to be far less powerful and giving a well balanced boat without all the weather helm and rudder input to travel straight. This makes me think about something a little. Chances are a boat designed to carry out some type of work will be the size of my EC12 or most likely larger. Larger boats have separate winches for the jib and the main. At some point a separate jib winch may want to be defined in the code. Its common in the larger RC boats with two winches to ease the main in heavy air at times but keep the jib set as it is. The boat continues to move along nicely under power from the jib and the main helps out just a little. This results in a very well balanced helm. So if the wind speed or heel angle reached some defined point, initially just the main would be eased. Just a thought for the future.
Wind speed sensor is now working! I have rebased on master I think the code is complete enough to start looking to merge. I fairly happy it all works, only untested thing is automatic tacking on geo-fence. Apart from that I think everything works as intended. I guess the best thing to do is to merge and do some documentation then hopefully a few people will have a go and then we can fix things as we find them.
I have mounted the sensor on the mast under the back stay to protect it while in transit.
Due to the rebase you will find some of your parameters are reset. There is now a calibration code for the wind vane, set the WNDVN_CAL param to one and reboot, after 30 seconds or so you will get a message on your gcs saying calibration started, then you just rotate the vane slowly for 30 seconds until it says complete. This populates the min and max voltage params. It will still have to be rotating clockwise for increasing voltage. Then you can set SAIL_GCS_TRU_WND param to 1 to report the apparent wind to the gcs instead of the true wind. This will allow you to set the vane to head to wind and set negative the current wind direction into the ANA_OF_HD param. The vane should now read zero. Oh and tacking on aux is now function 60 not 59.
My wind sensor arrived yesterday as I also have all the bits to make a windvane now. I’ve tested the potentiometer and it seemed to work (i.e. by turning the potentiometer I could see the reported wind direction was changing).
So you’ve decided to mount the wind speed sensor separately from the windvane. I was thinking that it would all be part of the same unit so that the wind speed sensor rotates into the wind. I see from the shape of the wind speed sensor that this could be a little difficult because the flat side would face into the wind so it could potentially fight against the vane.
I tested with the wind vane today and it did not go real well. I was using Peters code from about 10 days ago . The wind vane was accurate on the lake bank to within 5 degrees or so of the boats heading. The sheeting action in auto and acro was horrible though. on the lake bank in acro while I moved the wind vane around some times the sheets responded and some times they didn’t. The rudder was also moving around on the bank. In acro and auto on the water the sheets didn’t seem to behave properly. I don’t know if this is the wind vane or the older code that had the sail no go and sail hold parameter problem. It was light wind and it was hard to tell where the vane was pointing. I have a log at the end of this attached to look at. I have not looked at it yet but will do so in a few hours while eating dinner. Steering was O.K. considering the lack of drive the sails were providing. One question. Is there anyway to scale how much the sheets go out as the boat head from close hauled to a beam reach? Sail position is very critical in this range until going off the wind. once off the wind its not as critical . Different boats are going to have different sheeting geometries depend what type of winch or sail arm servos they use. It seemed that my sheets moved a lot more than I thought they should. I have just now changed to peters latest code he provided on this thread. This is the last log of the day after numerous reboots and troubleshooting. Thanks as always for everything. https://1drv.ms/u/s!AgqdUNhfFlnDgbNzMIs23L2_VBGsEA
Actually I just loaded the flash log on Mission Planner and I’m not really sure what to look at. This is a totally different thing compared to a quad, heli, or powered boat. Could it be my Servo3 output needs to be reversed?
If your throttle input is not reversed, in manual throttle down (towards you) Should be sheet fully in. If this is correct then servo3 is also correct. Hard to tell if the vane is working properly from the logs, I end up with SAIL_ANGLE_IDEAL at 25. This is the angle the sail set to the apparent wind. It interpolates the sail angle from the sail min and max angles. So if it should be sheeted in more you can just increase this angle ideal param.
I forgot to add the sail logs to the above code this one has them: ardurover.apj (755.5 KB)
If you flash that hopefully it will work alot better, lots of bug fixes since the one you were running. If you have a look at the new defaults or my parameter set, they are the same, most of the sail and windvane parameters are a much more sensible starting point. The only other thing i could see in the parameters is probably to turn down your acro and pivot (this is used for tacking) max rates, mine are 100 and about 30.
Also the new code lets you swap to reporting apparent wind to the GCS this gives you a much clearer idea if the vane is working correctly on the shore.
If you mount to the wind vane you have to sort out the wires rotating somehow, i think the sensor is more or less unidirectional, so it should be OK. I think being stuck behind the mast will have a greater effect in my case.
As a bit of a teaser, this is the map from my test today, did a AUTO misiton of about a mile total, in shifty winds. Not as much tacking as I had hoped in the end, cant really do much about that with a river to test on except wait for the wind to come from a different direction. It ran completely auto with tacking on cross track error and no pilot input for the whole thing.
I’ll flash this latest one. I will also bench test acro changing the SAIL_ANGLE_IDEAL. Mine is set to 5 I believe. I looked at my RC_OUT 3 in the logs and unless I was in manual it was never less than like 1700 if not maxed out. Only in manual did it come down to 1300 which is fully sheeted in. I don’t know.
I think you said it was working sensibly with the vane set to home heading, if this is still the case the issue is defiantly with the analog vane, I guess try the calibration and redo the offset and make sure it gives sensible apparent wind, if not try swapping the outer pints on the pot. It needs to be increasing voltage for clockwise rotation, although looking at your picture of it i think you have it right (assuming red is + and black is -), its hard to work out from the pic tho.
Videos are finally uploaded to YouTube. This is the mission in real time:
This is it speed up 8x in case you don’t have 40mins to spare .
Over all I am very pleased with how it went. The wind was quite shifty and gusty but essentially it dealt with it and manged to complete the mission. It sailed almost exactly 1 mile completely autonomously. I did a quick test of all the modes, they are labeled in the real time version. Again everything worked as expected. It got a bit confused about the wind direction when it got very light, this could be improved if I had set a suitable wind vane cut of wind speed, it just ignores the vane at wind speeds less than the cut off. Also it did some odd stuff sometimes when the wind shifted and it swapped back on to L1 controller, it would be tacking then the wind would shift so it would switch back to the L1 controller because the desired heading was no longer upwind. This would result in it turning round and sailing almost back where it came from to get back on the line between way-points. It would be more logical just to carry on towards the next way-point. This could be fixed by a bit of a rejig of how the heading controller works and a parameter to define at what wind angles the L1 controller is used, from a sailing point of view heading control would probably be better 100% of the time. I guess if your mapping or have a motor too you may prefer to try and keep on the line.
Anyway I think that can wait for another pull request, better that I do some documentation before I forget how it all works. Unfortunately I have to go back to my proper job on Monday after messing about with boats for three weeks. Hopefully I can find a nice spot to do some testing somewhere and keep doing some development. I have some other stuff to build too, a boosted tri-copter to rebuild and a TVBS to play with, then I have been thinking about maybe a land yacht. Would be quite a challenge for the code I think since they can quite easily go faster than the wind but if we can get it working for that it should be fine for boats. Would also be good to do some work on motor sailing, I think we might get more interest if we can just add a small sail to a existing boat and get twice the battery life, but still use the motors to remove all the difficulty associated with being 100% wind powered.