9 template <
size_t STATE_DIM,
size_t CONTROL_DIM,
typename SCALAR>
12 : ContinuousBase(),
DiscreteBase(), x_ref_(other.x_ref_), uff_(other.uff_), K_(other.K_)
16 template <
size_t STATE_DIM,
size_t CONTROL_DIM,
typename SCALAR>
24 :
x_ref_(x_ref, deltaT, t0, intType),
uff_(uff, deltaT, t0, intType),
K_(K, deltaT, t0, intType)
28 template <
size_t STATE_DIM,
size_t CONTROL_DIM,
typename SCALAR>
33 controlAction =
uff_.eval(t) +
K_.eval(t) * (state -
x_ref_.eval(t));
36 template <
size_t STATE_DIM,
size_t CONTROL_DIM,
typename SCALAR>
44 template <
size_t STATE_DIM,
size_t CONTROL_DIM,
typename SCALAR>
53 if (K.size() != tshort.size())
54 throw std::runtime_error(
"StateFeedbackController.h : K.size() != tshort.size()");
55 if (uff.size() != tshort.size())
56 throw std::runtime_error(
"StateFeedbackController.h : uff.size() != tshort.size()");
57 if (x_ref.size() != t.size())
58 throw std::runtime_error(
"StateFeedbackController.h : x_ref.size() != t.size()");
67 template <
size_t STATE_DIM,
size_t CONTROL_DIM,
typename SCALAR>
75 template <
size_t STATE_DIM,
size_t CONTROL_DIM,
typename SCALAR>
79 return x_ref_.getDataArray();
82 template <
size_t STATE_DIM,
size_t CONTROL_DIM,
typename SCALAR>
86 return uff_.getDataArray();
89 template <
size_t STATE_DIM,
size_t CONTROL_DIM,
typename SCALAR>
93 return K_.getDataArray();
96 template <
size_t STATE_DIM,
size_t CONTROL_DIM,
typename SCALAR>
99 return x_ref_.getTimeArray();
102 template <
size_t STATE_DIM,
size_t CONTROL_DIM,
typename SCALAR>
109 template <
size_t STATE_DIM,
size_t CONTROL_DIM,
typename SCALAR>
116 template <
size_t STATE_DIM,
size_t CONTROL_DIM,
typename SCALAR>
123 template <
size_t STATE_DIM,
size_t CONTROL_DIM,
typename SCALAR>
130 template <
size_t STATE_DIM,
size_t CONTROL_DIM,
typename SCALAR>
137 template <
size_t STATE_DIM,
size_t CONTROL_DIM,
typename SCALAR>
144 template <
size_t STATE_DIM,
size_t CONTROL_DIM,
typename SCALAR>
151 for (
size_t i = 0;
i < x_traj.
size() - 1;
i++)
StateTrajectory< STATE_DIM, SCALAR > x_ref_
Definition: StateFeedbackController.h:153
void clear()
Clear the trajectory.
Definition: DiscreteTrajectoryBase.h:211
An discrete array (vector) of a particular data type.
Definition: DiscreteArray.h:22
const tpl::TimeArray< SCALAR > & time() const
get time array
Definition: StateFeedbackController-impl.h:97
StateTrajectory< STATE_DIM, SCALAR > & getReferenceStateTrajectory()
get a reference to the feedforward trajectory
Definition: StateFeedbackController-impl.h:104
StateFeedbackController()
default constructor
Definition: StateFeedbackController.h:56
const DiscreteArray< FeedbackMatrix< STATE_DIM, CONTROL_DIM, SCALAR > > & K() const
get feedback array (without timings)
Definition: StateFeedbackController-impl.h:91
size_t size() const
returns the size of the trajectory
Definition: DiscreteTrajectoryBase.h:146
const DiscreteArray< state_vector_t > & x_ref() const
get reference state vector array (without timings)
Definition: StateFeedbackController-impl.h:77
FeedbackTrajectory< STATE_DIM, CONTROL_DIM, SCALAR > & getFeedbackTrajectory()
get a reference to the feedback trajectory
Definition: StateFeedbackController-impl.h:132
Definition: ControlVector.h:12
CppAD::AD< CppAD::cg::CG< double > > SCALAR
virtual void computeControl(const state_vector_t &state, const SCALAR &t, control_vector_t &controlAction) override
computes the control action in the continuous case
Definition: StateFeedbackController-impl.h:29
InterpolationType
Definition: Interpolation.h:14
A linear state feedback controller.
Definition: StateFeedbackController.h:39
A discrete, timed trajectory with interpolation.
Definition: DiscreteTrajectoryBase.h:31
constexpr size_t n
Definition: MatrixInversionTest.cpp:14
const DiscreteArray< control_vector_t > & uff() const
get feedforward array (without timings)
Definition: StateFeedbackController-impl.h:84
Interface class for all controllers.
Definition: DiscreteController.h:22
const SCALAR & getTimeFromIndex(const size_t &ind) const
get the time stamp at a certain index
Definition: DiscreteTrajectoryBase.h:243
An array in time.
Definition: TimeArray.h:22
ControlTrajectory< CONTROL_DIM, SCALAR > uff_
state reference trajectory
Definition: StateFeedbackController.h:154
void update(const DiscreteArray< state_vector_t > &x_ref, const DiscreteArray< control_vector_t > &uff, const DiscreteArray< FeedbackMatrix< STATE_DIM, CONTROL_DIM, SCALAR >> &K, const tpl::TimeArray< SCALAR > &t)
updates the controller
Definition: StateFeedbackController-impl.h:45
void extractControlTrajectory(const StateTrajectory< STATE_DIM, SCALAR > &x_traj, ControlTrajectory< CONTROL_DIM, SCALAR > &u_traj)
extracts a physically meaningful control trajectory from the given state-feedback law and a reference...
Definition: StateFeedbackController-impl.h:145
StateFeedbackController< STATE_DIM, CONTROL_DIM, SCALAR > * clone() const override
deep cloning
Definition: StateFeedbackController-impl.h:69
void push_back(const T &data, const SCALAR &time, const bool timeIsAbsolute)
Add a data and time point at the end.
Definition: DiscreteTrajectoryBase.h:181
Definition: FeedbackMatrix.h:12
FeedbackTrajectory< STATE_DIM, CONTROL_DIM, SCALAR > K_
feedforward control trajectory
Definition: StateFeedbackController.h:155
DiscreteBase::state_vector_t state_vector_t
Definition: StateFeedbackController.h:48
ControlTrajectory< CONTROL_DIM, SCALAR > & getFeedforwardTrajectory()
get a reference to the feedforward trajectory
Definition: StateFeedbackController-impl.h:118