RobotStudio event

RAPID, use a string to move the robot

Hello,
I dont know if it's possible but i want to find the name of a robtarget and retrieve its coord. I already have the part to retreive the name but not to do the extraction of the x,y,z from the name in the string. Here's is my code
thanks.
MODULE armin_main

    PERS tooldata t10_pince_prise:=[TRUE,[[0,0,200],[1,0,0,0]],[1,[0,0,1],[1,0,0,0],0,0,0]];
    PERS tooldata t20_pince_depose:=[TRUE,[[0,0,200],[1,0,0,0]],[1,[0,0,1],[1,0,0,0],0,0,0]];
    PERS tooldata t30_ok_ouais:=[TRUE,[[0,0,200],[1,0,0,0]],[1,[0,0,1],[1,0,0,0],0,0,0]];
    PERS tooldata t400_pourquoi:=[TRUE,[[0,0,200],[1,0,0,0]],[1,[0,0,1],[1,0,0,0],0,0,0]];
    
    PERS wobjdata f10_machine:=[FALSE,TRUE,"",[[-1330.08,-1329.25,142.631],[0.381227,0.0805217,-0.0333532,-0.920364]],[[-3200,0,0],[1,0,0,0]]];
    PERS wobjdata f200_table:=[FALSE,TRUE,"",[[-1330.08,-1329.25,142.631],[0.381227,0.0805217,-0.0333532,-0.920364]],[[-3200,0,0],[1,0,0,0]]];
    PERS wobjdata f300_ascenceur:=[FALSE,TRUE,"",[[-1330.08,-1329.25,142.631],[0.381227,0.0805217,-0.0333532,-0.920364]],[[-3200,0,0],[1,0,0,0]]];
    PERS wobjdata f40_retournement:=[FALSE,TRUE,"",[[-1330.08,-1329.25,142.631],[0.381227,0.0805217,-0.0333532,-0.920364]],[[-3200,0,0],[1,0,0,0]]];
    
    CONST robtarget p10_target:=[[0,500,0],[0.500000092,-0.499999902,-0.499999987,0.500000019],[0,0,0,1],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
    CONST robtarget p200_point2:=[[0,500,0],[0.500000092,-0.499999902,-0.499999987,0.500000019],[0,0,0,1],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
    CONST robtarget p30_evitement1:=[[0,500,0],[0.500000092,-0.499999902,-0.499999987,0.500000019],[0,0,0,1],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
    CONST robtarget p40_evitement2:=[[0,500,0],[0.500000092,-0.499999902,-0.499999987,0.500000019],[0,0,0,1],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
    
    PROC main()
        !path_20;
        VAR datapos block;
        VAR string name;
        !Found all TOOL to send
        SetDataSearch "tooldata"\InTask;
        WHILE GetNextSym(name,block \Recursive) DO
            IF StrFind(name,1,"t")=1 AND (StrFind(name,3,"_")=3 OR StrFind(name,4,"_")=4 OR StrFind(name,5,"_")=5)THEN
                TPWrite name;
            ENDIF
        ENDWHILE
        !Found all FRAME to send
        SetDataSearch "wobjdata"\InTask;
        WHILE GetNextSym(name,block \Recursive) DO
            IF StrFind(name,1,"f")=1 AND (StrFind(name,3,"_")=3 OR StrFind(name,4,"_")=4 OR StrFind(name,5,"_")=5)THEN
                TPWrite name;
            ENDIF
        ENDWHILE
        !Found all POINT to send
        SetDataSearch "robtarget"\InTask;
        WHILE GetNextSym(name,block \Recursive) DO
            IF StrFind(name,1,"p")=1 AND (StrFind(name,3,"_")=3 OR StrFind(name,4,"_")=4 OR StrFind(name,5,"_")=5)THEN
                TPWrite name;
                
            ENDIF
        ENDWHILE
    ENDPROC


Best Answer

  • Forge_Engineering
    Answer ✓
    Hi gdebeaudignies

    I think you can use "GetDataVal" Which is documented in the RAPID Instructions, Functions and Data types manual.

    Something like:
    GetDataVal name, \Block:=block, p_Temp;
    That would store the whole robtarget in p_Temp.
    Then you can access the x,y & z values individually through p_Temp.trans.x etc. 

    Hope this helps, 
    Regards,

    Harry