ompl/geometric/planners/cforest/CForestStateSpaceWrapper.h
00001 /********************************************************************* 00002 * Software License Agreement (BSD License) 00003 * 00004 * Copyright (c) 2014, Rice University 00005 * All rights reserved. 00006 * 00007 * Redistribution and use in source and binary forms, with or without 00008 * modification, are permitted provided that the following conditions 00009 * are met: 00010 * 00011 * * Redistributions of source code must retain the above copyright 00012 * notice, this list of conditions and the following disclaimer. 00013 * * Redistributions in binary form must reproduce the above 00014 * copyright notice, this list of conditions and the following 00015 * disclaimer in the documentation and/or other materials provided 00016 * with the distribution. 00017 * * Neither the name of the Rice University nor the names of its 00018 * contributors may be used to endorse or promote products derived 00019 * from this software without specific prior written permission. 00020 * 00021 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00022 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00023 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 00024 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 00025 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 00026 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 00027 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00028 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00029 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00030 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 00031 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00032 * POSSIBILITY OF SUCH DAMAGE. 00033 *********************************************************************/ 00034 00035 /* Authors: Mark Moll */ 00036 00037 #ifndef OMPL_GEOMETRIC_PLANNERS_CFOREST_CFORESTSTATESPACEWRAPPER_ 00038 #define OMPL_GEOMETRIC_PLANNERS_CFOREST_CFORESTSTATESPACEWRAPPER_ 00039 00040 #include "ompl/geometric/planners/cforest/CForestStateSampler.h" 00041 #include "ompl/base/StateSpace.h" 00042 #include "ompl/base/Planner.h" 00043 00044 namespace ompl 00045 { 00046 namespace geometric 00047 { 00048 class CForest; 00049 } 00050 00051 namespace base 00052 { 00055 class CForestStateSpaceWrapper : public StateSpace 00056 { 00057 public: 00058 CForestStateSpaceWrapper(geometric::CForest *cforest, base::StateSpace *space) 00059 : cforest_(cforest), space_(space), planner_(NULL) 00060 { 00061 setName(space->getName() + "CForestWrapper"); 00062 } 00063 00064 ~CForestStateSpaceWrapper() 00065 { 00066 } 00067 00068 void setPlanner(base::Planner *planner) 00069 { 00070 planner_ = planner; 00071 } 00072 00073 const base::Planner* getPlanner() const 00074 { 00075 return planner_; 00076 } 00077 00078 geometric::CForest* getCForestInstance() const 00079 { 00080 return cforest_; 00081 } 00082 00083 virtual StateSamplerPtr allocDefaultStateSampler() const; 00084 00085 virtual StateSamplerPtr allocStateSampler() const; 00086 00087 virtual void setup(); 00088 00089 virtual bool isCompound() const 00090 { 00091 return space_->isCompound(); 00092 } 00093 virtual bool isDiscrete() const 00094 { 00095 return space_->isDiscrete(); 00096 } 00097 virtual bool isHybrid() const 00098 { 00099 return space_->isHybrid(); 00100 } 00101 virtual bool isMetricSpace() const 00102 { 00103 return space_->isMetricSpace(); 00104 } 00105 virtual bool hasSymmetricDistance() const 00106 { 00107 return space_->hasSymmetricDistance(); 00108 } 00109 virtual bool hasSymmetricInterpolate() const 00110 { 00111 return space_->hasSymmetricInterpolate(); 00112 } 00113 virtual double getLongestValidSegmentFraction() const 00114 { 00115 return space_->getLongestValidSegmentFraction(); 00116 } 00117 virtual void setLongestValidSegmentFraction(double segmentFraction) 00118 { 00119 space_->setLongestValidSegmentFraction(segmentFraction); 00120 } 00121 virtual unsigned int validSegmentCount(const State *state1, const State *state2) const 00122 { 00123 return space_->validSegmentCount(state1, state2); 00124 } 00125 virtual unsigned int getDimension() const 00126 { 00127 return space_->getDimension(); 00128 } 00129 virtual double getMaximumExtent() const 00130 { 00131 return space_->getMaximumExtent(); 00132 } 00133 virtual double getMeasure() const 00134 { 00135 return space_->getMeasure(); 00136 } 00137 virtual void enforceBounds(State *state) const 00138 { 00139 space_->enforceBounds(state); 00140 } 00141 virtual bool satisfiesBounds(const State *state) const 00142 { 00143 return space_->satisfiesBounds(state); 00144 } 00145 virtual void copyState(State *destination, const State *source) const 00146 { 00147 space_->copyState(destination, source); 00148 } 00149 virtual double distance(const State *state1, const State *state2) const 00150 { 00151 return space_->distance(state1, state2); 00152 } 00153 virtual unsigned int getSerializationLength() const 00154 { 00155 return space_->getSerializationLength(); 00156 } 00157 virtual void serialize(void *serialization, const State *state) const 00158 { 00159 space_->serialize(serialization, state); 00160 } 00161 virtual void deserialize(State *state, const void *serialization) const 00162 { 00163 space_->deserialize(state, serialization); 00164 } 00165 virtual bool equalStates(const State *state1, const State *state2) const 00166 { 00167 return space_->equalStates(state1, state2); 00168 } 00169 virtual void interpolate(const State *from, const State *to, const double t, State *state) const 00170 { 00171 space_->interpolate(from, to, t, state); 00172 } 00173 virtual State* allocState() const 00174 { 00175 return space_->allocState(); 00176 } 00177 virtual void freeState(State *state) const 00178 { 00179 space_->freeState(state); 00180 } 00181 virtual double* getValueAddressAtIndex(State *state, const unsigned int index) const 00182 { 00183 return space_->getValueAddressAtIndex(state, index); 00184 } 00185 virtual void registerProjections() 00186 { 00187 space_->registerProjections(); 00188 } 00189 virtual void printState(const State *state, std::ostream &out) const 00190 { 00191 space_->printState(state, out); 00192 } 00193 virtual void printSettings(std::ostream &out) const 00194 { 00195 space_->printSettings(out); 00196 } 00197 virtual void printProjections(std::ostream &out) const 00198 { 00199 space_->printProjections(out); 00200 } 00201 virtual void sanityChecks(double zero, double eps, unsigned int flags) const 00202 { 00203 space_->sanityChecks(zero, eps, flags); 00204 } 00205 virtual void sanityChecks() const 00206 { 00207 space_->sanityChecks(); 00208 } 00209 virtual StateSamplerPtr allocSubspaceStateSampler(const StateSpace *subspace) const 00210 { 00211 return space_->allocSubspaceStateSampler(subspace); 00212 } 00213 virtual void computeLocations() 00214 { 00215 space_->computeLocations(); 00216 } 00217 00218 protected: 00219 geometric::CForest *cforest_; 00220 StateSpace *space_; 00221 Planner *planner_; 00222 }; 00223 } 00224 } 00225 00226 #endif