hpp-affordance 4.15.1
Implementation to Extract Whole-Body Affordances for Mutli-Contact Planning.
Loading...
Searching...
No Matches
affordance-extraction.hh
Go to the documentation of this file.
1//
2// Copyright (c) 2016 CNRS
3// Authors: Anna Seppala
4//
5// This file is part of hpp-affordance
6// hpp-affordance is free software: you can redistribute it
7// and/or modify it under the terms of the GNU Lesser General Public
8// License as published by the Free Software Foundation, either version
9// 3 of the License, or (at your option) any later version.
10//
11// hpp-affordance is distributed in the hope that it will be
12// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
13// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14// General Lesser Public License for more details. You should have
15// received a copy of the GNU Lesser General Public License along with
16// hpp-affordance If not, see
17// <http://www.gnu.org/licenses/>.
18
19#ifndef HPP_AFFORDANCE_AFFORDANCE_EXTRACTION_HH
20#define HPP_AFFORDANCE_AFFORDANCE_EXTRACTION_HH
21
23#include <hpp/affordance/fwd.hh>
24
25namespace hpp {
26namespace affordance {
27
31 fcl::Vec3f p1, p2, p3;
32};
34struct Triangle {
37 Triangle(const TrianglePoints& inPoints) : points(inPoints) {
40 }
44 double a, b, c;
45 a = (tri.p1 - tri.p2).norm();
46 b = (tri.p2 - tri.p3).norm();
47 c = (tri.p3 - tri.p1).norm();
48 double s = 0.5 * (a + b + c);
49 area = sqrt(s * (s - a) * (s - b) * (s - c));
50 }
55 normal = (tri.p2 - tri.p1).cross(tri.p3 - tri.p1);
56 normal.normalize();
57 }
61 double area;
63 fcl::Vec3f normal;
64};
65
66// helper function to extract mesh model of an fcl::collisionObstacle
68
71
77 public:
85 Affordance(const std::vector<unsigned int>& idxVec,
87 : indices_(idxVec), colObj_(colObj) {}
90 std::vector<unsigned int> indices_;
94};
100 public:
106 std::vector<std::vector<AffordancePtr_t> > affordances_;
107
108 private:
109 SemanticsData(const SemanticsData&); // Prevent copy-construction
110 SemanticsData& operator=(const SemanticsData&);
111};
112
154void searchLinkedTriangles(std::vector<unsigned int>& listPotential,
155 const OperationBasePtr_t& refOp,
156 const std::vector<Triangle>& allTris,
157 std::vector<unsigned int>& searchableTris,
158 const unsigned int& refTriIdx, double& area);
159
172 const OperationBases_t& opVec);
173
178std::vector<CollisionObjects_t> getAffordanceObjects(
179 const SemanticsDataPtr_t& sData);
180
192std::vector<CollisionObjects_t> getReducedAffordanceObjects(
193 const SemanticsDataPtr_t& sData, std::vector<double> reduceSizes);
194
196} // namespace affordance
197} // namespace hpp
198
199#endif // HPP_AFFORDANCE_AFFORDANCE_EXTRACTION_HH
Definition: affordance-extraction.hh:76
FclConstCollisionObjectPtr_t colObj_
Definition: affordance-extraction.hh:93
std::vector< unsigned int > indices_
Definition: affordance-extraction.hh:90
Affordance()
Definition: affordance-extraction.hh:78
Affordance(const std::vector< unsigned int > &idxVec, FclConstCollisionObjectPtr_t colObj)
Definition: affordance-extraction.hh:85
Definition: affordance-extraction.hh:99
std::vector< std::vector< AffordancePtr_t > > affordances_
Definition: affordance-extraction.hh:106
SemanticsData()
Definition: affordance-extraction.hh:101
void searchLinkedTriangles(std::vector< unsigned int > &listPotential, const OperationBasePtr_t &refOp, const std::vector< Triangle > &allTris, std::vector< unsigned int > &searchableTris, const unsigned int &refTriIdx, double &area)
std::vector< CollisionObjects_t > getAffordanceObjects(const SemanticsDataPtr_t &sData)
SemanticsDataPtr_t affordanceAnalysis(FclConstCollisionObjectPtr_t colObj, const OperationBases_t &opVec)
std::vector< CollisionObjects_t > getReducedAffordanceObjects(const SemanticsDataPtr_t &sData, std::vector< double > reduceSizes)
const fcl::CollisionObject * FclConstCollisionObjectPtr_t
Definition: fwd.hh:54
std::vector< OperationBasePtr_t > OperationBases_t
Definition: fwd.hh:48
fcl::shared_ptr< const BVHModelOB > BVHModelOBConst_Ptr_t
Definition: fwd.hh:41
fcl::shared_ptr< OperationBase > OperationBasePtr_t
Definition: fwd.hh:47
fcl::shared_ptr< SemanticsData > SemanticsDataPtr_t
Definition: fwd.hh:49
BVHModelOBConst_Ptr_t GetModel(FclConstCollisionObjectPtr_t object)
Definition: affordance-extraction.hh:25
Definition: affordance-extraction.hh:30
fcl::Vec3f p1
Definition: affordance-extraction.hh:31
fcl::Vec3f p3
Definition: affordance-extraction.hh:31
fcl::Vec3f p2
Definition: affordance-extraction.hh:31
Helper class to save triangle information.
Definition: affordance-extraction.hh:34
void TriangleNormal(TrianglePoints &tri)
Definition: affordance-extraction.hh:54
double area
The area of a triangle.
Definition: affordance-extraction.hh:61
Triangle()
Definition: affordance-extraction.hh:35
fcl::Vec3f normal
The normal vector of a triangle.
Definition: affordance-extraction.hh:63
Triangle(const TrianglePoints &inPoints)
Constructor that takes in a TrianglePoints object.
Definition: affordance-extraction.hh:37
TrianglePoints points
The global position of a triangles vertices.
Definition: affordance-extraction.hh:59
void TriangleArea(TrianglePoints &tri)
Definition: affordance-extraction.hh:43