Abb YuMi Cobot CRobT in a proc problems

  • Hello,
    i'm using the ABB YuMi cobot for a small project.
    i'm trying to create a function where the actual position of the cobot is stored in a robtarget.
    to use the robtargets later to create a path. Only when i use my created function it gives an error that i that it's an dummy positions. because it is empty
    but when i use the function directly it works fine.


    see code below:


    Proc Main()


    SetLeadthrough \on;
    TPReadFK reg1,"Press Apply to apply the coördinates", "Apply", stEmpty, stEmpty,stEmpty, stEmpty;
    if reg1 = 1 THEN
    TPErase;
    Pos1:= CRobT(\Tool:=Servo \wObj:= wobj0);
    Setleadthrough \off;
    reg1:=0;
    TPWrite "coördinates applied";
    ENDIF

    MoveJ HomePos, v200,fine,Servo;
    MoveJ Pos1, v200,fine,Servo;


    ENDPROC
    in this case it works fine but when i use in the as below it doesn't work


    PROC Main()


    TeachPos(Pos1);
    MoveJ HomePos, v200,fine,Servo;
    MoveJ Pos1, v200,fine,Servo;


    PROC TeachPos(robtarget pos)
    SetLeadthrough \on;
    TPReadFK reg1,"Press Apply to apply the coördinates", "Apply", stEmpty, stEmpty,stEmpty, stEmpty;
    if reg1 = 1 THEN
    TPErase;
    pos:= CRobT(\Tool:=Servo \wObj:= wobj0);
    Setleadthrough \off;
    reg1:=0;
    TPWrite "coördinates applied";
    ENDIF


    ENDPROC


    ENDPROC


    Does some one know what i do wrong ? or what the problem is ?

Advertising from our partners