Matlab generated dll not found
neil
✭
in RobotStudio
I have used the Matlab .NET Builder to generate a dll containing user defined Matlab functions. I have tested the dll in a standalone console application using Visual Studio 2005 and the dll can be referenced and the functions made available within the .NET environment with no problem.
Problems arise when I try to reference the same dll in a VS application which is used as a RobotStudio (5.10) add in. When the program tries to create an instance of this class, RS crashes.
I have included the following in the RobotStudioinAddins directory:
- matFuncts.dll (user generated dll from Matlab .NET Builder, unable to call instance without RS crashing)
- matFuncts.ctf (also genertaed from Matlab .NET builder)
- myAddin.dll (RS addin developed in Visual Studio - contains static void AddinMain() and also references matFuncts.dll)
Best regards,
Neil
neil2008-5-14 20:3:18
0
Comments
-
Hi Neil,
What happens exactly? Have you tried running RS under the debugger and see if there's any .NET exception that could give a hint?
regards,
Johannes
Johannes Weiman
Software Engineer
ABB Robotics0 -
Hi Neil,
All RS cares about is the method static void AddinMain(). The rest is up to the add-in itself, i.e. I don't believe this error is directly related to RobotStudio.
I suggest you try to debug your dll using Visual Studio. In your Visual Studio project you can define RobotStudio as the external program to start, see picture below. Just ensure that your dll is copied to the RobotStudio/bin/addins folder as a post-build step.
Henrik Berlin
ABB0 -
Hi Johannes and Henrik,
I've tried to debug the dll as you suggested but for some reason, there is no exception thrown. I can try to give some details about where I've made the call and what happens with RS. There are 2 scenarios I have come across when trying to instantiate the user generated dll (myFuncts.dll) from Matlab .NET Builder:
1. Trying to instantiate myFuncts.dll from UserControl1 (button click) or from CommandBarButton:
public static void AddinMain(){
ToolWindow tw=new ToolWindow;
UserControl1 uc = new UserControl1;
tw.Control=uc;
}
UserControl1(){
InitializeComponent();
}
private void button_click(object sender, EventArgs e){
myFuncts mf = new myFuncts(); *
}
static void button_ExecuteCommand(Object sender, ExecuteCommandEventArgs e){
myFuncts mf = new myFuncts(); *
{
*RS crashes at this point and debug mode exited. I have tried unsuccessfully to throw an exception.
2. It is possible to instantiate within AddinMain() and pass output of myMethod() to UserControl1:
public static void AddinMain(){
myFuncts mf = new myFuncts();
data = mf.myMethod(myMethodArgs);
UserControl1 uc = new UserControl1(data);
}
UserControl1(double passedData){
InitializeComponent();
textBox1.Text=passedData.ToString();
}
Although RS starts and displays the correct values in the textbox, problems occur when I try to load a station. The virtual controller starts but the RS then freezes and the station is not loaded.
As you say Henrik, this may not be a RS problem, and I am also in contact with Mathworks support to see if they can shed some light on the issue.
Any ideas welcome!
Thanks for the help,
Neil
0 -
Johannes/Henrik,
Just to repeat...there are no problems when the Matlab generated dll (myFuncts.dll) is called and instantiated from a console application. The problems described are only experienced within the public static void AddinMain() method. Because the dll causes no problems in the console application, Mathworks believe it may be an RS problem...
Is it possible to test the addin dll as a console application or in some other application to determine what is causing the problem?
Thanks,
Neil
neil2008-5-21 10:35:530 -
Hi Neil,
Unless there is a dependency from your dll you RobotStudio I suppose you can use it from any piece of software, independent of RobotStudio, such as for example a console application.
Henrik Berlin2008-5-28 9:24:36Henrik Berlin
ABB0 -
Johannes/Henrik,
I was able to save the error log from RS after crashing. The code used for the addin is as follows::
public static void AddinMain()
{
myFuncts mf = new myFuncts();
data = mf.myMethod(myMethodArgs);
UserControl1 uc = new UserControl1(data);
}
UserControl1(double passedData)
{
InitializeComponent();
textBox1.Text=passedData.ToString();
}
The Matlab class is instantiated, the values returned and displayed on UserControl1. This is all done when RS starts up, BEFORE any station is loaded.
When I try to load the station, the attached crash dump is generated.Hopefully it may provide some clues....
Neil
2008-05-28_155351_RobotStudioReport_2008-0528_153533.zip0 -
Hi Neil,
Unfortunately the crash dumps are empty (zero byte files).
Any chance you can try to run the addin under RS 2008? The error handling and dump generation has been much improved there...
Johannes
Johannes Weiman
Software Engineer
ABB Robotics0 -
Johannes/Henrik,
I have attached an RS addin project, which uses the Matlab generated dll.
2008-05-29_134430_randomNumberRS.zip
Before using this dll (RMtest.dll), a matlab runtime compiler must be installed on the target machine. This enables the Matlab generated dll to run without having Matlab installed. I have emailed this to you both as the installer file is too large to post on the forum.
The class call is as follows:
RMtestclass rmt = new RMtestclass();
randMult = rmt.randomMultiplier(2, rob, lin);
The RMtest class has one method, randomMultiplier(). This method takes 2 vector inputs (rob and lin), multiplies them by a random number and outputs the result. Some data conversions are required to get the results from Matlab arrays to native .NET arrays.
It is possible to instantiate the class and return the results in a console application but the same code causes RS to crash when used in as an addin.
When is RS 2008 available for download?
Thanks,
Neil
0
Categories
- All Categories
- 5.5K RobotStudio
- 396 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)
- 786 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 5 Job listings