Sophie

Sophie

distrib > Fedora > 14 > x86_64 > media > updates > by-pkgid > e7618febbb9cbed15bb79e326774c050 > files > 1299

ompl-devel-0.9.5-1.fc14.i686.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml; charset=UTF-8"/>
<title>OMPL: Generic instructions for setting up a planning context</title>
<meta name="author" content="Ioan A. Șucan, Mark Moll, Lydia E. Kavraki">
<link rel="stylesheet" href="../css/screen.css" type="text/css" media="screen, projection">
<link rel="stylesheet" href="../css/print.css" type="text/css" media="print">
<!--[if lt IE 7]>
<script type="text/javascript" src="../js/jquery/jquery.js"></script>
<script type="text/javascript" src="../js/jquery/jquery.dropdown.js"></script>
<![endif]-->
<script type="text/javaScript" src="search/search.js"></script>
<script type="text/javascript">
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-9156598-2']);
  _gaq.push(['_trackPageview']);
  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
</script>
</head>
<body onload='searchBox.OnSelectItem(0);'>
<script type="text/javascript"><!--
var searchBox = new SearchBox("searchBox", "search",false,'Search API');
--></script>
<div class="navigation" id="top">
  <div class="tabs" id="ompltitle">
    <ul class="tablist">
      <li>The Open Motion Planning Library</li>
      <li id="searchli">
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search API" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)"
               onblur="searchBox.OnSearchFieldFocus(false)"
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>

  <ul id="nav" class="dropdown">
    <li class="first"><a href="index.html">Home</a></li>
    <li><a href="download.html">Download</a></li>
    <li><a href="documentation.html">Documentation</a></li>
    <li><span class="dir">Code API</span>
      <ul>
        <li><a href="api_overview.html">API Overview</a></li>
        <li><a href="namespaces.html">Namespaces</a></li>
        <li><a href="annotated.html">Classes</a></li>
        <li><a href="files.html">Files</a></li>
        <li><a href="dirs.html">Directories</a></li>
      </ul>
    </li>
    <li><span class="dir">Community</span>
      <ul>
        <li><a href="developers.html">Developers</a></li>
        <li><a href="thirdparty.html">Contributions</a></li>
        <li><a href="education.html">Education</a></li>
        <li><a href="gallery.html">Gallery</a></li>
      </ul>
    </li>
    <li><span class="dir">About</span>
      <ul>
        <li><a href="license.html">License</a></li>
        <li><a href="citations.html">Citations</a></li>
        <li><a href="acknowledgements.html">Acknowledgments</a></li>
        <li><a href="contact.html">Contact Us</a></li>
      </ul>
    </li>
  </ul>
</div>

<!--- window showing the filter options -->
<div id="MSearchSelectWindow"
  onmouseover="return searchBox.OnSearchSelectShow()"
  onmouseout="return searchBox.OnSearchSelectHide()"
  onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
  <iframe src="" frameborder="0"name="MSearchResults" id="MSearchResults"></iframe>
</div>

<div class="container">
  <div class="span-22 push-2 first last">
  <div>
<!-- Generated by Doxygen 1.7.4 -->
<script type="text/javascript"><!--
var searchBox = new SearchBox("searchBox", "search",false,'Search');
--></script>
</div>
<div class="header">
  <div class="headertitle">
<div class="title">Generic instructions for setting up a planning context </div>  </div>
</div>
<div class="contents">
<div class="textblock"><dl class="user"><dt><b>Instantiating a state space</b></dt><dd>The first step for setting up a planning problem is selecting the space we are planning in. Simply create an instance of a class that inherits from <a class="el" href="classompl_1_1base_1_1StateSpace.html" title="Representation of a space in which planning can be performed. Topology specific sampling, interpolation and distance are defined.">ompl::base::StateSpace</a>, or select one from the available implementations. To change the definition of the employed sampler or distance function, it is possible to provide a further specialization of such a state space. See <a class="el" href="implementingStateSpaces.html">Implementing State Spaces</a>. <div class="fragment"><pre class="fragment">   base::StateSpacePtr space(<span class="keyword">new</span> base::SE2StateSpace());
   <span class="comment">// set bounds ....</span>
</pre></div></dd></dl>
<dl class="user"><dt><b>Instantiating a control space</b></dt><dd>If planning with differential constraints, a representation of the space of controls is needed as well. Simply create an instance of a class that inherits from <a class="el" href="classompl_1_1control_1_1ControlSpace.html" title="A control space representing the space of applicable controls.">ompl::control::ControlSpace</a>. Usually, <a class="el" href="classompl_1_1control_1_1RealVectorControlSpace.html" title="A control space representing Rn. The distance function is the L2 norm.">ompl::control::RealVectorControlSpace</a> is sufficient. An implementation needs to be specified for the ompl::control:ControlSpace::propagate() either by inheriting from the control space class or by calling ompl::control::ControlSpace::setPropagationFunction(). <div class="fragment"><pre class="fragment">   base::StateSpacePtr space(<span class="keyword">new</span> base::SE2StateSpace());
   <span class="comment">// set bounds for state space</span>
   control::ControlSpacePtr cspace(<span class="keyword">new</span> control::RealVectorControlSpace(space));
   <span class="comment">// set bounds for cspace</span>
