How do I send the actual position of an ABB robot via GO's to PLC

  • Dear,


    I want to make a clean function to send the actual position of the robot to the PLC. I want to do this via group outputs. (It is not that impirtant that the values are exact)

    I programmed something that works, but I'm sure you can make it cleaner in rapid. Has someone an Idea how I can send the actual position without the detour.


    (ABB, IRC5, Robotware 6.13)


    VAR intnum RAX1;

    VAR dnum nRAX1;

    VAR dnum rRAX1;

    VAR dnum sRAX1;


    Loop:

    ActPosCartTool0:=CRobT(\Tool:=tool0\WObj:=UserFrame0);

    ActPosJnt:=CJointT();


    RAX1:=ActPosJnt.robax.rax_1;

    nRAX1:=NumToDnum(RAX1);

    rRAX1:=RoundDnum(nRAX1);

    IF rRAX1<0 THEN

    sRAX1:=65535+rRax1;

    ELSE

    sRAX1:=rRax1;

    ENDIF

    SetGO GO1_CoordJ1,sRAX1;


    WaitTime 0.01;

  • There are already Rapid functions which can fetch the robot's position. CPos() gets trans, CRobT() gets the current robtarget position.

    Sorry, but you've clearely not read the question. The question is how to send the data out of CRobT or CJointT to the PLC in Group outputs (16bit)?

  • So is the problem that you are having is that the DNum datatype is too large to send in a 16 bit group? The largest joint value possible ought to be no more than 400, so the Num datatype should suffice. If I had to do it, I would not map it as a group output, but as an analog representation of the value. With proper scaling, it should work fine. Not only that, but also, it will take care of the sign for you then too.

  • Here's a possibility (Multitasking would be handy. YES, lots of RAPID code & data is not included):


    WHILE TRUE DO


    jT1:=CJointT(\TaskRef:=T_1Id);

    nAx1ToPLC:=Abs(Round(jT1.robax.rax_1\Dec:=0));

    IF jT1.robax.rax_1<0 SetDO do_RAX1Neg1,1;

    IF jT1.robax.rax_1>=0 SetDO do_RAX1Neg1,0;

    SetGO go_RAX1_CurJnt,nAx1ToPLC;


    ... 2, 3 ...

    ENDWHILE

Advertising from our partners