readXsensMTiData
Version 1.0.1 (26.1 KB) by
StevenHG
This Simulink model contains a basic example that can be used to parse incoming serial data from an Xsens MTi device.
Last updated: 27th July, 2023
Disclaimer
This model is merely an example that can be used as a starting point. It is not officially supported by Xsens/Movella.
Requirements
This model requires the Instrument Control Toolbox. It was tested with MATLAB/Simulink R2019b.
Only MTi devices connected via a serial COM port are supported. The driver has been tested with:
- MTi 1-series Development Board
- MTi 600-series Development Board
- MTi 600-series R/G-versions (via USB converter dongle)
Introduction
This Simulink model contains a basic example that can be used to parse incoming serial data from an Xsens MTi device. Only the default Xbus protocol is supported, and only the most commonly used output messages are parsed:
- EulerAngles (Roll/Pitch/Yaw) [deg]
- Acceleration (X/Y/Z) [m/s^2]
- RateOfTurn (X/Y/Z) [rad/s]
MTi devices should be preconfigured (e.g. using MT Manager) to output these data fields. Otherwise, the output signals will be 0. The parser function "parseXsensData" can be extended for use with other data fields, see: https://mtidocs.xsens.com/messages
Upon first use, make sure to set the SerialReceive/Configuration blocks to the correct COM port and baud rate of your MTi device.
Troubleshooting
- "Index exceeds array dimensions. Index value xx exceeds valid range [1-xx] of array data."
The Data size field of the Serial Receive block is not sufficient for the size of MTData2 messages sent out by the MTi. Either decrease the amount of data outputs of your MTi (e.g. using MT Manager) or increase the Data size field.
- "Open failed: Port: COMx is not available. Available ports: COMx."
Check the COM port of your MTi device in Windows Device Manager. Then make sure that your Serial Receive/Configuration blocks are set to the same COM port. Also, make sure to check whether the baud rate is correct. The baud rate of your MTi device can be found/changed in the Device Settings window of MT Manager.
- No data or only zeros received.
Ensure (e.g. using MT Manager) that your device is set to the Xbus output mode and that at least one of the following messages are enabled: EulerAngles, RateOfTurn, Acceleration. These are the only messages that are supported by parseXsensData.
MATLAB Release Compatibility
Created with
R2019b
Compatible with R2019b and later releases
Platform Compatibility
Windows macOS LinuxTags
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.