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

Palletizing block with different heights

  • jesusvaricap
  • January 12, 2017 at 4:30 AM
  • Thread is Resolved
  • jesusvaricap
    Reactions Received
    4
    Trophies
    4
    Posts
    259
    • January 12, 2017 at 4:30 AM
    • #1

    Hello ,


    KRC1 Vkr200/2
    kss 4.1.14 pp02

    My application its the next :

    stack blocks with different heights max tolerance +/-3cm
    first stack block on vertical position , next block horizontal position , i repeat this operation for 12 stacks.

    i fabricate the gripper , with sensors necessary to do it , and reconfigured 16 I/O digital via DeviceNet

    As the blocks has different heights, and need to be released to 5 mm up ( for the characteristics of the block and characteristics for the gripper )

    My idea its the next:

    -the robot took the first block
    -open the gripper and stack on vertical position (the first block was released at floor)
    -the robot took the second block
    -the robot was moving down, until detect the first stack using a sensor attached to bottom of gripper
    -the robot stop when detect the first stack
    -the robot move up 5mm
    -the robot released the second stack on horizontal
    -the robot took the 3rd block
    -the robot was moving down, until detect the second stack using a sensor attached to bottom of gripper
    -the robot stop when detect the second stack
    -the robot move up 5mm
    -the robot released the 3rd stack on vertical
    .......

    all these was repeated to stack 12 blocks

    Question 1
    how can i transfer to KRL the part :
    -the robot was moving down, until detect the X stack using a sensor attached to bottom of gripper
    -the robot stop when detect the X stack
    ?
    Question 2
    when the sensor was activated how i transfer to KRL
    -the robot move up 5mm
    ?


    Maybe i can use something like this:

    Code
    Home
    ;first stack
    open gripper 
    ptp
    ptp
    lin
    close  gripper
    lin
    ptp 
    ptp
    lin
    open gripper
    lin
    ptp
    ;end first stacking
    
    
    ptp
    ptp
    lin
    close  gripper
    lin
    ptp 
    ptp
    lin
    open gripper
    lin
    ptp
    
    
    detect_stack ()
    move_up_5mm ()
    
    
    Home
    Display More


    Question 3 :
    If its possible , how can i put on a "FOR cicle" to do this 12 times


    Thanks a lot BR,

    Edited once, last by robot_rob (January 12, 2017 at 4:32 AM).

  • Online
    SkyeFire
    Reactions Received
    1,039
    Trophies
    12
    Posts
    9,380
    • January 13, 2017 at 2:06 PM
    • #2

    Expert Programming Manual: https://www.robot-forum.com/robotforum/man…ss-version-5-2/

    Look up: FOR loop, Interrupt, $POS_INT, "Geometric Operator."

  • panic mode
    Reactions Received
    1,267
    Trophies
    11
    Posts
    13,033
    • January 13, 2017 at 6:04 PM
    • #3

    i don't quite follow the process but your program seem to be doing a lot of detecting/scanning and - that is very time consuming.
    did you consider using laser distance sensor? you can take reading instantly and be on your way to pickup or drop part...

    1) read pinned topic: READ FIRST...

    2) if you have an issue with robot, post question in the correct forum section... do NOT contact me directly

    3) read 1 and 2

  • jesusvaricap
    Reactions Received
    4
    Trophies
    4
    Posts
    259
    • January 18, 2017 at 12:08 AM
    • #4

    skyfire, panic mode , thanks a lot for you reply.

    i like the idea to use a laser, did you suggest to me a brand, kind , model laser ?


    But before to bought a laser i like to start using digital inputs, to detect the stack, and instantly stop the robot, then move up 5mm

    As skyfire suggest to me , yes , i know that i need to use the things mentioned before.

    i need to stop the robot using an interrupt:

    Code
    INTERRUPT 1 DECL 1 when $IN[1] do detect_stack ()

    yes , work it , the robot stop , but i need to confirms messages , yes i can configure de aut ExT and assig a diital input to config mess, but i need to made the hardware apropiate when the interupt On

    so inside a program i put the next code :

    Code
    ...
    repeat
    lin {z-1} c_dis
    until $in[1]==true 
    lin {z+5} c_dis
    ...

    the robot moves down with little increments on z negative with low speed , using the parameter $vel.cp=0.010
    until the $IN[1] comes high ! the next process its the robot up on z positive 5mm

    but doesnt work ! :mad: the robot not stop!
    i try using flags

    Code
    ...
    repeat
    lin {z-1} c_dis
    until $flag[1]==true 
    lin {z+5} c_dis
    ...

    on sps put:

    $flag[1]=$out[1]

    attached found the programs for more details.


    BR

    Files

    detect_stack.src 673 Byte – 50 Downloads master.dat 401 Byte – 31 Downloads master.src 1.35 kB – 48 Downloads took_stack.dat 3.74 kB – 33 Downloads took_stack.src 4.43 kB – 47 Downloads
  • hermann
    Reactions Received
    404
    Trophies
    9
    Posts
    2,595
    • January 18, 2017 at 10:11 AM
    • #5

    Your code with the repeat .. until should work.
    But the problem is that the standard value of $advance is 3.
    So Your loop will stop after 3 loops after detecting the signal.
    One 'solution' is to set the $advance to 1 or 0. The value 1 means that the loop will stop after one more loop after detecting the signal, the value zero inhibits the advance and the c_dis statement will have no effect, so the robot will stop after every move.

    In this cases always use an interrupt.
    This is discussed in some other threads.

  • panic mode
    Reactions Received
    1,267
    Trophies
    11
    Posts
    13,033
    • January 18, 2017 at 2:34 PM
    • #6

    this is not going to work...

    for example you are not setting tool and base, so last used inline form motion will determine tool and base.
    this means you are using world coordinate system so your loop will send repeatedly robot to a point that is bellow floor:

    LIN {Z -1} ; note, world origin is at Z=0

    you may want to consider LIN_REL instead of LIN.

    1) read pinned topic: READ FIRST...

    2) if you have an issue with robot, post question in the correct forum section... do NOT contact me directly

    3) read 1 and 2

  • Online
    SkyeFire
    Reactions Received
    1,039
    Trophies
    12
    Posts
    9,380
    • January 18, 2017 at 3:35 PM
    • #7

    The simplistic way:

    Code
    Shift = $NULLFRAME
    Shift.Z = -1.0
    REPEAT
      LIN_REL Shift
    UNTIL (($POS_ACT.Z < MinimumHeight) OR $IN[1])
    WAIT SEC 0
    Shift.Z = 5 + $ADVANCE ; compensate for Advance-run lag
    LIN_REL Shift

    The correct way to handle this is to use interrupts. However, using Interrupts properly requires setting up a chain of subroutines correctly:

    Code
    DEF Main()
      DECL INTERRUPT 10 WHEN $IN[1] DO PartFound
      PTP SearchStartPosition
      SearchMotion()
      ; RESUME command jumps program pointer here
      LIN {X 0,Y 0,Z 5,A 0,B 0,C 0} : $POS_INT ; move to position 5mm above location where $IN[1] was detected
    END
    
    
    DEF SearchMotion()
      INTERRUPT ON 10
      LIN SearchEndPosition ; set this point slightly below the detection height of the lowest part
    END
    
    
    DEF PartFound()
      BRAKE ; halt motion currently in progress
      INTERRUPT OFF 10 ; prevent double triggers
      RESUME ; jump the program pointer back to Main, one line after StartMotion -- this terminates SearchMotion()
    END
    Display More
  • jesusvaricap
    Reactions Received
    4
    Trophies
    4
    Posts
    259
    • January 19, 2017 at 1:56 AM
    • #8

    thanks to all for you reply's Panic mode, hermann , Skyfire

    Skyfire , your example work correctly :flower: :toothy9:
    but with a little changes

    as you see i remove with ";" some parts like:

    Code
    ;lin {x 0 , y 0 , z 100 , a 0 , b 0 , c 0} : $pos_int
    ;shift.z=100 + $advance
    ;lin_rel shift


    and put it :
    shift.z=100 + $advance
    lin_rel shift[/code]

    on the section: "searchmotion ()"
    an add:

    Code
    $VEL.ORI1=100
    $VEL.ORI2=100


    what happend wih the sections
    lin {x 0 , y 0 , z 100 , a 0 , b 0 , c 0} : $pos_int
    shift.z=100 + $advance
    lin_rel shift

    why doesnt work ? why the problem "read protection" ? (picture attached)
    ive not reconfigured tool and base yet , im doing tets on the "air" to avoid crashes

    here the code that work correctly :

    Code
    DEF main( )
    PTP HOME
    INTERRUPT decl 10 when $in[1] do part_found ()
    LIN P2 ;SearchStartPosition
    searchmotion ()
    ;position[i]=$pos_int
    ;lin {x 0 , y 0 , z 100 , a 0 , b 0 , c 0} : $pos_int
    WAIT SEC 1
    shift.z=5 + $advance
    lin_rel shift
    END
    DEF searchmotion ()
    interrupt on 10
    $VEL.ORI1=100
    $VEL.ORI2=100
    LIN P1 ; set this point slightly below the detection height of the lowest part
    search ()
    END
    DEF search ()
    shift=$nullframe
    shift.z=-1.0
    repeat
    lin_rel shift
    ;until (($pos_act.z < 500) or $in[1])
    until $in[1]==true
    ;shift.z=100 + $advance
    ;lin_rel shift
    end
    DEF part_found () 
    BRAKE
    INTERRUPT OFF 10
    RESUME
    Display More

    attahed 2 programs: "main" work correctly and main "main2" appears error read protection

    so , i just need "polish"the program to palletizing 12 stacks wih a for ,op/cl gripper etc

    Images

    • IMG_3922.JPG
      • 97.05 kB
      • 496 × 662
      • 61

    Files

    main.dat 1.67 kB – 33 Downloads main.src 2.96 kB – 49 Downloads main2.dat 1.67 kB – 25 Downloads main2.src 2.8 kB – 32 Downloads IMG_3922.JPG_thumb 29.87 kB – 224 Downloads

    Edited once, last by robot_rob (January 19, 2017 at 2:06 AM).

  • panic mode
    Reactions Received
    1,267
    Trophies
    11
    Posts
    13,033
    • January 19, 2017 at 4:18 AM
    • #9

    no offense but this has no hope of working in this form, some major reconstruction is needed :icon_frown:

    in order to write working programs, one must read manuals and understand what each instruction does...

    some of the notable issues include:

    adding $advance to position variable makes no sense,
    $POS_INT is only usable inside interrupt subroutine (this is why you get the message)
    there is nothing to turn off interrupt after search (if interrupt was not triggered during search - it remains active... this is how you crash robot! worse - this can happen weeks after programming was "complete").
    there is no need to do loop etc inside search motion - single long motion instruction is all you need, no point in "inching" (moving mm by mm).
    there is no need to check for $in[1] inside search routine
    there is nothing to keep advance run pointer inside search routine during search,

    1) read pinned topic: READ FIRST...

    2) if you have an issue with robot, post question in the correct forum section... do NOT contact me directly

    3) read 1 and 2

    Edited once, last by panic mode (January 19, 2017 at 5:32 AM).

  • Online
    SkyeFire
    Reactions Received
    1,039
    Trophies
    12
    Posts
    9,380
    • January 19, 2017 at 6:37 PM
    • #10

    To be fair, most of those mistakes are mine -- I was just dashing off some concept-example code that was never intended to be fully bulletproof.

    Forgot about that $POS_INT quirk. Need to record it to another variable inside the interrupt routine. And add a WAIT SEC 0 or something to the Search routine.

    And yes, I neglected turning off the Interrupt in the event of a failed search. :grinning-smiley:

    Adding $ADVANCE to the position variable was to compensate for the "overshoot" effects of the Advance pointer when using a simple 1mms/step search routine (which I forgot to put C_DIS on, :waffen100:)

  • jesusvaricap
    Reactions Received
    4
    Trophies
    4
    Posts
    259
    • January 20, 2017 at 11:06 PM
    • #11

    panic mode, thanks for your advices! :top:

    of course , i need to reconstrcut it
    about:
    there is nothing to turn off interrupt after search (if interrupt was not triggered during search - it remains active... this is how you crash robot! worse - this can happen weeks after programming was "complete").
    yes i need to create something to prevent it
    there is no need to do loop etc inside search motion - single long motion instruction is all you need, no point in "inching" (moving mm by mm).
    yes, maybe i just need to move the robot on "-z" , and ON an interrupt , the interrupt was triggered when $in[1]
    there is no need to check for $in[1] inside search routine
    ??? did you reefer to use an iterupt?
    there is nothing to keep advance run pointer inside search routine during search
    the stack need to delivery up 5mm (the tongs of the gripper interfere with the stack from the down ), als as skyfire say to compensate for the "overshoot" effects

    thanks.

  • panic mode
    Reactions Received
    1,267
    Trophies
    11
    Posts
    13,033
    • January 20, 2017 at 11:30 PM
    • #12
    Quote


    there is no need to check for $in[1] inside search routine
    ??? did you reefer to use an interrupt?

    no, I mentioned loop that is inside SEARCH()

    Code
    repeat
    lin_rel shift
    ;until (($pos_act.z < 500) or $in[1])
    until $in[1]==true

    when $IN[1] turns true, ISR is called, RESUME command kills everything bellow level where interrupt is declared and program returns to MAIN(), just after SEARCHMOTION()

    so inside SEARCH() code after loop never happens either

    Code
    shift.z=100 + $advance
    lin_rel shift

    1) read pinned topic: READ FIRST...

    2) if you have an issue with robot, post question in the correct forum section... do NOT contact me directly

    3) read 1 and 2

  • Online
    SkyeFire
    Reactions Received
    1,039
    Trophies
    12
    Posts
    9,380
    • January 23, 2017 at 4:37 PM
    • #13

    Okay, those were two different examples of how to go about this.

    The loop-search was the primitive but easy method. The Interrupt-based search is better, but more complicated. These two programs do not mix. SearchMotion() and PartFound() are part of the interrupt-driven method. Search() is the loop-based method. You cannot use both.

  • panic mode
    Reactions Received
    1,267
    Trophies
    11
    Posts
    13,033
    • January 25, 2017 at 8:24 PM
    • #14

    that may be intention but it is not how they work.
    in both cases SEARCHMOTION() calls SEARCH(), both use interrupt with $IN[1] and in both examples there is a loop evaluating same input as used as interrupt condition.

    1) read pinned topic: READ FIRST...

    2) if you have an issue with robot, post question in the correct forum section... do NOT contact me directly

    3) read 1 and 2

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