10-10-2007 06:04 AM
10-11-2007 08:01 AM
First off, yes you're right. In encoder position measuring mode, you must hardwire the encoder signals to the correct counter pins. Both A & B channels, plus any index pulse -- all must be hardwired. [Aside: the new M-series multifunction boards allow software assignment of these signals, but only provide onboard 2 counters]
So that accounts for 6 of your counters and their input pins. Now then, how to generate a sample clock every Nth edge of a particular encoder channel?
You can do this by configuring a 7th counter to *programmatically* use that encoder channel as its timebase while it generates a pulse train. I'm not near my LV box, but you can look under the DAQmx property nodes, maybe something like DAQmx Channel-->Counter Output-->Timebase-->Source. Possibly instead under the DAQmx Timing property node. Wherever it is, you'd wire in the name of the pin where the desired encoder signal is wired, likely in terms of PFI #. (Even when Counter 4 has that signal physically wired to its Source/Ch_A pin, Counter 7 can programmatically "see" that same pin in terms of its PFI # to use it as a timebase. You won't need to parallel wire anything on the terminal block.)
Then if you configure your counter output channel in units of Ticks, you can just specify High Time and Low Time such that they sum to N. Now your 7th counter will generate a pulse every N cycles of the specified encoder signal.
Finally, all the other 6 counter tasks will specify the 7th counter's output as their sample clock signal.
-Kevin P.
10-11-2007 09:11 AM
10-11-2007 11:22 AM
I get what you're saying about mech oscillations, but am not sure if you're abandoning the approach for the right reason. I'm having a tough time mentally reconciling some of the things you've described:
1. Dividing down an encoder axis signal to generate a sample clock. To me, this implies that you don't need maximum positional resolution in the data you acquire. It is also unlikely-seeming that all the interesting waypoints in the path will exactly correspond to positions with the same spacing as your divide-down factor. In other words, it seems that you're setting yourself up to acquire data that will require further processing.
2. Choosing different encoder axes as the master timebase for that sample clock. This implies that your choice of "master" is somewhat arbitrary. 5 of the encoders won't be positionally sync'ed to the sample clock anyway, so why not make life *really* simple and sample with a constant-frequency clock? Accurate time information would then allow you to interpret dynamics of the joint motions.
3. The need/desire to have acquisition data at certain specific waypoints within the motion. I'd think a constant freq sample clock at a fairly high rate would get you enough data at and near the waypoint to allow for some good interpolation / curve fitting.
Many years ago, I worked up an app to characterize motion dynamics across a gear train. It used a whole bunch of sync'ed counter/timer tasks to measure speed variations based on precise time measurements of the encoder edges. I set it up that way because the encoders were fairly low resolution and it seemed that time-based measurements offered better precision. A couple years later, someone else approached the same app by simply performing constant-rate sampling of the encoder positions. He then did various kinds of filtering and interpolations to produce his analysis results. I compared the results of the two approaches, hoping to confirm the superiority of my approach, but I found the results to be quite comparable.
Moral: it's nice to make exactly the right measurement in the first place, but it doesn't always pay off. Sometimes a simpler measurement followed by some fairly simple post-processing is plenty good enough.
So, why does it seem important to you to capture data exactly at every Nth position? Why wouldn't it suffice to capture all positions at some constant rate, then interpolate to estimate them at those specific Nth position points?
-Kevin P.
10-12-2007 01:51 AM
10-12-2007 06:40 AM
Ok, gotcha. No room for compromises when you've gotta interact with other software / hardware.
There actually are some complex things that can be done that *may* work, but are tough to guarantee. They involve configuring the encoder counter to "pulse on terminal count", configuring for a 2-pulse encoder while wiring A to gnd, hardwiring that encoder counter's output pulse to its Z-index, setting the Z-index reload value to N. Two problems remain: the motion needs to be predominantly unidirectional, and the Z-index reload requires knowledge of A,B states at the instant of the pulse.
So it's a good thing you can handle this stuff with your custom board and call it a day...
-Kevin P.