Aikido
GeometricStateSpace.hpp
Go to the documentation of this file.
1 #ifndef AIKIDO_OMPL_AIKIDOGEOMETRICSTATESPACE_HPP_
2 #define AIKIDO_OMPL_AIKIDOGEOMETRICSTATESPACE_HPP_
3 
4 #include <ompl/base/StateSpace.h>
5 
13 
14 namespace aikido {
15 namespace planner {
16 namespace ompl {
17 
19 
20 constexpr double EQUALITY_EPSILON = 1e-7;
22 
24 class GeometricStateSpace : public ::ompl::base::StateSpace
25 {
26 public:
28  class StateType : public ::ompl::base::State
29  {
30  public:
34 
37 
43  bool mValid;
44  };
45 
66  constraint::ConstTestablePtr boundsConstraint,
67  constraint::ProjectablePtr boundsProjection,
68  double maxDistanceBetweenValidityChecks);
69 
71  unsigned int getDimension() const override;
72 
75  double getMaximumExtent() const override;
76 
77 #if OMPL_VERSION_AT_LEAST(1, 0, 0)
78  double getMeasure() const override;
80 #else
81  double getMeasure() const;
82 #endif
83 
87  void enforceBounds(::ompl::base::State* state) const override;
88 
91  bool satisfiesBounds(const ::ompl::base::State* state) const override;
92 
96  void copyState(
97  ::ompl::base::State* destination,
98  const ::ompl::base::State* source) const override;
99 
103  double distance(
104  const ::ompl::base::State* state1,
105  const ::ompl::base::State* state2) const override;
106 
111  bool equalStates(
112  const ::ompl::base::State* state1,
113  const ::ompl::base::State* state2) const override;
114 
121  void interpolate(
122  const ::ompl::base::State* from,
123  const ::ompl::base::State* to,
124  double t,
125  ::ompl::base::State* state) const override;
126 
128  ::ompl::base::StateSamplerPtr allocDefaultStateSampler() const override;
129 
131  ::ompl::base::State* allocState() const override;
132 
135  ::ompl::base::State* allocState(
136  const statespace::StateSpace::State* state) const;
137 
141  void freeState(::ompl::base::State* state) const override;
142 
145 
148 
152 
155 
156 private:
159 
162 
165 
168 
171 
174 
177 };
178 
179 } // namespace ompl
180 } // namespace planner
181 } // namespace aikido
182 
183 #endif
aikido::planner::ompl::GeometricStateSpace::StateType
Wraps an aikido::statespace::StateSpace::State in an OMPL StateType.
Definition: GeometricStateSpace.hpp:28
aikido::planner::ompl::GeometricStateSpace::mDistance
distance::DistanceMetricPtr mDistance
Distance metric to compute distance between states in the statespace.
Definition: GeometricStateSpace.hpp:164
aikido::planner::ompl::GeometricStateSpace::StateType::StateType
StateType(statespace::StateSpace::State *state)
Constructor.
aikido::planner::ompl::GeometricStateSpace::getInterpolator
aikido::statespace::ConstInterpolatorPtr getInterpolator() const
Return the interpolator used to interpolate between states in the space.
aikido::planner::ompl::GeometricStateSpace::mStateSpace
statespace::ConstStateSpacePtr mStateSpace
The AIKIDO statespace to be exposed to OMPL.
Definition: GeometricStateSpace.hpp:158
aikido
Format of serialized trajectory in YAML.
Definition: algorithm.hpp:4
aikido::constraint::ProjectablePtr
std::shared_ptr< Projectable > ProjectablePtr
Definition: Projectable.hpp:33
aikido::planner::ompl::GeometricStateSpace::getMaximumExtent
double getMaximumExtent() const override
Get the maximum value a call to distance() can return (or an upper bound).
aikido::planner::ompl::GeometricStateSpace::distance
double distance(const ::ompl::base::State *state1, const ::ompl::base::State *state2) const override
Computes distance between two states using the dmetric.
aikido::distance::DistanceMetricPtr
std::shared_ptr< DistanceMetric > DistanceMetricPtr
Definition: DistanceMetric.hpp:10
aikido::planner::ompl::GeometricStateSpace::equalStates
bool equalStates(const ::ompl::base::State *state1, const ::ompl::base::State *state2) const override
Check state equality.
aikido::planner::ompl::GeometricStateSpace::copyState
void copyState(::ompl::base::State *destination, const ::ompl::base::State *source) const override
Copy the value of one state to another.
StateSpace.hpp
aikido::statespace::ConstStateSpacePtr
std::shared_ptr< const StateSpace > ConstStateSpacePtr
Definition: StateSpace.hpp:15
aikido::planner::ompl::GeometricStateSpace::interpolate
void interpolate(const ::ompl::base::State *from, const ::ompl::base::State *to, double t, ::ompl::base::State *state) const override
Computes the state that lies at time t in [0, 1] on the segment that connects from state to to state.
aikido::planner::ompl::GeometricStateSpace::GeometricStateSpace
GeometricStateSpace(statespace::ConstStateSpacePtr sspace, statespace::ConstInterpolatorPtr interpolator, distance::DistanceMetricPtr dmetric, constraint::SampleablePtr sampler, constraint::ConstTestablePtr boundsConstraint, constraint::ProjectablePtr boundsProjection, double maxDistanceBetweenValidityChecks)
Construct a state space.
aikido::constraint::SampleablePtr
std::shared_ptr< Sampleable > SampleablePtr
Definition: Sampleable.hpp:16
aikido::planner::ompl::GeometricStateSpace::mInterpolator
statespace::ConstInterpolatorPtr mInterpolator
An aikido interpolator to interpolate between states of the statespace.
Definition: GeometricStateSpace.hpp:161
aikido::statespace::ConstInterpolatorPtr
std::shared_ptr< const Interpolator > ConstInterpolatorPtr
Definition: Interpolator.hpp:12
aikido::planner::ompl::GeometricStateSpace::getBoundsConstraint
aikido::constraint::ConstTestablePtr getBoundsConstraint() const
Return the bounds constraint for the statespace.
aikido::planner::ompl::GeometricStateSpace::getMaxDistanceBetweenValidityChecks
double getMaxDistanceBetweenValidityChecks() const
Returns the collision checking resolution.
aikido::planner::ompl::GeometricStateSpace::satisfiesBounds
bool satisfiesBounds(const ::ompl::base::State *state) const override
Check if a state satisfies the boundsConstraint.
aikido::planner::ompl::GeometricStateSpace::mBoundsProjection
constraint::ProjectablePtr mBoundsProjection
A Projectable that projects a state within valid bounds of statespace.
Definition: GeometricStateSpace.hpp:173
Sampleable.hpp
Projectable.hpp
aikido::planner::ompl::EQUALITY_EPSILON
constexpr double EQUALITY_EPSILON
The maximum distance between two states for them to be considered equal.
Definition: GeometricStateSpace.hpp:21
aikido::planner::ompl::GeometricStateSpace::mSampler
constraint::SampleablePtr mSampler
State sampler used to sample states in the statespace.
Definition: GeometricStateSpace.hpp:167
aikido::planner::ompl::GeometricStateSpace::getAikidoStateSpace
statespace::ConstStateSpacePtr getAikidoStateSpace() const
Return the Aikido StateSpace that this OMPL StateSpace wraps.
aikido::planner::ompl::GeometricStateSpace::StateType::mState
statespace::StateSpace::State * mState
The wrapped aikido state.
Definition: GeometricStateSpace.hpp:36
aikido::planner::ompl::GeometricStateSpace
Wraps an aikido StateSpace into a space recognized by OMPL.
Definition: GeometricStateSpace.hpp:24
Testable.hpp
DistanceMetric.hpp
BackwardCompatibility.hpp
aikido::planner::ompl::GeometricStateSpace::mMaxDistanceBetweenValidityChecks
double mMaxDistanceBetweenValidityChecks
Collision checking resolution.
Definition: GeometricStateSpace.hpp:176
aikido::planner::ompl::GeometricStateSpace::getDimension
unsigned int getDimension() const override
Get the dimension of the space.
aikido::statespace::StateSpace::State
Definition: StateSpace.hpp:167
aikido::planner::ompl::GeometricStateSpace::allocDefaultStateSampler
::ompl::base::StateSamplerPtr allocDefaultStateSampler() const override
Allocate an instance of the state sampler for this space.
aikido::planner::ompl::GeometricStateSpace::StateType::mValid
bool mValid
Indicates whether the state has been initialized to represent a valid state.
Definition: GeometricStateSpace.hpp:43
aikido::planner::ompl::GeometricStateSpace::getMeasure
double getMeasure() const
aikido::planner::ompl::GeometricStateSpace::freeState
void freeState(::ompl::base::State *state) const override
Free the memory of the allocated state.
aikido::planner::ompl::GeometricStateSpace::mBoundsConstraint
constraint::ConstTestablePtr mBoundsConstraint
Constraint to determine if a state is within statespace bounds.
Definition: GeometricStateSpace.hpp:170
aikido::planner::ompl::GeometricStateSpace::allocState
::ompl::base::State * allocState() const override
Allocate a state that can store a point in the described space.
AIKIDO_DECLARE_POINTERS
#define AIKIDO_DECLARE_POINTERS(X)
Definition: pointers.hpp:21
GeodesicInterpolator.hpp
aikido::constraint::ConstTestablePtr
std::shared_ptr< const Testable > ConstTestablePtr
Definition: Testable.hpp:13
aikido::planner::ompl::GeometricStateSpace::enforceBounds
void enforceBounds(::ompl::base::State *state) const override
Bring the state within the bounds of the statespace using boundsProjection.