Is there any way to unset a variable?

  • KRC2, KSS5.x.


    I've prepared a palletizing program that has been working for days now...


    All day they have been making parts and "suddenly" the robot started rotating the 6th axis while going to pick the part.


    I'm sure they have made a modification in the program... But tomorrow I will confirm it.


    There are 3 points to get a box:


    1. Approximation (pPre1).

    2. Vacuum cups almost touching the box (to allow them to adjust the cups if needed) (pPre2).

    3. Pick position (p).


    In the first point I've set the T value, the other 2 ones have not...


    I assign the coordinates this way:



    The robot starts rotating going from pPre1 to pPre2... which should not as the point has the same coords except from Z and T (which pPre1 has initialized and pPre2 has not).

    As you can see I've not updated the T parameter of "pPre2" nor "p"...

    Of course, if they have touched up the position the S and T will have appeared and therefore the robot could want to go to the destination position...

    I can solve it by accessing the $Config.dat file and remove it manually, but... could I do it programatically?


    If that would be possible I would be able to program a small routine to leave the points as I want before starting the program.


    As always thank you in advance.

  • >> " Is there any way to unset variable?"


    not that i know of... but you can create new runtime variable and not initialize parts you don't care about which i believe is what you are trying to do.


    ;P1 is fully initialized for example P1=$POS_ACT

    PTP P1 ; move to P1 (using all elements of the P1 which is usually E6POS), including Turn value

    P1 = WithoutTurn(P1) ; update P1 but ignore (unsets) Turn for example

    PTP P1 ; now we have no turn value programmed....



    DEFFCT E6POS WithoutTurn(P:in)

    DECL E6POS P, temp

    temp.X = P.X ; selectively copy elements of P. elements not copied will be uninitialized

    temp.Y = P.Y

    temp.Z = P.Z

    temp.A = P.A

    temp.B = P.B

    temp.C = P.C

    temp.S = P.S

    ; temp.T is not initialized

    temp.E1 = P.E1

    temp.E2 = P.E2

    temp.E3 = P.E3

    temp.E4 = P.E4

    temp.E5 = P.E5

    temp.E6 = P.E6

    RETURN temp

    ENDFCT

    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