hpp-core  4.12.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 
34  public:
36  (const ProblemConstPtr_t& problem);
37  static WeighedDistancePtr_t create (const DevicePtr_t& robot);
39  createWithWeight (const DevicePtr_t& robot, const vector_t& weights);
41  (const WeighedDistancePtr_t& distance);
42  virtual DistancePtr_t clone () 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:
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);
72  ConfigurationIn_t q2) const;
75  private:
76  void computeWeights ();
77  DevicePtr_t robot_;
78  vector_t weights_;
79  WeighedDistanceWkPtr_t weak_;
80 
81  HPP_SERIALIZABLE();
82  }; // class WeighedDistance
84  } // namespace core
85 } // namespace hpp
86 #endif // HPP_CORE_WEIGHED_DISTANCE_HH
Abstract class for distance between configurations.
Definition: distance.hh:35
Definition: weighed-distance.hh:33
static WeighedDistancePtr_t createCopy(const WeighedDistancePtr_t &distance)
const DevicePtr_t & robot() const
Get robot.
Definition: weighed-distance.hh:60
static WeighedDistancePtr_t createFromProblem(const ProblemConstPtr_t &problem)
const vector_t & weights() const
Get weights.
virtual value_type impl_distance(ConfigurationIn_t q1, ConfigurationIn_t q2) const
Derived class should implement this function.
value_type getWeight(size_type rank) const
WeighedDistance(const WeighedDistance &distance)
WeighedDistance(const DevicePtr_t &robot)
static WeighedDistancePtr_t createWithWeight(const DevicePtr_t &robot, const vector_t &weights)
virtual DistancePtr_t clone() const
WeighedDistance(const DevicePtr_t &robot, const vector_t &weights)
static WeighedDistancePtr_t create(const DevicePtr_t &robot)
void setWeight(size_type rank, value_type weight)
WeighedDistance(const ProblemConstPtr_t &problem)
void weights(const vector_t &ws)
Set weights.
size_type size() const
Get size of weight vector.
Definition: weighed-distance.hh:54
void init(WeighedDistanceWkPtr_t self)
WeighedDistance()
For serialization only.
Definition: weighed-distance.hh:74
#define HPP_CORE_DLLAPI
Definition: config.hh:64
pinocchio::value_type value_type
Definition: fwd.hh:157
shared_ptr< Distance > DistancePtr_t
Definition: fwd.hh:122
shared_ptr< WeighedDistance > WeighedDistancePtr_t
Definition: fwd.hh:208
pinocchio::vector_t vector_t
Definition: fwd.hh:202
pinocchio::ConfigurationIn_t ConfigurationIn_t
Definition: fwd.hh:97
pinocchio::size_type size_type
Definition: fwd.hh:156
shared_ptr< const Problem > ProblemConstPtr_t
Definition: fwd.hh:180
pinocchio::DevicePtr_t DevicePtr_t
Definition: fwd.hh:114
Definition: bi-rrt-planner.hh:24