GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: include/pinocchio/bindings/python/multibody/joint/joints-datas.hpp Lines: 18 18 100.0 %
Date: 2024-01-23 21:41:47 Branches: 10 20 50.0 %

Line Branch Exec Source
1
//
2
// Copyright (c) 2019-2020 CNRS INRIA
3
//
4
5
#ifndef __pinocchio_python_joints_datas_hpp__
6
#define __pinocchio_python_joints_datas_hpp__
7
8
#include <boost/python.hpp>
9
10
namespace pinocchio
11
{
12
  namespace python
13
  {
14
    namespace bp = boost::python;
15
16
    // generic expose_joint_data : do nothing special
17
    template <class T>
18
608
    inline bp::class_<T>& expose_joint_data(bp::class_<T>& cl)
19
    {
20
608
      return cl;
21
    }
22
23
    // specialization for JointDataRevoluteUnaligned
24
    template<>
25
19
    inline bp::class_<JointDataRevoluteUnaligned>& expose_joint_data<JointDataRevoluteUnaligned> (bp::class_<JointDataRevoluteUnaligned> & cl)
26
    {
27
      return cl
28

19
        .def(bp::init<Eigen::Vector3d> (bp::args("axis"), "Init JointDataRevoluteUnaligned from an axis with x-y-z components"))
29
        ;
30
    }
31
32
    // specialization for JointDataPrismaticUnaligned
33
    template<>
34
19
    inline bp::class_<JointDataPrismaticUnaligned>& expose_joint_data<JointDataPrismaticUnaligned> (bp::class_<JointDataPrismaticUnaligned> & cl)
35
    {
36
      return cl
37

19
        .def(bp::init<Eigen::Vector3d> (bp::args("axis"), "Init JointDataPrismaticUnaligned from an axis with x-y-z components"))
38
               ;
39
    }
40
41
    template<>
42
19
    inline bp::class_<JointDataPlanar>& expose_joint_data<JointDataPlanar> (bp::class_<JointDataPlanar> & cl)
43
    {
44
      return cl
45
19
        .add_property("StU",&JointDataPlanar::StU)
46
        ;
47
    }
48
49
50
    template<>
51
19
    inline bp::class_<JointDataSphericalZYX>& expose_joint_data<JointDataSphericalZYX> (bp::class_<JointDataSphericalZYX> & cl)
52
    {
53
      return cl
54
19
        .add_property("StU",&JointDataSphericalZYX::StU)
55
        ;
56
    }
57
58
    template<>
59
19
    inline bp::class_<JointDataComposite>& expose_joint_data<JointDataComposite> (bp::class_<JointDataComposite> & cl)
60
    {
61
      return cl
62
19
        .def(bp::init<const JointDataComposite::JointDataVector&, const int, const int>
63
38
           (bp::args("joint_data_vectors", "nq", "nv"),
64
19
            "Init JointDataComposite from a given collection of joint data"))
65
19
        .add_property("joints",&JointDataComposite::joints)
66
19
        .add_property("iMlast",&JointDataComposite::iMlast)
67
19
        .add_property("pjMi",&JointDataComposite::pjMi)
68
38
        .add_property("StU",&JointDataComposite::StU)
69
        ;
70
    }
71
72
  } // namespace python
73
} // namespace pinocchio
74
75
#endif // ifndef __pinocchio_python_joint_datas_hpp__