17 void dmcopy(
int row,
int col,
double* A,
int lda,
double* B,
int ldb)
20 for (j = 0; j < col; j++)
22 for (i = 0; i < row; i++)
24 B[i + j * ldb] = A[i + j * lda];
32 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
36 static const int pp = state_dim / 2;
44 Eigen::Matrix<double, pp, pp> TEigen;
47 double* T = TEigen.data();
49 for (ii = 0; ii < pp; ii++)
50 T[ii * (pp + 1)] = -2;
51 for (ii = 0; ii < pp - 1; ii++)
52 T[ii * (pp + 1) + 1] = 1;
53 for (ii = 1; ii < pp; ii++)
54 T[ii * (pp + 1) - 1] = 1;
56 Eigen::Matrix<double, pp, pp> ZEigen;
58 double*
Z = ZEigen.data();
60 Eigen::Matrix<double, pp, pp> IEigen;
62 double* I = IEigen.data();
64 double* Ac = A_.data();
65 dmcopy(pp, pp, Z, pp, Ac, state_dim);
66 dmcopy(pp, pp, T, pp, Ac + pp, state_dim);
67 dmcopy(pp, pp, I, pp, Ac + pp * state_dim, state_dim);
68 dmcopy(pp, pp, Z, pp, Ac + pp * (state_dim + 1), state_dim);
70 Eigen::Matrix<double, control_dim, control_dim> InuEigen;
71 InuEigen.setIdentity();
72 double* Inu = InuEigen.data();
74 double* Bc = B_.data();
75 dmcopy(control_dim, control_dim, Inu, control_dim, Bc + pp, state_dim);
81 const double t = 0.0)
override 88 const double t = 0.0)
override 106 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
114 b_ << 0.145798, 0.150018, 0.150018, 0.145798, 0.245798, 0.200018, 0.200018, 0.245798;
116 static const int pp = state_dim / 2;
118 Eigen::Matrix<double, pp, pp> TEigen;
121 double* T = TEigen.data();
123 for (ii = 0; ii < pp; ii++)
124 T[ii * (pp + 1)] = -2;
125 for (ii = 0; ii < pp - 1; ii++)
126 T[ii * (pp + 1) + 1] = 1;
127 for (ii = 1; ii < pp; ii++)
128 T[ii * (pp + 1) - 1] = 1;
130 Eigen::Matrix<double, pp, pp> ZEigen;
132 double*
Z = ZEigen.data();
134 Eigen::Matrix<double, pp, pp> IEigen;
135 IEigen.setIdentity();
136 double* I = IEigen.data();
138 double* Ac = A_.data();
139 dmcopy(pp, pp, Z, pp, Ac, state_dim);
140 dmcopy(pp, pp, T, pp, Ac + pp, state_dim);
141 dmcopy(pp, pp, I, pp, Ac + pp * state_dim, state_dim);
142 dmcopy(pp, pp, Z, pp, Ac + pp * (state_dim + 1), state_dim);
144 Eigen::Matrix<double, control_dim, control_dim> InuEigen;
145 InuEigen.setIdentity();
146 double* Inu = InuEigen.data();
148 double* Bc = B_.data();
149 dmcopy(control_dim, control_dim, Inu, control_dim, Bc + pp, state_dim);
158 derivative = A_ * state + B_ * control + b_;
EIGEN_MAKE_ALIGNED_OPERATOR_NEW LinkedMasses2()
Definition: LinkedMasses.h:108
LinkedMasses()
Definition: LinkedMasses.h:38
void dmcopy(int row, int col, double *A, int lda, double *B, int ldb)
Definition: LinkedMasses.h:17
ct::core::ControlVector< control_dim > u
Definition: LoadFromFileTest.cpp:21
void computeControlledDynamics(const ct::core::StateVector< state_dim > &state, const double &t, const ct::core::ControlVector< control_dim > &control, ct::core::StateVector< state_dim > &derivative) override
Definition: LinkedMasses.h:153
const size_t state_dim
Definition: ConstraintExampleOutput.cpp:17
clear all close all load ct GNMSLog0 mat reformat t
Definition: gnmsPlot.m:6
for i
Definition: mpc_unittest_plotting.m:14
ct::core::StateVector< state_dim > x
Definition: LoadFromFileTest.cpp:20
const state_matrix_t & getDerivativeState(const StateVector< state_dim > &x, const ControlVector< control_dim > &u, const double t=0.0) override
Definition: LinkedMasses.h:79
Definition: LinkedMasses.h:29
LinkedMasses2 * clone() const override
Definition: LinkedMasses.h:152
const state_control_matrix_t & getDerivativeControl(const StateVector< state_dim > &x, const ControlVector< control_dim > &u, const double t=0.0) override
Definition: LinkedMasses.h:86
LinkedMasses * clone() const override
Definition: LinkedMasses.h:93
Definition: LinkedMasses.h:100
const size_t control_dim
Definition: ConstraintExampleOutput.cpp:18