RobotStudio event

load programs and modules to the controller

Options
We would like to perform the "load programs and modules" to the controller. We know we could use the function

LoadProgramFromFile
LoadModuleFromFile


Now, to perform this loading a requirement must be fulfilled as written in the document that says:

" All program files must reside in the file system of the controller and not locally on the PC. In order to load a program from the PC you must first download it to the controller by using the FileSystem.PutFile method" (ref. page 246 of the manual) "

To access this make the PutFile command we need a method:

Controller.FileSystem.PutFile(LocalFilePath, RemoteFilePath)

To go with all of this, we have now a problem in the command PutFile and GetFile. We run into the situation of having a GeneralControllerException error and was raised and shown message to the computer screen

Everytime we try on the code the PutFile and the GetFile routine of the FileSystem class we have the error.

Here are further the truth about our code that we can share as information:

1.) The Controller class has no problem when used on the source code, we can read and write its properties without exception or any error. And was created using the CreateFactory, So generally speaking the controller class when used is generally alright and good and not producing error.

2.) The FileSystem class was acquired in the controller class and was given correctly by the controller class

Private AFileSystem As ABB.Robotics.Controllers.FileSystemDomain.FileSystem = controller.filesystem


3.) To check, we see the remote directory and the local PC directory by

Dim RemoteDir As String = AController.FileSystem.RemoteDirectory
Dim LocalDir As String = AController.FileSystem.LocalDirectory

We  have seen that the variables RemoteDir and LocalDir points to the correct path in the controller path (RemoteDir) and the PC path (LocalDir)

When we check the diretory for the RemoteDir and LocalDir for its values, we inspected the desired file, seq_down.mod is stored in these directories

So as far as our concern, we have  no problem until here....

For the error here are the details:
We make a simple test to save the file to the controller as:

AFileSystem.PutFile(LocalDir + "seq_down.mod", RemoteDir + "/seq_down.mod")
This simple line of code but produces the GeneralControllerException

we also tested with these Visual Basic source codes as what you see here with many test methods yet they produces same result that the code will run in the GeneralControllerException error and was raised as message on the screen

1) Separate variables in source code (same, have GeneralControllerException error)

TheRemoteFile As String = RemoteDir + "/seq_down.mod"
TheLocalFile As String = LocalDir + "seq_down.mod"
 
AFileSystem.PutFile(TheLocalFile, TheRemoteFile)

2) Direct access to the filesystem using the contoller class (same, have GeneralControllerException error)

controller.FileSystem.PutFile(TheLocalFile, TheRemoteFile)

3) using a static full path name in Linux convention (same, have GeneralControllerException error)

TheRemoteFile = RemoteDir + "/seq_down.mod"
TheLocalFile = LocalDir + "/seq_down.mod"

AFileSystem.PutFile(TheRemoteFile, TheLocalFile)

or in the dos convention
 
TheRemoteFile = RemoteDir + "seq_down.mod"
TheLocalFile = LocalDir + "seq_down.mod"
AFileSystem.PutFile(TheRemoteFile, TheLocalFile)

or in vice-versa directory convention... (same, have GeneralControllerException error)

We also tested some more using this PutFile method (This is only one line of source code to gain access in saving the file to the controller) but still the GeneralControllerException error is raised. One line of code but have always the same error.

We do not see the problem in the class access (controller and controller.FileSystem) and is correctly setup in the source code we run. if we put the correct path, we dont have any FileNotFoundException error (again, this is not our problem, we know this and its not the one we ask for help) the problem we ask for is why we have the GeneralControllerException error. Why this is being raised? We cannot find any answer for
the moment using the manual for the Robot Application Builder. It seems the PutFile method of the controller.FileSystem is just easy and goes directly to the method class provided by the PC SDK (ABB Robotics)... So we need to have the information why we can not make it through and can not eliminate the error.

We also like to say that the actual test is made in the Offline (using Robot Studio) and Online (using the Hardware controller) but we have the same result and producing the GeneralControllerException error. It goes now in the situation.... Do we need to do more of the requirement by the controller to access in saving to the remote  directory? And how it will be done? The manual does not described, only the PutFile method.


I think I have provided the enough information so we can have the answers why we have the error, please follow up where and who can extend any information and help or explanation. Any information that may lead to the answers will be appreciated by the team.


Regards,

Comments

  • kjsv
    Options
    This works fine for me in C#:

                  string home = m_controller.GetEnvironmentVariable("HOME");
                  m_controller.FileSystem.RemoteDirectory = home + "/mytemp";
                  m_controller.FileSystem.LocalDirectory = "c:/temp";
                  m_controller.FileSystem.PutFile("dw.log", "tsts.txt", true);


  • Laro88
    Options
    This is my C# "supersimplified" loading
    try
    {
      using(master = Mastership.Request(controller.Rapid))
      {
        Task tMain = controller.Rapid.GetTask("T_ROB1");
        //fullfilename is a string with the generated module inside.
        uploadsuccess = tMain.LoadModuleFromFile(fullfilename, RapidLoadMode.Replace);
      }
    }
     catch(Exception ex)
     {
       log.Error("Failure in Upload",ex);
    }

  • Now we got it to work! Thanks a lot for given us some hints

  • Souka
    Options
    Hi,

    I m new to RAB and i would know if it is possible to create a FP SDK which contains buttons and each button load a program and excute it.

    regards,


    souka