Asking for streaming data from TT to WinFornsSample

NatNet, VRPN, TrackD, and Plugins
Post Reply
cuterabbit
Posts: 9
Joined: Wed Jul 25, 2012 1:08 am

Asking for streaming data from TT to WinFornsSample

Post by cuterabbit »

Hi, I am new for Optitrack and NatNet SDK. I have some question about streaming data from Tracking Tools to WinFormsSample.
When I create trackable more than 2 groups in tracking tools, WinFormsSample that is an example in NatNet SDK must show pose [x,y,x] of last trackable. It does not show trackable 1 or trackable2 in datagridview.
I use Tracking Tool version 2.5 and NatNet SDK version 2.2.0
NaturalPoint - Mike
Posts: 1896
Joined: Tue Feb 01, 2011 8:41 am
Location: Corvallis, OR

Re: Asking for streaming data from TT to WinFornsSample

Post by NaturalPoint - Mike »

Hello -

I've merged the two threads created on this question so we can address them here.

I am having a bit of trouble understanding what your issue is, could you explain it a bit more in depth?
cuterabbit
Posts: 9
Joined: Wed Jul 25, 2012 1:08 am

Re: Asking for streaming data from TT to WinFornsSample

Post by cuterabbit »

Thanks for your answer in my post.
I have some trouble with C# application name WinFormsSample. Pose of markers, as marker0, marker1, and marker2 of trackable1, does not shown in Table of C# application. When I have two trackable.
cuterabbit
Posts: 9
Joined: Wed Jul 25, 2012 1:08 am

Re: Asking for streaming data from TT to WinFornsSample

Post by cuterabbit »

I have question for C# Coding.

Code: Select all

private void UpdateDataGrid()
        {
            // update MarkerSet data
            for (int i = 0; i < m_FrameOfData.nMarkerSets; i++)
            {
                NatNetML.MarkerSetData ms = m_FrameOfData.MarkerSets[i];
                for (int j = 0; j < ms.nMarkers; j++)
                {
                    string strUniqueName = ms.MarkerSetName +i.ToString()+ j.ToString();
                    int key = strUniqueName.GetHashCode();
                    if(htMarkers.Contains(key))
                    {
                        int rowIndex = (int)htMarkers[key];
                        if (rowIndex >= 0)
                        {
                            dataGridView1.Rows[rowIndex].Cells[1].Value = ms.Markers[j].x;
                            dataGridView1.Rows[rowIndex].Cells[2].Value = ms.Markers[j].y;
                            dataGridView1.Rows[rowIndex].Cells[3].Value = ms.Markers[j].z;
                        }
                    }
                }
            }
I have check that ms.MarkerSetName is string value. Its outcome value is always Trackable2 when I have two rigid bodies. It is correct or not.
NaturalPoint - Mike
Posts: 1896
Joined: Tue Feb 01, 2011 8:41 am
Location: Corvallis, OR

Re: Asking for streaming data from TT to WinFornsSample

Post by NaturalPoint - Mike »

Marker sets are really more of an arena geared solution. I'd recommend using rigid body id's and marker lists, as seen in the sampleclient.
cuterabbit
Posts: 9
Joined: Wed Jul 25, 2012 1:08 am

Re: Asking for streaming data from TT to WinFornsSample

Post by cuterabbit »

Since, I have changed C# code in NatNet SDK as following

Code: Select all

private void UpdateDataGrid()
        {
            // update MarkerSet data
            for (int i = 0; i < m_FrameOfData.nMarkerSets; i++)
            {
                NatNetML.MarkerSetData ms = m_FrameOfData.MarkerSets[i];
                for (int j = 0; j < ms.nMarkers; j++)
                {
                    string strUniqueName = ms.MarkerSetName +i.ToString()+ j.ToString();
                    int key = strUniqueName.GetHashCode();
                    if(htMarkers.Contains(key))
                    {
                        int rowIndex = (int)htMarkers[key];
                        if (rowIndex >= 0)
                        {
dataGridView1.Rows[3].Cells[1].Value = ms.Markers[0].x;
dataGridView1.Rows[4].Cells[1].Value = ms.Markers[1].x;
dataGridView1.Rows[5].Cells[1].Value = ms.Markers[2].x;
dataGridView1.Rows[7].Cells[1].Value = ms.Markers[3].x;
dataGridView1.Rows[8].Cells[1].Value = ms.Markers[4].x;
dataGridView1.Rows[9].Cells[1].Value = ms.Markers[5].x; 
dataGridView1.Rows[3].Cells[2].Value = ms.Markers[0].y;
dataGridView1.Rows[4].Cells[2].Value = ms.Markers[1].y;
dataGridView1.Rows[5].Cells[2].Value = ms.Markers[2].y;
dataGridView1.Rows[7].Cells[2].Value = ms.Markers[3].y;
dataGridView1.Rows[8].Cells[2].Value = ms.Markers[4].y;
dataGridView1.Rows[9].Cells[2].Value = ms.Markers[5].y;
dataGridView1.Rows[3].Cells[3].Value = ms.Markers[0].z;   
dataGridView1.Rows[4].Cells[2].Value = ms.Markers[1].z;
dataGridView1.Rows[5].Cells[2].Value = ms.Markers[2].z;
dataGridView1.Rows[7].Cells[2].Value = ms.Markers[3].z;
dataGridView1.Rows[8].Cells[2].Value = ms.Markers[4].z;
dataGridView1.Rows[9].Cells[2].Value = ms.Markers[5].z;                      
                        }
                    }
                }
            }
When I debug with this code, the interface has shown as below

MarkerSet:Trackable1
Marker0 X:0.09,Y:0.00,Z:0.44
Marker1 X:-0.03,Y:0.00,Z:0.45
Marker2 X:-0.02,Y:0.00,Z:0.37

MarkerSet:Trackable2
Marker0 X:0.00,Y:0.00,Z:0.00
Marker1 X:0.00,Y:0.00,Z:0.00
Marker2 X:0.00,Y:0.00,Z:0.00

In PacketClient shows
Model Name: Trackable2
Marker Count :3
Marker 0: [x=0.09,y=-0.00,z=0.44]
Marker 1: [x=-0.03,y=-0.00,z=0.45]
Marker 2: [x=-0.02,y=0.00,z=-0.37]
Model Name:
Marker Count:0
Unidentified Marker Count:6
Marker 0 : pos = [0.09,-0.00,0.44]
Marker 1 : pos = [-0.02,0.00,0.37]
Marker 2 : pos = [-0.09,0.06,-0.39]
Marker 3 : pos = [-0.03,-0.00,0.45]
Marker 4 : pos = [-0.03,0.06,0.00]
Marker 5 : pos = [0.26,0.06,-0.03]
Rigid Body Count:2 and so on

I have two problems. First, why Marker0,1 and 2 are zeros in some markerset and how to show all pos of marker in interface.
Thank for your rely and sorry for long post
Last edited by cuterabbit on Mon Aug 20, 2012 9:30 am, edited 0 times in total.
Reason: added [code] for readability
Post Reply