LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Parallel APT Stepper Motor control

Hello all. I am coming across some issues in running two stepper motors in parallel instead of moving in series as they currently are. I am using Thorlabs APT drivers to position both stepper motors to a specific location, but regardless of what I attempt I cannot make them both run at the same time. I am also fairly new to LabVIEW and parallelism so forgive me if the solution is minor. Attached is an image of the current set-up.

0 Kudos
Message 1 of 8
(3,370 Views)

Hi gbartolod,

 

Since LabVIEW operates on data flow, it is difficult to know in what order operations will occur.

 

To start, using an event structure would be better than continuously polling the start button/switch in a while loop. 

 

Event-Driven Programming in LabVIEW

http://www.ni.com/white-paper/3331/en/

 

I would consolidate both sections of motor code together to use a sequence structure to ensure the motor operations are done in a specific order to help better synchronize their movement.

 

Flat Sequence Structure

http://zone.ni.com/reference/en-XX/help/371361P-01/glang/flat_sequence/

 

Jiwhan S.
Technical Support Engineer
National Instruments
0 Kudos
Message 2 of 8
(3,318 Views)

Is the Thorlabs library thread safe? an it be run in parallel? You might want to see if that is possible first. It could be the library does not allow parallel execution. I don't see anything inherently wrong with your code. I do agree with using the even structure for monitoring your button presses. Though any UI code (watching for button presses) should probably be done in parallel with your main code. I would also suggest using state machines rather than using sequence frames to control the flow of your execution. I'm surprised to see an NI employee recommending that. While sequence frames do have some limited use, they should generally be avoided for controlling all of your execution sequencing. State machines, producer/consumer, queued message handlers are all better ways to control execution over using sequence frames.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 3 of 8
(3,308 Views)

your architecture is wrong.

Since you initialize in parallel, the thread wait till your close the first initialization. (race condition determine witch one start first) The motion can be put in parallel for both motor, but initialize it only once and use the same reference to provide direction to both motor at the same time. Them close the reference only when you have finish with both motor.

Benoit

0 Kudos
Message 4 of 8
(3,305 Views)
Dear JiwhanS, Flat sequence are the worst thing to do in LabVIEW... error bus is the best way to prioritize object between each other. Flat sequence make the code hard to read and have the tendency to increase the size of the diagram. then you will complain that LabVIEW cannot zoom in and out.
 
Benoit

 

0 Kudos
Message 5 of 8
(3,303 Views)

There is a manually operated APTUser utility that comes with the APT drivers that does allow for parallel movement. Also, according to an APT systems brochure by Thorlabs it should be able to. (https://www.thorlabs.com/images/PDF/apt%20Brochure%20US240206.pdf)

 

This was my attempt at making the system work in parallel, attached is what the system actually looks like in use.

0 Kudos
Message 6 of 8
(3,272 Views)

does this work?

0 Kudos
Message 7 of 8
(3,228 Views)

Could you share the code, please? Also has it worked for you? I experience similar issues. 

0 Kudos
Message 8 of 8
(2,240 Views)