Commit 89369059 authored by Florent Lamiraux's avatar Florent Lamiraux Committed by Florent Lamiraux florent@laas.fr
Browse files

Reorganize exercise-1.

parent 4886f7e7
SOURCES = \
corba.asciidoc \
exercise-1.asciidoc \
exercise-2.asciidoc
......
......@@ -33,29 +33,25 @@ You should see the above window displaying a manipulator robot surrounded by obs
In the third terminal, you should see the message "Method solveBiRRT is not implemented yet". Open file +script/motion_planner.py+ in a text editor. The message is produced by method +solveBiRRT+ of class +MotionPlanner+.
Exercise 1
----------
Before starting
---------------
In file +script/motion_planner.py+, remove instruction
[source,python]
----
print ("Method solveBiRRT is not implemented yet")
----
and implement RRT algorithm between markers
[source,python]
----
#### RRT begin
All classes and functions are implemented by the remote process +hppcorbaserver+ called a +server+.
Instructions in python terminal trigger computation on the server side that stores some objects.
The server stores a +roadmap+ composed of nodes and of edges. Nodes contain
configurations. Edges contain paths. The roadmap can be extended using methods
#### RRT end
----
* +ps.addConfigToRoadmap+,
* +ps.addEdgeToRoadmap+.
TIP: All classes and functions are implemented by the remote process +hppcorbaserver+ called a +server+.
Instructions in python terminal trigger computation on the server side that stores some objects.
Those objects, mainly +paths+, +roadmap+ can be accessed using the methods described at the end of this page.
Calls to method +ps.directPath+ creates a new path between two configurations. This path is stored in a vector on the server side and can be accessed by the
index in the vector.
See Section "Some useful methods" below.
Displaying a configuration or a path
-----------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
While running, your RRT algorithm will produce configurations and paths to store in the roadmap
edges. To display a configuration +q+ in the viewer, use
[source,python]
......@@ -76,7 +72,7 @@ pp (pid)
----
Hint
----
~~~~
You can use methods of objects +robot+ and +ps+. To get the list of these
methods with documentation, type in the python terminal
......@@ -126,9 +122,12 @@ ps.getNearestConfig (config, connectedComponentId=-1)
# q1, q2: start and end configurations of the direct path,
# validation: whether the path should be tested for collision,
#
# return : whether the path is valid (True if validation is set to False),
# return: whether the path is valid (True if validation is set to False),
# index of the path,
# a string describing why the path is not valid, or empty string
# a string describing why the path is not valid, or empty string.
#
# note: When the path between q1 and q2 is not valid, the method returns
# a part of the path starting at q1 and ending before collision.
ps.directPath (q1, q2, validation)
# Add a configuration to the current roadmap
......@@ -147,13 +146,15 @@ ps.addEdgeToRoadmap (q1, q2, pathId, bothEdges)
#
# pathId: index of the path
#
# return: length of the path
# return: length of the path. The interval of definition of the path starts at
# 0 and ends at the path length.
ps.pathLength (pathId)
# Get configuration along a path
#
# pathId: index of the path
# parameter: parameter in interval of definition of the path
# (see method pathLength)
#
# return: configuration of path at given parameter
ps.configAtParam (pathId, parameter)
......@@ -163,3 +164,22 @@ ps.configAtParam (pathId, parameter)
# return: number of connected components
ps.numberConnectedComponents ()
----
Before starting we recommend that you play a little with the above methods,
creating and displaying some configurations and paths in the +python+ terminal.
Exercise 1
----------
In file +script/motion_planner.py+, remove instruction
[source,python]
----
print ("Method solveBiRRT is not implemented yet")
----
and implement RRT algorithm between markers
[source,python]
----
#### RRT begin
#### RRT end
----
......@@ -782,46 +782,37 @@ python -i rrt<span style="color: #990000">.</span>py</tt></pre></div></div>
</div>
</div>
<div class="sect1">
<h2 id="_exercise_1">Exercise 1</h2>
<h2 id="_before_starting">Before starting</h2>
<div class="sectionbody">
<div class="paragraph"><p>In file <code>script/motion_planner.py</code>, remove instruction</p></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt> <span style="font-weight: bold"><span style="color: #0000FF">print</span></span> <span style="color: #990000">(</span><span style="color: #FF0000">"Method solveBiRRT is not implemented yet"</span><span style="color: #990000">)</span></tt></pre></div></div>
<div class="paragraph"><p>and implement RRT algorithm between markers</p></div>
<div class="paragraph"><p>All classes and functions are implemented by the remote process <code>hppcorbaserver</code> called a <code>server</code>.
Instructions in python terminal trigger computation on the server side that stores some objects.
The server stores a <code>roadmap</code> composed of nodes and of edges. Nodes contain
configurations. Edges contain paths. The roadmap can be extended using methods</p></div>
<div class="ulist"><ul>
<li>
<p>
<code>ps.addConfigToRoadmap</code>,
</p>
</li>
<li>
<p>
<code>ps.addEdgeToRoadmap</code>.
</p>
</li>
</ul></div>
<div class="paragraph"><p>Calls to method <code>ps.directPath</code> creates a new path between two configurations. This path is stored in a vector on the server side and can be accessed by the
index in the vector.</p></div>
<div class="paragraph"><p>See Section "Some useful methods" below.</p></div>
<div class="sect2">
<h3 id="_displaying_a_configuration_or_a_path">Displaying a configuration or a path</h3>
<div class="paragraph"><p>While running, your RRT algorithm will produce configurations and paths to store in the roadmap
edges. To display a configuration <code>q</code> in the viewer, use</p></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt> <span style="font-style: italic"><span style="color: #9A1900">#### RRT begin</span></span>
<span style="font-style: italic"><span style="color: #9A1900">#### RRT end</span></span></tt></pre></div></div>
<div class="admonitionblock">
<table><tr>
<td class="icon">
<img src="./images/icons/tip.png" alt="Tip" />
</td>
<td class="content">All classes and functions are implemented by the remote process <code>hppcorbaserver</code> called a <code>server</code>.
Instructions in python terminal trigger computation on the server side that stores some objects.
Those objects, mainly <code>paths</code>, <code>roadmap</code> can be accessed using the methods described at the end of this page.</td>
</tr></table>
</div>
<div class="paragraph"><p>Displaying a configuration or a path</p></div>
<div class="listingblock">
<div class="content">
<pre><code>While running, your RRT algorithm will produce configurations and paths to store in the roadmap
edges. To display a configuration +q+ in the viewer, use
[source,python]</code></pre>
</div></div>
</div>
</div>
<div class="sect1">
<h2 id="_r_q">r (q)</h2>
<div class="sectionbody">
<pre><tt><span style="font-weight: bold"><span style="color: #000000">r</span></span> <span style="color: #990000">(</span>q<span style="color: #990000">)</span></tt></pre></div></div>
<div class="paragraph"><p>Functions that create a path (such as <code>directPath</code> below) appends
the created path to a vector. The path can be displayed by the path
player <code>pp</code>. To display the result of your algorithm, type</p></div>
......@@ -835,10 +826,8 @@ http://www.gnu.org/software/src-highlite -->
<span style="font-weight: bold"><span style="color: #000000">pp</span></span> <span style="color: #990000">(</span>pid<span style="color: #990000">)</span></tt></pre></div></div>
</div>
</div>
<div class="sect1">
<h2 id="_hint">Hint</h2>
<div class="sectionbody">
<div class="sect2">
<h3 id="_hint">Hint</h3>
<div class="paragraph"><p>You can use methods of objects <code>robot</code> and <code>ps</code>. To get the list of these
methods with documentation, type in the python terminal</p></div>
<div class="listingblock">
......@@ -856,6 +845,7 @@ http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt> self<span style="color: #990000">.</span>robot
self<span style="color: #990000">.</span>ps</tt></pre></div></div>
</div>
<div class="sect2">
<h3 id="_some_useful_methods">Some useful methods</h3>
<div class="listingblock">
......@@ -890,9 +880,12 @@ ps<span style="color: #990000">.</span><span style="font-weight: bold"><span sty
<span style="font-style: italic"><span style="color: #9A1900"># q1, q2: start and end configurations of the direct path,</span></span>
<span style="font-style: italic"><span style="color: #9A1900"># validation: whether the path should be tested for collision,</span></span>
<span style="font-style: italic"><span style="color: #9A1900">#</span></span>
<span style="font-style: italic"><span style="color: #9A1900"># return : whether the path is valid (True if validation is set to False),</span></span>
<span style="font-style: italic"><span style="color: #9A1900"># return: whether the path is valid (True if validation is set to False),</span></span>
<span style="font-style: italic"><span style="color: #9A1900"># index of the path,</span></span>
<span style="font-style: italic"><span style="color: #9A1900"># a string describing why the path is not valid, or empty string</span></span>
<span style="font-style: italic"><span style="color: #9A1900"># a string describing why the path is not valid, or empty string.</span></span>
<span style="font-style: italic"><span style="color: #9A1900">#</span></span>
<span style="font-style: italic"><span style="color: #9A1900"># note: When the path between q1 and q2 is not valid, the method returns</span></span>
<span style="font-style: italic"><span style="color: #9A1900"># a part of the path starting at q1 and ending before collision.</span></span>
ps<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">directPath</span></span> <span style="color: #990000">(</span>q1<span style="color: #990000">,</span> q2<span style="color: #990000">,</span> validation<span style="color: #990000">)</span>
<span style="font-style: italic"><span style="color: #9A1900"># Add a configuration to the current roadmap</span></span>
......@@ -911,13 +904,15 @@ ps<span style="color: #990000">.</span><span style="font-weight: bold"><span sty
<span style="font-style: italic"><span style="color: #9A1900">#</span></span>
<span style="font-style: italic"><span style="color: #9A1900"># pathId: index of the path</span></span>
<span style="font-style: italic"><span style="color: #9A1900">#</span></span>
<span style="font-style: italic"><span style="color: #9A1900"># return: length of the path</span></span>
<span style="font-style: italic"><span style="color: #9A1900"># return: length of the path. The interval of definition of the path starts at</span></span>
<span style="font-style: italic"><span style="color: #9A1900"># 0 and ends at the path length.</span></span>
ps<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">pathLength</span></span> <span style="color: #990000">(</span>pathId<span style="color: #990000">)</span>
<span style="font-style: italic"><span style="color: #9A1900"># Get configuration along a path</span></span>
<span style="font-style: italic"><span style="color: #9A1900">#</span></span>
<span style="font-style: italic"><span style="color: #9A1900"># pathId: index of the path</span></span>
<span style="font-style: italic"><span style="color: #9A1900"># parameter: parameter in interval of definition of the path</span></span>
<span style="font-style: italic"><span style="color: #9A1900"># (see method pathLength)</span></span>
<span style="font-style: italic"><span style="color: #9A1900">#</span></span>
<span style="font-style: italic"><span style="color: #9A1900"># return: configuration of path at given parameter</span></span>
ps<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">configAtParam</span></span> <span style="color: #990000">(</span>pathId<span style="color: #990000">,</span> parameter<span style="color: #990000">)</span>
......@@ -926,14 +921,37 @@ ps<span style="color: #990000">.</span><span style="font-weight: bold"><span sty
<span style="font-style: italic"><span style="color: #9A1900">#</span></span>
<span style="font-style: italic"><span style="color: #9A1900"># return: number of connected components</span></span>
ps<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">numberConnectedComponents</span></span> <span style="color: #990000">()</span></tt></pre></div></div>
<div class="paragraph"><p>Before starting we recommend that you play a little with the above methods,
creating and displaying some configurations and paths in the <code>python</code> terminal.</p></div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_exercise_1">Exercise 1</h2>
<div class="sectionbody">
<div class="paragraph"><p>In file <code>script/motion_planner.py</code>, remove instruction</p></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt> <span style="font-weight: bold"><span style="color: #0000FF">print</span></span> <span style="color: #990000">(</span><span style="color: #FF0000">"Method solveBiRRT is not implemented yet"</span><span style="color: #990000">)</span></tt></pre></div></div>
<div class="paragraph"><p>and implement RRT algorithm between markers</p></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt> <span style="font-style: italic"><span style="color: #9A1900">#### RRT begin</span></span>
<span style="font-style: italic"><span style="color: #9A1900">#### RRT end</span></span></tt></pre></div></div>
</div>
</div>
</div>
<div id="footnotes"><hr /></div>
<div id="footer">
<div id="footer-text">
Last updated 2017-09-15 14:26:11 CEST
Last updated 2017-09-15 15:09:41 CEST
</div>
</div>
</body>
......
......@@ -979,7 +979,7 @@ graph<span style="color: #990000">.</span><span style="font-weight: bold"><span
<div id="footnotes"><hr /></div>
<div id="footer">
<div id="footer-text">
Last updated 2017-07-08 11:30:15 CEST
Last updated 2017-09-15 14:37:05 CEST
</div>
</div>
</body>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment