Fanuc TP unordered array management?

  • Hi y'all,


    I'm Tony, I'm 19 and I'm learning on an ER-4ia. I need to do some simple part moving, using unknown sets and irregular plates to place them on. I come from computer science town, so pardon me for using C# expressions where I lack Karel/TP syntax! I've also learned CNC gcode, although it might not help here...


    I could write a simple point-to-point with pick-and-drop RO commands, but that would be exasperating to write and a nightmare to edit for every set of plates. Instead, I would like to go for something a little more KAREL-ly, perhaps some sort of:

    How would I approach this? Can TP programs be programmed with arrays like this? Or should I try Karel, although harder to simulate and backplot?


    Thanks in advance,

    |

    Tony

  • Place your Ad here!
    • Helpful

    You can do it in TP.


    There is no defining variables in TP. You use the already preexisting Registers and PR's.


    There is a For loop in TP, that you use with Registers.


    FOR R[1] = 1 to R[10]

    .....

    ENDFOR


    That for loop will initialize R[1] to 1, then loop and increment by 1 until it reaches the value of R[10].



    Your arrays will just be a block of PRs. The entire list of PRs and Rs is already an indexable array. You can indirectly index a PR by doing this: PR[R[1]].


  • Thanks man!


    I got a simple version running; the holes can be marked 1 or 0 for the R registers corresponding to the holes on the plate:

  • Nice! You don't actually need line 4. The For loop will always initialize the Register to 1.

    Interesting…


    I was wondering whether there’s there a way to write this without so many PR’s. Would P[R[1]] be a valid way to write points for perhaps a given PR Userframe? Or would it be more trouble than it's worth?

  • I don't recall if you can indirectly address Points.

    You can, at least in 8.3 and later. I used that recently -- passed an integer to a subroutine that was dedicated to hold a big batch of hand-taught points. The specific point number was indirectly referenced using a GI and loaded into a PR that the higher-level program then used. It was for a program that did a lot of sort-of palletizing, but with irregular spacing that required hand-taught points.


    Code
    R[210]=GI[8]    
    PR[112]=P[R[210]]  

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account
Sign up for a new account in our community. It's easy!
Register a new account
Sign in
Already have an account? Sign in here.
Sign in Now

Advertising from our partners