LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

.NET Thorlabs motor control timing problem

Solved!
Go to solution

Hi,

I have a Thorlabs DC servo motor being controlled by a KCube.

I have written the attached LabView code to perform a jog with the motor.

It is working ok 90% of the time, but when the jog is performed as part of loop, or if it is executed in rapid succession, occasionally I get an error at the "MoveRelative" method node because it thinks the motor is still moving from the previous jog.

To solve this I added the while loop to check the state of the motor, which is either moving or idle. It waits in blocks of 50ms until the motor is idle before anything else should happen. But I still sometimes get the error.

What am I doing wrong to get this error?

I must admit I don't really know if I have used the .NET close references at the correct place.

 

Thank you,

Graham

0 Kudos
Message 1 of 2
(2,313 Views)
Solution
Accepted by topic author grahamt8887

I think I have fixed the issue Smiley Happy, however the Thorlabs documentation still leaves me confused.

The solution (attached) is to set the "waitTimeout" value on the MoveRelative invoke node to some value greater than 0. I can't  find anywhere what unit this value has, but they use 50000 in their examples, and 10000 seems to be working for me.

Regardless, I still don't see why the while loop solution wasn't working.

 

This is taken from the Thorlabs documentation, I find it quite vague:

" 4) The method requires a timeout to be entered. If this is value is 0 then the function will return immediately. If this value is non zero, then the function will wait until the move completes or the timeout elapses, whichever comes first."

" 5) To give the homing move enough time to complete increase the waitTimeout on the home method, setting this to ~50000 is sufficient large enough so that the home is completed, however this value will depend on how far away from the home position the stage is and also what type of stage you are using."

0 Kudos
Message 2 of 2
(2,283 Views)