pid_vs_lqr_ballandbeam
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
pid_vs_lqr_ballandbeam [2016/02/15 01:26] – joaomatos | pid_vs_lqr_ballandbeam [2016/07/13 14:59] (current) – joaomatos | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | **SUMMARY** | + | ===== Lego Ball and Beam ===== |
+ | **Keywords:**Lego, | ||
- | PID CONTROL: | ||
- | #1:Ball and Beam Transfer Function Derivation. | ||
- | #2:Motor Transfer Function Derivation. | ||
- | #3:Motor system modeling on Simulink. | ||
- | # | ||
- | #5:Working Video / Simulating Disturbance. | ||
- | # | ||
- | #7:NXT CODE. | ||
- | LQR CONTROL: | + | ---- |
- | #8:State Space representation. | + | |
- | #9:Motor Parameters. | + | |
- | #10:LQR [A], | + | |
- | #11:Matlab code to find [K] matrix. | + | |
- | #12:LQR Control results. | + | |
- | + | ||
- | PID VS LQR CONTROL: | + | |
- | #13:PID vs LQR Control results. | + | |
- | . | + | |
- | + | ||
- | . | + | |
- | ** __PID CONTROL__ ** | + | |
- | We can analyze the whole system into two distinct transfer functions , one for the ball and beam , and one for the motor. After , we can analyze the whole system putting these two transfer functions together in a block diagram. | + | ===== Motivation |
- | ** __Ball | + | Motivation |
- | {{ :: | + | |
- | | ||
- | | + | .Automatic Controls Theory |
- | + | ||
- | | + | |
- | + | ||
- | | + | |
- | + | ||
- | + | ||
- | ** __Motor Transfer Function Derivation__ ** | + | |
- | + | ||
- | One easy way to get the motor' | + | |
- | + | ||
- | {{:: | + | |
- | + | ||
- | | + | |
- | + | ||
- | | + | |
- | + | ||
- | By the graphic response , we can assume the motor system as a second order system (because of the oscillatory | + | |
- | | + | .Controls Programming using lego NXT Brick (NXC language). |
- | | + | .Controls Programming using Matlab. |
- | + | ||
- | | + | |
- | + | ||
- | We know that a second order transfer function is: | + | |
- | | ||
- | So the motor' | + | ---- |
- | + | ||
- | | + | |
- | ** __Motor system modeling on Simulink__ ** | + | ===== Parts List and Source ===== |
- | We can simulate the motor system on Simulink and compare the result to the experimental result , to verify if the derivation is correct. | + | [[ballandbeam_parts|Parts List]] |
- | | ||
- | | ||
- | | + | ---- |
- | ** __SIMULATING THE WHOLE SYSTEM WITH PID CONTROL__ ** | + | ===== Construction Instructions ===== |
- | We can simulate the whole system using the ball and beam together with the motor' | + | {{:: |
- | | ||
- | | + | ---- |
- | | + | ===== System Modeling ===== |
- | | + | . [[ballandbeam_modelling|System Modeling.]] |
- | | ||
- | | + | ---- |
- | ** Working Video / Simulating Disturbance ** | + | ===== Programming ===== |
- | | + | . [[ballandbeam_code|Programming]] |
- | On the video ,was simulated first a heavy disturbance , and then two small disturbances. | ||
- | ** Comparison Simulink vs Real System ** | + | ---- |
- | | ||
- | | ||
- | ** NXT CODE ** | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | ** TUNING THE CODE ** | ||
- | |||
- | After introducing the file saving function and the necessary commands to get the data , the system response was slowed down. ( oscillating more than before ). So i made some tuning: | ||
- | * KP=1 and KD=0.60 | ||
- | * No waiting time inside the if statements | ||
- | * 50ms waiting before starting the control loop again. | ||
- | |||
- | The new result is: | ||
- | |||
- | | ||
- | |||
- | | ||
- | |||
- | . | ||
- | |||
- | . | ||
- | |||
- | ** __LQR CONTROL__ ** | ||
- | |||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | |||
- | . | ||
- | |||
- | . | ||
- | |||
- | ** __PID VS LQR CONTROL__ ** | ||
- | |||
- | | ||
- | |||
- | *note here that both methods can show pretty similar results , hand-tuning the gains after the initial guess. The PID version of the controler was intended to stop the ball fast , the LQR version of the controller was intended to stop the ball without overshooting too much. Again , both methods can be adjusted to control the overshoot or the rise time. | ||
- | |||
- | | ||
- | |||
- | | ||
- | |||
- |
pid_vs_lqr_ballandbeam.1455528375.txt.gz · Last modified: by joaomatos