pinocchio 4.1.0
A fast and flexible implementation of Rigid Body Dynamics algorithms and their analytical derivatives
Loading...
Searching...
No Matches
joint-data.hpp
1//
2// Copyright (c) 2020 INRIA
3//
4
5#pragma once
6
7#include "pinocchio/multibody/joint.hpp"
8#include "pinocchio/bindings/python/multibody/joint/joint-derived.hpp"
9#include "pinocchio/bindings/python/utils/printable.hpp"
10
11namespace pinocchio
12{
13 namespace python
14 {
15 namespace bp = boost::python;
16
17 template<typename JointData>
19 {
20 typedef typename JointData::JointCollection JointCollection;
21 typedef bp::object result_type;
22
23 template<typename JointDataDerived>
24 result_type operator()(const JointDataBase<JointDataDerived> & jdata) const
25 {
26 bp::object obj(boost::ref(jdata.derived()));
27 return obj;
28 }
29
30 static result_type extract(const JointData & jdata)
31 {
32 return boost::apply_visitor(ExtractJointDataVariantTypeVisitor(), jdata);
33 }
34 };
35
36 template<typename JointData>
38 {
39
40 static void expose()
41 {
42 bp::class_<JointData>("JointData", "Generic Joint Data", bp::no_init)
43 .def(
44 bp::init<const typename JointData::JointDataVariant &>(bp::args("self", "joint_data")))
47 .def(
48 "extract", ExtractJointDataVariantTypeVisitor<JointData>::extract, bp::arg("self"),
49 "Returns a reference of the internal joint managed by the JointData",
50 bp::with_custodian_and_ward_postcall<0, 1>());
51 }
52 };
53
54 } // namespace python
55} // 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