hpp-core: include/hpp/core/configuration-shooter/uniform-tpl.hh Source File

hpp-core 9.0.2 Implement basic classes for canonical path planning for kinematic chains.

Loading...
Searching...
No Matches
uniform-tpl.hh
Go to the documentation of this file.
1// Copyright (c) 2023 Eureka Robotics
2// Authors: Joseph Mirabel
3
4#ifndef HPP_CORE_CONFIGURATION_SHOOTER_UNIFORM_TPL_HH
5#define HPP_CORE_CONFIGURATION_SHOOTER_UNIFORM_TPL_HH
6
7#include <hpp/core/configuration-shooter.hh>
8#include <hpp/pinocchio/device.hh>
9#include <random>
10
11namespace hpp {
12namespace core {
13namespace configurationShooter {
14
17
19template <class generator_t>
20 class HPP_CORE_DLLAPI UniformTpl : public ConfigurationShooter {
21 public:
22 typedef shared_ptr<UniformTpl<generator_t>> Ptr_t;
23 typedef weak_ptr<UniformTpl<generator_t>> WkPtr_t;
24
25 static Ptr_t create(const DevicePtr_t& robot) {
26 UniformTpl* ptr = new UniformTpl(robot);
27 Ptr_t shPtr(ptr);
28 ptr->init(shPtr);
29 return shPtr;
30 }
31
33 void seed(typename generator_t::result_type seed) { generator_.seed(seed); }
34
35 protected:
39 UniformTpl(const DevicePtr_t& robot) : robot_(robot) {}
40 void init(const Ptr_t& self) {
41 ConfigurationShooter::init(self);
42 weak_ = self;
43 }
44
45 virtual void impl_shoot(Configuration_t& q) const;
46
47 private:
48 DevicePtr_t robot_;
49 WkPtr_t weak_;
50
51 // The generator must be mutable because impl_shoot is const and
52 // generator_t::operator() is not.
53 mutable generator_t generator_;
54}; // class UniformTpl
56
57 typedef UniformTpl<std::default_random_engine> UniformSeedable;
58
59} // namespace configurationShooter
60} // namespace core
61} // namespace hpp
62
63#endif // HPP_CORE_CONFIGURATION_SHOOTER_UNIFORM_TPL_HH
hpp::core::ConfigurationShooter
Definition configuration-shooter.hh:45
hpp::core::configurationShooter::UniformTpl
Uniformly sample with bounds of degrees of freedom using a custom generator.
Definition uniform-tpl.hh:20
hpp::core::configurationShooter::UniformTpl::init
void init(const Ptr_t &self)
Definition uniform-tpl.hh:40
hpp::core::configurationShooter::UniformTpl::WkPtr_t
weak_ptr< UniformTpl< generator_t > > WkPtr_t
Definition uniform-tpl.hh:23
hpp::core::configurationShooter::UniformTpl::UniformTpl
UniformTpl(const DevicePtr_t &robot)
Definition uniform-tpl.hh:39
hpp::core::configurationShooter::UniformTpl::seed
void seed(typename generator_t::result_type seed)
Set the generator seed.
Definition uniform-tpl.hh:33
hpp::core::configurationShooter::UniformTpl::Ptr_t
shared_ptr< UniformTpl< generator_t > > Ptr_t
Definition uniform-tpl.hh:22
hpp::core::configurationShooter::UniformTpl::create
static Ptr_t create(const DevicePtr_t &robot)
Definition uniform-tpl.hh:25
HPP_CORE_DLLAPI
#define HPP_CORE_DLLAPI
Definition config.hh:88
configuration-shooter.hh
device.hh
hpp
hpp::core::configurationShooter::UniformSeedable
UniformTpl< std::default_random_engine > UniformSeedable
Definition uniform-tpl.hh:57
hpp::core::Configuration_t
pinocchio::Configuration_t Configuration_t
Definition fwd.hh:107
hpp::core::DevicePtr_t
pinocchio::DevicePtr_t DevicePtr_t
Definition fwd.hh:134