OCS2 Manual  v1.0.0
OCS2 Documentation
ocs2_core

Detailed Description

Namespaces

 ocs2::cppad_sparsity
 
 ocs2::integrator_type
 
 ocs2::loopshaping_property_tree
 
 ocs2::benchmark
 
 ocs2::LinearAlgebra
 
 ocs2::LinearInterpolation
 
 ocs2::loadData
 
 ocs2::log
 
 ocs2::lookup
 
 ocs2::numerics
 
 ocs2::ModelData
 

Classes

class  ocs2::CppAdInterface
 
class  ocs2::ConstraintBase
 
class  ocs2::ConstraintBaseAD
 
class  ocs2::ConstraintCollection< CONSTRAINT >
 
class  ocs2::LinearConstraint
 
class  ocs2::PenaltyBase
 
class  ocs2::RelaxedBarrierPenalty
 
class  ocs2::StateConstraint
 
class  ocs2::StateInputConstraint
 
class  ocs2::ControllerAdjustmentBase
 
class  ocs2::ControllerBase
 
class  ocs2::FeedforwardController
 
class  ocs2::LinearController
 
class  ocs2::StateBasedLinearController
 
class  ocs2::TrajectorySpreadingControllerAdjustment
 
class  ocs2::CostCollection< COST >
 
class  ocs2::CostDesiredTrajectories
 
class  ocs2::CostFunctionBase
 
class  ocs2::CostFunctionBaseAD
 
class  ocs2::CostFunctionLinearCombination
 
class  ocs2::QuadraticCostFunction
 
class  ocs2::QuadraticGaussNewtonCostBaseAD
 
class  ocs2::QuadraticStateCost
 
class  ocs2::QuadraticStateInputCost
 
class  ocs2::RelaxedBarrierCost
 
class  ocs2::StateCost
 
class  ocs2::StateInputCost
 
class  ocs2::ControlledSystemBase
 
class  ocs2::LinearSystemDynamics
 
class  ocs2::SystemDynamicsBase
 
class  ocs2::SystemDynamicsBaseAD
 
class  ocs2::SystemDynamicsLinearizer
 
class  ocs2::TransferFunctionBase
 
class  ocs2::OperatingPoints
 
class  ocs2::SystemOperatingTrajectoriesBase
 
class  ocs2::Integrator< Stepper >
 
class  ocs2::IntegratorBase
 
class  ocs2::Observer
 
class  ocs2::OdeBase
 
class  ocs2::OdeFunc
 
class  ocs2::RungeKuttaDormandPrince5
 
class  ocs2::StateTriggeredEventHandler
 
class  ocs2::SystemEventHandler
 
struct  ocs2::ModeSchedule
 
class  ocs2::LoopshapingConstraint
 
class  ocs2::LoopshapingConstraintEliminatePattern
 
class  ocs2::LoopshapingConstraintInputPattern
 
class  ocs2::LoopshapingConstraintOutputPattern
 
class  ocs2::LoopshapingCost
 
class  ocs2::LoopshapingCostEliminatePattern
 
class  ocs2::LoopshapingCostInputPattern
 
class  ocs2::LoopshapingCostOutputPattern
 
class  ocs2::LoopshapingDynamics
 
class  ocs2::LoopshapingDynamicsEliminatePattern
 
class  ocs2::LoopshapingDynamicsInputPattern
 
class  ocs2::LoopshapingDynamicsOutputPattern
 
class  ocs2::LoopshapingFilterDynamics
 
class  ocs2::LoopshapingDefinition
 
class  ocs2::Filter
 
class  ocs2::LoopshapingOperatingPoint
 
class  ocs2::LinearFunction< STATE_DIM, DIM1, DIM2, SCALAR >
 
class  ocs2::LTI_Equations< DIM1, DIM2, SCALAR >
 
class  ocs2::LockedPtr< T >
 
class  ocs2::LockedConstPtr< T >
 
class  ocs2::Synchronized< T >
 
class  ocs2::TaskBase
 
class  ocs2::Task< Functor >
 
class  ocs2::ThreadPool
 
struct  ocs2::ModelDataBase
 
class  ocs2::OCS2NumericTraits< T >
 
class  ocs2::PenaltyFunctionBase
 
class  ocs2::QuadraticPenaltyFunction
 
class  ocs2::RelaxedBarrierPenaltyFunction
 
class  ocs2::SmoothAbsolutePenaltyFunction
 
