aligator  0.14.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>
8struct ResultsFDDPTpl final : ResultsBaseTpl<Scalar> {
9
12 using BlockXs = Eigen::Block<MatrixXs, -1, -1>;
13
14 using Base::gains_;
15 using Base::us;
16 using Base::xs;
17
19 : Base() {}
20 explicit ResultsFDDPTpl(const TrajOptProblemTpl<Scalar> &problem);
21};
22
23template <typename Scalar>
25 const TrajOptProblemTpl<Scalar> &problem) {
26 if (!problem.checkIntegrity())
27 ALIGATOR_RUNTIME_ERROR("Problem failed integrity check.");
28 using StageModel = StageModelTpl<Scalar>;
29
30 const std::size_t nsteps = problem.numSteps();
31 xs.resize(nsteps + 1);
32 us.resize(nsteps);
33
34 problem.initializeSolution(xs, us);
35
36 gains_.resize(nsteps);
37
38 for (std::size_t i = 0; i < nsteps; i++) {
39 const StageModel &sm = *problem.stages_[i];
40
41 const int ndx = sm.ndx1();
42 const int nu = sm.nu();
43
44 gains_[i].setZero(nu, ndx + 1);
45 }
46 this->m_isInitialized = true;
47}
48
49} // namespace aligator
50
51#ifdef ALIGATOR_ENABLE_TEMPLATE_INSTANTIATION
52#include "./results.txx"
53#endif
#define ALIGATOR_RUNTIME_ERROR(...)
Definition exceptions.hpp:7
Main package namespace.
std::vector< MatrixXs > gains_
std::vector< VectorXs > xs
States.
ResultsBaseTpl< Scalar > Base
Definition results.hpp:11
std::vector< VectorXs > us
Controls.
std::vector< MatrixXs > gains_
Riccati gains.
Eigen::Block< MatrixXs, -1, -1 > BlockXs
Definition results.hpp:12
A stage in the control problem.
Trajectory optimization problem.
void initializeSolution(std::vector< VectorXs > &xs, std::vector< VectorXs > &us) const
Execute the initialization strategy to generate an initial candidate solution to the problem.
std::vector< xyz::polymorphic< StageModel > > stages_
Stages of the control problem.
std::size_t numSteps() const