Controll motors with AI

Now I am working on underwater drone project. I am using ardusub system with blueos os. Due to blueos i can use rasp pi 4b 4 ram. I make everything. I works normlaly in manual mode with joystick. But now i am using AI for finding objects and going near this objects. How can I do that ai will controll motors?
Note: Camera connects rasp pi 4b 4ram.

Teach MAVlink to the AI. Either with reinforcement-learning algorithms or with genetic algorithms and SITL.