</pre></div></dd></dl>
<dl class="user"><dt><b>Instantiating a space information class</b></dt><dd>Creating an actual instance of a space information class (<a class="el" href="classompl_1_1base_1_1SpaceInformation.html" title="The base class for space information. This contains all the information about the space planning is d...">ompl::base::SpaceInformation</a>) is trivial as the constructor requires only a state space to be specified (<a class="el" href="classompl_1_1base_1_1StateSpace.html" title="Representation of a space in which planning can be performed. Topology specific sampling, interpolation and distance are defined.">ompl::base::StateSpace</a>). When planning with controls (<a class="el" href="classompl_1_1control_1_1SpaceInformation.html" title="Space information containing necessary information for planning with controls. setup() needs to be ca...">ompl::control::SpaceInformation</a>), this constructor requires a control space (<a class="el" href="classompl_1_1control_1_1ControlSpace.html" title="A control space representing the space of applicable controls.">ompl::control::ControlSpace</a>) as well. The space information class also needs to be configured before use:<br/>
<br/>
<ul>
<li><a class="el" href="classompl_1_1base_1_1StateValidityChecker.html" title="Abstract definition for a class checking the validity of states. The implementation of this class mus...">ompl::base::StateValidityChecker</a> is an abstract class that provides functionality for determining whether a state is valid or not. This class is assumed to be thread safe. The user should provide an implementation of this class and supply it to the space information instance by calling <a class="el" href="classompl_1_1base_1_1SpaceInformation.html#a0449ec0893e02aca2bdfc63323b624e5" title="Set the instance of the state validity checker to use. Parallel implementations of planners assume th...">ompl::base::SpaceInformation::setStateValidityChecker()</a>. Alternatively, the user can pass a function of the type <a class="el" href="namespaceompl_1_1base.html#a208ad51fcef09961293d23b589a4dbfa" title="If no state validity checking class is specified (StateValidityChecker), a boost function can be spec...">ompl::base::StateValidityCheckerFn</a> to <a class="el" href="classompl_1_1base_1_1SpaceInformation.html#a0449ec0893e02aca2bdfc63323b624e5" title="Set the instance of the state validity checker to use. Parallel implementations of planners assume th...">ompl::base::SpaceInformation::setStateValidityChecker()</a> instead. By default, all states are considered valid, if this parameter is not set.</li>
<li>if using <a class="el" href="classompl_1_1base_1_1DiscreteMotionValidator.html" title="A motion validator that only uses the state validity checker. Motions are checked for validity at a s...">ompl::base::DiscreteMotionValidator</a> for validating motions (this is the default), a call needs to be made to <a class="el" href="classompl_1_1base_1_1SpaceInformation.html#a2bcd47fd9b7cf54b086d2122646736bf" title="Set the resolution at which state validity needs to be verified in order for a motion between two sta...">ompl::base::SpaceInformation::setStateValidityCheckingResolution()</a> in order to specify the maximum distance between states to be checked for validity along a path segment. This distance is specified as a percentage of a space's maximum extent. If this call is not made, the resolution is assumed to be 1%. This value may be too low, in which case planning will be slower, or it may be too high, in which case it is possible to have collisions in solution plans. <div class="fragment"><pre class="fragment">   <span class="comment">// define this class:</span>
   <span class="keyword">class </span>myStateValidityCheckerClass : <span class="keyword">public</span> base::StateValidityChecker
   {
   <span class="keyword">public</span>:
        myStateValidityCheckerClass(<span class="keyword">const</span> base::SpaceInformationPtr &amp;si) :
          base::StateValidityChecker(si)
           {
        }

        <span class="keyword">virtual</span> <span class="keywordtype">bool</span> isValid(<span class="keyword">const</span> base::State *state)<span class="keyword"> const</span>
<span class="keyword">        </span>{
                <span class="keywordflow">return</span> ...;
        }
   };
   <span class="comment">// or this function:</span>
   <span class="keywordtype">bool</span> myStateValidityCheckerFunction(<span class="keyword">const</span> base::State *state)
   {
        <span class="keywordflow">return</span> ...;
   }

   base::SpaceInformationPtr si(space);
   <span class="comment">// either this call:</span>
   si-&gt;<a class="code" href="classompl_1_1base_1_1SpaceInformation.html#a0449ec0893e02aca2bdfc63323b624e5" title="Set the instance of the state validity checker to use. Parallel implementations of planners assume th...">setStateValidityChecker</a>(base::StateValidityCheckerPtr(<span class="keyword">new</span> myStateValidityCheckerClass(si)));
   <span class="comment">// or this call:</span>
   si-&gt;<a class="code" href="classompl_1_1base_1_1SpaceInformation.html#a0449ec0893e02aca2bdfc63323b624e5" title="Set the instance of the state validity checker to use. Parallel implementations of planners assume th...">setStateValidityChecker</a>(boost::bind(&amp;myStateValidityCheckerFunction, _1));
   si-&gt;<a class="code" href="classompl_1_1base_1_1SpaceInformation.html#a2bcd47fd9b7cf54b086d2122646736bf" title="Set the resolution at which state validity needs to be verified in order for a motion between two sta...">setStateValidityCheckingResolution</a>(0.03); <span class="comment">// 3%</span>
   si-&gt;<a class="code" href="classompl_1_1base_1_1SpaceInformation.html#ac39aa0c4b92e3ca5acfa75eeb56b080f" title="Perform additional setup tasks (run once, before use). If state validity checking resolution has not ...">setup</a>();
