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

9 views (last 30 days)
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.

Answers (1)

W. Owen Brimijoin
W. Owen Brimijoin on 12 Sep 2013
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.

Categories

Find more on Get Started with MATLAB in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!