ODrive S1 Position Control P vs PD Control?


Hello, everyone.
I am controlling the motor using position control (not using filtered input mode), as shown in the picture above. I have set the velocity integrator gain to 0, and I am adjusting only the position gain and velocity gain for control.
One question I have is: in this situation, am I performing P control or PD control? Can I consider the position gain as the P-gain and the velocity gain as the D-gain?

Hi! It’s the same as a PD controller, but with different gain scaling. Specifically:

A PD controller would have the equations:
torque = Kp * pos_error + Kd * d/dt pos_error
Since the derivative of position error is just -velocity (which we’ll call vel_est, for velocity estimate), we can simplify this to:
torque = Kp * pos_error - Kd * vel_est

However, with the cascaded velocity controller, the position controller sets a setpoint (which we’ll call vel_ref) for the velocity controller.

We can say the velocity controller works as:
torque = vel_gain * vel_error + vel_integrator_gain * ∫vel_error
Or, setting vel_integrator_gain to zero and substituting (setpoint-actual) for vel_error, we get:
torque = vel_gain * (vel_ref - vel_est)
Our position controller is simpler, it’s just vel_ref = vel_gain * pos_error

If we substitute, we get:
torque = vel_gain * (pos_gain * pos_error - vel_est)

You can expand this to:
torque = vel_gain * pos_gain * pos_error - vel_gain * vel_est

Now if we compare this to the original PD equation, we can see the differences:
torque = Kp * pos_error - Kd * vel_est

So to transform from “standard” PD coefficients to the cascaded coefficients, you would set:
vel_gain = Kd
pos_gain = Kp/vel_gain

Thank you for your quick response.
Thanks to your explanation, I was able to understand it very easily.

Great to hear! Please let me know if there’s any other way I can help.