RobotStudio event

Is it possible to modify the robtarget.pos.x coordinate of a ROBTARGET variable automatically?

I am looking to externally modify a graphically programmed position, of the type: 

    CONST robtarget NamePosision: = [[1598.461056774, -1860.729057189,350.083928981], [0,0.000004108,1,0], [- 1,0, -1,0], [ 9E + 09,9E + 09,9E + 09,9E + 09,9E + 09,9E + 09]];

The values ​​1598, 1860 and 350, are those corresponding to robtarget.pos.x, robtarget.pos.y, and robtarget.pos.z, respectively ... Those that I try to modify automatically by means of an arithmetic operation for example, to through RAPID, assigning new variables.

    CONST num x: = 1598.461056774;
    CONST num y: = -1860.729057189;
    CONST num z: = 350.083928981;
 
    VAR robtarget NamePosision: = [[x, y, z], [0,0.000004108,1,0], [- 1,0, -1,0], [9E + 09,9E + 09,9E + 09,9E + 09,9E + 09,9E + 09]];

The CONST variables num x, y, and z, only allow me to assign the data CONSTANT, if I create them of type VAR or PERS for example, it tells me that it must be CONST, but when doing the operation to assign a new value it tells me that it is read only and can not be modified. SIMPLE EXAMPLE: x = x + 1

I hope I have expressed myself correctly. Thank you very much!

Comments

  • Change the declaration of the Robtarget from Const to Pers (as well as the num variables).
  • Hi GRAEMEPAULIN, Thanks for answering...

    I made the change from CONST to PERS,

        PERS num x: = 1598.461056774;
        PERS num y: = -1860.729057189;
        PERS num z: = 350.083928981;
     
        PERS robtarget NamePosision: = [[x, y, z], [0,0,000004108,1,0], [- 1,0, -1,0], [9E + 09,9E + 09,9E + 09,9E + 09,9E + 09,9E + 09]];


     But the error manager tells me that there are syntax problems.

    - IRB_660_250kg_3.15m_3 / RAPID / T_ROB1 / Module1 (17232,42): Syntax error (135): Num. 03/04/2018 21:01:53 General considerations.
    - IRB_660_250kg_3.15m_3 / RAPID / T_ROB1 / Module1 (17232,43): Syntax error (135): Identifier expected. 03/04/2018 21:01:53 General considerations.
    - IRB_660_250kg_3.15m_3 / RAPID / T_ROB1 / Module1 (17232,47): Syntax error (136): ']' was not expected. 03/04/2018 21:01:53 General considerations.

    All of them make reference to this excerpt from the robtarget point.

    I hope you can help me. Best regards!


  • You need to have numbers in the robtarget

     PERS robtarget NamePosision: = [[0,0,0,], [0,0,000004108,1,0], [- 1,0, -1,0], [9E + 09,9E + 09,9E + 09,9E + 09,9E + 09,9E + 09]];
    You then update the x, y, or z values in the RAPID, as below:
    NamePosision.trans.x:=x;
    NamePosision.trans.y:=y;
    NamePosision.trans.z:=z;

  • I do what you tell me ...


    But I throw the following error ... Something I'm doing wrong!

    "IRB_660_250kg_3.15m_3 / RAPID / T_ROB1 / Module1 (17227,5): Data declaration error (94): Persistent variable declaration not allowed in the routine. 03/04/2018 22:34:59 General considerations"

  • I made a mistake there ... I'm sorry ...
  • I already did it correctly and it works perfectly ... Thank you very much for your answers and your time! :)
  • im doing something similar except my robot is on a track so I have mine looking like this:

    PERS robtarget pBackSet:=[[6652.,-1606.93,856.53],[0.488507,0.509356,0.507896,-0.493922],[0,0,-1,1],[6640.,9E+09,9E+09,9E+09,9E+09,9E+09]];

    What do I use for the track instead of "trans.x"

  • pBackSet.eax.a  could be underscore _a
    Lee Justice
  • will try thank you
  •        So the code I have now is:
        PERS robtarget pRightEnd:=[[0,13.06,-8.79],[0.486852,-0.512594,0.514645,0.485143],[-1,-1,0,1],[0,9E+09,9E+09,9E+09,9E+09,9E+09]];
        PERS robtarget pColumnCTR:=[[0,-1606.93,856.53],[0.488507,0.509356,0.507896,-0.493922],[0,0,-1,1],[0,9E+09,9E+09,9E+09,9E+09,9E+09]];
            nPartLenMM:=ColumnLen*25.4;
            nPartLenMMH:=nPartLenMM/2.;
            nXPOS:=nPartLenMMH;
            pRightEnd.trans.x:=nXPos+3.225-12.7;
            pRightEnd.eax_a:=6640.35-nXPos+600.;
            pColumnCTR.trans.x:=nXPos+6662.42-12.7;
            pColumnCTR.eax_a:=nXPos+6640.35-822.05;



    The eax_a is for the numbers bold? Is there a different variable for the Track, pictured below:

  • Ok I left one thing out.  It has been a while.  Use syntax .extax.eax_a:=what_number_you_need_here;
    Lee Justice
  • should there be a space behind the syntax?
  • Syntax refers to the required way you have to write the code, it is not part of the code.  pMyRobtarget.extax.eax_a:=100; for example.
    Lee Justice
  • Thank you Lee!!!! WooHoo it works....
  • You are welcome.   :)
    Lee Justice