real_time_algorithm.hpp
Go to the documentation of this file.
00001 /*
00002  *    This file is part of ACADO Toolkit.
00003  *
00004  *    ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization.
00005  *    Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau,
00006  *    Milan Vukov, Rien Quirynen, KU Leuven.
00007  *    Developed within the Optimization in Engineering Center (OPTEC)
00008  *    under supervision of Moritz Diehl. All rights reserved.
00009  *
00010  *    ACADO Toolkit is free software; you can redistribute it and/or
00011  *    modify it under the terms of the GNU Lesser General Public
00012  *    License as published by the Free Software Foundation; either
00013  *    version 3 of the License, or (at your option) any later version.
00014  *
00015  *    ACADO Toolkit is distributed in the hope that it will be useful,
00016  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018  *    Lesser General Public License for more details.
00019  *
00020  *    You should have received a copy of the GNU Lesser General Public
00021  *    License along with ACADO Toolkit; if not, write to the Free Software
00022  *    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00023  *
00024  */
00025 
00026 
00034 #ifndef ACADO_TOOLKIT_REAL_TIME_ALGORITHM_HPP
00035 #define ACADO_TOOLKIT_REAL_TIME_ALGORITHM_HPP
00036 
00037 
00038 #include <acado/optimization_algorithm/optimization_algorithm.hpp>
00039 #include <acado/control_law/control_law.hpp>
00040 
00041 
00042 BEGIN_NAMESPACE_ACADO
00043 
00044 
00045 
00056 class RealTimeAlgorithm : public OptimizationAlgorithmBase, public ControlLaw
00057 {
00058         //
00059         // PUBLIC MEMBER FUNCTIONS:
00060         //
00061         public:
00062 
00065                 RealTimeAlgorithm( );
00066 
00073                 RealTimeAlgorithm(      const OCP& ocp_,
00074                                                         double _samplingTime = DEFAULT_SAMPLING_TIME
00075                                                         );
00076 
00081                 RealTimeAlgorithm(      const RealTimeAlgorithm& rhs
00082                                                         );
00083 
00086                 virtual ~RealTimeAlgorithm( );
00087 
00092                 RealTimeAlgorithm& operator=(   const RealTimeAlgorithm& rhs
00093                                                                                 );
00094 
00099                 virtual ControlLaw* clone( ) const;
00100 
00101 
00108                 virtual returnValue initializeAlgebraicStates(  const VariablesGrid& _xa_init
00109                                                                                                                 );
00110 
00118                 virtual returnValue initializeAlgebraicStates(  const char* fileName
00119                                                                                                                 );
00120 
00121 
00128                 virtual returnValue initializeControls( const VariablesGrid& _u_init
00129                                                                                                 );
00130 
00138                 virtual returnValue initializeControls( const char* fileName
00139                                                                                                 );
00140 
00141 
00147                 virtual returnValue init( );
00148 
00159                 virtual returnValue init(       double startTime,
00160                                                                         const DVector &_x = emptyConstVector,
00161                                                                         const DVector &_p = emptyConstVector,
00162                                                                         const VariablesGrid& _yRef = emptyConstVariablesGrid
00163                                                                         );
00164 
00165 
00175                 virtual returnValue step(       double currentTime,
00176                                                                         const DVector& _x,
00177                                                                         const DVector& _p = emptyConstVector,
00178                                                                         const VariablesGrid& _yRef = emptyConstVariablesGrid
00179                                                                         );
00180 
00193                 virtual returnValue feedbackStep(       double currentTime,
00194                                                                                         const DVector &_x,
00195                                                                                         const DVector &_p = emptyConstVector,
00196                                                                                         const VariablesGrid& _yRef = emptyConstVariablesGrid
00197                                                                                         );
00198 
00206                 virtual returnValue preparationStep(    double nextTime = 0.0,
00207                                                                                                 const VariablesGrid& _yRef = emptyConstVariablesGrid
00208                                                                                                 );
00209 
00210 
00217                 virtual returnValue solve(      double startTime,
00218                                                                         const DVector &_x,
00219                                                                         const DVector &_p = emptyConstVector,
00220                                                                         const VariablesGrid& _yRef = emptyConstVariablesGrid
00221                                                                         );
00222 
00223 
00228                 virtual returnValue shift(      double timeShift = -1.0
00229                                                                         );
00230 
00231 
00240                 virtual returnValue setReference(       const VariablesGrid &ref
00241                                                                                         );
00242 
00243                 
00248                 virtual uint getNX( ) const;
00249 
00254                 virtual uint getNXA( ) const;
00255 
00260                 virtual uint getNU( ) const;
00261 
00266                 virtual uint getNP( ) const;
00267 
00272                 virtual uint getNW( ) const;
00273 
00278                 virtual uint getNY( ) const;
00279 
00280 
00285                 virtual double getLengthPredictionHorizon( ) const;
00286 
00291                 virtual double getLengthControlHorizon( ) const;
00292 
00293 
00300                 virtual BooleanType isDynamic( ) const;
00301 
00307                 virtual BooleanType isStatic( ) const;
00308 
00314                 virtual BooleanType isInRealTimeMode( ) const;
00315 
00316 
00317         //
00318         // PROTECTED MEMBER FUNCTIONS:
00319         //
00320         protected:
00321 
00326                 virtual returnValue setupOptions( );
00327 
00332                 virtual returnValue setupLogging( );
00333 
00338                 returnValue clear( );
00339 
00346                 virtual returnValue allocateNlpSolver(  Objective *F,
00347                                                                                                 DynamicDiscretization *G,
00348                                                                                                 Constraint *H
00349                                                                                                 );
00350 
00357                 virtual returnValue initializeNlpSolver(        const OCPiterate& userInit
00358                                                                                                         );
00359 
00366                 virtual returnValue initializeObjective(        Objective *F
00367                                                                                                         );
00368 
00369 
00376                 returnValue performFeedbackStep(        double currentTime,
00377                                                                                         const DVector &_x,
00378                                                                                         const DVector &_p = emptyConstVector
00379                                                                                         );
00380 
00387                 returnValue performPreparationStep(     const VariablesGrid& _yRef = emptyConstVariablesGrid,
00388                                                                                         BooleanType isLastIteration = BT_TRUE
00389                                                                                         );
00390 
00391 
00392         //
00393         // DATA MEMBERS:
00394         //
00395         protected:
00396 
00397                 DVector* x0;                                            
00398                 DVector* p0;                                            
00400                 VariablesGrid* reference;               
00402 };
00403 
00404 
00405 CLOSE_NAMESPACE_ACADO
00406 
00407 
00408 
00409 #include <acado/optimization_algorithm/real_time_algorithm.ipp>
00410 
00411 
00412 #endif  // ACADO_TOOLKIT_REAL_TIME_ALGORITHM_HPP
00413 
00414 /*
00415  *   end of file
00416  */


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Thu Aug 27 2015 11:59:51