Main Content

Build and Deploy Application to DDS Network

This example uses eProsima as the DDS middleware vendor. DDS Blockset includes out-of-the-box support for eProsima, removing the need for you to install eProsima software yourself.

To build your application model:

  1. Ensure that your model is configured correctly. Verify that the model ports are configured and mapped appropriately for DDS.

  2. Open the Configuration Parameters dialog box. Under Data Import/Export, clear Output to disable root-level output logging.

    Disable output logging in the configuration parameters.

  3. Save your model.

  4. Set up your build environment.

    In the MATLAB® Command Window, use the mex command to verify that a supported C++ compiler and supported compiler version are set up for your platform.

    mex -setup c++
       MEX configured to use 'Microsoft Visual C++ 2019' for C++ language compilation.
       To choose a different C++ compiler, select one from the following:
       ...

    For the requirements for each platform, see DDS Blockset System Requirements.

  5. Build the Shapes Demo application model. On the DDS tab, click Build.

Your Shapes Demo Simulink® model generates C++ code and produces an executable for deployment. The C++ code links to libraries provided by your DDS vendor (eProsima for this example). C++ code is placed in the shapesdemo_ert_rtw folder and the executable is placed in shapesdemo_ert_rtw/exe.

To deploy your generated executable:

  1. In the MATLAB Command Window, set your path to include the eProsima dynamic linked libraries.

    setenv('PATH',[getenv('PATH') ';' fullfile(matlabroot,'sys','FastDDS','win64','bin')])
  2. Change directory to your build folder, and run your shapesdemo.exe executable.

cd shapesdemo_ert_rtw/exe
!shapesdemo.exe

When your DDS Blockset Shapes application runs, it subscribes to the Square topic and publishes the Circle topic on the DDS network. No output is displayed in the MATLAB Command Window.

You can deploy a second Shapes Demo application on your DDS network to communicate with your shapesdemo application. To learn more about deploying a second Shapes Demo application to communicate with your deployed executable, see DDS Blockset Shapes Demo.

Related Topics