Improving NatNet init with VA and itaOptitrack

parent 4aed54b2
......@@ -292,7 +292,7 @@ classdef itaOptitrack < handle
Optitrack_obj.port = char(sArgs.port);
% Check if NatNet dll's are existing
if ~exist(Optitrack_obj.dllPath,'dir')
if isempty( which( 'NatNetML.dll' ) )
% download NatNet version
url = 'http://s3.amazonaws.com/naturalpoint/software/NatNetSDK/NatNet_SDK_2.10.zip';
......@@ -325,11 +325,25 @@ classdef itaOptitrack < handle
delete(fullfile(Optitrack_obj.dllPath,'NatNet_SDK_2.10\NatNetSDK\Samples\Matlab\quaternion.m'))
delete(fullfile(Optitrack_obj.dllPath,'NatNet_SDK_2.10\NatNetSDK\Samples\Matlab\quaternion-license.txt'))
if strcmpi( computer('arch'), 'win64' )
delete( fullfile(Optitrack_obj.dllPath,'NatNet_SDK_2.10/NatNetSDK/lib/NatNetML.dll') )
delete( fullfile(Optitrack_obj.dllPath,'NatNet_SDK_2.10/NatNetSDK/lib/NatNetLib.lib') )
delete( fullfile(Optitrack_obj.dllPath,'NatNet_SDK_2.10/NatNetSDK/lib/NatNetLibStatic.lib') )
delete( fullfile(Optitrack_obj.dllPath,'NatNet_SDK_2.10/NatNetSDK/lib/NatNetLib.dll') )
addpath( fullfile(Optitrack_obj.dllPath,'NatNet_SDK_2.10/NatNetSDK/lib/x64' ) )
else
delete( fullfile(Optitrack_obj.dllPath,'NatNet_SDK_2.10/NatNetSDK/lib/x64/NatNetML.dll') )
delete( fullfile(Optitrack_obj.dllPath,'NatNet_SDK_2.10/NatNetSDK/lib/x64/NatNetLib.lib') )
delete( fullfile(Optitrack_obj.dllPath,'NatNet_SDK_2.10/NatNetSDK/lib/x64/NatNetLibStatic.lib') )
delete( fullfile(Optitrack_obj.dllPath,'NatNet_SDK_2.10/NatNetSDK/lib/x64/NatNetLib.dll') )
addpath( fullfile(Optitrack_obj.dllPath,'NatNet_SDK_2.10/NatNetSDK/lib' ) )
end
fprintf( '[itaOptitrack] NatNet SDK 2.10 has been successfully downloaded.\n' );
end
NET.addAssembly(fullfile(Optitrack_obj.dllPath,'NatNet_SDK_2.10/NatNetSDK/lib/x64/NatNetML.dll'));
NET.addAssembly( which( 'NatNetML.dll' ) );
% Create an instance of a NatNet client
Optitrack_obj.theClient = NatNetML.NatNetClientML(0); % Input = iConnectionType: 0 = Multicast, 1 = Unicast
......
......@@ -248,6 +248,17 @@ else
set( handles.edit_vaserver_full_path, 'String', 'not found' )
end
% NatNetML
current_natnet_dir = which( 'NatNetML.dll' );
if ~isempty( current_natnet_dir )
ainfo = NET.addAssembly( current_natnet_dir );
natnetversion_raw = NatNetML.NatNetClientML( 0 ).NatNetVersion();
vs = sprintf( 'NatNetML (OptiTrack) %d.%d', natnetversion_raw(1), natnetversion_raw(2) );
set( handles.edit_natnet_version, 'String', vs )
end
function [ found, va_component_dir ] = find_VA_Component( va_search_dir, component, recursive )
found = false;
va_component_dir = '';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment