hpp-core  4.9.0
Implement basic classes for canonical path planning for kinematic chains.
joint-bound-validation.hh
Go to the documentation of this file.
1 //
2 // Copyright (c) 2014 CNRS
3 // Authors: Florent Lamiraux
4 //
5 // This file is part of hpp-core
6 // hpp-core 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_CORE_JOINT_BOUND_VALIDATION_HH
20 # define HPP_CORE_JOINT_BOUND_VALIDATION_HH
21 
22 # include <hpp/pinocchio/joint.hh>
24 
25 namespace hpp {
26  namespace core {
29 
31  class HPP_CORE_DLLAPI JointBoundValidationReport : public ValidationReport
32  {
33  public:
35  value_type lowerBound, value_type upperBound,
36  value_type value) :
38  joint_ (joint), rank_ (rank), lowerBound_ (lowerBound),
39  upperBound_ (upperBound), value_ (value)
40  {
41  }
43  virtual std::ostream& print (std::ostream& os) const
44  {
45  if (joint_) {
46  os << "Joint " << joint_->name () << ", rank: " << rank_
47  << ", value out of range: " << value_ << " not in ["
48  << lowerBound_ << ", " << upperBound_ << "]";
49  } else {
50  os << "Extra config space at rank: " << rank_
51  << ", value out of range: " << value_ << " not in ["
52  << lowerBound_ << ", " << upperBound_ << "]";
53  }
54  return os;
55  }
56 
67  };
68 
71  class HPP_CORE_DLLAPI JointBoundValidation : public ConfigValidation
72  {
73  public:
74  static JointBoundValidationPtr_t create (const DevicePtr_t& robot);
75 
83  bool validate (const Configuration_t& config,
84  ValidationReportPtr_t& validationReport);
85  protected:
86  JointBoundValidation (const DevicePtr_t& robot);
87  private:
88  DevicePtr_t robot_;
89  }; // class ConfigValidation
91  } // namespace core
92 } // namespace hpp
93 
94 #endif // HPP_CORE_JOINT_BOUND_VALIDATION_HH
virtual std::ostream & print(std::ostream &os) const
Print report in a stream.
Definition: joint-bound-validation.hh:43
Definition: validation-report.hh:36
boost::shared_ptr< ValidationReport > ValidationReportPtr_t
Definition: fwd.hh:206
pinocchio::DevicePtr_t DevicePtr_t
Definition: fwd.hh:114
ObjectFactory * create(ObjectFactory *parent=NULL, const XMLElement *element=NULL)
pinocchio::size_type size_type
Definition: fwd.hh:156
pinocchio::JointConstPtr_t JointConstPtr_t
Definition: fwd.hh:132
size_type rank_
degree of freedom in the joint (usually 0)
Definition: joint-bound-validation.hh:60
value_type upperBound_
upper bound
Definition: joint-bound-validation.hh:64
Definition: joint-bound-validation.hh:71
pinocchio::value_type value_type
Definition: fwd.hh:157
boost::shared_ptr< JointBoundValidation > JointBoundValidationPtr_t
Definition: fwd.hh:135
report returned when a configuration is not within the bounds
Definition: joint-bound-validation.hh:31
JointBoundValidationReport(const JointConstPtr_t &joint, size_type rank, value_type lowerBound, value_type upperBound, value_type value)
Definition: joint-bound-validation.hh:34
value_type value_
configuration value
Definition: joint-bound-validation.hh:66
Definition: config-validation.hh:35
value_type lowerBound_
lower bound
Definition: joint-bound-validation.hh:62
JointConstPtr_t joint_
Joint the configuration value is out of bounds.
Definition: joint-bound-validation.hh:58
pinocchio::Configuration_t Configuration_t
Definition: fwd.hh:96