> 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/machine-tending-psx-example.md).

# Machine Tending PSX Example

**HMI Panel File**

<div><figure><img src="/files/co8I5K6QhjsFn1ZTufv5" alt=""><figcaption></figcaption></figure> <figure><img src="/files/4SBgC9SFSZDZ5NGSbSgf" alt=""><figcaption></figcaption></figure></div>

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

**Robot Program File**

<figure><img src="/files/wcLPaoMUd1Lb9gD8kTeh" alt=""><figcaption></figcaption></figure>

{% code overflow="wrap" lineNumbers="true" expandable="true" %}

```python
status = "READY"
good = 230
discarded = 13
cycle_time = 0
target = 560
parts = ["P-CL-5055", "P230", "P-FS-6060", "P-GG-5043"]
machine_programs = ["PROG-CL-5055", "PROG-230", "CC-FS-6060", "MACH-5034"]
payloads = [2.0, 2.5, 3.0, 1.5]
selected_part = parts[0]

diameter_raw = 50
diameter_machined = 30

door_open = True

rows = 3
columns = 4
grids = ["3 x 4 Round", "3 x 5 Round", "4 x 5 Square"]
selected_grid = grids[0]

def get_payload():
    i = 0
    while i < length(parts):
    	if selected_part == parts[i]:
            return payloads[i]
    	end
    	i = i + 1
    end
	return 0.0
end

def get_machine_program():
    i = 0
    while i < length(parts):
    	if selected_part == parts[i]:
            return machine_programs[i]
    	end
    	i = i + 1
    end
	return ""
end

def get_grid():
    i = 0
    while i < length(grids):
    	if selected_grid == grids[i]:
            return grids[i]
    	end
    	i = i + 1
    end
	return ""
end

def load_grid():
    rows = to_num(str_sub(selected_grid,0,1))
    columns = to_num(str_sub(selected_grid,4,1))
end

# compete those function with robot motions
def pick():
	status = "PICKING"
	sleep(2)
end

def load():
	status = "LOADING"
	sleep(2)
end

def place():
	status = "PLACING"
	sleep(2)
end

def start():
    while good < target:
        start_time = time().sec
        pick()
        load()
        place()
        good = good + 1
        cycle_time = time().sec - start_time
    end
end


```

{% endcode %}

{% file src="/files/0z6qNkMRbtohCgPJwqt3" %}
