How to get robot current postion in a .sub programm

  • KSS8.6.2

    A sendRobotStatus.sub program which send robot postion (pos, and axis value) to external system as below,


    RET=EKI_Init("sendRobotStatus")

    RET=EKI_Open("sendRobotStatus")

    WAIT FOR $FLAG[101]

    LOOP

    $BASE=$NULLfRAME

    $TOOL=TOOL_DATA[1]

    b_clear=strclear(send_Status[])

    b_clear=strclear(axis_Status[])

    b_clear=strclear(pos_Status[])

    OFFSET=0

    send_Status[]="Status,"

    SWRITE(axis_Status[],STAT,OFFSET,"%0.2f,%0.2f,%0.2f,%0.2f,%0.2f,%0.2f,",$AXIS_ACT.A1,$AXIS_ACT.A2,$AXIS_ACT.A3,$AXIS_ACT.A4,$AXIS_ACT.A5,$AXIS_ACT.A6)

    OFFSET=0

    SWRITE(pos_Status[],STAT,OFFSET,"%0.2f,%0.2f,%0.2f,%0.2f,%0.2f,%0.2f,",$POS_ACT.X,$POS_ACT.Y,$POS_ACT.Z,$POS_ACT.C,$POS_ACT.B,$POS_ACT.A)

    OFFSET=0

    SWRITE(gi16_Status[],STAT,OFFSET,"%d,",gi_16)

    OFFSET=0

    SWRITE(go16_Status[],STAT,OFFSET,"%d",go_16)

    strLenth=StrAdd(send_Status[],pos_Status[])

    strLenth=StrAdd(send_Status[],axis_Status[])

    strLenth=StrAdd(send_Status[],gi16_Status[])

    strLenth=StrAdd(send_Status[],go16_Status[])

    IF strLenth<>0 THEN

    RET = EKI_Send("sendRobotStatus",send_Status[])

    ELSE

    ; send MSG on smartPad msgQuee

    ENDIF

    WAIT SEC sendInterval

    ENDLOOP

    $FLAG[101]=FALSE

    RET=EKI_Close("sendRobotStatus")

    RET=EKI_Clear("sendRobotStatus")


    when it was submit , a message hint that $BASE is write- protected,yes I have know the reason why it occurre.

    I try to Comment :

    ;$BASE=$NULLfRAME

    ;$TOOL=TOOL_DATA[1]

    another message hint that XYZABC TOOL not Program

    So Is there a method to get robot Pos(X Y Z A B C) in .sub program .

    sinece robot motion was exected in the robot Interpreter while sending robot status is need in parra

  • Technically, $POS_ACT_MES. But there are times (like, after a Program Cancel) when this variable contains no valid data, so you'll need to protect against errors that could occur when reading it, probably by doing a transcript into another E6POS variable with an ON_ERR_PROCEED and $ERR-checking.

  • please read pinned topic READ FIRST and try to post in correct forum section.


    some variables like those used by motion planner cannot be modified by submit. the only place where they can be modified is robot interpreter.


    Cartesian positions require selection of tool and base. But those are exactly some of the variables just mentioned that cannot be written from submit:


    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

  • of course.. you need to select both tool and base before you can use Cartesian coordinate system. and you are still not doing that as shown again in your screenshot. see image in post 3

    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

  • thanks for your correction and answer @panic mode

    so there is no way to get the Cartesian positions in submit , no matter $pos_act or $pos_act_mes was used ,sinece the Cartesian positions can be gotten with the precondition which is specifying the tool and base,. $base and $ tool are write-protected in submit,right?

  • of course.. you need to select both tool and base before you can use Cartesian coordinate system. and you are still not doing that as shown again in your screenshot. see image in post 3

    that is right, it can send robot pose after tool and base were selected, thank your .

Advertising from our partners