class  ocs2::SquaredHingePenaltyFunction
 
class  ocs2::SoftConstraintPenalty
 
class  ocs2::StateInputSoftConstraint
 
class  ocs2::StateSoftConstraint
 
struct  ocs2::ScalarFunctionQuadraticApproximation
 
struct  ocs2::VectorFunctionLinearApproximation
 
struct  ocs2::VectorFunctionQuadraticApproximation
 

Typedefs

using ocs2::ad_base_t = CppAD::cg::CG< scalar_t >
 
using ocs2::ad_scalar_t = CppAD::AD< ad_base_t >
 
using ocs2::ad_vector_t = Eigen::Matrix< ad_scalar_t, Eigen::Dynamic, 1 >
 
using ocs2::ad_matrix_t = Eigen::Matrix< ad_scalar_t, Eigen::Dynamic, Eigen::Dynamic >
 
template<typename T >
using ocs2::EnableIfStateConstraint_t = typename std::enable_if< std::is_same< T, StateConstraint >::value, bool >::type
 
template<typename T >
using ocs2::EnableIfStateInputConstraint_t = typename std::enable_if< std::is_same< T, StateInputConstraint >::value, bool >::type
 
template<typename T >
using ocs2::EnableIfStateCost_t = typename std::enable_if< std::is_same< T, StateCost >::value, bool >::type
 
template<typename T >
using ocs2::EnableIfStateInputCost_t = typename std::enable_if< std::is_same< T, StateInputCost >::value, bool >::type
 
using ocs2::IntegratorEuler = Integrator< euler_t >
 
using ocs2::IntegratorModifiedMidpoint = Integrator< modified_midpoint_t >
 
using ocs2::IntegratorRK4 = Integrator< runge_kutta_4_t >
 
using ocs2::IntegratorRK5Variable = Integrator< dense_runge_kutta5_t >
 
using ocs2::ODE45 = Integrator< runge_kutta_dopri5_t >
 
template<size_t STEPS>
using ocs2::IntegratorAdamsBashforth = Integrator< adams_bashforth_uncontrolled_t< STEPS > >
 
using ocs2::IntegratorBulirschStoer = Integrator< bulirsch_stoer_t >
 
using ocs2::euler_t = boost::numeric::odeint::euler< vector_t, scalar_t, vector_t, scalar_t, boost::numeric::odeint::vector_space_algebra >
 
using ocs2::modified_midpoint_t = boost::numeric::odeint::modified_midpoint< vector_t, scalar_t, vector_t, scalar_t, boost::numeric::odeint::vector_space_algebra >
 
using ocs2::runge_kutta_4_t = boost::numeric::odeint::runge_kutta4< vector_t, scalar_t, vector_t, scalar_t, boost::numeric::odeint::vector_space_algebra >
 
using ocs2::runge_kutta_dopri5_t = boost::numeric::odeint::runge_kutta_dopri5< vector_t, scalar_t, vector_t, scalar_t, boost::numeric::odeint::vector_space_algebra >
 
using ocs2::dense_runge_kutta5_t = boost::numeric::odeint::dense_output_runge_kutta< boost::numeric::odeint::controlled_runge_kutta< runge_kutta_dopri5_t > >
 
using ocs2::bulirsch_stoer_t = boost::numeric::odeint::bulirsch_stoer< vector_t, scalar_t, vector_t, scalar_t, boost::numeric::odeint::vector_space_algebra >
 
template<size_t STEPS>
using ocs2::adams_bashforth_uncontrolled_t = boost::numeric::odeint::adams_bashforth< STEPS, vector_t, scalar_t, vector_t, scalar_t, boost::numeric::odeint::vector_space_algebra >
 
using ocs2::size_array_t = std::vector< size_t >
 
using ocs2::size_array2_t = std::vector< size_array_t >
 
using ocs2::scalar_t = double
 
using ocs2::scalar_array_t = std::vector< scalar_t >
 
using ocs2::scalar_array2_t = std::vector< scalar_array_t >
 
using ocs2::scalar_array3_t = std::vector< scalar_array2_t >
 
using ocs2::vector_t = Eigen::Matrix< scalar_t, Eigen::Dynamic, 1 >
 
using ocs2::vector_array_t = std::vector< vector_t >
 
using ocs2::vector_array2_t = std::vector< vector_array_t >
 
