Code Mappings Editor
Configure DDS application inports and outports as DataReaders and DataWriters
Since R2021a
Description
The Code Mappings editor is a graphical interface where you can configure inports and outports as DataReaders and DataWriters in a DDS application.
To configure the inports and outports, use the Code Mappings editor panes:
Inports
Outports
Open the Code Mappings Editor
Open a model in the DDS Blockset app. On the DDS tab, click Code Interface and select Individual Element Code Mappings.
Open a model in the DDS Blockset app. The Code Mappings editor appears as a minimized tab directly below the model canvas. Click the tab to expand the editor.
Examples
Configure DataReaders and DataWriters by Using Default Behavior
This example uses the Shapes Demo example model to show how to configure the DataReaders and DataWriters for a DDS application by using default behavior.
Open the Shapes Demo example model,
shapesdemo
.openExample('shapesdemo');
Create DDS definitions. In the DDS Application Quick Start, on the second page, select Create and use default dictionary.
Open the Code Mappings editor. On the DDS tab, click Code Interface and select Individual Element Code Mappings.
Configure the inports. The inports represent DataReaders in a DDS application.
Select the Topic. Set the Topic to the Square Topic specified in the drop-down options by its path (
ShapesDomainLibrary/ShapesDomain/Square
).Select the DataReader. Set the Reader XML Path to
Auto
to have DDS Blockset automatically generate a reader for the application.Select the Quality of Service (QoS). Set the Reader QoS to
Default
to have the reader use the vendor provided QoS.
Configure the outports. The outports represent DataWriters in a DDS application.
Select the Topic. Set the Topic to the Circle Topic specified in the drop-down options by its path (
ShapesDomainLibrary/ShapesDomain/Circle
).Select the DataWriter. Set the Writer XML Path to
Auto
to have DDS Blockset automatically generate a reader for the application.Select the Quality of Service (QoS). Set the Writer QoS to
Default
to have the reader use the vendor provided QoS.
Set up the build environment for your target vendor.
On the DDS tab, click Build.
Deploy the application executable on DDS.
Configure DataReaders and DataWriters by Using XML Definitions
This example uses the Shapes Demo example model to show how to configure the DataReaders and DataWriters for a DDS application by using definitions previously specified in imported XML definitions.
Open the Shapes Demo example model,
shapesdemo
.openExample('shapesdemo');
Create DDS definitions. In the DDS Application Quick Start, select Import from XML, and select the
shapesexample_qos
XML file. When you close the Quick Start, the DDS DataReader and DataWriter definitions from theshapesexample_qos
XML file become available in the DDS Dictionary for the example application.
Open the Code Mappings editor. On the DDS tab, click Code Interface and select Individual Element Code Mappings.
Configure the inports. The inports represent DataReaders in a DDS application. The Topic, DataReader, and QoS for each inport appears in the editor based on the imported XML definitions.
Verify the Topic. For the Topic, verify that the Square Topic specified in the drop-down options by its path (
ShapesDomainLibrary/ShapesDomain/Circle
) is shown in the editor.Verify the DataReader. For the Reader XML Path, verify that the DataReader,
MySquareRdr
, specified by its path (myParticipant/MySubscriber/MySquareRdr
).Configure the Quality of Service (QoS). Set the Reader QoS to
Default
to have the reader use the vendor provided QoS.
Configure the outports. The outports represent DataWriters in a DDS application. The Topic, DataWriter, and QoS for each outport appears in the editor based on the imported XML definitions.
Verify the Topic. For the Topic, verify that the Circle Topic is specified in the drop-down options by its path (
ShapesDomainLibrary/ShapesDomain/Circle
).Verify the DataWriter. For the Writer XML Path, verify that the DataWriter,
MyCircleWtr
, specified by its path (myParticipant/MySubscriber/MyCircleWtr
).Configure the Quality of Service (QoS). Set the Writer QoS to
Default
to have the writer use the vendor provided QoS.
Set up the build environment for your target vendor.
On the DDS tab, click Build.
Deploy the application executable on DDS.
Related Examples
Parameters
Version History
Introduced in R2021a