11 template <
size_t STATE_DIM,
size_t CONTROL_DIM,
typename SCALAR_EVAL,
typename SCALAR>
18 template <
size_t STATE_DIM,
size_t CONTROL_DIM,
typename SCALAR_EVAL,
typename SCALAR>
26 template <
size_t STATE_DIM,
size_t CONTROL_DIM,
typename SCALAR_EVAL,
typename SCALAR>
34 template <
size_t STATE_DIM,
size_t CONTROL_DIM,
typename SCALAR_EVAL,
typename SCALAR>
41 template <
size_t STATE_DIM,
size_t CONTROL_DIM,
typename SCALAR_EVAL,
typename SCALAR>
48 template <
size_t STATE_DIM,
size_t CONTROL_DIM,
typename SCALAR_EVAL,
typename SCALAR>
53 template <
size_t STATE_DIM,
size_t CONTROL_DIM,
typename SCALAR_EVAL,
typename SCALAR>
56 P_ = P.template cast<SCALAR_EVAL>();
59 template <
size_t STATE_DIM,
size_t CONTROL_DIM,
typename SCALAR_EVAL,
typename SCALAR>
64 x_ref_ = x_ref.template cast<SCALAR_EVAL>();
65 u_ref_ = u_ref.template cast<SCALAR_EVAL>();
68 template <
size_t STATE_DIM,
size_t CONTROL_DIM,
typename SCALAR_EVAL,
typename SCALAR>
70 const Eigen::Matrix<SCALAR, CONTROL_DIM, 1>&
u,
73 return evalLocal<SCALAR>(
x,
u,
t);
77 template <
size_t STATE_DIM,
size_t CONTROL_DIM,
typename SCALAR_EVAL,
typename SCALAR>
81 ct::core::ADCGScalar
t)
83 return evalLocal<ct::core::ADCGScalar>(
x,
u,
t);
87 template <
size_t STATE_DIM,
size_t CONTROL_DIM,
typename SCALAR_EVAL,
typename SCALAR>
95 return P_.transpose() * uDiff;
98 template <
size_t STATE_DIM,
size_t CONTROL_DIM,
typename SCALAR_EVAL,
typename SCALAR>
103 const SCALAR_EVAL& t)
105 return state_matrix_t::Zero();
108 template <
size_t STATE_DIM,
size_t CONTROL_DIM,
typename SCALAR_EVAL,
typename SCALAR>
112 const SCALAR_EVAL& t)
119 template <
size_t STATE_DIM,
size_t CONTROL_DIM,
typename SCALAR_EVAL,
typename SCALAR>
124 const SCALAR_EVAL& t)
126 return control_matrix_t::Zero();
129 template <
size_t STATE_DIM,
size_t CONTROL_DIM,
typename SCALAR_EVAL,
typename SCALAR>
134 const SCALAR_EVAL& t)
139 template <
size_t STATE_DIM,
size_t CONTROL_DIM,
typename SCALAR_EVAL,
typename SCALAR>
141 const std::string& termName,
144 boost::property_tree::ptree pt;
147 boost::property_tree::read_info(filename, pt);
151 this->
name_ = pt.get<std::string>(termName +
".name.", termName);
158 std::cout <<
"Read P as P = \n" <<
P_ << std::endl;
159 std::cout <<
"Read x_ref as x_ref = \n" <<
x_ref_.transpose() << std::endl;
160 std::cout <<
"Read u_ref as u_ref = \n" <<
u_ref_.transpose() << std::endl;
164 template <
size_t STATE_DIM,
size_t CONTROL_DIM,
typename SCALAR_EVAL,
typename SCALAR>
166 const Eigen::Matrix<SCALAR_EVAL, STATE_DIM, 1>& newRefState)
TermMixed()
Definition: TermMixed-impl.hpp:19
Eigen::Matrix< SCALAR_EVAL, CONTROL_DIM, STATE_DIM > control_state_matrix_double_t
Definition: TermBase.hpp:44
Eigen::Matrix< SCALAR_EVAL, CONTROL_DIM, STATE_DIM > control_state_matrix_t
Definition: TermMixed.hpp:28
ct::core::ControlVector< control_dim > u
Definition: LoadFromFileTest.cpp:21
A basic quadratic term of type .
Definition: TermMixed.hpp:21
TermMixed< STATE_DIM, CONTROL_DIM, SCALAR_EVAL, SCALAR > * clone() const override
Deep-copy term.
Definition: TermMixed-impl.hpp:42
void setWeights(const control_state_matrix_double_t &P)
Definition: TermMixed-impl.hpp:54
virtual SCALAR evaluate(const Eigen::Matrix< SCALAR, STATE_DIM, 1 > &x, const Eigen::Matrix< SCALAR, CONTROL_DIM, 1 > &u, const SCALAR &t) override
Evaluates the term at x, u, t.
Definition: TermMixed-impl.hpp:69
An interface for a term, supporting both analytical and auto-diff terms.
Definition: TermBase.hpp:30
Eigen::Matrix< SCALAR_EVAL, CONTROL_DIM, STATE_DIM > control_state_matrix_t
Definition: TermBase.hpp:41
clear all close all load ct GNMSLog0 mat reformat t
Definition: gnmsPlot.m:6
void setStateAndControlReference(const core::StateVector< STATE_DIM > &x_ref, const core::ControlVector< CONTROL_DIM > &u_ref)
Definition: TermMixed-impl.hpp:60
control_state_matrix_t P_
Definition: TermMixed.hpp:92
CppAD::AD< CppAD::cg::CG< double > > SCALAR
core::StateVector< STATE_DIM, SCALAR_EVAL > x_ref_
Definition: TermMixed.hpp:94
ct::core::StateVector< state_dim > x
Definition: LoadFromFileTest.cpp:20
state_matrix_t stateSecondDerivative(const core::StateVector< STATE_DIM, SCALAR_EVAL > &x, const core::ControlVector< CONTROL_DIM, SCALAR_EVAL > &u, const SCALAR_EVAL &t) override
compute second order derivative of this cost term w.r.t. the state
Definition: TermMixed-impl.hpp:100
virtual ~TermMixed()
Definition: TermMixed-impl.hpp:49
void updateReferenceState(const Eigen::Matrix< SCALAR_EVAL, STATE_DIM, 1 > &newRefState) override
updates the reference state for this term
Definition: TermMixed-impl.hpp:165
virtual void loadConfigFile(const std::string &filename, const std::string &termName, bool verbose=false) override
load this term from a configuration file
Definition: TermMixed-impl.hpp:140
core::StateVector< STATE_DIM, SCALAR_EVAL > stateDerivative(const core::StateVector< STATE_DIM, SCALAR_EVAL > &x, const core::ControlVector< CONTROL_DIM, SCALAR_EVAL > &u, const SCALAR_EVAL &t) override
compute derivative of this cost term w.r.t. the state
Definition: TermMixed-impl.hpp:88
Eigen::Matrix< SCALAR_EVAL, STATE_DIM, STATE_DIM > state_matrix_t
Definition: TermBase.hpp:39
core::ControlVector< CONTROL_DIM, SCALAR_EVAL > controlDerivative(const core::StateVector< STATE_DIM, SCALAR_EVAL > &x, const core::ControlVector< CONTROL_DIM, SCALAR_EVAL > &u, const SCALAR_EVAL &t) override
compute derivative of this cost term w.r.t. the control input
Definition: TermMixed-impl.hpp:109
core::ControlVector< CONTROL_DIM, SCALAR_EVAL > u_ref_
Definition: TermMixed.hpp:95
const bool verbose
Definition: ConstraintComparison.h:18
control_matrix_t controlSecondDerivative(const core::StateVector< STATE_DIM, SCALAR_EVAL > &x, const core::ControlVector< CONTROL_DIM, SCALAR_EVAL > &u, const SCALAR_EVAL &t) override
compute second order derivative of this cost term w.r.t. the control input
Definition: TermMixed-impl.hpp:121
void loadMatrixCF(const std::string &filename, const std::string &matrixName, Eigen::Matrix< SCALAR, ROW, COL > &matrix, const std::string &termName="")
Definition: utilities.hpp:46
std::string name_
a name identifier for this term
Definition: TermBase.hpp:34
Eigen::Matrix< SCALAR_EVAL, CONTROL_DIM, CONTROL_DIM > control_matrix_t
Definition: TermMixed.hpp:27
control_state_matrix_t stateControlDerivative(const core::StateVector< STATE_DIM, SCALAR_EVAL > &x, const core::ControlVector< CONTROL_DIM, SCALAR_EVAL > &u, const SCALAR_EVAL &t) override
compute the cross-term derivative (state-control) of this cost function term
Definition: TermMixed-impl.hpp:131