- 3.0.2 optimal control module.
ct::optcon::CostFunction< STATE_DIM, CONTROL_DIM, SCALAR > Class Template Referenceabstract

A base function for cost functions. All cost functions should derive from this. More...

#include <CostFunction.hpp>

Inheritance diagram for ct::optcon::CostFunction< STATE_DIM, CONTROL_DIM, SCALAR >:
ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR > ct::optcon::CostFunctionAnalytical< STATE_DIM, CONTROL_DIM, SCALAR > ct::optcon::CostFunctionQuadraticSimple< STATE_DIM, CONTROL_DIM, SCALAR >

Public Types

typedef core::ControlVector< CONTROL_DIM, SCALARcontrol_vector_t
 

Public Member Functions

 CostFunction ()
 Default constructor. More...
 
virtual ~CostFunction ()
 Destructor. More...
 
 CostFunction (const CostFunction &arg)
 Copy constructor. More...
 
virtual CostFunction< STATE_DIM, CONTROL_DIM, SCALAR > * clone () const =0
 
virtual void setCurrentStateAndControl (const state_vector_t &x, const control_vector_t &u, const SCALAR &t=SCALAR(0.0))
 
virtual void getCurrentStateAndControl (Eigen::Matrix< SCALAR, STATE_DIM, 1 > &x, Eigen::Matrix< SCALAR, CONTROL_DIM, 1 > &u, SCALAR &t) const
 sets current state, control and time More...
 
virtual SCALAR evaluateIntermediate ()=0
 evaluate intermediate costs More...
 
virtual SCALAR evaluateTerminal ()=0
 evaluate terminal costs More...
 
virtual void shiftTime (const SCALAR t)
 

Public Attributes

EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef core::StateVector< STATE_DIM, SCALARstate_vector_t
 

Protected Attributes

state_vector_t x_
 
control_vector_t u_
 
SCALAR t_
 
SCALAR t_shift_
 

Detailed Description

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
class ct::optcon::CostFunction< STATE_DIM, CONTROL_DIM, SCALAR >

A base function for cost functions. All cost functions should derive from this.

Member Typedef Documentation

◆ control_vector_t

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
typedef core::ControlVector<CONTROL_DIM, SCALAR> ct::optcon::CostFunction< STATE_DIM, CONTROL_DIM, SCALAR >::control_vector_t

Constructor & Destructor Documentation

◆ CostFunction() [1/2]

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR >
ct::optcon::CostFunction< STATE_DIM, CONTROL_DIM, SCALAR >::CostFunction ( )

Default constructor.

Default constructor, sets state, control and time to zero

References ct::optcon::CostFunction< STATE_DIM, CONTROL_DIM, SCALAR >::u_, and ct::optcon::CostFunction< STATE_DIM, CONTROL_DIM, SCALAR >::x_.

◆ ~CostFunction()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR >
ct::optcon::CostFunction< STATE_DIM, CONTROL_DIM, SCALAR >::~CostFunction ( )
virtual

Destructor.

Destructor

◆ CostFunction() [2/2]

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR >
ct::optcon::CostFunction< STATE_DIM, CONTROL_DIM, SCALAR >::CostFunction ( const CostFunction< STATE_DIM, CONTROL_DIM, SCALAR > &  arg)

Copy constructor.

Parameters
argother cost function

Member Function Documentation

◆ clone()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
virtual CostFunction<STATE_DIM, CONTROL_DIM, SCALAR>* ct::optcon::CostFunction< STATE_DIM, CONTROL_DIM, SCALAR >::clone ( ) const
pure virtual

◆ setCurrentStateAndControl()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR >
void ct::optcon::CostFunction< STATE_DIM, CONTROL_DIM, SCALAR >::setCurrentStateAndControl ( const state_vector_t x,
const control_vector_t u,
const SCALAR t = SCALAR(0.0) 
)
virtual

◆ getCurrentStateAndControl()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR >
void ct::optcon::CostFunction< STATE_DIM, CONTROL_DIM, SCALAR >::getCurrentStateAndControl ( Eigen::Matrix< SCALAR, STATE_DIM, 1 > &  x,
Eigen::Matrix< SCALAR, CONTROL_DIM, 1 > &  u,
SCALAR t 
) const
virtual

sets current state, control and time

Get the current state, control and time of the cost function. In this function, the user can add pre-computations shared between different calls to the derivative functions.

Parameters
xstate vector
ucontrol vector
ttime

References ct::optcon::CostFunction< STATE_DIM, CONTROL_DIM, SCALAR >::t_, ct::optcon::CostFunction< STATE_DIM, CONTROL_DIM, SCALAR >::u_, and ct::optcon::CostFunction< STATE_DIM, CONTROL_DIM, SCALAR >::x_.

Referenced by ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::controlDerivativeIntermediateNumDiff(), and ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::stateDerivativeIntermediateNumDiff().

◆ evaluateIntermediate()

◆ evaluateTerminal()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
virtual SCALAR ct::optcon::CostFunction< STATE_DIM, CONTROL_DIM, SCALAR >::evaluateTerminal ( )
pure virtual

evaluate terminal costs

