> 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="https://175138337-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fvxlh3prlGsBGF30oqbYW%2Fuploads%2FqlKWdzLnT8YkSCuJdogD%2Fimmagine.png?alt=media&amp;token=c3c17c78-c3ad-4925-8c78-0ce2ef2731dc" alt=""><figcaption></figcaption></figure> <figure><img src="https://175138337-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fvxlh3prlGsBGF30oqbYW%2Fuploads%2FTalX4r48urD5jFYcaNDA%2Fimmagine.png?alt=media&amp;token=9ab9451a-eb11-4b6b-b28b-845656d13c0c" alt=""><figcaption></figcaption></figure></div>

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

**Robot Program File**

<figure><img src="https://175138337-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fvxlh3prlGsBGF30oqbYW%2Fuploads%2Fo4xZ9n6PUWdGqh88V6Fz%2Fimmagine.png?alt=media&amp;token=11573ad2-f69a-4098-b410-fff17a83847a" 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" %}
