pinocchio  2.3.1-dirty
algorithm/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 
59  template<typename Vector3Like>
60  inline void setGeometryMeshScales(GeometryModel & geom_model, const Eigen::MatrixBase<Vector3Like> & meshScale)
61  {
62  EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Vector3Like,3);
63  for(GeomIndex index=0; index<geom_model.ngeoms; index++)
64  geom_model.geometryObjects[index].meshScale = meshScale;
65  }
66 
73  inline void setGeometryMeshScales(GeometryModel & geom_model, const double meshScale)
74  {
75  setGeometryMeshScales(geom_model, Eigen::Vector3d::Constant(meshScale));
76  }
77 
78 #ifdef PINOCCHIO_WITH_HPP_FCL
79 
91  bool computeCollision(const GeometryModel & geom_model,
92  GeometryData & geom_data,
93  const PairIndex & pairId);
94 
115  template<typename Scalar, int Options, template<typename,int> class JointCollectionTpl, typename ConfigVectorType>
118  const GeometryModel & geom_model,
119  GeometryData & geom_data,
120  const Eigen::MatrixBase<ConfigVectorType> & q,
121  const bool stopAtFirstCollision = false);
122 
134  fcl::DistanceResult & computeDistance(const GeometryModel & geom_model,
135  GeometryData & geom_data,
136  const PairIndex & pairId);
137 
153  template<typename Scalar, int Options, template<typename,int> class JointCollectionTpl, typename ConfigVectorType>
154  inline std::size_t computeDistances(const ModelTpl<Scalar,Options,JointCollectionTpl> & model,
156  const GeometryModel & geom_model,
157  GeometryData & geom_data,
158  const Eigen::MatrixBase<ConfigVectorType> & q);
159 
173  template<typename Scalar, int Options, template<typename,int> class JointCollectionTpl>
174  inline std::size_t computeDistances(const ModelTpl<Scalar,Options,JointCollectionTpl> & model,
176  const GeometryModel & geom_model,
177  GeometryData & geom_data);
178 
183  template<typename Scalar, int Options, template<typename,int> class JointCollectionTpl>
185  const GeometryModel & geom_model,
186  GeometryData & geom_data);
187 #endif // PINOCCHIO_WITH_HPP_FCL
188 
206  inline void appendGeometryModel(GeometryModel & geom_model1,
207  const GeometryModel & geom_model2);
208 
209 } // namespace pinocchio
210 
211 /* --- Details -------------------------------------------------------------------- */
212 #include "pinocchio/algorithm/geometry.hxx"
213 
214 #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)
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. ...
void setGeometryMeshScales(GeometryModel &geom_model, const Eigen::MatrixBase< Vector3Like > &meshScale)
Set a mesh scaling vector to each GeometryObject contained in the the GeometryModel.
Index ngeoms
The number of GeometryObjects.
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.
bool computeCollisions(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const GeometryModel &geom_model, GeometryData &geom_data, const Eigen::MatrixBase< ConfigVectorType > &q, const bool stopAtFirstCollision=false)
GeometryObjectVector geometryObjects
Vector of GeometryObjects used for collision computations.