using ocs2::vector_array3_t = std::vector< vector_array2_t >
 
using ocs2::row_vector_t = Eigen::Matrix< scalar_t, 1, Eigen::Dynamic >
 
using ocs2::matrix_t = Eigen::Matrix< scalar_t, Eigen::Dynamic, Eigen::Dynamic >
 
using ocs2::matrix_array_t = std::vector< matrix_t >
 
using ocs2::matrix_array2_t = std::vector< matrix_array_t >
 
using ocs2::matrix_array3_t = std::vector< matrix_array2_t >
 
using ocs2::eigen_scalar_t = Eigen::Matrix< scalar_t, 1, 1 >
 
using ocs2::eigen_scalar_array_t = std::vector< eigen_scalar_t >
 
using ocs2::eigen_scalar_array2_t = std::vector< eigen_scalar_array_t >
 
using ocs2::eigen_scalar_array3_t = std::vector< eigen_scalar_array2_t >
 

Enumerations

enum  ocs2::ControllerType {
  ocs2::ControllerType::UNKNOWN,
  ocs2::ControllerType::FEEDFORWARD,
  ocs2::ControllerType::LINEAR,
  ocs2::ControllerType::NEURAL_NETWORK
}
 
enum  ocs2::IntegratorType {
  ocs2::IntegratorType::EULER,
  ocs2::IntegratorType::ODE45,
  ocs2::IntegratorType::ODE45_OCS2,
  ocs2::IntegratorType::ADAMS_BASHFORTH,
  ocs2::IntegratorType::BULIRSCH_STOER,
  ocs2::IntegratorType::MODIFIED_MIDPOINT,
  ocs2::IntegratorType::RK4,
  ocs2::IntegratorType::RK5_VARIABLE,
  ocs2::IntegratorType::ADAMS_BASHFORTH_MOULTON
}
 The IntegratorType enum Enum used in selecting a specific integrator. More...
 
enum  ocs2::sys_event_id {
  ocs2::killIntegration = -1,
  ocs2::maxCall = -2
}
 
enum  ocs2::LoopshapingType {
  ocs2::LoopshapingType::outputpattern,
  ocs2::LoopshapingType::inputpattern,
  ocs2::LoopshapingType::eliminatepattern
}
 
enum  ocs2::ConstraintOrder {
  ocs2::ConstraintOrder::Linear,
  ocs2::ConstraintOrder::Quadratic
}
 

Functions

matrix_t ocs2::finiteDifferenceDerivative (std::function< vector_t(const vector_t &)> f, const vector_t &x0, scalar_t eps=Eigen::NumTraits< scalar_t >::epsilon(), bool doubleSidedDerivative=true)
 
matrix_t ocs2::finiteDifferenceDerivativeState (ControlledSystemBase &system, scalar_t t, const vector_t &x, const vector_t &u, scalar_t eps=Eigen::NumTraits< scalar_t >::epsilon(), bool doubleSidedDerivative=true, bool isSecondOrderSystem=false)
 
matrix_t ocs2::finiteDifferenceDerivativeInput (ControlledSystemBase &system, scalar_t t, const vector_t &x, const vector_t &u, scalar_t eps=Eigen::NumTraits< scalar_t >::epsilon(), bool doubleSidedDerivative=true, bool isSecondOrderSystem=false)
 
void ocs2::swap (FeedforwardController &a, FeedforwardController &b) noexcept
 
std::ostream & ocs2::operator<< (std::ostream &out, const FeedforwardController &controller)
 
void ocs2::swap (LinearController &a, LinearController &b) noexcept
 
std::ostream & ocs2::operator<< (std::ostream &out, const LinearController &controller)
 
std::ostream & ocs2::operator<< (std::ostream &out, const CostDesiredTrajectories &traj)
 
void ocs2::tf2ss (vector_t numCoefficients, vector_t denCoefficients, matrix_t &A, matrix_t &B, matrix_t &C, matrix_t &D, scalar_t timeDelay=0.0, bool balance=true)
 
std::unique_ptr< IntegratorBaseocs2::newIntegrator (IntegratorType integratorType, const std::shared_ptr< SystemEventHandler > &eventHandlerPtr=nullptr)
 
template<typename SCALAR_T >
SCALAR_T ocs2::trapezoidalIntegration (const std::vector< SCALAR_T > &timeTrajectory, const std::vector< SCALAR_T > &valueTrajectory)
 
