How can i Store a Robot target Name in a string array or variable

Hi Guy's

Does anyone know how i can store a robtarget name in a string variable or String array (for lots of robtargets). Ideally i would like to store them as they are listed in my moves in their routines. I know how you can store the data, also i know how to use GETDATAVAL command but that searches all robtargets and not in any order.

I didnt think it would be that hard but i cant seem to find a way using code.

Can anyone help?

Matthew

Comments

  • Henrik BerlinHenrik Berlin Sweden ✭✭✭

    You just described the solution, didn't you? Here is my implementation of it:

    MODULE Module1
     CONST robtarget Target_10:=[[364.353809768,0,704.908015457],[0.500000013,0,0.866025396,0],[0,0,0,0],[9E9,9E9,9E9,9E9,9E9,9E9]];
     CONST robtarget Target_20:=[[364.353813367,0,601.342672798],[0.499999992,0,0.866025408,0],[0,0,0,0],[9E9,9E9,9E9,9E9,9E9,9E9]];
     CONST robtarget Target_30:=[[347.168289523,0,494.18528826],[0.332605283,0,0.94306613,0],[0,0,0,0],[9E9,9E9,9E9,9E9,9E9,9E9]];

     CONST string myrobtargetnames{3}:=["Target_20","Target_30","Target_10"];

     PROC Path_10()
      VAR robtarget current_robtarget;

      FOR i FROM 1 TO 3 DO
       GetDataVal myrobtargetnames{i},current_robtarget;
       MoveL current_robtarget,v1000,z100,tool0\WObj:=wobj0;
      ENDFOR
     ENDPROC

     PROC main()
      Path_10;
     ENDPROC

    ENDMODULE

    Henrik Berlin
    ABB
  • Hi Henrik 

    Thanks for that, but what I really need to know is can you read existing RobTarget names into a string array? 
    Is there a way of reading the name of a Robtarget eg "w4000768" and writing it into an array.

    Basically your solution backwards?

    I know you can read the .Trans and .Rot but is there such a thing as ".Name" in rapid.

    I.E.
        "Read p40 into an array"
        MoveL p40,vmax,z50,ToolG1_Rob\WObj:=wobjuf1;
        "then Read p50 into an array"
        MoveL p50,vmax,z200,ToolG1_Rob\WObj:=wobjuf1;
        !
        "then Read w400030 into an array" and so on
        SpotL w400030,vmax,Sch187,Prs350,ToolG1_Rob\WObj:=wobjuf1;
        !
        "then Read p1070 into an array"
        MoveL p1070,vmax,z50,ToolG1_Rob\WObj:=wobjuf1;
        !
  • Hi Henrik

    I'm assuming you don't know the answer, and you can't read and store the Robtarget Name using code?

    Matthew
  • Henrik BerlinHenrik Berlin Sweden ✭✭✭

    I am sorry, I don't know the answer. Perhaps you can read the data from a text file and get the names from there.

     

    Henrik Berlin
    ABB
  • Thanks anyway Hendrik

    I have now managed to do it, creating a function robtarget routine and string name, and then using VB to create the function for me in the move line."Target("p10")"

    I don't know why ABB can't give you access to the name, its only a string after all. I.E. "stRobTname:=p10.name;" but in rapid.
  • I agree. I think that ABB should allow access to the name variable in rapid code. I could really use this functionality for displaying meaningful messages in the event log during a smart robot recovery loop.
  • DenisFRDenisFR FRANCE ✭✭✭
    @liquidrobotics does this code make what you needs?

        PROC NameTest()
            CONST robtarget p10:=[[160,405,-152.2],[0,1,0,0],[-2,1,0,1],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
            VAR string sPosName;
           
            MoveL SaveName(p10,sPosName),vmax,fine,tool0;
            TPWrite sPosName+" done";
        ENDPROC
       
        FUNC robtarget SaveName(robtarget rtPos, INOUT string name)
            name:=ArgName(rtPos);
            RETURN rtPos;
        ENDFUNC

    PS: Code format doesn't work...
Sign In or Register to comment.