29 #include "gtest/gtest.h" 62 Eigen::MatrixXd Q = C.transpose() * C;
63 Eigen::MatrixXd R = Eigen::MatrixXd::Identity(1, 1);
65 EXPECT_TRUE(AlgebraicRiccatiContinuous::isNumericallyStable(A, B, Q, R));
69 bool solve_success = AlgebraicRiccatiContinuous::solve(A, B, Q, R, X, &G);
70 EXPECT_TRUE(solve_success);
72 Eigen::Matrix2d X_sol;
73 X_sol << 0.2949, 0.5199, 0.5199, 3.0198;
77 Eigen::MatrixXd G_sol(1, 2);
78 G_sol << 0.519862500040767, 3.019764837837087;
82 EXPECT_TRUE(AlgebraicRiccatiContinuous::isClosedLoopStable(A, B, G));
88 A << -8, -19, -22, -10, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0;
96 Eigen::MatrixXd Q = C.transpose() * C;
98 Eigen::MatrixXd R(1, 1);
101 EXPECT_TRUE(AlgebraicRiccatiContinuous::isNumericallyStable(A, B, Q, R));
105 bool solve_success = AlgebraicRiccatiContinuous::solve(A, B, Q, R, X, &G);
106 EXPECT_TRUE(solve_success);
108 Eigen::Matrix4d X_sol;
109 X_sol << 0.0029, 0.0234, 0.0538, 0.0499, 0.0234, 0.1889, 0.4445, 0.4288, 0.0538, 0.4445, 1.1076, 1.1833, 0.0499, 0.4288, 1.1833, 1.6375;
113 Eigen::MatrixXd G_sol(1, 4);
114 G_sol << 0.001461438418027, 0.011692575245343, 0.026875649174793, 0.024968827881711;
118 EXPECT_TRUE(AlgebraicRiccatiContinuous::isClosedLoopStable(A, B, G));
124 A << 6, -5, -2, 10, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0;
132 Eigen::MatrixXd Q = C.transpose() * C;
134 Eigen::MatrixXd R(1, 1);
137 EXPECT_TRUE(AlgebraicRiccatiContinuous::isNumericallyStable(A, B, Q, R));
141 bool solve_success = AlgebraicRiccatiContinuous::solve(A, B, Q, R, X, &G);
142 EXPECT_TRUE(solve_success);
144 Eigen::Matrix4d X_sol;
145 X_sol << 28.0029, 28.0234, 40.0538, 40.0499, 28.0234, 324.1889, 336.4445, 40.4288, 40.0538, 336.4445, 777.1076, 481.1833, 40.0499, 40.4288,
150 Eigen::MatrixXd G_sol(1, 4);
151 G_sol << 14.001461438418874, 14.011692575248027, 20.026875649177440, 20.024968827882546;
155 EXPECT_TRUE(AlgebraicRiccatiContinuous::isClosedLoopStable(A, B, G));
161 A << 0, 1.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.0, 0, 0, 21.9524, -0.1348;
164 B << 0, 1.0, 0, 2.2385;
167 C << 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1;
170 Q << 35, 0, 0, 0, 0, 1, 0, 0, 0, 0, 5, 0, 0, 0, 0, 35;
172 Eigen::MatrixXd R(1, 1);
177 bool solve_success = AlgebraicRiccatiContinuous::solve(A, B, Q, R, X, &G);
178 EXPECT_TRUE(solve_success);
180 Eigen::Matrix4d X_sol;
181 X_sol << 37.1092, 19.1727, -57.065, -9.4007, 19.1727, 14.5091, -50.7528, -7.3677, -57.065, -50.7528, 231.2142, 27.6002, -9.4007, -7.3677, 27.6002,
187 Eigen::MatrixXd G_sol(1, 4);
188 G_sol << -18.7083, -19.8357, 110.3077, 29.8251;
192 EXPECT_TRUE(AlgebraicRiccatiContinuous::isClosedLoopStable(A, B, G));
198 A << 0, 0, 0, 0, 1.0, 0, 0, 0, 0, 0, 0, 21.0524, 0, 0, 1, -0.1348;
201 B << 0, 1.0, 0, 2.2385;
204 Q << 35, 0, 0, 0, 0, 1, 0, 0, 0, 0, 5, 0, 0, 0, 0, 35;
206 Eigen::MatrixXd R(1, 1);
209 EXPECT_FALSE(AlgebraicRiccatiContinuous::isNumericallyStable(A, B, Q, R));
TestAlgebraicRiccatiContinuous()
MatrixType A(a, *n, *n, *lda)
virtual ~TestAlgebraicRiccatiContinuous()
MatrixType B(b, *n, *nrhs, *ldb)
#define EXPECT_EQ_MATRIX(A, B, tol)
Methods for dealing with continuous-time algebraic Riccati equations.
TEST_F(TestAlgebraicRiccatiContinuous, solve_feasible_2d_stable_real)