bindings/python/algorithm/parallel/geometry.cpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2021 INRIA
3 //
4 
6 #include "pinocchio/algorithm/parallel/geometry.hpp"
7 
9 
10 namespace pinocchio
11 {
12  namespace python
13  {
14 
15  using namespace Eigen;
16  typedef Eigen::Matrix<bool,Eigen::Dynamic,1> VectorXb;
17 
18  static bool computeCollisions_proxy(const int num_threads,
19  const GeometryModel & geom_model,
21  const bool stopAtFirstCollision = false)
22  {
23  return computeCollisions(num_threads, geom_model, geom_data, stopAtFirstCollision);
24  }
25 
27  const Model & model,
28  Data & data,
29  const GeometryModel & geom_model,
31  const Eigen::VectorXd & q,
32  const bool stopAtFirstCollision = false)
33  {
34  return computeCollisions(num_threads, model, data, geom_model, geom_data, q, stopAtFirstCollision);
35  }
36 
37  static void computeCollisions_pool_proxy_res(const int num_thread, GeometryPool & pool,
38  const Eigen::MatrixXd & q, Eigen::Ref<VectorXb> res,
39  bool stop_at_first_collision = false)
40  {
41  computeCollisions(num_thread,pool,q,res,stop_at_first_collision);
42  }
43 
44  static VectorXb computeCollisions_pool_proxy(const int num_thread, GeometryPool & pool,
45  const Eigen::MatrixXd & q,
46  bool stop_at_first_collision = false)
47  {
48  VectorXb res(q.cols());
49  computeCollisions(num_thread,pool,q,res,stop_at_first_collision);
50  return res;
51  }
52 
53  BOOST_PYTHON_FUNCTION_OVERLOADS(computeCollisions_pool_proxy_res_overload,computeCollisions_pool_proxy_res,4,5)
54  BOOST_PYTHON_FUNCTION_OVERLOADS(computeCollisions_pool_proxy_overload,computeCollisions_pool_proxy,3,4)
55  BOOST_PYTHON_FUNCTION_OVERLOADS(computeCollisions_overload,computeCollisions_proxy,3,4)
56  BOOST_PYTHON_FUNCTION_OVERLOADS(computeCollisions_full_overload,computeCollisions_full_proxy,6,7)
57 
59  {
60  namespace bp = boost::python;
61 
62  using namespace Eigen;
63 
64  bp::def("computeCollisions",
66  computeCollisions_overload(bp::args("num_thread","geometry_model","geometry_data","stop_at_first_collision"),
67  "Evaluates in parallel the collisions for a single data and returns the result.\n\n"
68  "Parameters:\n"
69  "\tnum_thread: number of threads used for the computation\n"
70  "\tgeometry_model: the geometry model\n"
71  "\tgeometry_data: the geometry data\n"
72  "\tstop_at_first_collision: if set to true, stops when encountering the first collision.\n"));
73 
74  bp::def("computeCollisions",
76  computeCollisions_full_overload(bp::args("num_thread","model","data","geometry_model","geometry_data","q","stop_at_first_collision"),
77  "Evaluates in parallel the collisions for a single data and returns the result.\n\n"
78  "Parameters:\n"
79  "\tnum_thread: number of threads used for the computation\n"
80  "\tmodel: the kinematic model\n"
81  "\tdata: the data associated to the model\n"
82  "\tgeometry_model: the geometry model\n"
83  "\tgeometry_data: the geometry data associated to the tgeometry_model\n"
84  "\tq: the joint configuration vector (size model.nq)\n"
85  "\tstop_at_first_collision: if set to true, stops when encountering the first collision.\n"));
86 
87  bp::def("computeCollisions",
89  computeCollisions_pool_proxy_overload(bp::args("num_thread","pool","q","stop_at_first_collision"),
90  "Evaluates in parallel the collisions and returns the result.\n\n"
91  "Parameters:\n"
92  "\tnum_thread: number of threads used for the computation\n"
93  "\tpool: pool of geometry model/ geometry data\n"
94  "\tq: the joint configuration vector (size model.nq x batch_size)\n"
95  "\tstop_at_first_collision: if set to true, stop when encountering the first collision in a batch element.\n"));
96 
97  bp::def("computeCollisions",
99  computeCollisions_pool_proxy_res_overload(bp::args("num_thread","pool","q","res","stop_at_first_collision"),
100  "Evaluates in parallel the collisions and stores the result in res.\n\n"
101  "Parameters:\n"
102  "\tnum_thread: number of threads used for the computation\n"
103  "\tpool: pool of geometry model/ geometry data\n"
104  "\tq: the joint configuration vector (size model.nq x batch_size)\n"
105  "\tres: the resulting collision vector (batch_size)\n"
106  "\tstop_at_first_collision: if set to true, stop when encountering the first collision in a batch element.\n"));
107 
108  }
109 
110  } // namespace python
111 } // namespace pinocchio
static bool computeCollisions_full_proxy(const int num_threads, const Model &model, Data &data, const GeometryModel &geom_model, GeometryData &geom_data, const Eigen::VectorXd &q, const bool stopAtFirstCollision=false)
static bool computeCollisions_proxy(const int num_threads, const GeometryModel &geom_model, GeometryData &geom_data, const bool stopAtFirstCollision=false)
static void computeCollisions_pool_proxy_res(const int num_thread, GeometryPool &pool, const Eigen::MatrixXd &q, Eigen::Ref< VectorXb > res, bool stop_at_first_collision=false)
BOOST_PYTHON_FUNCTION_OVERLOADS(computeKKTContactDynamicMatrixInverse_overload, computeKKTContactDynamicMatrixInverse_proxy, 4, 5) static const Eigen
static VectorXb computeCollisions_pool_proxy(const int num_thread, GeometryPool &pool, const Eigen::MatrixXd &q, bool stop_at_first_collision=false)
JointCollectionTpl const Eigen::MatrixBase< ConfigVectorType > & q
bool computeCollisions(const int num_threads, const GeometryModel &geom_model, GeometryData &geom_data, const bool stopAtFirstCollision=false)
Eigen::Matrix< bool, Eigen::Dynamic, 1 > VectorXb
Main pinocchio namespace.
Definition: timings.cpp:28
Eigen::Matrix< Scalar, Eigen::Dynamic, 1 > VectorXd
Definition: conversions.cpp:14
JointCollectionTpl & model


pinocchio
Author(s):
autogenerated on Fri Jun 23 2023 02:38:30