30 #ifndef EXOTICA_OMPL_SOLVER_OMPL_EXO_H_ 31 #define EXOTICA_OMPL_SOLVER_OMPL_EXO_H_ 35 #include <ompl/base/SpaceInformation.h> 36 #include <ompl/base/StateSpace.h> 37 #include <ompl/base/StateValidityChecker.h> 38 #include <ompl/base/spaces/DubinsStateSpace.h> 39 #include <ompl/base/spaces/RealVectorStateSpace.h> 40 #include <ompl/base/spaces/SE2StateSpace.h> 41 #include <ompl/base/spaces/SE3StateSpace.h> 42 #include <ompl/geometric/SimpleSetup.h> 44 #include <exotica_ompl_solver/ompl_solver_initializer.h> 46 #if OMPL_VERSION_VALUE >= 1004000 // Version greater than 1.4.0 48 #else // All other versions 62 virtual void ExoticaToOMPLState(
const Eigen::VectorXd &q, ompl::base::State *state)
const = 0;
63 virtual void OMPLToExoticaState(
const ompl::base::State *state, Eigen::VectorXd &q)
const = 0;
66 virtual void StateDebug(
const Eigen::VectorXd &q)
const = 0;
77 bool isValid(
const ompl::base::State *state)
const override;
79 bool isValid(
const ompl::base::State *state,
double &dist)
const override;
88 class StateType :
public ompl::base::CompoundStateSpace::StateType
95 const ompl::base::RealVectorStateSpace::StateType &
getRNSpace()
const 97 return *as<ompl::base::RealVectorStateSpace::StateType>(0);
102 return *as<ompl::base::RealVectorStateSpace::StateType>(0);
109 void ExoticaToOMPLState(
const Eigen::VectorXd &q, ompl::base::State *state)
const override;
110 void OMPLToExoticaState(
const ompl::base::State *state, Eigen::VectorXd &q)
const override;
111 void StateDebug(
const Eigen::VectorXd &q)
const override;
117 class StateType :
public ompl::base::CompoundStateSpace::StateType
126 return *as<ompl::base::RealVectorStateSpace::StateType>(1);
131 return *as<ompl::base::RealVectorStateSpace::StateType>(1);
136 return *as<ompl::base::SE3StateSpace::StateType>(0);
140 return *as<ompl::base::SE3StateSpace::StateType>(0);
147 void ExoticaToOMPLState(
const Eigen::VectorXd &q, ompl::base::State *state)
const override;
148 void OMPLToExoticaState(
const ompl::base::State *state, Eigen::VectorXd &q)
const override;
149 void StateDebug(
const Eigen::VectorXd &q)
const override;
152 unsigned int dim_ = 6;
158 class StateType :
public ompl::base::CompoundStateSpace::StateType
167 return *as<ompl::base::RealVectorStateSpace::StateType>(1);
172 return *as<ompl::base::RealVectorStateSpace::StateType>(1);
177 return *as<ompl::base::SE2StateSpace::StateType>(0);
181 return *as<ompl::base::SE2StateSpace::StateType>(0);
188 void ExoticaToOMPLState(
const Eigen::VectorXd &q, ompl::base::State *state)
const override;
189 void OMPLToExoticaState(
const ompl::base::State *state, Eigen::VectorXd &q)
const override;
190 void StateDebug(
const Eigen::VectorXd &q)
const override;
193 unsigned int dim_ = 3;
199 class StateType :
public ompl::base::CompoundStateSpace::StateType
208 return *as<ompl::base::RealVectorStateSpace::StateType>(1);
213 return *as<ompl::base::RealVectorStateSpace::StateType>(1);
218 return *as<ompl::base::DubinsStateSpace::StateType>(0);
222 return *as<ompl::base::DubinsStateSpace::StateType>(0);
229 void ExoticaToOMPLState(
const Eigen::VectorXd &q, ompl::base::State *state)
const override;
230 void OMPLToExoticaState(
const ompl::base::State *state, Eigen::VectorXd &q)
const override;
231 void StateDebug(
const Eigen::VectorXd &q)
const override;
234 unsigned int dim_ = 3;
241 const std::vector<int> &vars)
242 : ompl::base::ProjectionEvaluator(space), variables_(vars)
252 return variables_.size();
258 cellSizes_.resize(variables_.size(), 0.1);
264 for (std::size_t i = 0; i < variables_.size(); ++i)
277 const std::vector<int> &vars)
278 : ompl::base::ProjectionEvaluator(space), variables_(vars)
288 return variables_.size();
294 cellSizes_.resize(variables_.size(), 0.1);
300 for (std::size_t i = 0; i < variables_.size(); ++i)
313 const std::vector<int> &vars)
314 : ompl::base::ProjectionEvaluator(space), variables_(vars)
324 return variables_.size();
330 cellSizes_.resize(variables_.size(), 0.1);
336 for (std::size_t i = 0; i < variables_.size(); ++i)
346 #endif // EXOTICA_OMPL_SOLVER_OMPL_EXO_H_
std::vector< int > variables_
ompl::base::SE2StateSpace::StateType & SE2StateSpace()
virtual void OMPLToExoticaState(const ompl::base::State *state, Eigen::VectorXd &q) const =0
const ompl::base::SE3StateSpace::StateType & SE3StateSpace() const
void defaultCellSizes() override
void project(const ompl::base::State *state, OMPLProjection projection) const override
virtual void SetBounds(SamplingProblemPtr &prob)=0
virtual void StateDebug(const Eigen::VectorXd &q) const =0
virtual void ExoticaToOMPLState(const Eigen::VectorXd &q, ompl::base::State *state) const =0
std::vector< int > variables_
const ompl::base::RealVectorStateSpace::StateType & RealVectorStateSpace() const
ompl::base::SE3StateSpace::StateType & SE3StateSpace()
std::vector< int > variables_
const ompl::base::SE2StateSpace::StateType & SE2StateSpace() const
ompl::base::RealVectorStateSpace::StateType & RealVectorStateSpace()
unsigned int getDimension(void) const override
OMPLSE3RNProjection(const ompl::base::StateSpacePtr &space, const std::vector< int > &vars)
void defaultCellSizes() override
ompl::base::RealVectorStateSpace::StateType & getRNSpace()
const ompl::base::DubinsStateSpace::StateType & DubinsStateSpace() const
OMPLStateSpace(OMPLSolverInitializer init)
virtual ompl::base::StateSamplerPtr allocDefaultStateSampler() const =0
const ompl::base::RealVectorStateSpace::StateType & RealVectorStateSpace() const
std::shared_ptr< exotica::SamplingProblem > SamplingProblemPtr
OMPLSE2RNProjection(const ompl::base::StateSpacePtr &space, const std::vector< int > &vars)
const ompl::base::RealVectorStateSpace::StateType & getRNSpace() const
unsigned int getDimension(void) const override
OMPLRNProjection(const ompl::base::StateSpacePtr &space, const std::vector< int > &vars)
void project(const ompl::base::State *state, OMPLProjection projection) const override
ompl::base::SE2StateSpace::StateType & DubinsStateSpace()
const ompl::base::RealVectorStateSpace::StateType & RealVectorStateSpace() const
OMPLSolverInitializer init_
unsigned int getDimension(void) const override
ompl::base::RealVectorStateSpace::StateType & RealVectorStateSpace()
ompl::base::EuclideanProjection & OMPLProjection
void defaultCellSizes() override
ompl::base::RealVectorStateSpace::StateType & RealVectorStateSpace()
void project(const ompl::base::State *state, OMPLProjection projection) const override