Skip to content

Commit

Permalink
NatNet SDK version 3.1.0 (September 11, 2018)
Browse files Browse the repository at this point in the history
  • Loading branch information
mje-nz committed Dec 23, 2018
1 parent 8a5cd00 commit 5a8a379
Show file tree
Hide file tree
Showing 929 changed files with 1,241 additions and 600 deletions.
Binary file modified NatNetUsersGuide.pdf 100644 → 100755
Binary file not shown.
Empty file modified Readme-NatNet.txt 100644 → 100755
Empty file.
17 changes: 17 additions & 0 deletions Readme.md
Expand Up @@ -7,6 +7,23 @@ See also [mje-nz/python_natnet](https://github.com/mje-nz/python_natnet) and [mj

## Changelog

__3.1.0__ _(September 11, 2018)_

* Updated the sample projects for the Apache Software License. This gives greater open source freedom with the NatNet redistributable.
* Included additional timing metrics and recording to the WinForms application.
* Updated the python depacketizer sample to match the correct rigid body descriptions.
* Updated the SampleClient and SampleClient3D projects, so that they may be used exclusively with unlabeled markers.
* Updated the explanation of labeled markers in the PacketClient.cpp to be more descriptive.
* Improved clarity of the version and compilation information for sample applications.
* Added a broadcast option to the multicast data channel.
* Fixed a crash when attempting to stream over 99 rigid bodies at one time.
* Fixed a crash with the WinForms test app by removing the ability to edit text in the IP address combo box.
* Fixed an issue where the labeled marker list did not report the flags when a labeled marker was occluded.
* Fixed a bug with automatically determining the IP address on start.
* Fixed a bug in the WinForms test app that caused it to report incorrect rigid body data in some cases.
* Fixed a bug in the WinForms test app where it would not refresh when switching between multicast and unicast.
* Renamed "Labeled Markers" to just "Markers" in the WinForms application.

__3.0.1__ _(November 7, 2017)_

* Cleaned up the SampleClient by removing OtherMarkers sample and refactoring some other code.
Expand Down
Empty file modified Samples/BroadcastSample/BroadcastSample.sln 100644 → 100755
Empty file.
28 changes: 14 additions & 14 deletions Samples/BroadcastSample/BroadcastSample/BroadcastSample.cpp 100644 → 100755
@@ -1,17 +1,17 @@
//=============================================================================
// Copyright © 2014 NaturalPoint, Inc. All Rights Reserved.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall NaturalPoint, Inc. or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//=============================================================================
/*
Copyright © 2014 NaturalPoint Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */

/*
BroadcastClient.cpp
Expand Down
Empty file modified Samples/BroadcastSample/BroadcastSample/BroadcastSample.vcxproj 100644 → 100755
Empty file.
14 changes: 14 additions & 0 deletions Samples/Matlab/NatNetEventHandlerSample.m 100644 → 100755
@@ -1,3 +1,17 @@
%Copyright © 2018 Naturalpoint
%
%Licensed under the Apache License, Version 2.0 (the "License");
%you may not use this file except in compliance with the License.
%You may obtain a copy of the License at
%
%http://www.apache.org/licenses/LICENSE-2.0
%
%Unless required by applicable law or agreed to in writing, software
%distributed under the License is distributed on an "AS IS" BASIS,
%WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
%See the License for the specific language governing permissions and
%limitations under the License.

% Optitrack Matlab / NatNet Event Handler Sample
% Requirements:
% - OptiTrack Motive 2.0 or later
Expand Down
Empty file modified Samples/Matlab/NatNetLib.dll 100644 → 100755
Empty file.
Empty file modified Samples/Matlab/NatNetML.dll 100644 → 100755
Empty file.
14 changes: 14 additions & 0 deletions Samples/Matlab/NatNetPollingSample.m 100644 → 100755
@@ -1,3 +1,17 @@
%Copyright © 2018 Naturalpoint
%
%Licensed under the Apache License, Version 2.0 (the "License");
%you may not use this file except in compliance with the License.
%You may obtain a copy of the License at
%
%http://www.apache.org/licenses/LICENSE-2.0
%
%Unless required by applicable law or agreed to in writing, software
%distributed under the License is distributed on an "AS IS" BASIS,
%WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
%See the License for the specific language governing permissions and
%limitations under the License.

% Optitrack Matlab / NatNet Polling Sample
% Requirements:
% - OptiTrack Motive 2.0 or later
Expand Down
Empty file modified Samples/Matlab/event handlers/consoleprint.m 100644 → 100755
Empty file.
Empty file modified Samples/Matlab/event handlers/plotposition.m 100644 → 100755
Empty file.
Empty file modified Samples/Matlab/event handlers/plotrotation.m 100644 → 100755
Empty file.
Empty file modified Samples/Matlab/event handlers/plotvelocity.m 100644 → 100755
Empty file.
Empty file modified Samples/Matlab/natnet.p 100644 → 100755
Empty file.
Empty file modified Samples/Matlab/quaternion-license.txt 100644 → 100755
Empty file.
Empty file modified Samples/Matlab/quaternion.m 100644 → 100755
Empty file.
Empty file modified Samples/MayaPlugIn/ReadMe.txt 100644 → 100755
Empty file.
Empty file modified Samples/NatCap/App.xaml 100644 → 100755
Empty file.
17 changes: 16 additions & 1 deletion Samples/NatCap/App.xaml.cs 100644 → 100755
@@ -1,4 +1,19 @@
using System;
/*
Copyright © 2013 NaturalPoint Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */

using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
Expand Down
Empty file modified Samples/NatCap/MainWindow.xaml 100644 → 100755
Empty file.
17 changes: 16 additions & 1 deletion Samples/NatCap/MainWindow.xaml.cs 100644 → 100755
@@ -1,4 +1,19 @@
using System;
/*
Copyright © 2013 NaturalPoint Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
Expand Down
Empty file modified Samples/NatCap/NatCap.csproj 100644 → 100755
Empty file.
17 changes: 16 additions & 1 deletion Samples/NatCap/Properties/AssemblyInfo.cs 100644 → 100755
@@ -1,4 +1,19 @@
using System.Reflection;
/*
Copyright © 2013 NaturalPoint Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */

using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
Expand Down
2 changes: 1 addition & 1 deletion Samples/NatCap/Properties/Resources.Designer.cs 100644 → 100755

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file modified Samples/NatCap/Properties/Resources.resx 100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion Samples/NatCap/Properties/Settings.Designer.cs 100644 → 100755

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file modified Samples/NatCap/Properties/Settings.settings 100644 → 100755
Empty file.
Empty file modified Samples/NatCap/Styles/MetroDark.MSControls.Core.Implicit.xaml 100644 → 100755
Empty file.
Empty file modified Samples/NatNetSamples.sln 100644 → 100755
Empty file.
37 changes: 19 additions & 18 deletions Samples/PacketClient/PacketClient.cpp 100644 → 100755
@@ -1,17 +1,17 @@
//=============================================================================
// Copyright © 2014 NaturalPoint, Inc. All Rights Reserved.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall NaturalPoint, Inc. or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//=============================================================================
/*
Copyright © 2012 NaturalPoint Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */

/*
Expand Down Expand Up @@ -777,7 +777,8 @@ void Unpack(char* pData)
} // next skeleton
}

// labeled markers (NatNet version 2.3 and later)
// labeled markers (NatNet version 2.3 and later)
// labeled markers - this includes all markers: Active, Passive, and 'unlabeled' (markers with no asset but a PointCloud ID)
if( ((major == 2)&&(minor>=3)) || (major>2))
{
int nLabeledMarkers = 0;
Expand Down Expand Up @@ -821,9 +822,9 @@ void Unpack(char* pData)
bool bModelSolved = (params & 0x04) != 0; // position provided by model solve
if ((major >= 3) || (major == 0))
{
bool bHasModel = (params & 0x08) != 0; // marker has an associated model
bool bUnlabeled = (params & 0x10) != 0; // marker is an unlabeled marker
bool bActiveMarker = (params & 0x20) != 0; // marker is an active marker
bool bHasModel = (params & 0x08) != 0; // marker has an associated asset in the data stream
bool bUnlabeled = (params & 0x10) != 0; // marker is 'unlabeled', but has a point cloud ID
bool bActiveMarker = (params & 0x20) != 0; // marker is an actively labeled LED marker
}

}
Expand Down
Empty file modified Samples/PacketClient/PacketClient.vcxproj 100644 → 100755
Empty file.
28 changes: 14 additions & 14 deletions Samples/PacketClient/PacketClientUDPBroadcast.cpp 100644 → 100755
@@ -1,17 +1,17 @@
//=============================================================================
// Copyright © 2010 NaturalPoint, Inc. All Rights Reserved.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall NaturalPoint, Inc. or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//=============================================================================
/*
Copyright © 2013 NaturalPoint Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */

/*
Expand Down
Empty file.
Binary file modified Samples/PacketClient/x64/Release/PacketClient.obj 100644 → 100755
Binary file not shown.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Binary file modified Samples/PacketClient/x64/Release/vc140.pdb 100644 → 100755
Binary file not shown.
53 changes: 42 additions & 11 deletions Samples/PythonClient/NatNetClient.py 100644 → 100755
@@ -1,4 +1,20 @@
import socket
#Copyright © 2018 Naturalpoint
#
#Licensed under the Apache License, Version 2.0 (the "License");
#you may not use this file except in compliance with the License.
#You may obtain a copy of the License at
#
#http://www.apache.org/licenses/LICENSE-2.0
#
#Unless required by applicable law or agreed to in writing, software
#distributed under the License is distributed on an "AS IS" BASIS,
#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#See the License for the specific language governing permissions and
#limitations under the License.

# OptiTrack NatNet direct depacketization library for Python 3.x

import socket
import struct
from threading import Thread

Expand All @@ -14,7 +30,10 @@ def trace( *args ):
class NatNetClient:
def __init__( self ):
# Change this value to the IP address of the NatNet server.
self.serverIPAddress = "169.254.201.120"
self.serverIPAddress = "127.0.0.1"

# Change this value to the IP address of your local network interface
self.localIPAddress = "127.0.0.1"

# This should match the multicast address listed in Motive's streaming settings.
self.multicastAddress = "239.255.42.99"
Expand Down Expand Up @@ -49,11 +68,12 @@ def __createDataSocket( self, port ):
result = socket.socket( socket.AF_INET, # Internet
socket.SOCK_DGRAM,
socket.IPPROTO_UDP) # UDP
result.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
result.bind( ('', port) )

mreq = struct.pack("4sl", socket.inet_aton(self.multicastAddress), socket.INADDR_ANY)
result.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP, mreq)
result.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
result.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP, socket.inet_aton(self.multicastAddress) + socket.inet_aton(self.localIPAddress))

result.bind( (self.localIPAddress, port) )

return result

# Create a command socket to attach to the NatNet stream
Expand Down Expand Up @@ -87,7 +107,7 @@ def __unpackRigidBody( self, data ):
self.rigidBodyListener( id, pos, rot )

# RB Marker Data ( Before version 3.0. After Version 3.0 Marker data is in description )
if( self.__natNetStreamVersion[0] < 3 ) :
if( self.__natNetStreamVersion[0] < 3 and self.__natNetStreamVersion[0] != 0) :
# Marker count (4 bytes)
markerCount = int.from_bytes( data[offset:offset+4], byteorder='little' )
offset += 4
Expand All @@ -113,9 +133,6 @@ def __unpackRigidBody( self, data ):
offset += 4
trace( "\tMarker Size", i, ":", size[0] )

# Skip padding inserted by the server
offset += 4

if( self.__natNetStreamVersion[0] >= 2 ):
markerError, = FloatValue.unpack( data[offset:offset+4] )
offset += 4
Expand Down Expand Up @@ -344,7 +361,7 @@ def __unpackRigidBodyDescription( self, data ):
if( self.__natNetStreamVersion[0] >= 2 ):
name, separator, remainder = bytes(data[offset:]).partition( b'\0' )
offset += len( name ) + 1
trace( "\tMarker Name:", name.decode( 'utf-8' ) )
trace( "\tRigidBody Name:", name.decode( 'utf-8' ) )

id = int.from_bytes( data[offset:offset+4], byteorder='little' )
offset += 4
Expand All @@ -355,6 +372,20 @@ def __unpackRigidBodyDescription( self, data ):
timestamp = Vector3.unpack( data[offset:offset+12] )
offset += 12

# Version 3.0 and higher, rigid body marker information contained in description
if (self.__natNetStreamVersion[0] >= 3 or self.__natNetStreamVersion[0] == 0 ):
markerCount = int.from_bytes( data[offset:offset+4], byteorder='little' )
offset += 4
trace( "\tRigidBody Marker Count:", markerCount )

markerCountRange = range( 0, markerCount )
for marker in markerCountRange:
markerOffset = Vector3.unpack(data[offset:offset+12])
offset +=12
for marker in markerCountRange:
activeLabel = int.from_bytes(data[offset:offset+4],byteorder = 'little')
offset += 4

return offset

# Unpack a skeleton description packet
Expand Down
Empty file modified Samples/PythonClient/PythonClient.pyproj 100644 → 100755
Empty file.
Empty file modified Samples/PythonClient/PythonClient.sln 100644 → 100755
Empty file.
22 changes: 21 additions & 1 deletion Samples/PythonClient/PythonSample.py 100644 → 100755
@@ -1,4 +1,24 @@
from NatNetClient import NatNetClient
#Copyright © 2018 Naturalpoint
#
#Licensed under the Apache License, Version 2.0 (the "License");
#you may not use this file except in compliance with the License.
#You may obtain a copy of the License at
#
#http://www.apache.org/licenses/LICENSE-2.0
#
#Unless required by applicable law or agreed to in writing, software
#distributed under the License is distributed on an "AS IS" BASIS,
#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#See the License for the specific language governing permissions and
#limitations under the License.


# OptiTrack NatNet direct depacketization sample for Python 3.x
#
# Uses the Python NatNetClient.py library to establish a connection (by creating a NatNetClient),
# and receive data via a NatNet connection and decode it using the NatNetClient library.

from NatNetClient import NatNetClient

# This is a callback function that gets connected to the NatNet client and called once per mocap frame.
def receiveNewFrame( frameNumber, markerSetCount, unlabeledMarkersCount, rigidBodyCount, skeletonCount,
Expand Down
Empty file modified Samples/RebroadcastMotiveData/RebroadcastMotiveData.vcxproj 100644 → 100755
Empty file.
Empty file.
Empty file modified Samples/RebroadcastMotiveData/src/LightCraft Protocol/HiTimer.h 100644 → 100755
Empty file.

0 comments on commit 5a8a379

Please sign in to comment.