LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Position automation of a Thorlabs' Z825B servo motor actuator, using a KDC101 Brushed Motor Controller, LabView and Kinesis software.

Hello to everyone!

 

I am facing a problem. I’m working with a KDC101 Brushed Motor Controller and a Z825B servo motor actuator. Both of them are Thorlabs’ components. Regarding the automation, I use LabView, as well as Kinesis Software’s DLL files in order to establish the connection with the controller.

 

The purpose of this project is to automate the Z825B’s position. More specifically, the system will be triggered externally, through the two available inputs (e.g. using a function generator). So, the idea is to specify a position for each input port. Then, for example, when the input port-1 is triggered, the actuator moves to Position 1.

 

Thus, because of the limited Thorlabs’ bibliography, regarding automation using LabView and external triggering, I haven’t found yet the sequence of the nodes, as well as the way of setting the desired parameters (for the position (absolute or not), velocity, acceleration) for these nodes.

I am aware of the available Thorlabs bibliography, that the certain headers must be set for each particular action. This coding method is referred into the APT Communication Protocol document. Also, the Kinesis LabView Guide is considered, but is lacking in information for the external triggering method.

 

Finally, I must admit that I am not familiar with LabView programming, but I have established the connection with the controller and have made a simple program, different than the desired one. I have also checked that this kind of the programming idea works, setting the desired parameters through the Kinesis App and then triggering the controller using a function generator. 

 

Thank you in advance for your time!

Download All
0 Kudos
Message 1 of 9
(493 Views)

If you're using the Kinesis interface in LabVIEW then the "APT Communications protocol" manual is not what you need.  That's only for if you're trying to control the devices at a very low level yourself;  the commands in the Kinesis DLLs take care of all that for you.

 

Since you have Kinesis installed on your PC, I would recommend looking at this help file that it comes with:

C:\Program Files (x86)\Thorlabs\Kinesis\Thorlabs.MotionControl.DotNet_API.chm

 

It kind of sounds like you should start with this entry:

Thorlabs::MotionControl::GenericMotorCLI::Settings::HardwareTriggeringSettings
Since you're trying to setup a hardware trigger of some kind.
0 Kudos
Message 2 of 9
(453 Views)

Some of this has already been noted in another response.

I did some Kinesis LabVIEW coding for several Thorlabs positioner device families a few years ago.

The Kinesis package is a sprawling collection of .Net and lower level dlls with little useful documentation.  They basically give you a big box of tools but do not explain what a hammer is used for (reminds me of the LabVIEW docs).  When you do go looking for a hammer you know has to be there it can be hard to identify, and there are several hammers with similar names.

If you look in the program files folder where the Thor software is installed, there are some help files (*.chm?) that give documentation for all the functions.  It was not generally useful to me.  However, if you dig down deep enough in the help file for a particular device family you can often find an example code written in C.  If you translate one of these examples into LabVIEW it will provide a good starting point.  Some of the Thor devices are finicky on how they are started, so following the example startup sequence is important.  The example codes have time delays between some of the function calls that need to be there!

They recommend copying the .Net dlls to your project folder to start (using the correct 32 bit or 64 bit dlls).  I did not like this, but it is probably a good idea.  Once a project decides it is associated with a particular .Net dll, it is hard to get it to change.  It is like playing a game of Whack-a-mole, and the moles win.

Most of the Thor .Net examples use a front panel .Net container for the constructor, so start by dropping a container there and digging down through the .Net assemblies to find the one for your device.

Message 3 of 9
(449 Views)

@jjohn1 wrote:

They recommend copying the .Net dlls to your project folder to start (using the correct 32 bit or 64 bit dlls).  I did not like this, but it is probably a good idea.  Once a project decides it is associated with a particular .Net dll, it is hard to get it to change.  It is like playing a game of Whack-a-mole, and the moles win.


Good note, I had forgotten about that part.

 

In our company we partly "solved" this by adding all the DLLs to a LabVIEW .lvclass file as members.  When a file is part of a .lvclass file it automatically includes it in all builds involving the class, and uses the path to it from the class file.

0 Kudos
Message 4 of 9
(440 Views)

How do you add dlls to a class?  This would have been helpful.  I wrote VIs for about four different Kinesis device families, each family in a *.lvlib in a different folder.  The .Net dlls were copied to another folder at the same level as the folders containing the *.lvlibs.  All was well until I tried to move the code to another computer.  Apparently the project did not use a relative path to the .Net dlls, and trying to change the location proved difficult.

0 Kudos
Message 5 of 9
(410 Views)

@jjohn1 wrote:

How do you add dlls to a class?  


Right-click the class (or a virtual folder in the class), "Add.." submenu, then "File".  You can add anything, it doesn't have to be a LabVIEW file.

 

Just remember that anything you add to a class goes in the build, so if you add a help document to the class for easy reference it will go in your build folder too.

0 Kudos
Message 6 of 9
(401 Views)

Hello again. Thank you all for your answers!

 

At that time I checked what you told me.
I have some more questions. I opened the Kinesis .Net API, but it doesn't help a lot, because of the poor explanation of each command.

 

In LabVIEW though, when I use one of the nodes that sets the parameters through Kinesis (SetTriggerConfigParameters), and (with a right-click at the left side) choose Creat => Control in order to specify them, it asks for a .Net file. I'm not sure if such a .Net file already exists and then I have to make a few changes, or I have to write some code in C# (of which I'm not aware), or what I'm describing is totally wrong. If the last one is happening, what should I do?

 

On the other hand, if I (again with a right-click) choose Properties or Methods there are some more extra nodes. I tried a lot but don't know which sequence of nodes to use. The SetTriggerConfigParameters is one of some available Kinesis nodes, which I just showed you as an example. All of them ask for a .Net input.

 

Regarding the Properties, TriggerMode and TriggerPolarity, their available options are showed in the frond panel, but they cannot specify the desirable motion (e.g. Absolute Move 5mm).

 

At first, I want to understand how to set the parameters, that's why I don't send the main structure of the vi, because in the end it depends on the last one.

  

Thanks in advance again!

0 Kudos
Message 7 of 9
(364 Views)

I suspect that there are other properties elsewhere that set the parameters such as location for an absolute move when triggered.  I've used the Kinesis API a fair amount before but never using hardware triggers so I don't know myself where to set those properties.

 

You might actually want to try contacting Thorlabs support on this one.  I have done so in the past (a few years back though...) and actually gotten quite detailed coding-related replies back.  

0 Kudos
Message 8 of 9
(355 Views)

It looks like you have connected an empty .Net reference to your invoke node.

Usually with .Net you drill down through the reference “tree?” to get to the reference you need.

As an example, your code gets a device reference from the original .Net reference.  You might try connecting this device reference to another property node and seeing if there is a triggerConfigParameters reference.  If there is, connect that reference to an invoke node or property node and see if it exposes the properties and methods you need.

0 Kudos
Message 9 of 9
(351 Views)