DirectTrajectoryOptimization  v0.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
ZeroCostBolza.hpp
Go to the documentation of this file.
1 /***********************************************************************************
2 Copyright (c) 2017, Diego Pardo. All rights reserved.
3 
4 Redistribution and use in source and binary forms, with or without modification,
5 are permitted provided that the following conditions are met:
6  * Redistributions of source code must retain the above copyright notice,
7  this list of conditions and the following disclaimer.
8  * Redistributions in binary form must reproduce the above copyright notice,
9  this list of conditions and the following disclaimer in the documentation
10  and/or other materials provided with the distribution.
11  * Neither the name of ETH ZURICH nor the names of its contributors may be used
12  to endorse or promote products derived from this software without specific
13  prior written permission.
14 
15 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
16 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
18 SHALL ETH ZURICH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
19 OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
20 GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
21 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
23 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 ***************************************************************************************/
25 
31 #ifndef ZEROCOSTBOLZA_HPP_
32 #define ZEROCOSTBOLZA_HPP_
33 
34 #include <Eigen/Dense>
36 
37 namespace DirectTrajectoryOptimization {
38 namespace Costs {
39 
43 template<class DIMENSIONS>
44 class ZeroCostBolza : public BaseClass::CostFunctionBolza<DIMENSIONS> {
45 
46 public :
47 
48  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
49 
50  typedef typename DIMENSIONS::state_vector_t state_vector_t;
51  typedef typename DIMENSIONS::control_vector_t control_vector_t;
52 
53  ZeroCostBolza() { }
54 
55  double phi(const state_vector_t & x, const control_vector_t & u);
56  state_vector_t phi_x(const state_vector_t &x, const control_vector_t & u);
57  control_vector_t phi_u(const state_vector_t &x, const control_vector_t & u);
58 
59  double terminalCost(const state_vector_t &x_f);
60  state_vector_t terminalCostDerivative(const state_vector_t &x_f);
61 
62  virtual ~ZeroCostBolza() {}
63 };
64 
65 template <class DIMENSIONS>
66 double ZeroCostBolza<DIMENSIONS>::phi(const state_vector_t & x, const control_vector_t & u) {
67 
68  return 0.0;
69 }
70 
71 template <class DIMENSIONS>
72 typename DIMENSIONS::state_vector_t ZeroCostBolza<DIMENSIONS>::phi_x(const state_vector_t & x, const control_vector_t & u) {
73  return(state_vector_t::Zero());
74 }
75 
76 template <class DIMENSIONS>
77 typename DIMENSIONS::control_vector_t ZeroCostBolza<DIMENSIONS>::phi_u(const state_vector_t & x, const control_vector_t & u) {
78  return(control_vector_t::Zero());
79 }
80 
81 template <class DIMENSIONS>
82 double ZeroCostBolza<DIMENSIONS>::terminalCost(const state_vector_t & x_f) {
83 
84  return 0;
85 }
86 
87 template <class DIMENSIONS>
88 typename DIMENSIONS::state_vector_t ZeroCostBolza<DIMENSIONS>::terminalCostDerivative(const state_vector_t & x_f) {
89 
90  return(state_vector_t::Zero());
91 }
92 }
93 }
94 #endif /* ZEROCOSTBOLZA_HPP_ */
Base class to derive cost function of the type J = sum_k( phi_k(x_k,u_k,k) ) + H(X_K) ...
Base class to derive cost function of the type J = sum_k( phi_k(x_k,u_k,k) ) + H(X_K) ...
Definition: CostFunctionBolza.hpp:44
Cost function with zero intermediate and final costs.
Definition: ZeroCostBolza.hpp:44