Home Forums Software Development Button that activates with gaze

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #8338
    Borja Vicinay
    Participant

    I want to create several buttons that activate after gazing over it for 800 milliseconds. I am using a VirtualWindow overlaying the button and an interactor. However, the interactor only triggers when the gaze enters and leaves. How can I setup a function that executes after a user gazes the button for a certain amount of time.

    I have tried using timers, but this does not seem to work well. I would have expected the GazeAware behavior to include a delay… How can I approach/solve this.

    #8345
    Grant [Tobii]
    Keymaster

    Hi @bvicinay, thanks for your query. Indeed a timer routine is the best way to implement tracking dwell time within a Gaze Enabled Object. Perhaps you could share a snippet of your code or explain the issue you are having using a timer? I am afraid there is no inbuilt function to do this…

    #8349
    Borja Vicinay
    Participant

    I want to create a number keypad (1-9) where you can click a button by dwelling 800 miliseconds over it.

    Executes once the window is loaded:

    bounds1 = GetItemBounds(btn1);
    win1 = virtualWindowsAgent.CreateFreeFloatingVirtualWindowAsync("window1", bounds1).Result;
    agent1 = host.InitializeVirtualInteractorAgent(win1.Id);
    agent1
        .AddInteractorFor(bounds1)
        .WithGazeAware()
        .HasGaze(() => btnEnter(1))
        .LostGaze(() => btnLeave(1));

    Function declarations:

    private void btnEnter(int btn)
    {
        timer.Restart();
        currBtn = btn;
        while (currBtn == btn)
        {
            if (timer.ElapsedMilliseconds > 800 && currBtn == btn)
            {
                addText(btn.ToString());
                timer.Restart();
                break;
            }
        }
    
    }
    private void btnLeave(int btn)
    {
        timer.Restart();
        currBtn = 0;
    }

    This is not working correctly. When I gaze over 1 button it works (after the dwell time) but if I try to type 23 for example it types in other numbers in between. Are the enter/leave calls asynchronous?

    Many thanks for your help!

    #8354
    Grant [Tobii]
    Keymaster

    Hi @bvicinay, okay thanks for that information. I would say you need to evaluate the means by which you are calling functions according to when gaze is captured within a gaze-aware component. Luckily, there is a pertinent example I can provide for you which should hopefully point you on the right track.

    Please download the Tobii Core SDK Interaction samples for free @ https://github.com/Tobii/interaction-samples
    Once you have loaded the solution into Visual Studio, goto the example ‘Gaze Aware Elements’ within the WPF Samples folder.

    You will there within the file MainWindow.xaml the proper technique to determine gaze dwell time and how to act upon it. Hopefully this is exactly what you are looking for! Please let us know if you still hit any issues.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.