Main Content

DDS Blockset Shapes Demo

This example shows how to import, configure, and deploy the Shapes Demo provided by DDS vendors to introduce DDS concepts. In the demo there are various shapes - Circles, Squares, and Triangles - that you can subscribe to watch their location as they move around a canvas. In this version of the demo, DDS Blockset provides an application that subscribes to a Square and then publishes the location of a Circle.

Import DDS Definitions

To get started with the Shapes Demo, the DDS definitions of Domains, Topics, Types, and Quality of Service (QoS) have been imported from XML. To view the XML specifications, open shapesexample.xml.

View and Edit Definitions

To view these DDS definitions in the DDS Dictionary, open the dictionary and view the Types, Domains, and QoS tabs.

open shapesexample.sldd

View Publisher and Subscriber Model Construction

open_system('shapesdemo');

In the Simulink model for the Shapes Demo, view how the DDS blocks, Take DDS Sample and Write DDS Sample, are used to subscribe to and publish the location of the shape.

  1. Click the inport and view the DDS data type of the shape.

  2. Click the Take DDS Sample block that converts the DDS data type to the Simulink data type.

  3. Examine the logic component of the application model. The logic component uses the Simulink data types to compute the logic of the DDS application.

  4. Click the Write DDS Sample block that converts the Simulink data types to a DDS data type.

  5. Click the outport and view the DDS data type to send the shape position to the DDS network.

View Configured DDS Interface

In addition to the modeling of the Shapes Demo, you can view the DDS interface configuration of the DataReaders and DataWriters for the model. This example uses the Reader/Writer XML path configuration mode to specify previously imported readers and writers to configure the interface.

  1. Open the Code Mappings editor. On the toolstrip, click Code Interface and select Individual Elements Code Mappings.

  2. On the Inports tab, view how the Configuration Mode is set to Use Reader XML Path. This configuration sets the DataReader to the definition specified in the imported XML.

  3. On the Outports tab, view how the Configuration Mode is set to Use Writer XML Path. This configuration sets the DataWriter to the definition specified in the imported XML.

Build and Deploy the Shapes Demo

DDS Blockset enables out-of-the-box support for RTI and eProsima. To use this out-of-the-box support, build your application model and deploy your generated executable in your development environment. For this example, click Build to subscribe to a Square and publish the location of a Circle Topic.

External Websites