void ocs2::swap (ModeSchedule &lh, ModeSchedule &rh)
 
std::ostream & ocs2::operator<< (std::ostream &stream, const ModeSchedule &modeSchedule)
 
template<typename Container >
std::string ocs2::toDelimitedString (const Container &container, const std::string &delimiter=", ")
 
void ocs2::setThreadPriority (const int priority, std::thread &thread)
 
template<typename... SV>
auto ocs2::synchronizeLock (SV &... sv) -> std::tuple< decltype(sv.adoptLock())... >
 
std::ostream & ocs2::operator<< (std::ostream &out, const ModelDataBase &data)
 
std::ostream & ocs2::operator<< (std::ostream &out, const ScalarFunctionQuadraticApproximation &f)
 
std::ostream & ocs2::operator<< (std::ostream &out, const VectorFunctionLinearApproximation &f)
 
std::ostream & ocs2::operator<< (std::ostream &out, const VectorFunctionQuadraticApproximation &f)
 
void ocs2::Integrator< Stepper >::runIntegrateConst (system_func_t system, observer_func_t observer, const vector_t &initialState, scalar_t startTime, scalar_t finalTime, scalar_t dt) override
 
void ocs2::Integrator< Stepper >::runIntegrateAdaptive (system_func_t system, observer_func_t observer, const vector_t &initialState, scalar_t startTime, scalar_t finalTime, scalar_t dtInitial, scalar_t AbsTol, scalar_t RelTol) override
 
void ocs2::Integrator< Stepper >::runIntegrateTimes (system_func_t system, observer_func_t observer, const vector_t &initialState, typename scalar_array_t::const_iterator beginTimeItr, typename scalar_array_t::const_iterator endTimeItr, scalar_t dtInitial, scalar_t AbsTol, scalar_t RelTol) override
 
template<typename S >
std::enable_if< std::is_same< S, runge_kutta_dopri5_t >::value, void >::type ocs2::Integrator< Stepper >::integrateAdaptiveSpecialized (system_func_t system, observer_func_t observer, vector_t &initialState, scalar_t startTime, scalar_t finalTime, scalar_t dtInitial, scalar_t AbsTol, scalar_t RelTol)
 
template<typename S = Stepper>
std::enable_if< std::is_same< S, runge_kutta_dopri5_t >::value, void >::type ocs2::Integrator< Stepper >::integrateTimesSpecialized (system_func_t system, observer_func_t observer, vector_t &initialState, typename scalar_array_t::const_iterator beginTimeItr, typename scalar_array_t::const_iterator endTimeItr, scalar_t dtInitial, scalar_t AbsTol, scalar_t RelTol)
 
template<typename S = Stepper>
std::enable_if< std::is_same< S, runge_kutta_dopri5_t >::value, void >::type ocs2::Integrator< Stepper >::initializeStepper (vector_t &initialState, scalar_t t, scalar_t dt)
 
template<typename Functor >
std::future< typename std::result_of< Functor(int)>::type > ocs2::ThreadPool::run (Functor taskFunction)
 
template<typename Functor >
std::future< typename std::result_of< Functor(int)>::type > ocs2::ThreadPool::run (Functor taskFunction, int &thisTaskId)
 
template<typename Functor >
std::future< typename std::result_of< Functor(int)>::type > ocs2::ThreadPool::runAfter (int runAfterId, Functor taskFunction)
 
template<typename Functor >
std::future< typename std::result_of< Functor(int)>::type > ocs2::ThreadPool::runAfter (int runAfterId, Functor taskFunction, int &thisTaskId)
 

Typedef Documentation

◆ ad_base_t

using ocs2::ad_base_t = typedef CppAD::cg::CG<scalar_t>

Scalar type.

◆ ad_matrix_t

using ocs2::ad_matrix_t = typedef Eigen::Matrix<ad_scalar_t, Eigen::Dynamic, Eigen::Dynamic>

◆ ad_scalar_t

using ocs2::ad_scalar_t = typedef CppAD::AD<ad_base_t>

◆ ad_vector_t

using ocs2::ad_vector_t = typedef Eigen::Matrix<ad_scalar_t, Eigen::Dynamic, 1>

Dynamic-size vector type.

◆ adams_bashforth_uncontrolled_t

template<size_t STEPS>
using ocs2::adams_bashforth_uncontrolled_t = typedef boost::numeric::odeint::adams_bashforth<STEPS, vector_t, scalar_t, vector_t, scalar_t, boost::numeric::odeint::vector_space_algebra>

