User Tools

Site Tools


lego_rip

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
lego_rip [2017/05/19 16:18] – [Matlab Code] sangsinparklego_rip [2017/06/15 10:10] (current) – [NXC code for LEGO NXT Brick] sangsinpark
Line 8: Line 8:
 **Date:** Last modified on 05/19/2017 **Date:** Last modified on 05/19/2017
 \\ \\
-**Keywords:** RIP+**Keywords:** Rotary inverted pendulum, LEGO brick, and NXC
 \\ \\
  
Line 36: Line 36:
 {{ lego_rip_v2:rip_equ2.jpg }} {{ lego_rip_v2:rip_equ2.jpg }}
 \\ \\
-  * HW. Derive the kinetic energy.+  * **HW.** Derive the kinetic energy.
 And the potential energy of the system is And the potential energy of the system is
 {{ lego_rip_v2:rip_equ3.jpg }} {{ lego_rip_v2:rip_equ3.jpg }}
Line 53: Line 53:
 {{ lego_rip_v2:rip_equ7.jpg }} {{ lego_rip_v2:rip_equ7.jpg }}
 \\ \\
-  * HW. Linearize the above nonlinear equations by Taylor expansion.+  * **HW.** Linearize the above nonlinear equations by Taylor expansion.
 For state-space representation, the equations are reconstructed. For state-space representation, the equations are reconstructed.
 {{ lego_rip_v2:rip_equ8.jpg }} {{ lego_rip_v2:rip_equ8.jpg }}
Line 70: Line 70:
 {{ lego_rip_v2:rip_equ11.jpg }} {{ lego_rip_v2:rip_equ11.jpg }}
 \\ \\
 +  * **HW.** Derive a transfer function assuming that an output, y, is a α.
 ===== Full state feedback control ===== ===== Full state feedback control =====
  
Line 151: Line 151:
 float d_Pdeg = 0.0; float d_Pdeg = 0.0;
 float M_errSum = 0.0; float M_errSum = 0.0;
-float sum_swingU = 0.0; 
-float prev_xc1 = 0.0; 
-float prev_xc2 = 0.0; 
-float est_Mvel = 0.0; 
-float est_Pvel = 0.0; 
  
 char controlU = 0; char controlU = 0;
Line 166: Line 161:
 { {
    float error = refRad - Mrad;    float error = refRad - Mrad;
-   float U = PGain*error + IGain*M_errSum DGain*d_Mrad;+   float U = PGain*error + IGain*M_errSum DGain*d_Mrad;
  
    if(U > FULL_SPEED)    if(U > FULL_SPEED)
Line 241: Line 236:
 task BalanceControl() task BalanceControl()
 { {
-   // A physical motor rotation direction is reversed as model's rotation direction.+   // A physical motor rotation direction is reversed as model's rotation direction.
    float Gm_p = -(-7.07106781265702);     //Gain on Motor Position    float Gm_p = -(-7.07106781265702);     //Gain on Motor Position
    float Gp_p = -361.604865668371;        //Gain on Pendulum Position    float Gp_p = -361.604865668371;        //Gain on Pendulum Position
lego_rip.1495235896.txt.gz · Last modified: by sangsinpark