controller.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 
00033 #ifndef ACADO_TOOLKIT_CONTROLLER_HPP
00034 #define ACADO_TOOLKIT_CONTROLLER_HPP
00035 
00036 
00037 #include <acado/utils/acado_utils.hpp>
00038 #include <acado/simulation_environment/simulation_block.hpp>
00039 
00040 #include <acado/matrix_vector/matrix_vector.hpp>
00041 
00042 #include <acado/control_law/control_law.hpp>
00043 #include <acado/estimator/estimator.hpp>
00044 #include <acado/reference_trajectory/reference_trajectory.hpp>
00045 #include <acado/reference_trajectory/static_reference_trajectory.hpp>
00046 
00047 
00048 
00049 
00050 BEGIN_NAMESPACE_ACADO
00051 
00052 
00071 class Controller : public SimulationBlock
00072 {
00073     //
00074     // PUBLIC MEMBER FUNCTIONS:
00075     //
00076     public:
00079         Controller( );
00080 
00088         Controller(     ControlLaw& _controlLaw,
00089                                         Estimator& _estimator,
00090                                         ReferenceTrajectory& _referenceTrajectory = emptyReferenceTrajectory
00091                                         );
00092 
00099         Controller(     ControlLaw& _controlLaw,
00100                                         ReferenceTrajectory& _referenceTrajectory = emptyReferenceTrajectory
00101                                         );
00102 
00107         Controller(     const Controller& rhs
00108                                         );
00109 
00112         virtual ~Controller( );
00113 
00118         Controller& operator=(  const Controller& rhs
00119                                                                 );
00120 
00121 
00128                 returnValue setControlLaw(      ControlLaw& _controlLaw
00129                                                                         );
00130 
00138                 returnValue setEstimator(       Estimator& _estimator
00139                                                                         );
00140 
00147                 returnValue setReferenceTrajectory(     ReferenceTrajectory& _referenceTrajectory
00148                                                                                         );
00149 
00150 
00157                 returnValue initializeAlgebraicStates(  const VariablesGrid& _xa_init
00158                                                                                                 );
00159 
00167                 returnValue initializeAlgebraicStates(  const char* fileName
00168                                                                                                 );
00169 
00170 
00187         virtual returnValue init(       double startTime = 0.0,
00188                                                                         const DVector& _x0 = emptyConstVector,
00189                                                                         const DVector& _p  = emptyConstVector,
00190                                                                         const VariablesGrid& _yRef = emptyConstVariablesGrid
00191                                                                         );
00192 
00193 
00208         virtual returnValue step(       double currentTime,
00209                                                                         const DVector& _y,
00210                                                                         const VariablesGrid& _yRef = emptyConstVariablesGrid
00211                                                                         );
00212 
00228                 virtual returnValue step(       double currentTime,
00229                                                                         uint dim,
00230                                                                         const double* const _y,
00231                                                                         const VariablesGrid& _yRef = emptyConstVariablesGrid
00232                                                                         );
00233 
00248         virtual returnValue feedbackStep(       double currentTime,
00249                                                                                         const DVector& _y,
00250                                                                                         const VariablesGrid& _yRef = emptyConstVariablesGrid
00251                                                                                         );
00252 
00265         virtual returnValue preparationStep(    double nextTime = 0.0,
00266                                                                                                 const VariablesGrid& _yRef = emptyConstVariablesGrid
00267                                                                                                 );
00268 
00269                 virtual returnValue obtainEstimates(    double currentTime,
00270                                                                                                 const DVector& _y,
00271                                                                                                 DVector& xEst,
00272                                                                                                 DVector& pEst
00273                                                                                                 );
00274 
00275 
00282         inline returnValue getU(        DVector& _u
00283                                                                         ) const;
00284 
00291         inline returnValue getP(        DVector& _p
00292                                                                         ) const;
00293 
00294 
00299                 inline uint getNY( ) const;
00300 
00305                 inline uint getNU( ) const;
00306 
00311                 inline uint getNP( ) const;
00312 
00313 
00319                 inline BooleanType hasDynamicControlLaw( ) const;
00320 
00326                 inline BooleanType hasStaticControlLaw( ) const;
00327 
00333                 inline BooleanType hasEstimator( ) const;
00334 
00340                 inline BooleanType hasReferenceTrajectory( ) const;
00341 
00342 
00347                 inline double getSamplingTimeControlLaw( );
00348 
00353                 inline double getSamplingTimeEstimator( );
00354 
00355 
00363                 double getNextSamplingInstant(  double currentTime
00364                                                                                 );
00365 
00371                 inline double getPreviousRealRuntime( );
00372 
00373 
00378                 inline returnValue enable( );
00379 
00384                 inline returnValue disable( );
00385 
00386 
00387 
00388     //
00389     // PROTECTED MEMBER FUNCTIONS:
00390     //
00391     protected:
00392 
00397                 virtual returnValue setupOptions( );
00398 
00403                 virtual returnValue setupLogging( );
00404 
00405 
00414                 virtual returnValue getCurrentReference(        double tStart,
00415                                                                                                         VariablesGrid& _yRef
00416                                                                                                         ) const;
00417 
00418 
00419     //
00420     // DATA MEMBERS:
00421     //
00422     protected:
00423                 
00424                 ControlLaw* controlLaw;                                         
00425                 Estimator* estimator;                                           
00426                 ReferenceTrajectory* referenceTrajectory;       
00428                 BooleanType isEnabled;                                          
00430                 RealClock controlLawClock;                                      
00431 };
00432 
00433 
00434 
00435 CLOSE_NAMESPACE_ACADO
00436 
00437 
00438 
00439 #include <acado/controller/controller.ipp>
00440 
00441 
00442 #endif  // ACADO_TOOLKIT_CONTROLLER_HPP
00443 
00444 /*
00445  *      end of file
00446  */


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