pinocchio 4.1.0
A fast and flexible implementation of Rigid Body Dynamics algorithms and their analytical derivatives
Loading...
Searching...
No Matches
constraint-model.hpp
1//
2// Copyright (c) 2025 INRIA
3//
4
5#pragma once
6
7#include "pinocchio/constraints.hpp"
8#include "pinocchio/serialization.hpp"
9
10#include "pinocchio/bindings/python/algorithm/constraints/constraint-model-base.hpp"
11#include "pinocchio/bindings/python/utils/printable.hpp"
12#include "pinocchio/bindings/python/serialization/serializable.hpp"
13
14namespace pinocchio
15{
16 namespace python
17 {
18 namespace bp = boost::python;
19
20 template<typename ConstraintModel>
22 {
23 typedef typename ConstraintModel::ConstraintCollection ConstraintCollection;
24 typedef bp::object result_type;
25
26 template<typename ConstraintModelDerived>
27 result_type operator()(const ConstraintModelBase<ConstraintModelDerived> & cmodel) const
28 {
29 bp::object obj(boost::ref(cmodel.derived()));
30 return obj;
31 }
32
33 result_type operator()(BlankConstraintModel) const
34 {
35 bp::object obj;
36 return obj;
37 }
38
39 static result_type extract(const ConstraintModel & cmodel)
40 {
41 return boost::apply_visitor(ExtractConstraintModelVariantTypeVisitor(), cmodel);
42 }
43 };
44
45 template<typename ConstraintModel>
47 {
48 static void expose()
49 {
50 bp::class_<ConstraintModel>("ConstraintModel", "Generic Constraint Model", bp::no_init)
51 .def(bp::init<const ConstraintModel &>(bp::args("self", "other"), "Copy constructor"))
55 .def(
56 "extract", ExtractConstraintModelVariantTypeVisitor<ConstraintModel>::extract,
57 bp::arg("self"),
58 "Returns a reference of the internal constraint managed by the ConstraintModel",
59 bp::with_custodian_and_ward_postcall<0, 1>());
60 }
61 };
62 } // namespace python
63} // namespace pinocchio
Main pinocchio namespace.
Definition treeview.dox:11
Set the Python method str and repr to use the overloading operator<<.
Definition printable.hpp:21