How do I access Thorlabs Kinesis .NET functions in Matlab?

41 次查看(过去 30 天)
I am attempting to program Thorlab KST Stepper Motor Controllers from Matlab. This simple script:
asm2=NET.addAssembly('C:\Program Files\Thorlabs\Kinesis\Thorlabs.MotionControl.GenericMotorCLI.dll');
sn1=('26001073');
Connect(Thorlabs.MotionControl.GenericMotorCLI.AdvancedMotor.GenericAdvancedMotorCLI,sn1)
generates the error:
Error using Thorlabs.MotionControl.GenericMotorCLI.AdvancedMotor.GenericAdvancedMotorCLI
Abstract classes cannot be instantiated. Class
'Thorlabs.MotionControl.GenericMotorCLI.AdvancedMotor.GenericAdvancedMotorCLI' defines abstract methods and/or
properties.
Thorlabs.MotionControl.GenericMotorCLI.AdvancedMotor.GenericAdvancedMotorCLI is a class in the .NET library:
Thorlabs.MotionControl.GenericMotorCLI.dll, and Connect(Thorlabs.MotionControl.GenericMotorCLI.GenericMotorCLI this, System.String serialNo) is listed as a method in that class.
Any suggestions would be appreciated.
  3 个评论

请先登录,再进行评论。

回答(2 个)

Raha
Raha 2023-5-8
编辑:Walter Roberson 2023-5-8
I have successfully used it in Matlab for KCube:
clear
clc
%Set path to the DLL files
NET.addAssembly('C:\Program Files\Thorlabs\APT\Thorlabs.MotionControl.DeviceManagerCLI.dll');
NET.addAssembly('C:\Program Files\Thorlabs\APT\Thorlabs.MotionControl.GenericMotorCLI.dll');
NET.addAssembly('C:\Program Files\Thorlabs\APT\Thorlabs.MotionControl.KCube.BrushlessMotorCLI.dll');
import Thorlabs.MotionControl.DeviceManagerCLI.*
import Thorlabs.MotionControl.GenericMotorCLI.*
import Thorlabs.MotionControl.KCube.BrushlessMotorCLI.*
DeviceManagerCLI.BuildDeviceList();
DeviceManagerCLI.GetDeviceListSize();
device = KCubeBrushlessMotor.CreateKCubeBrushlessMotor('yourserial number'); %The output of this line must be suppressed
device.Connect('YourserialNum');

anha sara mara
anha sara mara 2024-6-10
编辑:anha sara mara 2024-6-10
hi , raha im currently working with LTS300/M ,I'm having the sam e issues as you i can detect the serial number cant connect ,which drivers did you install . did you reinstall the software or just the drivers

类别

Help CenterFile Exchange 中查找有关 Call Web Services from MATLAB Using HTTP 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by