Skip to content

Commit 6de7ed3

Browse files
Merge branch 'master' into develop
2 parents 2797a70 + 6104b25 commit 6de7ed3

File tree

151 files changed

+7065
-31
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

151 files changed

+7065
-31
lines changed

.github/workflows/lint_python.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
- name: Set up Python
3535
uses: actions/setup-python@v2
3636
with:
37-
python-version: 3.7
37+
python-version: 3.8
3838
- name: Install necessary tools
3939
run: pip install black==22.3.0
4040
- name: Perform format check in a pull request

README.md

+30-24
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,27 @@
1-
# rticonnextdds-examples
1+
# RTI Connext Examples
22

3-
This repository includes examples on how to use specific features of RTI
4-
Connext DDS.
3+
This repository includes:
54

6-
To contribute enhancements or additional examples to the repository, follow the
7-
instructions on our [RTI Connext DDS Examples
8-
Wiki](https://github.com/rticommunity/rticonnextdds-examples/wiki). Your
9-
contributions will be reviewed and as soon as they are approved they will
10-
automatically be included in the [RTI Community Portal Examples
11-
Section](http://community.rti.com). See [CONTRIBUTING.md](https://github.com/rticommunity/rticonnextdds-examples/blob/master/CONTRIBUTING.md)
12-
for further information about how to contribute with new examples to this repository.
5+
- Code examples on how to use specific Connext features (under [examples/](./examples))
6+
- Supporting code for learning materials (under [tutorials/](./tutorials))
7+
8+
## Cloning the repository
9+
10+
To clone the repository you will need to run `git clone` as follows to download
11+
both the repository and its submodule dependencies:
12+
13+
```bash
14+
git clone --recurse-submodule https://github.com/rticommunity/rticonnextdds-examples.git
15+
```
16+
17+
If you forget to clone the repository with `--recurse-submodule`, simply run
18+
the following command to pull all the dependencies:
19+
20+
```bash
21+
git submodule update --init --recursive
22+
```
23+
24+
## Versioning
1325

1426
The examples contained in the
1527
[master](https://github.com/rticommunity/rticonnextdds-examples/tree/master)
@@ -29,18 +41,12 @@ versions of RTI Connext DDS, please check out the appropriate branch:
2941
- [release/5.1.0](https://github.com/rticommunity/rticonnextdds-examples/tree/release/5.1.0)
3042
- [release/5.0.0](https://github.com/rticommunity/rticonnextdds-examples/tree/release/5.0.0)
3143

32-
## Cloning Repository
33-
34-
To clone the repository you will need to run `git clone` as follows to download
35-
both the repository and its submodule dependencies:
36-
37-
```bash
38-
git clone --recurse-submodule https://github.com/rticommunity/rticonnextdds-examples.git
39-
```
40-
41-
If you forget to clone the repository with `--recurse-submodule`, simply run
42-
the following command to pull all the dependencies:
44+
## How to contribute
4345

44-
```bash
45-
git submodule update --init --recursive
46-
```
46+
To contribute enhancements or additional examples to the repository, follow the
47+
instructions on our [RTI Connext DDS Examples
48+
Wiki](https://github.com/rticommunity/rticonnextdds-examples/wiki). Your
49+
contributions will be reviewed and as soon as they are approved they will
50+
automatically be included in the [RTI Community Portal Examples
51+
Section](http://community.rti.com). See [CONTRIBUTING.md](https://github.com/rticommunity/rticonnextdds-examples/blob/master/CONTRIBUTING.md)
52+
for further information about how to contribute with new examples to this repository.

examples/connext_dds/distributed_logger/c++11/DistLoggerExample.cxx

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ void distlogger_example_main(
2424
const string application_kind,
2525
const int domain_id,
2626
const int sleep,
27-
const uint iterations)
27+
const unsigned int iterations)
2828
{
2929
// First, create the options to personalize Distributed Logger.
3030
// If no options are provided, default ones will be created.
@@ -45,7 +45,7 @@ void distlogger_example_main(
4545
// The log messages are published as DDS topics, which allows your DDS
4646
// applications to subscribe to them. You can also run rtiddsspy or
4747
// RTI Admin Console to visualize the logs.
48-
for (uint i = 1; i <= iterations; ++i) {
48+
for (unsigned int i = 1; i <= iterations; ++i) {
4949
cout << "\nIteration #" << i << endl;
5050

5151
dist_logger.debug("This is a debug message");
@@ -67,7 +67,7 @@ int main(int argc, char *argv[])
6767

6868
int domain_id = 0;
6969
int sleep = 1;
70-
uint iterations = 50;
70+
unsigned int iterations = 50;
7171

7272
for (int i = 1; i < argc;) {
7373
const string &param = argv[i++];

examples/connext_dds/lbediscovery_xml_app_creation/c++11/CMakeLists.txt

+4-3
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@
1111
#
1212
cmake_minimum_required(VERSION 3.11)
1313
project(rtiexamples-lbediscovery-xml-app-creation)
14-
set(CMAKE_MODULE_PATH
15-
${CMAKE_MODULE_PATH}
16-
"${CMAKE_CURRENT_SOURCE_DIR}/../../../../resources/cmake"
14+
list(APPEND CMAKE_MODULE_PATH
15+
"${CMAKE_CURRENT_SOURCE_DIR}/../../../../resources/cmake/Modules"
1716
)
17+
include(ConnextDdsConfigureCmakeUtils)
18+
connextdds_configure_cmake_utils()
1819

1920
# Include ConnextDdsAddExample.cmake from resources/cmake
2021
include(ConnextDdsAddExample)

tutorials/README.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# RTI Connext Tutorials
2+
3+
The code included in this directory is the supporting material for the tutorials
4+
in the
5+
[Connext Developer](https://community.rti.com/static/documentation/developers/index.html)
6+
page.
7+
8+
Please follow the instructions for each tutorial under *Learn*.
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Tutorial: Application Design
2+
3+
This code is part of the Connext Application Design tutorial.
4+
5+
There are multiple subfolders which contain a toolchain-specific tutorial.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<?xml-model href="https://community.rti.com/schema/7.3.0/rti_dds_profiles.xsd" type="application/xml" schematypens="http://www.w3.org/2001/XMLSchema"?>
3+
<dds>
4+
<types>
5+
<const name="VIN_LENGTH" type="uint8" value="17"/>
6+
<typedef name="VIN" type="string" stringMaxLength="VIN_LENGTH"/>
7+
8+
<struct name="Coord" extensibility="final" nested="true">
9+
<member name="lat" type="float64"/>
10+
<member name="lon" type="float64"/>
11+
</struct>
12+
<struct name="VehicleTransit" extensibility="appendable">
13+
<member name="vehicle_vin"
14+
type="nonBasic"
15+
nonBasicTypeName="VIN"
16+
key="true" />
17+
<member name="current_position"
18+
type="nonBasic"
19+
nonBasicTypeName="Coord" />
20+
<member name="current_route"
21+
type="nonBasic"
22+
nonBasicTypeName="Coord"
23+
sequenceMaxLength="-1"
24+
optional="true" /> <!-- 'no route' == standby -->
25+
</struct>
26+
27+
<typedef name="Percentage" type="float64" min="0.0" max="100.0"/>
28+
<struct name="VehicleMetrics" extensibility="appendable">
29+
<member name="vehicle_vin"
30+
type="nonBasic"
31+
nonBasicTypeName="VIN"
32+
key="true"/>
33+
<member name="fuel_level"
34+
type="nonBasic"
35+
nonBasicTypeName="Percentage"/>
36+
</struct>
37+
</types>
38+
39+
<qos_library name="VehicleModeling_Library">
40+
<qos_profile name="VehicleMetrics_Profile">
41+
<datawriter_qos base_name="BuiltinQosLib::Generic.BestEffort">
42+
<deadline>
43+
<period>
44+
<sec>10</sec>
45+
<nanosec>0</nanosec>
46+
</period>
47+
</deadline>
48+
</datawriter_qos>
49+
<datareader_qos base_name="BuiltinQosLib::Generic.BestEffort">
50+
<deadline>
51+
<period>
52+
<sec>15</sec>
53+
<nanosec>0</nanosec>
54+
</period>
55+
</deadline>
56+
</datareader_qos>
57+
</qos_profile>
58+
<qos_profile name="VehicleTransit_Profile">
59+
<datawriter_qos base_name="BuiltinQosLib::Generic.StrictReliable">
60+
<durability>
61+
<kind>TRANSIENT_LOCAL_DURABILITY_QOS</kind>
62+
</durability>
63+
</datawriter_qos>
64+
<datareader_qos base_name="BuiltinQosLib::Generic.KeepLastReliable">
65+
<durability>
66+
<kind>TRANSIENT_LOCAL_DURABILITY_QOS</kind>
67+
</durability>
68+
</datareader_qos>
69+
</qos_profile>
70+
</qos_library>
71+
72+
<domain_library name="DomainLibrary">
73+
<domain name="VehicleDomain" domain_id="0">
74+
<topic name="VehicleMetricsTopic" register_type_ref="VehicleMetrics" />
75+
<topic name="VehicleTransitTopic" register_type_ref="VehicleTransit" />
76+
</domain>
77+
</domain_library>
78+
79+
<domain_participant_library name="ParticipantLibrary">
80+
<domain_participant name="PublisherApp" domain_ref="DomainLibrary::VehicleDomain">
81+
<publisher name="Publisher">
82+
<data_writer name="MetricsWriter" topic_ref="VehicleMetricsTopic">
83+
<datawriter_qos base_name="VehicleModeling_Library::VehicleMetrics_Profile" />
84+
</data_writer>
85+
86+
<data_writer name="TransitWriter" topic_ref="VehicleTransitTopic">
87+
<datawriter_qos base_name="VehicleModeling_Library::VehicleTransit_Profile" />
88+
</data_writer>
89+
</publisher>
90+
</domain_participant>
91+
92+
<domain_participant name="SubscriberApp" domain_ref="DomainLibrary::VehicleDomain">
93+
<subscriber name="Subscriber">
94+
<data_reader name="MetricsReader" topic_ref="VehicleMetricsTopic">
95+
<datareader_qos base_name="VehicleModeling_Library::VehicleMetrics_Profile" />
96+
</data_reader>
97+
<data_reader name="TransitReader" topic_ref="VehicleTransitTopic">
98+
<datareader_qos base_name="VehicleModeling_Library::VehicleTransit_Profile" />
99+
</data_reader>
100+
</subscriber>
101+
</domain_participant>
102+
</domain_participant_library>
103+
</dds>
+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Tutorial: Data Persistence
2+
3+
This code is part of the Connext Application Design tutorial and is included
4+
here in full for convenience.
5+
Please see the tutorial for instructions.
6+
7+
This code targets Python 3.8 and uses the Connext Python API.
8+
9+
## How to build
10+
11+
The example already provides generated types (`VehicleModeling.py`), so nothing
12+
needs to be done for Python applications.
13+
14+
## How to run
15+
16+
The publisher can be run as a file or module. The expected output contains a
17+
description of the application. It will end once the vehicle has run out of fuel.
18+
19+
```console
20+
$ python publisher.py
21+
Running simulation: simulation=Simulation(self._metrics_writer=<rti.connextdds.DataWriter object at 0x7f7e693cdb30>, self._transit_writer=<rti.connextdds.DataWriter object at 0x7f7e697d83f0>, self._vehicle_vin='3P524A8JB256YZOQY', self._vehicle_fuel=100.0, self._vehicle_route=[Coord(lat=10.851231171123665, lon=4.549741897319626), Coord(lat=-19.336436875210726, lon=45.5761709545348), Coord(lat=-28.473080284108043, lon=-3.3714508132107524), Coord(lat=-44.45875114267031, lon=11.536506807784141), Coord(lat=-30.68510788813299, lon=3.7515235253391954), Coord(lat=-45.485688894791096, lon=-19.45044753805537)], self._vehicle_position=Coord(lat=-9.361148743978752, lon=10.532865637410172))
22+
Vehicle '3P524A8JB256YZOQY' has reached its destination, now moving to a new location...
23+
Vehicle '3P524A8JB256YZOQY' has reached its destination, now moving to a new location...
24+
Vehicle '3P524A8JB256YZOQY' ran out of fuel!
25+
26+
```
27+
28+
The subscriber can be run as a file or a module. The expected output contains a
29+
description of the application, followed by periodic updates on the understanding
30+
of the system. It will run until interrupted.
31+
32+
```console
33+
$ python subscriber.py
34+
[[ DASHBOARD: 2024-07-11 13:28:39.503181 ]]
35+
Online vehicles: 1
36+
- Vehicle F01UV8KCSAY5EVBL3:
37+
Fuel updates: 4
38+
Last known destination: Coord(lat=-29.739379575147705, lon=8.811412382546946)
39+
Last known fuel level: 90.24212596289948
40+
Offline vehicles: 1
41+
- Vehicle V93YZUZIYQB71P77Z:
42+
Mean fuel consumption: 2.5009597229252654
43+
Known reached destinations: 3
44+
- Coord(lat=-19.42303588068077, lon=4.543146614919191)
45+
- Coord(lat=-23.903966240016082, lon=-1.5759817176247415)
46+
- Coord(lat=-27.18890271220428, lon=-23.879609290719095)
47+
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#
2+
# (c) 2024 Copyright, Real-Time Innovations, Inc. All rights reserved.
3+
#
4+
# RTI grants Licensee a license to use, modify, compile, and create derivative
5+
# works of the Software solely for use with RTI products. The Software is
6+
# provided "as is", with no warranty of any type, including any warranty for
7+
# fitness for any purpose. RTI is under no obligation to maintain or support
8+
# the Software. RTI shall not be liable for any incidental or consequential
9+
# damages arising out of the use or inability to use the software.
10+
#
11+
12+
import os
13+
import sys
14+
from dataclasses import field
15+
from enum import IntEnum
16+
from typing import Optional, Sequence, Union
17+
18+
import rti.idl as idl
19+
20+
VIN_LENGTH = 17
21+
22+
VIN = str
23+
24+
25+
@idl.struct(type_annotations=[idl.final])
26+
class Coord:
27+
lat: float = 0.0
28+
lon: float = 0.0
29+
30+
31+
VehicleMetricsTopic = "VehicleMetrics"
32+
33+
34+
@idl.struct(
35+
member_annotations={
36+
"vehicle_vin": [idl.key, idl.bound(VIN_LENGTH)],
37+
"current_route": [idl.bound(100)],
38+
}
39+
)
40+
class VehicleTransit:
41+
vehicle_vin: str = ""
42+
current_position: Coord = field(default_factory=Coord)
43+
current_route: Optional[Sequence[Coord]] = None
44+
45+
46+
Percentage = float
47+
48+
VehicleTransitTopic = "VehicleTransit"
49+
50+
51+
@idl.struct(
52+
member_annotations={
53+
"vehicle_vin": [idl.key, idl.bound(VIN_LENGTH)],
54+
}
55+
)
56+
class VehicleMetrics:
57+
vehicle_vin: str = ""
58+
fuel_level: float = 0.0

0 commit comments

Comments
 (0)