I am trying to implement cascaded control system, with velocity inner loop and position outer loop.

Separately and without cascaded control, I have implemented position control and velocity control easily, thanks to the "pid library."

I have no idea how to convert position output from position pid to reference velocity.

Any help would be appreciated, since I am blank on this topic. Thanks and best regards

enter image description here


This is not an Arduino specific topic, but here is just a pragmatic answer:

Use the output of the PID controller directly as your reference velocity, subtract your actual velocity and use it as input for the PID velocity. Units do not care in this case.

You have to make sure that the paramters of your PID position are well adjusted, this will set the problem with the units.

Here is an example to understand (only P gain considered):

If you want to drive from A to B with your car and the distance from A to B is 10 km, then your desired position is 10km and i would choose to drive about 100km/h. So in this example you start with a control deviation of 10km - 0km = 10km. If you choose a P gain of 10 the output of the PID will be 100, which is an ideal refernce Velocity, if velocity is given in km/h.

But if you are measuring your distance not in km but in m, the control deviation will be (10.000m - 0m = 10.000m), with a P gain of 10 you will end up with a refernce velocity of 100.000km/h, which is not an appropriate reference velocity in this case.

Now someone may object that in my example if you want do drive from A to C and C is 1.000km away, you will end up with an reference velocity of 10.000km/h, which is also not appropriate, but that is where the limitations in a PID controller are usefull, just set them for this example to 130km/h and you will end up stil with an appropriate reference velocity, and also your integrator part will not wind up endlessly.

You can look at I and D gain in a similar manner.

  • Yeah I got it thanks – Syed Tirmizi Mar 13 at 5:01
  • @SyedTirmizi you are welcome, I hope your system works. :-) – RJPlog Mar 13 at 20:11

Not the answer you're looking for? Browse other questions tagged or ask your own question.