RobotStudio event

image acquisition and robotstudio

Dear all,
I am doing my MSc project on the ABB IRB140 manipulator. The outline of my project is that the camera attached to the robot gripper will detect the position of the ball,pick it up and place it on the tray. I have done my image acquisition and processing in MATLAB. But I had some issues on integrating MATLAB with RobotStudio. Is there anything which can be done?

Thanking in anticipation.
Kind regards.

Kaustubh

Comments

  • I tried to save the co-ordinates given by MATLAB into .txt files. But I am unable to open these files in the RobotStudio. Any help guys.
  • As far as i know u can only open files which have *.mod, *.sys or *.prg extension in RobotStudio.Of course your file must have correct syntax and headers.

    %%%
      VERSION:1
      LANGUAGE:ENGLISH
    %%%

    MODULE ABC
    .
    .
    .
    ENDMODULE

    What kinds of coordinates did u create at MATLAB?

    Just x,y,z(posdata) or x,y,z+rotation(posedata)? I guess u can write a simple C# code to read those data from .txt file and create an executable RAPID file which have correct syntax for RobotStudio.

     



    Erdem Karaçeper
  • Hi,
     

    I do not have any experiance in this particular area but I have used the following to load data from files on the controller before.

    I am sure there are many other ways but this may get you started.

     

    In the *.mod file that is loaded you will need to put the robtartgets in the normal  format ie:

     


    MODULE prog_data

    PROC the_prog_data()

    p1:= [[2060.85,1096.91,1905.49],[8.79169E-007,0.99999,-0.00465967,-1.59443E-006],[-1,0,-2,0],[9E+009,9E+009,9E+009,9E+009,9E+009,9E+009]];

    ENDPROC

    ENDMODULE

     

    Add the following code to your RAPID program to load the data (you can read more about the commands in the RAPID manual):

     


    %%%

    VERSION:1

    LANGUAGE:ENGLISH

    %%%

    MODULE Load_Data

     

    VAR dir Directory;

    VAR string Filename;

    VAR string ShortFileName;

    VAR iodev PartFile;

    VAR num StepCount;

    VAR num NameLength;

     

    PROC load_the_data()


    !// Open the directory ready for loading

    OpenDir Directory,"HOME:/Parts";

    StepCount:=1;

    WHILE ReadDir(Directory,Filename) DO

    !// This skips the first two files in the directory(. and ..)

    IF StepCount>2 THEN

    Load "Home/parts/"File:=FileName;

    !// to remove the.mod extention

    Namelength:=StrLen(FileName);

    Namelength:=Namelength-4;

    ShortFileName:=StrPart(FileName,1,Namelength);

    %"the_" + ShortFileName%;

    UnLoad "Home/parts/"File:=FileName;

    ENDIF

    StepCount:= StepCount + 1;

    ENDWHILE

    Close PartFile;

    CloseDir Directory;

    TPwrite ValToStr(StepCount - 3) + " files loaded ";

    ENDPROC

     

    Regards

    Graeme
  • thnx guys for the replies.. I will try the codes mentioned by you.

    the text files contain the co-ordinates in x and y direction. I went through the RAPID manual. I found the "Open" command. but had some issues opening the .txt files. Always gave me some error. And since I am from Mechanical background, have no prior experience with C#. Maybe I should try using PickMaster 3.  :)
  • Hi,
     

    If you have only the x and y co-ordinates then you will need to put them in a pos type variable (instead of the robtarget as in the example), or you could use num type to store each part separately then in RAPID put them into the RobTarget.

    You can find out more information in the Instruction, Functions & Data Types manual

     

    Regards

    Graeme
  • Hi,

    Thank you for the reply. The thing is that the robot should automatically identify the targets. So the position of X and Y will change with every object. So is there any way by which it can update the position with each target?
    Also,  I tried working with the program you provided. It gave me an error which said "missing RAPID symbol". I am trying to locate which symbol exactly is missing. Confused
  • Hi,
     

    Sorry missed the ENDMODULE off the end when I copied it.

     

    If your vision system can out put the x,y data in the correct file format and save it automatically, then you can load the data with the code supplied when required in the robot program (probably just before moving to pick up the item).

     

    Regards

    Graeme
  • Hi Graeme,
    thanks for the reply again. what are the suggested file formats? because then I have to work on how to save them. And I just noticed ur tag as "Pickmaster and service". Do you think using PickMaster 3 would be suitable for this purpose?

    Apologies for the inconvenience. Stern Smile
  • Hi,
     

    You would need to do some programing work to use a external vision source with PickMaster (as standard it uses cognex vision acuisition and processing with a Gig E camera).

     

    Use a standard text file but with .mod instead of .txt file extension.

    You need to have the module and procedure decrelations, then list your x and y co-ordinates. For example:

     

    MODULE Load_data

       PROC Load_the_data()

            X1 :=123;

            Y1 := 456;

            etc

        ENDPROC

    ENDMODULE

     

    The variables x1, y1, etc must already be declared (as num) in the RAPID program, they will get assigned the values from the file when you load it.

     

    Regards

    Graeme
  • Hi,

    I used the LOAD command to load the mod file saved in HOME directory of the controller. But it is giving me certain error.

    "The source file to be loaded contains RAPID syntax errors. Correct the source file" Unhappy
  • Hi,
     

    Send me the file and I will have a look.

     

    Cheers

    Graeme
  • Hi,
     

    Attached is sample pack&go (and seperate modules in case of problems) for those that are interested.

     

  • Is there any way of setting up a user coordinate system? because it is getting really difficult for me to give the offsets. 

    For example,
    the origin of my workspace is 450,0,280

    is this the right way of doing it?

    PERS wobjdata wobj1 :=[ FALSE, TRUE, "", [ [450, 0, 280], [1, 0,0 ,0] ], [ [0, 0, 0], [1, 0, 0 ,0] ] ]; 

    sorry for asking too much. Unhappy
  • ok.. figured it out.. thnx.. :)

  • i am trying to separate out the objects wrt their colors. For eg. red one will be saved as 1 in col.mod

    now i have to pick it up and place in the respective colored tray. I defined col.mod as

    PERS num color;

    now, I am trying to use the IF and ELSE if commands. But, the problem is robot never goes to the process. It loops till the previous one.

    if (color = 1) then
    MoveJ Target_30,v100,z50,tool0WObj:=wobj1;
    elseif....

    endif


    am I going somewhere wrong?? Unhappy

    kauzy2010-08-06 00:28:39
  • Done.. just had to define some variables.

    I had another small query though. The files that have been processed in MATLAB are being stored on the PC. And for making the robot follow them, I have to manually transfer those files using "file transfer" option in the Online tab. Is there any way I can automatically transfer the files? and since I come from mechanical background, I am not acquainted with .net language. So other than working in the SDK, is there any other method which can help me do this?

    thanks for the help. Smile
  • any help guys?? :(
  • hello , i am trying to write and read a txt file into my rapid program, can somebody help me in that it shows no errors but i dont know where it is saved or how it is read by rapid
    this is my code:

    ROC write_to_file()
    VAR iodev file;
    !Open "HOME:/file.doc", infile\Read;
    !reg1 := ReadNum(infile);
    VAR num number:= 8;
    Open "Desktop:/SAJJ.TXT", file \Read;
    Write file, "The number is :"\Num:=number;
    Close file;
    ENDPROC

    PROC read_from_file()
    VAR iodev file;
    VAR num number;
    VAR string text;
    Open "Desktop:/SAJJ.TXT", file \Read;
    TPWrite ReadStr(file);
    Rewind file;
    text := ReadStr(file\Delim:=":");
    number := ReadNum(file);
    Close file;
    TPWrite text \Num:=number;
    ENDPROC
  • Hi,
    You can use TCP/IP communication between yor PC -MATALAB as Server and robot as client and the send the coordinates to Robot.