Zero Prerequisites Demo Tutorial: Simple Fetch and Place

From David Vernon's Wiki
Revision as of 04:58, 6 May 2021 by Dvernon (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This page provides a consolidated version of the code required for the Zero prerequisites demo tutorial: Simple fetch and place. You normally do this tutorial in an interactive manner, leading to the creation of the code for the move-bottle function that is pasted into the pick-and-place.lisp file for the first example. The second and third examples on failure handling modify this code.

Here, we provide the code for three versions of move-bottle, one for each example: move-bottle1, move-bottle2, and move-bottle3. This allows you to add code to the pick-and-place.lisp just once and so that you can simply do the tutorial by invoking the example commands, i.e. by evaluating the three example forms in REPL, each one exemplifying one specific aspect of the plan.

We also include a fourth version, move-botte4, which covers the example of defining a new grasp, directly after Exercise 3.

For convenience, we also include four dummy functions to use when doing exercises 1 - 4.

Note that here we don't cover the material in the first two sections of the tutorial, i.e. "Setting Up" and "Understanding the Basics". You need to go through these yourself. Here, we cover the material in the section "Simple Fetch and Place".


Update pick-and-place.lisp

First, let's copy the example code.

Move into the src directory:

$ cd src

Edit pick-and-place.lisp

Copy and paste the code below.


(in-package :smmp-tut)


There are four versions of move-bottle1(): move-bottle2(), move-bottle3(), and move-bottle4()</code>.

These correspond to the four steps in the tutorial

  1. Simple Fetch and Place
  2. Recovery from Failures
  3. Handling More Failures
  4. Defining a New Grasp (this comes after Exercise 3, in preparation for Exercise 4)

in which the move-bottle() functions are defined (step 1), revised (step 2), revised again (step 3). Step 4, defining a new grasp, involves direct evaluation of an action designator of type picking-up with the new front-left-diagonal grasp. For convenience, we wrap this in the move-bottle4 function.

Doing the Tutorial

We are now in a position to do the Zero prerequisites demo tutorial: Simple fetch and place but without having to provide all of the function definitions interactively. This means we can simply invoke the example commands, i.e. by evaluating the various example functions in REPL.


Bullet World Initialization

Finally, initialize everything.

PP-TUT> (roslisp-utilities:startup-ros)

Note: this can take some time (a few minutes).

If everything is works as it should, the kitchen and PR2 robot should appear in the Bullet World window.


Environment Setup

First, let's set up the environment in our terminal by calling the launch file. This invokes roscore so there is no need to do it manually from a terminal.

$ roslaunch cram_pick_place_tutorial world.launch

There is no need to do this if you've already done it for the Bullet World Demonstration check in the previous section.

REPL Setup

Now, let's load the package in the REPL (in case you have forgotten, REPL stands for Read-Eval-Print Loop).

$ roslisp_repl
CL-USER> (ros-load:load-system "cram_pick_place_tutorial" :cram-pick-place-tutorial)
CL-USER> (in-package :cram-pick-place-tutorial)

Bullet World Initialization

Finally, initialize everything.

PP-TUT> (roslisp-utilities:startup-ros)

Note again: this can take some time (a few minutes).

Simple Fetch and Place Plan

We are ready to do the four parts of the tutorial. These four headings are the same as the headings in the Zero prerequisites demo tutorial: Simple fetch and place.

These correspond to the four steps in the tutorial

  1. Simple Fetch and Place
  2. Recovery from Failures
  3. Handling More Failures
  4. Defining a New Grasp (this comes after Exercise 3, in preparation for Exercise 4)

so do refer to these sections to understand what is going on.

Simple Fetch and Place

Run (move-bottle1)

PP-TUT> (move-bottle1 '((-1.6 -0.9 0.82) (0 0 0 1)))

Recovery from Failures

Run (move-bottle2)

PP-TUT> (move-bottle2 '((-2 -0.9 0.860) (0 0 0 1)))

Handling More Failures

Run (move-bottle3)

PP-TUT> (move-bottle3 '((-1.0 -0.75 0.860) (0 0 0 1)))

Defining a New Grasp

Run (move-bottle4)

PP-TUT> (move-bottle4 '((-1.6 -0.9 0.82) (0 0 0 1)))


Exercises

As mentioned above, there are four dummy functions to help you get started with exercises 1 - 4. At the moment, they don't do anything but you can run them to check.

Exercise 1

Run (move-bottle-exercise-1)

PP-TUT> (move-bottle-exercise-1 '((-1.0 0.75 0.860) (0 0 0 1)))


Exercise 2

Run (move-bottle-exercise-2)

PP-TUT> (move-bottle-exercise-2 '((-1.0 -0.75 0.860) (0 0 0 1)))


Exercise 3

Run (move-bottle-exercise-3)

PP-TUT> (move-bottle-exercise-3 '((-2 -0.9 0.860) (0 0 0 1)))


Exercise 4

Run (move-bottle-exercise-4)

PP-TUT> (move-bottle-exercise-4 '((-1.6 -0.9 0.82) (0 0 0 1)))