Loading...
Searching...
No Matches
VampStateSpace.h
1#pragma once
2
3#include <ompl/base/spaces/RealVectorStateSpace.h>
4
5namespace ompl::vamp
6{
7 namespace ob = ompl::base;
8
10 template <typename Robot>
11 inline auto getRobotBounds() -> ob::RealVectorBounds
12 {
13 using Configuration = typename Robot::Configuration;
14
15 std::array<float, Robot::dimension> zeros{};
16 std::array<float, Robot::dimension> ones{};
17 std::fill(ones.begin(), ones.end(), 1.0f);
18
19 auto zero_v = Configuration(zeros);
20 auto one_v = Configuration(ones);
21
22 Robot::scale_configuration(zero_v);
23 Robot::scale_configuration(one_v);
24
25 auto zero_arr = zero_v.to_array();
26 auto one_arr = one_v.to_array();
27
28 ob::RealVectorBounds bounds(Robot::dimension);
29 for (auto i = 0U; i < Robot::dimension; ++i)
30 {
31 bounds.setLow(i, zero_arr[i]);
32 bounds.setHigh(i, one_arr[i]);
33 }
34
35 return bounds;
36 }
37
38 //==========================================================================
39 // VAMP State Space for OMPL
40 //==========================================================================
41
42 template <typename Robot>
43 class VampStateSpace : public ob::RealVectorStateSpace
44 {
45 public:
46 VampStateSpace() : ob::RealVectorStateSpace(Robot::dimension)
47 {
48 this->setBounds(getRobotBounds<Robot>());
49 }
50 };
51
52} // namespace ompl::vamp
The lower and upper bounds for an Rn space.
A state space representing Rn. The distance function is the L2 norm.
void setBounds(const RealVectorBounds &bounds)
Set the bounds of this state space. This defines the range of the space in which sampling is performe...
This namespace contains sampling based planning routines shared by both planning under geometric cons...