aligator  0.9.0
A primal-dual augmented Lagrangian-type solver for nonlinear trajectory optimization.
Loading...
Searching...
No Matches
results.hpp
Go to the documentation of this file.
1#pragma once
2
4
5namespace aligator {
6
7template <typename Scalar> struct ResultsFDDPTpl : ResultsBaseTpl<Scalar> {
8
11 using BlockXs = Eigen::Block<MatrixXs, -1, -1>;
12
13 using Base::gains_;
14 using Base::us;
15 using Base::xs;
16
18 explicit ResultsFDDPTpl(const TrajOptProblemTpl<Scalar> &problem);
19};
20
21template <typename Scalar>
23 const TrajOptProblemTpl<Scalar> &problem) {
24 if (!problem.checkIntegrity())
25 ALIGATOR_RUNTIME_ERROR("Problem failed integrity check.");
26 using StageModel = StageModelTpl<Scalar>;
27
28 const std::size_t nsteps = problem.numSteps();
29 xs.resize(nsteps + 1);
30 us.resize(nsteps);
31
32 xs_default_init(problem, xs);
33 us_default_init(problem, us);
34
35 gains_.resize(nsteps);
36
37 for (std::size_t i = 0; i < nsteps; i++) {
38 const StageModel &sm = *problem.stages_[i];
39
40 const int ndx = sm.ndx1();
41 const int nu = sm.nu();
42
43 gains_[i].setZero(nu, ndx + 1);
44 }
45 this->m_isInitialized = true;
46}
47
48} // namespace aligator
49
50#ifdef ALIGATOR_ENABLE_TEMPLATE_INSTANTIATION
51#include "./results.txx"
52#endif
#define ALIGATOR_RUNTIME_ERROR(...)
Definition exceptions.hpp:7
Main package namespace.
void us_default_init(const TrajOptProblemTpl< Scalar > &problem, std::vector< typename math_types< Scalar >::VectorXs > &us)
Default-initialize a controls trajectory from the neutral element of each control space.
void xs_default_init(const TrajOptProblemTpl< Scalar > &problem, std::vector< typename math_types< Scalar >::VectorXs > &xs)
Default-intialize a trajectory to the neutral states for each state space at each stage.
std::vector< VectorXs > xs
States.
std::vector< VectorXs > us
Controls.
std::vector< MatrixXs > gains_
Riccati gains.
Eigen::Block< MatrixXs, -1, -1 > BlockXs
Definition results.hpp:11
A stage in the control problem.
Definition fwd.hpp:93
Trajectory optimization problem.
Definition fwd.hpp:107
std::size_t numSteps() const
std::vector< xyz::polymorphic< StageModel > > stages_
Stages of the control problem.