I am currently working on a Drone that navigates to different points that it detects on the ground. To go from one point to another in a smooth manner, I am employing a PID looks at the error between the current and the desired location of the drone. Currently this is a two dimensional problem. Soon enough, it is going to be a three dimensional problem as I will try and have the drone navigate three dimensional spaces. Now I am unsure as to how to program a PID that can take in more than one input and give an two outputs (which are x and y in this case for the Cartesian geometry the drone is trying to navigate).
Can someone take me through the exact theory behind a PID that approaches the 2D problem and different solutions that are possible. I also want to know about any solutions that are present in C++ that can help me speed up creating this program (other languages are also okay, but I am mostly building this project in C++).