Adams_Bashforth stepper

◆ bulirsch_stoer_t

using ocs2::bulirsch_stoer_t = typedef boost::numeric::odeint::bulirsch_stoer<vector_t, scalar_t, vector_t, scalar_t, boost::numeric::odeint::vector_space_algebra>

Bulirsch_Stoer stepper

◆ dense_runge_kutta5_t

using ocs2::dense_runge_kutta5_t = typedef boost::numeric::odeint::dense_output_runge_kutta<boost::numeric::odeint::controlled_runge_kutta<runge_kutta_dopri5_t> >

Dense_output Runge_Kutta stepper

◆ eigen_scalar_array2_t

using ocs2::eigen_scalar_array2_t = typedef std::vector<eigen_scalar_array_t>

Array of eigen scalar trajectory type.

◆ eigen_scalar_array3_t

using ocs2::eigen_scalar_array3_t = typedef std::vector<eigen_scalar_array2_t>

Array of arrays of eigen scalar trajectory type.

◆ eigen_scalar_array_t

using ocs2::eigen_scalar_array_t = typedef std::vector<eigen_scalar_t>

Eigen scalar trajectory type.

◆ eigen_scalar_t

using ocs2::eigen_scalar_t = typedef Eigen::Matrix<scalar_t, 1, 1>

Eigen scalar type.

◆ EnableIfStateConstraint_t

template<typename T >
using ocs2::EnableIfStateConstraint_t = typedef typename std::enable_if<std::is_same<T, StateConstraint>::value, bool>::type

◆ EnableIfStateCost_t

template<typename T >
using ocs2::EnableIfStateCost_t = typedef typename std::enable_if<std::is_same<T, StateCost>::value, bool>::type

◆ EnableIfStateInputConstraint_t

template<typename T >
using ocs2::EnableIfStateInputConstraint_t = typedef typename std::enable_if<std::is_same<T, StateInputConstraint>::value, bool>::type

◆ EnableIfStateInputCost_t

template<typename T >
using ocs2::EnableIfStateInputCost_t = typedef typename std::enable_if<std::is_same<T, StateInputCost>::value, bool>::type

◆ euler_t

using ocs2::euler_t = typedef boost::numeric::odeint::euler<vector_t, scalar_t, vector_t, scalar_t, boost::numeric::odeint::vector_space_algebra>

Euler stepper

◆ IntegratorAdamsBashforth

template<size_t STEPS>
using ocs2::IntegratorAdamsBashforth = typedef Integrator<adams_bashforth_uncontrolled_t<STEPS> >

Adams-Bashforth integrator.

◆ IntegratorBulirschStoer

Bulirsch-Stoer integrator.

◆ IntegratorEuler

Euler integrator.

◆ IntegratorModifiedMidpoint

Modified midpoint integrator.

◆ IntegratorRK4

RK4 integrator.

◆ IntegratorRK5Variable

RK5 variable integrator.

◆ matrix_array2_t

using ocs2::matrix_array2_t = typedef std::vector<matrix_array_t>

Array of dynamic matrix's trajectory type.

◆ matrix_array3_t

using ocs2::matrix_array3_t = typedef std::vector<matrix_array2_t>

Array of arrays of dynamic matrix trajectory type.

◆ matrix_array_t

using ocs2::matrix_array_t = typedef std::vector<matrix_t>

Dynamic matrix's trajectory type.

◆ matrix_t

using ocs2::matrix_t = typedef Eigen::Matrix<scalar_t, Eigen::Dynamic, Eigen::Dynamic>

Dynamic-size matrix type.

◆ modified_midpoint_t

using ocs2::modified_midpoint_t = typedef boost::numeric::odeint::modified_midpoint<vector_t, scalar_t, vector_t, scalar_t, boost::numeric::odeint::vector_space_algebra>

Modified_Midpoint stepper

◆ ODE45

ode45 integrator.

◆ row_vector_t

using ocs2::row_vector_t = typedef Eigen::Matrix<scalar_t, 1, Eigen::Dynamic>

Dynamic-size row vector type.

◆ runge_kutta_4_t

using ocs2::runge_kutta_4_t = typedef boost::numeric::odeint::runge_kutta4<vector_t, scalar_t, vector_t, scalar_t, boost::numeric::odeint::vector_space_algebra>

