5#ifndef __pinocchio_python_algorithm_constraints_coulomb_friction_cone_hpp__
6#define __pinocchio_python_algorithm_constraints_coulomb_friction_cone_hpp__
8#include "pinocchio/algorithm/constraints/coulomb-friction-cone.hpp"
10#include "pinocchio/bindings/python/utils/cast.hpp"
11#include "pinocchio/bindings/python/utils/copyable.hpp"
17 namespace bp = boost::python;
19 template<
typename CoulombFrictionCone>
20 struct CoulombFrictionConePythonVisitor
21 :
public boost::python::def_visitor<CoulombFrictionConePythonVisitor<CoulombFrictionCone>>
23 typedef typename CoulombFrictionCone::Scalar Scalar;
24 typedef CoulombFrictionCone Self;
26 template<
class PyClass>
27 void visit(PyClass & cl)
const
29 cl.def(bp::init<const Scalar &>(bp::args(
"self",
"mu"),
"Default constructor"))
30 .def(bp::init<const Self &>(bp::args(
"self",
"other"),
"Copy constructor"))
32 .def_readwrite(
"mu", &Self::mu,
"Friction coefficient.")
35 "isInside", &Self::template isInside<context::Vector3s>, bp::args(
"self",
"f"),
36 "Check whether a vector x lies within the cone.")
39 "project", &Self::template project<context::Vector3s>, bp::args(
"self",
"f"),
40 "Normal projection of a vector f onto the cone.")
42 "weightedProject", &Self::template weightedProject<context::Vector3s>,
43 bp::args(
"self",
"f",
"R"),
"Weighted projection of a vector f onto the cone.")
45 "computeNormalCorrection", &Self::template computeNormalCorrection<context::Vector3s>,
46 bp::args(
"self",
"v"),
47 "Compute the complementary shift associted to the Coulomb friction cone for "
48 "complementarity satisfaction in complementary problems.")
50 "computeRadialProjection", &Self::template computeRadialProjection<context::Vector3s>,
51 bp::args(
"self",
"f"),
52 "Compute the radial projection associted to the Coulomb friction cone.")
54 .def(
"dual", &Self::dual, bp::arg(
"self"),
"Returns the dual cone associated to this")
56 .def(
"dim", Self::dim,
"Returns the dimension of the cone.")
59#ifndef PINOCCHIO_PYTHON_SKIP_COMPARISON_OPERATIONS
60 .def(bp::self == bp::self)
61 .def(bp::self != bp::self)
68 bp::class_<CoulombFrictionCone>(
69 "CoulombFrictionCone",
"3d Coulomb friction cone.\n", bp::no_init)
70 .def(CoulombFrictionConePythonVisitor())
73 .def(CopyableVisitor<CoulombFrictionCone>());
77 template<
typename DualCoulombFrictionCone>
78 struct DualCoulombFrictionConePythonVisitor
79 :
public boost::python::def_visitor<
80 DualCoulombFrictionConePythonVisitor<DualCoulombFrictionCone>>
82 typedef typename DualCoulombFrictionCone::Scalar Scalar;
83 typedef DualCoulombFrictionCone Self;
85 template<
class PyClass>
86 void visit(PyClass & cl)
const
88 cl.def(bp::init<const Scalar &>(bp::args(
"self",
"mu"),
"Default constructor"))
89 .def(bp::init<const Self &>(bp::args(
"self",
"other"),
"Copy constructor"))
91 .def_readwrite(
"mu", &Self::mu,
"Friction coefficient.")
94 "isInside", &Self::template isInside<context::Vector3s>, bp::args(
"self",
"v"),
95 "Check whether a vector x lies within the cone.")
98 "project", &Self::template project<context::Vector3s>, bp::args(
"self",
"v"),
99 "Project a vector v onto the cone.")
101 .def(
"dual", &Self::dual, bp::arg(
"self"),
"Returns the dual cone associated to this.")
103 .def(
"dim", Self::dim,
"Returns the dimension of the cone.")
106#ifndef PINOCCHIO_PYTHON_SKIP_COMPARISON_OPERATIONS
107 .def(bp::self == bp::self)
108 .def(bp::self != bp::self)
115 bp::class_<DualCoulombFrictionCone>(
116 "DualCoulombFrictionCone",
"Dual cone of the 3d Coulomb friction cone.\n", bp::no_init)
117 .def(DualCoulombFrictionConePythonVisitor())
120 .def(CopyableVisitor<DualCoulombFrictionCone>());
Main pinocchio namespace.