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
motor.setTargetPosition(45)
while motor.getismoving():
acquireData()
time.wait(1)
motor.setTargetPosition(-45)
while motor.getismoving():
acquireData()
time.wait(1)
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?
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.