From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

USB-6210 Real Time (or at least really fast) Sampling/Control in C#

Hi Everyone:

 

We've been trying to get a robotic arm to do an indentation materials test. It has a load cell on its end-effector, which is connected to a collection computer through a USB-6210. The Windows computer is using the C# DAQmx API to collect and calibrate force data, which we're trying to use to feedback the robotic arm (just a simple hold). The problem is there seems to be a slight delay (0.2 to 0.3 s) in the force measurement from the USB-6210 which is causing our control algorithm to overshoot the target force quite substantially, and also gives us very silly looking hysteresis curves (see below).

 

We've hit this with the kitchen sink in terms of reprogramming the sampling. So far we've used:

  1. Asynchronous BeginReadSingleSample calls which recursively call themselves (basically copy and paste from the sample docs).
  2. Asynchronous BeginReadWaveform, since apparently reading multiple samples is a bit more optimal. This again recursively called itself.
  3. Asynchronous BeginReadMultiSample for the same reason.
  4. Starting a separate thread that just runs a while loop that repeatedly calls ReadSingleSample from the multichannel reader.

 

negative-hysteresis.png

 

 

I've attached a barebones C# class for a LoadCell object which implements solution 1 (this example doesn't have the teardown code for this object, which I've left out for brevity). This effectively samples at around 140 Hz on our machine; which would definitely be fast enough, were it not for this silly delay. Is there any known solution for this? What are all y'all thoughts?

 

 

 

Thanks in advance!

 

 

 

0 Kudos
Message 1 of 1
(739 Views)