• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Accuracy of timestamping streamed data (code included - long)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Accuracy of timestamping streamed data (code included - long)


  • Subject: Re: Accuracy of timestamping streamed data (code included - long)
  • From: Ricky Sharp <email@hidden>
  • Date: Mon, 25 Sep 2006 16:25:43 -0500


On Sep 25, 2006, at 4:07 PM, Hank Heijink wrote:

I'm new to this list, and fairly new to Cocoa (although by now I've worked my way through Hillegass and Dalrymple + same). I'm working on the following problem:

For an application in behavioral science, I'm recording cursor movements on an old (10+ years) and big (3 by 5 feet) Quora digitizing tablet. The tablet streams 6-byte coordinates at a constant rate of about 160 Hz, and I want to get as constant a recording rate as I can get. After saving my data to a file, I find I'm fairly accurate, that is, I've timestamped my coordinates such that they're between 5 and 7.5 ms apart. The standard deviation of the differences in time is about 0.3 ms.

My question is, can I achieve even better accuracy, and if so, how? I'd like a more constant rate - I know the output rate of the tablet is more constant than this, and I'm not sure what causes the variability. My application is built in release mode and it's the only one running. Not sure if background daemons are having an effect and I don't know much about USB timing accuracy, but I guess at this level of accuracy, everything could have an effect...

I snipped the supplied code to be brief...

I think the problem may be that you're seeing drifting due to the high-frequency timer. It would be interesting to see what happens if your updateTabletCursor method just logs a timestamp and does nothing else. Perhaps you'll see the drifting occur with just that "shell" in place. It could also be the case where the duration of time you're in updateTabletCursor may vary.

Note that timers do not guarantee you a system that will always fire exactly n time units apart.

While I've never done any USB or other hardware-level coding like this, I would imagine that there's a non-polling method of reading in data from the device. That should provide you with a better flow of data.

___________________________________________________________
Ricky A. Sharp         mailto:email@hidden
Instant Interactive(tm)   http://www.instantinteractive.com

_______________________________________________
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


  • Follow-Ups:
    • Re: Accuracy of timestamping streamed data (code included - long)
      • From: j o a r <email@hidden>
References: 
 >Accuracy of timestamping streamed data (code included - long) (From: Hank Heijink <email@hidden>)

  • Prev by Date: Partially transparent child window
  • Next by Date: Re: Partially transparent child window
  • Previous by thread: Accuracy of timestamping streamed data (code included - long)
  • Next by thread: Re: Accuracy of timestamping streamed data (code included - long)
  • Index(es):
    • Date
    • Thread