LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

MTw Xsens LabVIEW Data Streaming

Solved!
Go to solution

Hello there, 

 

I am new to this. I have a project regarding tremor and joint angle analysis. In this project, I am using Xsens's MTw sensors and USB Dongle. The goal is to have the measurement data streaming in real time into LabVIEW.

 

The flow should be as this:
MTw Sensors  -->  USB Dongle  -->  LabVIEW

 

There is a friendly instrument driver ready for MTi-G series but not for MTw.

If that's the case, what are my options? 

 

There was a forum about the same issue but I am unsure if the goal has achieved. 

 

Regards.

0 Kudos
Message 1 of 22
(5,839 Views)

Hello,

 

Probably best to ask your question at the Xsens community forum:

https://base.xsens.com/hc/en-us/community/topics

 

Remco

0 Kudos
Message 2 of 22
(5,790 Views)

Hi there, 

 

Thanks for the respond. I am consulting them on this issue as well.  
As I mentioned previously, there was a forum about this issue. There was an option he/she mentioned "Use the Component Object Model and the ActiveX Labview VIs (advice from XSens): xsensdeviceapi_com32.dll". As far as I know, this .dll comes along with xsens software installed into the computer.

So, is it possible for me to run my program using MyRIO since there is no such .dll in MyRIO?

Is there any method to integrate it into MyRIO?

I am quite new to this. Please do correct me if I am asking the wrong question.

 

Thanks in advance. 

0 Kudos
Message 3 of 22
(5,779 Views)

Hi Charles,

 

I saw your question on my previous post from quite a while ago regarding streaming data into Labview from the MTw. Specifically, you were asking about how to get the DeviceID from the variant data.

Based on the version I have, I assume you are talking about the variant data output from the XsControl_device invoke node, which gives you the p_thisPtr Device variant data. If you input that variant data to the XsDevice_children invoke node, you can obtain another variant data containing the ID of the children sensors. You can then use the Variant-to-Data Labview function to convert that into a list of numerical sensor numbers.

 

Hope this helps.

 

Matt

 

 

 

0 Kudos
Message 4 of 22
(5,759 Views)

Hi Matt,

 

Thanks for the respond. I am actually facing this issue from scanning port part (XsScanner_scanPorts), it gives a variant output. Following XsDeviceId_isAwindaDongle and XsDeviceId_isMtw, they required an INT32 input for the p_deviceId. So I assume the device id is getting from the variant. I try to wired it to an indicator to have peek on what is inside, it showed array (non-displayable). May I ask how you manage to pass the id to it?

 

By the way, thanks for the suggestion you provided for initialize master device. I think I did some mistakes in take part as well.

0 Kudos
Message 5 of 22
(5,738 Views)

Hi Matt,

I have this error "The server threw an exception" whenever i try to pass the variant p_thisPtr from the XsControl_device to XsDevice_children. Did you face this issue before?

0 Kudos
Message 6 of 22
(5,652 Views)
Solution
Accepted by topic author CharlesGoh

Hi Charles,

 

Just checking, are you creating the labview streaming code based off the matlab or C version provided by Xsens? If you are, by running the matlab or C code and looking at the data streams and variables produced, you can see the inputs and outputs of each function in matlab/C. Those same inputs/outputs are "wrapped" into the equivalent variant data streams in Labview.

I'm not sure if this is best practice, but I found that the most reliable way to parse variant data into its components is to use the Variant to Data function with a string type identifier, usually a string array.

 

As to your previous question, you're right that the XsScanner_scanPorts function produces a variant output. That variant output can be extracted using the Variant to Data function. It is arranged as a 2D string array type, consisting of 4 outputs in this order - device number, another number that I cannot remember, the COM port, and the Baudrate. That first output is your INT32 p_deviceId needed for your XsDeviceId_isAwindaDongle etc.

 

As to your last question, I don't recall exactly, but I think that whenever you see "The server threw an exception" error, it's usually a wrong or null data input to the function. Because there's so many functions taking in and giving out variant data, or INT32 data with the same variable name but different data, that can get confusing with wiring the right data to the right function.

Again, this error likely stems from your previous question/problem. Once you get the variant data from XsScanner_scanPorts parsed appropriately, you will get the INT32 device number p_deviceId, which inputs to XsControl_device, which outputs the variant data to XsDevice_children.

 

It is definitely frustrating that Xsens does not support labview although it is a fantastic platform for the type of data the device can collect in realtime and display for research purposes. It gets better once you get used to the way they named their variables and push variant data around.

Message 7 of 22
(5,637 Views)

Hi Matt,

Yes, I built the coding based on the matlab coding. I have solved the problem. The UNDO command is the reason that I cannot harvest the variant data. I accidentally removed the dimension I have added in the array, thus returning it to 1D array. I found it when I checked the block diagram again. Perhaps I should try separate them into several VIs to reduce the block complexity and make it easier for checking. 

I am able to proceed on building data retrieving block now. 

Thanks Matt!

 

0 Kudos
Message 8 of 22
(5,606 Views)

Hi Matt,

 

I tried to understand that part it meant handledata(varargin). It stated that dataPacket = varargin{3}{2}; then later in the cell to matric function it used (h.XsDataPacket_orientationEuler_1(dataPacket)). Which data has been exactly input into this invoke node? Under registerevent code line, it stated that @handledata which is to construct a function handle. I did try to pass the id into it but it did not work. 

 

Charles

0 Kudos
Message 9 of 22
(5,582 Views)

handleData is an event handler that triggers whenever an event is detected in the sensor. For example, if the sensor is turned on and in measurement mode at say 100 Hz, you'll have 100 events coming in every second. That function is very straightforward to implement in Matlab, but a little more complicated in Labview.

You're going to have to set up a Event Callback loop that will pull the variant data from the event onDataAvailable. This step can be fairly involved if you're not too familiar with handling events in Labview. Once you have that variant data pulled, it becomes quite simple. That variant data will contain a datapacket of 2 elements -- the sensor data, and packet number. The sensor data needs to be parsed out from the variant data into its INT32 form, repackaged into a single element variant data, which feeds into the XsDataPacket_orientationEuler_1. From this point on, you'll be on the home stretch to pulling actual XYZ data streams.

 

0 Kudos
Message 10 of 22
(5,571 Views)