Gimbal-mounted FPV camera with point and track function

As an FPV pilot, I wanted to be able to designate a point of interest via a gimbal-controlled camera view and have the aircraft automatically fly toward the target and then orbit it, all while maintaining a view of that target. Since I couldn’t find a function in ArduPlane that met this need, I developed this script. While ArduPlane does have a “Mount POI Lock function” - which works very well for keeping the target in the camera’s view - it doesn’t control the aircraft itself to free the pilot from the task of manually targeting and circling the target. That is precisely what this script offers. Some high-end gimbals might offer this type of functionality, but not all hobbyists like me have the means to afford them. Of course, this script has certain limitations. For example, due to trigonometric calculations, the closer the camera is oriented toward the horizon, the more accuracy decreases—to the point where, beyond a certain limit, the results are no longer truly usable. That is why the script includes a minimum angle parameter. The script has been flight-tested with an XF Robot C20D (2-axis) gimbal but it is designed to work with a 3-axis gimbal as well. I believe the script should work with any gimbal, given that no proprietary APIs were used. The entire script logic relies on the native mount:get_attitude_euler(0) function and other standard ArduPilot functions. As for the obscure mathematical calculations—since I’m not very gifted in that area—I enlisted the help of AI.

The plane I used to test this script is a ZOHD Altus VTOL with a XFRobot C20T (2 axis gimball) and a DJI O4 Pro camera mounted on a self made Altus Nose. You can see it here : Thingiverse - The community for Open Hardware

I have put a great deal of time and effort into this, so if you use this script, please let me know how it works for you. Furthermore, I would be very proud if the ArduPilot development team deemed it useful to integrate this function—and use all or part of my code—into future versions of ArduPlane.

Script and info can be found here : GitHub - axelisart/ardupilot-gimbal-poi-tracker: ArduPlane 4.7 Lua script — automatic POI tracking with CADDX gimbal · GitHub

Demo video : https://youtu.be/RbMBZhsmI9k

This looks like something I was trying to do with circle flight mode + POI lock + “Make Mount ROI the center of the circle” options.