Sailboat Support

I did some more testing and tuning over the last few days, using a larger wind vane. It swings around quite a bit as the boat rocks, but works well after running through the low pass filter.

@iampete Did you not have to tune the streering rate controller at all? I found that I run into significant integral windup with the default settings, even in acro mode. If the boat can’t achieve the desired turn rate (and the default acro max turn rate is extremely high), the integrator will wind up and cause the boat to spin in circles even after the stick is released. I ended up disabling the integrator altogether, and increasing the feedforward which gave much better acro performance.

I am still observing poor navigation behavior when going downwind. The boat oscillates around the waypoint track, especially when it is disturbed by a gust of wind or waves.

This problem is illustrated by the plot above. It shows the bearing toward the target waypoint (NTUN.WpBrg), the bearing to the L1 point (NTUN.DesYaw) and the boat’s heading (NTUN.Yaw). It also shows the desired and actual turn rates. All units have been converted to degrees or degrees/sec. Note that when NTUN.WpBrg and NTUN.DesYaw are equal, this indicates zero cross track error.

The rate controller appears to be tracking well, but there appears to be a significant phase lag between the desired and actual yaw. Based on the documentation and the parts of the code I have looked at, I would expect the target turn rate to be zero when the actual and desired yaw are equal, but the plot clearly shows that the boat is still being commanded to turn when the target yaw is reached, and this seems to be what causes the phase lag.

Here is the full log file in case someone wants to look at it: https://drive.google.com/open?id=1ci1LwsCJV2vNuf_LqdaYQ22d8avKdfM7

To be honest I cant remember exactly what I changed. These are my params from the last time I sailed the IOM 00000014.BIN.param (18.4 KB). Do a param compare using mission planner, or just look at the ones your interested in. As I’m sure you realize bad things will happen if you just flash them all.

I think I did definitely turn down the the acro turn rate, this is a better solution than turning off the I as its good for lee/weather helm when sailing on each tack.

There are time periods for the L1 controller that you can have a play with, these will make a difference to the downwind stuff. When taking into the wind we just use a heading controller (like acro mode) but off the wind we use the full L1 controller to try and stay on the line between way-points.

As I said I never spend a huge amount of time on the tune, just got it good enough to get to test the rest of the sailing code. With my new boat I’m going to spend some time getting the tune sot on (hopefully), still not allowed out to try it here tho :frowning:

Hi, if you have any idea here (not sure you noticed the logs are uploaded), then I can try things out this weekend for you.
Otherwise I will try some sailing tuning with the standard Laser rig :smiley: no worries.

It seems to be upside down with no gps lock in that log, I guess it is the wrong one. A log from the SD card gives more info if you have one.

Sorry about that.
hm that was the only log on the SD card. In that case it failed to record that sailing or I deleted it.
Then I will only have the Telemetry log from the pc. Does that help?

p.s. the first half of the log its still on the shore.

I think I just happened to have a bad beta of MP on my laptop, the same log is fine on the desktop.

Anyway, not really enough info to go on in the tlog. You could set GCS_PID_MASK to steering so we get more info in the log. Or grab the log off the SD card that just has it all in anyway. This would be a .bin or a .log.

We print ‘tacking’ if you hit the switch in a navigation mode, maybe we should add that to acro also. Or maybe just add a special logging message just for tacking so we get more info.

Okay, I think I will check so the sd card is really logging.
Then I will do more sailing. Good excuse to sail :smiley:
But everytime I have checked the SD card, there are no .bin files only tlog and rlog files
Should I do something to convert them to BIN?

The tlog and rlog are created by mission planner. You should get .log and .bin after doing a download of data flash logs using mission planner. You can of course also just pull the SD card and copy them straight off.

I think its logging okay now on to the sd card.
Also think I found where its placing the file when downloading on the pc, there are several files but only one with .bin at end …
this is the type of file you are looking for?
The steering is in there?

p.s. I have no idea why it selected a file name from the 70 ties - :slight_smile:

That is the right file type, but there is nothing interesting happening in that log, its only a few seconds. All the steering stuff is there tho.

ArduPilot gets the date from GPS time, so if you have no GPS lock when the log is started the date and time is wrong.

thanks! that explains it.

Last weekends its been too windy to sail (over 10 knots).
I have made a smaller wing sail so this should not stop me this weekend :slight_smile:

This D sail is only 55% of the A sail on a laser.

image

1 Like

Hello,

To use this do i need a pixhawk or is a APM 2.8 supported?
and when using mission planner do i need to set it up as a rover or is there a option im not seeing for sailboat.
i have have just stumbled across this and havent used the software since the change to pixhawk.

Hi Ricky, Welcome,

The wiki is the best place to start,

https://ardupilot.org/rover/index.html

There is a list of all the currently supported hardware.

https://ardupilot.org/rover/docs/common-autopilots.html

