31 #ifndef REACHGOALCOSTBOLZA_HPP_
32 #define REACHGOALCOSTBOLZA_HPP_
36 namespace DirectTrajectoryOptimization {
42 template<
class DIMENSIONS>
47 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
49 typedef typename DIMENSIONS::state_vector_t state_vector_t;
50 typedef typename DIMENSIONS::state_matrix_t state_matrix_t;
52 typedef typename DIMENSIONS::control_vector_t control_vector_t;
53 typedef typename DIMENSIONS::control_matrix_t control_matrix_t;
61 ReachGoalCostBolza(
const state_vector_t & goal,
const state_matrix_t & Q=state_matrix_t::Identity(),
const state_matrix_t & H = state_matrix_t::Identity()):Q_(Q),goal_(goal),H_(H)
64 double phi(
const state_vector_t & x,
const control_vector_t & u);
65 state_vector_t phi_x(
const state_vector_t &x,
const control_vector_t & u);
66 control_vector_t phi_u(
const state_vector_t &x,
const control_vector_t & u);
68 double terminalCost(
const state_vector_t &x_f);
69 state_vector_t terminalCostDerivative(
const state_vector_t &x_f);
78 template <
class DIMENSIONS>
79 double ReachGoalCostBolza<DIMENSIONS>::phi(
const state_vector_t & x,
const control_vector_t & u) {
81 double val = (x-goal_).transpose()*Q_*(x-goal_);
85 template <
class DIMENSIONS>
86 typename DIMENSIONS::state_vector_t ReachGoalCostBolza<DIMENSIONS>::phi_x(
const state_vector_t & x,
87 const control_vector_t & u ) {
89 return(2*Q_*(x-goal_));
92 template <
class DIMENSIONS>
93 typename DIMENSIONS::control_vector_t ReachGoalCostBolza<DIMENSIONS>::phi_u(
const state_vector_t & x,
94 const control_vector_t & u) {
96 return(control_vector_t::Zero());
100 template <
class DIMENSIONS>
101 double ReachGoalCostBolza<DIMENSIONS>::terminalCost(
const state_vector_t & x_f) {
103 double terminal_cost = (x_f-goal_).transpose()*H_*(x_f-goal_);
105 return terminal_cost;
108 template <
class DIMENSIONS>
109 typename DIMENSIONS::state_vector_t ReachGoalCostBolza<DIMENSIONS>::terminalCostDerivative(
const state_vector_t & x_f) {
111 return(2*H_*(x_f-goal_));
Bolza type cost function minimizing the distance to a goal state.
Definition: ReachGoalCostBolza.hpp:43
Base class to derive cost function of the type J = sum_k( phi_k(x_k,u_k,k) ) + H(X_K) ...
ReachGoalCostBolza(const state_vector_t &goal, const state_matrix_t &Q=state_matrix_t::Identity(), const state_matrix_t &H=state_matrix_t::Identity())
Constructor.
Definition: ReachGoalCostBolza.hpp:61
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