include
pinocchio
bindings
python
multibody
joint
joint-data.hpp
Go to the documentation of this file.
1
//
2
// Copyright (c) 2020 INRIA
3
//
4
5
#ifndef __pinocchio_python_multibody_joint_joint_data_hpp__
6
#define __pinocchio_python_multibody_joint_joint_data_hpp__
7
8
#include "
pinocchio/multibody/joint/joint-generic.hpp
"
9
#include "
pinocchio/bindings/python/multibody/joint/joint-derived.hpp
"
10
#include "
pinocchio/bindings/python/utils/printable.hpp
"
11
12
namespace
pinocchio
13
{
14
namespace
python
15
{
16
namespace
bp
=
boost::python
;
17
18
template
<
typename
Jo
int
Data>
19
struct
ExtractJointDataVariantTypeVisitor
20
{
21
typedef
typename
JointData::JointCollection
JointCollection
;
22
typedef
bp::object
result_type
;
23
24
template
<
typename
Jo
int
DataDerived>
25
result_type
operator()
(
const
JointDataBase<JointDataDerived>
& jdata)
const
26
{
27
bp::object obj(boost::ref(jdata.
derived
()));
28
return
obj;
29
}
30
31
static
result_type
extract
(
const
JointData
& jdata)
32
{
33
return
boost::apply_visitor(
ExtractJointDataVariantTypeVisitor
(), jdata);
34
}
35
};
36
37
template
<
typename
Jo
int
Data>
38
struct
JointDataPythonVisitor
39
{
40
41
static
void
expose
()
42
{
43
bp::class_<JointData>(
"JointData"
,
"Generic Joint Data"
, bp::no_init)
44
.def(
45
bp::init<const typename JointData::JointDataVariant &>(bp::args(
"self"
,
"joint_data"
)))
46
.def(
JointDataBasePythonVisitor<JointData>
())
47
.def(
PrintableVisitor<JointData>
())
48
.def(
49
"extract"
,
ExtractJointDataVariantTypeVisitor<JointData>::extract
, bp::arg(
"self"
),
50
"Returns a reference of the internal joint managed by the JointData"
,
51
bp::with_custodian_and_ward_postcall<0, 1>());
52
}
53
};
54
55
}
// namespace python
56
}
// namespace pinocchio
57
58
#endif // ifndef __pinocchio_python_multibody_joint_joint_data_hpp__
boost::python
pinocchio::python::JointDataPythonVisitor
Definition:
joint-data.hpp:38
pinocchio::JointDataBase
Definition:
joint-data-base.hpp:161
pinocchio::JointDataTpl< context::Scalar >::JointCollection
JointCollectionTpl< context::Scalar, _Options > JointCollection
Definition:
joint-generic.hpp:100
pinocchio::python::ExtractJointDataVariantTypeVisitor::extract
static result_type extract(const JointData &jdata)
Definition:
joint-data.hpp:31
pinocchio::JointDataTpl< context::Scalar >
pinocchio::JointDataBase::derived
Derived & derived()
Definition:
joint-data-base.hpp:168
pinocchio::python::JointDataPythonVisitor::expose
static void expose()
Definition:
joint-data.hpp:41
pinocchio::python::PrintableVisitor
Set the Python method str and repr to use the overloading operator<<.
Definition:
printable.hpp:21
joint-generic.hpp
python
pinocchio::python::JointDataBasePythonVisitor
Definition:
joint-derived.hpp:117
pinocchio::python::ExtractJointDataVariantTypeVisitor::operator()
result_type operator()(const JointDataBase< JointDataDerived > &jdata) const
Definition:
joint-data.hpp:25
pinocchio::python::ExtractJointDataVariantTypeVisitor::JointCollection
JointData::JointCollection JointCollection
Definition:
joint-data.hpp:21
pinocchio::python::ExtractJointDataVariantTypeVisitor::result_type
bp::object result_type
Definition:
joint-data.hpp:22
joint-derived.hpp
pinocchio::python::ExtractJointDataVariantTypeVisitor
Definition:
joint-data.hpp:19
printable.hpp
pinocchio
Main pinocchio namespace.
Definition:
timings.cpp:27
pinocchio
Author(s):
autogenerated on Sun Dec 22 2024 03:41:10