OCS2 Manual  v1.0.0
OCS2 Documentation
ocs2_core

Detailed Description

Namespaces

 ocs2::cppad_sparsity
 
 ocs2::loopshaping_property_tree
 
 ocs2::benchmark
 
 ocs2::LinearAlgebra
 
 ocs2::loadData
 
 ocs2::lookup
 
 ocs2::numerics
 

Classes

class  ocs2::CppAdInterface< scalar_t >
 
class  ocs2::FiniteDifferenceMethods< ControlledSystemBase >
 
class  ocs2::ConstraintBase< STATE_DIM, INPUT_DIM >
 
class  ocs2::ConstraintBaseAD< STATE_DIM, INPUT_DIM >
 
class  ocs2::LinearConstraint< STATE_DIM, INPUT_DIM >
 
class  ocs2::PenaltyBase< STATE_DIM, INPUT_DIM >
 
class  ocs2::RelaxedBarrierPenalty< STATE_DIM, INPUT_DIM >
 
class  ocs2::ControllerAdjustmentBase< STATE_DIM, INPUT_DIM >
 
class  ocs2::ControllerBase< STATE_DIM, INPUT_DIM >
 
class  ocs2::FeedforwardController< STATE_DIM, INPUT_DIM >
 
class  ocs2::LinearController< STATE_DIM, INPUT_DIM >
 
class  ocs2::NeuralNetworkController< STATE_DIM, INPUT_DIM >
 
class  ocs2::TrajectorySpreadingControllerAdjustment< STATE_DIM, INPUT_DIM >
 
class  ocs2::CostDesiredTrajectories< SCALAR_T >
 
class  ocs2::CostFunctionBase< STATE_DIM, INPUT_DIM >
 
class  ocs2::CostFunctionBaseAD< STATE_DIM, INPUT_DIM >
 
class  ocs2::CostFunctionLinearCombination< STATE_DIM, INPUT_DIM >
 
class  ocs2::QuadraticCostFunction< STATE_DIM, INPUT_DIM >
 
class  ocs2::Dimensions< STATE_DIM, INPUT_DIM >
 
class  ocs2::ControlledSystemBase< STATE_DIM, INPUT_DIM >
 
class  ocs2::DerivativesBase< STATE_DIM, INPUT_DIM >
 
class  ocs2::LinearSystemDynamics< STATE_DIM, INPUT_DIM >
 
class  ocs2::SystemDynamicsBase< STATE_DIM, INPUT_DIM, NUM_MODES >
 
class  ocs2::SystemDynamicsBaseAD< STATE_DIM, INPUT_DIM, NUM_MODES >
 
class  ocs2::SystemDynamicsLinearizer< STATE_DIM, INPUT_DIM >
 
class  ocs2::TransferFunctionBase
 
class  ocs2::SystemOperatingPoint< STATE_DIM, INPUT_DIM >
 
class  ocs2::SystemOperatingTrajectoriesBase< STATE_DIM, INPUT_DIM >
 
class  ocs2::EventHandlerBase< STATE_DIM >
 
class  ocs2::Integrator< STATE_DIM, Stepper >
 
class  ocs2::IntegratorBase< STATE_DIM >
 
class  ocs2::Observer< STATE_DIM >
 
class  ocs2::OdeBase< STATE_DIM >
 
class  ocs2::OdeFunc< STATE_DIM >
 
class  ocs2::StateTriggeredEventHandler< STATE_DIM >
 
class  ocs2::SystemEventHandler< STATE_DIM >
 
class  ocs2::HybridLogicRulesMachine
 
class  ocs2::HybridLogicRules
 
struct  ocs2::ModeSequenceTemplate< scalar_t >
 
class  ocs2::NullLogicRules
 
class  ocs2::LoopshapingConstraint< FULL_STATE_DIM, FULL_INPUT_DIM, SYSTEM_STATE_DIM, SYSTEM_INPUT_DIM, FILTER_STATE_DIM, FILTER_INPUT_DIM >
 
class  ocs2::LoopshapingConstraintEliminatePattern< FULL_STATE_DIM, FULL_INPUT_DIM, SYSTEM_STATE_DIM, SYSTEM_INPUT_DIM, FILTER_STATE_DIM, FILTER_INPUT_DIM >
 
class  ocs2::LoopshapingConstraintInputPattern< FULL_STATE_DIM, FULL_INPUT_DIM, SYSTEM_STATE_DIM, SYSTEM_INPUT_DIM, FILTER_STATE_DIM, FILTER_INPUT_DIM >
 
class  ocs2::LoopshapingConstraintOutputPattern< FULL_STATE_DIM, FULL_INPUT_DIM, SYSTEM_STATE_DIM, SYSTEM_INPUT_DIM, FILTER_STATE_DIM, FILTER_INPUT_DIM >
 
class  ocs2::LoopshapingCost< FULL_STATE_DIM, FULL_INPUT_DIM, SYSTEM_STATE_DIM, SYSTEM_INPUT_DIM, FILTER_STATE_DIM, FILTER_INPUT_DIM >
 
class  ocs2::LoopshapingCostEliminatePattern< FULL_STATE_DIM, FULL_INPUT_DIM, SYSTEM_STATE_DIM, SYSTEM_INPUT_DIM, FILTER_STATE_DIM, FILTER_INPUT_DIM >
 
class  ocs2::LoopshapingCostInputPattern< FULL_STATE_DIM, FULL_INPUT_DIM, SYSTEM_STATE_DIM, SYSTEM_INPUT_DIM, FILTER_STATE_DIM, FILTER_INPUT_DIM >
 
class  ocs2::LoopshapingCostOutputPattern< FULL_STATE_DIM, FULL_INPUT_DIM, SYSTEM_STATE_DIM, SYSTEM_INPUT_DIM, FILTER_STATE_DIM, FILTER_INPUT_DIM >
 
class  ocs2::LoopshapingDynamics< FULL_STATE_DIM, FULL_INPUT_DIM, SYSTEM_STATE_DIM, SYSTEM_INPUT_DIM, FILTER_STATE_DIM, FILTER_INPUT_DIM >
 
class  ocs2::LoopshapingDynamicsDerivative< FULL_STATE_DIM, FULL_INPUT_DIM, SYSTEM_STATE_DIM, SYSTEM_INPUT_DIM, FILTER_STATE_DIM, FILTER_INPUT_DIM >
 
class  ocs2::LoopshapingDynamicsDerivativeEliminatePattern< FULL_STATE_DIM, FULL_INPUT_DIM, SYSTEM_STATE_DIM, SYSTEM_INPUT_DIM, FILTER_STATE_DIM, FILTER_INPUT_DIM >
 
class  ocs2::LoopshapingDynamicsDerivativeInputPattern< FULL_STATE_DIM, FULL_INPUT_DIM, SYSTEM_STATE_DIM, SYSTEM_INPUT_DIM, FILTER_STATE_DIM, FILTER_INPUT_DIM >
 
class  ocs2::LoopshapingDynamicsDerivativeOutputPattern< FULL_STATE_DIM, FULL_INPUT_DIM, SYSTEM_STATE_DIM, SYSTEM_INPUT_DIM, FILTER_STATE_DIM, FILTER_INPUT_DIM >
 
class  ocs2::LoopshapingDynamicsInputPattern< FULL_STATE_DIM, FULL_INPUT_DIM, SYSTEM_STATE_DIM, SYSTEM_INPUT_DIM, FILTER_STATE_DIM, FILTER_INPUT_DIM >
 
class  ocs2::LoopshapingDynamicsOutputPattern< FULL_STATE_DIM, FULL_INPUT_DIM, SYSTEM_STATE_DIM, SYSTEM_INPUT_DIM, FILTER_STATE_DIM, FILTER_INPUT_DIM >
 
class  ocs2::LoopshapingFilterDynamics< FULL_STATE_DIM, FULL_INPUT_DIM, SYSTEM_STATE_DIM, SYSTEM_INPUT_DIM, FILTER_STATE_DIM, FILTER_INPUT_DIM >
 
class  ocs2::LoopshapingDefinition
 
class  ocs2::Filter
 
class  ocs2::LoopshapingOperatingPoint< FULL_STATE_DIM, FULL_INPUT_DIM, SYSTEM_STATE_DIM, SYSTEM_INPUT_DIM, FILTER_STATE_DIM, FILTER_INPUT_DIM >
 
class  ocs2::LinearFunction< STATE_DIM, DIM1, DIM2, scalar_t >
 
class  ocs2::LinearInterpolation< Data_T, Alloc >
 
class  ocs2::LTI_Equations< DIM1, DIM2, SCALAR_T >
 
class  ocs2::TaskBase
 
class  ocs2::Task< Functor >
 
class  ocs2::ThreadPool
 
class  ocs2::OCS2NumericTraits< T >
 

Typedefs

template<int STATE_DIM>
using ocs2::IntegratorEuler = Integrator< STATE_DIM, euler_t< STATE_DIM > >
 
template<int STATE_DIM>
using ocs2::IntegratorModifiedMidpoint = Integrator< STATE_DIM, modified_midpoint_t< STATE_DIM > >
 
template<int STATE_DIM>
using ocs2::IntegratorRK4 = Integrator< STATE_DIM, runge_kutta_4_t< STATE_DIM > >
 
template<int STATE_DIM>
using ocs2::IntegratorRK5Variable = Integrator< STATE_DIM, dense_runge_kutta5_t< STATE_DIM > >
 
template<int STATE_DIM>
using ocs2::ODE45 = Integrator< STATE_DIM, runge_kutta_dopri5_t< STATE_DIM > >
 
template<int STATE_DIM, size_t STEPS>
using ocs2::IntegratorAdamsBashforth = Integrator< STATE_DIM, adams_bashforth_uncontrolled_t< STATE_DIM, STEPS > >
 
template<int STATE_DIM>
using ocs2::IntegratorBulirschStoer = Integrator< STATE_DIM, bulirsch_stoer_t< STATE_DIM > >
 
template<int STATE_DIM>
using ocs2::euler_t = boost::numeric::odeint::euler< Eigen::Matrix< double, STATE_DIM, 1 >, double, Eigen::Matrix< double, STATE_DIM, 1 >, double, boost::numeric::odeint::vector_space_algebra >
 
template<int STATE_DIM>
using ocs2::modified_midpoint_t = boost::numeric::odeint::modified_midpoint< Eigen::Matrix< double, STATE_DIM, 1 >, double, Eigen::Matrix< double, STATE_DIM, 1 >, double, boost::numeric::odeint::vector_space_algebra >
 
template<int STATE_DIM>
using ocs2::runge_kutta_4_t = boost::numeric::odeint::runge_kutta4< Eigen::Matrix< double, STATE_DIM, 1 >, double, Eigen::Matrix< double, STATE_DIM, 1 >, double, boost::numeric::odeint::vector_space_algebra >
 
template<int STATE_DIM>
using ocs2::runge_kutta_dopri5_t = boost::numeric::odeint::runge_kutta_dopri5< Eigen::Matrix< double, STATE_DIM, 1 >, double, Eigen::Matrix< double, STATE_DIM, 1 >, double, boost::numeric::odeint::vector_space_algebra >
 
template<int STATE_DIM>
using ocs2::dense_runge_kutta5_t = boost::numeric::odeint::dense_output_runge_kutta< boost::numeric::odeint::controlled_runge_kutta< runge_kutta_dopri5_t< STATE_DIM > >>
 
template<int STATE_DIM>
using ocs2::bulirsch_stoer_t = boost::numeric::odeint::bulirsch_stoer< Eigen::Matrix< double, STATE_DIM, 1 >, double, Eigen::Matrix< double, STATE_DIM, 1 >, double, boost::numeric::odeint::vector_space_algebra >
 
template<int STATE_DIM, size_t STEPS>
using ocs2::adams_bashforth_uncontrolled_t = boost::numeric::odeint::adams_bashforth< STEPS, Eigen::Matrix< double, STATE_DIM, 1 >, double, Eigen::Matrix< double, STATE_DIM, 1 >, double, boost::numeric::odeint::vector_space_algebra >
 
template<size_t FULL_STATE_DIM, size_t FULL_INPUT_DIM, size_t SYSTEM_STATE_DIM, size_t SYSTEM_INPUT_DIM, size_t FILTER_STATE_DIM, size_t FILTER_INPUT_DIM>
using ocs2::LoopshapingDynamicsEliminatePattern = LoopshapingDynamicsInputPattern< FULL_STATE_DIM, FULL_INPUT_DIM, SYSTEM_STATE_DIM, SYSTEM_INPUT_DIM, FILTER_STATE_DIM, FILTER_INPUT_DIM >
 
template<typename Data_T >
using ocs2::EigenLinearInterpolation = LinearInterpolation< Data_T, Eigen::aligned_allocator< Data_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::MODIFIED_MIDPOINT,
  ocs2::IntegratorType::RK4,
  ocs2::IntegratorType::RK5_VARIABLE,
  ocs2::IntegratorType::ODE45,
  ocs2::IntegratorType::ADAMS_BASHFORTH,
  ocs2::IntegratorType::BULIRSCH_STOER,
  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
}
 

Functions

template<size_t STATE_DIM, size_t INPUT_DIM>
void ocs2::swap (FeedforwardController< STATE_DIM, INPUT_DIM > &a, FeedforwardController< STATE_DIM, INPUT_DIM > &b)
 
template<size_t STATE_DIM, size_t INPUT_DIM>
void ocs2::swap (LinearController< STATE_DIM, INPUT_DIM > &a, LinearController< STATE_DIM, INPUT_DIM > &b)
 
void ocs2::padeApproximation (double timeDelay, Eigen::VectorXd &numCoefficients, Eigen::VectorXd &denCoefficients, size_t numZeros, size_t numPoles)
 
Eigen::VectorXd ocs2::multiplyPolynomials (const Eigen::VectorXd &p_lhs, const Eigen::VectorXd &p_rhs)
 
void ocs2::tf2ss (Eigen::VectorXd numCoefficients, Eigen::VectorXd denCoefficients, Eigen::MatrixXd &A, Eigen::MatrixXd &B, Eigen::MatrixXd &C, Eigen::MatrixXd &D, double timeDelay=0.0, bool balance=true)
 
static std::string ocs2::toString (IntegratorType integratorType)
 
void ocs2::setThreadPriority (const int priority, std::thread &thread)
 
 ocs2::CppAdInterface< scalar_t >::CppAdInterface (ad_parameterized_function_t adFunction, int rangeDim, int variableDim, int parameterDim, std::string modelName, std::string folderName="/tmp/ocs2", std::vector< std::string > compileFlags={"-O3", "-march=native", "-mtune=native", "-ffast-math"})
 
 ocs2::CppAdInterface< scalar_t >::CppAdInterface (ad_function_t adFunction, int rangeDim, int variableDim, std::string modelName, std::string folderName="/tmp/ocs2", std::vector< std::string > compileFlags={"-O3", "-march=native", "-mtune=native", "-ffast-math"})
 
 ocs2::CppAdInterface< scalar_t >::CppAdInterface (const CppAdInterface &rhs)
 
void ocs2::CppAdInterface< scalar_t >::createModels (ApproximationOrder approximationOrder=ApproximationOrder::Second, bool verbose=true)
 
void ocs2::CppAdInterface< scalar_t >::loadModels (bool verbose=true)
 
void ocs2::CppAdInterface< scalar_t >::loadModelsIfAvailable (ApproximationOrder approximationOrder=ApproximationOrder::Second, bool verbose=true)
 
dynamic_vector_t ocs2::CppAdInterface< scalar_t >::getFunctionValue (const dynamic_vector_t &x, const dynamic_vector_t &p=dynamic_vector_t(0)) const
 
dynamic_matrix_t ocs2::CppAdInterface< scalar_t >::getJacobian (const dynamic_vector_t &x, const dynamic_vector_t &p=dynamic_vector_t(0)) const
 
dynamic_matrix_t ocs2::CppAdInterface< scalar_t >::getHessian (size_t outputIndex, const dynamic_vector_t &x, const dynamic_vector_t &p=dynamic_vector_t(0)) const
 
dynamic_matrix_t ocs2::CppAdInterface< scalar_t >::getHessian (const dynamic_vector_t &w, const dynamic_vector_t &x, const dynamic_vector_t &p=dynamic_vector_t(0)) const
 
void ocs2::CppAdInterface< scalar_t >::setFolderNames ()
 
bool ocs2::CppAdInterface< scalar_t >::isLibraryAvailable () const
 
void ocs2::CppAdInterface< scalar_t >::createFolderStructure () const
 
std::string ocs2::CppAdInterface< scalar_t >::getUniqueTemporaryName () const
 
void ocs2::CppAdInterface< scalar_t >::setCompilerOptions (CppAD::cg::GccCompiler< scalar_t > &compiler) const
 
void ocs2::CppAdInterface< scalar_t >::setApproximationOrder (ApproximationOrder approximationOrder, CppAD::cg::ModelCSourceGen< scalar_t > &sourceGen, ad_fun_t &fun) const
 
void ocs2::CppAdInterface< scalar_t >::setSparsityNonzeros ()
 
SparsityPattern ocs2::CppAdInterface< scalar_t >::createJacobianSparsity (ad_fun_t &fun) const
 
SparsityPattern ocs2::CppAdInterface< scalar_t >::createHessianSparsity (ad_fun_t &fun) const
 
 ocs2::ConstraintBaseAD< STATE_DIM, INPUT_DIM >::ConstraintBaseAD ()
 
 ocs2::ConstraintBaseAD< STATE_DIM, INPUT_DIM >::ConstraintBaseAD (const ConstraintBaseAD &rhs)
 
void ocs2::ConstraintBaseAD< STATE_DIM, INPUT_DIM >::initialize (const std::string &modelName, const std::string &modelFolder="/tmp/ocs2", bool recompileLibraries=true, bool verbose=true)
 
void ocs2::ConstraintBaseAD< STATE_DIM, INPUT_DIM >::setCurrentStateAndControl (const scalar_t &t, const state_vector_t &x, const input_vector_t &u) final
 
void ocs2::ConstraintBaseAD< STATE_DIM, INPUT_DIM >::setADInterfaces (const std::string &modelName, const std::string &modelFolder)
 
void ocs2::ConstraintBaseAD< STATE_DIM, INPUT_DIM >::createModels (bool verbose)
 
void ocs2::ConstraintBaseAD< STATE_DIM, INPUT_DIM >::loadModelsIfAvailable (bool verbose)
 
void ocs2::PenaltyBase< STATE_DIM, INPUT_DIM >::getPenaltyCost (const scalar_array_t &h, scalar_t &penalty) const
 
void ocs2::PenaltyBase< STATE_DIM, INPUT_DIM >::getPenaltyCostDerivativeState (const scalar_array_t &h, const state_vector_array_t &dhdx, state_vector_t &penaltyDerivativeState) const
 
void ocs2::PenaltyBase< STATE_DIM, INPUT_DIM >::getPenaltyCostDerivativeInput (const scalar_array_t &h, const input_vector_array_t &dhdu, input_vector_t &penaltyDerivativeInput) const
 
void ocs2::PenaltyBase< STATE_DIM, INPUT_DIM >::getPenaltyCostSecondDerivativeState (const scalar_array_t &h, const state_vector_array_t &dhdx, const state_matrix_array_t &ddhdxdx, state_matrix_t &penaltySecondDerivativeState) const
 
void ocs2::PenaltyBase< STATE_DIM, INPUT_DIM >::getPenaltyCostSecondDerivativeInput (const scalar_array_t &h, const input_vector_array_t &dhdu, const input_matrix_array_t &ddhdudu, input_matrix_t &penaltySecondDerivativeInput) const
 
void ocs2::PenaltyBase< STATE_DIM, INPUT_DIM >::getPenaltyCostDerivativeInputState (const scalar_array_t &h, const state_vector_array_t &dhdx, const input_vector_array_t &dhdu, const input_state_matrix_array_t &ddhdudx, input_state_matrix_t &penaltyDerivativeInputState) const
 
void ocs2::PenaltyBase< STATE_DIM, INPUT_DIM >::getConstraintViolationSquaredNorm (const scalar_array_t &h, scalar_t &squaredViolation) const
 
void ocs2::TrajectorySpreadingControllerAdjustment< STATE_DIM, INPUT_DIM >::findEventTimesIndices (const scalar_array_t &eventTimes, const linear_controller_array_t &controllersStock, std::vector< index_t > &eventsIndices) const
 
bool ocs2::TrajectorySpreadingControllerAdjustment< STATE_DIM, INPUT_DIM >::isSmallerEqual (const index_t &a, const index_t &b) const
 
void ocs2::TrajectorySpreadingControllerAdjustment< STATE_DIM, INPUT_DIM >::adjustController (const scalar_array_t &eventTimes, const scalar_array_t &controllerEventTimes, linear_controller_array_t &controllersStock) override
 
index_t ocs2::TrajectorySpreadingControllerAdjustment< STATE_DIM, INPUT_DIM >::findPreviousIndex (index_t index, const linear_controller_array_t &controllersStock) const
 
void ocs2::TrajectorySpreadingControllerAdjustment< STATE_DIM, INPUT_DIM >::spreadController (scalar_t eventTime, index_t eventTimeIndex, index_t controlerEventTimeIndex, linear_controller_array_t &controllersStock) const
 
virtual void ocs2::CostFunctionBase< STATE_DIM, INPUT_DIM >::setCostDesiredTrajectories (const cost_desired_trajectories_t &costDesiredTrajectories)
 
virtual void ocs2::CostFunctionBase< STATE_DIM, INPUT_DIM >::getCostDesiredTrajectories (cost_desired_trajectories_t &costDesiredTrajectories) const
 
 ocs2::CostFunctionBaseAD< STATE_DIM, INPUT_DIM >::CostFunctionBaseAD ()
 
 ocs2::CostFunctionBaseAD< STATE_DIM, INPUT_DIM >::CostFunctionBaseAD (const CostFunctionBaseAD &rhs)
 
void ocs2::CostFunctionBaseAD< STATE_DIM, INPUT_DIM >::initialize (const std::string &modelName, const std::string &modelFolder="/tmp/ocs2", bool recompileLibraries=true, bool verbose=true)
 
void ocs2::CostFunctionBaseAD< STATE_DIM, INPUT_DIM >::setCurrentStateAndControl (const scalar_t &t, const state_vector_t &x, const input_vector_t &u) final
 
void ocs2::CostFunctionBaseAD< STATE_DIM, INPUT_DIM >::getIntermediateCost (scalar_t &L) final
 
void ocs2::CostFunctionBaseAD< STATE_DIM, INPUT_DIM >::getIntermediateCostDerivativeTime (scalar_t &dLdt) final
 
void ocs2::CostFunctionBaseAD< STATE_DIM, INPUT_DIM >::getIntermediateCostDerivativeState (state_vector_t &dLdx) final
 
void ocs2::CostFunctionBaseAD< STATE_DIM, INPUT_DIM >::getIntermediateCostSecondDerivativeState (state_matrix_t &dLdxx) override
 
void ocs2::CostFunctionBaseAD< STATE_DIM, INPUT_DIM >::getIntermediateCostDerivativeInput (input_vector_t &dLdu) final
 
void ocs2::CostFunctionBaseAD< STATE_DIM, INPUT_DIM >::getIntermediateCostSecondDerivativeInput (input_matrix_t &dLduu) override
 
void ocs2::CostFunctionBaseAD< STATE_DIM, INPUT_DIM >::getIntermediateCostDerivativeInputState (input_state_matrix_t &dLdux) override
 
void ocs2::CostFunctionBaseAD< STATE_DIM, INPUT_DIM >::getTerminalCost (scalar_t &Phi) final
 
void ocs2::CostFunctionBaseAD< STATE_DIM, INPUT_DIM >::getTerminalCostDerivativeTime (scalar_t &dPhidt) final
 
void ocs2::CostFunctionBaseAD< STATE_DIM, INPUT_DIM >::getTerminalCostDerivativeState (state_vector_t &dPhidx) final
 
void ocs2::CostFunctionBaseAD< STATE_DIM, INPUT_DIM >::getTerminalCostSecondDerivativeState (state_matrix_t &dPhidxx) override
 
void ocs2::CostFunctionBaseAD< STATE_DIM, INPUT_DIM >::setADInterfaces (const std::string &modelName, const std::string &modelFolder)
 
void ocs2::CostFunctionBaseAD< STATE_DIM, INPUT_DIM >::createModels (bool verbose)
 
void ocs2::CostFunctionBaseAD< STATE_DIM, INPUT_DIM >::loadModelsIfAvailable (bool verbose)
 
 ocs2::CostFunctionLinearCombination< STATE_DIM, INPUT_DIM >::CostFunctionLinearCombination (const std::vector< WeightedCost > &weightedCosts)
 
 ocs2::CostFunctionLinearCombination< STATE_DIM, INPUT_DIM >::CostFunctionLinearCombination (const CostFunctionLinearCombination &rhs)
 
CostFunctionLinearCombination< STATE_DIM, INPUT_DIM > * ocs2::CostFunctionLinearCombination< STATE_DIM, INPUT_DIM >::clone () const override
 
void ocs2::CostFunctionLinearCombination< STATE_DIM, INPUT_DIM >::getIntermediateCost (scalar_t &L) override
 
void ocs2::CostFunctionLinearCombination< STATE_DIM, INPUT_DIM >::getIntermediateCostDerivativeState (state_vector_t &dLdx) override
 
void ocs2::CostFunctionLinearCombination< STATE_DIM, INPUT_DIM >::getIntermediateCostSecondDerivativeState (state_matrix_t &dLdxx) override
 
void ocs2::CostFunctionLinearCombination< STATE_DIM, INPUT_DIM >::getIntermediateCostDerivativeInput (input_vector_t &dLdu) override
 
void ocs2::CostFunctionLinearCombination< STATE_DIM, INPUT_DIM >::getIntermediateCostSecondDerivativeInput (input_matrix_t &dLduu) override
 
void ocs2::CostFunctionLinearCombination< STATE_DIM, INPUT_DIM >::getIntermediateCostDerivativeInputState (input_state_matrix_t &dLdux) override
 
void ocs2::CostFunctionLinearCombination< STATE_DIM, INPUT_DIM >::getTerminalCost (scalar_t &Phi) override
 
void ocs2::CostFunctionLinearCombination< STATE_DIM, INPUT_DIM >::getTerminalCostDerivativeState (state_vector_t &dPhidx) override
 
void ocs2::CostFunctionLinearCombination< STATE_DIM, INPUT_DIM >::getTerminalCostSecondDerivativeState (state_matrix_t &dPhidxx) override
 
void ocs2::CostFunctionLinearCombination< STATE_DIM, INPUT_DIM >::setCostDesiredTrajectories (const cost_desired_trajectories_t &costDesiredTrajectories) override
 
void ocs2::CostFunctionLinearCombination< STATE_DIM, INPUT_DIM >::setCurrentStateAndControl (const scalar_t &t, const state_vector_t &x, const input_vector_t &u) override
 
void ocs2::CostFunctionLinearCombination< STATE_DIM, INPUT_DIM >::getIntermediateCostDerivativeTime (scalar_t &dLdt) override
 
void ocs2::CostFunctionLinearCombination< STATE_DIM, INPUT_DIM >::getTerminalCostDerivativeTime (scalar_t &dPhidt) override
 
 ocs2::SystemDynamicsBaseAD< STATE_DIM, INPUT_DIM, NUM_MODES >::SystemDynamicsBaseAD ()
 
 ocs2::SystemDynamicsBaseAD< STATE_DIM, INPUT_DIM, NUM_MODES >::SystemDynamicsBaseAD (const SystemDynamicsBaseAD &rhs)
 
void ocs2::SystemDynamicsBaseAD< STATE_DIM, INPUT_DIM, NUM_MODES >::initialize (const std::string &modelName, const std::string &modelFolder="/tmp/ocs2", bool recompileLibraries=true, bool verbose=true)
 
void ocs2::SystemDynamicsBaseAD< STATE_DIM, INPUT_DIM, NUM_MODES >::computeFlowMap (const scalar_t &time, const state_vector_t &state, const input_vector_t &input, state_vector_t &stateDerivative) final
 
void ocs2::SystemDynamicsBaseAD< STATE_DIM, INPUT_DIM, NUM_MODES >::computeJumpMap (const scalar_t &time, const state_vector_t &state, state_vector_t &jumpedState) final
 
void ocs2::SystemDynamicsBaseAD< STATE_DIM, INPUT_DIM, NUM_MODES >::computeGuardSurfaces (const scalar_t &time, const state_vector_t &state, dynamic_vector_t &guardSurfacesValue) final
 
void ocs2::SystemDynamicsBaseAD< STATE_DIM, INPUT_DIM, NUM_MODES >::setCurrentStateAndControl (const scalar_t &time, const state_vector_t &state, const input_vector_t &input) final
 
void ocs2::SystemDynamicsBaseAD< STATE_DIM, INPUT_DIM, NUM_MODES >::setADInterfaces (const std::string &modelName, const std::string &modelFolder)
 
void ocs2::SystemDynamicsBaseAD< STATE_DIM, INPUT_DIM, NUM_MODES >::createModels (bool verbose)
 
void ocs2::SystemDynamicsBaseAD< STATE_DIM, INPUT_DIM, NUM_MODES >::loadModelsIfAvailable (bool verbose)
 
 ocs2::Integrator< STATE_DIM, Stepper >::Integrator (const std::shared_ptr< OdeBase< STATE_DIM >> &systemPtr, const std::shared_ptr< SystemEventHandler< STATE_DIM >> &eventHandlerPtr=nullptr)
 
void ocs2::Integrator< STATE_DIM, Stepper >::integrate (const state_vector_t &initialState, const scalar_t &startTime, const scalar_t &finalTime, scalar_t dt, state_vector_array_t &stateTrajectory, scalar_array_t &timeTrajectory, bool concatOutput=false) final
 
void ocs2::Integrator< STATE_DIM, Stepper >::integrate (const state_vector_t &initialState, const scalar_t &startTime, const scalar_t &finalTime, state_vector_array_t &stateTrajectory, scalar_array_t &timeTrajectory, scalar_t dtInitial=0.01, scalar_t AbsTol=1e-6, scalar_t RelTol=1e-3, int maxNumSteps=std::numeric_limits< int >::max(), bool concatOutput=false) final
 
void ocs2::Integrator< STATE_DIM, Stepper >::integrate (const state_vector_t &initialState, typename scalar_array_t::const_iterator beginTimeItr, typename scalar_array_t::const_iterator endTimeItr, state_vector_array_t &stateTrajectory, scalar_t dtInitial=0.01, scalar_t AbsTol=1e-9, scalar_t RelTol=1e-6, int maxNumSteps=std::numeric_limits< int >::max(), bool concatOutput=false) final
 
void ocs2::Integrator< STATE_DIM, Stepper >::setupSystem ()
 
void ocs2::Integrator< STATE_DIM, Stepper >::initialize (state_vector_t &initialState, scalar_t &t, scalar_t dt)
 
