Hello, I’ve been working on an add-in for a while to push a module into a virtual controller. The code is as follows:
using (Controller controller = Controller.Connect(selectedController.SystemId, ConnectionType.RobotStudio)) controller.Logon(UserInfo.DefaultUser);
UserAuthorizationSystem authSystem = controller.AuthenticationSystem;
if (controller == null || !controller.Connected)
{
Logger.AddMessage(“Link Failed”);
return;
}
if (!authSystem.CheckDemandGrant(Grant.LoadRapidProgram))
{
Logger.AddMessage(“Write access refused”);
}
else
{
Logger.AddMessage(“Write access granted”);
}
Logger.AddMessage($“Link at {selectedController.Name}, {selectedController.Version} !”);
ABB.Robotics.Controllers.RapidDomain.Task tRob1 = controller.Rapid.GetTask(“T_ROB1”);
string filePath = @“C:\Users\user-reseau\Desktop\code.mod”;
if (File.Exists(filePath))
{
{
using (Mastership.Request(controller))
{
if (controller.Rapid.ExecutionStatus == ABB.Robotics.Controllers.RapidDomain.ExecutionStatus.Stopped)
{
bool loaded = tRob1.LoadModuleFromFile(filePath, RapidLoadMode.Replace);
Logger.AddMessage(loaded ? “Load success.” : “Module loading failed.”);
System.Threading.Thread.Sleep(1000);
}
else
{
Logger.AddMessage(“Error 10”);
}
}
}
}
It works perfectly on IRC5 without any issues, but as soon as I switch to an Omnicore virtual controller, I get the following error and can’t seem to get rid of it.
RobotStudio .NET exception: C004A00C : File not found or could not be opened for reading.
LoadModuleFile
Does anyone have an idea? What is the correct method with Omnicore?