Evaluates the terminal cost for a given state and control set in setCurrentStateAndControl(). This usually ignores time.

Returns
costs

Implemented in ct::optcon::CostFunctionQuadraticSimple< STATE_DIM, CONTROL_DIM, SCALAR >, and ct::optcon::CostFunctionAnalytical< STATE_DIM, CONTROL_DIM, SCALAR >.

Referenced by ct::optcon::example::compareCostFunctionOutput(), and ct::optcon::example::printCostFunctionOutput().

◆ shiftTime()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR >
void ct::optcon::CostFunction< STATE_DIM, CONTROL_DIM, SCALAR >::shiftTime ( const SCALAR  t)
virtual

Member Data Documentation

◆ state_vector_t

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef core::StateVector<STATE_DIM, SCALAR> ct::optcon::CostFunction< STATE_DIM, CONTROL_DIM, SCALAR >::state_vector_t

◆ x_

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
state_vector_t ct::optcon::CostFunction< STATE_DIM, CONTROL_DIM, SCALAR >::x_
protected

Referenced by ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::controlDerivativeIntermediateBase(), ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::controlDerivativeTerminalBase(), ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::controlSecondDerivativeIntermediateBase(), ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::controlSecondDerivativeTerminalBase(), ct::optcon::CostFunction< STATE_DIM, CONTROL_DIM, SCALAR >::CostFunction(), ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::evaluateIntermediateBase(), ct::optcon::CostFunctionQuadraticSimple< STATE_DIM, CONTROL_DIM, SCALAR >::evaluateTerminal(), ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::evaluateTerminalBase(), ct::optcon::CostFunction< STATE_DIM, CONTROL_DIM, SCALAR >::getCurrentStateAndControl(), ct::optcon::CostFunctionQuadraticSimple< STATE_DIM, CONTROL_DIM, SCALAR >::setCurrentStateAndControl(), ct::optcon::CostFunction< STATE_DIM, CONTROL_DIM, SCALAR >::setCurrentStateAndControl(), ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::stateControlDerivativeIntermediateBase(), ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::stateControlDerivativeTerminalBase(), ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::stateDerivativeIntermediateBase(), ct::optcon::CostFunctionQuadraticSimple< STATE_DIM, CONTROL_DIM, SCALAR >::stateDerivativeTerminal(), ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::stateDerivativeTerminalBase(), ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::stateSecondDerivativeIntermediateBase(), and ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::stateSecondDerivativeTerminalBase().

◆ u_

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
control_vector_t ct::optcon::CostFunction< STATE_DIM, CONTROL_DIM, SCALAR >::u_
protected

state vector

Referenced by ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::controlDerivativeIntermediateBase(), ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::controlDerivativeTerminalBase(), ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::controlSecondDerivativeIntermediateBase(), ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::controlSecondDerivativeTerminalBase(), ct::optcon::CostFunction< STATE_DIM, CONTROL_DIM, SCALAR >::CostFunction(), ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::evaluateIntermediateBase(), ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::evaluateTerminalBase(), ct::optcon::CostFunction< STATE_DIM, CONTROL_DIM, SCALAR >::getCurrentStateAndControl(), ct::optcon::CostFunctionQuadraticSimple< STATE_DIM, CONTROL_DIM, SCALAR >::setCurrentStateAndControl(), ct::optcon::CostFunction< STATE_DIM, CONTROL_DIM, SCALAR >::setCurrentStateAndControl(), ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::stateControlDerivativeIntermediateBase(), ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::stateControlDerivativeTerminalBase(), ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::stateDerivativeIntermediateBase(), ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::stateDerivativeTerminalBase(), ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::stateSecondDerivativeIntermediateBase(), and ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::stateSecondDerivativeTerminalBase().

◆ t_

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
SCALAR ct::optcon::CostFunction< STATE_DIM, CONTROL_DIM, SCALAR >::t_
protected

control vector

Referenced by ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::controlDerivativeIntermediateBase(), ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::controlDerivativeTerminalBase(), ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::controlSecondDerivativeIntermediateBase(), ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::controlSecondDerivativeTerminalBase(), ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::evaluateIntermediateBase(), ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::evaluateTerminalBase(), ct::optcon::CostFunction< STATE_DIM, CONTROL_DIM, SCALAR >::getCurrentStateAndControl(), ct::optcon::CostFunctionQuadraticSimple< STATE_DIM, CONTROL_DIM, SCALAR >::setCurrentStateAndControl(), ct::optcon::CostFunction< STATE_DIM, CONTROL_DIM, SCALAR >::setCurrentStateAndControl(), ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::stateControlDerivativeIntermediateBase(), ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::stateControlDerivativeTerminalBase(), ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::stateDerivativeIntermediateBase(), ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::stateDerivativeTerminalBase(), ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::stateSecondDerivativeIntermediateBase(), and ct::optcon::CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR >::stateSecondDerivativeTerminalBase().

◆ t_shift_

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
SCALAR ct::optcon::CostFunction< STATE_DIM, CONTROL_DIM, SCALAR >::t_shift_
protected

The documentation for this class was generated from the following files: