![]() |
OCS2 Manual
v1.0.0
OCS2 Documentation
|
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 > |
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< IntegratorBase > | ocs2::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) |
using ocs2::ad_base_t = typedef CppAD::cg::CG<scalar_t> |
Scalar type.
using ocs2::ad_matrix_t = typedef Eigen::Matrix<ad_scalar_t, Eigen::Dynamic, Eigen::Dynamic> |
using ocs2::ad_scalar_t = typedef CppAD::AD<ad_base_t> |
using ocs2::ad_vector_t = typedef Eigen::Matrix<ad_scalar_t, Eigen::Dynamic, 1> |
Dynamic-size vector type.
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
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
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
using ocs2::eigen_scalar_array2_t = typedef std::vector<eigen_scalar_array_t> |
Array of eigen scalar trajectory type.
using ocs2::eigen_scalar_array3_t = typedef std::vector<eigen_scalar_array2_t> |
Array of arrays of eigen scalar trajectory type.
using ocs2::eigen_scalar_array_t = typedef std::vector<eigen_scalar_t> |
Eigen scalar trajectory type.
using ocs2::eigen_scalar_t = typedef Eigen::Matrix<scalar_t, 1, 1> |
Eigen scalar type.
using ocs2::EnableIfStateConstraint_t = typedef typename std::enable_if<std::is_same<T, StateConstraint>::value, bool>::type |
using ocs2::EnableIfStateCost_t = typedef typename std::enable_if<std::is_same<T, StateCost>::value, bool>::type |
using ocs2::EnableIfStateInputConstraint_t = typedef typename std::enable_if<std::is_same<T, StateInputConstraint>::value, bool>::type |
using ocs2::EnableIfStateInputCost_t = typedef typename std::enable_if<std::is_same<T, StateInputCost>::value, bool>::type |
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
using ocs2::IntegratorAdamsBashforth = typedef Integrator<adams_bashforth_uncontrolled_t<STEPS> > |
Adams-Bashforth integrator.
using ocs2::IntegratorBulirschStoer = typedef Integrator<bulirsch_stoer_t> |
Bulirsch-Stoer integrator.
using ocs2::IntegratorEuler = typedef Integrator<euler_t> |
Euler integrator.
using ocs2::IntegratorModifiedMidpoint = typedef Integrator<modified_midpoint_t> |
Modified midpoint integrator.
using ocs2::IntegratorRK4 = typedef Integrator<runge_kutta_4_t> |
RK4 integrator.
using ocs2::IntegratorRK5Variable = typedef Integrator<dense_runge_kutta5_t> |
RK5 variable integrator.
using ocs2::matrix_array2_t = typedef std::vector<matrix_array_t> |
Array of dynamic matrix's trajectory type.
using ocs2::matrix_array3_t = typedef std::vector<matrix_array2_t> |
Array of arrays of dynamic matrix trajectory type.
using ocs2::matrix_array_t = typedef std::vector<matrix_t> |
Dynamic matrix's trajectory type.
using ocs2::matrix_t = typedef Eigen::Matrix<scalar_t, Eigen::Dynamic, Eigen::Dynamic> |
Dynamic-size matrix type.
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
using ocs2::ODE45 = typedef Integrator<runge_kutta_dopri5_t> |
ode45 integrator.
using ocs2::row_vector_t = typedef Eigen::Matrix<scalar_t, 1, Eigen::Dynamic> |
Dynamic-size row vector type.
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
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
using ocs2::scalar_array2_t = typedef std::vector<scalar_array_t> |
Array of scalar trajectory type.
using ocs2::scalar_array3_t = typedef std::vector<scalar_array2_t> |
Array of arrays of scalar trajectory type.
using ocs2::scalar_array_t = typedef std::vector<scalar_t> |
Scalar trajectory type.
using ocs2::scalar_t = typedef double |
Scalar type.
using ocs2::size_array2_t = typedef std::vector<size_array_t> |
Array of size_t trajectory type.
using ocs2::size_array_t = typedef std::vector<size_t> |
size_t trajectory type.
using ocs2::vector_array2_t = typedef std::vector<vector_array_t> |
Array of dynamic vector's trajectory type.
using ocs2::vector_array3_t = typedef std::vector<vector_array2_t> |
Array of arrays of dynamic vector trajectory type.
using ocs2::vector_array_t = typedef std::vector<vector_t> |
Dynamic vector's trajectory type.
using ocs2::vector_t = typedef Eigen::Matrix<scalar_t, Eigen::Dynamic, 1> |
Dynamic-size vector type.
|
strong |
|
strong |
|
strong |
|
strong |
enum ocs2::sys_event_id |
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::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 |
||
) |
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 |
||
) |
|
inlineprivate |
Functionality to reset stepper. If we integrate with ODE45, we don't need to reset the stepper, hence specialize empty function
S | stepper type. |
[in] | initialState | Initial state. |
[in] | t | Time. |
[in] | dt | Time step. |
do nothing, runge_kutta_5_t does not have a init method
|
inlineprivate |
Integrate adaptive specialized.
S | stepper type. |
[in] | system | System function |
[in] | observer | Observer callback |
[in] | initialState | Initial state. |
[in] | startTime | Initial time. |
[in] | finalTime | Final time. |
[in] | dtInitial | Initial time step. |
[in] | AbsTol | The absolute tolerance error for ode solver. |
[in] | RelTol | The relative tolerance error for ode solver. |
|
inlineprivate |
Integrate times specialized function
S | stepper type. |
[in] | system | System function |
[in] | observer | Observer callback |
[in] | initialState | Initial state. |
[in] | beginTimeItr | The iterator to the beginning of the time stamp trajectory. |
[in] | endTimeItr | The iterator to the end of the time stamp trajectory. |
[in] | dtInitial | Initial time step. |
[in] | AbsTol | The absolute tolerance error for ode solver. |
[in] | RelTol | The relative tolerance error for ode solver. |
std::unique_ptr<IntegratorBase> ocs2::newIntegrator | ( | IntegratorType | integratorType, |
const std::shared_ptr< SystemEventHandler > & | eventHandlerPtr = nullptr |
||
) |
Create Integrator of given type.
[in] | integratorType | The integrator type. |
[in] | eventHandler | The integration event function. |
std::ostream& ocs2::operator<< | ( | std::ostream & | stream, |
const ModeSchedule & | modeSchedule | ||
) |
std::ostream& ocs2::operator<< | ( | std::ostream & | out, |
const CostDesiredTrajectories & | traj | ||
) |
std::ostream& ocs2::operator<< | ( | std::ostream & | out, |
const ModelDataBase & | data | ||
) |
std::ostream& ocs2::operator<< | ( | std::ostream & | out, |
const FeedforwardController & | controller | ||
) |
std::ostream& ocs2::operator<< | ( | std::ostream & | out, |
const LinearController & | controller | ||
) |
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 | ||
) |
std::future< typename std::result_of< Functor(int)>::type > ocs2::ThreadPool::run | ( | Functor | taskFunction, |
int & | thisTaskId | ||
) |
Run a task in another thread
[in] | taskFunction | task function to run in the pool |
[out] | thisTaskId | ID of the new task. |
std::future< typename std::result_of< Functor(int)>::type > ocs2::ThreadPool::run | ( | Functor | taskFunction | ) |
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
[in] | taskFunction | task function to run in the pool. |
[in] | runAfterId | new task is delayed until task with given ID has finished. |
[out] | thisTaskId | new task ID. |
std::future< typename std::result_of< Functor(int)>::type > ocs2::ThreadPool::runAfter | ( | int | runAfterId, |
Functor | taskFunction | ||
) |
|
inlineoverrideprivate |
Adaptive time integration based on start time and final time.
[in] | system | System function |
[in] | observer | Observer callback |
[in] | initialState | Initial state. |
[in] | startTime | Initial time. |
[in] | finalTime | Final time. |
[in] | dtInitial | Initial time step. |
[in] | AbsTol | The absolute tolerance error for ode solver. |
[in] | RelTol | The relative tolerance error for ode solver. |
|
inlineoverrideprivate |
Equidistant integration based on initial and final time as well as step length.
[in] | system | System function |
[in] | observer | Observer callback |
[in] | initialState | Initial state. |
[in] | startTime | Initial time. |
[in] | finalTime | Final time. |
[in] | dt | Time step. |
|
inlineoverrideprivate |
Output integration based on a given time trajectory.
[in] | system | System function |
[in] | observer | Observer callback |
[in] | initialState | Initial state. |
[in] | beginTimeItr | The iterator to the beginning of the time stamp trajectory. |
[in] | endTimeItr | The iterator to the end of the time stamp trajectory. |
[in] | dtInitial | Initial time step. |
[in] | AbsTol | The absolute tolerance error for ode solver. |
[in] | RelTol | The relative tolerance error for ode solver. |
|
inline |
Sets the priority of the input thread.
priority | The priority of the thread from 0 (lowest) to 99 (highest) |
thread | A reference to the tread. |
void ocs2::swap | ( | ModeSchedule & | lh, |
ModeSchedule & | rh | ||
) |
|
noexcept |
|
noexcept |
auto ocs2::synchronizeLock | ( | SV &... | sv | ) | -> std::tuple<decltype(sv.adoptLock())...> |
Helper function to lock multiple synchronized<T> objects simultaneously, preventing deadlocks.
|
inline |
std::string ocs2::toDelimitedString | ( | const Container & | container, |
const std::string & | delimiter = ", " |
||
) |
Loops over the elements in a container and creates a delimited string
SCALAR_T ocs2::trapezoidalIntegration | ( | const std::vector< SCALAR_T > & | timeTrajectory, |
const std::vector< SCALAR_T > & | valueTrajectory | ||
) |