bindings
python
algorithm
pgs-solver.cpp
Go to the documentation of this file.
1
//
2
// Copyright (c) 2022-2024 INRIA
3
//
4
5
#include "
pinocchio/algorithm/pgs-solver.hpp
"
6
#include "
pinocchio/bindings/python/fwd.hpp
"
7
8
#include "
pinocchio/bindings/python/algorithm/contact-solver-base.hpp
"
9
#include "
pinocchio/bindings/python/utils/std-vector.hpp
"
10
#include <
eigenpy/eigen-from-python.hpp
>
11
12
namespace
pinocchio
13
{
14
namespace
python
15
{
16
namespace
bp
=
boost::python
;
17
18
typedef
PGSContactSolverTpl<context::Scalar>
Solver
;
19
20
#ifdef PINOCCHIO_PYTHON_PLAIN_SCALAR_TYPE
21
template
<
typename
DelassusMatrixType>
22
static
bool
solve_wrapper(
23
Solver
& solver,
24
const
DelassusMatrixType & G,
25
const
context::VectorXs
& g,
26
const
context::CoulombFrictionConeVector & cones,
27
Eigen::Ref<context::VectorXs> x,
28
const
context::Scalar
over_relax = 1)
29
{
30
return
solver.solve(G, g, cones, x, over_relax);
31
}
32
#endif
33
34
void
exposePGSContactSolver
()
35
{
36
#ifdef PINOCCHIO_PYTHON_PLAIN_SCALAR_TYPE
37
bp::class_<Solver>(
38
"PGSContactSolver"
,
"Projected Gauss Siedel solver for contact dynamics."
,
39
bp::init<int>(bp::args(
"self"
,
"problem_dim"
),
"Default constructor."
))
40
.def(
ContactSolverBasePythonVisitor<Solver>
())
41
.def(
42
"solve"
, solve_wrapper<context::MatrixXs>,
43
(bp::args(
"self"
,
"G"
,
"g"
,
"cones"
,
"x"
), (bp::arg(
"over_relax"
) =
context::Scalar
(1))),
44
"Solve the constrained conic problem composed of problem data (G,g,cones) and starting "
45
"from the initial guess."
)
46
.def(
47
"solve"
, solve_wrapper<context::SparseMatrix>,
48
(bp::args(
"self"
,
"G"
,
"g"
,
"cones"
,
"x"
), (bp::arg(
"over_relax"
) =
context::Scalar
(1))),
49
"Solve the constrained conic problem composed of problem data (G,g,cones) and starting "
50
"from the initial guess."
);
51
52
#endif
53
}
54
55
}
// namespace python
56
}
// namespace pinocchio
contact-solver-base.hpp
pinocchio::python::ContactSolverBasePythonVisitor
Definition:
bindings/python/algorithm/contact-solver-base.hpp:18
boost::python
eigen-from-python.hpp
pgs-solver.hpp
pinocchio::context::VectorXs
Eigen::Matrix< Scalar, Eigen::Dynamic, 1, Options > VectorXs
Definition:
context/generic.hpp:47
python
pinocchio::python::Solver
ADMMContactSolverTpl< context::Scalar > Solver
Definition:
admm-solver.cpp:26
fwd.hpp
std-vector.hpp
pinocchio::python::context::Scalar
PINOCCHIO_PYTHON_SCALAR_TYPE Scalar
Definition:
bindings/python/context/generic.hpp:37
pinocchio
Main pinocchio namespace.
Definition:
timings.cpp:27
pinocchio::python::exposePGSContactSolver
void exposePGSContactSolver()
Definition:
pgs-solver.cpp:34
pinocchio
Author(s):
autogenerated on Thu Dec 19 2024 03:41:32