10#ifndef CROCODDYL_CORE_OPTCTRL_SHOOTING_HPP_
11#define CROCODDYL_CORE_OPTCTRL_SHOOTING_HPP_
13#include "crocoddyl/core/action-base.hpp"
14#include "crocoddyl/core/fwd.hpp"
15#include "crocoddyl/core/utils/deprecate.hpp"
31template <
typename _Scalar>
34 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
36 typedef _Scalar Scalar;
40 typedef typename MathBase::VectorXs VectorXs;
51 const std::vector<std::shared_ptr<ActionModelAbstract> >& running_models,
52 std::shared_ptr<ActionModelAbstract> terminal_model);
65 const std::vector<std::shared_ptr<ActionModelAbstract> >& running_models,
66 std::shared_ptr<ActionModelAbstract> terminal_model,
67 const std::vector<std::shared_ptr<ActionDataAbstract> >& running_datas,
68 std::shared_ptr<ActionDataAbstract> terminal_data);
88 Scalar
calc(
const std::vector<VectorXs>& xs,
const std::vector<VectorXs>& us);
107 const std::vector<VectorXs>& us);
117 void rollout(
const std::vector<VectorXs>& us, std::vector<VectorXs>& xs);
127 std::vector<VectorXs>
rollout_us(
const std::vector<VectorXs>& us);
137 void quasiStatic(std::vector<VectorXs>& us,
const std::vector<VectorXs>& xs);
159 std::shared_ptr<ActionDataAbstract> data);
180 std::shared_ptr<ActionModelAbstract> model,
181 std::shared_ptr<ActionDataAbstract> data);
190 std::shared_ptr<ActionModelAbstract> model);
201 template <
typename NewScalar>
245 const std::vector<std::shared_ptr<ActionModelAbstract> >& models);
284 template <
class Scalar>
292 std::shared_ptr<ActionModelAbstract>
295 std::vector<std::shared_ptr<ActionModelAbstract> >
297 std::vector<std::shared_ptr<ActionDataAbstract> >
314#include "crocoddyl/core/optctrl/shooting.hxx"
316extern template class CROCODDYL_EXPLICIT_INSTANTIATION_DECLARATION_DLLAPI
318extern template class CROCODDYL_EXPLICIT_INSTANTIATION_DECLARATION_DLLAPI
Abstract class for action model.
This class encapsulates a shooting problem.
void circularAppend(std::shared_ptr< ActionModelAbstract > model, std::shared_ptr< ActionDataAbstract > data)
Circular append of the model and data onto the end running node.
void set_terminalModel(std::shared_ptr< ActionModelAbstract > model)
Modify the terminal model and allocate new data.
Scalar calcDiff(const std::vector< VectorXs > &xs, const std::vector< VectorXs > &us)
Compute the derivatives of the cost and dynamics.
ShootingProblemTpl< NewScalar > cast() const
Cast the shooting problem to a different scalar type.
void quasiStatic(std::vector< VectorXs > &us, const std::vector< VectorXs > &xs)
Compute the quasic static commands given a state trajectory.
void updateNode(const std::size_t i, std::shared_ptr< ActionModelAbstract > model, std::shared_ptr< ActionDataAbstract > data)
Update the model and data for a specific node.
std::shared_ptr< ActionModelAbstract > terminal_model_
Terminal action model.
void rollout(const std::vector< VectorXs > &us, std::vector< VectorXs > &xs)
Integrate the dynamics given a control sequence.
const std::shared_ptr< ActionDataAbstract > & get_terminalData() const
Return the terminal data.
friend std::ostream & operator<<(std::ostream &os, const ShootingProblemTpl< Scalar > &problem)
Print information on the 'ShootingProblem'.
std::size_t get_ndx() const
Return the dimension of the tangent space of the state manifold.
void updateModel(const std::size_t i, std::shared_ptr< ActionModelAbstract > model)
Update a model and allocated new data for a specific node.
void set_runningModels(const std::vector< std::shared_ptr< ActionModelAbstract > > &models)
Modify the running models and allocate new data.
const VectorXs & get_x0() const
Return the initial state.
const std::vector< std::shared_ptr< ActionModelAbstract > > & get_runningModels() const
Return the running models.
std::size_t nx_
State dimension.
std::size_t get_nthreads() const
Return the number of threads.
std::vector< VectorXs > quasiStatic_xs(const std::vector< VectorXs > &xs)
Compute the quasic static commands given a state trajectory.
Scalar calc(const std::vector< VectorXs > &xs, const std::vector< VectorXs > &us)
Compute the cost and the next states.
const std::vector< std::shared_ptr< ActionDataAbstract > > & get_runningDatas() const
Return the running datas.
ShootingProblemTpl(const ShootingProblemTpl< Scalar > &problem)
Initialize the shooting problem.
bool is_updated()
Return only once true is the shooting problem has been changed, otherwise false.
std::size_t T_
number of running nodes
void circularAppend(std::shared_ptr< ActionModelAbstract > model)
Circular append of the model and data onto the end running node.
void set_x0(const VectorXs &x0_in)
Modify the initial state.
std::vector< std::shared_ptr< ActionModelAbstract > > running_models_
Running action model.
const std::shared_ptr< ActionModelAbstract > & get_terminalModel() const
Return the terminal model.
std::vector< std::shared_ptr< ActionDataAbstract > > running_datas_
Running action data.
void set_nthreads(const int nthreads)
Modify the number of threads using with multithreading support.
std::size_t get_T() const
Return the number of running nodes.
ShootingProblemTpl(const VectorXs &x0, const std::vector< std::shared_ptr< ActionModelAbstract > > &running_models, std::shared_ptr< ActionModelAbstract > terminal_model)
Initialize the shooting problem and allocate its data.
ShootingProblemTpl(const VectorXs &x0, const std::vector< std::shared_ptr< ActionModelAbstract > > &running_models, std::shared_ptr< ActionModelAbstract > terminal_model, const std::vector< std::shared_ptr< ActionDataAbstract > > &running_datas, std::shared_ptr< ActionDataAbstract > terminal_data)
Initialize the shooting problem (models and datas)
std::shared_ptr< ActionDataAbstract > terminal_data_
Terminal action data.
std::size_t get_nx() const
Return the dimension of the state tuple.
VectorXs x0_
Initial state.
std::vector< VectorXs > rollout_us(const std::vector< VectorXs > &us)
Integrate the dynamics given a control sequence.
std::size_t ndx_
State rate dimension.