[PD-dev] Fwd: PD Scheduling Irregularities

Tom Smyth pd at tomsmyth.ca
Mon Apr 10 09:49:00 CEST 2006


Folks,

I am writing a Pd object to control a Sensable Phantom haptic device.
For those of you who don't know what I'm talking about, a Phantom is a
device which lets you feel virtual objects and force fields by
manipulating a pen in free space.  See www.sensable.com for more info.

For now, what matters is that the Phantom's servo loop runs at 1000Hz.
 In practice it's usually 3 or 4 microseconds off, but rarely more
than 10.  Furthermore, bi-directional communication is required.  The
signals on the 3 inlets of my object should get sent to the Phantom as
the force to be rendered, and the 3 outlets should continuously spew
out the position of the Phantom tip.  (All inlets and outlets are
audio-type.)

The difficulty I'm encoutering is the seeminly erradic scheduling of
the Pd dsp tick.  I tried timing it with Windows XP's
QueryPerformanceTimer call, and it reported everything from 300usec to
20000usec between dsp ticks.  And that variation was regular -- it
wasn't just happening once or twice.

Why does Pd behave like that?  I assume it can get away with it
because the sound card buffers its output, right?  But that's no good
to me -- a sound card is uni-directional.

I tried communicating from Pd to the Phantom with a buffer in order to
absorb the jitter.  It seemed to work fine in one direction, though
the bigger the buffer, the bigger the delay, from what I can figure.
And delay is bad.  So I'm hesitant to go through a buffer both ways.

But the performance so far with one buffer is not acceptable.  The
same algorithms that run fine without Pd cause noticable instability
in the Phantom with it.

Is there any way to force Pd to run its ticks more regularly?  Any
other suggestions?  OSC has been mentioned, but I don't see how it
would help for this low-low level a problem.  Please correct me if I'm
wrong.

Thanks so much for your help.




More information about the Pd-dev mailing list