Deploy DDS Applications - MATLAB & Simulink (original) (raw)

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.

Build and Deploy DDS Applications

To deploy your application on the DDS network:

  1. 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.
  2. 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. You can use the mex -setup C++ command in the MATLAB® Command Window to verify which compiler you are using. For compiler requirements for each platform, see DDS Blockset System Requirements.
    • If your target vendor is eProsima, no additional setup is required besides ensuring your path includes the eProsima dynamic linked libraries. For example, in the MATLAB Command Window, you can enter this to include the libraries in your path:
      setenv('PATH',[getenv('PATH') ';' fullfile(matlabroot,'sys','FastDDS','win64','bin')])
    • If your target vendor is RTI, you must also install RTI Connext. For more information, see DDS Blockset System Requirements.
  3. Build the application model. On the DDS tab, clickBuild.
    If your DDS Library contains a large number of definitions, you can set thebigobj compiler flag to avoid exceeding object file format limits for Windows® platforms. To set the compiler option, before you build the model, enter the following in the MATLAB Command Window:
    modelName = 'yourModelName';
    set_param(modelName, 'PostCodeGenCommand', 'addCompileFlags(buildInfo,"/bigobj")')
  4. Run the executable.

Overview of Generated Files

When you build your DDS application model, these folders are generated in your current working folder:

Display of current folder containing generated folders and files.

In the exe folder that contains the executable and other deployment files, DDS Blockset code generation exports an XML file containing the exported DDS definitions for those vendors that require XML files. For applications that use the eProsima vendor, the generated XML file includes locator elements (within <locator> </locator> XML tags). If needed, you can suppress the locator elements from being exported by setting the environment variableDO_NOT_USE_LOCATORS to a nonzero number. For example, in the MATLAB Command Window, enter:

setenv('DO_NOT_USE_LOCATORS', '1');

You can use the generated files to analyze, deploy, and port your DDS application.

Implementation Details and Generated C++ Code

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 supports 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.

Generated C++ Class Name and Namespace Customization

If you would like to customize the generated C++ code for your DDS application, you can control the generated class name and namespace for your DDS application model interactively or programmatically.

To interactively configure these aspects of the generated code, from an open model, on the DDS tab, click Code Interface, selectClass Name & Namespace, and customize the names in the opened configuration dialog box.

Dialog box for configuring C++ class name and namespace.

For more information, see Configure class namespace (Embedded Coder).

Debug and Troubleshoot

A few common build issues you can troubleshoot are the following:

Incorrect environment setup

Missing or invalid mapping for inports and outports in application model

Inconsistent data management of the DDS definitions

Considerations and Limitations

See Also

Topics

External Websites