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/28 23:18] riepermarvin:ecp2 [2009/01/29 10:07] deva
Line 1: Line 1:
- 
 <texit info> <texit info>
 author=Johnny Rieper, Bent Bisballe Nyeng and Kasper Sohn author=Johnny Rieper, Bent Bisballe Nyeng and Kasper Sohn
Line 9: 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 26: Line 26:
 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”. 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=====
Line 126: Line 128:
   goto start   goto start
  </code>  </code>
 +
 +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 =====
Line 148: Line 152:
 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.
  
-(Indsæt billedepole_zero_plot1)+{{ :marvin:ecp2-pole-zero-plot1.jpg? |Pole Zero Plot}}
  
 Poles are represented with a cross and zeros with a circle. The shown diagram has no affiliation with our system. It is just provided as an example. Poles are represented with a cross and zeros with a circle. The shown diagram has no affiliation with our system. It is just provided as an example.
Line 270: Line 274:
  
  
-====Gyro Problemer==== 
-The gyro is an analog sensor so the output is measured by the NXT A/D hardware and the suspicion is that the gyro readings are being influenced by a possible drop in reference voltage in the A/D which is changing the reading. this is backed up by your comments about low batteries.(([[http://forums.nxtasy.org/index.php?showtopic=2217]])) 
- 
-huskeseddel (Johnny):\\ 
-feature extraction, gain control 
-integral, diff, proportional 
-midling af gyrodata - virkede lovende ved stilstand, men hjalp ikke ved test af balanceevne 
-Der blev lavet en lcd-klasse til udskrivning på display 
-Der blev forsøgt med auto kalibrering af gyroscoop ved beregning af varians 
-Der blev forsøgt at kompenserere for gyrobias ved ad hoc metoder 
- 
-Implementerede PID regulering, Ki, Kd, Kc. 
-Afprøvede "Ziegler" tuningsmetoder- Passede ikke overhovedet! 
-Bedste resultat opstod ved fintuning ad hoc, men besværligt fordi, der skal uploades for hver ny indstilling af parametre.  
-Spørgsmål om det er tilstrækkeligt kun at måle på "angle"-værdien..  
-Har tjekket integrations/differentationsmetoder er rigtige.  
  
  
-Balancepunktskalibrering bedre, når Marvin er oprejst end liggende. 
-Problemer med fremad kørsel. Kan dreje og køre baglæns 
  
 +====Hardware Related Issues====
 +At first we experienced severe stability problems as Marvin was highly sensitive to the offset of the gyroscope. The offset calibration did not appear to be stationary and this lead to diverging oscillations, which caused Marvin to crash over and over. (Fortunately the NXT module is quite solid.) We used great effort to find a solution to this problem and though the gyroscope tends to drift over time, we were able to find a stable combination of the tuning parameters causing Marvin to balance for several minutes - using only the tilt angle from the gyroscope and the PID control loop. At this point Marvin was balancing so we tried some preliminary attempts in order for Marvin to move forward/backward. This task was not as easy as expected and therefore the next lab report is devoted to the driving. It is important to notice, that at this point we did not use all the aforementioned states, since all four states contributed to an increasing set of gain combinations - it is not that easy to set all seven gains intuitively! We were only using the integration part of the gyroscope readings, but our suspicion at this point was closing in on the (lack of) states in the control loop. As we finally decided to work with all four states in the control loop, we found a strong combination of the four feedback gains. By adding these extra features we overcame the offset problems of the gyroscope to a satisfying degree. After some longer fine tuning of the parameters, Marvin showed a pretty stable behaviour and hereafter we were confident that he would be able to drive properly. It had to be a matter of finding the right approach, but this problem is addressed in the following lab report. The different attempts to resolve the gyroscope drifting is also adressed in the following lab report.
marvin/ecp2.txt · Last modified: 2009/01/29 11:02 by rieper