Once you have Rover installed you can look at setting up the sailing functionality

https://ardupilot.org/rover/docs/sailboat-home.html

Hello!
I did not need to use the small D sail today.
The sailing experience was just like before: in Acro the boat is unable to tack, in manual its never problem.
This time I think I have a good log file for @iampete to analyse.
What is happening? Search for sections where in Acro mode, then I always try to make a tack after a while. It never succeeds except once! the boat falls back to the original tack.
I have an idea of what is happening but I await the word of the guru.

Here is the log
https://drive.google.com/file/d/1CQr6uuMBGMmwAEfgwShIlJJGF7ycQlkv/view?usp=sharing

I can add on some onboard video of the typical Acro failure tacking as well as the suceeseful Manuel mode tacking.
Just let me know.

P.S.
I was thinking to sail with the default Laser sail just to verify the software can tack etc, but I am getting used to the motor and that really helps getting out of tricky situations. So I consider building a separate motor stand to be used with the default laser sail set up to try it.
D.S.

Looks like you had RC 6 set as tack switch but RC 6 never goes abover 1800 (the value to trigger a action). So AP never received a tack command.

Maybe you mean that it will not tack if you steer it through the wind in acro mode. To me this just looks like you need to tune up the steering controller. This is the target from the stick in red and the actual in green.

Its never going to be perfect on a slow sail boat, but I think it could be a better, you could probably double all your gains. This is where the motor comes in handy, you can use it to drive at a constant speed to get consistent testing between settings.

Thanks a lot for taking time to look at the log Pete.

. Yes during this sailing I never tried to tack with the RC6 switch, sorry could have told you.
. Yes that’s what I mean, I expected it to tack when steering through the wind in Acro mode.

Aha, so you think that in manual mode the PIDs for steering/tacking is not involved and tacking succeeds but in Acro they are but they are too low to really turn the rudder all the way I want and need?
Okay! will try adjust that.

This is what to read up on right?
https://ardupilot.org/rover/docs/rover-tuning-steering-rate.html?highlight=tune%20steering
Anything else?

From observing the boat trying to tack in Acro mode, I can see it never changes the control tab to the other side. Except once and at that time it did it very late when boat had already fallen deep from the wind on the new tack.
So maybe other issues as well…

Yep, those are the instructions.

Basically turn up the gains until it get wobbly and then back them off abit. The feed forward term is the important one to get right first. Setting up the real time feedback as explained at the bottom is very usefully. You can get the same data in more resolution in the dataflash log by looking at the PIDS log.

1 Like

Thanks Pete

I have done some 2h sailing today. Main purpose was to follow instructions in wiki and get a better tuning of the steering controller. I think it’s better. The
The tuning activities are not in this log. This log show sailing after the tuning.
I found the max turn rate to be 40 degrees per second, way lower than the defaults. Basically its 30 but ones in a while hits 40. So I set it to 40.
I cranked up feed forward *2.5 and P and I both to *2.
It would be helpful if you can check if it looks reasonable okay or I really need to redo all of the calibration.

https://drive.google.com/file/d/19jjjZaCqUdxajtndpyeCjK-QHKYz-epU/view?usp=sharing

Today was so many factors that make the analysis of cause and effect blurry.
I think there might have been some sea weed stuck to both keel and rudder for some parts of the sailing, also I think the boat actually got stuck here and there while sailing like in weed or other unknown obstacle. cat really tell for sure.

That makes it hard to distinguish if the code made the boat sail backwards or not. Clearly, tacking in acro mode with just rudder steering through the wind has not improved very much. It falls back to original tack.
RTL works pretty good.
The instructions you gave me to first put the thrust up 100% and then turn to Acro/Auto/RTL modes seems very mysterious and I can not as of now determine which one makes the boat sail backwards (half of the times I did not put the throttle up 100 but just kept it as normal at minimum 0).

I plan to sail tomorrow again to gain some more experience that can make more
sense to you.

Best
K

p.s.
the winds today was very weak and shifty so maybe not put too much energy on analysing it.
d.s.

This is my boat in Auto.

You can see the green follows the red quite well (this is a OK tune but there is still room for improvement). Tacks are the big square bits at a constant rate. For Auto mode I set the tacking speed to 40 deg/per second (WP_PIVOT_RATE). The log is in radians so that is the 0.7 rad/sec of the ‘flat bit’ of the tacks.

This is yours in auto.

The target is leaving the actual well behind.On on the right there where it is asking for less it does quite a good job. With sailing its hard to tell if its just doing a bad job or if run out of wind and has stopped. The motor eliminates this issue, you can just cruse around at 1m/s and concentrate on the steering tune. My boat the motor is fixed to the hull so it works like a normal rover, I guess yours where it can pivot upsets the acro speed controller.

These are my params if you want to compare. 00000014.BIN.param (18.4 KB)