Main Site Documentation

TouchCollectorConfiguration


#1

According to the help files, the TouchCollectorConfiguration.TouchInput.SamplingDistance is set to sample per micro second. However it seems that what ever number I place in the parameter I get a System Argument Out of Range Exception.

http://msdn.microsoft.com/en-us/library/ee436182.aspx

Dale


#2

Please show a snippet of your code.


#3

Me too!! I tried to speed things up as well by changing sampling frequency… Only one or two values worked… I ended up using the default values in the GHI demo and I’ve left it there.

Cheers Ian


#4

 Touch.Initialize(myApp);  // Initialize Touch Screen Handler
            TouchCollectorConfiguration.CollectionMethod = CollectionMethod.Native;
            TouchCollectorConfiguration.CollectionMode = CollectionMode.InkOnly;
            TouchCollectorConfiguration.SetTouchInput(TouchCollectorConfiguration.TouchInput.TouchMoveFrequency, 0, 0, 0);
            TouchCollectorConfiguration.SetTouchInput(TouchCollectorConfiguration.TouchInput.SamplingDistance, 2, 0, 0);

Theres not much to this, the sampling distance should take an int(). And as I said the documentation states in microseconds. No matter what value is entered I get an argument our of range exception. My main problem is the touch response is really slow.

Dale


#5

You are trying to set sampling frequency to 500 000 samples per second in your code.

Here is the snippet from the MF source code. It is a SamplingFrequency property of the TouchCollector. It uses SetTouchInput internally and will give you the idea of what is expected.

So basically if you want 50 samples per second, you have to set param1 in SetTouchInput to 1000000/50=20000. One sample every 20000 microseconds


        /// <summary>
        /// Sampling rate per second. Setting 50 will result 50 touch samples in a second.
        /// </summary>
        public static int SamplingFrequency
        {
            get
            {
                int param1 = 0;
                int param2 = 0;
                int param3 = 0;

                GetTouchInput(TouchInput.SamplingDistance, ref param1, ref param2, ref param3);

                if (param1 <= 0)
                    return 0;

                return (1000000 / param1);
            }

            set
            {
                int param1 = 0;
                int param2 = 0;
                int param3 = 0;

                /// Negative or zero is not acceptable frequency.
                if (value <= 0)
                    throw new ArgumentException();

                param1 = 1000000 / value;

                /// param1 == 0 means more than one sample is requested per microsecond,
                /// which is not attainable.
                if (param1 <= 0)
                    throw new ArgumentException();

                SetTouchInput(TouchInput.SamplingDistance, param1, param2, param3);
            }
        }

Cheers,
Valentin


#6

I looked further in the code and the valid range is:

From:
20000 [italic](50 samples per second)[/italic]
To:
5000 [italic](200 samples per second)[/italic]


#7

Thanks for the information. Still really slow touch responses.

Dale


#8

Try something more than 20000. I got the values from the porting kit. The GHI implementation might use a different range.

Cheers,
Valentin


#9

Valentin… So you’re saying to speed things up, read less samples! ie… 50 samples is better that 200 samples.

Cheers Ian


#10

Collecting less will keep system less busy and might improve responsiveness.


#11

Thanks for all the help. Not much difference in responsiviness. Will have a chat with GHI.

Dale


#12

Have a word with Thomas (skewworks) The guy’s at pyxis use their own touch collection

Cheers Ian


#13

As long as you’re using WPF you’re going to see horrid responsiveness; of if you’re using TinyCore get rid of it.

If you’re not using TinyCore and you’re still sluggish to respond perhaps something else is taxing your system. If you care to try InputManager.cs from pyxis (http://www.skewworks.com/products/pyxis%202) should be pretty easy to drop into your application.