get from data Motive to Matlab in a simple way?

NatNet, VRPN, TrackD, and Plugins
Post Reply
Posts: 16
Joined: Tue Jun 17, 2014 9:42 am

get from data Motive to Matlab in a simple way?

Post by orhirshfeld » Thu Aug 07, 2014 8:50 am

I'm new to NatNet SDK and I'm trying to extract data to Matlab
I tried running the sample an it's seems everything is working but I'm a bit lost in all the code lines
first thing I'm looking for is how to pull the data on location and orientation of the rigid body i setup in Motive.
the rigid body is the only object i setup in my project.
i wish to write as simple as possible in order to make it clear for other workers and students in my lab
my project is to create a control system in Matalb which get the location/orientation data of toy helicopter and navigate it on the fly according to the data received.

as i understood until now I should start with the following lines

Code: Select all

dllPath = fullfile('c:','NatNetSDK2.5','lib','x64','NatNetML.dll');
assemblyInfo = NET.addAssembly(dllPath);
theClient = NatNetML.NatNetClientML(0);
hst =;
HostIP = char('');
theClient.Initialize(HostIP, HostIP);
data = theClient.GetLastFrameOfData();
rigidBodyData= frameOfData.RigidBodies(1);
q = quaternion( rigidBodyData.qx, rigidBodyData.qy, rigidBodyData.qz, rigidBodyData.qw );
qRot = quaternion( 0, 0, 0, 1);     % rotate pitch 180 to avoid 180/-180 flip for nicer graphing
q = mtimes(q, qRot);
angles = EulerAngles(q,'zyx');
angleX = -angles(1) * 180.0 / pi;   % must invert due to 180 flip above
angleY = angles(2) * 180.0 / pi;
angleZ = -angles(3) * 180.0 / pi;   % must invert due to 180 flip above                         
did i miss something?

thank you
Or Hirshfeld
Control Lab
Aerospace Faculty
Technion - Israel Institute of Technology
Haifa, Israel

Post Reply