1 |
|
|
// |
2 |
|
|
// Copyright (c) 2014 CNRS |
3 |
|
|
// Authors: Steve Tonneau |
4 |
|
|
// |
5 |
|
|
// This file is part of hpp-rbprm |
6 |
|
|
// hpp-rbprm 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-core 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-core If not, see |
17 |
|
|
// <http://www.gnu.org/licenses/>. |
18 |
|
|
|
19 |
|
|
#ifndef HPP_RBPRM_ROM_VALIDATION_HH |
20 |
|
|
#define HPP_RBPRM_ROM_VALIDATION_HH |
21 |
|
|
|
22 |
|
|
#include <hpp/core/collision-validation.hh> |
23 |
|
|
#include <hpp/rbprm/config.hh> |
24 |
|
|
#include <hpp/rbprm/rbprm-device.hh> |
25 |
|
|
|
26 |
|
|
namespace hpp { |
27 |
|
|
namespace rbprm { |
28 |
|
|
|
29 |
|
|
class RbPrmRomValidation; |
30 |
|
|
typedef shared_ptr<RbPrmRomValidation> RbPrmRomValidationPtr_t; |
31 |
|
|
|
32 |
|
|
/// \addtogroup validation |
33 |
|
|
/// \{ |
34 |
|
|
|
35 |
|
|
/// Validate a Rom configuration with respect to the reachability condition; |
36 |
|
|
/// a Rom Configuration is valid the object linked to it is colliding |
37 |
|
|
/// with the environment. A normal filter can be optionnaly specified |
38 |
|
|
/// to only accept collision with obstacles aligned with special normal |
39 |
|
|
/// surfaces. |
40 |
|
|
/// |
41 |
|
|
class HPP_RBPRM_DLLAPI RbPrmRomValidation : public core::CollisionValidation { |
42 |
|
|
public: |
43 |
|
|
static RbPrmRomValidationPtr_t create( |
44 |
|
|
const pinocchio::DevicePtr_t& robot, |
45 |
|
|
const std::vector<std::string>& affFilters = std::vector<std::string>()); |
46 |
|
|
|
47 |
|
|
/// Compute whether the configuration is valid |
48 |
|
|
/// |
49 |
|
|
/// \param config the config to check for validity |
50 |
|
|
/// \return whether the whole config is valid. |
51 |
|
|
virtual bool validate(const core::Configuration_t& config); |
52 |
|
|
|
53 |
|
|
/// Compute whether the configuration is valid |
54 |
|
|
/// |
55 |
|
|
/// \param config the config to check for validity, |
56 |
|
|
/// \retval validationReport report on validation (used only for rom shape). |
57 |
|
|
/// This parameter will |
58 |
|
|
/// dynamically cast into CollisionValidationReport type, |
59 |
|
|
/// \return whether the whole config is valid. |
60 |
|
|
virtual bool validate(const core::Configuration_t& config, |
61 |
|
|
core::ValidationReportPtr_t& validationReport); |
62 |
|
|
|
63 |
|
|
/// Rearrange the collisions pairs of all configValidation in a random manner |
64 |
|
|
/// \brief randomnizeCollisionPairs |
65 |
|
|
/// |
66 |
|
|
virtual void randomnizeCollisionPairs(); |
67 |
|
|
|
68 |
|
|
public: |
69 |
|
|
const std::vector<std::string> filter_; |
70 |
|
|
|
71 |
|
|
void setOptional(bool optional) { optional_ = optional; } |
72 |
|
|
|
73 |
|
|
protected: |
74 |
|
|
RbPrmRomValidation(const pinocchio::DevicePtr_t& robot, |
75 |
|
|
const std::vector<std::string>& affFilters); |
76 |
|
|
|
77 |
|
|
private: |
78 |
|
|
core::ValidationReportPtr_t unusedReport_; |
79 |
|
|
bool optional_; |
80 |
|
|
|
81 |
|
|
}; // class RbPrmValidation |
82 |
|
|
/// \} |
83 |
|
|
} // namespace rbprm |
84 |
|
|
} // namespace hpp |
85 |
|
|
|
86 |
|
|
#endif // HPP_RBPRM_ROM_VALIDATION_HH |