Crocoddyl
Loading...
Searching...
No Matches
box-fddp.hpp
1
2// BSD 3-Clause License
3//
4// Copyright (C) 2019-2025, University of Edinburgh, Heriot-Watt University
5// Copyright note valid unless otherwise stated in individual files.
6// All rights reserved.
8
9#ifndef CROCODDYL_CORE_SOLVERS_BOX_FDDP_HPP_
10#define CROCODDYL_CORE_SOLVERS_BOX_FDDP_HPP_
11
12#include "crocoddyl/core/solvers/box-qp.hpp"
13#include "crocoddyl/core/solvers/fddp.hpp"
14
15namespace crocoddyl {
16
17template <typename _Scalar>
18class SolverBoxFDDPTpl : public SolverFDDPTpl<_Scalar> {
19 public:
20 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
21 CROCODDYL_DERIVED_FLOATINGPOINT_CAST(SolverBase, SolverBoxFDDPTpl)
22
23 typedef _Scalar Scalar;
24 typedef SolverFDDPTpl<Scalar> SolverFDDP;
25 typedef BoxQPTpl<Scalar> BoxQP;
26 typedef BoxQPSolutionTpl<Scalar> BoxQPSolution;
27 typedef ShootingProblemTpl<Scalar> ShootingProblem;
28 typedef typename ShootingProblem::ActionModelAbstract ActionModelAbstract;
29 typedef typename ShootingProblem::ActionDataAbstract ActionDataAbstract;
30 typedef MathBaseTpl<Scalar> MathBase;
31 typedef typename MathBase::VectorXs VectorXs;
32 typedef typename MathBase::MatrixXs MatrixXs;
33
34 explicit SolverBoxFDDPTpl(std::shared_ptr<ShootingProblem> problem,
35 const DynamicsSolverType dyn_solver = FeasShoot,
36 const EqualitySolverType term_solver = LuNull);
37 virtual ~SolverBoxFDDPTpl() = default;
38
39 virtual void computePolicy(const std::size_t t) override;
40 virtual void forwardPass(const Scalar steplength);
41
51 template <typename NewScalar>
52 SolverBoxFDDPTpl<NewScalar> cast() const;
53
54 const std::vector<MatrixXs>& get_Quu_inv() const;
55
56 protected:
57 void allocateData();
58 virtual void resizeRunningData() override;
62 using SolverFDDP::dx_;
64 using SolverFDDP::fs_;
66 using SolverFDDP::K_;
67 using SolverFDDP::k_;
69 using SolverFDDP::Qu_;
89 using SolverFDDP::us_;
91 using SolverFDDP::Vx_;
93 using SolverFDDP::xs_;
96
97 BoxQP qp_;
98 std::vector<MatrixXs> Quu_inv_;
99 std::vector<VectorXs> du_lb_;
100 std::vector<VectorXs> du_ub_;
101 VectorXs xnext_;
102};
103
104} // namespace crocoddyl
105
106/* --- Details -------------------------------------------------------------- */
107/* --- Details -------------------------------------------------------------- */
108/* --- Details -------------------------------------------------------------- */
109#include "crocoddyl/core/solvers/box-fddp.hxx"
110
111CROCODDYL_DECLARE_EXTERN_TEMPLATE_CLASS(crocoddyl::SolverBoxFDDPTpl)
112
113#endif // CROCODDYL_CORE_SOLVERS_BOX_FDDP_HPP_
This class implements a Box QP solver based on a Projected Newton method.
Definition box-qp.hpp:103
This class encapsulates a shooting problem.
Definition shooting.hpp:32
std::shared_ptr< ShootingProblem > problem_
std::vector< std::shared_ptr< CallbackAbstract > > callbacks_
virtual void resizeRunningData() override
Resize data associated with the running models of the shooting problem.
SolverBoxFDDPTpl< NewScalar > cast() const
Cast the Box-FDDP solver to a different scalar type.
virtual void computePolicy(const std::size_t t) override
Compute the feedforward and feedback terms (control policy) computed via a Cholesky decomposition.
std::vector< VectorXs > dx_
Definition fddp.hpp:748
std::vector< MatrixXs > Vxx_
Definition fddp.hpp:720
DynamicsSolverType dyn_solver_
Definition fddp.hpp:685
void allocateData()
Allocate all the internal data needed for the solver.
SolverFDDPTpl(std::shared_ptr< ShootingProblem > problem, const DynamicsSolverType dyn_solver=FeasShoot, const EqualitySolverType term_solver=LuNull)
Initialize the FDDP solver.
std::vector< MatrixXs > Qxu_
Definition fddp.hpp:738
std::vector< MatrixXs > Quu_
Definition fddp.hpp:740
std::vector< VectorXs > Vx_
Definition fddp.hpp:725
std::vector< VectorXs > Qu_
Definition fddp.hpp:744
std::vector< MatrixXsRowMajor > K_
Definition fddp.hpp:745
EqualitySolverType term_solver_
Definition fddp.hpp:686
std::vector< VectorXs > k_
Definition fddp.hpp:746
Box QP solution.
Definition box-qp.hpp:27