Overview
I'm trying to levitate a constrained permanent magnet with 2 electromagnets. I'm having trouble conceptualizing the control system for such an operation.
Setup
The permanent magnet is fixed onto a horizontal arm and is repelled by an electromagnet above and repelled by an electromagnet below. The pendulum is attached to a rotary encoder that provides the absolute angle of the pendulum with respect to the horizontal.
Goal
Given a desired angle (relative to the horizontal), I need to change change the voltage going to each electromagnet. For example, if I want the pendulum to be at +X degrees, the control system would increase voltage to the electromagnet below the pendulum and decrease voltage to the electromagnet above the pendulum, resulting in a net upwards force.
Problem
I was advised to use a PID controller. I'd heard of, but never used, a PID controller, so I researched them a bit online, and I understand the general idea--it's just like somebody adjusting water temperature before showering. However, my intuition tells me that I cannot use a single PID loop to control the two electromagnets because I'd be using a single input to solve two outputs. It'd be like saying $$f(x) = y_{1}$$ and $$f(x) = y_{2}$$ where f is a linear function. Since that's not possible for a linear function--and PIDs are linear control systems--then I cannot control 2 motors with a single PID controller.
Am I right? If so, could you point me towards how people have solved similar problems? I feel like this is a common problem with control systems.
If I'm wrong, could you provide an example?
Many thanks!