hpp-core: include/hpp/core/collision-validation-report.hh Source File

hpp-core 9.0.2 Implement basic classes for canonical path planning for kinematic chains.

Loading...
Searching...
No Matches
collision-validation-report.hh
Go to the documentation of this file.
1//
2// Copyright (c) 2014 CNRS
3// Authors: Florent Lamiraux
4//
5
6// Redistribution and use in source and binary forms, with or without
7// modification, are permitted provided that the following conditions are
8// met:
9//
10// 1. Redistributions of source code must retain the above copyright
11// notice, this list of conditions and the following disclaimer.
12//
13// 2. Redistributions in binary form must reproduce the above copyright
14// notice, this list of conditions and the following disclaimer in the
15// documentation and/or other materials provided with the distribution.
16//
17// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
28// DAMAGE.
29
30#ifndef HPP_CORE_COLLISION_VALIDATION_REPORT_HH
31#define HPP_CORE_COLLISION_VALIDATION_REPORT_HH
32
33#include <coal/collision_data.h>
34
35#include <hpp/core/collision-pair.hh>
36#include <hpp/core/validation-report.hh>
37#include <hpp/pinocchio/collision-object.hh>
38#include <hpp/util/indent.hh>
39
40namespace hpp {
41namespace core {
44
47 struct HPP_CORE_DLLAPI CollisionValidationReport : public ValidationReport {
48 CollisionValidationReport() {}
49
50 CollisionValidationReport(CollisionObjectConstPtr_t o1,
51 CollisionObjectConstPtr_t o2,
52 const coal::CollisionResult& r)
53 : object1(o1), object2(o2), result(r) {}
54
55 CollisionValidationReport(const CollisionPair_t& pair,
56 const coal::CollisionResult& r)
57 : object1(pair.first), object2(pair.second), result(r) {}
58
60 CollisionObjectConstPtr_t object1;
61 std::string objectName1;
63 CollisionObjectConstPtr_t object2;
64 std::string objectName2;
66 coal::CollisionResult result;
68 virtual std::ostream& print(std::ostream& os) const {
69 os << "Collision between object "
70 << (object1 ? object1->name() : objectName1) << " and "
71 << (object2 ? object2->name() : objectName2);
72 return os;
73 }
74 std::pair<std::string, std::string> getObjectNames() const {
75 return std::pair<std::string, std::string>(
76 object1 ? object1->name() : objectName1,
77 object2 ? object2->name() : objectName2);
78 }
79}; // class CollisionValidationReport
80
83 struct HPP_CORE_DLLAPI AllCollisionsValidationReport
84 : public CollisionValidationReport {
85 AllCollisionsValidationReport() {}
86
87 AllCollisionsValidationReport(CollisionObjectConstPtr_t o1,
88 CollisionObjectConstPtr_t o2,
89 const coal::CollisionResult& r)
90 : CollisionValidationReport(o1, o2, r) {}
91
92 AllCollisionsValidationReport(const CollisionPair_t& pair,
93 const coal::CollisionResult& r)
94 : CollisionValidationReport(pair, r) {}
95
96 std::vector<CollisionValidationReportPtr_t> collisionReports;
97 virtual std::ostream& print(std::ostream& os) const {
98 os << " Number of collisions : " << collisionReports.size() << "."
99 << incendl;
100 for (std::vector<CollisionValidationReportPtr_t>::const_iterator it =
101 collisionReports.begin();
102 it != collisionReports.end(); ++it) {
103 os << **it << iendl;
104 }
105 return os << decindent;
106 }
107}; // class AllCollisionsValidationReport
109} // namespace core
110} // namespace hpp
111
112#endif // HPP_CORE_COLLISION_VALIDATION_REPORT_HH
hpp::core::ValidationReport
Definition validation-report.hh:47
collision-object.hh
collision-pair.hh
HPP_CORE_DLLAPI
#define HPP_CORE_DLLAPI
Definition config.hh:88
indent.hh
hpp
hpp::core::CollisionObjectConstPtr_t
pinocchio::CollisionObjectConstPtr_t CollisionObjectConstPtr_t
Definition fwd.hh:100
hpp::incendl
HPP_UTIL_DLLAPI std::ostream & incendl(std::ostream &o)
hpp::iendl
HPP_UTIL_DLLAPI std::ostream & iendl(std::ostream &o)
hpp::decindent
HPP_UTIL_DLLAPI std::ostream & decindent(std::ostream &o)
hpp::core::AllCollisionsValidationReport
Definition collision-validation-report.hh:84
hpp::core::AllCollisionsValidationReport::collisionReports
std::vector< CollisionValidationReportPtr_t > collisionReports
Definition collision-validation-report.hh:96
hpp::core::AllCollisionsValidationReport::AllCollisionsValidationReport
AllCollisionsValidationReport(const CollisionPair_t &pair, const coal::CollisionResult &r)
Definition collision-validation-report.hh:92
hpp::core::AllCollisionsValidationReport::AllCollisionsValidationReport
AllCollisionsValidationReport(CollisionObjectConstPtr_t o1, CollisionObjectConstPtr_t o2, const coal::CollisionResult &r)
Definition collision-validation-report.hh:87
hpp::core::AllCollisionsValidationReport::print
virtual std::ostream & print(std::ostream &os) const
Write report in a stream.
Definition collision-validation-report.hh:97
hpp::core::AllCollisionsValidationReport::AllCollisionsValidationReport
AllCollisionsValidationReport()
Definition collision-validation-report.hh:85
hpp::core::CollisionPair
Definition collision-pair.hh:45
hpp::core::CollisionValidationReport
Definition collision-validation-report.hh:47
hpp::core::CollisionValidationReport::objectName2
std::string objectName2
Definition collision-validation-report.hh:64
hpp::core::CollisionValidationReport::CollisionValidationReport
CollisionValidationReport(CollisionObjectConstPtr_t o1, CollisionObjectConstPtr_t o2, const coal::CollisionResult &r)
Definition collision-validation-report.hh:50
hpp::core::CollisionValidationReport::getObjectNames
std::pair< std::string, std::string > getObjectNames() const
Definition collision-validation-report.hh:74
hpp::core::CollisionValidationReport::object1
CollisionObjectConstPtr_t object1
First object in collision.
Definition collision-validation-report.hh:60
hpp::core::CollisionValidationReport::CollisionValidationReport
CollisionValidationReport()
Definition collision-validation-report.hh:48
hpp::core::CollisionValidationReport::CollisionValidationReport
CollisionValidationReport(const CollisionPair_t &pair, const coal::CollisionResult &r)
Definition collision-validation-report.hh:55
hpp::core::CollisionValidationReport::objectName1
std::string objectName1
Definition collision-validation-report.hh:61
hpp::core::CollisionValidationReport::object2
CollisionObjectConstPtr_t object2
Second object in collision.
Definition collision-validation-report.hh:63
hpp::core::CollisionValidationReport::print
virtual std::ostream & print(std::ostream &os) const
Write report in a stream.
Definition collision-validation-report.hh:68
hpp::core::CollisionValidationReport::result
coal::CollisionResult result
coal collision results
Definition collision-validation-report.hh:66
validation-report.hh