Running motor loop in parallel with data acquisition

Supporting 2.7 and 3.2+
Fresh meat
Posts: 2
Joined: Mon Jul 16, 2018 12:47 pm

Running motor loop in parallel with data acquisition

Postby gdeol » Thu Jul 19, 2018 9:56 pm

I want to move my stepper in a reciprocating motion (45 degrees to -45 degrees)

While simultaneously measuring data through a DAQ.

I have my DAQ sampling frequency set to 600[hz]

Currently I'm running the stepper in a loop something like this

while motor.getismoving():
while motor.getismoving():

My data looks like it's being sampled at 50[Hz]. Is this because the motor phidget is checking if it's currently moving at 50[Hz]?

Is there a way to easily loop my stepper for 100000 cycles while acquiring data?

User avatar
Site Admin
Posts: 690
Joined: Fri Oct 28, 2011 12:17 pm

Re: Running motor loop in parallel with data acquisition

Postby mparadis » Fri Jul 20, 2018 3:14 pm

It's possible the other functions are slowing down the sampling. You can test this pretty easily by commenting out the motor functionality.

If you're using a Phidgets DAQ, I would recommend using events to gather data instead of polling for it. That way, the data and the motor settings will not block one another. If you're using some other library to get the data in, I would look to see if they have data events or some sort of asynchronous call in their API. If all else fails you could try using multiple python threads to accomplish the different parts of this program.

Return to “Python”

Who is online

Users browsing this forum: No registered users and 1 guest