UDP Communication with Unity in Simulink Destkop Real-time Kernel Mode

29 visualizzazioni (ultimi 30 giorni)
I have a desktop real-time system executing on a single PC using kernel mode. I would like to be able to send to and receive data packets from unity through UDP. The unity program is also running on the same PC. The data in collected from a DAQ (NI PCI 6229). This is the block layout I'm using, which is similar to the one here. Note that the sine block is for testing; it will be replaced with the input source block
However, whenever I build the model in kernel mode, I get the following error:
.
.
.
### Writing source file rtGetNaN.c
### Writing header file DCMotor_Test_PWM_LF_Unity_private.h
### Writing header file rtmodel.h
### Writing source file DCMotor_Test_PWM_LF_Unity_data.c
### Writing header file rt_defines.h
### TLC code generation complete.
### Generating TLC interface API.
### Creating data type transition file DCMotor_Test_PWM_LF_Unity_dt.h
Warning:Matching "From" for "Goto" 'DCMotor_Test_PWM_LF_Unity/Goto3' not found
Top model targets built:
Model Action Rebuild Reason
=====================================================================================
DCMotor_Test_PWM_LF_Unity Failed Code generation information file does not exist.
0 of 1 models built (0 models already up to date)
Build duration: 0h 0m 6.582s
Error: Dot indexing is not supported for variables of this type.
Running the model in connected I/O mode works and the data is sent and received; however, it's not real-time (around 1-2 secs of delay) despite the present of the real-time sync block.
  1 Commento
Amr Okasha
Amr Okasha il 20 Mag 2022
Sharing the entire error message for reference
### Invoking Target Language Compiler on DCMotor_Test_PWM_LF_Unity.rtw
### Using System Target File: C:\Program Files\MATLAB\R2021b\toolbox\sldrt\rtw\sldrt.tlc
### Loading TLC function libraries
### Initial pass through model to cache user defined code
### Caching model source code
### Writing source file DCMotor_Test_PWM_LF_Unity_tgtconn.c
### Writing header file DCMotor_Test_PWM_LF_Unity_types.h
### Writing source file DCMotor_Test_PWM_LF_Unity.c
### Writing header file DCMotor_Test_PWM_LF_Unity.h
### Writing header file rtwtypes.h
### Writing header file multiword_types.h
.
### Writing header file zero_crossing_types.h
### Writing header file rtGetInf.h
### Writing source file rtGetInf.c
### Writing header file rt_nonfinite.h
### Writing source file rt_nonfinite.c
### Writing header file rtGetNaN.h
.
### Writing source file rtGetNaN.c
### Writing header file DCMotor_Test_PWM_LF_Unity_private.h
### Writing header file rtmodel.h
### Writing source file DCMotor_Test_PWM_LF_Unity_data.c
### Writing header file rt_defines.h
### TLC code generation complete.
### Generating TLC interface API.
### Creating data type transition file DCMotor_Test_PWM_LF_Unity_dt.h
Warning:Matching "From" for "Goto" 'DCMotor_Test_PWM_LF_Unity/Goto3' not found
Top model targets built:
Model Action Rebuild Reason
=====================================================================================
DCMotor_Test_PWM_LF_Unity Failed Code generation information file does not exist.
0 of 1 models built (0 models already up to date)
Build duration: 0h 0m 6.582s
Error:Dot indexing is not supported for variables of this type.

Accedi per commentare.

Risposta accettata

Jan Houska
Jan Houska il 20 Mag 2022
Hi Amr,
the interface blocks are target-specific. So you cannot use block from Simulink Real-Time library with Simulink Desktop Real-Time. Please see the sldrt_packetio shipping example to learn how to use UDP with Simulink Desktop Real-Time.
Good Luck, Jan
  1 Commento
Amr Okasha
Amr Okasha il 23 Mag 2022
Thank you for your response. For the record, matlab corrected the file name to sldrtex_packetio. The contents solved my issue.

Accedi per commentare.

Più risposte (0)

Prodotti


Release

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by