Ramune6110 / Inverted-pendulum-LQR

Inverted-pendulum-LQR
0 stars 0 forks source link

ABC Matrix problem #1

Open wumin199 opened 4 years ago

wumin199 commented 4 years ago

in lqr_control.cpp, I think the element of B Matrix is (J + m * pow(l, 2.0)) / alpha, -(m * l) / alpha not (J * m * pow(l, 2.0)) / alpha, -(m * l) / alpha.

Also I think C is a 2 X 4 Matrix , not 1X4 Matrix.

what do you think, please check.

    A << 0, 0, 1, 0,
         0, 0, 0, 1,
         0, -(pow(m, 2.0) * pow(l, 2.0) * g) / alpha, 0, 0,
         0, ((M + m) * m * g * l) / alpha, 0, 0;

    B << 0, 0, (J * m * pow(l, 2.0)) / alpha, -(m * l) / alpha;

    C << 1, 0, 0, 0;

    Q << 10, 0, 0, 0,
         0, 10, 0, 0,
         0, 0, 10, 0,
         0, 0, 0, 10;

    R << 1;

    x << 1, 0, 0, 0;
Ramune6110 commented 4 years ago

Thank you for pointing that out. Matrix B is as you said. I will fix it. As for matrix C, I am assuming that only the position of the bogie can be measured this time. So this time I set matrix C to 1×4. If the matrix C is 2×4, the position of the bogie and the angle of the pendulum are assumed to be measurable. However, I need to verify whether the controllability and observability are measurable or not. If it is, I think the system can be controlled with no problem even if it is modified in that way.

What do you think?