16 using std::shared_ptr;
26 template <
typename SCALAR =
double>
36 derivative(0) = state(1);
37 derivative(1) = control(0) - kStiffness * state(0);
44 template <
typename SCALAR =
double>
52 state_control_matrix_t
B_;
74 template <
typename SCALAR =
double>
76 Eigen::Matrix<SCALAR, 2, 1>& x_final)
78 Eigen::Matrix<SCALAR, 2, 2> Q;
81 Eigen::Matrix<SCALAR, 1, 1> R;
87 Eigen::Matrix<SCALAR, 2, 2> Q_final;
88 Q_final << 1000, 0, 0, 1000;
90 std::shared_ptr<TermQuadratic<state_dim, control_dim>> termIntermediate(
92 std::shared_ptr<TermQuadratic<state_dim, control_dim>> termFinal(
95 std::shared_ptr<CostFunctionAnalytical<state_dim, control_dim>> quadraticCostFunction(
97 quadraticCostFunction->addIntermediateTerm(termIntermediate);
98 quadraticCostFunction->addFinalTerm(termFinal);
100 return quadraticCostFunction;
A basic quadratic term of type .
Definition: TermQuadratic.hpp:22
state_matrix_t A_
Definition: LinearOscillator.h:51
ct::core::ControlVector< control_dim > u
Definition: LoadFromFileTest.cpp:21
core::StateMatrix< state_dim, SCALAR > state_matrix_t
Definition: LinearOscillator.h:48
state_control_matrix_t B_
Definition: LinearOscillator.h:52
const size_t state_dim
Definition: ConstraintComparison.h:20
LinearOscillator()
Definition: LinearOscillator.h:30
core::StateControlMatrix< state_dim, control_dim, SCALAR > state_control_matrix_t
Definition: LinearOscillator.h:49
A cost function which contains only terms that have analytical derivatives.
Definition: CostFunctionAnalytical.hpp:31
clear all close all load ct GNMSLog0 mat reformat t
Definition: gnmsPlot.m:6
Definition: LinearOscillator.h:45
LinearOscillatorLinear< SCALAR > * clone() const override
Definition: LinearOscillator.h:70
CppAD::AD< CppAD::cg::CG< double > > SCALAR
std::shared_ptr< CostFunctionQuadratic< state_dim, control_dim, SCALAR > > createCostFunctionLinearOscillator(Eigen::Matrix< SCALAR, 2, 1 > &x_final)
Definition: LinearOscillator.h:75
Definition: LinearOscillator.h:27
const double kStiffness
Definition: SymplecticTest.h:34
ct::core::StateVector< state_dim > x
Definition: LoadFromFileTest.cpp:20
LinearOscillator< SCALAR > * clone() const override
Definition: LinearOscillator.h:40
tpl::LinearOscillator< double > LinearOscillator
Definition: LinearOscillator.h:105
const state_matrix_t & getDerivativeState(const StateVector< state_dim, SCALAR > &x, const ControlVector< control_dim, SCALAR > &u, const SCALAR t=0.0) override
Definition: LinearOscillator.h:54
tpl::LinearOscillatorLinear< double > LinearOscillatorLinear
Definition: LinearOscillator.h:106
void computeControlledDynamics(const StateVector< state_dim, SCALAR > &state, const SCALAR &t, const ControlVector< control_dim, SCALAR > &control, StateVector< state_dim, SCALAR > &derivative) override
Definition: LinearOscillator.h:31
const size_t control_dim
Definition: ConstraintComparison.h:21
Definition: exampleDir.h:9
const state_control_matrix_t & getDerivativeControl(const StateVector< state_dim, SCALAR > &x, const ControlVector< control_dim, SCALAR > &u, const SCALAR t=0.0) override
Definition: LinearOscillator.h:62