FiberedProjection.cpp
1 /* Author: Andreas Orthey */
2 
3 #include <ompl/multilevel/datastructures/projections/FiberedProjection.h>
4 #include <ompl/base/StateSpace.h>
5 #include <ompl/base/SpaceInformation.h>
6 
7 using namespace ompl::multilevel;
8 
9 FiberedProjection::FiberedProjection(ompl::base::StateSpacePtr bundleSpace, ompl::base::StateSpacePtr baseSpace)
10  : Projection(bundleSpace, baseSpace)
11 {
12 }
13 
14 void FiberedProjection::lift(const ompl::base::State *xBase, ompl::base::State *xBundle) const
15 {
16  fiberSpaceSampler_->sampleUniform(xFiberTmp_);
17  lift(xBase, xFiberTmp_, xBundle);
18 }
19 
20 ompl::base::StateSpacePtr FiberedProjection::getFiberSpace() const
21 {
22  return fiberSpace_;
23 }
24 
25 bool FiberedProjection::isFibered() const
26 {
27  return true;
28 }
29 
31 {
32  if (fiberSpace_)
33  return fiberSpace_->getDimension();
34  else
35  return 0;
36 }
37 
38 std::string FiberedProjection::getFiberTypeAsString() const
39 {
40  if (fiberSpace_)
41  return stateTypeToString(fiberSpace_);
42  else
43  return "None";
44 }
45 
46 void FiberedProjection::makeFiberSpace()
47 {
48  fiberSpace_ = computeFiberSpace();
49 
50  if (fiberSpace_ != nullptr)
51  {
52  siFiberSpace_ = std::make_shared<ompl::base::SpaceInformation>(fiberSpace_);
53  fiberSpaceSampler_ = siFiberSpace_->allocStateSampler();
54  xFiberTmp_ = siFiberSpace_->allocState();
55  }
56 }
57 
58 ompl::base::StateSamplerPtr FiberedProjection::getFiberSamplerPtr() const
59 {
60  return fiberSpaceSampler_;
61 }
Definition of an abstract state.
Definition: State.h:113
This namespace contains datastructures and planners to exploit multilevel abstractions,...
A shared pointer wrapper for ompl::base::StateSpace.
A shared pointer wrapper for ompl::base::StateSampler.
std::string stateTypeToString(base::StateSpacePtr) const
Return string representing type of ompl::base::StateSpace.
Definition: Projection.cpp:103
unsigned int getFiberDimension() const
Dimension of Fiber Space.