pinocchio 4.1.0
A fast and flexible implementation of Rigid Body Dynamics algorithms and their analytical derivatives
Loading...
Searching...
No Matches
set-coulomb-friction-cone.hpp
1//
2// Copyright (c) 2022-2025 INRIA
3//
4
5#pragma once
6
7#include <eigenpy/copyable.hpp>
8
9#include "pinocchio/constraints.hpp"
10#include "pinocchio/bindings/python/algorithm/constraints/set-base.hpp"
11#include "pinocchio/bindings/python/utils/cast.hpp"
12
13namespace pinocchio
14{
15 namespace python
16 {
17 namespace bp = boost::python;
18
19 template<typename CoulombFrictionCone>
21 : public boost::python::def_visitor<CoulombFrictionConePythonVisitor<CoulombFrictionCone>>
22 {
23 typedef typename CoulombFrictionCone::Scalar Scalar;
24 typedef CoulombFrictionCone Self;
25
26 template<class PyClass>
27 void visit(PyClass & cl) const
28 {
29 cl.def(
30 bp::init<const Scalar &>(
31 bp::args("self", "mu"), "Constructor from a given friction coefficient"))
32 .def(bp::init<const Self &>(bp::args("self", "other"), "Copy constructor"))
33 .add_property(
34 "mu", bp::make_function(+[](Self & self) -> Scalar { return self.mu; }),
35 "Friction coefficient.")
36 .def(
37 "weightedProject",
38 &Self::template weightedProject<context::Vector3s, context::Vector3s>,
39 bp::args("self", "f", "R"), "Weighted projection of a vector f onto the cone.")
40 .def(
41 "computeNormalCorrection", &Self::template computeNormalCorrection<context::Vector3s>,
42 bp::args("self", "v"),
43 "Compute the complementary shift associted to the Coulomb friction cone for "
44 "complementarity satisfaction in complementary problems.")
45 .def(
46 "computeRadialProjection", &Self::template computeRadialProjection<context::Vector3s>,
47 bp::args("self", "f"),
48 "Compute the radial projection associted to the Coulomb friction cone.");
49 }
50
51 static void expose()
52 {
53 bp::class_<CoulombFrictionCone>(
54 "CoulombFrictionCone", "3d Coulomb friction cone.\n", bp::no_init)
58 // .def(CastVisitor<CoulombFrictionCone>())
59 // .def(ExposeConstructorByCastVisitor<CoulombFrictionCone,::pinocchio::CoulombFrictionCone>())
60 .def(::eigenpy::CopyableVisitor<CoulombFrictionCone>());
61 }
62 };
63
64 template<typename DualCoulombFrictionCone>
66 : public boost::python::def_visitor<
67 DualCoulombFrictionConePythonVisitor<DualCoulombFrictionCone>>
68 {
69 typedef typename DualCoulombFrictionCone::Scalar Scalar;
70 typedef DualCoulombFrictionCone Self;
71
72 template<class PyClass>
73 void visit(PyClass & cl) const
74 {
75 cl.def(
76 bp::init<const Scalar &>(
77 bp::args("self", "mu"), "Constructor from a given friction coefficient"))
78 .def(bp::init<const Self &>(bp::args("self", "other"), "Copy constructor"))
79 .add_property(
80 "mu", bp::make_function(+[](Self & self) -> Scalar { return self.mu; }),
81 "Friction coefficient.");
82 }
83
84 static void expose()
85 {
86 bp::class_<DualCoulombFrictionCone>(
87 "DualCoulombFrictionCone", "Dual cone of the 3d Coulomb friction cone.\n", bp::no_init)
91 // .def(CastVisitor<DualCoulombFrictionCone>())
92 // .def(ExposeConstructorByCastVisitor<DualCoulombFrictionCone,::pinocchio::CoulombFrictionCone>())
93 .def(::eigenpy::CopyableVisitor<DualCoulombFrictionCone>());
94 }
95 };
96 } // namespace python
97} // namespace pinocchio
Main pinocchio namespace.
Definition treeview.dox:11