Programs: Difference between revisions

From Industrial Robotics & Automation - Fanuc Teach Pendant Programming
Content added Content deleted
No edit summary
Line 5: Line 5:




==== Setup Section ====
== 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 can do this quickly using a single register instruction.
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 can do this quickly using a single register instruction.


Line 14: Line 14:
<br />
<br />


==== Intro Motion ====
== 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 singularity.
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 singularity.


Line 21: Line 21:
<br />
<br />


====Inputs ====
==Inputs ==


While inputs can be read anywhere in your program, it can be helpful to organize them into a small section that can be run through at points where it really matters. In this example, we have 4 inputs waiting to go ON. These could represent 4 different conveyors coming to the robot.
While inputs can be read anywhere in your program, it can be helpful to organize them into a small section that can be run through at points where it really matters. In this example, we have 4 inputs waiting to go ON. These could represent 4 different conveyors coming to the robot.
Line 37: Line 37:
<br />
<br />


==== Configuration ====
== Configuration ==


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.
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.
Line 66: Line 66:


<br />
<br />
==== Motion ====
== Motion ==


Your motion lines should be efficient and minimalist. Anything that can be done with a new tool frame, user frame, offset, and registers should be, instead of having lots of similar motion lines.
Your motion lines should be efficient and minimalist. Anything that can be done with a new tool frame, user frame, offset, and registers should be, instead of having lots of similar motion lines.


'''J P[1] 100% Fine OFFSET PR[10]'''
'''J P[1] 100% Fine'''


'''L P[2] 222mm/s Fine OFFSET PR[10]'''
'''L P[2] 222mm/s Fine OFFSET PR[10]'''
Line 78: Line 78:
'''L P[3] 222mm/s Fine OFFSET PR[10]'''
'''L P[3] 222mm/s Fine OFFSET PR[10]'''


'''C P[8] 222mm/s Fine OFFSET PR[10] ...P[6] R[11] Fine OFFSET PR[10]'''
'''C P[8] OFFSET PR[10]'''


'''... P[6] R[11] 222mm/s Fine OFFSET PR[10]'''



==== Notes ====

== Notes ==
The program listed above could have been done much more simply with a group input and a SELECT instruction. It was left as IF statements for simplicity in understanding.
The program listed above could have been done much more simply with a group input and a SELECT instruction. It was left as IF statements for simplicity in understanding.

Revision as of 23:23, 1 July 2019

Teach pendant programs are generally simplistic, following much of the same structure as other programming languages.

It's a good idea to break your program into sections as listed below, to help organize your code.


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 can do this quickly using a single register instruction.

Examples:

PR[5]=PR[5]-PR[5]


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 singularity.

J P[1:Home] 20% FINE


Inputs

While inputs can be read anywhere in your program, it can be helpful to organize them into a small section that can be run through at points where it really matters. In this example, we have 4 inputs waiting to go ON. These could represent 4 different conveyors coming to the robot.

IF DI[101] = ON JMP LBL[4]

IF DI[102] = ON JMP LBL[5]

IF DI[103] = ON JMP LBL[6]

IF DI[104] = ON JMP LBL[7]

JMP LBL[8]


Configuration

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.

LBL [4]

PR[10,3] = 5

R[12] = R [12] + 1

LBL [5]

PR[10,3] = 7

R[12] = R [12] + 2

LBL [6]

PR[10,3] = 25

R[12] = R [12] + 1

LBL [7]

PR[10,3] = 33

R[12] = R [12] + 2


Motion

Your motion lines should be efficient and minimalist. Anything that can be done with a new tool frame, user frame, offset, and registers should be, instead of having lots of similar motion lines.

J P[1] 100% Fine

L P[2] 222mm/s Fine OFFSET PR[10]

L P[5] R[11] Fine OFFSET PR[10]

L P[3] 222mm/s Fine OFFSET PR[10]

C P[8] OFFSET PR[10]

... P[6] R[11] 222mm/s Fine OFFSET PR[10]


Notes

The program listed above could have been done much more simply with a group input and a SELECT instruction. It was left as IF statements for simplicity in understanding.