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

Update instructions and scripts

  - rrt.py does not create client to gepetto-gui
  - rrt.py, grasp_ball.py, and grasp_ball_in_box.py reset problem at start.
  - create client to gepetto-gui in a separate command,
  - use widgets in gepetto-gui for displaying path and constraint graph
    instead of python commands.
parent a0bf20e6
......@@ -27,11 +27,7 @@ cd script
python -i rrt.py
----
image::hpp-gui-ur5.png[width="40%",alt="hpp-gui graphical interface"]
You should see the above window displaying a manipulator robot surrounded by obstacles.
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+.
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+.
Before starting
---------------
......@@ -44,33 +40,49 @@ configurations. Edges contain paths. The roadmap can be extended using methods
* +ps.addConfigToRoadmap+,
* +ps.addEdgeToRoadmap+.
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
Calls to method +ps.directPath+ create 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
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Displaying a configuration
~~~~~~~~~~~~~~~~~~~~~~~~~~
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
edges. To display a configuration +q+, first create a client to +gepetto-gui+ in the python terminal:
[source,python]
----
v (q)
>>> v = vf.createViewer ()
----
Functions that create a path (such as +directPath+ below) appends
image::hpp-gui-ur5.png[width="40%",alt="hpp-gui graphical interface"]
You should see the above window displaying a manipulator robot surrounded by obstacles.
Then, typing in the python terminal
[source,python]
----
>>> v (q)
----
You shoud see the robot in configuration +q+.
Displaying a path
~~~~~~~~~~~~~~~~~
Functions that create a path (such as +directPath+ below) append
the created path to a vector. The path can be displayed by the path
player +pp+. To display the result of your algorithm, type
[source,python]
----
pid = ps.numberPaths () - 1
if pid < 0: raise RuntimeError ("No path in vector")
pp (pid)
>>> pid = ps.numberPaths () - 1
>>> if pid < 0: raise RuntimeError ("No path in vector")
>>> pp = PathPlayer (v)
>>> pp (pid)
----
You can also use +gepetto-gui+ path player to display a path. For that, in menu +Tools+, select +Reset connections+ then +Refresh+. In menu +Windows+, select +Path player+.
Hint
~~~~
......@@ -79,16 +91,16 @@ methods with documentation, type in the python terminal
[source,python]
----
help (robot)
help (ps)
>>> help (robot)
>>> help (ps)
----
In +class MotionPlanner+, you can access these object by
[source,python]
----
self.robot
self.ps
>>> self.robot
>>> self.ps
----
Some useful methods
......
......@@ -772,13 +772,7 @@ http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>cd script
python -i rrt<span style="color: #990000">.</span>py</tt></pre></div></div>
<div class="imageblock">
<div class="content">
<img src="hpp-gui-ur5.png" alt="hpp-gui graphical interface" width="40%" />
</div>
</div>
<div class="paragraph"><p>You should see the above window displaying a manipulator robot surrounded by obstacles.</p></div>
<div class="paragraph"><p>In the third terminal, you should see the message "Method solveBiRRT is not implemented yet". Open file <code>script/motion_planner.py</code> in a text editor. The message is produced by method <code>solveBiRRT</code> of class <code>MotionPlanner</code>.</p></div>
<div class="paragraph"><p>You should see the message "Method solveBiRRT is not implemented yet". Open file <code>script/motion_planner.py</code> in a text editor. The message is produced by method <code>solveBiRRT</code> of class <code>MotionPlanner</code>.</p></div>
</div>
</div>
<div class="sect1">
......@@ -800,20 +794,37 @@ configurations. Edges contain paths. The roadmap can be extended using methods</
</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
<div class="paragraph"><p>Calls to method <code>ps.directPath</code> create 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>
<h3 id="_displaying_a_configuration">Displaying a configuration</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>
edges. To display a configuration <code>q</code>, first create a client to <code>gepetto-gui</code> in the python terminal:</p></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 3.1.8
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><span style="color: #990000">&gt;&gt;&gt;</span> v <span style="color: #990000">=</span> vf<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">createViewer</span></span> <span style="color: #990000">()</span></tt></pre></div></div>
<div class="imageblock">
<div class="content">
<img src="hpp-gui-ur5.png" alt="hpp-gui graphical interface" width="40%" />
</div>
</div>
<div class="paragraph"><p>You should see the above window displaying a manipulator robot surrounded by obstacles.</p></div>
<div class="paragraph"><p>Then, typing in the python terminal</p></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 3.1.8
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><span style="font-weight: bold"><span style="color: #000000">v</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
<pre><tt><span style="color: #990000">&gt;&gt;&gt;</span> <span style="font-weight: bold"><span style="color: #000000">v</span></span> <span style="color: #990000">(</span>q<span style="color: #990000">)</span></tt></pre></div></div>
<div class="paragraph"><p>You shoud see the robot in configuration <code>q</code>.</p></div>
</div>
<div class="sect2">
<h3 id="_displaying_a_path">Displaying a path</h3>
<div class="paragraph"><p>Functions that create a path (such as <code>directPath</code> below) append
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>
<div class="listingblock">
......@@ -821,10 +832,11 @@ player <code>pp</code>. To display the result of your algorithm, type</p></div>
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>pid <span style="color: #990000">=</span> ps<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">numberPaths</span></span> <span style="color: #990000">()</span> <span style="color: #990000">-</span> <span style="color: #993399">1</span>
<span style="font-weight: bold"><span style="color: #0000FF">if</span></span> pid <span style="color: #990000">&lt;</span> <span style="color: #993399">0</span><span style="color: #990000">:</span> <span style="font-weight: bold"><span style="color: #0000FF">raise</span></span> <span style="font-weight: bold"><span style="color: #000000">RuntimeError</span></span> <span style="color: #990000">(</span><span style="color: #FF0000">"No path in vector"</span><span style="color: #990000">)</span>
<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>
<pre><tt><span style="color: #990000">&gt;&gt;&gt;</span> pid <span style="color: #990000">=</span> ps<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">numberPaths</span></span> <span style="color: #990000">()</span> <span style="color: #990000">-</span> <span style="color: #993399">1</span>
<span style="color: #990000">&gt;&gt;&gt;</span> <span style="font-weight: bold"><span style="color: #0000FF">if</span></span> pid <span style="color: #990000">&lt;</span> <span style="color: #993399">0</span><span style="color: #990000">:</span> <span style="font-weight: bold"><span style="color: #0000FF">raise</span></span> <span style="font-weight: bold"><span style="color: #000000">RuntimeError</span></span> <span style="color: #990000">(</span><span style="color: #FF0000">"No path in vector"</span><span style="color: #990000">)</span>
<span style="color: #990000">&gt;&gt;&gt;</span> pp <span style="color: #990000">=</span> <span style="font-weight: bold"><span style="color: #000000">PathPlayer</span></span> <span style="color: #990000">(</span>v<span style="color: #990000">)</span>
<span style="color: #990000">&gt;&gt;&gt;</span> <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 class="paragraph"><p>You can also use <code>gepetto-gui</code> path player to display a path. For that, in menu <code>Tools</code>, select <code>Reset connections</code> then <code>Refresh</code>. In menu <code>Windows</code>, select <code>Path player</code>.</p></div>
</div>
<div class="sect2">
<h3 id="_hint">Hint</h3>
......@@ -835,16 +847,16 @@ methods with documentation, type in the python terminal</p></div>
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt> <span style="font-weight: bold"><span style="color: #000000">help</span></span> <span style="color: #990000">(</span>robot<span style="color: #990000">)</span>
<span style="font-weight: bold"><span style="color: #000000">help</span></span> <span style="color: #990000">(</span>ps<span style="color: #990000">)</span></tt></pre></div></div>
<pre><tt><span style="color: #990000">&gt;&gt;&gt;</span> <span style="font-weight: bold"><span style="color: #000000">help</span></span> <span style="color: #990000">(</span>robot<span style="color: #990000">)</span>
<span style="color: #990000">&gt;&gt;&gt;</span> <span style="font-weight: bold"><span style="color: #000000">help</span></span> <span style="color: #990000">(</span>ps<span style="color: #990000">)</span></tt></pre></div></div>
<div class="paragraph"><p>In <code>class MotionPlanner</code>, you can access these object by</p></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 3.1.8
by Lorenzo Bettini
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>
<pre><tt><span style="color: #990000">&gt;&gt;&gt;</span> self<span style="color: #990000">.</span>robot
<span style="color: #990000">&gt;&gt;&gt;</span> self<span style="color: #990000">.</span>ps</tt></pre></div></div>
</div>
<div class="sect2">
<h3 id="_some_useful_methods">Some useful methods</h3>
......@@ -952,7 +964,7 @@ http://www.gnu.org/software/src-highlite -->
<div id="footer">
<div id="footer-text">
Last updated
2019-05-31 11:32:41 CEST
2019-05-31 14:35:55 CEST
</div>
</div>
</body>
......
......@@ -18,14 +18,20 @@ hppcorbaserver
In the second terminal, type
[source,sh]
----
gepetto-gui
cd script
python -i grasp_ball.py
----
In the third terminal, type
[source,sh]
----
cd script
python -i grasp_ball.py
gepetto-gui
----
To display the robot and environment, create again a client to +gepetto-gui+ in the python terminal:
[source,python]
----
>>> v = vf.createViewer ()
----
image::manipulation.png[width="40%",alt="hpp-gui graphical interface"]
......@@ -36,21 +42,31 @@ the script by typing respectively
[source,python]
----
v (q_init)
v (q_goal)
>>> v (q_init)
>>> v (q_goal)
----
Displaying the constraint graph
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
in the python terminal. You can display the constraint graph by typing
In +gepetto-gui+ menu +Windows+, select item +Constraint Graph+. The following window should appear in +gepetto-gui+.
image::hpp-plot-manipulation-graph.png[width="40%",alt="hpp-plot-manipulation-graph"]
Click on buttons "Refresh" and "Statistics" to display the current constraint graph.
By clicking on edges, you can see some statistics about the roadmap extension.
image::hpp-plot-manipulation-graph-statistics.png[width="40%",alt="hpp-plot-manipulation-graph"]
Alternatively, in the python terminal. You can display the constraint graph by typing
[source,python]
----
graph.display (format='svg')
>>> graph.display (format='svg')
----
The graph should be displayed in a brower. By moving the mouse on
The graph should be displayed in a browser. By moving the mouse on
nodes and edges, you can see the constraints associated to each graph
element.
......@@ -60,7 +76,7 @@ Solving the problem
Typing
[source,python]
----
ps.solve ()
>>> ps.solve ()
----
should solve the problem in a minute or so.
......@@ -69,8 +85,10 @@ Displaying the path
As in exercise 1, the path can be displayed using the path player
[source,python]
----
pp (0)
>>> pp = PathPlayer (v)
>>> pp (0)
----
You can also display the path using the path player in +gepetto-gui+.
A more difficult problem
------------------------
......@@ -111,25 +129,6 @@ indices named +paths+ corresponding to indices in the vector of paths. Each path
Hints
-----
Displaying the constraint graph
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Type in a terminal
[source,sh]
----
hpp-plot-manipulation-graph
----
The following window should pop up.
image::hpp-plot-manipulation-graph.png[width="40%",alt="hpp-plot-manipulation-graph"]
Click on buttons "Refresh" and "Statistics" to display the current constraint graph.
By clicking on edges, you can see some statistics about the roadmap extension.
image::hpp-plot-manipulation-graph-statistics.png[width="40%",alt="hpp-plot-manipulation-graph"]
Some useful methods
~~~~~~~~~~~~~~~~~~~
[source,python]
......
This diff is collapsed.
from math import sqrt
from hpp import Transform
from hpp.corbaserver.manipulation import ConstraintGraph, Constraints
from hpp.corbaserver import Client
Client ().problem.resetProblem ()
from manipulation import robot, vf, ps, Ground, Box, Pokeball, PathPlayer, gripperName, ballName
vf.loadEnvironmentModel (Ground, 'ground')
......
from math import sqrt
from hpp import Transform
from hpp.corbaserver.manipulation import ConstraintGraph
from hpp.corbaserver import Client
Client ().problem.resetProblem ()
from manipulation import robot, vf, ps, Ground, Box, Pokeball, PathPlayer, gripperName, ballName
vf.loadEnvironmentModel (Ground, 'ground')
......
from hpp.corbaserver.practicals.ur5 import Robot
from hpp.corbaserver import ProblemSolver
from hpp.corbaserver import ProblemSolver, Client
from hpp.gepetto import ViewerFactory, PathPlayer
Client ().problem.resetProblem ()
robot = Robot ('ur5')
ps = ProblemSolver (robot)
......
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