RobotStudio event

Load program/module from file


Hi,

I am trying to use RAB 5.10 to load program/module files, located on the robot controller memory. The program and module I am trying to access is located in "/hd0a/SystemName/Test".

I have created a controller object, logged into the controller as the default user and taken mastership:

###############################################
controller = ControllerFactory.CreateFrom(controllerInfo);
tasks = controller.Rapid.GetTasks();
using (Mastership m = Mastership.Request(controller.Rapid))
{
    string remoteDir = controller.FileSystem.RemoteDirectory + "/../Test/";
    string fileP = remoteDir + "Test.pgf";
    string fileM = remoteDir + "MainModule.mod";

    tasks[0].LoadProgramFromFile(fileP, RapidLoadMode.Replace);
    tasks[0].LoadModuleFromFile(fileM, RapidLoadMode.Add);

    MessageBox.Show(fileP + "is active program");
}
##############################################


controller.FileSystem.RemoteDirectory returns the

string, "/hd0a/SystemName/Home"

The string fileP returns: "/hd0a/SystemName/Home/../Test/Test.pgf"

The string fileM returns: "/hd0a/SystemName/Home/../Test/MainModule.mod"


I get a "General file hadling error", and there is no program loaded onto the controller. The files do exist on the controller memory.

Any ideas what the problem is??

Thanks in advance,
Neil
neil2008-1-29 14:47:34

Comments


  • I tried exactly the code you supplied, and it worked for me.
    When I loaded the .pgf first and then the .mod, like you do, however, I got an exception  when loading the module "Operation is illegal in current execution state", which should not be exposed to the RAB user. It is because a .pgf always executes a short while when loaded, and when trying to load the module the program is still executing. So we try once again to load the module and succeed because execution has now stopped. (When I loaded the module first and then the program I did not get any exception. In both cases both .pfg and .mod were loaded.)
    So, I don't know what the File handling error you got can be. Have you figured it out? Is there anything wrong  with the files?
    Best regards,

    Ingela Brorsson
    Software Engineer
    ABB Robotics, Sweden