27 using Data = TrajOptDataTpl<Scalar>;
92 std::vector<shared_ptr<StageModel>>
stages_;
104 const std::vector<shared_ptr<StageModel>> &stages,
105 shared_ptr<CostAbstract> term_cost);
110 const std::vector<shared_ptr<StageModel>> &stages,
111 shared_ptr<CostAbstract> term_cost);
117 shared_ptr<CostAbstract> term_cost);
122 shared_ptr<Manifold> space,
123 shared_ptr<CostAbstract> term_cost);
128 void addStage(
const shared_ptr<StageModel> &stage);
134 "Initial condition is not a StateErrorResidual.\n");
143 "Initial condition is not a StateErrorResidual.\n");
157 const std::vector<VectorXs> &us,
Data &prob_data,
158 std::size_t num_threads = 1)
const;
170 const std::vector<VectorXs> &us,
Data &prob_data,
171 std::size_t num_threads = 1,
172 bool compute_second_order =
true)
const;
198 static auto createStateError(
const ConstVectorRef &x0,
199 const shared_ptr<Manifold> &space,
201 return std::make_shared<StateErrorResidual>(space, nu, x0);
206template <
typename Scalar>
207auto problem_last_state_space_helper(
const TrajOptProblemTpl<Scalar> &problem) {
208 return problem.term_cost_->space;
212template <
typename Scalar>
213int problem_last_ndx_helper(
const TrajOptProblemTpl<Scalar> &problem) {
214 return problem_last_state_space_helper(problem)->ndx();
220#include "aligator/core/traj-opt-problem.hxx"
222#ifdef ALIGATOR_ENABLE_TEMPLATE_INSTANTIATION
223#include "aligator/core/traj-opt-problem.txx"
#define ALIGATOR_RUNTIME_ERROR(msg)
TrajOptProblemTpl(shared_ptr< UnaryFunction > init_constraint, const std::vector< shared_ptr< StageModel > > &stages, shared_ptr< CostAbstract > term_cost)
TrajOptProblemTpl(const ConstVectorRef &x0, const std::vector< shared_ptr< StageModel > > &stages, shared_ptr< CostAbstract > term_cost)
Constructor for an initial value problem.
TrajOptProblemTpl(shared_ptr< UnaryFunction > init_constraint, shared_ptr< CostAbstract > term_cost)
TrajOptProblemTpl(const ConstVectorRef &x0, const int nu, shared_ptr< Manifold > space, shared_ptr< CostAbstract > term_cost)
Constructor for an initial value problem.
Trajectory optimization problem.
void checkIntegrity() const
ConstraintStackTpl< Scalar > term_cstrs_
Terminal constraints.
bool initCondIsStateError() const
void setInitState(const ConstVectorRef &x0)
Set initial state constraint.
StageConstraintTpl< Scalar > ConstraintType
StateErrorResidual * init_state_error_
Pointer to underlying state error residual.
ALIGATOR_DYNAMIC_TYPEDEFS(Scalar)
void computeDerivatives(const std::vector< VectorXs > &xs, const std::vector< VectorXs > &us, Data &prob_data, std::size_t num_threads=1, bool compute_second_order=true) const
Rollout the problem derivatives, stage per stage.
void addTerminalConstraint(const ConstraintType &cstr)
Add a terminal constraint for the model.
void removeTerminalConstraints()
Remove all terminal constraints.
Scalar computeTrajectoryCost(const Data &problem_data) const
Helper for computing the trajectory cost (from pre-computed problem data).
shared_ptr< UnaryFunction > init_condition_
Initial condition.
Scalar evaluate(const std::vector< VectorXs > &xs, const std::vector< VectorXs > &us, Data &prob_data, std::size_t num_threads=1) const
Rollout the problem costs, constraints, dynamics, stage per stage.
void addStage(const shared_ptr< StageModel > &stage)
Add a stage to the control problem.
VectorXs unone_
Dummy, "neutral" control value.
void replaceStageCircular(const shared_ptr< StageModel > &model)
Pop out the first StageModel and replace by the supplied one; updates the supplied problem data (Traj...
ConstVectorRef getInitState() const
Get initial state constraint.
void checkStages() const
Check if all stages are non-null.
StateErrorResidualTpl< Scalar > StateErrorResidual
shared_ptr< CostAbstract > term_cost_
Terminal cost.
std::vector< shared_ptr< StageModel > > stages_
Stages of the control problem.
std::size_t numSteps() const
ManifoldAbstractTpl< Scalar > Manifold