.XML FILE Fast DDS for DDS Blockset

17 visualizaciones (últimos 30 días)
ANDRES GALLEGO FERNANDEZ
ANDRES GALLEGO FERNANDEZ el 7 de Mzo. de 2024
Comentada: ANDRES GALLEGO FERNANDEZ el 15 de Mzo. de 2024
I’ve been trying for a few weeks to connect the Matlab-Simulink software with some subscriber nodes and publishers via FastDS, making use of the DDS Blockset block.
To do this, I need to create an . XML file in which the domain, themes, and subscriber/publisher nodes I want to create are declared. As much as I try to look for examples, I cannot create a correct code, since Simulink never recognizes the topics when I assign it to the DDS Blockset. The code is as follows:
<types>
<struct name="Header">
<member name="data" type="int32"/>
</struct>
</types>
<domainLibrary profile_name="domainLibrary_profile">
<profiles>
<participant profile_name="participant_xml_profile">
<rtps>
<name>my_participant</name>
<builtin>
<domainId>0</domainId>
</builtin>
</rtps>
</participant>
<publisher profile_name="PublicoEnJuan">
<topic>
<name>juan</name>
<dataType>Header</dataType>
</topic>
</publisher>
<subscriber profile_name="LeoEnAndres">
<topic>
<name>andres</name>
<dataType>Header</dataType>
</topic>
</subscriber>
</profiles>
As I mentioned earlier, the Simulink block does detect for example the type "Header" that I have declared, but it does not recognize either the domain library, the specified domain or the topics within that domain. The only thing I want to implement is a file .XML that works in such a way that a subscriber node (andres) subscribes to a topic by which integers arrive and publish them through a publishing node (juan) on a different topic.
A greeting and thanks in advance
  1 comentario
ANDRES GALLEGO FERNANDEZ
ANDRES GALLEGO FERNANDEZ el 7 de Mzo. de 2024
I've just realized I've not posted the complete code:
<?xml version="1.0" encoding="UTF-8"?>
<dds xmlns="http://www.eprosima.com/XMLSchemas/fastRTPS_Profiles">
<types>
<struct name="Header">
<member name="data" type="int32"/>
</struct>
</types>
<domainLibrary profile_name="domainLibrary_profile">
<profiles>
<participant profile_name="participant_xml_profile">
<rtps>
<name>my_participant</name>
<builtin>
<domainId>0</domainId>
</builtin>
</rtps>
</participant>
<publisher profile_name="PublicoEnJuan">
<topic>
<name>juan</name>
<dataType>Header</dataType>
</topic>
</publisher>
<subscriber profile_name="LeoEnAndres">
<topic>
<name>andres</name>
<dataType>Header</dataType>
</topic>
</subscriber>
</profiles>
</domainLibrary>
</dds>

Iniciar sesión para comentar.

Respuesta aceptada

Mark McBroom
Mark McBroom el 14 de Mzo. de 2024
Hello,
I was able to create a Simulink model and generate code using your XML file. Note that your XML file is not complete. I had to add additional info in the Simulink DDS Data Dictionary. Following are the steps I followed and attached is a the model. Send me a direct message if you have further questions or would like a demo via MS Teams.
  1. Create a blank Simulink model
  2. Open the DDS App
  3. Follow prompts to import the XML file
  4. Open the DDS Data Dictionary.
  5. On the Domains tab, create a new Domain Library, Domain and Topic. Name the topics "juan" and "andres"
  6. Add the DDS Take and DDS Write blocks to a simulink model. Add an input port and an output port. Connect up the blocks
  7. Set the datatype of the input block to be "Header" and check the non-virtual bus box
  8. Open the Code Mappings dialog. Map the input port to topic "andres" and outport to "juan"
  9. Generate code
NOTE. Rename file my_sldd.slx to my.sldd.
  1 comentario
ANDRES GALLEGO FERNANDEZ
ANDRES GALLEGO FERNANDEZ el 15 de Mzo. de 2024
I have answered you via direct message but I think I should put it here too in case it is solved. Also, I can attach images. As I told you via DM I have managed to get the DDS block to recognise my topics as you indicated. Now I have another problem I cannot solve.
When I start publishing on the "andres" topic with "Prueba_pub" DDS node and run the simulation of the simulink block diagram (simulink "Run" button) it does nothing. It tells me that it has performed the operation successfully but does not send anything through the topic "juan" and the "Prueba_sub2" receives nothing. I do not know if I have to run another file. I don’t know if I’m making myself clear with this image.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Get Started with DDS Blockset en Help Center y File Exchange.

Productos


Versión

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by