I am building an air propelled hydrofoil that will have four servos controlling wings in the water. It will be remote controlled for lateral movement, but will stabilize itself using Elevon left and right for pitch and roll control. Additionally there is a range finder that is directly underneath the hydrofoil to measure the distance between the bottom of the craft and the top of the water.
I have the range finder working and putting the information into Sonarrange, and the elevon left/right working correctly, moving the servo motors that are controlling the wings in the water for pitch and roll control. However, I want the elevon left/right pwm output to also consider the sonarrange value, and change all four of the servo outputs based on that value in order to also control the height.
Is there an easy way to do this in Ardupilot without lua scripts? Or are lua scripts the only way. Please let me know your thoughts on this. Additionally, if you have any questions understanding what I am trying to do, please let me know. Thank you all for your help!!
I don’t know enough to help with your question but I want to make sure you are aware of the YouTube channel rctestflight. This channel has multiple videos with ArduPilot controlled hydrofoils. I don’t remember if your particular issue as addressed in any of these videos but I do recall multiple videos where ArduPilot settings are discussed.
Your project sure sounds interesting. I hope you share some photos and videos of your project.
Altitude hold with rangefinder as the primary (or sole) source seems like a place to start. I’m not sure if this will work without some additional source modification to prevent excursions or filter the sonar data.
A little searching turns up an article or two about rctestflight. Seems he likely modified the firmware a bit. It’s a cool project that I recall watching a couple of years ago.
Thanks for the reply. I am trying to do this, but the flight controller is not convinced that the range finders distance is the altitude. I have the orientation set to down, and told it to use the range finder as primary vertical source. Is there anything else I need to do for this to work? Thank you
Thank you for the reply. I did send rctestflight an email about this issue. Hoping he has some insight on this. I will share some photos and videos of the project as we get it working.