- Block output data types: '6*double'
- Format string:'<Rob Type=\"KUKA\"><RIst X=\"%f\" Y=\"%f\" Z=\"%f\" A=\"%f\" B=\"%f\" C=\"%f\"/>'
- Message termination:'</Rob>'
How do I use Stream Input block to parse ASCII encoded data received via UDP, TCP or Serial with Simulink Desktop Real-Time?
6 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
MathWorks Support Team
il 5 Set 2018
Modificato: MathWorks Support Team
il 13 Nov 2025 alle 10:20
I would like to read UDP packets sent from a KUKA robot in a Simulink Desktop Real-Time (SLDRT) application.
The UDP packets include 120 Byte ASCII encoded data in XML format containing position information of the robot, e.g.:
<Rob Type="KUKA"><RIst X="-18.3" Y="260.3" Z="25.0" A="18.6" B="1.4" C="-1.1"/><Delay D="0"/><IPOC>9420422</IPOC></Rob>
My aim is to process the values for X, Y, Z, A, B, and C. How can I parse the XML data from the UDP packets in a Simulink Desktop Real-Time application?
Risposta accettata
MathWorks Support Team
il 13 Nov 2025 alle 0:00
Modificato: MathWorks Support Team
il 13 Nov 2025 alle 10:20
Use a Stream Input block from the Simulink Desktop Real-Time library with the following settings:
In this way, we can read 6 double values X, Y, Z, A, B, and C, that are placed at the positions marked by %f placeholders. Note the escaped double quotes (preceded by a backslash).
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Model Preparation for Real-Time Simulation in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!