pinocchio 4.1.0
A fast and flexible implementation of Rigid Body Dynamics algorithms and their analytical derivatives
Loading...
Searching...
No Matches
constraints-datas.hpp
1//
2// Copyright (c) 2025 INRIA
3//
4
5#pragma once
6
7#include "pinocchio/constraints.hpp"
8#include "pinocchio/bindings/python/fwd.hpp"
9#include "pinocchio/bindings/python/utils/printable.hpp"
10#include "pinocchio/bindings/python/algorithm/constraints/constraint-data-inheritance.hpp"
11
12namespace pinocchio
13{
14 namespace python
15 {
16 namespace bp = boost::python;
17
18 // generic expose_constraint_data : do nothing special
19 template<class T>
20 inline bp::class_<T> & expose_constraint_data(bp::class_<T> & cl)
21 {
22 return cl;
23 }
24
25 // specialization for ConstraintDatas
26 template<>
27 bp::class_<context::JointFrictionConstraintData> &
28 expose_constraint_data(bp::class_<context::JointFrictionConstraintData> & cl)
29 {
30 typedef context::JointFrictionConstraintData Self;
31
32 return cl
33 .def(
34 bp::init<const typename context::JointFrictionConstraintData::ConstraintModel &>(
35 bp::args("self", "constraint_model"), "From model constructor."))
36 .def_readwrite("friction_impulse_lower_limit", &Self::friction_impulse_lower_limit)
37 .def_readwrite("friction_impulse_upper_limit", &Self::friction_impulse_upper_limit);
38 }
39
40 template<>
41 bp::class_<context::JointLimitConstraintData> &
42 expose_constraint_data(bp::class_<context::JointLimitConstraintData> & cl)
43 {
44 typedef context::JointLimitConstraintData Self;
45 return cl
46 .def(
47 bp::init<const typename Self::ConstraintModel &>(
48 bp::args("self", "constraint_model"), "From model constructor."))
49 .PINOCCHIO_ADD_PROPERTY(Self, rowise_tangent_map, "Rowise tangent map.")
50 .add_property(
51 "constraint_residual",
52 bp::make_function(
53 +[](const context::JointLimitConstraintData & self)
54 -> Eigen::Ref<context::JointLimitConstraintData::VectorXs> {
55 return Eigen::Ref<context::JointLimitConstraintData::VectorXs>(
56 self.constraint_residual);
57 },
58 bp::with_custodian_and_ward_postcall<0, 1>()),
59 "");
60 // CompactTangentMap and constraint_residual_storage are not exposed
61 }
62 } // namespace python
63} // namespace pinocchio
Main pinocchio namespace.
Definition treeview.dox:11