Machines

Pick & Place

Pick & Place is one of the most fundamental automation tasks. Master it and you'll understand axis coordination, timing, gripper control, and state machine design that applies across all automation.

📺 Video Lesson

The Concept

A Pick & Place system moves parts from a source to a destination. Even complex robots follow the same fundamental 7-step cycle. Understanding this cycle is the foundation of all automation sequencing.

🏠
Home
Safe starting position
Move to Pick
Go to part location
🤏
Grip
Activate gripper
Lift
Retract Z with part
Move to Place
Travel to destination
📦
Release
Deposit part
Return
Back to Home

🤖 Live Simulator

Control the robot: run the full auto-cycle, step through states manually, or trigger an E-Stop.

State: HOME   Placed: 0

// Ready — press ▶ Auto Cycle to start.

Sequence Diagram

Draw a sequence diagram before writing code. This shows every axis and I/O over time — revealing timing gaps, interlocks, and parallel actions.

Step Z Axis X Axis Gripper Sensor HOME OPEN MV_PICK OPEN WAIT GRIP CLOSED OK LIFT CLOSED MV_PLACE CLOSED RELEASE CLOSED RETURN OPEN

State Machine

Implement the sequence with a single integer variable state. One CASE block handles everything — safe, readable, and easy to extend.

ST — State Constants
VAR_GLOBAL CONSTANT
  ST_HOME    : INT := 0;   ST_MV_PICK  : INT := 1;
  ST_GRIP    : INT := 2;   ST_LIFT     : INT := 3;
  ST_MV_PLACE: INT := 4;   ST_RELEASE  : INT := 5;
  ST_RETURN  : INT := 6;
END_VAR

Complete ST Implementation

Structured Text
CASE state OF

  ST_HOME:
    IF cycle_start AND part_present THEN
      state := ST_MV_PICK;
    END_IF;

  ST_MV_PICK:
    x_setpoint := PICK_X;  z_setpoint := PICK_Z;
    IF x_in_pos AND z_in_pos THEN  state := ST_GRIP;  END_IF;

  ST_GRIP:
    gripper_close := TRUE;
    grip_timer(IN := TRUE, PT := T#300ms);
    IF grip_timer.Q THEN
      IF gripper_feedback THEN  state := ST_LIFT;
      ELSE  alarm_no_part := TRUE;  state := ST_HOME;
      END_IF;
    END_IF;

  ST_LIFT:
    z_setpoint := LIFT_Z;
    IF z_in_pos THEN  state := ST_MV_PLACE;  END_IF;

  ST_MV_PLACE:
    x_setpoint := PLACE_X;
    IF x_in_pos THEN  state := ST_RELEASE;  END_IF;

  ST_RELEASE:
    gripper_close := FALSE;
    release_timer(IN := TRUE, PT := T#200ms);
    IF release_timer.Q THEN
      parts_placed := parts_placed + 1;
      state := ST_RETURN;
    END_IF;

  ST_RETURN:
    x_setpoint := HOME_X;  z_setpoint := HOME_Z;
    IF x_in_pos AND z_in_pos THEN  state := ST_HOME;  END_IF;

END_CASE;

(* Safety: E-Stop always takes priority *)
IF emergency_stop THEN
  gripper_close := FALSE;
  state := ST_HOME;
END_IF;

✏ Exercise

Exercise

Add a vision quality check after GRIP. If part_ok = FALSE, route to a reject bin. What constant name should you add following the existing naming convention?

Follow the pattern ST_[ACTION]. The action is rejecting (moving to the reject bin).