aligator
0.19.0
A versatile and efficient C++ library for real-time constrained trajectory optimization.
Toggle main menu visibility
Loading...
Searching...
No Matches
expose-utils.cpp
Go to the documentation of this file.
1
#include "
aligator/python/fwd.hpp
"
2
#include "
aligator/gar/utils.hpp
"
3
4
#include <eigenpy/std-array.hpp>
5
6
namespace
aligator::python
{
7
using namespace
gar;
8
9
using
context::Scalar
;
10
using
context::VectorXs;
11
using
lqr_t
=
LqrProblemTpl<context::Scalar>
;
12
13
bp::dict
lqr_sol_initialize_wrap
(
const
lqr_t
&problem) {
14
bp::dict out;
15
auto
ss =
lqrInitializeSolution
(problem);
16
auto
&[xs, us, vs, lbdas] = ss;
17
out[
"xs"
] = xs;
18
out[
"us"
] = us;
19
out[
"vs"
] = vs;
20
out[
"lbdas"
] = lbdas;
21
return
out;
22
}
23
24
bp::tuple
lqr_create_sparse_wrap
(
const
lqr_t
&problem,
const
Scalar
mueq,
25
bool
update) {
26
Eigen::SparseMatrix<Scalar> mat;
27
VectorXs rhs;
28
lqrCreateSparseMatrix
(problem, mueq, mat, rhs, update);
29
mat.makeCompressed();
30
return
bp::make_tuple(mat, rhs);
31
}
32
33
void
exposeGarUtils
() {
34
bp::def(
"lqrCreateSparseMatrix"
,
lqr_create_sparse_wrap
,
35
(
"problem"
_a,
"mueq"
,
"update"
),
36
"Create or update a sparse matrix from an LqrProblem."
);
37
38
bp::def(
"lqrInitializeSolution"
,
lqr_sol_initialize_wrap
, (
"problem"
_a));
39
40
bp::def(
"lqrComputeKktError"
,
lqrComputeKktError<Scalar>
,
41
(
"problem"
_a,
"xs"
,
"us"
,
"vs"
,
"lbdas"
,
"mueq"
,
"theta"
,
42
"verbose"
_a =
false
),
43
"Compute the KKT residual of the LQR problem."
);
44
}
45
}
// namespace aligator::python
fwd.hpp
utils.hpp
aligator::context::Scalar
double Scalar
Definition
context.hpp:9
aligator::gar::lqrCreateSparseMatrix
void lqrCreateSparseMatrix(const LqrProblemTpl< Scalar > &problem, const Scalar mueq, Eigen::SparseMatrix< Scalar > &mat, Eigen::Matrix< Scalar, -1, 1 > &rhs, bool update)
aligator::gar::lqrInitializeSolution
auto lqrInitializeSolution(const LqrProblemTpl< Scalar > &problem)
Definition
utils.hpp:114
aligator::gar::lqrComputeKktError
std::array< Scalar, 3 > lqrComputeKktError(const LqrProblemTpl< Scalar > &problem, boost::span< const typename math_types< Scalar >::VectorXs > xs, boost::span< const typename math_types< Scalar >::VectorXs > us, boost::span< const typename math_types< Scalar >::VectorXs > vs, boost::span< const typename math_types< Scalar >::VectorXs > lbdas, const Scalar mueq, const std::optional< typename math_types< Scalar >::ConstVectorRef > &theta=std::nullopt, bool verbose=false)
aligator::python
The Python bindings.
Definition
blk-matrix.hpp:7
aligator::python::exposeGarUtils
void exposeGarUtils()
Definition
expose-utils.cpp:33
aligator::python::lqr_sol_initialize_wrap
bp::dict lqr_sol_initialize_wrap(const lqr_t &problem)
Definition
expose-utils.cpp:13
aligator::python::lqr_create_sparse_wrap
bp::tuple lqr_create_sparse_wrap(const lqr_t &problem, const Scalar mueq, bool update)
Definition
expose-utils.cpp:24
aligator::python::lqr_t
LqrProblemTpl< context::Scalar > lqr_t
Definition
expose-dense.cpp:11
aligator::gar::LqrProblemTpl
Definition
lqr-problem.hpp:105
bindings
python
src
gar
expose-utils.cpp
Generated by
1.17.0