Sailboat Support

Here is the video: https://youtu.be/2Tx8407xAXo?si=CUDC4nxBuVBiJU5_

It tacks OK port to starboard around 40 secs but thereafter fails repeatedly to tack back to port (until I switch it back to Manual). The mode indicator is at bottom right, windvane and boat speed at top center. I do realize my sail trim is not the greatest! Could be a factor…

Hi,

I can’t tell from your video, is your wind vane on the back of the boat? I had a similar tack then tack-back issue with my boat initially that I think is from the apparent wind the vane gets during rotation. Boats with the vane on the bow like Pete’s would get the opposite effect.

This video shows the motion, skip to 2:35 or so if you want to get right to it, or 9:45 where the GPS track is shown, does this look similar to what you saw?

I did fix this with a custom version of the code that forces the boat to sail to the compass heading after a tack long enough for the vane transient to settle before switching to following the vane upwind. See my post above to get to my fork with this fix and a mod to flatten the boat when bearing away:

I have a new parameter TACK_TIME that I set to 8000ms rather than the default 5000ms which is how long to stay in tacking mode before going to regular vane sailing. It replaces a hard-coded #define SAILBOAT_AUTO_TACKING_TIMEOUT_MS

I have another parameter TACK_ACQ that I set to -1 but it defaults to 10 degrees, a tack is considered complete when vehicle is within this many degrees of target tack angle. -1 forces a tack to always steer to the compass for TACK_TIME seconds so I get 8 seconds to settle the vane transient measurements. This parameter replaces a #define SAILBOAT_TACKING_ACCURACY_DEG

I was going to do a pull request to get these parameters and the heel parameters into the main code but want to test it a little more to make sure it’s bug-free.

1 Like

Thanks so much for your response. I will dig into the details and get back to you. Would I have to compile the code from your fork? I can probably figure it out but not really in my comfort zone.

Your post reminded me that I was going to post info on my windvane in case others were interested. It is a mast top wind vane based on the AS5600 chip and only weighs 14g - see attached photo. I can provide details and the 3D print designs if anyone wants them.

2 Likes

Flying a hull in Acro mode with a model based on the Ardupilot SITL Catamaran. https://www.youtube.com/watch?v=UhFMmKNH3TE

3 Likes

Did this code get merged? Thanks!

The tack back out issue issue is down to a bug in the sailboat code. The code looks for a heading less than some small angle either side of head to wind independent of the original tack , whereas it should look for being some angle or zero the other side of head to wind from the original tack.

1 Like

Gazebo cat in action with larger rig

2 Likes

I just submitted a pull request: Sailboat tack time by meholden · Pull Request #31195 · ArduPilot/ardupilot · GitHub

In the time since I first made the changes the rest of the code changed a lot, so I had to manually merge and then tested the code on my boat. Seems okay so I sent the pull request, hopefully someone will let me know if I need to do more things! I will contribute updates to the documentation also if this gets approved.

3 Likes

Hi Mike,

Great! Thanks for letting me know…

Chris Jerome

Hey ardupilot sailing hivemind, I need some help with my setup…

1m Vo60:

  • pixhawk 3dr px4
  • a bunch of gps things to choose from, I have a basic ublox gps and a compass set up for testing, might throw in a F9p gps later if I want better gps accuracy.
  • CRSF things for rc and telemetry
  • BEC and Voltage/current monitoring
  • Servos etc
  • A5600 magnetic encoder for windvane
  • Modern device Wind rev P will be added later.

The a5600 is where my desire for a lobotomy begins… Days spent going through data sheets, forums, yt videos, and this forum, have not helped. I can not get useable readings from the output pin of the a5600, but I have confirmed that the i2c is functioning perfectly and I’ve hooked it up to a teensy 4.1 to verify the values are exactly as expected.

I have tried all adc options for 3.3V, 6.6V, AUX inputs (yes I enabled GPIO for those pins), the pixhawk will only use its current heading as wind direction, even though I have set the params for analog windvane type. I have seen that there are two types of a5600, one which output a voltage % of VIN, and the other outputs PWM. I have the Direction pin hooked up to GND, so I expect voltage to increase as the the windvane spins clockwise. I have tested the output with my teensy and I can’t read any pwm signals from the output, and I also do not read a voltage on an analog pin of the teensy. I have not yet tried filtering with a capacitor to get and average voltage from pwm, as I can’t detect any pwm from the output anyway. I have seen RcTestFlights videos and Daniel mentions having to remove the R4 resistor, I tried this as well, another yt video has said that the GPO pin must be connected to ground for the board to output PWM, but the datasheet says it is a programming pin for manually setting the functional range of the sensor. I have tried both methods.

I am considering just calling it and running i2c through the teensy and using the RC filter for pwm from the teensy to the pixhawk adc

I’ll attach my params, incase something obvious jumps out at anyone.

Vo60params.param (14.3 KB)

1 Like

