Skip to content

Commit 3105fa0

Browse files
committed
UDP connection through stateful firewall; fixing GitHub issue #6
1 parent d27e408 commit 3105fa0

22 files changed

Lines changed: 695 additions & 60 deletions

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11

22
# List of ART DTRACK Plugin for Unity Game Engine releases
33

4+
## v1.1.3 (2024-05-03)
5+
6+
- (Optionally) enables UDP connection through stateful firewall
7+
- Fixing DTrack1 parsing error (cf. GitHub issue #6)
8+
49
## v1.1.2 (2023-04-01)
510

611
- Some reorganization to allow release as UPM package, esp. in OpenUPM
29.6 KB
Loading
4.1 KB
Loading

README.md

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# ART DTRACK Plugin for Unity Game Engine 2019 or later
22

3-
**Version v1.1.2**
3+
**Version v1.1.3**
44

55
This is a component for Unity 2019 or later with the purpose of
66
native integration of the Advanced Realtime Tracking (ART) DTRACK
@@ -18,28 +18,30 @@ supports the DTRACK Standard Body ('6d'), Flystick ('6df2') and Fingertracking (
1818

1919
## Features <a name="features"></a>
2020

21-
- Validated with Unity Editors 2019.4 to 2022.3
21+
- Validated with Unity Editors 2019.4 to 2023.2 (but should work with any later Unity)
2222
- Supports DTRACK room calibration modes 'Powerwall' and 'Normal'
2323
- Supports tracking of 6DOF Standard Bodies and Flystick2, Flystick2+ and Flystick3
2424
- Supports Flystick buttons and joystick/trigger (emitting Unity events)
2525
- Supports Fingertracking, with 'Leap Motion Realistic Male/Female Hands' (by Storkplay)
26+
- (Optionally) enables UDP connection through stateful firewall
2627

2728
## Installing the ART DTRACK Plugin <a name="installing"></a>
2829

2930
There are several ways to get the ART DTRACK Plugin.
3031

31-
### GitHub <a name="github"></a>
32+
### Unity Asset Store <a name="assetstore"></a>
3233

33-
You can download a ready-to-use custom Unity package ( UnityDTrackPlugin-vX.X.X.unitypackage ) at<br>
34-
[https://github.com/ar-tracking/UnityDTrackPlugin/releases](https://github.com/ar-tracking/UnityDTrackPlugin/releases).
34+
The plugin is available (for free) in the Unity Asset Store
35+
[https://assetstore.unity.com/packages/tools/integration/art-dtrack-plugin-246990](https://assetstore.unity.com/packages/tools/integration/art-dtrack-plugin-246990).
3536

36-
In order to install the package, follow the steps below.
37+
After 'purchasing' you can install it via the Unity Package Manager:
3738

3839
1. Launch Unity Hub
3940
- Create/Open Unity project
40-
- Import package ( *Assets* &rarr; *Import Package...* &rarr; *Custom Package...* )
41+
- Open Package Manager ( *Window* &rarr; *Package Manager* &rarr; *Packages: My Assets* )
42+
- Download the package (button *Download* ), then install it (button *Install* )
4143

42-
The plugin will be installed in your project's assets folder:<br>
44+
The plugin will be installed in your project's Assets folder:<br>
4345
/path/to/unity/projects/*MyUnityProject*/**Assets/ARTDTrackPlugin**/ .
4446

4547
### OpenUPM <a name="openupm"></a>
@@ -51,6 +53,7 @@ The ART DTRACK plugin is available (for free) via
5153
To install it, follow the instructions mentioned at the above website; roughly:
5254

5355
1. Launch Unity Hub
56+
- Create/Open Unity project
5457
- Open *Edit* &rarr; *Project Settings...* &rarr; *Package Manager*
5558
- Add a new Scoped Registry (corresponding to the above OpenUPM link), then click *Save* or *Apply*
5659
- Open Package Manager ( *Window* &rarr; *Package Manager* &rarr; *Packages: My Registries* )
@@ -59,6 +62,20 @@ To install it, follow the instructions mentioned at the above website; roughly:
5962
The plugin will be installed in your project's Packages folder:<br>
6063
/path/to/unity/projects/*MyUnityProject*/**Packages/ART DTRACK Plugin**/ .
6164

65+
### GitHub <a name="github"></a>
66+
67+
You can download a ready-to-use custom Unity package ( UnityDTrackPlugin-vX.X.X.unitypackage ) at<br>
68+
[https://github.com/ar-tracking/UnityDTrackPlugin/releases](https://github.com/ar-tracking/UnityDTrackPlugin/releases).
69+
70+
In order to install the package, follow the steps below.
71+
72+
1. Launch Unity Hub
73+
- Create/Open Unity project
74+
- Import package ( *Assets* &rarr; *Import Package...* &rarr; *Custom Package...* )
75+
76+
The plugin will be installed in your project's Assets folder:<br>
77+
/path/to/unity/projects/*MyUnityProject*/**Assets/ARTDTrackPlugin**/ .
78+
6279
### Plain Sources <a name="plainsources"></a>
6380

6481
You can download or clone sources for this plugin at
@@ -203,6 +220,14 @@ this prefix must be removed.
203220
<br>
204221

205222

223+
### Fingertracking <a name="dtrackfingertracking"></a>
224+
225+
When configuring ART Fingertracking hand devices with 3 thimbles, be sure to activate the _Simulate 5 fingers_ setting.
226+
227+
![Figure: DTRACK3 Fingertracking administration dialog](Documentation~/images/dtrack-fingertracking-administration.png)
228+
<br>
229+
230+
206231
## Plugin Configuration <a name="pluginconfiguration"></a>
207232

208233
Streaming position, rotation and button events data from DTRACK
@@ -214,6 +239,9 @@ it a name, e.g. **DTrackSource**. To this object attach the
214239

215240
- Set *Listen Port* number matching the
216241
setting for DTRACK (see section [**Setting Outputs**](#dtracksettingoutputs))
242+
- Optionally set *Controller Host* with hostname or IP address of your ART Controller, if there is a
243+
'stateful firewall' installed between Controller and Unity; normally that's sufficient to pass UDP packets
244+
with tracking data to the plugin
217245
- Set *DTrack Coordinates* matching the calibration mode used in DTRACK
218246
(see section [**Room Calibration**](#dtrackroomcalibration))
219247

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/* DTrackSDK in C#: DTrackMeaTool.cs
2+
*
3+
* Data object containing DTRACK output data of one Measurement Tool.
4+
*
5+
* Copyright (c) 2024 Advanced Realtime Tracking GmbH & Co. KG
6+
*
7+
* Redistribution and use in source and binary forms, with or without
8+
* modification, are permitted provided that the following conditions are met:
9+
*
10+
* 1. Redistributions of source code must retain the above copyright
11+
* notice, this list of conditions and the following disclaimer.
12+
* 2. Redistributions in binary form must reproduce the above copyright
13+
* notice, this list of conditions and the following disclaimer in the
14+
* documentation and/or other materials provided with the distribution.
15+
* 3. Neither the name of copyright holder nor the names of its contributors
16+
* may be used to endorse or promote products derived from this software
17+
* without specific prior written permission.
18+
*
19+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29+
*/
30+
31+
using DTrackSDK.Interfaces;
32+
33+
namespace DTrackSDK
34+
{
35+
36+
37+
public class DTrackMeaTool : DTrackBody
38+
{
39+
public float TipRadius { get; }
40+
public int NumButtons { get; }
41+
public bool[] Buttons { get; }
42+
43+
public DTrackMeaTool( int id, float quality, float sx, float sy, float sz,
44+
float r0, float r1, float r2, float r3, float r4, float r5, float r6, float r7, float r8,
45+
float tipradius, bool[] buttons, int numButtons )
46+
: base( id, quality, sx, sy, sz, r0, r1, r2 ,r3, r4, r5, r6, r7, r8 )
47+
{
48+
this.TipRadius = tipradius;
49+
this.NumButtons = numButtons;
50+
this.Buttons = buttons;
51+
}
52+
}
53+
54+
55+
} // namespace DTrackSDK
56+

Sdk/DTrackSDK-CSharp/Source/DTrackObjects/DTrackMeaTool.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Sdk/DTrackSDK-CSharp/Source/DTrackObjects/Frame.cs

Lines changed: 68 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
*
33
* Data object containing DTRACK output data of one frame.
44
*
5-
* Copyright (c) 2019-2022 Advanced Realtime Tracking GmbH & Co. KG
5+
* Copyright (c) 2019-2024 Advanced Realtime Tracking GmbH & Co. KG
66
*
77
* Redistribution and use in source and binary forms, with or without
88
* modification, are permitted provided that the following conditions are met:
@@ -39,21 +39,88 @@ public class Frame
3939
// frame counter, timestamp
4040
public uint FrameCounter { get; set; }
4141
public double TimeStamp { get; set; }
42+
public uint TimeStampSec { get; set; }
43+
public uint TimeStampUsec { get; set; }
44+
public uint LatencyUsec { get; set; }
4245

4346
// Standard Bodies
4447
public Dictionary< int, DTrackBody > Bodies { get; set; }
48+
public int NumBodies { get; set; } // number of calibrated Standard Bodies (as far as known)
4549

4650
// Flysticks
4751
public Dictionary< int, DTrackFlystick > Flysticks { get; set; }
52+
public int NumFlysticks { get; set; } // number of calibrated Flysticks
53+
54+
// Measurement Tools
55+
public Dictionary< int, DTrackMeaTool > MeaTools { get; set; }
56+
public int NumMeaTools { get; set; } // number of calibrated Measurement Tools
4857

4958
// Fingertracking hands
5059
public Dictionary< int, DTrackHand > Hands { get; set; }
60+
public int NumHands { get; set; } // number of calibrated Fingertracking hands (as far as known)
5161

5262

5363
public Frame()
5464
{
5565
this.FrameCounter = 0;
5666
this.TimeStamp = -1.0;
67+
this.TimeStampSec = 0;
68+
this.TimeStampUsec = 0;
69+
this.LatencyUsec = 0;
70+
71+
this.NumBodies = 0;
72+
this.NumFlysticks = 0;
73+
this.NumMeaTools = 0;
74+
this.NumHands = 0;
75+
}
76+
77+
78+
// Get Standard Body data.
79+
80+
public DTrackBody GetBody( int id )
81+
{
82+
if ( this.Bodies == null ) return null;
83+
84+
DTrackBody body;
85+
if ( this.Bodies.TryGetValue( id, out body ) ) return body;
86+
87+
return null;
88+
}
89+
90+
// Get Flystick data.
91+
92+
public DTrackFlystick GetFlystick( int id )
93+
{
94+
if ( this.Flysticks == null ) return null;
95+
96+
DTrackFlystick flystick;
97+
if ( this.Flysticks.TryGetValue( id, out flystick ) ) return flystick;
98+
99+
return null;
100+
}
101+
102+
// Get Measurement Tool data.
103+
104+
public DTrackMeaTool GetMeaTool( int id )
105+
{
106+
if ( this.MeaTools == null ) return null;
107+
108+
DTrackMeaTool meatool;
109+
if ( this.MeaTools.TryGetValue( id, out meatool ) ) return meatool;
110+
111+
return null;
112+
}
113+
114+
// Get Fingertracking hand data.
115+
116+
public DTrackHand GetHand( int id )
117+
{
118+
if ( this.Hands == null ) return null;
119+
120+
DTrackHand hand;
121+
if ( this.Hands.TryGetValue( id, out hand ) ) return hand;
122+
123+
return null;
57124
}
58125
}
59126

0 commit comments

Comments
 (0)