pinocchio  2.4.4
A fast and flexible implementation of Rigid Body Dynamics algorithms and their analytical derivatives
geometry.hpp
1 //
2 // Copyright (c) 2015-2020 CNRS INRIA
3 //
4 
5 #ifndef __pinocchio_algo_geometry_hpp__
6 #define __pinocchio_algo_geometry_hpp__
7 
8 #include "pinocchio/multibody/visitor.hpp"
9 #include "pinocchio/multibody/model.hpp"
10 #include "pinocchio/multibody/data.hpp"
11 
12 #include "pinocchio/algorithm/kinematics.hpp"
13 #include "pinocchio/multibody/geometry.hpp"
14 
15 namespace pinocchio
16 {
17 
30  template<typename Scalar, int Options, template<typename,int> class JointCollectionTpl, typename ConfigVectorType>
31  inline void updateGeometryPlacements(const ModelTpl<Scalar,Options,JointCollectionTpl> & model,
32  DataTpl<Scalar,Options,JointCollectionTpl> & data,
33  const GeometryModel & geom_model,
34  GeometryData & geom_data,
35  const Eigen::MatrixBase<ConfigVectorType> & q);
36 
47  template<typename Scalar, int Options, template<typename,int> class JointCollectionTpl>
48  inline void updateGeometryPlacements(const ModelTpl<Scalar,Options,JointCollectionTpl> & model,
49  const DataTpl<Scalar,Options,JointCollectionTpl> & data,
50  const GeometryModel & geom_model,
51  GeometryData & geom_data);
52 
61  template<typename Vector3Like>
62  PINOCCHIO_DEPRECATED
63  inline void setGeometryMeshScales(GeometryModel & geom_model, const Eigen::MatrixBase<Vector3Like> & meshScale)
64  {
65  EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Vector3Like,3);
66  for(GeomIndex index=0; index<geom_model.ngeoms; index++)
67  geom_model.geometryObjects[index].meshScale = meshScale;
68  }
69 
78  PINOCCHIO_DEPRECATED
79  inline void setGeometryMeshScales(GeometryModel & geom_model, const double meshScale)
80  {
81  for(GeomIndex index=0; index<geom_model.ngeoms; index++)
82  geom_model.geometryObjects[index].meshScale.setConstant(meshScale);
83  }
84 
85 #ifdef PINOCCHIO_WITH_HPP_FCL
86 
98  bool computeCollision(const GeometryModel & geom_model,
99  GeometryData & geom_data,
100  const PairIndex & pairId);
101 
113  inline bool computeCollisions(const GeometryModel & geom_model,
114  GeometryData & geom_data,
115  const bool stopAtFirstCollision = false);
116 
135  template<typename Scalar, int Options, template<typename,int> class JointCollectionTpl, typename ConfigVectorType>
138  const GeometryModel & geom_model,
139  GeometryData & geom_data,
140  const Eigen::MatrixBase<ConfigVectorType> & q,
141  const bool stopAtFirstCollision = false);
142 
154  fcl::DistanceResult & computeDistance(const GeometryModel & geom_model,
155  GeometryData & geom_data,
156  const PairIndex & pairId);
157 
173  template<typename Scalar, int Options, template<typename,int> class JointCollectionTpl, typename ConfigVectorType>
174  inline std::size_t computeDistances(const ModelTpl<Scalar,Options,JointCollectionTpl> & model,
176  const GeometryModel & geom_model,
177  GeometryData & geom_data,
178  const Eigen::MatrixBase<ConfigVectorType> & q);
179 
193  template<typename Scalar, int Options, template<typename,int> class JointCollectionTpl>
194  inline std::size_t computeDistances(const ModelTpl<Scalar,Options,JointCollectionTpl> & model,
196  const GeometryModel & geom_model,
197  GeometryData & geom_data);
198 
203  template<typename Scalar, int Options, template<typename,int> class JointCollectionTpl>
205  const GeometryModel & geom_model,
206  GeometryData & geom_data);
207 #endif // PINOCCHIO_WITH_HPP_FCL
208 
226  inline void appendGeometryModel(GeometryModel & geom_model1,
227  const GeometryModel & geom_model2);
228 
229 } // namespace pinocchio
230 
231 /* --- Details -------------------------------------------------------------------- */
232 #include "pinocchio/algorithm/geometry.hxx"
233 
234 #endif // ifndef __pinocchio_algo_geometry_hpp__
std::size_t computeDistances(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const GeometryModel &geom_model, GeometryData &geom_data, const Eigen::MatrixBase< ConfigVectorType > &q)
PINOCCHIO_DEPRECATED void setGeometryMeshScales(GeometryModel &geom_model, const Eigen::MatrixBase< Vector3Like > &meshScale)
Set a mesh scaling vector to each GeometryObject contained in the the GeometryModel.
Definition: geometry.hpp:63
void appendGeometryModel(GeometryModel &geom_model1, const GeometryModel &geom_model2)
fcl::DistanceResult & computeDistance(const GeometryModel &geom_model, GeometryData &geom_data, const PairIndex &pairId)
Compute the minimal distance between collision objects of a SINGLE collison pair. ...
Index ngeoms
The number of GeometryObjects.
Definition: geometry.hpp:156
bool computeCollisions(const GeometryModel &geom_model, GeometryData &geom_data, const bool stopAtFirstCollision=false)
Calls computeCollision for every active pairs of GeometryData. This function assumes that updateGeome...
Main pinocchio namespace.
Definition: treeview.dox:24
bool computeCollision(const GeometryModel &geom_model, GeometryData &geom_data, const PairIndex &pairId)
Compute the collision status between a SINGLE collision pair. The result is store in the collisionRes...
void computeBodyRadius(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, const GeometryModel &geom_model, GeometryData &geom_data)
void updateGeometryPlacements(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const GeometryModel &geom_model, GeometryData &geom_data, const Eigen::MatrixBase< ConfigVectorType > &q)
Apply a forward kinematics and update the placement of the geometry objects.
GeometryObjectVector geometryObjects
Vector of GeometryObjects used for collision computations.
Definition: geometry.hpp:159