4th order Runge_Kutta stepper

◆ runge_kutta_dopri5_t

using ocs2::runge_kutta_dopri5_t = typedef boost::numeric::odeint::runge_kutta_dopri5<vector_t, scalar_t, vector_t, scalar_t, boost::numeric::odeint::vector_space_algebra>

5th order Runge_Kutta_Dopri stepper

◆ scalar_array2_t

using ocs2::scalar_array2_t = typedef std::vector<scalar_array_t>

Array of scalar trajectory type.

◆ scalar_array3_t

using ocs2::scalar_array3_t = typedef std::vector<scalar_array2_t>

Array of arrays of scalar trajectory type.

◆ scalar_array_t

using ocs2::scalar_array_t = typedef std::vector<scalar_t>

Scalar trajectory type.

◆ scalar_t

using ocs2::scalar_t = typedef double

Scalar type.

◆ size_array2_t

using ocs2::size_array2_t = typedef std::vector<size_array_t>

Array of size_t trajectory type.

◆ size_array_t

using ocs2::size_array_t = typedef std::vector<size_t>

size_t trajectory type.

◆ vector_array2_t

using ocs2::vector_array2_t = typedef std::vector<vector_array_t>

Array of dynamic vector's trajectory type.

◆ vector_array3_t

using ocs2::vector_array3_t = typedef std::vector<vector_array2_t>

Array of arrays of dynamic vector trajectory type.

◆ vector_array_t

using ocs2::vector_array_t = typedef std::vector<vector_t>

Dynamic vector's trajectory type.

◆ vector_t

using ocs2::vector_t = typedef Eigen::Matrix<scalar_t, Eigen::Dynamic, 1>

Dynamic-size vector type.

Enumeration Type Documentation

◆ ConstraintOrder

enum ocs2::ConstraintOrder
strong
Enumerator
Linear 
Quadratic 

◆ ControllerType

enum ocs2::ControllerType
strong

Enum class for specifying controller type

Enumerator
UNKNOWN 
FEEDFORWARD 
LINEAR 
NEURAL_NETWORK 

◆ IntegratorType

enum ocs2::IntegratorType
strong

The IntegratorType enum Enum used in selecting a specific integrator.

Enumerator
EULER 
ODE45 
ODE45_OCS2 
ADAMS_BASHFORTH 
BULIRSCH_STOER 
MODIFIED_MIDPOINT 
RK4 
RK5_VARIABLE 
ADAMS_BASHFORTH_MOULTON 

◆ LoopshapingType

enum ocs2::LoopshapingType
strong
Enumerator
outputpattern 
inputpattern 
eliminatepattern 

◆ sys_event_id

System event ID. all values are negative.

Enumerator
killIntegration 

killIntegration: kill integration due to an external signal.

maxCall 

maximum number of function calls.

Function Documentation

◆ finiteDifferenceDerivative()

matrix_t ocs2::finiteDifferenceDerivative ( std::function< vector_t(const vector_t &)>  f,
const vector_t x0,
scalar_t  eps = Eigen::NumTraits< scalar_t >::epsilon(),
bool  doubleSidedDerivative = true 
)

◆ finiteDifferenceDerivativeInput()

matrix_t ocs2::finiteDifferenceDerivativeInput ( ControlledSystemBase system,
scalar_t  t,
const vector_t x,
const vector_t u,
scalar_t  eps = Eigen::NumTraits< scalar_t >::epsilon(),
bool  doubleSidedDerivative = true,
bool  isSecondOrderSystem = false 
)

◆ finiteDifferenceDerivativeState()

matrix_t ocs2::finiteDifferenceDerivativeState ( ControlledSystemBase system,
scalar_t  t,
const vector_t x,
const vector_t u,
scalar_t  eps = Eigen::NumTraits< scalar_t >::epsilon(),
bool  doubleSidedDerivative = true,
bool  isSecondOrderSystem = false 
)

◆ initializeStepper()

template<class Stepper >
template<typename S >
std::enable_if<!(std::is_same< S, runge_kutta_dopri5_t >::value), void >::type ocs2::Integrator< Stepper >::initializeStepper ( vector_t initialState,
scalar_t  t,
scalar_t  dt 
)
inlineprivate

Functionality to reset stepper. If we integrate with ODE45, we don't need to reset the stepper, hence specialize empty function

Template Parameters
Sstepper type.
Parameters
[in]initialStateInitial state.
[in]tTime.
[in]dtTime step.

