hpp-core  4.9.0
Implement basic classes for canonical path planning for kinematic chains.
weighed-distance.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_WEIGHED_DISTANCE_HH
20 # define HPP_CORE_WEIGHED_DISTANCE_HH
21 
22 # include <hpp/core/distance.hh>
23 
24 namespace hpp {
25  namespace core {
28 
33  class HPP_CORE_DLLAPI WeighedDistance : public Distance {
34  public:
35  static WeighedDistancePtr_t createFromProblem
36  (const Problem& problem);
37  static WeighedDistancePtr_t create (const DevicePtr_t& robot);
39  createWithWeight (const DevicePtr_t& robot, const vector_t& weights);
40  static WeighedDistancePtr_t createCopy
42  virtual DistancePtr_t clone () const;
45  value_type getWeight( size_type rank ) const;
48  void setWeight(size_type rank, value_type weight);
50  const vector_t& weights() const;
52  void weights(const vector_t& ws);
54  size_type size () const
55  {
56  return weights_.size ();
57  }
58 
60  const DevicePtr_t& robot () const
61  {
62  return robot_;
63  }
64  protected:
65  WeighedDistance (const Problem& problem);
66  WeighedDistance (const DevicePtr_t& robot);
67  WeighedDistance (const DevicePtr_t& robot, const vector_t& weights);
68  WeighedDistance (const WeighedDistance& distance);
69  void init (WeighedDistanceWkPtr_t self);
71  virtual value_type impl_distance (ConfigurationIn_t q1,
72  ConfigurationIn_t q2) const;
73  private:
74  void computeWeights ();
75  DevicePtr_t robot_;
76  vector_t weights_;
77  WeighedDistanceWkPtr_t weak_;
78  }; // class WeighedDistance
80  } // namespace core
81 } // namespace hpp
82 #endif // HPP_CORE_WEIGHED_DISTANCE_HH
boost::shared_ptr< WeighedDistance > WeighedDistancePtr_t
Definition: fwd.hh:207
pinocchio::DevicePtr_t DevicePtr_t
Definition: fwd.hh:114
pinocchio::ConfigurationIn_t ConfigurationIn_t
Definition: fwd.hh:97
Definition: problem.hh:48
Definition: weighed-distance.hh:33
ObjectFactory * create(ObjectFactory *parent=NULL, const XMLElement *element=NULL)
pinocchio::size_type size_type
Definition: fwd.hh:156
const DevicePtr_t & robot() const
Get robot.
Definition: weighed-distance.hh:60
size_type size() const
Get size of weight vector.
Definition: weighed-distance.hh:54
pinocchio::vector_t vector_t
Definition: fwd.hh:201
pinocchio::value_type value_type
Definition: fwd.hh:157
boost::shared_ptr< Distance > DistancePtr_t
Definition: fwd.hh:122
Abstract class for distance between configurations.
Definition: distance.hh:33
FCL_REAL distance(const KDOP< N > &other, Vec3f *P=NULL, Vec3f *Q=NULL) const