Quantcast
Channel: LabVIEW topics
Viewing all articles
Browse latest Browse all 66970

DAQmx, Timing, servo control

$
0
0

Hi, I'm trying to set up a system to control a servomotor while simultaneously measuring its current draw and rotational position, using LabVIEW 2013.  To control the servo, I'm using VISA to output commands to a Parallax Servo Controller.  To acquire the analog voltage signals (from a Hall-effect current sensor and from the potentiometer within the servomotor), I'm using a NI USB-6259 DAQ.  Attached is the LabVIEW code I'm using to do this.

 

The problem that I'm having has to do with timing:  I'd like to both send commands to the servo controller and sample the analog voltages at 100 Hz (every 10ms).  It seems that my system is doing this, but there is some kind of delay between sending position signals and acquiring voltages, and I don't believe it's hardware related.  Here is the output on a waveform chart of the command vs. the actual position, showing the delay:

 

delay.png I'm not sure if I have all the DAQmx stuff set up correctly.  Another thing I noticed is that if I put a delay in one of the outer while loops (going through successive tests), the DAQ seems to still be reading and logging the signals even while it's not in the Timed Loop.  If I put a Stop Task after the Timed Loop, this problem goes away, but putting a Start Task before the Timed Loop doesn't seem to help at all.  

 

Please take a look at the block diagram and let me know if you see any problems with the way I have this set up.  It's basically working, but I am just worried that the timing isn't really synchronized the way it's supposed to be.  I am guessing someone will suggest using a producer/consumer loop scheme, but will that actually fix my issues?  If so, is there example code for producer/consumer that someone can suggest?  Thanks.

 

 

 


Viewing all articles
Browse latest Browse all 66970

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>