User Tools

Site Tools


marvin:ecp2

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
marvin:ecp2 [2009/01/29 10:02] riepermarvin:ecp2 [2009/01/29 10:34] rieper
Line 8: Line 8:
 **Duration of activity:** 8-12\\ **Duration of activity:** 8-12\\
 **Participants:** Kasper, Bent and Johnny\\ **Participants:** Kasper, Bent and Johnny\\
 +//Note that we returned to this subject several times during the following lab sessions.//
  
 =====Project Goal===== =====Project Goal=====
Line 20: Line 21:
  
  
-=====Our Angle of Approach Towards Control Theory=====+===== Theory ===== 
 +====Our Angle of Approach Towards Control Theory====
  
-Basically there are three approaches to our control problem, which we will describe briefly in an increasing order of complexity.  The first method requires no more than an intuitive understanding of the tuning parameters in a given control loop as we consider the control plant as a black box. We simply implement a control loop by following the directions of the control loop as indicated in the following section Introducing the PID Controller. In this case we make no attempts to precalculate the stability issues e.g. using bode plots to observe phase margin as a function of our bandwidth. Instead we use a trial and error principle based on our intuitive understanding of the tuning parameters. The problem with this approach is that lack of knowledge about the dynamics of the control plant (the robot) if we do not succeed. We have no theoretical foundation.\\ +Basically there are three approaches to our control problem, which we will describe briefly in an increasing order of complexity.  The first method requires no more than an intuitive understanding of the tuning parameters in a given control loop as we consider the control plant as a black box. We simply implement a control loop by following the directions of the control loop as indicated in the following section [[#Introducing the PID Controller|Introducing the PID Controller]]. In this case we make no attempts to precalculate the stability issues e.g. using bode plots to observe phase margin as a function of our bandwidth. Instead we use a trial and error principle based on our intuitive understanding of the tuning parameters. The problem with this approach is that lack of knowledge about the dynamics of the control plant (the robot) if we do not succeed. We have no theoretical foundation.\\ 
-The second approach is again to consider the control plant as a black box, but here we wish to estimate the characteristic transfer function of the plant. Recall that if we give an impulse to a filter we are given the filter characteristic by means of the impulse response. The analogy to control theory is to apply a step function and observe the transient response, which is illustrated on the figures in the following section Introducing the PID Controller. Depending on the order of the system we may need to apply a ramp or a parabola, but the principle is the same. By observing the rise time and settling time we may be able to estimate the transfer function and thereby to create a more solid foundation as to why the system is unstable and how large bandwidth we can obtain. This method is more complex since we need to be able to measure the transient response, which often requires expensive and precise equipment.\\+The second approach is again to consider the control plant as a black box, but here we wish to estimate the characteristic transfer function of the plant. Recall that if we give an impulse to a filter we are given the filter characteristic by means of the impulse response. The analogy to control theory is to apply a step function and observe the transient response, which is illustrated on the figures in the following section [[#Introducing the PID Controller|Introducing the PID Controller]]. Depending on the order of the system we may need to apply a ramp or a parabola, but the principle is the same. By observing the rise time and settling time we may be able to estimate the transfer function and thereby to create a more solid foundation as to why the system is unstable and how large bandwidth we can obtain. This method is more complex since we need to be able to measure the transient response, which often requires expensive and precise equipment.\\
 The third method is to derive a mathematical model of the dynamics of the control plant and this can be somewhat complex. In the case of a balancing robot it is helpful to look at the mathematical modelling of an inverted pendulum and there next to add the physical dimensions of the balancing robot. When working with modelling we end up with non linear equations, which is a problem as our controllers are linear. One common method is to use the state space representation and then to make a linearization around the steady state point or the equilibrium. If our mathematical model is precise and close to the true physical model we obtain a great theoretical foundation for creating a stable system. This is exactly what Yorihisa Yamamoto(([[http://www.mathworks.com/matlabcentral/fileexchange/19147| Yorihisa Yamamoto's]])) has done and the result is outstanding. In our case however, the modelling is too comprehensive and we have seen several examples that prove a stable balancing robot. We therefore rely on our intuitive understanding and use method one to implement our solution. We have decided to use the PID controller as we have already obtained some practical/intuitive understanding of the tuning parameters during LAB4(([[http://wiki.aasimon.org/?id=marvin:lab4|Lab 4]])). The third method is to derive a mathematical model of the dynamics of the control plant and this can be somewhat complex. In the case of a balancing robot it is helpful to look at the mathematical modelling of an inverted pendulum and there next to add the physical dimensions of the balancing robot. When working with modelling we end up with non linear equations, which is a problem as our controllers are linear. One common method is to use the state space representation and then to make a linearization around the steady state point or the equilibrium. If our mathematical model is precise and close to the true physical model we obtain a great theoretical foundation for creating a stable system. This is exactly what Yorihisa Yamamoto(([[http://www.mathworks.com/matlabcentral/fileexchange/19147| Yorihisa Yamamoto's]])) has done and the result is outstanding. In our case however, the modelling is too comprehensive and we have seen several examples that prove a stable balancing robot. We therefore rely on our intuitive understanding and use method one to implement our solution. We have decided to use the PID controller as we have already obtained some practical/intuitive understanding of the tuning parameters during LAB4(([[http://wiki.aasimon.org/?id=marvin:lab4|Lab 4]])).
  
  
  
-=====Introducing the PID Controller=====+====Introducing the PID Controller====
  
 The digital implementation of a PID controller is actually based on very simple filtering techniques similar to what we described in the [[http://wiki.aasimon.org/?id=marvin:ecp1#implementation|implementation]] section of LAB Session 1. Thus we need a digital filter integration and differentiation technique, which could be a trapezoidal method for integration and backward difference for the differentiation to give an example. The difference equations are used to present the numerical formula and the z-transform of those can then be used to evaluate transfer functions, which are useful to determine the frequency responses. We will not derive these expressions as they can be found in any decent control book. But be aware that we are in the digital domain where we often denote integration by 1/w instead of 1/s as in the continuous domain due to the z-transform, hence the transfer function and the control loop differs between the discrete and continuous domain. The PID control loop can be regarded simply as The digital implementation of a PID controller is actually based on very simple filtering techniques similar to what we described in the [[http://wiki.aasimon.org/?id=marvin:ecp1#implementation|implementation]] section of LAB Session 1. Thus we need a digital filter integration and differentiation technique, which could be a trapezoidal method for integration and backward difference for the differentiation to give an example. The difference equations are used to present the numerical formula and the z-transform of those can then be used to evaluate transfer functions, which are useful to determine the frequency responses. We will not derive these expressions as they can be found in any decent control book. But be aware that we are in the digital domain where we often denote integration by 1/w instead of 1/s as in the continuous domain due to the z-transform, hence the transfer function and the control loop differs between the discrete and continuous domain. The PID control loop can be regarded simply as
Line 130: Line 132:
 Further readings and inspiration are found at "Sensors and Sensing"(([[http://www.cs.brown.edu/people/tld/courses/cs148/02/sensors.html|Sensors and Sensing]])), which was presented in week 3 of the course. Further readings and inspiration are found at "Sensors and Sensing"(([[http://www.cs.brown.edu/people/tld/courses/cs148/02/sensors.html|Sensors and Sensing]])), which was presented in week 3 of the course.
  
-===== Defining the States in the Control Loop =====+==== Defining the States in the Control Loop ====
  
 Now that we have established our choice of control loop, we must determine an error function. In a state space representation this corresponds to determining the states, which are defined through differential equations describing the dynamics of the control plant. Therefore we may turn to the model described in the documentation of Rich Chi Ooi((Balancing a Two-Wheeled Autonomous Robot, Author Rich Chi Ooi, The University of Western Australia Now that we have established our choice of control loop, we must determine an error function. In a state space representation this corresponds to determining the states, which are defined through differential equations describing the dynamics of the control plant. Therefore we may turn to the model described in the documentation of Rich Chi Ooi((Balancing a Two-Wheeled Autonomous Robot, Author Rich Chi Ooi, The University of Western Australia
Line 147: Line 149:
  
  
-===== Parameters and Stability =====+==== Parameters and Stability ====
 The calculation of the right PID control parameters is essential to secure a stable system. This is called loop tuning. If loop tuning is not done according to the task at hand, the control system will become unstable i.e. the output will diverge. Oscillation might occur in this case. The only thing that will prevent divergens or oscillation is saturation or mechanical breakage. This may happen a lot when trying to produce a balancing robot and is generally not a problem due the great structural integrity, however if the controller is to control something else that might not be as rigid as our construction oscillation is always something to avoid in the first place. \\ The calculation of the right PID control parameters is essential to secure a stable system. This is called loop tuning. If loop tuning is not done according to the task at hand, the control system will become unstable i.e. the output will diverge. Oscillation might occur in this case. The only thing that will prevent divergens or oscillation is saturation or mechanical breakage. This may happen a lot when trying to produce a balancing robot and is generally not a problem due the great structural integrity, however if the controller is to control something else that might not be as rigid as our construction oscillation is always something to avoid in the first place. \\
 Loop tuning could be defined as adjusting the control loop parameters (Proportional gain(P), Integral gain (I) and Derivative gain(D)) to the optimum value for a desired control response. The z-transform for the controller should, in order to be stable obey the rules for a stable system, that is poles of the system should be located inside the unity circle, see diagram below. Loop tuning could be defined as adjusting the control loop parameters (Proportional gain(P), Integral gain (I) and Derivative gain(D)) to the optimum value for a desired control response. The z-transform for the controller should, in order to be stable obey the rules for a stable system, that is poles of the system should be located inside the unity circle, see diagram below.
Line 197: Line 199:
  
  
-===== Results =====+===== Implementation =====
 First we present the software implementation, whereafter a short summary of the encountered problems is given. First we present the software implementation, whereafter a short summary of the encountered problems is given.
  
marvin/ecp2.txt · Last modified: 2009/01/29 11:02 by rieper