hpp-core  6.0.0
Implement basic classes for canonical path planning for kinematic chains.
gaussian.hh
Go to the documentation of this file.
1 //
2 // Copyright (c) 2018 CNRS
3 // Authors: Joseph Mirabel
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_CONFIGURATION_SHOOTER_GAUSSIAN_HH
31 #define HPP_CORE_CONFIGURATION_SHOOTER_GAUSSIAN_HH
32 
34 #include <hpp/pinocchio/device.hh>
35 #include <sstream>
36 
37 namespace hpp {
38 namespace core {
39 namespace configurationShooter {
42 
46  public:
47  static GaussianPtr_t create(const DevicePtr_t& robot) {
48  Gaussian* ptr = new Gaussian(robot);
49  GaussianPtr_t shPtr(ptr);
50  ptr->init(shPtr);
51  return shPtr;
52  }
53 
54  void center(ConfigurationIn_t c) { center_ = c; }
55  const Configuration_t& center() const { return center_; }
56 
65  void sigma(const value_type& factor);
66 
67  void sigmas(vectorIn_t s) {
68  assert(s.size() == robot_->numberDof());
69  sigmas_ = s;
70  }
71  const vector_t& sigmas() const { return sigmas_; }
72 
73  protected:
77  Gaussian(const DevicePtr_t& robot)
78  : robot_(robot),
79  center_(robot->currentConfiguration()),
80  sigmas_(robot->numberDof()) {
81  sigma(1. / 4.);
82  }
83  void init(const GaussianPtr_t& self) {
85  weak_ = self;
86  }
87 
88  virtual void impl_shoot(Configuration_t& q) const;
89 
90  private:
91  const DevicePtr_t& robot_;
93  Configuration_t center_;
95  vector_t sigmas_;
96 
97  GaussianWkPtr_t weak_;
98 }; // class Gaussian
100 } // namespace configurationShooter
101 } // namespace core
102 } // namespace hpp
103 
104 #endif // HPP_CORE_CONFIGURATION_SHOOTER_GAUSSIAN_HH
Definition: configuration-shooter.hh:45
void center(ConfigurationIn_t c)
Definition: gaussian.hh:54
Gaussian(const DevicePtr_t &robot)
Definition: gaussian.hh:77
static GaussianPtr_t create(const DevicePtr_t &robot)
Definition: gaussian.hh:47
void sigma(const value_type &factor)
virtual void impl_shoot(Configuration_t &q) const
void init(const GaussianPtr_t &self)
Definition: gaussian.hh:83
void sigmas(vectorIn_t s)
Definition: gaussian.hh:67
const Configuration_t & center() const
Definition: gaussian.hh:55
const vector_t & sigmas() const
Definition: gaussian.hh:71
#define HPP_CORE_DLLAPI
Definition: config.hh:88
void init(const ConfigurationShooterWkPtr_t &weak)
Store weak pointer to itself.
Definition: configuration-shooter.hh:67
shared_ptr< Gaussian > GaussianPtr_t
Definition: fwd.hh:357
pinocchio::value_type value_type
Definition: fwd.hh:174
pinocchio::vectorIn_t vectorIn_t
Definition: fwd.hh:221
pinocchio::vector_t vector_t
Definition: fwd.hh:220
pinocchio::ConfigurationIn_t ConfigurationIn_t
Definition: fwd.hh:108
pinocchio::Configuration_t Configuration_t
Definition: fwd.hh:107
pinocchio::DevicePtr_t DevicePtr_t
Definition: fwd.hh:134
Definition: bi-rrt-planner.hh:35