template<typename S >
std::enable_if< std::is_same< S, runge_kutta_dopri5_t< STATE_DIM > >::value, void >::type ocs2::Integrator< STATE_DIM, Stepper >::integrate_adaptive_specialized (state_vector_t &initialState, const scalar_t &startTime, const 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< STATE_DIM > >::value, void >::type ocs2::Integrator< STATE_DIM, Stepper >::integrate_times_specialized (state_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< STATE_DIM > >::value, void >::type ocs2::Integrator< STATE_DIM, Stepper >::initializeStepper (state_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)
 

Variables

static std::atomic_bool ocs2::SystemEventHandler< STATE_DIM >::killIntegration_
 

Typedef Documentation

◆ adams_bashforth_uncontrolled_t

template<int STATE_DIM, size_t STEPS>
using ocs2::adams_bashforth_uncontrolled_t = typedef boost::numeric::odeint::adams_bashforth<STEPS, Eigen::Matrix<double, STATE_DIM, 1>, double, Eigen::Matrix<double, STATE_DIM, 1>, double, boost::numeric::odeint::vector_space_algebra>

Adams_Bashforth stepper

◆ bulirsch_stoer_t

template<int STATE_DIM>
using ocs2::bulirsch_stoer_t = typedef boost::numeric::odeint::bulirsch_stoer<Eigen::Matrix<double, STATE_DIM, 1>, double, Eigen::Matrix<double, STATE_DIM, 1>, double, boost::numeric::odeint::vector_space_algebra>

Bulirsch_Stoer stepper

◆ dense_runge_kutta5_t

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

Dense_output Runge_Kutta stepper

◆ EigenLinearInterpolation

template<typename Data_T >
using ocs2::EigenLinearInterpolation = typedef LinearInterpolation<Data_T, Eigen::aligned_allocator<Data_T> >

◆ euler_t

template<int STATE_DIM>
using ocs2::euler_t = typedef boost::numeric::odeint::euler<Eigen::Matrix<double, STATE_DIM, 1>, double, Eigen::Matrix<double, STATE_DIM, 1>, double, boost::numeric::odeint::vector_space_algebra>

Euler stepper

◆ IntegratorAdamsBashforth

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

Adams-Bashforth integrator.

◆ IntegratorBulirschStoer

template<int STATE_DIM>
using ocs2::IntegratorBulirschStoer = typedef Integrator<STATE_DIM, bulirsch_stoer_t<STATE_DIM> >

Bulirsch-Stoer integrator.

◆ IntegratorEuler

template<int STATE_DIM>
using ocs2::IntegratorEuler = typedef Integrator<STATE_DIM, euler_t<STATE_DIM> >

Euler integrator.

◆ IntegratorModifiedMidpoint

template<int STATE_DIM>
using ocs2::IntegratorModifiedMidpoint = typedef Integrator<STATE_DIM, modified_midpoint_t<STATE_DIM> >

Modified midpoint integrator.

◆ IntegratorRK4

template<int STATE_DIM>
using ocs2::IntegratorRK4 = typedef Integrator<STATE_DIM, runge_kutta_4_t<STATE_DIM> >

RK4 integrator.

◆ IntegratorRK5Variable

template<int STATE_DIM>
using ocs2::IntegratorRK5Variable = typedef Integrator<STATE_DIM, dense_runge_kutta5_t<STATE_DIM> >

RK5 variable integrator.

◆ LoopshapingDynamicsEliminatePattern

template<size_t FULL_STATE_DIM, size_t FULL_INPUT_DIM, size_t SYSTEM_STATE_DIM, size_t SYSTEM_INPUT_DIM, size_t FILTER_STATE_DIM, size_t FILTER_INPUT_DIM>
using ocs2::LoopshapingDynamicsEliminatePattern = typedef LoopshapingDynamicsInputPattern<FULL_STATE_DIM, FULL_INPUT_DIM, SYSTEM_STATE_DIM, SYSTEM_INPUT_DIM, FILTER_STATE_DIM, FILTER_INPUT_DIM>

◆ modified_midpoint_t

template<int STATE_DIM>
using ocs2::modified_midpoint_t = typedef boost::numeric::odeint::modified_midpoint<Eigen::Matrix<double, STATE_DIM, 1>, double, Eigen::Matrix<double, STATE_DIM, 1>, double, boost::numeric::odeint::vector_space_algebra>

Modified_Midpoint stepper

◆ ODE45

template<int STATE_DIM>
using ocs2::ODE45 = typedef Integrator<STATE_DIM, runge_kutta_dopri5_t<STATE_DIM> >

ode45 integrator.

◆ runge_kutta_4_t

template<int STATE_DIM>
using ocs2::runge_kutta_4_t = typedef boost::numeric::odeint::runge_kutta4<Eigen::Matrix<double, STATE_DIM, 1>, double, Eigen::Matrix<double, STATE_DIM, 1>, double, boost::numeric::odeint::vector_space_algebra>

4th order Runge_Kutta stepper

◆ runge_kutta_dopri5_t

template<int STATE_DIM>
using ocs2::runge_kutta_dopri5_t = typedef boost::numeric::odeint::runge_kutta_dopri5<Eigen::Matrix<double, STATE_DIM, 1>, double, Eigen::Matrix<double, STATE_DIM, 1>, double, boost::numeric::odeint::vector_space_algebra>

5th order Runge_Kutta_Dopri stepper

Enumeration Type Documentation

◆ 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 
MODIFIED_MIDPOINT 
RK4 
RK5_VARIABLE 
ODE45 
ADAMS_BASHFORTH 
BULIRSCH_STOER 
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

◆ adjustController()

template<size_t STATE_DIM, size_t INPUT_DIM>
void ocs2::TrajectorySpreadingControllerAdjustment< STATE_DIM, INPUT_DIM >::adjustController ( const scalar_array_t eventTimes,
const scalar_array_t controllerEventTimes,
linear_controller_array_t controllersStock 
)
overridevirtual

Adjust the controller based on the last changes in the logic rules.

Parameters
[in]eventTimesThe new event times.
[in]controllerEventTimesThe control policy stock's event times.
[out]controllerStockThe controller stock which will be modified.

Implements ocs2::ControllerAdjustmentBase< STATE_DIM, INPUT_DIM >.

◆ clone()

template<size_t STATE_DIM, size_t INPUT_DIM>
CostFunctionLinearCombination< STATE_DIM, INPUT_DIM > * ocs2::CostFunctionLinearCombination< STATE_DIM, INPUT_DIM >::clone ( ) const
overridevirtual

Returns pointer to the class.

Returns
A raw pointer to the class.

Implements ocs2::CostFunctionBase< STATE_DIM, INPUT_DIM >.

◆ computeFlowMap()

template<size_t STATE_DIM, size_t INPUT_DIM, size_t NUM_MODES>
void ocs2::SystemDynamicsBaseAD< STATE_DIM, INPUT_DIM, NUM_MODES >::computeFlowMap ( const scalar_t t,
const state_vector_t x,
const input_vector_t u,
state_vector_t dxdt 
)
finalvirtual

Computes derivative of the autonomous system dynamics.

Parameters
[in]tCurrent time.
[in]xCurrent state.
[in]uCurrent input.
[out]dxdtCurrent state time derivative.

Implements ocs2::ControlledSystemBase< STATE_DIM, INPUT_DIM >.

◆ computeGuardSurfaces()

template<size_t STATE_DIM, size_t INPUT_DIM, size_t NUM_MODES>
void ocs2::SystemDynamicsBaseAD< STATE_DIM, INPUT_DIM, NUM_MODES >::computeGuardSurfaces ( const scalar_t time,
const state_vector_t state,
dynamic_vector_t guardSurfacesValue 
)
finalvirtual

Interface method to the guard surfaces.

Parameters
[in]timetransition time
[in]statetransition state
[out]guardSurfacesValueAn array of guard surfaces values

Reimplemented from ocs2::OdeBase< STATE_DIM >.

◆ computeJumpMap()

template<size_t STATE_DIM, size_t INPUT_DIM, size_t NUM_MODES>
void ocs2::SystemDynamicsBaseAD< STATE_DIM, INPUT_DIM, NUM_MODES >::computeJumpMap ( const scalar_t time,
const state_vector_t state,
state_vector_t mappedState 
)
finalvirtual

State map at the transition time

Parameters
[in]timetransition time
[in]statetransition state
[out]mappedStatemapped state after transition

Reimplemented from ocs2::OdeBase< STATE_DIM >.

◆ ConstraintBaseAD() [1/2]

template<size_t STATE_DIM, size_t INPUT_DIM>
ocs2::ConstraintBaseAD< STATE_DIM, INPUT_DIM >::ConstraintBaseAD ( )

Default constructor.

◆ ConstraintBaseAD() [2/2]

template<size_t STATE_DIM, size_t INPUT_DIM>
ocs2::ConstraintBaseAD< STATE_DIM, INPUT_DIM >::ConstraintBaseAD ( const ConstraintBaseAD< STATE_DIM, INPUT_DIM > &  rhs)

Copy constructor

◆ CostFunctionBaseAD() [1/2]

template<size_t STATE_DIM, size_t INPUT_DIM>
ocs2::CostFunctionBaseAD< STATE_DIM, INPUT_DIM >::CostFunctionBaseAD ( )
explicit

Default constructor

◆ CostFunctionBaseAD() [2/2]

template<size_t STATE_DIM, size_t INPUT_DIM>
ocs2::CostFunctionBaseAD< STATE_DIM, INPUT_DIM >::CostFunctionBaseAD ( const CostFunctionBaseAD< STATE_DIM, INPUT_DIM > &  rhs)

Copy constructor

◆ CostFunctionLinearCombination() [1/2]

template<size_t STATE_DIM, size_t INPUT_DIM>
ocs2::CostFunctionLinearCombination< STATE_DIM, INPUT_DIM >::CostFunctionLinearCombination ( const std::vector< WeightedCost > &  weightedCosts)
explicit

◆ CostFunctionLinearCombination() [2/2]

template<size_t STATE_DIM, size_t INPUT_DIM>
ocs2::CostFunctionLinearCombination< STATE_DIM, INPUT_DIM >::CostFunctionLinearCombination ( const CostFunctionLinearCombination< STATE_DIM, INPUT_DIM > &  rhs)

◆ CppAdInterface() [1/3]

template<typename scalar_t >
ocs2::CppAdInterface< scalar_t >::CppAdInterface ( ad_parameterized_function_t  adFunction,
int  rangeDim,
int  variableDim,
int  parameterDim,
std::string  modelName,
std::string  folderName = "/tmp/ocs2",
std::vector< std::string >  compileFlags = {"-O3", "-march=native", "-mtune=native", "-ffast-math"} 
)

Constructor for parameterized functions

Parameters
adFunction: parameterized function f(x,p,y)
rangeDim: size of y
variableDim: size of x
parameterDim: size of p
modelName: Name of the library to be generated.
folderName: Folder to save library files to, either absolute of relative
compileFlags: Compilation flags for the model library.

◆ CppAdInterface() [2/3]

template<typename scalar_t >
ocs2::CppAdInterface< scalar_t >::CppAdInterface ( ad_function_t  adFunction,
int  rangeDim,
int  variableDim,
std::string  modelName,
std::string  folderName = "/tmp/ocs2",
std::vector< std::string >  compileFlags = {"-O3", "-march=native", "-mtune=native", "-ffast-math"} 
)

Constructor for functions without parameters

Parameters
adFunction: function f(x, y)
rangeDim: size of y
variableDim: size of x
modelName: Name of the library to be generated.
folderName: Folder to save library files to, either absolute of relative
compileFlags: Compilation flags for the model library.

◆ CppAdInterface() [3/3]

template<typename scalar_t >
ocs2::CppAdInterface< scalar_t >::CppAdInterface ( const CppAdInterface< scalar_t > &  rhs)

Copy constructor. Models are reloaded if available.

◆ createFolderStructure()

template<typename scalar_t >
void ocs2::CppAdInterface< scalar_t >::createFolderStructure ( ) const
private

Creates folders on disk

◆ createHessianSparsity()

template<typename scalar_t >
CppAdInterface< scalar_t >::SparsityPattern ocs2::CppAdInterface< scalar_t >::createHessianSparsity ( ad_fun_t fun) const
private

Creates sparsity pattern for the Hessian that will be generated

Parameters
fun: taped ad function
Returns
Sparsity pattern that contains entries for variables only, not for parameters

◆ createJacobianSparsity()

template<typename scalar_t >
CppAdInterface< scalar_t >::SparsityPattern ocs2::CppAdInterface< scalar_t >::createJacobianSparsity ( ad_fun_t fun) const
private

Creates sparsity pattern for the Jacobian that will be generated

Parameters
fun: taped ad function
Returns
Sparsity pattern that contains entries for variables only, not for parameters

◆ createModels() [1/4]

template<typename scalar_t >
void ocs2::CppAdInterface< scalar_t >::createModels ( ApproximationOrder  approximationOrder = ApproximationOrder::Second,
bool  verbose = true 
)

Creates models, compiles them, and saves them to disk

Parameters
approximationOrder: Order of derivatives to generate
verbose: Print out extra information

◆ createModels() [2/4]

template<size_t STATE_DIM, size_t INPUT_DIM, size_t NUM_MODES>
void ocs2::SystemDynamicsBaseAD< STATE_DIM, INPUT_DIM, NUM_MODES >::createModels ( bool  verbose)
private

Create the forward model and derivatives.

Parameters
[in]verbosedisplay information.

◆ createModels() [3/4]

template<size_t STATE_DIM, size_t INPUT_DIM>
void ocs2::ConstraintBaseAD< STATE_DIM, INPUT_DIM >::createModels ( bool  verbose)
private

Create the forward model and derivatives.

Parameters
[in]verbosedisplay information.

◆ createModels() [4/4]

template<size_t STATE_DIM, size_t INPUT_DIM>
void ocs2::CostFunctionBaseAD< STATE_DIM, INPUT_DIM >::createModels ( bool  verbose)
private

Create the forward model and derivatives.

Parameters
[in]verbosedisplay information.

◆ findEventTimesIndices()

template<size_t STATE_DIM, size_t INPUT_DIM>
void ocs2::TrajectorySpreadingControllerAdjustment< STATE_DIM, INPUT_DIM >::findEventTimesIndices ( const scalar_array_t eventTimes,
const linear_controller_array_t controllersStock,
std::vector< index_t > &  eventsIndices 
) const
protected

Finds the indices of the entries in the control policy that their time stamps are greater or equal to the associated event time.

Parameters
[in]eventTimesEvent time vector.
[in]controllersStockControl policy.
[out]eventsIndicesevent time indices in the control policy time stamp.

◆ findPreviousIndex()

template<size_t STATE_DIM, size_t INPUT_DIM>
TrajectorySpreadingControllerAdjustment< STATE_DIM, INPUT_DIM >::index_t ocs2::TrajectorySpreadingControllerAdjustment< STATE_DIM, INPUT_DIM >::findPreviousIndex ( index_t  index,
const linear_controller_array_t controllersStock 
) const
protected

Finds the index before the input index

Parameters
[in]afirst index.
[in]bsecond index.
Returns
true if a <= b.

◆ getConstraintViolationSquaredNorm()

template<size_t STATE_DIM, size_t INPUT_DIM>
void ocs2::PenaltyBase< STATE_DIM, INPUT_DIM >::getConstraintViolationSquaredNorm ( const scalar_array_t h,
scalar_t squaredViolation 
) const

Computes the sum of squared constraint violation.

Parameters
[in]hVector of inequality constraint values.
[out]squaredViolationsum of squared constraint violation.

◆ getCostDesiredTrajectories()

template<size_t STATE_DIM, size_t INPUT_DIM>
void ocs2::CostFunctionBase< STATE_DIM, INPUT_DIM >::getCostDesiredTrajectories ( cost_desired_trajectories_t costDesiredTrajectories) const
virtual

Gets the desired state and input trajectories used in the cost function.

Parameters
[in]CostDesiredTrajectoriescost desired trajectories interface class.

◆ getFunctionValue()

template<typename scalar_t >
CppAdInterface< scalar_t >::dynamic_vector_t ocs2::CppAdInterface< scalar_t >::getFunctionValue ( const dynamic_vector_t x,
const dynamic_vector_t p = dynamic_vector_t(0) 
) const
Parameters
x: input vector of size variableDim
p: parameter vector of size parameterDim
Returns
y = f(x,p)

◆ getHessian() [1/2]

template<typename scalar_t >
CppAdInterface< scalar_t >::dynamic_matrix_t ocs2::CppAdInterface< scalar_t >::getHessian ( size_t  outputIndex,
const dynamic_vector_t x,
const dynamic_vector_t p = dynamic_vector_t(0) 
) const

Hessian, available per output.

Parameters
outputIndex: Output to get the hessian for.
x: input vector of size variableDim
p: parameter vector of size parameterDim
Returns
dd/dxdx( f_i(x,p) )

◆ getHessian() [2/2]

template<typename scalar_t >
CppAdInterface< scalar_t >::dynamic_matrix_t ocs2::CppAdInterface< scalar_t >::getHessian ( const dynamic_vector_t w,
const dynamic_vector_t x,
const dynamic_vector_t p = dynamic_vector_t(0) 
) const

Weighted hessian

Parameters
wvector of weights of size rangeDim
x: input vector of size variableDim
p: parameter vector of size parameterDim
Returns
dd/dxdx(sum_i w_i*f_i(x,p) )

◆ getIntermediateCost() [1/2]

template<size_t STATE_DIM, size_t INPUT_DIM>
void ocs2::CostFunctionLinearCombination< STATE_DIM, INPUT_DIM >::getIntermediateCost ( scalar_t L)
overridevirtual

Get the intermediate cost.

Parameters
[out]LThe intermediate cost value.

Implements ocs2::CostFunctionBase< STATE_DIM, INPUT_DIM >.

◆ getIntermediateCost() [2/2]

template<size_t STATE_DIM, size_t INPUT_DIM>
void ocs2::CostFunctionBaseAD< STATE_DIM, INPUT_DIM >::getIntermediateCost ( scalar_t L)
finalvirtual

Get the intermediate cost.

Parameters
[out]LThe intermediate cost value.

Implements ocs2::CostFunctionBase< STATE_DIM, INPUT_DIM >.

◆ getIntermediateCostDerivativeInput() [1/2]

template<size_t STATE_DIM, size_t INPUT_DIM>
void ocs2::CostFunctionLinearCombination< STATE_DIM, INPUT_DIM >::getIntermediateCostDerivativeInput ( input_vector_t dLdu)
overridevirtual

Get control input derivative of the intermediate cost.

Parameters
[out]dLduFirst order derivative of the intermediate cost with respect to input vector.

Implements ocs2::CostFunctionBase< STATE_DIM, INPUT_DIM >.

◆ getIntermediateCostDerivativeInput() [2/2]

template<size_t STATE_DIM, size_t INPUT_DIM>
void ocs2::CostFunctionBaseAD< STATE_DIM, INPUT_DIM >::getIntermediateCostDerivativeInput ( input_vector_t dLdu)
finalvirtual

Get control input derivative of the intermediate cost.

Parameters
[out]dLduFirst order derivative of the intermediate cost with respect to input vector.

Implements ocs2::CostFunctionBase< STATE_DIM, INPUT_DIM >.

◆ getIntermediateCostDerivativeInputState() [1/2]

template<size_t STATE_DIM, size_t INPUT_DIM>
void ocs2::CostFunctionLinearCombination< STATE_DIM, INPUT_DIM >::getIntermediateCostDerivativeInputState ( input_state_matrix_t dLdux)
overridevirtual

Get the input-state derivative of the intermediate cost.

Parameters
[out]dLduxSecond order derivative of the intermediate cost with respect to input vector and state.

Implements ocs2::CostFunctionBase< STATE_DIM, INPUT_DIM >.

◆ getIntermediateCostDerivativeInputState() [2/2]

template<size_t STATE_DIM, size_t INPUT_DIM>
void ocs2::CostFunctionBaseAD< STATE_DIM, INPUT_DIM >::getIntermediateCostDerivativeInputState ( input_state_matrix_t dLdux)
overridevirtual

Get the input-state derivative of the intermediate cost.

Parameters
[out]dLduxSecond order derivative of the intermediate cost with respect to input vector and state.

Implements ocs2::CostFunctionBase< STATE_DIM, INPUT_DIM >.

◆ getIntermediateCostDerivativeState() [1/2]

template<size_t STATE_DIM, size_t INPUT_DIM>
void ocs2::CostFunctionLinearCombination< STATE_DIM, INPUT_DIM >::getIntermediateCostDerivativeState ( state_vector_t dLdx)
overridevirtual

Get the state derivative of the intermediate cost.

Parameters
[out]dLdxFirst order derivative of the intermediate cost with respect to state vector.

Implements ocs2::CostFunctionBase< STATE_DIM, INPUT_DIM >.

◆ getIntermediateCostDerivativeState() [2/2]

template<size_t STATE_DIM, size_t INPUT_DIM>
void ocs2::CostFunctionBaseAD< STATE_DIM, INPUT_DIM >::getIntermediateCostDerivativeState ( state_vector_t dLdx)
finalvirtual

Get the state derivative of the intermediate cost.

Parameters
[out]dLdxFirst order derivative of the intermediate cost with respect to state vector.

Implements ocs2::CostFunctionBase< STATE_DIM, INPUT_DIM >.

◆ getIntermediateCostDerivativeTime() [1/2]

template<size_t STATE_DIM, size_t INPUT_DIM>
void ocs2::CostFunctionLinearCombination< STATE_DIM, INPUT_DIM >::getIntermediateCostDerivativeTime ( scalar_t dLdt)
overridevirtual

Get the time derivative of the intermediate cost.

Parameters
[out]dLdtThe time derivative of intermediate cost.

Reimplemented from ocs2::CostFunctionBase< STATE_DIM, INPUT_DIM >.

◆ getIntermediateCostDerivativeTime() [2/2]

template<size_t STATE_DIM, size_t INPUT_DIM>
void ocs2::CostFunctionBaseAD< STATE_DIM, INPUT_DIM >::getIntermediateCostDerivativeTime ( scalar_t dLdt)
finalvirtual

Get the time derivative of the intermediate cost.

Parameters
[out]dLdtThe time derivative of intermediate cost.

Reimplemented from ocs2::CostFunctionBase< STATE_DIM, INPUT_DIM >.

◆ getIntermediateCostSecondDerivativeInput() [1/2]

template<size_t STATE_DIM, size_t INPUT_DIM>
void ocs2::CostFunctionLinearCombination< STATE_DIM, INPUT_DIM >::getIntermediateCostSecondDerivativeInput ( input_matrix_t dLduu)
overridevirtual

Get control input second derivative of the intermediate cost.

Parameters
[out]dLduuSecond order derivative of the intermediate cost with respect to input vector.

Implements ocs2::CostFunctionBase< STATE_DIM, INPUT_DIM >.

◆ getIntermediateCostSecondDerivativeInput() [2/2]

template<size_t STATE_DIM, size_t INPUT_DIM>
void ocs2::CostFunctionBaseAD< STATE_DIM, INPUT_DIM >::getIntermediateCostSecondDerivativeInput ( input_matrix_t dLduu)
overridevirtual

Get control input second derivative of the intermediate cost.

Parameters
[out]dLduuSecond order derivative of the intermediate cost with respect to input vector.

Implements ocs2::CostFunctionBase< STATE_DIM, INPUT_DIM >.

◆ getIntermediateCostSecondDerivativeState() [1/2]

template<size_t STATE_DIM, size_t INPUT_DIM>
void ocs2::CostFunctionLinearCombination< STATE_DIM, INPUT_DIM >::getIntermediateCostSecondDerivativeState ( state_matrix_t dLdxx)
overridevirtual

Get state second order derivative of the intermediate cost.

Parameters
[out]dLdxxSecond order derivative of the intermediate cost with respect to state vector.

Implements ocs2::CostFunctionBase< STATE_DIM, INPUT_DIM >.

◆ getIntermediateCostSecondDerivativeState() [2/2]

template<size_t STATE_DIM, size_t INPUT_DIM>
void ocs2::CostFunctionBaseAD< STATE_DIM, INPUT_DIM >::getIntermediateCostSecondDerivativeState ( state_matrix_t dLdxx)
overridevirtual

Get state second order derivative of the intermediate cost.

Parameters
[out]dLdxxSecond order derivative of the intermediate cost with respect to state vector.

Implements ocs2::CostFunctionBase< STATE_DIM, INPUT_DIM >.

◆ getJacobian()

template<typename scalar_t >
CppAdInterface< scalar_t >::dynamic_matrix_t ocs2::CppAdInterface< scalar_t >::getJacobian ( const dynamic_vector_t x,
const dynamic_vector_t p = dynamic_vector_t(0) 
) const

Jacobian with gradient of each output w.r.t the variables x in the rows.

Parameters
x: input vector of size variableDim
p: parameter vector of size parameterDim
Returns
d/dx( f(x,p) )

◆ getPenaltyCost()

template<size_t STATE_DIM, size_t INPUT_DIM>
void ocs2::PenaltyBase< STATE_DIM, INPUT_DIM >::getPenaltyCost ( const scalar_array_t h,
scalar_t penalty 
) const

Get the penalty cost.

Parameters
[in]hVector of inequality constraint values
[out]penaltyThe penalty cost.

◆ getPenaltyCostDerivativeInput()

template<size_t STATE_DIM, size_t INPUT_DIM>
void ocs2::PenaltyBase< STATE_DIM, INPUT_DIM >::getPenaltyCostDerivativeInput ( const scalar_array_t h,
const input_vector_array_t dhdu,
input_vector_t penaltyDerivativeInput 
) const

Get the derivative of the penalty cost. Implements the chain rule between the inequality constraint and penalty function.

Parameters
[in]hVector of inequality constraint values.
[in]dhduVector of inequality constraint derivatives with respect to input vector.
[out]penaltyDerivativeInputDerivative of the penalty cost with respect to input vector.

◆ getPenaltyCostDerivativeInputState()

template<size_t STATE_DIM, size_t INPUT_DIM>
void ocs2::PenaltyBase< STATE_DIM, INPUT_DIM >::getPenaltyCostDerivativeInputState ( const scalar_array_t h,
const state_vector_array_t dhdx,
const input_vector_array_t dhdu,
const input_state_matrix_array_t ddhdudx,
input_state_matrix_t penaltyDerivativeInputState 
) const

Second derivative of penalty cost.

Parameters
[in]hVector of inequality constraint values.
[in]dhdxVector of inequality constraint derivatives with respect to state.
[in]dhduVector of inequality constraint derivatives with respect to input.
[in]ddhdudxVector of inequality constraint derivatives with respect to input and state.
[out]penaltyDerivativeInputStateDerivative of the penalty cost with respect to input and state.

◆ getPenaltyCostDerivativeState()

template<size_t STATE_DIM, size_t INPUT_DIM>
void ocs2::PenaltyBase< STATE_DIM, INPUT_DIM >::getPenaltyCostDerivativeState ( const scalar_array_t h,
const state_vector_array_t dhdx,
state_vector_t penaltyDerivativeState 
) const

Get the derivative of the penalty cost. Implements the chain rule between the inequality constraint and penalty function.

Parameters
[in]hVector of inequality constraint values.
[in]dhdxVector of inequality constraint derivatives with respect to state.
[out]penaltyDerivativeStateDerivative of the penalty cost with respect to state.

◆ getPenaltyCostSecondDerivativeInput()

template<size_t STATE_DIM, size_t INPUT_DIM>
void ocs2::PenaltyBase< STATE_DIM, INPUT_DIM >::getPenaltyCostSecondDerivativeInput ( const scalar_array_t h,
const input_vector_array_t dhdu,
const input_matrix_array_t ddhdudu,
input_matrix_t penaltySecondDerivativeInput 
) const

Second derivative of penalty cost.

Parameters
[in]hVector of inequality constraint values.
[in]dhduVector of inequality constraint derivatives with respect to input.
[in]ddhduduVector of inequality constraint second derivatives with respect to input.
[out]penaltySecondDerivativeInputSecond derivative of the penalty cost with respect to input.

◆ getPenaltyCostSecondDerivativeState()

template<size_t STATE_DIM, size_t INPUT_DIM>
void ocs2::PenaltyBase< STATE_DIM, INPUT_DIM >::getPenaltyCostSecondDerivativeState ( const scalar_array_t h,
const state_vector_array_t dhdx,
const state_matrix_array_t ddhdxdx,
state_matrix_t penaltySecondDerivativeState 
) const

Second derivative of penalty cost.

Parameters
[in]hVector of inequality constraint values.
[in]dhdxVector of inequality constraint derivatives with respect to state.
[in]ddhdxdxVector of inequality constraint second derivatives with respect to state.
[out]penaltySecondDerivativeStateSecond derivative of the penalty cost with respect to state.

◆ getTerminalCost() [1/2]

template<size_t STATE_DIM, size_t INPUT_DIM>
void ocs2::CostFunctionLinearCombination< STATE_DIM, INPUT_DIM >::getTerminalCost ( scalar_t Phi)
overridevirtual

Get the terminal cost.

Parameters
[out]PhiThe final cost value.

Implements ocs2::CostFunctionBase< STATE_DIM, INPUT_DIM >.

◆ getTerminalCost() [2/2]

template<size_t STATE_DIM, size_t INPUT_DIM>
void ocs2::CostFunctionBaseAD< STATE_DIM, INPUT_DIM >::getTerminalCost ( scalar_t Phi)
finalvirtual

Get the terminal cost.

Parameters
[out]PhiThe final cost value.

Implements ocs2::CostFunctionBase< STATE_DIM, INPUT_DIM >.

◆ getTerminalCostDerivativeState() [1/2]

template<size_t STATE_DIM, size_t INPUT_DIM>
void ocs2::CostFunctionLinearCombination< STATE_DIM, INPUT_DIM >::getTerminalCostDerivativeState ( state_vector_t dPhidx)
overridevirtual

Get the terminal cost state derivative of the terminal cost.

Parameters
[out]dPhidxFirst order final cost derivative with respect to state vector.

Implements ocs2::CostFunctionBase< STATE_DIM, INPUT_DIM >.

◆ getTerminalCostDerivativeState() [2/2]

template<size_t STATE_DIM, size_t INPUT_DIM>
void ocs2::CostFunctionBaseAD< STATE_DIM, INPUT_DIM >::getTerminalCostDerivativeState ( state_vector_t dPhidx)
finalvirtual

Get the terminal cost state derivative of the terminal cost.

Parameters
[out]dPhidxFirst order final cost derivative with respect to state vector.

Implements ocs2::CostFunctionBase< STATE_DIM, INPUT_DIM >.

◆ getTerminalCostDerivativeTime() [1/2]

template<size_t STATE_DIM, size_t INPUT_DIM>
void ocs2::CostFunctionLinearCombination< STATE_DIM, INPUT_DIM >::getTerminalCostDerivativeTime ( scalar_t dPhidt)
overridevirtual

Get the time derivative of terminal cost.

Parameters
[out]dPhidtThe time derivative of terminal cost.

Reimplemented from ocs2::CostFunctionBase< STATE_DIM, INPUT_DIM >.

◆ getTerminalCostDerivativeTime() [2/2]

template<size_t STATE_DIM, size_t INPUT_DIM>
void ocs2::CostFunctionBaseAD< STATE_DIM, INPUT_DIM >::getTerminalCostDerivativeTime ( scalar_t dPhidt)
finalvirtual

Get the time derivative of terminal cost.

Parameters
[out]dPhidtThe time derivative of terminal cost.

Reimplemented from ocs2::CostFunctionBase< STATE_DIM, INPUT_DIM >.

◆ getTerminalCostSecondDerivativeState() [1/2]

template<size_t STATE_DIM, size_t INPUT_DIM>
void ocs2::CostFunctionLinearCombination< STATE_DIM, INPUT_DIM >::getTerminalCostSecondDerivativeState ( state_matrix_t dPhidxx)
overridevirtual

Get the terminal cost state second derivative of the terminal cost.

Parameters
[out]dPhidxxSecond order final cost derivative with respect to state vector.

Implements ocs2::CostFunctionBase< STATE_DIM, INPUT_DIM >.

◆ getTerminalCostSecondDerivativeState() [2/2]

template<size_t STATE_DIM, size_t INPUT_DIM>
void ocs2::CostFunctionBaseAD< STATE_DIM, INPUT_DIM >::getTerminalCostSecondDerivativeState ( state_matrix_t dPhidxx)
overridevirtual

Get the terminal cost state second derivative of the terminal cost.

Parameters
[out]dPhidxxSecond order final cost derivative with respect to state vector.

Implements ocs2::CostFunctionBase< STATE_DIM, INPUT_DIM >.

◆ getUniqueTemporaryName()

template<typename scalar_t >
std::string ocs2::CppAdInterface< scalar_t >::getUniqueTemporaryName ( ) const
private

Creates a random temporary folder name

Returns
folder name

◆ initialize() [1/4]

template<size_t STATE_DIM, size_t INPUT_DIM, size_t NUM_MODES>
void ocs2::SystemDynamicsBaseAD< STATE_DIM, INPUT_DIM, NUM_MODES >::initialize ( const std::string &  modelName,
const std::string &  modelFolder = "/tmp/ocs2",
bool  recompileLibraries = true,
bool  verbose = true 
)

Initializes model libraries

Parameters
modelName: name of the generate model library
modelFolder: folder to save the model library files to
recompileLibraries: If true, the model library will be newly compiled. If false, an existing library will be loaded if available.
verbose: print information.

◆ initialize() [2/4]

template<size_t STATE_DIM, size_t INPUT_DIM>
void ocs2::CostFunctionBaseAD< STATE_DIM, INPUT_DIM >::initialize ( const std::string &  modelName,
const std::string &  modelFolder = "/tmp/ocs2",
bool  recompileLibraries = true,
bool  verbose = true 
)

Initializes model libraries

Parameters
modelName: name of the generate model library
modelFolder: folder to save the model library files to
recompileLibraries: If true, the model library will be newly compiled. If false, an existing library will be loaded if available.
verbose: print information.

◆ initialize() [3/4]

template<size_t STATE_DIM, size_t INPUT_DIM>
void ocs2::ConstraintBaseAD< STATE_DIM, INPUT_DIM >::initialize ( const std::string &  modelName,
const std::string &  modelFolder = "/tmp/ocs2",
bool  recompileLibraries = true,
bool  verbose = true 
)

Default destructor

~ConstraintBaseAD() override = default;

/** Initializes model libraries

Parameters
modelName: name of the generate model library
modelFolder: folder to save the model library files to
recompileLibraries: If true, the model library will be newly compiled. If false, an existing library will be loaded if available.
verbose: print information.

◆ initialize() [4/4]

template<int STATE_DIM, class Stepper >
void ocs2::Integrator< STATE_DIM, Stepper >::initialize ( state_vector_t initialState,
scalar_t t,
scalar_t  dt 
)
private

Initializes the integrator.

Parameters
[in]initialState
[in]t
[in]dt

◆ initializeStepper()

template<int STATE_DIM, class Stepper >
template<typename S >
std::enable_if< std::is_same< S, runge_kutta_dopri5_t< STATE_DIM > >::value, void >::type ocs2::Integrator< STATE_DIM, Stepper >::initializeStepper ( state_vector_t initialState,
scalar_t t,
scalar_t  dt 
)
private

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.
Returns

do nothing, runge_kutta_5_t does not have a init method

◆ integrate() [1/3]

template<int STATE_DIM, class Stepper >
void ocs2::Integrator< STATE_DIM, Stepper >::integrate ( const state_vector_t initialState,
const scalar_t startTime,
const scalar_t finalTime,
scalar_t  dt,
state_vector_array_t stateTrajectory,
scalar_array_t timeTrajectory,
bool  concatOutput = false 
)
final

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

Parameters
[in]initialStateInitial state.
[in]startTimeInitial time.
[in]finalTimeFinal time.
[in]dtTime step.
[out]stateTrajectoryOutput state trajectory.
[out]timeTrajectoryOutput time stamp trajectory.
[in]concatOutputWhether to concatenate the output to the input trajectories or override (default).

◆ integrate() [2/3]

template<int STATE_DIM, class Stepper >
void ocs2::Integrator< STATE_DIM, Stepper >::integrate ( const state_vector_t initialState,
const scalar_t startTime,
const scalar_t finalTime,
state_vector_array_t stateTrajectory,
scalar_array_t timeTrajectory,
scalar_t  dtInitial = 0.01,
scalar_t  AbsTol = 1e-6,
scalar_t  RelTol = 1e-3,
int  maxNumSteps = std::numeric_limits<int>::max(),
bool  concatOutput = false 
)
final

Adaptive time integration based on start time and final time. This method can solve ODEs with time-dependent events, if eventsTime is not empty. In this case the output time-trajectory contains two identical values at the moments of event triggers. This method uses OdeBase::computeJumpMap() method for state transition at events.

Parameters
[in]initialStateInitial state.
[in]startTimeInitial time.
[in]finalTimeFinal time.
[out]stateTrajectoryOutput state trajectory.
[out]timeTrajectoryOutput time stamp trajectory.
[in]dtInitialInitial time step.
[in]AbsTolThe absolute tolerance error for ode solver.
[in]RelTolThe relative tolerance error for ode solver.
[in]maxNumStepsThe maximum number of integration points per a second for ode solver.
[in]concatOutputWhether to concatenate the output to the input trajectories or override (default).

◆ integrate() [3/3]

template<int STATE_DIM, class Stepper >
void ocs2::Integrator< STATE_DIM, Stepper >::integrate ( const state_vector_t initialState,
typename scalar_array_t::const_iterator  beginTimeItr,
typename scalar_array_t::const_iterator  endTimeItr,
state_vector_array_t stateTrajectory,
scalar_t  dtInitial = 0.01,
scalar_t  AbsTol = 1e-9,
scalar_t  RelTol = 1e-6,
int  maxNumSteps = std::numeric_limits<int>::max(),
bool  concatOutput = false 
)
final

Output integration based on a given time trajectory. This method can solve ODEs with time-dependent events. In this case, user should pass past-the-end indices of events on the input time trajectory. Moreover, this method assumes that there are two identical time values in the input time-trajectory at the moments of event triggers. This method uses OdeBase::computeJumpMap() method for state transition at events.

Parameters
[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.
[out]stateTrajectoryOutput state trajectory.
[in]dtInitialInitial time step.
[in]AbsTolThe absolute tolerance error for ode solver.
[in]RelTolThe relative tolerance error for ode solver.
[in]maxNumStepsThe maximum number of integration points per a second for ode solver.
[in]concatOutputWhether to concatenate the output to the input trajectories or override (default).

◆ integrate_adaptive_specialized()

template<int STATE_DIM, class Stepper >
template<typename S >
std::enable_if<!std::is_same< S, runge_kutta_dopri5_t< STATE_DIM > >::value, void >::type ocs2::Integrator< STATE_DIM, Stepper >::integrate_adaptive_specialized ( state_vector_t initialState,
const scalar_t startTime,
const scalar_t finalTime,
scalar_t  dtInitial,
scalar_t  AbsTol,
scalar_t  RelTol 
)
private

Integrate adaptive specialized.

Template Parameters
Sstepper type.
Parameters
[in]initialStateInitial state.
[in]startTimeInitial time.
[in]finalTimeFinal time.
[out]stateTrajectoryOutput state trajectory.
[out]timeTrajectoryOutput time stamp trajectory.
[in]dtInitialInitial time step.
[in]AbsTolThe absolute tolerance error for ode solver.
[in]RelTolThe relative tolerance error for ode solver.
Returns

◆ integrate_times_specialized()

template<int STATE_DIM, class Stepper >
template<typename S >
std::enable_if<!std::is_same< S, runge_kutta_dopri5_t< STATE_DIM > >::value, void >::type ocs2::Integrator< STATE_DIM, Stepper >::integrate_times_specialized ( state_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 
)
private

Integrate times specialized function

Template Parameters
Sstepper type.
Parameters
[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.
[out]stateTrajectoryOutput state trajectory.
[in]dtInitialInitial time step.
[in]AbsTolThe absolute tolerance error for ode solver.
[in]RelTolThe relative tolerance error for ode solver.
Returns

◆ Integrator()

template<int STATE_DIM, class Stepper >
ocs2::Integrator< STATE_DIM, Stepper >::Integrator ( const std::shared_ptr< OdeBase< STATE_DIM >> &  systemPtr,
const std::shared_ptr< SystemEventHandler< STATE_DIM >> &  eventHandlerPtr = nullptr 
)
explicit

Constructor

Parameters
[in]systemThe system dynamics.
[in]eventHandlerThe integration event function.

◆ isLibraryAvailable()

template<typename scalar_t >
bool ocs2::CppAdInterface< scalar_t >::isLibraryAvailable ( ) const
private

Checks if library can already be found on disk.

Returns
isLibraryAvailable

◆ isSmallerEqual()

template<size_t STATE_DIM, size_t INPUT_DIM>
bool ocs2::TrajectorySpreadingControllerAdjustment< STATE_DIM, INPUT_DIM >::isSmallerEqual ( const index_t a,
const index_t b 
) const
protected

Returns true if a <= b.

Parameters
[in]afirst index.
[in]bsecond index.
Returns
true if a <= b.

◆ loadModels()

template<typename scalar_t >
void ocs2::CppAdInterface< scalar_t >::loadModels ( bool  verbose = true)

Loads earlier created model from disk

◆ loadModelsIfAvailable() [1/4]

template<typename scalar_t >
void ocs2::CppAdInterface< scalar_t >::loadModelsIfAvailable ( ApproximationOrder  approximationOrder = ApproximationOrder::Second,
bool  verbose = true 
)

Load models if they are available on disk. Creates a new library otherwise.

Parameters
approximationOrder: Order of derivatives to generate
verbose: Print out extra information

◆ loadModelsIfAvailable() [2/4]

template<size_t STATE_DIM, size_t INPUT_DIM, size_t NUM_MODES>
void ocs2::SystemDynamicsBaseAD< STATE_DIM, INPUT_DIM, NUM_MODES >::loadModelsIfAvailable ( bool  verbose)
private

Loads the forward model and derivatives if available. Constructs them otherwise.

Parameters
[in]verbosedisplay information

◆ loadModelsIfAvailable() [3/4]

template<size_t STATE_DIM, size_t INPUT_DIM>
void ocs2::ConstraintBaseAD< STATE_DIM, INPUT_DIM >::loadModelsIfAvailable ( bool  verbose)
private

Loads the forward model and derivatives if available. Constructs them otherwise.

Parameters
[in]verbosedisplay information

◆ loadModelsIfAvailable() [4/4]

template<size_t STATE_DIM, size_t INPUT_DIM>
void ocs2::CostFunctionBaseAD< STATE_DIM, INPUT_DIM >::loadModelsIfAvailable ( bool  verbose)
private

Loads the forward model and derivatives if available. Constructs them otherwise.

Parameters
[in]verbosedisplay information

◆ multiplyPolynomials()

Eigen::VectorXd ocs2::multiplyPolynomials ( const Eigen::VectorXd &  p_lhs,
const Eigen::VectorXd &  p_rhs 
)
inline

◆ padeApproximation()

void ocs2::padeApproximation ( double  timeDelay,
Eigen::VectorXd &  numCoefficients,
Eigen::VectorXd &  denCoefficients,
size_t  numZeros,
size_t  numPoles 
)
inline

◆ 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 
)

◆ setADInterfaces() [1/3]

template<size_t STATE_DIM, size_t INPUT_DIM, size_t NUM_MODES>
void ocs2::SystemDynamicsBaseAD< STATE_DIM, INPUT_DIM, NUM_MODES >::setADInterfaces ( const std::string &  modelName,
const std::string &  modelFolder 
)
private

Sets all the required CppAdCodeGenInterfaces

◆ setADInterfaces() [2/3]

template<size_t STATE_DIM, size_t INPUT_DIM>
void ocs2::ConstraintBaseAD< STATE_DIM, INPUT_DIM >::setADInterfaces ( const std::string &  modelName,
const std::string &  modelFolder 
)
private

Sets all the required CppAdCodeGenInterfaces

◆ setADInterfaces() [3/3]

template<size_t STATE_DIM, size_t INPUT_DIM>
void ocs2::CostFunctionBaseAD< STATE_DIM, INPUT_DIM >::setADInterfaces ( const std::string &  modelName,
const std::string &  modelFolder 
)
private

Sets all the required CppAdCodeGenInterfaces

◆ setApproximationOrder()

template<typename scalar_t >
void ocs2::CppAdInterface< scalar_t >::setApproximationOrder ( ApproximationOrder  approximationOrder,
CppAD::cg::ModelCSourceGen< scalar_t > &  sourceGen,
ad_fun_t fun 
) const
private

Configure the approximation order for the source generator

Parameters
approximationOrder
sourceGen
fun

◆ setCompilerOptions()

template<typename scalar_t >
void ocs2::CppAdInterface< scalar_t >::setCompilerOptions ( CppAD::cg::GccCompiler< scalar_t > &  compiler) const
private

Configures the compiler that compiles the model library

Parameters
compiler: compiler to be configured

◆ setCostDesiredTrajectories() [1/2]

template<size_t STATE_DIM, size_t INPUT_DIM>
void ocs2::CostFunctionLinearCombination< STATE_DIM, INPUT_DIM >::setCostDesiredTrajectories ( const cost_desired_trajectories_t costDesiredTrajectories)
overridevirtual

Sets the desired state and input trajectories used in the cost function.

Parameters
[in]CostDesiredTrajectoriescost desired trajectories interface class.

Reimplemented from ocs2::CostFunctionBase< STATE_DIM, INPUT_DIM >.

◆ setCostDesiredTrajectories() [2/2]

template<size_t STATE_DIM, size_t INPUT_DIM>
void ocs2::CostFunctionBase< STATE_DIM, INPUT_DIM >::setCostDesiredTrajectories ( const cost_desired_trajectories_t costDesiredTrajectories)
virtual

Sets the desired state and input trajectories used in the cost function.

Parameters
[in]CostDesiredTrajectoriescost desired trajectories interface class.

Reimplemented in ocs2::LoopshapingCost< FULL_STATE_DIM, FULL_INPUT_DIM, SYSTEM_STATE_DIM, SYSTEM_INPUT_DIM, FILTER_STATE_DIM, FILTER_INPUT_DIM >, and ocs2::CostFunctionLinearCombination< STATE_DIM, INPUT_DIM >.

◆ setCurrentStateAndControl() [1/4]

template<size_t STATE_DIM, size_t INPUT_DIM>
void ocs2::CostFunctionLinearCombination< STATE_DIM, INPUT_DIM >::setCurrentStateAndControl ( const scalar_t t,
const state_vector_t x,
const input_vector_t u 
)
overridevirtual

Sets the current time, state, and control input

Parameters
[in]tCurrent time
[in]xCurrent state vector
[in]uCurrent input vector

Reimplemented from ocs2::CostFunctionBase< STATE_DIM, INPUT_DIM >.

◆ setCurrentStateAndControl() [2/4]

template<size_t STATE_DIM, size_t INPUT_DIM>
void ocs2::CostFunctionBaseAD< STATE_DIM, INPUT_DIM >::setCurrentStateAndControl ( const scalar_t t,
const state_vector_t x,
const input_vector_t u 
)
finalvirtual

Sets the current time, state, and control input

Parameters
[in]tCurrent time
[in]xCurrent state vector
[in]uCurrent input vector

Reimplemented from ocs2::CostFunctionBase< STATE_DIM, INPUT_DIM >.

◆ setCurrentStateAndControl() [3/4]

template<size_t STATE_DIM, size_t INPUT_DIM, size_t NUM_MODES>
void ocs2::SystemDynamicsBaseAD< STATE_DIM, INPUT_DIM, NUM_MODES >::setCurrentStateAndControl ( const scalar_t t,
const state_vector_t x,
const input_vector_t u 
)
finalvirtual

Sets the current time, state, and control inout.

Parameters
[in]tCurrent time.
[in]xCurrent state.
[in]uCurrent input.

Reimplemented from ocs2::DerivativesBase< STATE_DIM, INPUT_DIM >.

◆ setCurrentStateAndControl() [4/4]

template<size_t STATE_DIM, size_t INPUT_DIM>
void ocs2::ConstraintBaseAD< STATE_DIM, INPUT_DIM >::setCurrentStateAndControl ( const scalar_t t,
const state_vector_t x,
const input_vector_t u 
)
finalvirtual

Sets the current time, state, and control input.

Parameters
[in]tCurrent time.
[in]xCurrent state.
[in]uCurrent input.

Reimplemented from ocs2::ConstraintBase< STATE_DIM, INPUT_DIM >.

◆ setFolderNames()

template<typename scalar_t >
void ocs2::CppAdInterface< scalar_t >::setFolderNames ( )
private

Defines library folder names

◆ setSparsityNonzeros()

template<typename scalar_t >
void ocs2::CppAdInterface< scalar_t >::setSparsityNonzeros ( )
private

Stores the sparisty nonzeros

◆ 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.

◆ setupSystem()

template<int STATE_DIM, class Stepper >
void ocs2::Integrator< STATE_DIM, Stepper >::setupSystem ( )
private

Setup System

◆ spreadController()

template<size_t STATE_DIM, size_t INPUT_DIM>
void ocs2::TrajectorySpreadingControllerAdjustment< STATE_DIM, INPUT_DIM >::spreadController ( scalar_t  eventTime,
index_t  eventTimeIndex,
index_t  controlerEventTimeIndex,
linear_controller_array_t controllersStock 
) const
protected
Parameters
eventTime
eventTimeIndex
ControlerEventTimeIndex
controllersStock

◆ swap() [1/2]

template<size_t STATE_DIM, size_t INPUT_DIM>
void ocs2::swap ( FeedforwardController< STATE_DIM, INPUT_DIM > &  a,
FeedforwardController< STATE_DIM, INPUT_DIM > &  b 
)

◆ swap() [2/2]

template<size_t STATE_DIM, size_t INPUT_DIM>
void ocs2::swap ( LinearController< STATE_DIM, INPUT_DIM > &  a,
LinearController< STATE_DIM, INPUT_DIM > &  b 
)

◆ SystemDynamicsBaseAD() [1/2]

template<size_t STATE_DIM, size_t INPUT_DIM, size_t NUM_MODES>
ocs2::SystemDynamicsBaseAD< STATE_DIM, INPUT_DIM, NUM_MODES >::SystemDynamicsBaseAD ( )

◆ SystemDynamicsBaseAD() [2/2]

template<size_t STATE_DIM, size_t INPUT_DIM, size_t NUM_MODES>
ocs2::SystemDynamicsBaseAD< STATE_DIM, INPUT_DIM, NUM_MODES >::SystemDynamicsBaseAD ( const SystemDynamicsBaseAD< STATE_DIM, INPUT_DIM, NUM_MODES > &  rhs)

Copy constructor

◆ tf2ss()

void ocs2::tf2ss ( Eigen::VectorXd  numCoefficients,
Eigen::VectorXd  denCoefficients,
Eigen::MatrixXd &  A,
Eigen::MatrixXd &  B,
Eigen::MatrixXd &  C,
Eigen::MatrixXd &  D,
double  timeDelay = 0.0,
bool  balance = true 
)
inline

◆ toString()

static std::string ocs2::toString ( IntegratorType  integratorType)
static

Variable Documentation

◆ killIntegration_

template<int STATE_DIM>
std::atomic_bool ocs2::SystemEventHandler< STATE_DIM >::killIntegration_
staticprotected