lego_rip
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
lego_rip [2017/05/19 16:18] – [NXC code for LEGO NXT Brick] sangsinpark | lego_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: | + | **Keywords: |
\\ | \\ | ||
Line 36: | Line 36: | ||
{{ lego_rip_v2: | {{ lego_rip_v2: | ||
\\ | \\ | ||
- | * HW. Derive the kinetic energy. | + | |
And the potential energy of the system is | And the potential energy of the system is | ||
{{ lego_rip_v2: | {{ lego_rip_v2: | ||
Line 53: | Line 53: | ||
{{ lego_rip_v2: | {{ lego_rip_v2: | ||
\\ | \\ | ||
- | * HW. Linearize the above nonlinear equations by Taylor expansion. | + | |
For state-space representation, | For state-space representation, | ||
{{ lego_rip_v2: | {{ lego_rip_v2: | ||
Line 70: | Line 70: | ||
{{ lego_rip_v2: | {{ lego_rip_v2: | ||
\\ | \\ | ||
+ | * **HW.** Derive a transfer function assuming that an output, y, is a α. | ||
===== Full state feedback control ===== | ===== Full state feedback control ===== | ||
Line 88: | Line 88: | ||
===== LQR for the gains ===== | ===== LQR for the gains ===== | ||
==== Matlab Code ==== | ==== Matlab Code ==== | ||
- | < | + | < |
clear, clc, close all | clear, clc, close all | ||
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 | + | float U = PGain*error + IGain*M_errSum |
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' | + | // A physical motor rotation direction is reversed as a model' |
float Gm_p = -(-7.07106781265702); | float Gm_p = -(-7.07106781265702); | ||
float Gp_p = -361.604865668371; | float Gp_p = -361.604865668371; |
lego_rip.1495235885.txt.gz · Last modified: by sangsinpark