File not found or could not be opened for reading
I follow the given sample code.When I am trying to load one module to the real controller , it returns the error : RobotStudio .NET exception: File not found or could not be opened for reading. However , the module does exist . Here is my code , any idea? I am a green hand ,thanks a lot !
private static void button_ExecuteCommandSecond(object sender, ExecuteCommandEventArgs e)
{
// Step 1: Connect to the controller
#region LMStep1
Guid systemId = new Guid("7fa807ce-c383-42b6-8a32-549fcb4cb50d");
Controller controller = new Controller(systemId);
controller.Logon(UserInfo.DefaultUser);
#endregion
// Clears the eventlogs in the controller
controller.EventLog.ClearAll();
// Gets the task with the specified name.
ABB.Robotics.Controllers.RapidDomain.Task tRob1 = controller.Rapid.GetTask("T_ROB1");
// Step 2: Select module from PC
#region LMStep2
if (System.IO.File.Exists(@D:\Temp\MyModule.mod))
{
string ModulefilePath = @D:\Temp\MyModule.mod;
bool bLoadModuleSuccess = false;
// Step 3: Load Module
#region LMStep3
using (Mastership.Request(controller.Rapid))
{
// Loads a RAPID module to the task in the robot controller.
Logger.AddMessage("The mastership has been gotten.");
bLoadModuleSuccess = tRob1.LoadModuleFromFile(ModulefilePath, RapidLoadMode.Replace); // According to the report ,here happens the error.
}
#endregion
}
#endregion
#endregion
}
0
Comments
-
Hey hanpeiwen,
I know it's been a while, but did you ever solve your question above?
I'm sitting here with what I believe is that same problem. My code closely resembles ABB example for uploading a mod fiel to a controller and it even works on a virtual one.
But as soon as I try it on a physical controller I'm getting the error file not found.
Was hoping you or someone else might have some suggestions to what I'm doing wrong.0 -
Hello,I think you have to copy your file to the controller before you can load it from there.As I know it is not possible to load a file directly from the PC into the real controller.You can use the following method to copy your file:
aController.FileSystem.PutFile(localFilePath, remoteFilePath);
See also the following link:Best regardsMicky
0 -
Hello,Physical controller use Unix folder separator '/'.Filename could be like this: "HOME:/myfilename.txt".Look at Open instruction in RAPID manual.You can use RobOS() to know if you're running in virtual or real robot.0
Categories
- All Categories
- 5.5K RobotStudio
- 395 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 249 ScreenMaker
- 2.7K Robot Controller
- 310 IRC5
- 59 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 785 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 4 Job listings