hpp-core 6.0.0
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
8#include <hpp/pinocchio/device.hh>
9#include <random>
10
11namespace hpp {
12namespace core {
13namespace configurationShooter {
14
17
19template <class generator_t>
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
58
59} // namespace configurationShooter
60} // namespace core
61} // namespace hpp
62
63#endif // HPP_CORE_CONFIGURATION_SHOOTER_UNIFORM_TPL_HH
Definition configuration-shooter.hh:45
Uniformly sample with bounds of degrees of freedom using a custom generator.
Definition uniform-tpl.hh:20
void init(const Ptr_t &self)
Definition uniform-tpl.hh:40
weak_ptr< UniformTpl< generator_t > > WkPtr_t
Definition uniform-tpl.hh:23
UniformTpl(const DevicePtr_t &robot)
Definition uniform-tpl.hh:39
void seed(typename generator_t::result_type seed)
Set the generator seed.
Definition uniform-tpl.hh:33
shared_ptr< UniformTpl< generator_t > > Ptr_t
Definition uniform-tpl.hh:22
static Ptr_t create(const DevicePtr_t &robot)
Definition uniform-tpl.hh:25
#define HPP_CORE_DLLAPI
Definition config.hh:88
UniformTpl< std::default_random_engine > UniformSeedable
Definition uniform-tpl.hh:57
pinocchio::Configuration_t Configuration_t
Definition fwd.hh:107
pinocchio::DevicePtr_t DevicePtr_t
Definition fwd.hh:134
Definition bi-rrt-planner.hh:35