I’ve managed to get i2c input from sensor fed through the teensy and into the adc on the pixhawk, and it works… so definitely a problem with my A5600, and not with my params.

I’m not tooooo upset about needing the teensy up on the mast if i2c isn’t stable along the full length, but if there’s a magical forgotten step to making the a5600 work, I still haven’t found it. I might try out the adafruit-as5600-magnetic-angle-sensor instead of the unknown ebay/aliexpress classic white a5600 sensor I’ve been struggling with.

here’s the source for a5600 arduino library I used, works great. I’ve added a screenshot of the code I used to read the i2c value and convert to pwm output.

I have a funny feeling your AS5600 pins are incorrect according to your schematic

Should be according to my datasheets
1 VDD5V
2 VDD3V
3 OUT
4 GND
5 PG0
6 SDA
7 SCL
8 DIR.

Once you have checked that, notice from the datasheet that the AS5600 analog output is very weak. And AFAIK ardupilot doesn’t have a driver for the I2C option, so you have to use analog. The minimum recommended output impedance is 100k ohm, which isnt much Your 10uF capacitor in the schamatic is too big with the very small available output current and will give a very, very slow respons, so attach a (say) 0.1uF capacitor from the other end of the 100k resistor to ground. That should give you a faster response, but You do need a capacitor to give you a low output impedance along the cable, You should connect PG0 to ground via a (say) 10k resistor. Then disconnect SCL, SDA. Connect VDD5V and VDD3V together ( or check datsheets for other options) and supply 3.3V power.

Also note there is only 1 AS5600, but it will do several different types of output dependent on how it is set up.

It may be you main issue is the very low drive available. Also bear in mind you may have accidentally programmed it to change its output range.

2 Likes

I just threw together that earlier schematic, so pin numbers were just from an existing part I found online, so it may well have incorrect pin numbers. I hooked it up according to the pcb silkscreen.
I should note that I am using one of the classic white a5600 breakout boards, and not the a5600 chip by itself.

As for which parts I selected, the best option for me is what I already have lying around, so if I need to change later I will buy some new bits

I have made a schematic for my current setup, which is responsive enough for my use. values are displaying correctly in missionplanner.

Wouldn’t i2c output reflect a reprogrammed range?

Any opinions on Modern devices Wind Rev C versus the Rev P?

It’s cheaper, smaller, good for 0-60mph wind. The only downside I see is that its output is a % of Vin which must be 4-5V, so would need to use the 6.6V ADC on the pixhawk. Would need fewer wires going up the mast, as the Rev P needs 10-12V and the temp as well.
Although it doesn’t have the dedicated thermistor for ambient temp compensation, in practice I’m not sure how important that will be.

Rev C + a5600:
5Vin –Rev C, teensy, and a5600
3.3V ADC –windvane
3.3V ADC –wind temp
6.6V ADC –wind speed
GND

Rev P + a5600:
12Vin –Rev P
5Vin –for teensy and a5600
3.3V ADC –windvane
3.3V ADC –wind temp
3.3V ADC –wind speed
GND

With the rev P I’d need to run a 4s battery and two BECs, one at 5V for servos, pixhawk, etc, and one at 12V for the Rev P.
Using a Rev C I’d be able to run 3s, and a single BEC at 5V, but sacrificing ambient temp compensation…

Seems that the output voltage of rev. C is not linear with wind speed, according to the descriptions of Modern Devices. So a conversion may be needed.

I wonder is it possible to modify the fimware’s code to accept UART input of wind speed and wind direction. Then, we can use Teensy or Arduino or ESP32 or other develop boards’ ADC channel to read data instead of working on flight controller’s ADC channels.

We do have a dedicated driver which does the none linear conversion.

If you wanted to do something custom you could output the NMEA MWV message over serial.

Thanks for the reply!

I realized that both rev.C’s and rev.P’s output are nonlinear. Seems that rev.C uses a NTC thermosistor? And I don’t know if it runs on constant current mode. If so, the responding time may be much slower than rev.P which runs on constant power mode. And of course using rev.C needs to rewrite the conversion formula.

About the NMEA message, can it be updated separately? For example, if I use analog wind vane for direction (relative), and use a DIY amenometer for air speed which sends NMEA MWV message with wind direction of 0 deg, can FC combine the two data? And what about sending wind vane and wind speed data seperately using NMEA MWV message?

By the way I am also curious about if knowing the water speed is useful for controlling and navigating. And how to measure the water speed.

That should work as expected.

I don’t think this would work, it will always update both values from each message.

We do support NMEA water speed message in the airspeed library (I know its a bit odd place for it). However, it not used internally its only logged reported to the gcs.

1 Like

A thread about water speed logging

1 Like

@iampete , we wish to emit sail AOA as named value float. Therefore we need to have MAV_APPWNDDIR within LUA but as I currently understand MAV_APPWNDDIR is only availeble in GCS? Is there a way to get the real wind direction from the sensor in LUA?