DDS Blockset connects applications modeled in Simulink® to DDS by providing out-of-the-box support for the DDS vendors RTI and eProsima. To use out-of-the-box DDS, create and model a DDS application in Simulink, set up the environment, and use Embedded Coder® to build the application model. The build creates exported XML, generated C++ code, and an application executable that you can use to directly connect to the DDS network.
To deploy your application on the DDS network:
Ensure that your model is configured correctly. Verify that the model ports are configured and mapped appropriately for DDS. For more information, see Interactively Configure DDS Interface.
Set up the environment. DDS Blockset generates an executable specific to the DDS vendor that you select, RTI or eProsima. To verify or change your vendor selection, you can use the Configuration Parameters dialog box to review the toolchain setting for your application. To build an executable of your application, set up your environment with a supported platform, C++ compiler, and CMake. If your target vendor is eProsima, additional setup is not required. If your target vendor is RTI, you must also install RTI Connext. For more information, see DDS Blockset System Requirements.
Build the application model. On the DDS Blockset toolstrip, click Build.
Run the executable and connect your application to the DDS network.
When you build your DDS application model, the following folders and files are generated in your current working folder:
Application executable — The executable that you can deploy to connect the application to the DDS network.
Embedded Coder build folder — The generated C++ code files.
Simulink project folder (slprj) — The model simulation files.
Simulink Data Dictionary file — The associated DDS Dictionary
DDS Application model — The Simulink model for the application.
Exported XML/IDL file — The XML/IDL specifications of your DDS application.
You can use these generated files to analyze, deploy, and port your DDS application. Additionally, you can use the Pack-N-Go functionality to relocate and rebuild your application.
To relocate, unpack, and rebuild your DDS application in another development environment, you can use Pack-N-Go. The Pack-N-Go function enables you to relocate files so you can recompile for a specific target environment or rebuild in a development environment where MATLAB® is not installed. By default, the function packages the files as a flat folder structure in a ZIP file within the code generation folder. After you relocate the ZIP file, use a standard ZIP utility to unpack the compressed file.
To configure your model to build with Pack-N-Go:
Open the Configuration Parameters dialog box.
Select Pack code and artifacts.
On the toolstrip, click Build.
For more information, see
packNGo (Embedded Coder).
The implementation of DDS is specified by the Object Management Group (OMG) standard and implemented by several vendors in several different programming languages. The DDS Blockset provides out-of-the box integration with the DDS vendors RTI and eProsima. Specifically, the blockset provides support for the C implementation of the DDS standard provided by RTI and the C++ implementation of the standard provided by eProsima.
The basic architecture of the generated C++ code is that the application is composed of message classes, vendor helper classes, and the main file. The message classes enable the application to send and receive data. The vendor helper classes are specific to the vendor and load the application profile, register the data types, create and initialize the DDS entities, and wrap the send and receive message classes specific to the vendor. The main file then performs the application logic. If you would like to examine the generated C++ code, view the Embedded Coder build folder. If you are interested in the vendor APIs, refer to your vendor documentation.
A few common build issues you can troubleshoot are the following:
Description — If the inports or outports have not been configured correctly the model does not build.
Action — Map the inports and outports in the application model to DDS Topics and configure the ports with the corresponding DDS data types.
Description — If you map an inport or an outport to a Topic and then delete or change the data type for the Topic the model does not build.
Action — Verify that the DDS definitions are available in the associated DDS Dictionary.
DDS Target Specification — DDS Blockset does not support compiling the code generated from a DDS application model for a non-DDS application
DDS Definitions — The DDS Topics and QoS for your application are retrieved from the DDS Dictionary associated with your application model. Ensure that this dictionary is on your MATLAB path to appropriately build your model.
Code Generation Data Types — The generated C++ code does not provide support for certain data types. Multidimensional arrays are not supported for code generation. The array data type is not supported for eProsima code generation. The string data type is not supported for RTI code generation.
Security — There are security risks inherent in communication platforms. These risks include the potential of malicious users to attempt to listen to or spoof DDS communication. Additionally, late-joining readers can potentially access previously transmitted data. To increase protection against these security risks, download and use the secure version of your vendor. The version of eProsima included with DDS Blockset is not the secure version.