reseting robtarget

  • Hello!,


    Is there a way to "reset" robtargets without typing like this in the middle of the code:


    PutPos:=[[0.0,0,0],[1,0,0,0],[-1,0,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];


    with kuka i believe you can use $NULLFRAME if I remember correctly, but the command for rapid idk.. looks much better, short and simple.


    Thanks in advance.

  • Hello,

    You can use a routine:


    PROC zero_robtarget(VAR robtarget p)

    p.trans:=[0,0,0];

    p.rot:=[1,0,0,0];

    p.robconf:=[-1,0,0,0];

    p.extax:=[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09];

    ENDPROC


    And you need use like this:

    zero_robtarget(p10);

  • Thanks again, i made a FUNC like this


    FUNC robtarget NULLFRAME(robtarget p)

    p.trans:=[0,0,0];

    p.rot:=[1,0,0,0];

    p.robconf:=[-1,0,0,0];

    p.extax:=[9E+9,9E+9,9E+9,9E+9,9E+9,9E+9];

    RETURN p;

    ENDFUNC


    Worked perfectly!

  • Kind of the long way round instead of declaring a global NULLFRAME:


    CONST robtarget pNULLFRAME:=[[0,0,0],[1,0,0,0],[-1,0,0,0],[9E+9,9E+9,9E+9,9E+9,9E+9,9E+9]];


    and in your code just using:


    PutPos:=NULLFRAME;





    AIf you like the idea of using a function instead, then in your routine/function you don't need to separate out all your components of a robtarget (it's a robtarget after all) you can assign all at once just like you did in your initial post.


    FUNC robtarget NULLFRAME(robtarget p)

    p;=[[0,0,0],[1,0,0,0],[-1,0,0,0],[9E+9,9E+9,9E+9,9E+9,9E+9,9E+9]];

    RETURN p;

    ENDFUNC

  • As I said before and @SAABoholic put together, the simpler way is to use a global constant.


    If you want to go with function solution, you can make it even simpler. You don't need to pass parameters or temp values, just return it directly.


    Code
    FUNC robtarget NULLFRAME()
      RETURN [[0,0,0],[1,0,0,0],[-1,0,0,0],[9E+9,9E+9,9E+9,9E+9,9E+9,9E+9]];
    ENDFUNC

Advertising from our partners