Timing problem with serial port and/or cocoa drawing
Timing problem with serial port and/or cocoa drawing
- Subject: Timing problem with serial port and/or cocoa drawing
- From: Hank Heijink <email@hidden>
- Date: Tue, 10 Oct 2006 16:10:28 -0400
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
email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden