|
Revision 586, 0.5 kB
(checked in by smidl, 16 years ago)
|
|
redesign of ctrl LQ control for arx
|
| Line | |
|---|
| 1 | #define BDMLIB |
|---|
| 2 | #include "UnitTest++.h" |
|---|
| 3 | #include "design/ctrlbase.h" |
|---|
| 4 | |
|---|
| 5 | using namespace bdm; |
|---|
| 6 | |
|---|
| 7 | TEST(test_LQG) { |
|---|
| 8 | LQG reg; |
|---|
| 9 | shared_ptr<StateSpace<fsqmat> > stsp=new StateSpace<fsqmat>; |
|---|
| 10 | // 2 x 1 x 1 |
|---|
| 11 | stsp-> set_parameters(eye(2), ones(2,1), ones(1,2), ones(1,1), /* Q,R */ eye(2), eye(1)); |
|---|
| 12 | reg.set_system(stsp); // A, B, C |
|---|
| 13 | reg.set_control_parameters(eye(1), eye(1), vec_1(1.0), 6); //Qy, Qu, horizon |
|---|
| 14 | |
|---|
| 15 | reg.redesign(); |
|---|
| 16 | CHECK_CLOSE(reg.apply("0.5, 1.1","0.0")(0) /*convert vec to double*/, -0.248528137234392, 0.0001); |
|---|
| 17 | } |
|---|