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 = java.net.InetAddress.getLocalHost; HostIP = char('127.0.0.1'); theClient.Initialize(HostIP, HostIP); data = theClient.GetLastFrameOfData(); rigidBodyData= frameOfData.RigidBodies(1); x=rigidBodyData.x y=rigidBodyData.y z=rigidBodyData.z 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
Technion - Israel Institute of Technology