controller.hpp
Go to the documentation of this file.
1 /*
2  * This file is part of ACADO Toolkit.
3  *
4  * ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization.
5  * Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau,
6  * Milan Vukov, Rien Quirynen, KU Leuven.
7  * Developed within the Optimization in Engineering Center (OPTEC)
8  * under supervision of Moritz Diehl. All rights reserved.
9  *
10  * ACADO Toolkit is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Lesser General Public
12  * License as published by the Free Software Foundation; either
13  * version 3 of the License, or (at your option) any later version.
14  *
15  * ACADO Toolkit is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  * Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public
21  * License along with ACADO Toolkit; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23  *
24  */
25 
26 
33 #ifndef ACADO_TOOLKIT_CONTROLLER_HPP
34 #define ACADO_TOOLKIT_CONTROLLER_HPP
35 
36 
39 
41 
46 
47 
48 
49 
51 
52 
72 {
73  //
74  // PUBLIC MEMBER FUNCTIONS:
75  //
76  public:
79  Controller( );
80 
88  Controller( ControlLaw& _controlLaw,
89  Estimator& _estimator,
90  ReferenceTrajectory& _referenceTrajectory = emptyReferenceTrajectory
91  );
92 
99  Controller( ControlLaw& _controlLaw,
100  ReferenceTrajectory& _referenceTrajectory = emptyReferenceTrajectory
101  );
102 
107  Controller( const Controller& rhs
108  );
109 
112  virtual ~Controller( );
113 
118  Controller& operator=( const Controller& rhs
119  );
120 
121 
128  returnValue setControlLaw( ControlLaw& _controlLaw
129  );
130 
138  returnValue setEstimator( Estimator& _estimator
139  );
140 
148  );
149 
150 
158  );
159 
167  returnValue initializeAlgebraicStates( const char* fileName
168  );
169 
170 
187  virtual returnValue init( double startTime = 0.0,
188  const DVector& _x0 = emptyConstVector,
189  const DVector& _p = emptyConstVector,
191  );
192 
193 
208  virtual returnValue step( double currentTime,
209  const DVector& _y,
211  );
212 
228  virtual returnValue step( double currentTime,
229  uint dim,
230  const double* const _y,
232  );
233 
248  virtual returnValue feedbackStep( double currentTime,
249  const DVector& _y,
251  );
252 
265  virtual returnValue preparationStep( double nextTime = 0.0,
267  );
268 
269  virtual returnValue obtainEstimates( double currentTime,
270  const DVector& _y,
271  DVector& xEst,
272  DVector& pEst
273  );
274 
275 
282  inline returnValue getU( DVector& _u
283  ) const;
284 
291  inline returnValue getP( DVector& _p
292  ) const;
293 
294 
299  inline uint getNY( ) const;
300 
305  inline uint getNU( ) const;
306 
311  inline uint getNP( ) const;
312 
313 
319  inline BooleanType hasDynamicControlLaw( ) const;
320 
326  inline BooleanType hasStaticControlLaw( ) const;
327 
333  inline BooleanType hasEstimator( ) const;
334 
340  inline BooleanType hasReferenceTrajectory( ) const;
341 
342 
347  inline double getSamplingTimeControlLaw( );
348 
353  inline double getSamplingTimeEstimator( );
354 
355 
363  double getNextSamplingInstant( double currentTime
364  );
365 
371  inline double getPreviousRealRuntime( );
372 
373 
378  inline returnValue enable( );
379 
384  inline returnValue disable( );
385 
386 
387 
388  //
389  // PROTECTED MEMBER FUNCTIONS:
390  //
391  protected:
392 
397  virtual returnValue setupOptions( );
398 
403  virtual returnValue setupLogging( );
404 
405 
414  virtual returnValue getCurrentReference( double tStart,
415  VariablesGrid& _yRef
416  ) const;
417 
418 
419  //
420  // DATA MEMBERS:
421  //
422  protected:
423 
431 };
432 
433 
434 
436 
437 
438 
439 #include <acado/controller/controller.ipp>
440 
441 
442 #endif // ACADO_TOOLKIT_CONTROLLER_HPP
443 
444 /*
445  * end of file
446  */
virtual returnValue preparationStep(double nextTime=0.0, const VariablesGrid &_yRef=emptyConstVariablesGrid)
Definition: controller.cpp:474
Calculates the control inputs of the Process based on the Process outputs.
Definition: controller.hpp:71
virtual ~Controller()
Definition: controller.cpp:141
Abstract base class to define a reference trajectory that the ControlLaw aims to track.
virtual returnValue setupLogging()
Definition: controller.cpp:558
Allows real time measurements based on the system&#39;s clock.
Definition: real_clock.hpp:53
returnValue setEstimator(Estimator &_estimator)
Definition: controller.cpp:209
BooleanType isEnabled
Definition: controller.hpp:428
returnValue disable()
virtual returnValue getCurrentReference(double tStart, VariablesGrid &_yRef) const
Definition: controller.cpp:573
returnValue initializeAlgebraicStates(const VariablesGrid &_xa_init)
Definition: controller.cpp:246
Provides a time grid consisting of vector-valued optimization variables at each grid point...
Allows to pass back messages to the calling function.
BEGIN_NAMESPACE_ACADO typedef unsigned int uint
Definition: acado_types.hpp:42
ReferenceTrajectory * referenceTrajectory
Definition: controller.hpp:426
uint getNY() const
virtual returnValue obtainEstimates(double currentTime, const DVector &_y, DVector &xEst, DVector &pEst)
Definition: controller.cpp:383
#define CLOSE_NAMESPACE_ACADO
RealClock controlLawClock
Definition: controller.hpp:430
ControlLaw * controlLaw
Definition: controller.hpp:424
returnValue enable()
BooleanType hasReferenceTrajectory() const
virtual returnValue step(double currentTime, const DVector &_y, const VariablesGrid &_yRef=emptyConstVariablesGrid)
Definition: controller.cpp:338
Controller & operator=(const Controller &rhs)
Definition: controller.cpp:154
BooleanType hasEstimator() const
static const DVector emptyConstVector
Definition: vector.hpp:336
returnValue setReferenceTrajectory(ReferenceTrajectory &_referenceTrajectory)
Definition: controller.cpp:227
double getSamplingTimeEstimator()
virtual returnValue init(double startTime=0.0, const DVector &_x0=emptyConstVector, const DVector &_p=emptyConstVector, const VariablesGrid &_yRef=emptyConstVariablesGrid)
Definition: controller.cpp:270
uint getNP() const
Base class for interfacing online state/parameter estimators.
Definition: estimator.hpp:56
BooleanType hasStaticControlLaw() const
void rhs(const real_t *x, real_t *f)
double getNextSamplingInstant(double currentTime)
Definition: controller.cpp:518
BooleanType hasDynamicControlLaw() const
double getSamplingTimeControlLaw()
uint getNU() const
Base class for building-blocks of the SimulationEnvironment.
returnValue setControlLaw(ControlLaw &_controlLaw)
Definition: controller.cpp:192
#define BEGIN_NAMESPACE_ACADO
double getPreviousRealRuntime()
virtual returnValue feedbackStep(double currentTime, const DVector &_y, const VariablesGrid &_yRef=emptyConstVariablesGrid)
Definition: controller.cpp:424
Estimator * estimator
Definition: controller.hpp:425
virtual returnValue setupOptions()
Definition: controller.cpp:550
returnValue getU(DVector &_u) const
Base class for interfacing online feedback laws to be used within a Controller.
Definition: control_law.hpp:64
static const VariablesGrid emptyConstVariablesGrid
CLOSE_NAMESPACE_ACADO static BEGIN_NAMESPACE_ACADO StaticReferenceTrajectory emptyReferenceTrajectory
returnValue getP(DVector &_p) const


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Mon Jun 10 2019 12:34:31