help to palletize program!

  • hello guyz. I am new robot programming. I am sorry to ask some weird question :smiling_face: I hope I can found help. I have a project that I will program palletizing robot. so, I am using KRC 4. there are some problems in code maybe need someting. when the robot goes home position to start position and see sensor is true, then it is going to pick place.
    -but when it is going there,if sensor become again false, the robot is stopped.
    -after it puts the piece,it goes again the same start place. I want it to go -50 z direction. (it should remembers to pick point and goes to next one)
    -the same problem is in the put place. it goes to same point to put.



    so,what should I do? The problem is in code or what? plz help me guyz.



    ----------------------------------------------------------------------------------------------
    DEF prog( )
    INI
    ;definiton interrupts


    INTERRUPT DECL 10 WHEN $IN[01]==FALSE DO piece_control()
    INTERRUPT DECL 11 WHEN $IN[01]==TRUE DO piece_found()


    PTP HOME Vel= 100 % DEFAULT


    $ADVANCE=3


    ;come search start point (ssp=start search point)
    PTP Pssp Vel= 100 % PDAT1 Tool[1]:kbs Base[0]


    ;if sensor false go search_path
    ;search start point to end point
    IF $IN[1]==FALSE THEN


    INTERRUPT ON 11
    search_path()
    ;;INTERRUPT OFF 11
    $ADVANCE=3
    ENDIF


    ;when sensor true, pick and put then come back
    IF $IN[1]==TRUE THEN


    INTERRUPT ON 10
    service()
    $ADVANCE=3
    INTERRUPT OFF 10
    ENDIF
    END
    ------------------------------------------------------------------------------
    DEF service()


    INI
    $ADVANCE=0


    PTP Pssp Vel=100 % PDAT11 Tool[1]:zeytool Base[0] ;search start point'e gidis
    PTP Pg Vel=100 % PDAT11 Tool[1]:zeytool Base[0] ; Pg noktasyna parçayi birakmaya gider
    PTP Pb Vel=100 % PDAT11 Tool[1]:zeytool Base[0] ; Pb noktasyna parçayi birakmaya iner.


    END
    ---------------------------------------------------------------------------
    DEF piece_control()
    INTERRUPT OFF 10
    BRAKE
    RESUME
    END
    ---------------------------------------------------------------------------
    DEF piece_found()
    INTERRUPT OFF 11
    BRAKE
    RESUME
    END
    ------------------------------------------------------------------------------
    DEF search_path ( )
    INI

    ; go start to end search point until input true
    LIN Pesp Vel= 0.2 m/s CPDAT2 Tool[1]:kbs Base[0] ;esp=end search positon
    WAIT FOR TRUE ;it is the new added
    $ADVANCE=0;when I add it, the program doesnt work.



    END

Advertising from our partners