real_time_algorithm.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 
34 #ifndef ACADO_TOOLKIT_REAL_TIME_ALGORITHM_HPP
35 #define ACADO_TOOLKIT_REAL_TIME_ALGORITHM_HPP
36 
37 
40 
41 
43 
44 
45 
57 {
58  //
59  // PUBLIC MEMBER FUNCTIONS:
60  //
61  public:
62 
66 
73  RealTimeAlgorithm( const OCP& ocp_,
74  double _samplingTime = DEFAULT_SAMPLING_TIME
75  );
76 
82  );
83 
86  virtual ~RealTimeAlgorithm( );
87 
93  );
94 
99  virtual ControlLaw* clone( ) const;
100 
101 
108  virtual returnValue initializeAlgebraicStates( const VariablesGrid& _xa_init
109  );
110 
118  virtual returnValue initializeAlgebraicStates( const char* fileName
119  );
120 
121 
128  virtual returnValue initializeControls( const VariablesGrid& _u_init
129  );
130 
138  virtual returnValue initializeControls( const char* fileName
139  );
140 
141 
147  virtual returnValue init( );
148 
159  virtual returnValue init( double startTime,
160  const DVector &_x = emptyConstVector,
161  const DVector &_p = emptyConstVector,
163  );
164 
165 
175  virtual returnValue step( double currentTime,
176  const DVector& _x,
177  const DVector& _p = emptyConstVector,
179  );
180 
193  virtual returnValue feedbackStep( double currentTime,
194  const DVector &_x,
195  const DVector &_p = emptyConstVector,
197  );
198 
206  virtual returnValue preparationStep( double nextTime = 0.0,
208  );
209 
210 
217  virtual returnValue solve( double startTime,
218  const DVector &_x,
219  const DVector &_p = emptyConstVector,
221  );
222 
223 
228  virtual returnValue shift( double timeShift = -1.0
229  );
230 
231 
240  virtual returnValue setReference( const VariablesGrid &ref
241  );
242 
243 
248  virtual uint getNX( ) const;
249 
254  virtual uint getNXA( ) const;
255 
260  virtual uint getNU( ) const;
261 
266  virtual uint getNP( ) const;
267 
272  virtual uint getNW( ) const;
273 
278  virtual uint getNY( ) const;
279 
280 
285  virtual double getLengthPredictionHorizon( ) const;
286 
291  virtual double getLengthControlHorizon( ) const;
292 
293 
300  virtual BooleanType isDynamic( ) const;
301 
307  virtual BooleanType isStatic( ) const;
308 
314  virtual BooleanType isInRealTimeMode( ) const;
315 
316 
317  //
318  // PROTECTED MEMBER FUNCTIONS:
319  //
320  protected:
321 
326  virtual returnValue setupOptions( );
327 
332  virtual returnValue setupLogging( );
333 
338  returnValue clear( );
339 
348  Constraint *H
349  );
350 
358  );
359 
367  );
368 
369 
376  returnValue performFeedbackStep( double currentTime,
377  const DVector &_x,
378  const DVector &_p = emptyConstVector
379  );
380 
388  BooleanType isLastIteration = BT_TRUE
389  );
390 
391 
392  //
393  // DATA MEMBERS:
394  //
395  protected:
396 
402 };
403 
404 
406 
407 
408 
409 #include <acado/optimization_algorithm/real_time_algorithm.ipp>
410 
411 
412 #endif // ACADO_TOOLKIT_REAL_TIME_ALGORITHM_HPP
413 
414 /*
415  * end of file
416  */
virtual returnValue preparationStep(double nextTime=0.0, const VariablesGrid &_yRef=emptyConstVariablesGrid)
virtual returnValue initializeObjective(Objective *F)
Data class for storing generic optimization variables.
Definition: ocp_iterate.hpp:57
virtual returnValue feedbackStep(double currentTime, const DVector &_x, const DVector &_p=emptyConstVector, const VariablesGrid &_yRef=emptyConstVariablesGrid)
returnValue performPreparationStep(const VariablesGrid &_yRef=emptyConstVariablesGrid, BooleanType isLastIteration=BT_TRUE)
virtual returnValue setupLogging()
virtual uint getNP() const
Stores and evaluates the constraints of optimal control problems.
Definition: constraint.hpp:60
virtual returnValue initializeNlpSolver(const OCPiterate &userInit)
Provides a time grid consisting of vector-valued optimization variables at each grid point...
Allows to pass back messages to the calling function.
RealTimeAlgorithm & operator=(const RealTimeAlgorithm &rhs)
BEGIN_NAMESPACE_ACADO typedef unsigned int uint
Definition: acado_types.hpp:42
User-interface to formulate and solve model predictive control problems.
virtual returnValue allocateNlpSolver(Objective *F, DynamicDiscretization *G, Constraint *H)
#define CLOSE_NAMESPACE_ACADO
virtual uint getNY() const
virtual returnValue setupOptions()
Base class for user-interfaces to formulate and solve optimal control problems and static NLPs...
Base class for discretizing a DifferentialEquation for use in optimal control algorithms.
returnValue performFeedbackStep(double currentTime, const DVector &_x, const DVector &_p=emptyConstVector)
virtual BooleanType isDynamic() const
static const DVector emptyConstVector
Definition: vector.hpp:336
virtual uint getNX() const
virtual returnValue setReference(const VariablesGrid &ref)
virtual double getLengthPredictionHorizon() const
virtual ControlLaw * clone() const
virtual returnValue shift(double timeShift=-1.0)
virtual BooleanType isStatic() const
virtual uint getNU() const
virtual double getLengthControlHorizon() const
Data class for defining optimal control problems.
Definition: ocp.hpp:89
void rhs(const real_t *x, real_t *f)
virtual uint getNXA() const
const double DEFAULT_SAMPLING_TIME
virtual returnValue step(double currentTime, const DVector &_x, const DVector &_p=emptyConstVector, const VariablesGrid &_yRef=emptyConstVariablesGrid)
#define BT_TRUE
Definition: acado_types.hpp:47
virtual returnValue solve(double startTime, const DVector &_x, const DVector &_p=emptyConstVector, const VariablesGrid &_yRef=emptyConstVariablesGrid)
virtual BooleanType isInRealTimeMode() const
virtual uint getNW() const
VariablesGrid * reference
#define BEGIN_NAMESPACE_ACADO
virtual returnValue initializeControls(const VariablesGrid &_u_init)
virtual returnValue initializeAlgebraicStates(const VariablesGrid &_xa_init)
virtual returnValue init()
Base class for interfacing online feedback laws to be used within a Controller.
Definition: control_law.hpp:64
static const VariablesGrid emptyConstVariablesGrid
Stores and evaluates the objective function of optimal control problems.
Definition: objective.hpp:123


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