Creating a custom mode that available to set acceleration and velocity on 3d

Hello everyone. I need to control a plane with ArduPilot. My python script calculates acceleration and velocities to chase another plane according to camera data. I need to set acceleration on 3d (x-y-z). But you know, ArduPlane doesn’t have a feature that make my wish possible. So, I need to create a custom mode that available to set acceleration and velocity. How can I do that? Which controllers should I use in this mode and how to use them?
If you don’t know how to do that, do you know any instruction document or video to create a new mode for plane?
Thanks in advance.