Why do people not know how to use functions?
Literally reducing the size of this robot program by like... 75% by making a function to pack two bytes into a 16-bit register, rather than doing it online every single time.
Also...Universal Robots, why does UR Script not have bitshift or bitwise operators? Seriously. My function literally has to use the builtin `integer_to_booleans(...)` function, assign individual bools to the right spots in a temporary array, and then `booleans_to_integer(...)` back.
This *could* have just been python. You clearly tried to use similar syntax. And yet...
I have thus far trimmed 12078 lines from the program and replaced them with 13 functions totalling around 56 lines.
Included in the lines that did not get replaced were 151 copies of time-based wait commands used in the pattern "Send command signal to external device; Wait 0.5s; Wait on reply signal from the device; do stuff" because why do we need time waits when we have hardware signal interlocks?