-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontrol_sampler.cpp
More file actions
32 lines (24 loc) · 1.01 KB
/
Copy pathcontrol_sampler.cpp
File metadata and controls
32 lines (24 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include "control_sampler.hpp"
using std::cout;
using std::endl;
namespace shared {
UniformControlSampler::UniformControlSampler(const ompl::control::ControlSpace *space):
ompl::control::ControlSampler(space),
space_(space)
{
}
void UniformControlSampler::sample(ompl::control::Control *control) {
std::vector<double> low = space_->as<ompl::control::RealVectorControlSpace>()->getBounds().low;
std::vector<double> high = space_->as<ompl::control::RealVectorControlSpace>()->getBounds().high;
for (size_t i = 0; i < space_->getDimension(); i++) {
control->as<ompl::control::RealVectorControlSpace::ControlType>()->values[i] = rng_.uniformReal(low[i], high[i]);
}
}
void UniformControlSampler::sample(ompl::control::Control *control,
const ompl::base::State *state) {
sample(control);
}
void UniformControlSampler::sampleNext(ompl::control::Control *control, const ompl::control::Control *previous, const ompl::base::State *state) {
sample(control);
}
}