</pre></div> Once the class is instantiated and parameters have been set, the <a class="el" href="classompl_1_1base_1_1SpaceInformation.html#ac39aa0c4b92e3ca5acfa75eeb56b080f" title="Perform additional setup tasks (run once, before use). If state validity checking resolution has not ...">ompl::base::SpaceInformation::setup()</a> function needs to be called and the instance is ready for use.</li>
</ul>
</dd></dl>
<dl class="user"><dt><b>Instantiating a problem definition</b></dt><dd><ul>
<li>instances of <a class="el" href="classompl_1_1base_1_1State.html" title="Definition of an abstract state.">ompl::base::State</a> or <a class="el" href="classompl_1_1base_1_1ScopedState.html" title="Definition of a scoped state.">ompl::base::ScopedState</a> need to be supplied as starting states for the system (at least one), using <a class="el" href="classompl_1_1base_1_1ProblemDefinition.html#a3120682d036099f68fd26805fee0736d" title="Add a start state. The state is copied.">ompl::base::ProblemDefinition::addStartState()</a>.</li>
<li>an <a class="el" href="classompl_1_1base_1_1Goal.html" title="Abstract definition of goals. Will contain solutions, if found.">ompl::base::Goal</a> specification must be set using <a class="el" href="classompl_1_1base_1_1ProblemDefinition.html#a039bef3abd7e8319e4ea2e4cda752ff6" title="Set the goal.">ompl::base::ProblemDefinition::setGoal()</a>. For simplicity, specifications of this class are available: <a class="el" href="classompl_1_1base_1_1GoalRegion.html" title="Definition of a goal region.">ompl::base::GoalRegion</a>, <a class="el" href="classompl_1_1base_1_1GoalSampleableRegion.html" title="Abstract definition of a goal region that can be sampled.">ompl::base::GoalSampleableRegion</a>, <a class="el" href="classompl_1_1base_1_1GoalState.html" title="Definition of a goal state.">ompl::base::GoalState</a>, <a class="el" href="classompl_1_1base_1_1GoalStates.html" title="Definition of a set of goal states.">ompl::base::GoalStates</a>.</li>
<li>as a simplification, a call can be made to <a class="el" href="classompl_1_1base_1_1ProblemDefinition.html#a9ab5830fd9366be606349ea1885a3695" title="In the simplest case possible, we have a single starting state and a single goal state.">ompl::base::ProblemDefinition::setStartAndGoalStates()</a>. This will clear previous settings, add one start state and create an <a class="el" href="classompl_1_1base_1_1GoalState.html" title="Definition of a goal state.">ompl::base::GoalState</a> representation for the goal. <div class="fragment"><pre class="fragment">   base::SpaceInformationPtr si(...);
   base::ProblemDefinitionPtr pdef(<span class="keyword">new</span> base::ProblemDefinition(si));

   base::ScopedState start;
   <span class="comment">// fill start state</span>

   base::ScopedState goal;
   <span class="comment">// fill goal state</span>

   pdef-&gt;setStartAndGoalStates(start, goal);
