> For the complete documentation index, see [llms.txt](https://docs.robpod.cloud/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.robpod.cloud/hmi-designer/working-examples/universal-robots/pick-and-place-example.md).

# Pick and Place Example

**HMI Panel File**

<figure><img src="/files/6I7nGuvkjDOXvimCRbwV" alt=""><figcaption></figcaption></figure>

{% file src="/files/1WyAXgZXQSEE1AcEWkeK" %}

**Robot Program File**

```python
# variables
global velocity = 200
global loop_forever = False
global repetitions = 2
global gripper_status = "ACTIVATED"
global counter = 0
global aborted = False
global completed = False
global status = "READY"

# positions (can be defined also as installation variables to store their value)
global pick_pose = p[0, 0, 0, 0, 0, 0]
global place_pose = p[0, 0, 0, 0, 0, 0]

# functions
def open_gripper():
    if gripper_status == "ACTIVATED":
        textmsg("open")
        #rq_open()
    end
end

def close_gripper():
    if gripper_status == "ACTIVATED":
        textmsg("close")
        #rq_close()
    end
end

def pick(pose):
    if not aborted:
        status = "PICKING"
        approach = pose_trans(pose, p[0, 0, -0.1, 0, 0, 0])
        movel(approach, a=0.1, v=velocity/1000)
        movel(pick_pose, a=0.1, v=velocity/1000)
        close_gripper()
        movel(approach, a=0.1, v=velocity/1000)
    end
end

def place(pose):
    if not aborted:
        status = "PLACING"
        approach = pose_trans(pose, p[0, 0, -0.1, 0, 0, 0])
        movel(approach, a=0.1, v=velocity/1000)
        movel(pick_pose, a=0.1, v=velocity/1000)
        open_gripper()
        movel(approach, a=0.1, v=velocity/1000)
    end
end

def start_task():
    global counter = 0
    global aborted = False
    global completed = False
    while (not aborted) and (loop_forever or counter < repetitions):
        pick(pick_pose)
        place(place_pose)
        pick(place_pose)
        place(pick_pose)
        counter = counter + 1
    end
    completed = True
    status = "READY"
end

def stop_task():
    global aborted = True
    status = "STOPPING..."
    while not completed:
        sleep(0.1)
    end
end
```

{% file src="/files/fgMjMPGTlyVEKzp37eeS" %}
