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 in a supported platform with a supported C++ compiler. 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 tab, 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 packNGo functionality to relocate and rebuild your application.
To relocate, unpack, and rebuild your DDS application in another development environment, you can use packNGo. The packNGo 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 packNGo:
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 eProsima. If you are interested in these vendor APIs, refer to your vendor documentation.
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 API. 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 would like to customize the generated code, you can control the generated C++ class names and namespaces for your DDS applications. To configure these aspects of the generated code, from an open model, on the DDS tab, click Code Interface, select Class Name & Namespace, and customize the names in the opened configuration dialog box. For more information, see Configure class name and namespace (Embedded Coder).
A few common build issues you can troubleshoot are the following:
Description — If you select RTI as your vendor but do not install RTI Connext, then you are unable to deploy your application.
Action — Download and install RTI Connext.
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.
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.