hpp-core 6.0.0
Implement basic classes for canonical path planning for kinematic chains.
Loading...
Searching...
No Matches
uniform-tpl.hxx
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_HXX
5#define HPP_CORE_CONFIGURATION_SHOOTER_UNIFORM_TPL_HXX
6
8#include <hpp/pinocchio/liegroup-space.hh>
9#include <pinocchio/multibody/model.hpp>
10
11namespace hpp {
12namespace core {
13namespace configurationShooter {
14
15template <class generator_t>
17 typedef std::uniform_real_distribution<value_type> distribution_t;
18
19 if (!robot_->configSpace()->isVectorSpace()) {
20 throw std::invalid_argument(
21 "The device config space must be a vector space"
22 " to use UniformTpl");
23 }
24
25 config.resize(robot_->configSize());
26 auto const& model = robot_->model();
27
28 for (size_type i = 0; i < model.nq; ++i) {
29 distribution_t distrib(model.lowerPositionLimit[i],
30 model.upperPositionLimit[i]);
31 config[i] = distrib(generator_);
32 }
33 auto const& ecs = robot_->extraConfigSpace();
34 for (size_type i = 0; i < ecs.dimension(); ++i) {
35 distribution_t distrib(ecs.lower(i), ecs.upper(i));
36 config[model.nq + i] = distrib(generator_);
37 }
38}
39
40} // namespace configurationShooter
41} // namespace core
42} // namespace hpp
43
44#endif // HPP_CORE_CONFIGURATION_SHOOTER_UNIFORM_TPL_HXX
virtual void impl_shoot(Configuration_t &q) const
Definition uniform-tpl.hxx:16
pinocchio::size_type size_type
Definition fwd.hh:173
pinocchio::Configuration_t Configuration_t
Definition fwd.hh:107
Definition bi-rrt-planner.hh:35