aligator  0.9.0
A primal-dual augmented Lagrangian-type solver for nonlinear trajectory optimization.
Loading...
Searching...
No Matches
expose-solver-fddp.cpp
Go to the documentation of this file.
4
6
7namespace aligator::python {
11} // namespace aligator::python
12
13namespace aligator {
14namespace python {
15
16void exposeFDDP() {
19 using Workspace = WorkspaceFDDPTpl<Scalar>;
20 using Results = ResultsFDDPTpl<Scalar>;
21
22 bp::class_<QParams>("QParams", "Q-function parameters.",
23 bp::init<int, int, int>(("self"_a, "ndx", "nu", "ndy")))
24 .add_property("ntot", &QParams::ntot)
25 .def_readonly("grad", &QParams::grad_)
26 .def_readonly("hess", &QParams::hess_)
27 .add_property(
28 "Qx", bp::make_getter(&QParams::Qx,
29 bp::return_value_policy<bp::return_by_value>()))
30 .add_property(
31 "Qu", bp::make_getter(&QParams::Qu,
32 bp::return_value_policy<bp::return_by_value>()))
33 .add_property("Qxx", bp::make_getter(
35 bp::return_value_policy<bp::return_by_value>()))
36 .add_property("Qxu", bp::make_getter(
38 bp::return_value_policy<bp::return_by_value>()))
39 .add_property("Qxy", bp::make_getter(
41 bp::return_value_policy<bp::return_by_value>()))
42 .add_property("Quu", bp::make_getter(
44 bp::return_value_policy<bp::return_by_value>()))
45 .add_property("Quy", bp::make_getter(
47 bp::return_value_policy<bp::return_by_value>()))
48 .add_property("Qyy", bp::make_getter(
50 bp::return_value_policy<bp::return_by_value>()))
52
53 bp::class_<VParams>("VParams", "Value function parameters.", bp::no_init)
54 .def_readonly("Vx", &VParams::Vx_)
55 .def_readonly("Vxx", &VParams::Vxx_)
57
58 StdVectorPythonVisitor<std::vector<QParams>>::expose("StdVec_QParams");
59 StdVectorPythonVisitor<std::vector<VParams>>::expose("StdVec_VParams");
60
61 bp::class_<Workspace, bp::bases<Workspace::Base>, boost::noncopyable>(
62 "WorkspaceFDDP", bp::no_init)
63 .def_readonly("dxs", &Workspace::dxs)
64 .def_readonly("dus", &Workspace::dus)
65 .def_readonly("value_params", &Workspace::value_params)
66 .def_readonly("q_params", &Workspace::q_params)
67 .def_readonly("d1", &Workspace::d1_)
68 .def_readonly("d2", &Workspace::d2_);
69
70 bp::class_<Results, bp::bases<Results::Base>>("ResultsFDDP", bp::no_init)
71 .def(bp::init<const context::TrajOptProblem &>(("self"_a, "problem")));
72
73 bp::class_<SolverFDDP, boost::noncopyable>(
74 "SolverFDDP", "An implementation of the FDDP solver from Crocoddyl.",
75 bp::init<Scalar, VerboseLevel, Scalar, std::size_t>(
76 ("self"_a, "tol", "verbose"_a = VerboseLevel::QUIET,
77 "reg_init"_a = 1e-9, "max_iters"_a = 1000)))
78 .def_readwrite("reg_min", &SolverFDDP::reg_min_)
79 .def_readwrite("reg_max", &SolverFDDP::reg_max_)
81 .def("run", &SolverFDDP::run,
82 ("self"_a, "problem", "xs_init", "us_init"));
83}
84
85} // namespace python
86} // namespace aligator
ManifoldAbstractTpl< Scalar > Manifold
Definition context.hpp:14
The Python bindings.
Definition blk-matrix.hpp:5
Main package namespace.
Q-function model parameters.
The feasible DDP (FDDP) algorithm, from Mastalli et al. (2020).
Storage for the value function model parameters.
Workspace for solver SolverFDDP.
Definition workspace.hpp:10