do nothing, runge_kutta_5_t does not have a init method

◆ integrateAdaptiveSpecialized()

template<class Stepper >
template<typename S >
std::enable_if<!std::is_same< S, runge_kutta_dopri5_t >::value, void >::type ocs2::Integrator< Stepper >::integrateAdaptiveSpecialized ( system_func_t  system,
observer_func_t  observer,
vector_t initialState,
scalar_t  startTime,
scalar_t  finalTime,
scalar_t  dtInitial,
scalar_t  AbsTol,
scalar_t  RelTol 
)
inlineprivate

Integrate adaptive specialized.

Template Parameters
Sstepper type.
Parameters
[in]systemSystem function
[in]observerObserver callback
[in]initialStateInitial state.
[in]startTimeInitial time.
[in]finalTimeFinal time.
[in]dtInitialInitial time step.
[in]AbsTolThe absolute tolerance error for ode solver.
[in]RelTolThe relative tolerance error for ode solver.

◆ integrateTimesSpecialized()

template<class Stepper >
template<typename S >
std::enable_if<!std::is_same< S, runge_kutta_dopri5_t >::value, void >::type ocs2::Integrator< Stepper >::integrateTimesSpecialized ( system_func_t  system,
observer_func_t  observer,
vector_t initialState,
typename scalar_array_t::const_iterator  beginTimeItr,
typename scalar_array_t::const_iterator  endTimeItr,
scalar_t  dtInitial,
scalar_t  AbsTol,
scalar_t  RelTol 
)
inlineprivate

Integrate times specialized function

Template Parameters
Sstepper type.
Parameters
[in]systemSystem function
[in]observerObserver callback
[in]initialStateInitial state.
[in]beginTimeItrThe iterator to the beginning of the time stamp trajectory.
[in]endTimeItrThe iterator to the end of the time stamp trajectory.
[in]dtInitialInitial time step.
[in]AbsTolThe absolute tolerance error for ode solver.
[in]RelTolThe relative tolerance error for ode solver.

◆ newIntegrator()

std::unique_ptr<IntegratorBase> ocs2::newIntegrator ( IntegratorType  integratorType,
const std::shared_ptr< SystemEventHandler > &  eventHandlerPtr = nullptr 
)

Create Integrator of given type.

Parameters
[in]integratorTypeThe integrator type.
[in]eventHandlerThe integration event function.

◆ operator<<() [1/8]

std::ostream& ocs2::operator<< ( std::ostream &  stream,
const ModeSchedule modeSchedule 
)

◆ operator<<() [2/8]

std::ostream& ocs2::operator<< ( std::ostream &  out,
const CostDesiredTrajectories traj 
)

◆ operator<<() [3/8]

std::ostream& ocs2::operator<< ( std::ostream &  out,
const ModelDataBase data 
)

◆ operator<<() [4/8]

std::ostream& ocs2::operator<< ( std::ostream &  out,
const FeedforwardController controller 
)

◆ operator<<() [5/8]

std::ostream& ocs2::operator<< ( std::ostream &  out,
const LinearController controller 
)

◆ operator<<() [6/8]

std::ostream& ocs2::operator<< ( std::ostream &  out,
const ScalarFunctionQuadraticApproximation f 
)

◆ operator<<() [7/8]

std::ostream& ocs2::operator<< ( std::ostream &  out,
const VectorFunctionLinearApproximation f 
)

◆ operator<<() [8/8]

std::ostream& ocs2::operator<< ( std::ostream &  out,
const VectorFunctionQuadraticApproximation f 
)

◆ run() [1/2]

template<typename Functor >
std::future< typename std::result_of< Functor(int)>::type > ocs2::ThreadPool::run ( Functor  taskFunction,
int &  thisTaskId 
)

Run a task in another thread

Parameters
[in]taskFunctiontask function to run in the pool
[out]thisTaskIdID of the new task.
Returns
future object with taskFunction retrun value

◆ run() [2/2]

template<typename Functor >
std::future< typename std::result_of< Functor(int)>::type > ocs2::ThreadPool::run ( Functor  taskFunction)

◆ runAfter() [1/2]

template<typename Functor >
std::future< typename std::result_of< Functor(int)>::type > ocs2::ThreadPool::runAfter ( int  runAfterId,
Functor  taskFunction,
int &  thisTaskId 
)

