1. Home
    1. Dashboard
    2. Search
  2. Forum
    1. Unresolved Threads
    2. Members
      1. Recent Activities
      2. Users Online
      3. Team Members
      4. Search Members
      5. Trophys
  3. Articles
  4. Blog
  5. Videos
  6. Jobs
  7. Shop
    1. Orders
  • Login or register
  • Search
This Thread
  • Everywhere
  • This Thread
  • This Forum
  • Articles
  • Pages
  • Forum
  • Blog Articles
  • Products
  • More Options
  1. Robotforum - Support and discussion community for industrial robots and cobots
  2. Forum
  3. Industrial Robot Support and Discussion Center
  4. Fanuc Robot Forum
Your browser does not support videos RoboDK Software for simulation and programming
Visit our Mainsponsor
IRBCAM
Robotics Channel
Robotics Training
Advertise in robotics
Sponsored Ads

Fanuc TP unordered array management?

  • Tony R.
  • July 16, 2021 at 8:36 AM
  • Thread is Unresolved
  • Tony R.
    Reactions Received
    1
    Trophies
    2
    Posts
    38
    • July 16, 2021 at 8:36 AM
    • #1

    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:

    Code
    VAR
     ArrayStartPositions [10] OF INTEGER
     ArrayEndPositions [10] OF INTEGER
    BEGIN
     //Initialize current (start) positions and final (end) position arrays
     R1 = 1 //first start position count
     R2 = 1 //first end position count
     R3 = 0 //no part clamped
     
     FOR R1 <= ArrayStartPositions.SIZE , R1++
     | IF ArrayStartPositions [ R1 ] = 1
     | THEN
     | | J PR[R1] 100% CNT100 Offset , PR[1] // offset height
     | | L PR[R1] 500mm/sec FINE
     | | CALL PICKUP
     | | L PR[R1] 100% CNT100 Offset , PR[1] // offset height
     | | R3 = 1
     | |
     | | FOR R2 <= ArrayEndPositions.SIZE , R2++
     | | | IF ArrayStartPositions [ R1 ] = 1
     | | | THEN
     | | | | J PR[R2] 100% CNT100 Offset , PR[1] // offset height
     | | | | L PR[R2] 500mm/sec FINE
     | | | | CALL DROP
     | | | | L PR[R2] 100% CNT100 Offset , PR[1] // offset height
     | | | | R3 = 0
     | | | ENDIF
     | | ENDFOR
     | ENDIF
     ENDFOR
     
     IF R3 = 1
     THEN
     | J P[1] 100% CNT100 Offset , PR[1] // offset height
     | L P[1] 500mm/sec FINE
     | CALL DROP
     | L P[1] 100% CNT100 Offset , PR[1] // offset height
     | R3 = 0
     ENDIF
    END
    Display More

    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

  • HawkME
    Reactions Received
    568
    Trophies
    10
    Posts
    3,268
    • July 16, 2021 at 12:43 PM
    • Best Answer
    • #2

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

  • Tony R.
    Reactions Received
    1
    Trophies
    2
    Posts
    38
    • July 16, 2021 at 1:22 PM
    • #3
    Quote from HawkME

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

    Display More

    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:

  • HawkME
    Reactions Received
    568
    Trophies
    10
    Posts
    3,268
    • July 16, 2021 at 1:30 PM
    • #4

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

  • Tony R.
    Reactions Received
    1
    Trophies
    2
    Posts
    38
    • July 17, 2021 at 12:59 PM
    • #5
    Quote from HawkME

    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?

  • HawkME
    Reactions Received
    568
    Trophies
    10
    Posts
    3,268
    • July 17, 2021 at 7:57 PM
    • #6

    I don't recall if you can indirectly address Points. Typically I use PRs for that.

  • Tony R.
    Reactions Received
    1
    Trophies
    2
    Posts
    38
    • July 19, 2021 at 5:03 AM
    • #7

    I see. Thanks anyways!

  • SkyeFire
    Reactions Received
    1,044
    Trophies
    12
    Posts
    9,391
    • July 20, 2021 at 12:31 AM
    • #8
    Quote from HawkME

    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]]  

Advertising from our partners

IRBCAM
Robotics Channel
Robotics Training
Advertise in robotics
Advertise in Robotics
Advertise in Robotics

Job Postings

  • Anyware Robotics is hiring!

    yzhou377 February 23, 2025 at 4:54 AM
  • How to see your Job Posting (search or recruit) here in Robot-Forum.com

    Werner Hampel November 18, 2021 at 3:44 PM
Your browser does not support videos RoboDK Software for simulation and programming

Tag Cloud

  • abb
  • Backup
  • calibration
  • Communication
  • CRX
  • DCS
  • dx100
  • dx200
  • error
  • Ethernet
  • Ethernet IP
  • external axis
  • Fanuc
  • help
  • hmi
  • I/O
  • irc5
  • IRVIsion
  • karel
  • kawasaki
  • KRC2
  • KRC4
  • KRC 4
  • KRL
  • KUKA
  • motoman
  • Offset
  • PLC
  • PROFINET
  • Program
  • Programming
  • RAPID
  • robodk
  • roboguide
  • robot
  • robotstudio
  • RSI
  • safety
  • Siemens
  • simulation
  • SPEED
  • staubli
  • tcp
  • TCP/IP
  • teach pendant
  • vision
  • Welding
  • workvisual
  • yaskawa
  • YRC1000

Thread Tag Cloud

  • abb
  • Backup
  • calibration
  • Communication
  • CRX
  • DCS
  • dx100
  • dx200
  • error
  • Ethernet
  • Ethernet IP
  • external axis
  • Fanuc
  • help
  • hmi
  • I/O
  • irc5
  • IRVIsion
  • karel
  • kawasaki
  • KRC2
  • KRC4
  • KRC 4
  • KRL
  • KUKA
  • motoman
  • Offset
  • PLC
  • PROFINET
  • Program
  • Programming
  • RAPID
  • robodk
  • roboguide
  • robot
  • robotstudio
  • RSI
  • safety
  • Siemens
  • simulation
  • SPEED
  • staubli
  • tcp
  • TCP/IP
  • teach pendant
  • vision
  • Welding
  • workvisual
  • yaskawa
  • YRC1000

Tags

  • TP programming
  • Karel programming
  • ER-4ia

Users Viewing This Thread

  • 1 Guest
  1. Privacy Policy
  2. Legal Notice
Powered by WoltLab Suite™
As a registered Member:
* You will see no Google advertising
* You can translate posts into your local language
* You can ask questions or help the community with your knowledge
* You can thank the authors for their help
* You can receive notifications of replies or new topics on request
* We do not sell your data - we promise

JOIN OUR GREAT ROBOTICS COMMUNITY.
Don’t have an account yet? Register yourself now and be a part of our community!
Register Yourself Lost Password
Robotforum - Support and discussion community for industrial robots and cobots in the WSC-Connect App on Google Play
Robotforum - Support and discussion community for industrial robots and cobots in the WSC-Connect App on the App Store
Download