expose-reachable-workspace.cpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2015-2023 CNRS INRIA
3 //
4 
8 
10 
11 namespace pinocchio
12 {
13  namespace python
14  {
15  namespace bp = boost::python;
16 
17 #ifndef PINOCCHIO_PYTHON_SKIP_REACHABLE_WORKSPACE
19  const context::Model & model,
20  const context::VectorXs & q0,
21  const double time_horizon,
22  const int frame_id,
23  const int n_samples = 5,
24  const int facet_dims = 3)
25  {
28  param.n_samples = n_samples;
29  param.facet_dims = facet_dims;
30 
31  pinocchio::reachableWorkspaceHull(model, q0, time_horizon, frame_id, res, param);
32  return bp::make_tuple(res.vertex, res.faces);
33  }
34 
36  const context::Model & model,
37  const context::VectorXs & q0,
38  const double time_horizon,
39  const int frame_id,
40  const int n_samples = 5,
41  const int facet_dims = 3)
42  {
44  param.n_samples = n_samples;
45  param.facet_dims = facet_dims;
47 
48  pinocchio::reachableWorkspace(model, q0, time_horizon, frame_id, vertex, param);
49 
50  return vertex;
51  }
52 
53  #ifdef PINOCCHIO_WITH_HPP_FCL
54  bp::tuple reachableWorkspaceWithCollisionsHull_(
55  const context::Model & model,
56  const GeometryModel & geom_model,
57  const context::VectorXs & q0,
58  const double time_horizon,
59  const int frame_id,
60  const int n_samples = 5,
61  const int facet_dims = 3)
62  {
65  param.n_samples = n_samples;
66  param.facet_dims = facet_dims;
67 
68  pinocchio::reachableWorkspaceWithCollisionsHull(
69  model, geom_model, q0, time_horizon, frame_id, res, param);
70  return bp::make_tuple(res.vertex, res.faces);
71  }
72  static context::Data::MatrixXs reachableWorkspaceWithCollisions_(
73  const context::Model & model,
74  const GeometryModel & geom_model,
75  const context::VectorXs & q0,
76  const double time_horizon,
77  const int frame_id,
78  const int n_samples = 5,
79  const int facet_dims = 3)
80  {
81 
83  param.n_samples = n_samples;
84  param.facet_dims = facet_dims;
85 
87 
88  pinocchio::reachableWorkspaceWithCollisions(
89  model, geom_model, q0, time_horizon, frame_id, vertex, param);
90  return vertex;
91  }
92  #endif // PINOCCHIO_WITH_HPP_FCL
93 #endif // PINOCCHIO_PYTHON_SKIP_REACHABLE_WORKSPACE
94 
96  {
97 #ifndef PINOCCHIO_PYTHON_SKIP_REACHABLE_WORKSPACE
98  using namespace Eigen;
99  typedef context::Scalar Scalar;
100  typedef context::VectorXs VectorXs;
101  enum
102  {
104  };
105 
106  bp::def(
107  "reachableWorkspace", &reachableWorkspace_,
108  bp::args("model", "q0", "time_horizon", "frame_id", "n_samples", "facet_dims"),
109  "Computes the reachable workspace on a fixed time horizon. For more information, "
110  "please see https://gitlab.inria.fr/auctus-team/people/antunskuric/pycapacity\n\n"
111  "Parameters:\n"
112  "\tmodel: model of the kinematic tree\n"
113  "\ttime_horizon: time horizon for which the polytope will be computed\n"
114  "\tframe_id: frame for which the polytope should be computed\n\n"
115  "Returns:\n \tvertex");
116  bp::def(
117  "reachableWorkspaceHull", &reachableWorkspaceHull_,
118  bp::args("model", "q0", "time_horizon", "frame_id", "n_samples", "facet_dims"),
119  "Computes the convex hull of the reachable workspace on a fixed time horizon. For "
120  "more information, please see "
121  "https://gitlab.inria.fr/auctus-team/people/antunskuric/pycapacity\n\n"
122  "Parameters:\n"
123  "\tmodel: model of the kinematic tree\n"
124  "\ttime_horizon: time horizon for which the polytope will be computed\n"
125  "\tframe_id: frame for which the polytope should be computed\n\n"
126  "Returns:\n \t(vertex, faces)");
127 
128  #ifdef PINOCCHIO_WITH_HPP_FCL
129  bp::def(
130  "reachableWorkspaceWithCollisions", &reachableWorkspaceWithCollisions_,
131  bp::args(
132  "model", "geom_model", "q0", "time_horizon", "frame_id", "n_samples", "facet_dims"),
133  "Computes the reachable workspace taking geometry model into account on a fixed time "
134  "horizon. For more information, please see "
135  "https://gitlab.inria.fr/auctus-team/people/antunskuric/pycapacity\n\n"
136  "Parameters:\n"
137  "\tmodel: model of the kinematic tree\n"
138  "\tgeom_model: model of the environment to check for collisions\n"
139  "\ttime_horizon: time horizon for which the polytope will be computed\n"
140  "\tframe_id: frame for which the polytope should be computed\n\n"
141  "Returns:\n \tvertex");
142 
143  bp::def(
144  "reachableWorkspaceWithCollisionsHull", &reachableWorkspaceWithCollisionsHull_,
145  bp::args(
146  "model", "geom_model", "q0", "time_horizon", "frame_id", "n_samples", "facet_dims"),
147  "Computes the convex hull of the reachable workspace taking geometry model into "
148  "account on a fixed time horizon. For more information, please see "
149  "https://gitlab.inria.fr/auctus-team/people/antunskuric/pycapacity\n\n"
150  "Parameters:\n"
151  "\tmodel: model of the kinematic tree\n"
152  "\tgeom_model: model of the environment to check for collisions\n"
153  "\ttime_horizon: time horizon for which the polytope will be computed\n"
154  "\tframe_id: frame for which the polytope should be computed\n\n"
155  "Returns:\n \t(vertex, faces)");
156  #endif // PINOCCHIO_WITH_HPP_FCL
157 #endif // PINOCCHIO_PYTHON_SKIP_REACHABLE_WORKSPACE
158  }
159 
160  } // namespace python
161 } // namespace pinocchio
pinocchio::DataTpl::MatrixXs
Eigen::Matrix< Scalar, Eigen::Dynamic, Eigen::Dynamic, Options > MatrixXs
Definition: multibody/data.hpp:74
boost::python
Eigen
pinocchio::python::reachableWorkspaceHull_
bp::tuple reachableWorkspaceHull_(const context::Model &model, const context::VectorXs &q0, const double time_horizon, const int frame_id, const int n_samples=5, const int facet_dims=3)
Definition: expose-reachable-workspace.cpp:18
reachable-workspace.hpp
pinocchio::python::reachableWorkspace_
static context::Data::MatrixXs reachableWorkspace_(const context::Model &model, const context::VectorXs &q0, const double time_horizon, const int frame_id, const int n_samples=5, const int facet_dims=3)
Definition: expose-reachable-workspace.cpp:35
pinocchio::python::Scalar
context::Scalar Scalar
Definition: admm-solver.cpp:29
reachable-workspace-with-collisions.n_samples
int n_samples
Definition: reachable-workspace-with-collisions.py:90
pinocchio::ReachableSetResults
Structure containing the return value for the reachable algorithm.
Definition: reachable-workspace.hpp:25
pinocchio::python::context::Model
ModelTpl< Scalar, Options > Model
Definition: bindings/python/context/generic.hpp:63
pinocchio::python::VectorXs
context::VectorXs VectorXs
Definition: admm-solver.cpp:30
pinocchio::reachableWorkspaceHull
void reachableWorkspaceHull(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, const Eigen::MatrixBase< ConfigVectorType > &q0, const double time_horizon, const int frame_id, ReachableSetResults &res, const ReachableSetParams &params=ReachableSetParams())
Computes the convex Hull reachable workspace on a fixed time horizon. For more information,...
pinocchio::python::Options
@ Options
Definition: expose-contact-inverse-dynamics.cpp:22
pinocchio::ReachableSetParams
Parameters for the reachable space algorithm.
Definition: reachable-workspace.hpp:39
pinocchio::context::VectorXs
Eigen::Matrix< Scalar, Eigen::Dynamic, 1, Options > VectorXs
Definition: context/generic.hpp:47
reachable-workspace-with-collisions.facet_dims
int facet_dims
Definition: reachable-workspace-with-collisions.py:91
algorithms.hpp
pinocchio::ReachableSetParams::facet_dims
int facet_dims
Definition: reachable-workspace.hpp:42
python
pinocchio::q0
JointCollectionTpl const Eigen::MatrixBase< ConfigVectorIn1 > & q0
Definition: joint-configuration.hpp:1137
pinocchio::ReachableSetParams::n_samples
int n_samples
Definition: reachable-workspace.hpp:41
pinocchio::reachableWorkspace
void reachableWorkspace(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, const Eigen::MatrixBase< ConfigVectorType > &q0, const double time_horizon, const int frame_id, Eigen::MatrixXd &vertex, const ReachableSetParams &params=ReachableSetParams())
Computes the reachable workspace on a fixed time horizon. For more information, please see https://gi...
append-urdf-model-with-another-model.geom_model
geom_model
Definition: append-urdf-model-with-another-model.py:26
pinocchio::python::exposeReachableWorkspace
void exposeReachableWorkspace()
Definition: expose-reachable-workspace.cpp:95
pinocchio::python::context::Options
@ Options
Definition: bindings/python/context/generic.hpp:40
contact-cholesky.frame_id
frame_id
Definition: contact-cholesky.py:19
pinocchio::GeometryModel
Definition: multibody/geometry.hpp:50
pinocchio::ModelTpl
Definition: context/generic.hpp:20
pinocchio::python::res
ReturnType res
Definition: bindings/python/spatial/explog.hpp:68
pinocchio::python::context::Scalar
PINOCCHIO_PYTHON_SCALAR_TYPE Scalar
Definition: bindings/python/context/generic.hpp:37
eigen.hpp
pinocchio::model
JointCollectionTpl & model
Definition: joint-configuration.hpp:1082
pinocchio
Main pinocchio namespace.
Definition: timings.cpp:27
namespace.hpp


pinocchio
Author(s):
autogenerated on Thu Dec 19 2024 03:41:29