All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator
SpaceInformation.h
00001 /*********************************************************************
00002 * Software License Agreement (BSD License)
00003 *
00004 *  Copyright (c) 2010, 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 /* Author: Ioan Sucan */
00036 
00037 #ifndef OMPL_CONTROL_SPACE_INFORMATION_
00038 #define OMPL_CONTROL_SPACE_INFORMATION_
00039 
00040 #include "ompl/base/SpaceInformation.h"
00041 #include "ompl/control/ControlManifold.h"
00042 #include "ompl/control/ControlSampler.h"
00043 #include "ompl/control/Control.h"
00044 #include "ompl/util/ClassForward.h"
00045 
00046 namespace ompl
00047 {
00048 
00051     namespace control
00052     {
00053 
00055         ClassForward(SpaceInformation);
00056 
00061         class SpaceInformation : public base::SpaceInformation
00062         {
00063         public:
00064 
00067             SpaceInformation(const base::StateManifoldPtr &stateManifold, const ControlManifoldPtr &controlManifold) :
00068                 base::SpaceInformation(stateManifold), controlManifold_(controlManifold),
00069                 minSteps_(0), maxSteps_(0), stepSize_(0.0)
00070             {
00071             }
00072 
00073             virtual ~SpaceInformation(void)
00074             {
00075             }
00076 
00078             const ControlManifoldPtr& getControlManifold(void) const
00079             {
00080                 return controlManifold_;
00081             }
00082 
00087             Control* allocControl(void) const
00088             {
00089                 return controlManifold_->allocControl();
00090             }
00091 
00093             void freeControl(Control *control) const
00094             {
00095                 controlManifold_->freeControl(control);
00096             }
00097 
00099             void copyControl(Control *destination, const Control *source) const
00100             {
00101                 controlManifold_->copyControl(destination, source);
00102             }
00103 
00105             Control* cloneControl(const Control *source) const
00106             {
00107                 Control *copy = controlManifold_->allocControl();
00108                 controlManifold_->copyControl(copy, source);
00109                 return copy;
00110             }
00111 
00118             void printControl(const Control *control, std::ostream &out = std::cout) const
00119             {
00120                 controlManifold_->printControl(control, out);
00121             }
00122 
00124             bool equalControls(const Control *control1, const Control *control2) const
00125             {
00126                 return controlManifold_->equalControls(control1, control2);
00127             }
00128 
00130             void nullControl(Control *control) const
00131             {
00132                 controlManifold_->nullControl(control);
00133             }
00134 
00141             ControlSamplerPtr allocControlSampler(void) const
00142             {
00143                 return controlManifold_->allocControlSampler();
00144             }
00145 
00148             void setPropagationStepSize(double stepSize)
00149             {
00150                 stepSize_ = stepSize;
00151             }
00152 
00154             double getPropagationStepSize(void) const
00155             {
00156                 return stepSize_;
00157             }
00158 
00160             void setMinMaxControlDuration(unsigned int minSteps, unsigned int maxSteps)
00161             {
00162                 minSteps_ = minSteps;
00163                 maxSteps_ = maxSteps;
00164             }
00165 
00167             unsigned int getMinControlDuration(void) const
00168             {
00169                 return minSteps_;
00170             }
00171 
00173             unsigned int getMaxControlDuration(void) const
00174             {
00175                 return maxSteps_;
00176             }
00187             void propagate(const base::State *state, const Control* control, unsigned int steps, base::State *result) const;
00188 
00196             unsigned int propagateWhileValid(const base::State *state, const Control* control, unsigned int steps, base::State *result) const;
00197 
00206             void propagate(const base::State *state, const Control* control, unsigned int steps, std::vector<base::State*> &result, bool alloc) const;
00207 
00220             unsigned int propagateWhileValid(const base::State *state, const Control* control, unsigned int steps, std::vector<base::State*> &result, bool alloc) const;
00221 
00225             virtual void printSettings(std::ostream &out = std::cout) const;
00226 
00228             virtual void setup(void);
00229 
00230         protected:
00231 
00233             ControlManifoldPtr controlManifold_;
00234 
00236             unsigned int       minSteps_;
00237 
00239             unsigned int       maxSteps_;
00240 
00242             double             stepSize_;
00243 
00244         };
00245 
00246     }
00247 
00248 }
00249 
00250 #endif
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator