Height/altitude control for Hydrofoil-boat

As part of my bachelor thesis I built a small scale hydrofoil boat using 3D printed parts and a CUAV V5+ flight controller for stabilization. The boat can fly stably for a few minutes, which is great, but right now the height is controlled manually through the throttle on my controller (Flysky FS-i6X).

My goal is to add a height sensor so the boat can maintain altitude automatically by adjusting throttle or pitch. I’ve installed a sonar sensor (Pmod MAXSONAR: Maxbotix Ultrasonic) that gives correct readings, but I’ve had trouble getting any altitude hold mode in ArduPlane to work. I also tried a LUA-script on the flight controller, which worked but caused other issues.

I know ArduCopter and ArduRotor include more height control modes. Would it make sense to switch firmware, or would that bring new problems for my hydrofoil?

In this video, RCtestflight used custom ArduPlane code to maintain height (Code found in the comments), but since it was made for a different flight controller I’m not sure how to adapt it. I’ve also seen him using dRehmflight instead of Ardupilot to implement height control.

What do you think is the best way forward for implementing height control on my boat? Any recommendations would be greatly appreciated!!

Picture of the boat:

1 Like

Your hydrofoil boat looks great. I am looking to implement hydrofoils on my model catamaran (Note the pitch control on the rudder) at some point so watching this with interest.
Ardupilot sailboat already uses the Sailboat heel (roll) pid controller which you can see in action here so all that is needed is to re-implement similar for pitch.

Thanks! Ahh okay interesting, your catamaran looks great also

Do you know how to switch source for vertical positioning? Default altitude sensing uses the barometer so we need to change the source to use the height sensor instead. If you haven’t already: set the EK3_SRC1_POSZ source to Option 2: RangeFinder and see if that helps. Since you already have readings from the sensor I assume you have updated the parameter RNGFND1_TYPE to match the Pmod MAXSONAR? Also check your RNGFND1_MIN_CM & RNGFND1_MAX_CM

I would be very careful using rangefinder directly as EKF source as terrain height changes AKA waves may throw EKF off. I would suggest using Lua to adjust target altitude based on lowpass filtered rangefinder data. If you want to use rangefinder directly I would recommend doing tests with baro altitude on a day with maximum acceptable waves and replay logging and testing that EKF behaves correctly using the log replay capabilities (IIRC described in the dev part of the wiki).

1 Like