Skip to main content
edited body
Source Link
Ugo Pattacini
  • 4k
  • 1
  • 15
  • 36

First comment, the equation you gave for your PID seems a bit weird. The PID normally acts to steer an error, let's say $e_{\theta}=\theta_d-\theta$, to zero, where $\theta_d\left(t\right)$ is your set-point, possibly varying, and $\theta\left(t\right)$ is the current feedback.

If we always assume $\theta_d=0$ - is this your task? -, then you have to consider the right sign for the feedback, i.e. $-\theta$, since usually the PID gains are deemed to be positive. This way though, you'll prevent yourself from having fun while trying to stabilize the pole in non-upright positions (i.e. $\theta_d \neq 0$, wherein the linearization does not hold).

What is missing is to make the dynamic equation of linear motion explicit, that is something like $\ddot{x}=f\left(x,u,d_l,t\right)$$\ddot{x}=f\left(x,u,d_x,t\right)$, where $u$ is the motor torque and $d_l$$d_x$ are other type of disturbances (e.g. friction forces) acting on the system. You could plug this second equation in the first one coming up with a new PID whose output is directly $u$ and no longer $\ddot{x}$, changing thus the input to the system.

You might describe the function $f\left(\cdot\right)$ in terms of what you know about the system (e.g. wheels geometry to transform torque into force, motors' parameters to deal with transformation of voltage/current into mechanical torque), providing therefore a feed-forward term to help the PID do its job or even let the PID work alone in the closed-loop.

Another possibility is to replace the single PID scheme with a cascade of a inner loop where you control $\ddot{x}$ through the first PID (you have somehow to measure/estimate the linear acceleration), and an outer loop that finally controls the angular position of the pole by means of a second PID. Anyway, two PIDs means more gains to fine tune. You may also want to identify $f$ via proper identification techniques.

As a side note, one effective way to deal with all the disturbances and uncertainties you have in the real system that are not taken into account in the model is to resort to sliding mode control.

Finally, I'd really suggest you to search in literature: there are plenty of methods and models out of the box for you to read and use for such a classical control problem.

First comment, the equation you gave for your PID seems a bit weird. The PID normally acts to steer an error, let's say $e_{\theta}=\theta_d-\theta$, to zero, where $\theta_d\left(t\right)$ is your set-point, possibly varying, and $\theta\left(t\right)$ is the current feedback.

If we always assume $\theta_d=0$ - is this your task? -, then you have to consider the right sign for the feedback, i.e. $-\theta$, since usually the PID gains are deemed to be positive. This way though, you'll prevent yourself from having fun while trying to stabilize the pole in non-upright positions (i.e. $\theta_d \neq 0$, wherein the linearization does not hold).

What is missing is to make the dynamic equation of linear motion explicit, that is something like $\ddot{x}=f\left(x,u,d_l,t\right)$, where $u$ is the motor torque and $d_l$ are other type of disturbances (e.g. friction forces) acting on the system. You could plug this second equation in the first one coming up with a new PID whose output is directly $u$ and no longer $\ddot{x}$, changing thus the input to the system.

You might describe the function $f\left(\cdot\right)$ in terms of what you know about the system (e.g. wheels geometry to transform torque into force, motors' parameters to deal with transformation of voltage/current into mechanical torque), providing therefore a feed-forward term to help the PID do its job or even let the PID work alone in the closed-loop.

Another possibility is to replace the single PID scheme with a cascade of a inner loop where you control $\ddot{x}$ through the first PID (you have somehow to measure/estimate the linear acceleration), and an outer loop that finally controls the angular position of the pole by means of a second PID. Anyway, two PIDs means more gains to fine tune. You may also want to identify $f$ via proper identification techniques.

As a side note, one effective way to deal with all the disturbances and uncertainties you have in the real system that are not taken into account in the model is to resort to sliding mode control.

Finally, I'd really suggest you to search in literature: there are plenty of methods and models out of the box for you to read and use for such a classical control problem.

First comment, the equation you gave for your PID seems a bit weird. The PID normally acts to steer an error, let's say $e_{\theta}=\theta_d-\theta$, to zero, where $\theta_d\left(t\right)$ is your set-point, possibly varying, and $\theta\left(t\right)$ is the current feedback.

If we always assume $\theta_d=0$ - is this your task? -, then you have to consider the right sign for the feedback, i.e. $-\theta$, since usually the PID gains are deemed to be positive. This way though, you'll prevent yourself from having fun while trying to stabilize the pole in non-upright positions (i.e. $\theta_d \neq 0$, wherein the linearization does not hold).

What is missing is to make the dynamic equation of linear motion explicit, that is something like $\ddot{x}=f\left(x,u,d_x,t\right)$, where $u$ is the motor torque and $d_x$ are other type of disturbances (e.g. friction forces) acting on the system. You could plug this second equation in the first one coming up with a new PID whose output is directly $u$ and no longer $\ddot{x}$, changing thus the input to the system.

You might describe the function $f\left(\cdot\right)$ in terms of what you know about the system (e.g. wheels geometry to transform torque into force, motors' parameters to deal with transformation of voltage/current into mechanical torque), providing therefore a feed-forward term to help the PID do its job or even let the PID work alone in the closed-loop.

Another possibility is to replace the single PID scheme with a cascade of a inner loop where you control $\ddot{x}$ through the first PID (you have somehow to measure/estimate the linear acceleration), and an outer loop that finally controls the angular position of the pole by means of a second PID. Anyway, two PIDs means more gains to fine tune. You may also want to identify $f$ via proper identification techniques.

As a side note, one effective way to deal with all the disturbances and uncertainties you have in the real system that are not taken into account in the model is to resort to sliding mode control.

Finally, I'd really suggest you to search in literature: there are plenty of methods and models out of the box for you to read and use for such a classical control problem.

Source Link
Ugo Pattacini
  • 4k
  • 1
  • 15
  • 36

First comment, the equation you gave for your PID seems a bit weird. The PID normally acts to steer an error, let's say $e_{\theta}=\theta_d-\theta$, to zero, where $\theta_d\left(t\right)$ is your set-point, possibly varying, and $\theta\left(t\right)$ is the current feedback.

If we always assume $\theta_d=0$ - is this your task? -, then you have to consider the right sign for the feedback, i.e. $-\theta$, since usually the PID gains are deemed to be positive. This way though, you'll prevent yourself from having fun while trying to stabilize the pole in non-upright positions (i.e. $\theta_d \neq 0$, wherein the linearization does not hold).

What is missing is to make the dynamic equation of linear motion explicit, that is something like $\ddot{x}=f\left(x,u,d_l,t\right)$, where $u$ is the motor torque and $d_l$ are other type of disturbances (e.g. friction forces) acting on the system. You could plug this second equation in the first one coming up with a new PID whose output is directly $u$ and no longer $\ddot{x}$, changing thus the input to the system.

You might describe the function $f\left(\cdot\right)$ in terms of what you know about the system (e.g. wheels geometry to transform torque into force, motors' parameters to deal with transformation of voltage/current into mechanical torque), providing therefore a feed-forward term to help the PID do its job or even let the PID work alone in the closed-loop.

Another possibility is to replace the single PID scheme with a cascade of a inner loop where you control $\ddot{x}$ through the first PID (you have somehow to measure/estimate the linear acceleration), and an outer loop that finally controls the angular position of the pole by means of a second PID. Anyway, two PIDs means more gains to fine tune. You may also want to identify $f$ via proper identification techniques.

As a side note, one effective way to deal with all the disturbances and uncertainties you have in the real system that are not taken into account in the model is to resort to sliding mode control.

Finally, I'd really suggest you to search in literature: there are plenty of methods and models out of the box for you to read and use for such a classical control problem.