static_reference_trajectory.cpp
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 
35 
36 
38 
39 
40 
41 //
42 // PUBLIC MEMBER FUNCTIONS:
43 //
44 
46 {
47 }
48 
49 
50 // StaticReferenceTrajectory::StaticReferenceTrajectory( const Curve& _yRef
51 // ) : ReferenceTrajectory( )
52 // {
53 // yRef = _yRef;
54 //
55 // setStatus( BS_READY );
56 // }
57 
58 
60  )
61 {
62  if ( _yRef.isEmpty( ) == BT_TRUE )
63  {
65  ASSERT( 1==0 );
66  }
67 
68 // yRef.add( _yRef );
69  yRef = _yRef;
70 
71  //setStatus( BS_READY );
72 }
73 
74 
76  )
77 {
78  VariablesGrid _yRef;
79  _yRef.read( _yRefFileName );
80 
81  if ( _yRef.isEmpty( ) == BT_TRUE )
82  {
84  ASSERT( 1==0 );
85  }
86 
87 // yRef.add( _yRef );
88  yRef = _yRef;
89 
90  //setStatus( BS_READY );
91 }
92 
93 
94 
96 {
97  yRef = rhs.yRef;
98 }
99 
100 
102 {
103 }
104 
105 
107 {
108  if ( this != &rhs )
109  {
111 
112  yRef = rhs.yRef;
113  }
114 
115  return *this;
116 }
117 
118 
120 {
121  return new StaticReferenceTrajectory( *this );
122 }
123 
124 
126  const DVector& _x,
127  const DVector& _xa,
128  const DVector& _u,
129  const DVector& _p,
130  const DVector& _w
131  )
132 {
133  return SUCCESSFUL_RETURN;
134 }
135 
136 
138  const DVector& _y,
139  const DVector& _x,
140  const DVector& _xa,
141  const DVector& _u,
142  const DVector& _p,
143  const DVector& _w
144  )
145 {
146  return SUCCESSFUL_RETURN;
147 }
148 
149 
151  const VariablesGrid& _u,
152  const VariablesGrid& _p,
153  const VariablesGrid& _w
154  )
155 {
156  return SUCCESSFUL_RETURN;
157 }
158 
159 
161  double tEnd,
162  VariablesGrid& _yRef
163  ) const
164 {
165  if ( acadoIsSmaller( tStart,tEnd ) == BT_FALSE )
167 
168  if ( acadoIsStrictlySmaller( tStart,yRef.getFirstTime() ) == BT_TRUE )
170 
171 // return yRef.evaluate( tStart,tEnd,_yRef );
172 
173  if ( acadoIsSmaller( tEnd,yRef.getLastTime() ) == BT_TRUE )
174  {
175  _yRef = yRef.getTimeSubGrid( tStart,tEnd );
176  }
177  else
178  {
179  // constant extrapolation beyond end of interval
180  if ( acadoIsSmaller( yRef.getLastTime(),tStart ) == BT_TRUE )
181  {
182  Grid grid( tStart,tEnd );
183  _yRef.init( yRef.getLastVector(),grid );
184  }
185  else
186  {
187  _yRef = yRef.getTimeSubGrid( tStart,yRef.getLastTime() );
188  _yRef.setTime( _yRef.getLastIndex(),tEnd );
189  }
190  }
191 
192  return SUCCESSFUL_RETURN;
193 }
194 
195 
196 
198 {
199 // return yRef.getDim( );
200  return yRef.getNumValues( );
201 }
202 
203 
204 //
205 // PROTECTED MEMBER FUNCTIONS:
206 //
207 
208 
209 
210 
212 
213 // end of file.
returnValue setTime(double _time)
Definition: grid.cpp:307
StaticReferenceTrajectory & operator=(const StaticReferenceTrajectory &rhs)
virtual returnValue getReference(double tStart, double tEnd, VariablesGrid &_yRef) const
Abstract base class to define a reference trajectory that the ControlLaw aims to track.
double getFirstTime() const
virtual ReferenceTrajectory * clone() const
Provides a time grid consisting of vector-valued optimization variables at each grid point...
Allows to pass back messages to the calling function.
virtual returnValue init(double startTime=0.0, const DVector &_x=emptyConstVector, const DVector &_xa=emptyConstVector, const DVector &_u=emptyConstVector, const DVector &_p=emptyConstVector, const DVector &_w=emptyConstVector)
BEGIN_NAMESPACE_ACADO typedef unsigned int uint
Definition: acado_types.hpp:42
Allows to conveniently handle (one-dimensional) grids consisting of time points.
Definition: grid.hpp:58
BooleanType isEmpty() const
uint getLastIndex() const
virtual returnValue step(double _currentTime, const DVector &_y, const DVector &_x=emptyConstVector, const DVector &_xa=emptyConstVector, const DVector &_u=emptyConstVector, const DVector &_p=emptyConstVector, const DVector &_w=emptyConstVector)
#define CLOSE_NAMESPACE_ACADO
ReferenceTrajectory & operator=(const ReferenceTrajectory &rhs)
BooleanType acadoIsStrictlySmaller(double x, double y, double TOL)
DVector getLastVector() const
VariablesGrid getTimeSubGrid(uint startIdx, uint endIdx) const
returnValue init()
BooleanType acadoIsSmaller(double x, double y, double TOL)
Allows to define a static reference trajectory that the ControlLaw aims to track. ...
void rhs(const real_t *x, real_t *f)
returnValue read(std::istream &stream)
#define ASSERT(x)
#define BT_TRUE
Definition: acado_types.hpp:47
double getLastTime() const
#define BEGIN_NAMESPACE_ACADO
#define BT_FALSE
Definition: acado_types.hpp:49
#define ACADOERROR(retval)


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