# Create Pick&Place program¶

The following chapter contains variants of a Pick&Place program that build on each other:

1. Create a basic Pick&Place program
2. Extension: Movement Optimization
5. Extension: Add case distinction and user dialog

## Create a basic Pick&Place program¶

What you will learn

• Gripping and placing workpieces
• Parameterize robot movements
• Use of loops and conditions
• Use of input parameters and user dialogs

Error message during program execution

If individual waypoints in the programs are too far apart, the robot can no longer perform the movement. This results in an error message ("Command Error"). This can be corrected by reducing the distances between the waypoints or by inserting intermediate points.

### Step-by-step Guide¶

1. Go to the Programs section.

2. Klick on and name the program.

3. Drag a Move Cartesian function block into the program and name it "Home Position".

4. In this function block, parameterize the desired starting position using the Trajectory Wizard.

#### Approach position¶

1. Now add another Move Cartesian block and define the following two waypoints:

a) The approach position above the workpiece to be gripped.

b) The gripping position directly on the workpiece.

For the approach position this could look like this:

2. To grip the workpiece, now drag the function block Simulator Gripper - Close into the program.

3. Execute the program to be able to determine the placing position with the workpiece in the next step.

#### Placing position¶

1. For the placing position: Duplicate the last Move Cartesian block and drag it to the end of the program.

2. Parameterize the function block.

3. In the Trajectory Wizard, replace the gripping position (second waypoint) with the first approach point for the placing position. This must be in front of the machine.

4. Define a second approach point directly above the placing point, as well as the placing point itself.

5. Now drag Simulator Gripper - Open into the program.

6. Duplicate the previous Move Cartesian block and delete the existing waypoints except for the approach positions.

7. Swap the two approach positions to move the robot out of the machine.

8. Now copy the block Home Position from step 3 so that the robot returns to it at the end.