Run a task that depends on antother task

Parameters
[in]taskFunctiontask function to run in the pool.
[in]runAfterIdnew task is delayed until task with given ID has finished.
[out]thisTaskIdnew task ID.
Returns
future object with taskFunction retrun value

◆ runAfter() [2/2]

template<typename Functor >
std::future< typename std::result_of< Functor(int)>::type > ocs2::ThreadPool::runAfter ( int  runAfterId,
Functor  taskFunction 
)

◆ runIntegrateAdaptive()

template<class Stepper >
void ocs2::Integrator< Stepper >::runIntegrateAdaptive ( system_func_t  system,
observer_func_t  observer,
const vector_t initialState,
scalar_t  startTime,
scalar_t  finalTime,
scalar_t  dtInitial,
scalar_t  AbsTol,
scalar_t  RelTol 
)
inlineoverrideprivate

Adaptive time integration based on start time and final time.

Parameters
[in]systemSystem function
[in]observerObserver callback
[in]initialStateInitial state.
[in]startTimeInitial time.
[in]finalTimeFinal time.
[in]dtInitialInitial time step.
[in]AbsTolThe absolute tolerance error for ode solver.
[in]RelTolThe relative tolerance error for ode solver.

◆ runIntegrateConst()

template<class Stepper >
void ocs2::Integrator< Stepper >::runIntegrateConst ( system_func_t  system,
observer_func_t  observer,
const vector_t initialState,
scalar_t  startTime,
scalar_t  finalTime,
scalar_t  dt 
)
inlineoverrideprivate

Equidistant integration based on initial and final time as well as step length.

Parameters
[in]systemSystem function
[in]observerObserver callback
[in]initialStateInitial state.
[in]startTimeInitial time.
[in]finalTimeFinal time.
[in]dtTime step.

◆ runIntegrateTimes()

template<class Stepper >
void ocs2::Integrator< Stepper >::runIntegrateTimes ( system_func_t  system,
observer_func_t  observer,
const vector_t initialState,
typename scalar_array_t::const_iterator  beginTimeItr,
typename scalar_array_t::const_iterator  endTimeItr,
scalar_t  dtInitial,
scalar_t  AbsTol,
scalar_t  RelTol 
)
inlineoverrideprivate

Output integration based on a given time trajectory.

Parameters
[in]systemSystem function
[in]observerObserver callback
[in]initialStateInitial state.
[in]beginTimeItrThe iterator to the beginning of the time stamp trajectory.
[in]endTimeItrThe iterator to the end of the time stamp trajectory.
[in]dtInitialInitial time step.
[in]AbsTolThe absolute tolerance error for ode solver.
[in]RelTolThe relative tolerance error for ode solver.

◆ setThreadPriority()

void ocs2::setThreadPriority ( const int  priority,
std::thread &  thread 
)
inline

Sets the priority of the input thread.

Parameters
priorityThe priority of the thread from 0 (lowest) to 99 (highest)
threadA reference to the tread.

◆ swap() [1/3]

void ocs2::swap ( ModeSchedule lh,
ModeSchedule rh 
)

◆ swap() [2/3]

void ocs2::swap ( FeedforwardController a,
FeedforwardController b 
)
noexcept

◆ swap() [3/3]

void ocs2::swap ( LinearController a,
LinearController b 
)
noexcept

◆ synchronizeLock()

template<typename... SV>
auto ocs2::synchronizeLock ( SV &...  sv) -> std::tuple<decltype(sv.adoptLock())...>

Helper function to lock multiple synchronized<T> objects simultaneously, preventing deadlocks.

Returns
a tuple of LockedPtr<T> / LockedConstPtr<T>.

◆ tf2ss()

void ocs2::tf2ss ( vector_t  numCoefficients,
vector_t  denCoefficients,
matrix_t A,
matrix_t B,
matrix_t C,
matrix_t D,
scalar_t  timeDelay = 0.0,
bool  balance = true 
)
inline

◆ toDelimitedString()

template<typename Container >
std::string ocs2::toDelimitedString ( const Container &  container,
const std::string &  delimiter = ", " 
)

Loops over the elements in a container and creates a delimited string

◆ trapezoidalIntegration()

template<typename SCALAR_T >
SCALAR_T ocs2::trapezoidalIntegration ( const std::vector< SCALAR_T > &  timeTrajectory,
const std::vector< SCALAR_T > &  valueTrajectory 
)