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

lib.png

View Publisher and Subscriber Model Construction

open_system('shapesdemo');

model.png

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 Bus Element In block 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 Bus Element Out block and view the DDS data type to send the shape position to the DDS network.

Also, note that root level output logging is unset for this model to use Bus Element Out block with virtual bus representing the DDS Publisher.

config.png

View Configured DDS Interface

In addition to the modeling of the Shapes Demo, you can view the imported DDS interface configuration of the Topics, DataReaders, and DataWriters for the model:

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

  2. To view the imported Topics and DataReaders, click on the Inports tab.

  3. To view the imported Topics and DataWriters, click on the Outports tab.

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.

Related Topics

External Websites