11inline std::tuple<eigen_mat, eigen_mat>
discretize_zoh(
const Eigen::Ref<const eigen_mat> &A,
12 const Eigen::Ref<const eigen_mat> &B,
14 assert(A.rows() == B.rows());
15 auto nx = A.rows(), nu = B.cols();
16 eigen_mat ABOO = eigen_mat::Zero(nx + nu, nx + nu);
17 ABOO.topLeftCorner(nx, nx) = A;
18 ABOO.topRightCorner(nx, nu) = B;
20 return {ABOId.topLeftCorner(nx, nx), ABOId.topRightCorner(nx, nu)};
24discretize_zoh(
const Eigen::Ref<const eigen_mat> &A,
const Eigen::Ref<const eigen_mat> &B,
25 const Eigen::Ref<const eigen_mat> &b, real_t Ts) {
26 assert(A.rows() == B.rows());
27 assert(A.rows() == b.rows());
28 auto nx = A.rows(), nu = B.cols(), nb = b.cols();
29 eigen_mat ABOO = eigen_mat::Zero(nx + nu + nb, nx + nu + nb);
30 ABOO.block(0, 0, nx, nx) = A;
31 ABOO.block(0, nx, nx, nu) = B;
32 ABOO.block(0, nx + nu, nx, nb) = b;
34 return {ABOId.block(0, 0, nx, nx), ABOId.block(0, nx, nx, nu), ABOId.block(0, nx + nu, nx, nb)};