</pre></div> An important part of setting the problem definition is filling the content of start states (and goal states, if using a goal representation that requires states). Please see <a class="el" href="workingWithStates.html#stateOps">Operating with states</a>.</li>
</ul>
</dd></dl>
<dl class="user"><dt><b>Instantiating a planner</b></dt><dd>In order to use a motion planner (ompl::geometric::XXX, from <b>ompl/geometric/planners</b> or ompl::control::XXX, from <b>ompl/control/planners</b>), an instance of <a class="el" href="classompl_1_1base_1_1SpaceInformation.html" title="The base class for space information. This contains all the information about the space planning is d...">ompl::base::SpaceInformation</a> (<a class="el" href="classompl_1_1control_1_1SpaceInformation.html" title="Space information containing necessary information for planning with controls. setup() needs to be ca...">ompl::control::SpaceInformation</a>, respectively) must be available. This instance is supplied to the planner's constructor. After creation, a call to the planner's <a class="el" href="classompl_1_1base_1_1Planner.html#a948cef726b875317e53ea0f21af40efc" title="Perform extra configuration steps, if needed. This call will also issue a call to ompl::base::SpaceIn...">ompl::base::Planner::setup()</a> method must be made and the planner instance is ready for use. The problem to be solved is set with <a class="el" href="classompl_1_1base_1_1Planner.html#add968ea14f1aa3d3bffc110da3e1d031" title="Set the problem definition for the planner. The problem needs to be set before calling solve()...">ompl::base::Planner::setProblemDefinition()</a>. The <a class="el" href="classompl_1_1base_1_1Planner.html#acc87e95df04aa24ec52e24281c9fc223" title="Function that can solve the motion planning problem. This function can be called multiple times on th...">ompl::base::Planner::solve()</a> method can be called repeatedly with different allowed time durations until a solution is found. The planning process continues with the available data structures when sequential calls to <a class="el" href="classompl_1_1base_1_1Planner.html#acc87e95df04aa24ec52e24281c9fc223" title="Function that can solve the motion planning problem. This function can be called multiple times on th...">ompl::base::Planner::solve()</a> are made. A call to <a class="el" href="classompl_1_1base_1_1Planner.html#a7e99408ada6e1572a14509fd566ae8b8" title="Clear all internal datastructures. Planner settings are not affected. Subsequent calls to solve() wil...">ompl::base::Planner::clear()</a> will restore a planner to its state before any calls to the <a class="el" href="classompl_1_1base_1_1Planner.html#acc87e95df04aa24ec52e24281c9fc223" title="Function that can solve the motion planning problem. This function can be called multiple times on th...">ompl::base::Planner::solve()</a> method were made. <div class="fragment"><pre class="fragment">   <span class="keyword">using namespace </span>ompl;
   <a class="code" href="classompl_1_1base_1_1SpaceInformationPtr.html" title="A boost shared pointer wrapper for ompl::base::SpaceInformation.">base::SpaceInformationPtr</a> si(...);
   <a class="code" href="classompl_1_1base_1_1ProblemDefinition.html" title="Definition of a problem to be solved. This includes the start state(s) for the system and a goal spec...">base::ProblemDefinition</a>   pdef(si);
   <span class="comment">// set start states &amp; goal region for the problem definition</span>

   <a class="code" href="classompl_1_1base_1_1PlannerPtr.html" title="A boost shared pointer wrapper for ompl::base::Planner.">base::PlannerPtr</a> planner(<span class="keyword">new</span> <a class="code" href="classompl_1_1geometric_1_1SBL.html" title="Single-Query Bi-Directional Probabilistic Roadmap Planner with Lazy Collision Checking.">geometric::SBL</a>(si));
   planner-&gt;setProblemDefinition(pdef);
   planner-&gt;solve(1.0);
   <span class="keywordflow">if</span> (pdef-&gt;getGoal()-&gt;getSolutionPath())
   {
      <span class="comment">// do something with the solution</span>
   }
   planner-&gt;clear();
</pre></div></dd></dl>
<dl class="user"><dt><b>Using SimpleSetup</b></dt><dd>The instantiation of all the above classes is facilitated by the <a class="el" href="classompl_1_1geometric_1_1SimpleSetup.html" title="Create the set of classes typically needed to solve a geometric problem.">ompl::geometric::SimpleSetup</a> class (<a class="el" href="classompl_1_1control_1_1SimpleSetup.html" title="Create the set of classes typically needed to solve a control problem.">ompl::control::SimpleSetup</a>, respectively). Please see the documentation of these classes for more information. Making use of their functionality is recommended, if appropriate. </dd></dl>
</div></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

</div>

<div class="footer span-22 push-2 last">
  <a href="http://www.kavrakilab.org">Physical and Biological Computing Group</a> &bull;
  <a href="http://www.cs.rice.edu">Department of Computer Science</a> &bull;
  <a href="http://www.rice.edu">Rice University</a><br>
  <div class="gray">Generated on Sun Oct 9 2011 23:04:41 by&#160;<a href="http://www.doxygen.org/index.html">doxygen</a> 1.7.4</div>
</div>
</div>
</body>
</html>