Sailboat Support

Have you got an oscilloscope etc for debugging? Life will be hard if not!

I do have one. I was looking for the best way to drive the transducers without having to make custom hardware, apparently you can just use some TTL to RS232 adapters to drive the transducers directly from a pin.

Ultrasonic driver circuit is a good question. I would make a high voltage supply ( say 20V to start). Then use an RLC circuit. One end of Transducer, R, L to gnd. Other end of R to other of transducer, then to C . Other end of C to non gnd end of L. Then a high side switch from 20v supply to non gnd end of inductor. Then just switch on once for t <= 1/2 * f and put back to high z, which should be enough to get the transducer ringing. … Or something like that !

1 Like

my plan is to try and replicate your setup with the parking sensors for my solar rover, It’s big enough that it carry it as is, and I should be able to get it working without soo much issue using your code. i have a few other projects I’m working on with the sonars, so once i somewhere with them IL come back around to this.

1 Like

The schematics for the various versions, the unmodified one and the modified one. The schematic also shows the existing driver circuit

1 Like

I was just looking for 200khz wind sensors online, they have came right down in price since the last time I looked a couple of years ago, ali express have them for £68! they were about £300+ last time I looked. I think it would cost more to make a 200khz version that to just buy one.
https://www.aliexpress.com/item/1005007454724848.html

HaHa. Yes. Probably in terms of development time, but it would be more fun to try to make one. :slight_smile: Those types I think may work on resonance, measuring change in frequency input to get resonance , rather than pulse timing, And they can be very small. It would be interesting to look at update rate of those. They seem to update at a few Hz, whereas pulse timing is faster ( proportional to transducer frequency), but I could be wrong about that. I haven’t really investigated exactly how they work

Anyway here are some raw waterproof high frequency ultrasonic transducers
https://www.aliexpress.com/item/4000389134890.html

1 Like

Hi everyone,

I had my sailboat out today and it’s working pretty well. I have had trouble in the past with it not being able to turn downwind when it’s windy and was working on that today. The rudder goes hard over but the boat will not turn until the sail is eased, like many full scale sailboats.

I will spend some time on the sail trim servo settings to make sure that it is not oversheeting on a reach. I’m also considering a larger rudder. I am able to switch to manual mode and bear away by dumping the sail and turning when the boat is flat.

I tried a variety of heel PID numbers: changing the threshold to 20 degrees from 30 made a big change, and I increased the P gain too. After these changes it was able to turn downwind at the upwind waypoint every time, although the wind had also gotten lighter so I want to test more. The other thing that happens with these settings is the sail servo pumps very aggressively in waves as the boat tips, working the servo pretty hard. It’s a beefy servo so I’m leaving it that way for now. I see a sail slew rate parameter and tried some settings, can anyone tell me what the units are or the equation it uses? I’m also unsure how the feedforward gain is used, would that help?

What I would really like is to be able to aggressively ease the sail when the boat is heeled AND it is trying to bear away. Something like target heel is 30 degrees - K*(rudder percent). I don’t mind a lot of heel upwind but need to be able to help the rudder reaching and running.

Let me know if you have any ideas! Thanks.

Bin file link

GCS image shows rudder (ch3out) at max while sail (ch4out) pretty in (900 is all the way out) at 20 degrees heel. Wind was from the left on the map, boat is trying to turn right (downwind) at waypoint 2

1 Like

It was a nice day on the river: @n3m0_the_robot_boat on Instagram: "N4N1 the autonomous sailboat instagram takeover. Nice day at Sherman island, tuning parameters and testing, still a little trouble bearing away in breeze but better! Look for the otter in the last clip! 🦦 @meholden"

1 Like

This is certainty a area that could be improved.

The slew rate limit param limits the value of P+D portion. There is a small section on the wiki for this, Limit Cycle Detection — Rover documentation. I would not expect it to do much in this case.

Feedforward won’t do anything in this case because there is a constant target from the parameter value.

You could try adding some filtering with ATC_SAIL_FLTE, a low value will slow everything down. Maybe start at 5Hz and go lower.

Thanks for the info!

I took a crack at it. I hadn’t compiled anything in a couple of years and it was a pain to get my development environment going again! But anyway.

I have a branch on my fork here: ardupilot/Rover/sailboat.cpp at Bear_Away_Ease · meholden/ardupilot · GitHub

I bench tested it and it seems correct, I hope to test it on the water soon. The gain is hard-coded at the top. It lowers the heel PID setpoint if the rudder is past 50% and turning in the bear-away direction based on the rudder sign and the apparent wind sign.

heel_setpoint = heel_setpoint - K*(abs(rudder)-0.5)*2

The factor of 2 is so the setpoint is reduced by K degrees when the rudder is 100%

My boat requires one other hack which is in a separate branch, and a third branch combines them together, if I did the git stuff correctly.

Let me know if you have any suggestions, I will follow up here once I have tested it in enough breeze.

2 Likes

Looks good, I have left some comments.

Thanks for the coments! I am in San Diego for a few days dropping my son at SDSU after Thanksgiving break, managed to fit the boat in the car and did some testing at the mission bay model yacht pond yesterday.

The boat sailed windward-leeward courses for 1.5 hours without needing any help, it was windy but not extreme. The ease-on-bear-away code seems to work and help with the steering. I should have set up some beam-reach to downwind legs to test it, but am hopeful this will be a good code for my boat. I will revise to add the hard-code numbers as parameters once I’m home (I have one new gain and also my boat works better with 2 other hardcoded parameters set differently so I’ll try to make them all parameters in my fork.)

Here is a link to the bin file.

Clip inserted below if I got this right…

I did update the code with Pete’s suggestions, and to create parameters I need for my sailboat.

There is one new parameter for the ease on bear-away gain.

I also made two tacking #defines from the code into parameters because my boat works better with different numbers. My vane is mounted on the back of the boat and the yaw-rate-induced errors in a tack need to be ignored for a while, so I set the timeout to 8 seconds and skip the tacking_accuracy test altogether by setting it to a negative number.

I have only bench-tested it at this point, won’t be able to go sailing for a week or two. I don’t know if this is of general interest enough for a pull request, but after I test it on the water and clean up some commented code I could submit it if you think so. Either way I am happy to have an up-to-date-hacked version for my boat!

This link should get you to the relevant bits:

I have seen similar issues with a vane at the top of the mast and the boat rocking back and fourth in waves. I have wondered about adding position parameters, like we have for GPS and IMU. We could then use the rotation rates of the vehicle to correct the measurements.

Great work on the bear away gain. I think we could look to merge that, we would just need to pick it out of your branch, you could open a PR or I can take a look over the holidays.

1 Like