Timing problem with serial port and/or cocoa drawing

  • Hi everyone,

    I've been trying to solve the following problem for a couple of days
    now, and I'm stuck. I'm writing an application for research purposes
    that involves reading coordinates from a big (3 by 5 ft) digitizing
    tablet and projecting the tablet-controlled cursor on a two-way
    mirror above the tablet through a ceiling-mounted Epson projector.
    Eventually the cursor movement will be partly invisible, rotated,
    scaled -- it's all about how people use visual feedback in movement.

    What happens is that the display cursor lags behind the tablet
    cursor. If I move the tablet cursor at a steady pace (about 0.5 m/s),
    the display cursor follows it at about an inch distance and it
    catches up when I stop moving. I can't figure out where the delay
    comes from... I hope it's just something stupid that I did, but I
    can't figure it out.

    Because I don't know what the relevant part of the code is, I posted
    the whole XCode 2.4 project on my website (http://www.hankheijink.com/
    Movetest.zip -- it's 2MB, sorry about that. I tried to make it as
    small as possible -- there's not a lot of code involved). I don't
    know if this actually is a cocoa problem, but I suspect it is -- any
    pointers to where the problem might be or where better to ask for
    help would be greatly appreciated!

    Some more information about the situation (since I don't know what's
    relevant, I'll try to be exhaustive):

    The code is structured like this: a secondary thread reads from the
    tablet with blocking read() calls and transforms the binary data into
    coordinates in points. It sets an instance variable of the tablet
    (class is called TDSTablet) to the current coordinate. The main
    thread in AppController sets up a timer that polls the tablet's
    current coordinate and calls a method of the WorkspaceView class to
    update the display cursor. WorkspaceView just draws a simple cursor
    in a window on the second screen (the projector). I've tried changing
    the frequency of the timer, and even putting the display cursor
    updates in a separate thread, but that doesn't make a difference.

    The tablet communicates like a modem with a serial port, and sends
    coordinates at just over 160Hz. I've tested this on a MacBook 2.0GHz
    with the tablet connected to a Keyspan USA-28X serial-to-USB
    converter, and on a Dual G4 450MHz with a Keyspan SXPro PCI Card. The
    projector is connected to the MacBook with Apple's VGA converter, and
    the G4 has two ATI Rage graphics cards.

    We used to connect this tablet to a Keyspan SXPro card on Mac OS
    9.2.2 on a blue G3, and that worked fine.

    I'm sorry I'm not able to be more specific...

    Many thanks to anyone who's willing to look into this!
    Hank

    Hank Heijink
    www.hankheijink.com
    <hankh...>
  • Embarrassing moment here...

    After double-checking the whole situation on the old computers (Mac
    OS 9.2.2, Blue G3 with Keyspan SXPro card and PowerPC 7200 with same
    system), it turns out the delay has always been there... I'm sorry, I
    should have checked more carefully before posting. It is pretty much
    certain that it isn't a cocoa problem, but a problem of the tablet
    itself.

    Again, my apologies! I hope I didn't waste anybody's time yet.
    Hank

    Hank Heijink
    www.hankheijink.com
    <hankh...>

    On Oct 10, 2006, at 4:10 PM, Hank Heijink wrote:

    > I've been trying to solve the following problem for a couple of
    > days now, and I'm stuck. I'm writing an application for research
    > purposes that involves reading coordinates from a big (3 by 5 ft)
    > digitizing tablet and projecting the tablet-controlled cursor on a
    > two-way mirror above the tablet through a ceiling-mounted Epson
    > projector. Eventually the cursor movement will be partly invisible,
    > rotated, scaled -- it's all about how people use visual feedback in
    > movement.
    >
    > What happens is that the display cursor lags behind the tablet
    > cursor. If I move the tablet cursor at a steady pace (about 0.5 m/
    > s), the display cursor follows it at about an inch distance and it
    > catches up when I stop moving. I can't figure out where the delay
    > comes from... I hope it's just something stupid that I did, but I
    > can't figure it out.
    >

    <snip>

    > The tablet communicates like a modem with a serial port, and sends
    > coordinates at just over 160Hz. I've tested this on a MacBook
    > 2.0GHz with the tablet connected to a Keyspan USA-28X serial-to-USB
    > converter, and on a Dual G4 450MHz with a Keyspan SXPro PCI Card.
    > The projector is connected to the MacBook with Apple's VGA
    > converter, and the G4 has two ATI Rage graphics cards.
    >
    > We used to connect this tablet to a Keyspan SXPro card on Mac OS
    > 9.2.2 on a blue G3, and that worked fine.
previous month october 2006 next month
MTWTFSS
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31          
Go to today