Send position via Profibus (RAPID)

  • Hi all,


    I would like to send a new position via profibus from a PLC towards an ABB. With Profibus I can send 16 bytes input so not much, but I think enough to only send the X,Y and Z coordinates the angles and orientation.


    Normally RAPID responses to:
    CONST robtarget p15 := [ [600, 500, 225.3], [1, 0, 0, 0], [1, 1,0, 0], [ 9E9, 9E9, 9E9, 9E9, 9E9, 9E9] ];
    A position p15 is defined as follows:
    • The position of the robot: x = 600, y = 500 and z = 225.3 mm in the object coordinate
    system.
    • The orientation of the tool in the same direction as the object coordinate system.
    • The axis configuration of the robot: axes 1 and 4 in position 90-180°, axis 6 in position
    0-90°.
    • The position of the external logical axes, a and b, expressed in degrees or mm
    (depending on the type of axis). Axes c to f are undefined.


    The last blok doesn't consern me, but i would like to make the first three blok variable so I can send them from a device over Profibus to the ABB and let it move towards this position.



    Anyone who did something similar, or had a better idea?



    Thanks! Best regards,


    Dukel

  • Di01_Sign_X (On -, Off +)
    Di02_Sign_Y (On -, Off +)
    Di03_Sign_Z (On -, Off +)


    Gi01_Offset_X (mapping useful above 6point)
    Gi02_Offset_Y (mapping useful above 6point)
    Gi03_Offset_Z (mapping useful above 6point)


    MODULE mainmodule
    var num nOfs_X;
    var num nOfs_Y;
    var num nOfs_Z;


    var robtarget pPos_Control;
    CONST robtarget pOrigin := X,Y,Z,rX,rY,rZ,Ext1~8 ......


    PROC test()


    WaitUntil Gi01_Offset_X <> 0;
    WaitUntil Gi02_Offset_Y <> 0;
    WaitUntil Gi03_Offset_Z <> 0;


    nOfs_X := Gi01_Offset_X;
    nOfs_Y := Gi01_Offset_Y;
    nOfs_Z := Gi01_Offset_Z;


    IF Di01_Sign_X = 1 THEN
    nOfs_X := nOfs_X * (-1);
    EndIF
    IF Di02_Sign_Y = 1 THEN
    nOfs_Y := nOfs_Y * (-1);
    EndIF
    IF Di03_Sign_Z = 1 THEN
    nOfs_Z := nOfs_Z * (-1);
    EndIF


    pPos_Control := pOrigin(\Wobj:=wobj0\Tool:=tool0);


    MoveL Offs(pPos_Control, nOfs_X, nOfs_Y, nOfs_Z), v500, fine, tool0;


    Return;
    EndProc
    EndModule



    did u meaning coordinate data control by PLC ?

    ABB, FANUC, Hyundai, Kawasaki

    Edited once, last by Robtics ().

  • Thank you Robtics,


    This look good, but is get the following error: (Identefier not found: pOrigin)
    at the line that says pPos_Control := pOrigin(\Wobj:=wobj0\Tool:=tool0);
    Any idea what cost this error?


    This could be an solution it think, but here I will send only the displaysment from the last position, is it also possible to send a hole new position.
    So that my plc sends a whole new complete robtarget.
    :merci:


    Dukel



  • I solved the error by just replacing: pPos_Control := pOrigin(\Wobj:=wobj0\Tool:=tool0); in:
    pPos_Control := pOrigin(\Tool:=tool0\Wobj:=wobj0);


    I have created a new program with the (X, Y, Z), (q1,q2,q3,q4) and (cf1,cf4,cf6,cfx) as variable


    VAR num nOfs_X;
    VAR num nOfs_Y;
    VAR num nOfs_Z;
    VAR num LastPos_X;
    VAR num LastPos_Y;
    VAR num LastPos_Z;

    CONST robtarget pOrigin:=[[928.61214857,0,1412.499981377],[0.49999989,0,0.866025467,0],[0,0,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
    VAR robtarget pPos_Control;
    VAR robtarget CPos;


    VAR robtarget vPos;



    CONST robtarget Target_10:=[[928.61214857,0,1412.499981377],[0.49999989,0,0.866025467,0],[0,0,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
    CONST robtarget Target_20:=[[1120.699649084,-29.007355691,1148.636699382],[0.481553049,-0.328651141,0.549984387,-0.598006909],[0,0,-2,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
    CONST robtarget Target_30:=[[1068.435053259,-402.961343167,1317.118306823],[0.563350561,0.584925592,0.493479124,0.311410584],[-1,-1,-4,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
    CONST robtarget Target_40:=[[1194.797421983,-442.941230281,1060.721714594],[0.828756098,0.03481388,0.53081964,-0.173729194],[-1,-1,-5,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
    CONST robtarget Target_50:=[[1258.427582426,-144.040360816,1042.64291247],[0.781453212,0.398154415,0.480416958,0.00186723],[-1,0,-5,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];


    PROC Main()
    !Wait for digital ouput to be low
    WaitUntil Di12_Set = Low;

    !Go to home position
    MoveJ pOrigin,v100,z10,tool0\WObj:=wobj0;

    !Waits until the robot and external axes have reached stop point or have zero speed
    WaitRob \ZeroSpeed;

    !Test program for variable position
    Teste;


    ENDPROC

    PROC Teste()
    !Waituntil Do01_Set = high;
    !MoveL Target_80,v1000,z100,tool0\WObj:=wobj0;
    !CPos := CRobT(\Tool:=tool0\WObj:=wobj0);


    !Change the sign of an input
    IF Di01_Sign_X = 1 THEN
    nOfs_X := nOfs_X*(-1);
    ENDIF
    IF Di02_Sign_Y = 1 THEN
    nOfs_Y := nOfs_Y*(-1);
    ENDIF
    IF Di03_Sign_Z = 1 THEN
    nOfs_Z := nOfs_Z*(-1);
    ENDIF
    IF Di04_Sign_Q1 = 1 THEN
    nOfs_X := nOfs_X*(-1);
    ENDIF
    IF Di05_Sign_Q2 = 1 THEN
    nOfs_Y := nOfs_Y*(-1);
    ENDIF
    IF Di06_Sign_Q3 = 1 THEN
    nOfs_Z := nOfs_Z*(-1);
    ENDIF
    IF Di07_Sign_Q4 = 1 THEN
    nOfs_X := nOfs_X*(-1);
    ENDIF
    IF Di08_Sign_cf1 = 1 THEN
    nOfs_Y := nOfs_Y*(-1);
    ENDIF
    IF Di09_Sign_cf4 = 1 THEN
    nOfs_Z := nOfs_Z*(-1);
    ENDIF
    IF Di10_Sign_cf6 = 1 THEN
    nOfs_X := nOfs_X*(-1);
    ENDIF
    IF Di11_Sign_cfx = 1 THEN
    nOfs_Y := nOfs_Y*(-1);
    ENDIF


    !Create variable position (Translation (X,Y,Z), Rotation (q1,q2,q3,q4), RobotConfiguration (cf1,cf4,cf6,cfx))
    vPos:=[[Gi01_Offset_X/100,Gi02_Offset_Y/100,Gi03_Offset_Z/100],[Gi04_trans_Q1/100,Gi05_trans_Q2/100,Gi06_trans_Q3/100,Gi07_trans_Q4/100],[Gi08_conf_cf1,Gi09_conf_cf4,Gi10_conf_cf6,Gi11_conf_cfx],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];

    !Move towards variable position with Joint movement
    MoveJ vPos,v100,z100,tool0\WObj:=wobj0;

    Teste;

    ENDPROC


    I have given the X, Y and Z 16bits, so they have a maximum value of 131071 that is divided by 100 to get a precision of a hundredth.
    The q1,q2,q3 and q4 all have a maximum value of 1023. I also divide them by 100 for the precision.
    The last 4 variables cf1,cf4,cf6 and cfx have a maximum value of 7


    Now I get this error:


    40222: Limit error
    Description
    Task T_ROB1: Execution stack overflow.
    Actions
    The program is too complex to execute. Probably the program contains recursive routines.


    Anyone have an idea or a better solution?


    :help:

  • Hello


    first of all


    and for dnum


    then you can change the code in teste to the following
    will cut out checking sign and the quite long line with vPos:=[[Gi01_Offset_X/100,Gi02_Offset_Y/100,Gi03_Offset_Z/100],[Gi04_trans_Q1/100,Gi05_trans_Q2/100,Gi06_trans_Q3/100,Gi07_trans_Q4/100],[Gi08_conf_cf1,Gi09_conf_cf4,Gi10_conf_cf6,Gi11_conf_cfx],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
    you could also send euler angles and transform it in one line into orient. i left it in there as comment.
    dnum just change the function call from "RealWord" with "RealDWord"
    and i personal just use a Precison of 10 because the robot isnt even precise enough for 100


    Greets Loipe

    Edited once, last by Loipe ().

  • Quote

    This look good, but is get the following error: (Identefier not found: pOrigin)
    at the line that says pPos_Control := pOrigin(\Wobj:=wobj0\Tool:=tool0);


    becuz I didn't describe perfect module and routine.
    that error meaning "Must identify data". so, You just create and define data or types.


    I hope help my concept for you. thats all ~ :winking_face:


    Quote

    40222: Limit error
    Description
    Task T_ROB1: Execution stack overflow.
    Actions
    The program is too complex to execute. Probably the program contains recursive routines.


    Mainmodule -> Main -> call routine "Teste" -> call again "Teste" -> Execution stack overflow !


    Main is parents.
    and other routine is child right?


    Memory already called "Teste". so, cannot call same routine.

    ABB, FANUC, Hyundai, Kawasaki

Advertising from our partners