(!) Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.

Running the portrait bot

Description: A tutorial on how to run the portrait_bot stack on the PR2 and the basestation.

Tutorial Level: BEGINNER


For this tutorial you will need:

  • a PR2 Robot
  • a canvas (for example a whiteboard on a table)
  • a thick and at least 10 cm long pen (the PR2 must be able to hold it in its grippers)
  • a surface to put the pen on (for example the canvas)
  • a well lit room
  • enough room around the PR2
  • at least two persons (one at the basestation, and a photo victim)

The image below shows the environment setup:

  • the pen is in front of the robot
  • the pen is reachable by the robot's right arm

prepare the pr2: the pen is in front of the pr2 and in range of his hand


Launching the environment

Execute this command on the PR2

roslaunch face_finder pr2.launch

and execute

roslaunch face_finder basestation.launch

on the basestation.

The following GUI will display: main window initial

Taking the pen

  1. Put the pen standing on a surface in front of the PR2 (should be reachable by the right gripper).
  2. Make sure that no other higher objects are standing on the surface.
  3. Make sure there is enough room around the PR2 (enough so that the arms can't hit anything if they move around).
  4. Press the "Take Pen" button on the GUI on the basestation and make sure that the arm does not hit anything.
  5. Wait until the PR2 has taken the pen.

pr2 taking the pen

Taking a picture

  1. Press the "Reset head position" button.
  2. Let a person stand in front of the cameras.
  3. You should see rectangles around the found faces on the GUI (the wide_stereo stream is displayed in the middle of the GUI).
  4. Leftclick on the face you want to use. This configures the laser scanner and head.
  5. Wait for about 5 seconds to give the laser scanner time to scan the face. The person in front of the camera must stand still during this period.
  6. Rightclick on the rectangle to take a picture and calculate a mask. This could take a while, so be patient. The mask is displayed in the right part of the window and the original image on the left part.
  7. Check if the mask is ok (it should be black around the area of the face and white everywhere else), otherwise take another picture.

good mask

bad mask

bad mask

good mask

bad mask

bad mask

  1. Now you can press the button "Compute Edges".

Extracting the face contours

  1. After you have taken a picture, press the button "Compute Edges".
  2. Wait until it is done calculating different possibilities.
  3. Now it should open a GUI, which shows you different proposals:image selection
    Click on the proposal you think is the best.

  4. Now you can move the areas (the selected area is surrounded with a red rectangle) and change the parameters. To move an area select it in the drop down menue and click on the image to move it (the new position you would move the area to is surrounded with a blue rectangle). You can also play around with the parameters for the area, this is a bit tricky. In general the parameters will behave as follows:
    1. blur width and blur height: The higher these parameters are, the smoother the lines will be. But also a lot of lines will vanish if you make this too high.

    2. threshold1 and threshold2: If these values are high, less lines will be displayed. If they are low, more lines will be displayed.

    3. search radius: This will connect line endpoints with other lines in the search radius (in pixels).

    4. min line length: All lines that have less pixels than this number, will be deleted.

    If you want to generate a new image with the selected parameters press the "Apply" button. You can also turn "Immediately apply changes" on. If you do so the image gets updated whenever on of the parameter values changes. But this makes the GUI very slow.
  5. You can rate your result, this will improve the last proposal in the future. parameter adjustment and raiting in an image settings frame

  6. Press "Commit" to send the result back to the main GUI.
  7. Now the edge image is displayed on the right side of the window.

Drawing the picture

Note: Drawing is currently only tested with surfaces that lie flat in front of the robot. We use a white board on a table.

  1. Press the button "Set Corner".
  2. Now you have to take the gripper to the top left corner of your canvas, so that the pen is pressed onto the canvas. Then press the button.
  3. Now the same for the other corners (based on the instructions on the screen)
  4. Finally press the "Draw Image" button and wait until the robot has finished drawing. You will see an output in the GUI telling you how many lines there are left.

Note: The last three lines will always be the proud PR2 signing his drawing with "PR2".

pr2 robot drawing a portrait

Wiki: portrait_bot/Tutorials/Running the portrait bot (last edited 2011-05-10 17:30:19 by NikolausMayer)