22 template <
size_t STATE_DIM,
size_t CONTROL_DIM,
typename SCALAR_EVAL =
double,
typename SCALAR = SCALAR_EVAL>
26 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
39 const SCALAR_EVAL alpha = 0.2);
50 const Eigen::Matrix<SCALAR, CONTROL_DIM, 1>&
u,
56 ct::core::ADCGScalar
t)
override;
61 const SCALAR_EVAL&
t)
override;
65 const SCALAR_EVAL&
t)
override;
69 const SCALAR_EVAL&
t)
override;
73 const SCALAR_EVAL&
t)
override;
77 const SCALAR_EVAL&
t)
override;
80 const std::string& termName,
84 template <
typename SC>
85 SC
evalLocal(
const Eigen::Matrix<SC, STATE_DIM, 1>&
x,
const Eigen::Matrix<SC, CONTROL_DIM, 1>&
u,
const SC&
t);
95 template <
size_t STATE_DIM,
size_t CONTROL_DIM,
typename SCALAR_EVAL,
typename SCALAR>
96 template <
typename SC>
98 const Eigen::Matrix<SC, CONTROL_DIM, 1>&
u,
101 const Eigen::Matrix<SC, STATE_DIM, 1> xerr2 = (x -
x_ref_.template cast<SC>()).array().square();
102 const Eigen::Matrix<SC, CONTROL_DIM, 1> uerr2 = (u -
u_ref_.template cast<SC>()).array().square();
104 const Eigen::Matrix<SC, STATE_DIM, 1> xerrAbs =
106 const Eigen::Matrix<SC, CONTROL_DIM, 1> uerrAbs =
109 return a_.template cast<SC>().dot(xerrAbs) +
b_.template cast<SC>().dot(uerrAbs);
core::ControlVector< CONTROL_DIM, SCALAR_EVAL > b_
Definition: TermSmoothAbs.hpp:89
SC evalLocal(const Eigen::Matrix< SC, STATE_DIM, 1 > &x, const Eigen::Matrix< SC, CONTROL_DIM, 1 > &u, const SC &t)
Definition: TermSmoothAbs.hpp:97
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef Eigen::Matrix< SCALAR_EVAL, STATE_DIM, STATE_DIM > state_matrix_t
Definition: TermSmoothAbs.hpp:28
SCALAR_EVAL alphaSquared_
Definition: TermSmoothAbs.hpp:91
ct::core::ControlVector< control_dim > u
Definition: LoadFromFileTest.cpp:21
Eigen::Matrix< SCALAR_EVAL, STATE_DIM, STATE_DIM > state_matrix_double_t
Definition: TermSmoothAbs.hpp:31
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: TermSmoothAbs-impl.hpp:96
An interface for a term, supporting both analytical and auto-diff terms.
Definition: TermBase.hpp:30
core::StateVector< STATE_DIM, SCALAR_EVAL > a_
Definition: TermSmoothAbs.hpp:87
Eigen::Matrix< SCALAR_EVAL, CONTROL_DIM, STATE_DIM > control_state_matrix_t
Definition: TermSmoothAbs.hpp:30
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: TermSmoothAbs-impl.hpp:81
clear all close all load ct GNMSLog0 mat reformat t
Definition: gnmsPlot.m:6
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: TermSmoothAbs-impl.hpp:110
CppAD::AD< CppAD::cg::CG< double > > SCALAR
TermSmoothAbs< STATE_DIM, CONTROL_DIM, SCALAR_EVAL, SCALAR > * clone() const override
Deep-copy term.
Definition: TermSmoothAbs-impl.hpp:35
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: TermSmoothAbs-impl.hpp:47
ct::core::StateVector< state_dim > x
Definition: LoadFromFileTest.cpp:20
Eigen::Matrix< SCALAR_EVAL, CONTROL_DIM, CONTROL_DIM > control_matrix_double_t
Definition: TermSmoothAbs.hpp:32
void loadConfigFile(const std::string &filename, const std::string &termName, bool verbose=false) override
load this term from a configuration file
Definition: TermSmoothAbs-impl.hpp:134
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: TermSmoothAbs-impl.hpp:125
core::ControlVector< CONTROL_DIM, SCALAR_EVAL > u_ref_
Definition: TermSmoothAbs.hpp:90
core::StateVector< STATE_DIM, SCALAR_EVAL > x_ref_
Definition: TermSmoothAbs.hpp:88
Eigen::Matrix< SCALAR_EVAL, CONTROL_DIM, CONTROL_DIM > control_matrix_t
Definition: TermSmoothAbs.hpp:29
const bool verbose
Definition: ConstraintComparison.h:18
Eigen::Matrix< SCALAR_EVAL, CONTROL_DIM, STATE_DIM > control_state_matrix_double_t
Definition: TermSmoothAbs.hpp:33
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: TermSmoothAbs-impl.hpp:67
A smooth absolute term of type where this calculation is performed component-wise and summed with in...
Definition: TermSmoothAbs.hpp:23
virtual ~TermSmoothAbs()
Definition: TermSmoothAbs-impl.hpp:42