29 #include "gtest/gtest.h" 54 A << -0.05, 0.05, 1, 0;
62 Eigen::MatrixXd Q = C.transpose() * C;
63 Eigen::MatrixXd R(1, 1);
68 bool solve_success = AlgebraicRiccatiDiscrete::solve(A, B, Q, R, X, &G);
69 EXPECT_TRUE(solve_success);
71 Eigen::Matrix2d X_sol;
72 X_sol << 1.0026, -0.0013, -0.0013, 1.0013;
76 Eigen::MatrixXd G_sol(1, 2);
77 G_sol << -0.025673043427904, 0.025032039904055;
81 EXPECT_TRUE(AlgebraicRiccatiDiscrete::isClosedLoopStable(A, B, G));
87 A << -0.05, -0.2, -0.0125, 0.0125, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0;
95 Eigen::MatrixXd Q = C.transpose() * C;
97 Eigen::MatrixXd R(1, 1);
102 bool solve_success = AlgebraicRiccatiDiscrete::solve(A, B, Q, R, X, &G);
103 EXPECT_TRUE(solve_success);
105 Eigen::Matrix4d X_sol;
106 X_sol << 1.0289, 0.0075, -0.0013, -0.0004, 0.0075, 1.0277, 0.0016, -0.0017, -0.0013, 0.0016, 1.0002, -0.0001, -0.0004, -0.0017, -0.0001, 1.0001;
110 Eigen::MatrixXd G_sol(1, 4);
111 G_sol << -0.014509214644181, -0.068380590003095, -0.004366017750237, 0.004246262501251;
115 EXPECT_TRUE(AlgebraicRiccatiDiscrete::isClosedLoopStable(A, B, G));
121 A << -1.5, -1.32, 3.742, 2.076, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0;
129 Eigen::MatrixXd Q = C.transpose() * C;
131 Eigen::MatrixXd R(1, 1);
136 bool solve_success = AlgebraicRiccatiDiscrete::solve(A, B, Q, R, X, &G);
137 EXPECT_TRUE(solve_success);
139 Eigen::Matrix4d X_sol;
140 X_sol << 33.8189, 7.5236, -14.3996, -5.0081, 7.5236, 32.4107, 0.1086, -6.8438, -14.3996, 0.1086, 32.7867, 14.0887, -5.0081, -6.8438, 14.0887,
145 Eigen::MatrixXd G_sol(1, 4);
146 G_sol << -1.206200888594686, -1.648306965169984, 3.393241337036358, 1.960083490678313;
150 EXPECT_TRUE(AlgebraicRiccatiDiscrete::isClosedLoopStable(A, B, G));
virtual ~TestAlgebraicRiccatiDiscrete()
TestAlgebraicRiccatiDiscrete()
MatrixType A(a, *n, *n, *lda)
TEST_F(TestAlgebraicRiccatiDiscrete, solve_feasible_2d_stable_real)
MatrixType B(b, *n, *nrhs, *ldb)
#define EXPECT_EQ_MATRIX(A, B, tol)
Methods for dealing with discrete-time algebraic Riccati equations.