Remote start/stop Vicon Nexus Motion Capture from a separate computer.

10 次查看(过去 30 天)
I am trying to simultaneously start and stop multiple programs including motion capture using Nexus. I Would like to use Matlab from a separate computer to start/stop while still save the timing information (e.g., frames per second captured) in the Matlab computer used (as a CSV).
I have used the available real-time code (from Vicon/Nexus's website) but I am having issues. I am able to obtain contact the Nexus computer using the IP address and get some information (e.g., name of segments of a subject), but I cannot remote start/stop nor get any captured data (i.e., x,y,z coordinates). I can send you the m-file I used previously used.

回答(1 个)

W. Owen Brimijoin
W. Owen Brimijoin 2013-9-12
As far as I know, what you are asking for is not something that the ViconDataStreamSDK actually does. What the SDK can do is report the coordinates of a particular marker. It does this remarkably quickly, so you could use a timer object in Matlab to make repeated calls to the SDK for marker locations and assemble an array of these coordinates.
Provided you already have a connection to the SDK, you can use a function like the following to get the coordinates of the markers in the cell array 'MarkerNames'
function coordinates = report_marker_coordinates(SubjectName,MarkerNames)
%REPORT_MARKER_COORDINATES returns the xyz position of Vicon markers.
% Using the ViconDataStreamSDK, this will capture and report back the
% xyz position of markers in 'MarkerNames' in the subject 'SubjectName'
%
% Example:
% REPORT_MARKER_COORDINATES('Subject0',{'Unlabeled0','Unlabeled1'});
% Author: W. Owen Brimijoin - MRC Institute of Hearing Research
ppos = libpointer('doublePtrPtr', [0.0 0.0 0.0]);
pocc = libpointer('uint32Ptr', 0);
calllib('ViconDataStreamSDK_MATLAB', 'GetFrame');
%convert marker names to a cell, if not already one:
MarkerNames = cellstr(MarkerNames);
num_markers = size(cellstr(MarkerNames),2); %count markers
coordinates = zeros(num_markers,3); %create empty array for xyz vals
%step through each named marker in turn and get its coordinates
for marker = 1:num_markers,
calllib('ViconDataStreamSDK_MATLAB', 'GetGlobalMarkerTranslation',...
SubjectName, MarkerNames{marker}, ppos, pocc);
coordinates(marker,:) = get(ppos, 'Value');
end
Best of luck,
-Owen.

类别

Help CenterFile Exchange 中查找有关 Get Started with MATLAB 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by