stream motive data to simulink rigidbodydata empty
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur String dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!