GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: bindings/python/algorithm/expose-geometry.cpp Lines: 20 21 95.2 %
Date: 2024-01-23 21:41:47 Branches: 10 20 50.0 %

Line Branch Exec Source
1
//
2
// Copyright (c) 2015-2021 CNRS INRIA
3
//
4
5
#include "pinocchio/bindings/python/algorithm/algorithms.hpp"
6
#include "pinocchio/algorithm/geometry.hpp"
7
8
namespace pinocchio
9
{
10
  namespace python
11
  {
12
13
19
    void exposeGeometryAlgo()
14
    {
15
      using namespace Eigen;
16
17
19
      bp::def("updateGeometryPlacements",
18
              &updateGeometryPlacements<double,0,JointCollectionDefaultTpl,VectorXd>,
19
38
              bp::args("model", "data", "geometry_model", "geometry_data", "q"),
20
              "Update the placement of the collision objects according to the current configuration.\n"
21
              "The algorithm also updates the current placement of the joint in Data."
22
              );
23
24
19
      bp::def("updateGeometryPlacements",
25
              &updateGeometryPlacements<double,0,JointCollectionDefaultTpl>,
26
38
              bp::args("model", "data", "geometry_model", "geometry_data"),
27
              "Update the placement of the collision objects according to the current joint placement stored in data."
28
              );
29
30
#ifdef PINOCCHIO_WITH_HPP_FCL
31
19
      bp::def("computeCollision",computeCollision,
32
38
              bp::args("geometry_model", "geometry_data", "pair_index"),
33
              "Check if the collision objects of a collision pair for a given Geometry Model and Data are in collision.\n"
34
              "The collision pair is given by the two index of the collision objects."
35
              );
36
37
19
      bp::def("computeCollisions",
38
              (bool (*)(const GeometryModel &, GeometryData &, const bool))&computeCollisions,
39
38
              bp::args("geometry_model","geometry_data","stop_at_first_collision"),
40
              "Determine if collision pairs are effectively in collision."
41
              );
42
43
19
      bp::def("computeCollisions",
44
              &computeCollisions<double,0,JointCollectionDefaultTpl,VectorXd>,
45
38
              bp::args("model","data","geometry_model","geometry_data","q","stop_at_first_collision"),
46
              "Update the geometry for a given configuration and "
47
              "determine if all collision pairs are effectively in collision or not."
48
              );
49
50
19
      bp::def("computeDistance",&computeDistance,
51
38
              bp::args("geometry_model", "geometry_data", "pair_index"),
52
              "Compute the distance between the two geometry objects of a given collision pair for a GeometryModel and associated GeometryData.",
53
              bp::with_custodian_and_ward_postcall<0,2,bp::return_value_policy<bp::reference_existing_object> >()
54
              );
55
56
19
      bp::def("computeDistances",
57
              (std::size_t (*)(const GeometryModel &, GeometryData &))&computeDistances,
58
38
              bp::args("geometry_model","geometry_data"),
59
              "Compute the distance between each collision pair for a given GeometryModel and associated GeometryData."
60
              );
61
62
19
      bp::def("computeDistances",
63
              &computeDistances<double,0,JointCollectionDefaultTpl,VectorXd>,
64
38
              bp::args("model","data","geometry_model","geometry_data","q"),
65
              "Update the geometry for a given configuration and "
66
              "compute the distance between each collision pair"
67
              );
68
69
19
      bp::def("computeBodyRadius",
70
              &computeBodyRadius<double,0,JointCollectionDefaultTpl>,
71
38
              bp::args("model","geometry_model","geometry_data"),
72
              "Compute the radius of the geometry volumes attached to every joints.");
73
#endif // PINOCCHIO_WITH_HPP_FCL
74
75
19
    }
76
  } // namespace python
77
} // namespace pinocchio