[Seeking advice] PID using a fiducial tag as feedback, not the encoder

Hi All,

I am interested in using Odrive for a closed loop application but am having toruble thinknig through something.

I am building a 2d gantry that follows an apriltag ( Demo of April Tag Localization System - YouTube).

So the feedback system will be the position of the apriltag relative to the camera attached to my 2D gantry. It will Not be the encoder on the Odrive. I am having trouble wrapping my head around how to implement an accurate control algorithm.

I was looking for any advice you might have for this. Should I implement my own PID controller where the feedback input is tag position, and the output is motor velocity? Should I Just calculate the distance and give a position command to the odrive controller?

Happy to answer any questions you may have! Thanks so much, this looks like a fantastic community!

What you describe is called “Visual Servoing” and is becoming quite a popular subject in robotics :slight_smile:
Normally, this is applied as a ‘correction’ offset to the position command, by an external loop. But for high-performance (fast/agile/animal-like) robots, you may want to bypass all the joint-based PID loops and control torque on each joint at a high rate from a model-predictive controller (MPC), which is aware of the physics between joints, as well as the effect of the load on each joint’s inertia, etc.
The relation between ‘forces’ at the end-effector and ‘torques’ at each joint of a ‘series manipulator’ aka a standard robot arm, can be found by taking the ‘Jacobian’ of the kinematic chain of coordinate transforms which desribes the robot.

Of course, for a Syncronous Motor (including any Brushless DC Motor) to produce a controllable torque, you still need an encoder.
Even in current mode (aka torque mode) you need an encoder (preferably a fast, high-resolution encoder) to know how to translate a 1-dimensional torque demand into the 2-dimensional current demand needed for a 3-phase synchronous motor.