stream motive data to simulink rigidbodydata empty

조회 수: 1 (최근 30일)
minkow38
minkow38 2017년 10월 13일
Hi,
After unsuccessfully trying to stream between Motive and Simulink (either iwth udp, or Or Hirshfeld solutions), I tried to use a wrapper to access to NET.addAssembly while running simulink.
So first if I want to get x position I have my wrapper:
function x = NatNet_wrapper(RigidBody_ID)
addpath('my path to dll')
dllPath = fullfile(my path to dll 'NatNetSDK','Samples','Matlab','NatNetML.dll');
assemblyInfo = NET.addAssembly(dllPath);
theClient = NatNetML.NatNetClientML(0) % Input = iConnectionType: 0 = Multicast, 1 = Unicast
HostIP = char('127.0.0.1');
theClient.Initialize(HostIP, HostIP) % Flg = returnCode: 0 = Success
frameOfData = theClient.GetLastFrameOfData()
rigidBodyData = frameOfData.RigidBodies(RigidBody_ID);
X= single(0);
X = rigidBodyData.x;
x = double(X)
Then I have a matlab Function in simulink:
function x = getoptitrackdata(RigidBody_ID)
%#codegen
coder.extrinsic('NatNet_wrapper');
x = double(0);
x = NatNet_wrapper(RigidBody_ID);
When I run Simulink I can see in the diagnostic viewer that the flag Flg=0 so it's initialized, but I get
Struct contents reference from a non-struct array object.
error because my frameOfData is empty.
Do you have any why? I made sure streaming is on on motive and that my asset has the right index and is tracked.
I run matlab 2016b / on windows 64bits.
Any help would be great, Thanks

답변 (0개)

카테고리

Help CenterFile Exchange에서 Communications Toolbox에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by