Adding more tracking features for individual setup of listener, real-world listener and source

parent 3cc3a6e9
...@@ -235,48 +235,40 @@ classdef itaVA < handle ...@@ -235,48 +235,40 @@ classdef itaVA < handle
connected = VAMatlab( 'IsTrackerConnected', this.handle ); connected = VAMatlab( 'IsTrackerConnected', this.handle );
end end
function disconnectTracker( this )
% Disconnects from the NatNet tracking server
VAMatlab( 'DisconnectTracker', this.handle )
end
% -- Tracked listener -- %
function setTrackedListener( this, listener_id ) function setTrackedListener( this, listener_id )
% Connects a VA listener with the tracked rigid body % Connects a VA listener with the tracked listener rigid body
% %
% Parameters: % Parameters:
% %
% listener_id [integer-1x1] VA listener id % listener_id [integer-1x1] VA listener id
% %
VAMatlab( 'SetTrackedListener', this.handle, listener_id ); VAMatlab( 'SetTrackedListener', this.handle, listener_id );
end end
function setTrackedSource( this, source_id )
% Connects a VA source with the tracked rigid body
%
% Parameters:
%
% source_id [integer-1x1] VA listener id
%
VAMatlab( 'SetTrackedSource', this.handle, source_id );
end
function disconnectTracker( this ) function setTrackedListenerRigidBodyIndex( this, index )
% Disconnects from the NatNet tracking server % Sets the index of the rigid body to be tracked for listener (default is 1)
VAMatlab( 'DisconnectTracker', this.handle ) VAMatlab( 'SetTrackedListenerRigidBodyIndex', this.handle, index )
end end
function setRigidBodyIndex( this, index ) function setTrackedListenerRigidBodyTranslation( this, translation )
% Sets the index of the rigid body to be tracked (default is 1) % Sets the pivot point translation for the tracked listener rigid body
VAMatlab( 'SetRigidBodyIndex', this.handle, index )
end
function setRigidBodyTranslation( this, translation )
% Sets the pivot point translation for the tracked rigid body
% %
% Parameters: % Parameters:
% %
% translation [double-3x1] Translation in local coordinate system of rigid body [m] % translation [double-3x1] Translation in local coordinate system of rigid body [m]
% %
VAMatlab( 'SetRigidBodyTranslation', this.handle, translation ) VAMatlab( 'SetTrackedListenerRigidBodyTranslation', this.handle, translation )
end end
function setRigidBodyRotation( this, rotation ) function setTrackedListenerRigidBodyRotation( this, rotation )
% Sets the rotation of orientation for the tracked rigid body % Sets the rotation of orientation for the tracked listener rigid body
% %
% Given rotation has to be a Matlab quaternion type (order: w(real), i, j, k) % Given rotation has to be a Matlab quaternion type (order: w(real), i, j, k)
% %
...@@ -284,8 +276,35 @@ classdef itaVA < handle ...@@ -284,8 +276,35 @@ classdef itaVA < handle
% %
% rotation [quaternion] Rotation of rigid body % rotation [quaternion] Rotation of rigid body
% %
VAMatlab( 'SetRigidBodyRotation', this.handle, rotation ) VAMatlab( 'SetTrackedListenerRigidBodyRotation', this.handle, rotation )
end
% -- Tracked real-world listener -- %
function setTrackedRealWorldListener( this, listener_id )
% Connects a VA real-world listener with the tracked real-world rigid body
%
% Parameters:
%
% listener_id [integer-1x1] VA listener id
%
VAMatlab( 'SetTrackedRealWorldListener', this.handle, listener_id );
end
@todo
% -- Tracked source -- %
function setTrackedSource( this, source_id )
% Connects a VA source with the tracked source rigid body
%
% Parameters:
%
% source_id [integer-1x1] VA listener id
%
VAMatlab( 'SetTrackedSource', this.handle, source_id );
end end
%% --= Functions =-- %% --= Functions =--
......
...@@ -8,18 +8,9 @@ va = itaVA( 'localhost' ) ...@@ -8,18 +8,9 @@ va = itaVA( 'localhost' )
L = va.createListener( 'itaVA_Tracked_Listener' ); L = va.createListener( 'itaVA_Tracked_Listener' );
% OptiTrack tracker conneection and listener updates % OptiTrack tracker conneection and listener updates
va.setTrackedListener( L ) va.setTrackedListener( L ) % For virtual scene / rendering
va.setTrackedRealWorldListener( L ) % For CTC reproductions
va.connectTracker va.connectTracker
% apply pivot point offset to a rigid body
% Hint: the method .calibrate of itaOptirack() calculates the individual
% offset between a head-mounted rigid body and the center of the interaural
% axis of a listener
va.setRigidBodyIndex( 1 ) % set index of rigid body that should be manipulated (cf. Motive)
va.setRigidBodyTranslation( [0 -0.08 0] ) % translation in local coordinate system of rigid body [m]
% move rigid body by 8 cm in
% negative y direction
pause( 12 ) % Observe how you can move the virtual listener in VAGUI pause( 12 ) % Observe how you can move the virtual listener in VAGUI
va.disconnectTracker va.disconnectTracker
......
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