Best intuiface asset for fast data transfer rate + questions about .NET asset creation

Hi there,

I’m trying to build an app that will transfer detailed skeletal tracking information from Nuitrack into Intuiface. At first, I was using local network triggers. The speed of these was decent, but still not quite fast enough.

I am looking for something that will transfer data at a rate similar to a good serial connection. I tried a REST based solution, but that was even slower than local network triggers.

Presently, I’m working on a .NET interface asset. I have a feeling that this will give me the speed that I’m looking for, but I’m wondering if this is actually the case. Additionally, I am wondering whether a multi-threaded .DLL can be used as a .NET interface asset. And, does it matter if any of the dependencies in that .DLL are running on different threads? You emphasize the need for co-routines on your website, but the details are a bit fuzzy.

Warm regards,
Parks

Hi Parks @emphelp,

Local Network Triggers are indeed basic HTTP calls (REST), and it’s definitely not the best for fast data transfer.
I would look at a Web Socket based solution, especially if you need data transfer over network. That’s what we use in our Face Detection solution and it’s been working well (local machine or local network).

If you’re directly connected to your sensors via USB on the PC that runs Player, you can indeed use a .NET IA to communicate with your sensors. I’m not familiar with Nuitrack, but it seems they have some C# samples, so you should be able to convert them / include them into an Interface Asset.
Multi-threading isn’t an issue in a .NET IA.

Let me know if that helps

Seb

That’s excellent. Thank you Seb. I might settle on web sockets, but I’m still interested in creating a .Net asset.

How do you define triggers with .net assets? Presently, I have some simple code that I’m using to test out data transfer. In composer, every time I re-add the updating variable (currently just an integer that’s being incremented), it has the newest value. But when I hit play, the full-screen experience only displays the starting value of said integer. I am assuming that defining a trigger will allow me to notify Intuiface whenever the value changes.

This is the code that I’m testing:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel;

namespace IntuifaceLibraryTest
{
public class IntuifaceLibraryTest
{

    public string testVariable1 = "";
    public int testVariable2 = 5;
    public event PropertyChangedEventHandler PropertyChanged;

    public int[] testVariable3 = { 1, 2, 3, 4, 5, 6, 7 };

    bool loop = true;

    public IntuifaceLibraryTest()
    {
        var loop1Task = Task.Run(async () =>
        {
            while (loop)
            {
                testVariable2 += 1;
                NotifyPropertyChanged("Whatever2");
                if (testVariable2 >= int.MaxValue)
                    testVariable2 = 0;
                await Task.Delay(1000);
            }
        });
    }

    ~IntuifaceLibraryTest()
    {
        loop = false;
    }

    private void NotifyPropertyChanged(String info)
    {
        if (PropertyChanged != null)
        {
            PropertyChanged(this, new PropertyChangedEventArgs(info));
        }
    }

    public string TestVariable1   // property
    {
        get { return testVariable1; }   // get method
        set { testVariable1 = value; }  // set method
    }

    public string TestVariable2   // property
    {
        get { return testVariable2.ToString(); }   // get method
        set 
        {
            int a = testVariable2;
            int.TryParse(value, out a);
            if (testVariable2 != a)
            {
                testVariable2 = a;
                NotifyPropertyChanged("Whatever2");
            }
        }
    }

    public int [] TestVariable3   // property
    {
        get { return testVariable3; }   // get method
        set { testVariable3 = value; }  // set method
    }

}

}

The first thing I see in your code @emphelp is that your class doesn’t implement INotifyPropertyChanged. See this article section.

You can also have a look at one of our .NET IA code sample on Github, such as this TUIO Interface Asset. Look into TUIOTagIA.cs and see how private attributes / public properties are used with this pattern.

The property changed event handler is in there, look again. But I’ll look at this example.

The event handler yes, but not the interface implementation (line where you define your class) or the private attribute / public property definitions :wink:

Hi Seb,

How are you? I’ve gotten data to transfer between the asset and Intuiface, and it works quite well. Thank you for your help!

I have one other question. The destructor in my .dll isn’t firing properly when I close Intuiface. This is somewhat of an issue because Nuitrack needs to shut down on exit, otherwise it maintains a link to the camera. Any idea how to get this to happen?

Edit: I figured it out, you have to derive your class from iDisposable and implement “Dispose” instead of a regular destructor

1 Like

Hi @emphelp,

Thanks for your feedback! Now we’ll want to see the result of what you do with Nuitrack and Intuiface combined together :wink: