Programs: Difference between revisions
Content added Content deleted
No edit summary |
|||
Line 6:
== Setup Section ==
The first lines of a program should be your setup instructions. This often means zeroing registers and setting constants to be used later. It's also a good idea to set all your outputs to ideal conditions. We
We can zero entire position registers easily using a single register instruction.
Examples:
'''PR[
<br />
== Intro Motion ==
It can be useful to include motion instructions that take your robot to a known position, in case of power failure or a prior program leaving off in a weird place. Use a Joint move to ensure you don't enter [https://www.universal-robots.com/how-tos-and-faqs/faq/ur-faq/what-is-a-singularity-42311/ singularity].
'''J P[1:Home] 20% FINE'''
<br />
[[File:Start button.jpg|thumb]]
==
Since when looping, you aren't likely to want it to go home every single time and don't want to zero your registers each time, we will begin our loop here. We will jump to this label later in the program, with JMP LBL[1]
'''
Everything inside the loop will occur over and over. In this example, we only want it to repeat when we press a "Start" button.
'''
== Configuration ==
[[File:Knob.jpg|thumb]]
Depending on program state, input values, counts, times, and other variables - you can set up configuration data to match. This lets you run short, efficient motion instructions with few or no special sections. In this example, an analog input, AI[1] is read and applied to the Z element (element 3) of our position register. Note that this part isn't reached until someone presses that "Start" button above, so the technician will set the analog value with a knob and THEN press start.▼
▲Depending on program state, input values, counts, times, and other variables - you can set up configuration data to match. This lets you run short, efficient motion instructions with few or no special sections.
Any changes to the knob after starting won't affect the motion until the next loop, so the technician could actually begin entering the next value on the knob immediately.<br />
▲'''PR[10,3] = 5'''
== Motion ==
|