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

70 visualizzazioni (ultimi 30 giorni)
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 Commenti
Paul Farnsworth
Paul Farnsworth il 28 Mag 2021
No. I worked around it by switching to Labview.

Accedi per commentare.

Risposte (2)

Raha
Raha il 8 Mag 2023
Modificato: Walter Roberson il 8 Mag 2023
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 il 10 Giu 2024
Modificato: anha sara mara il 10 Giu 2024
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

Community Treasure Hunt

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

Start Hunting!

Translated by