GCC Code Coverage Report


Directory: ./
File: include/pinocchio/bindings/python/multibody/joint/joints-datas.hpp
Date: 2024-08-27 18:20:05
Exec Total Coverage
Lines: 22 22 100.0%
Branches: 12 24 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 namespace pinocchio
9 {
10 namespace python
11 {
12 namespace bp = boost::python;
13
14 // generic expose_joint_data : do nothing special
15 template<class T>
16 800 inline bp::class_<T> & expose_joint_data(bp::class_<T> & cl)
17 {
18 800 return cl;
19 }
20
21 // specialization for JointDataRevoluteUnaligned
22 template<>
23 inline bp::class_<JointDataRevoluteUnaligned> &
24 20 expose_joint_data<JointDataRevoluteUnaligned>(bp::class_<JointDataRevoluteUnaligned> & cl)
25 {
26
2/4
✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 20 times.
✗ Branch 5 not taken.
20 return cl.def(bp::init<const Eigen::Vector3d &>(
27 40 bp::args("axis"), "Init JointDataRevoluteUnaligned from an axis with x-y-z components"));
28 }
29
30 // specialization for JointDataPrismaticUnaligned
31 template<>
32 inline bp::class_<JointDataPrismaticUnaligned> &
33 20 expose_joint_data<JointDataPrismaticUnaligned>(bp::class_<JointDataPrismaticUnaligned> & cl)
34 {
35
2/4
✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 20 times.
✗ Branch 5 not taken.
20 return cl.def(bp::init<const Eigen::Vector3d &>(
36 40 bp::args("axis"), "Init JointDataPrismaticUnaligned from an axis with x-y-z components"));
37 }
38
39 // specialization for JointDataHelicalUnaligned
40 template<>
41 inline bp::class_<JointDataHelicalUnaligned> &
42 20 expose_joint_data<JointDataHelicalUnaligned>(bp::class_<JointDataHelicalUnaligned> & cl)
43 {
44
2/4
✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 20 times.
✗ Branch 5 not taken.
20 return cl.def(bp::init<const Eigen::Vector3d &>(
45 40 bp::args("axis"), "Init JointDataHelicalUnaligned from an axis with x-y-z components"));
46 }
47
48 template<>
49 inline bp::class_<JointDataPlanar> &
50 20 expose_joint_data<JointDataPlanar>(bp::class_<JointDataPlanar> & cl)
51 {
52 20 return cl.add_property("StU", &JointDataPlanar::StU);
53 }
54
55 template<>
56 inline bp::class_<JointDataSphericalZYX> &
57 20 expose_joint_data<JointDataSphericalZYX>(bp::class_<JointDataSphericalZYX> & cl)
58 {
59 20 return cl.add_property("StU", &JointDataSphericalZYX::StU);
60 }
61
62 template<>
63 inline bp::class_<JointDataComposite> &
64 20 expose_joint_data<JointDataComposite>(bp::class_<JointDataComposite> & cl)
65 {
66 return cl
67
2/4
✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 20 times.
✗ Branch 5 not taken.
20 .def(bp::init<const JointDataComposite::JointDataVector &, const int, const int>(
68 40 bp::args("joint_data_vectors", "nq", "nv"),
69 "Init JointDataComposite from a given collection of joint data"))
70
1/2
✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
20 .add_property("joints", &JointDataComposite::joints)
71
1/2
✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
20 .add_property("iMlast", &JointDataComposite::iMlast)
72
1/2
✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
20 .add_property("pjMi", &JointDataComposite::pjMi)
73
1/2
✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
40 .add_property("StU", &JointDataComposite::StU);
74 }
75
76 } // namespace python
77 } // namespace pinocchio
78
79 #endif // ifndef __pinocchio_python_joint_datas_hpp__
80