RobotStudio event

Reading command string from .txt file

Hey guys,

 

Is there any way I can read a MoveL command stored on a txt file? I've been trying to use the ReadStr function but the path to the text file on my pc is not being acknowledged by the compiler. The program runs perfectly until it stops at the Open file line with the path.

 

I'm trying to follow this example I saw on RAPID's manual:

 

VAR string text;
VAR iodev infile;
...
Open "HOME:/file.doc", infile\Read;
text := ReadStr(infile);

Text is assigned a string read from the file file.doc.

 

Instead of "HOME:/file.doc" I'm using "C:\test\test_v1", which is the location of the txt file on my pc. I'm sorry if it sounds stupid but I'm just beginning to work with the RAPID language and I'm still not familiar with its synthax.

 

What is this "HOME:\" in the beginning of the example path? I inittially assumed it was there just for the sake of the example and that this would actually be my C:\ drive, but I keep getting errors if I refer to C:\. Is it something I have to set on RobotStudio?

 

Btw, I've connected the pc directly to the robot i.e., there's no intervention through the FlexPendant. The robot is an IRB 1600, 6kg, 1.45m with an IRC5 controller.

 

Any ideas on what the correct synthax for the path should be?

 

Any help would be greatly appreciated!

 

Alessandra

Comments

  • Hello Alessandra,

    hd0a is the flash drive of the robot. hd0a\system\home is the directory where HOME:/ is linked to.


    You can save the data you want from the string to the disired RAPID-data. Then you can use this data in an already existing move instruction.


    If you want to create the entire instruction offline you would have to create the entire module, with the data, routine, and instructions inside, and use the LOAD instruction
    RobWelding
    The Netherlands
  • Hi SjoLi,

    Thanks a lot for your answer! I had no idea it was that simple :)

    I just want to read coordinates from the txt file in order to use them in a simple MoveL instruction on the RAPID code. These coordinates will be constantly updated as needed and that's why I think the ReadStr instruction would be appropriate. But I'll take a look at LOAD as well to learn what I can do with it.

    Anyways, thank you once again!