Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add streaming sample #40

Merged
merged 27 commits into from
Aug 25, 2023
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .accepted_words.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ Chariott's
chariott
com
config
dev
digitaltwins
dir
dt
dtdl
DTDL
en
fontconfig
gcc
gcc's
github
Expand All @@ -31,6 +33,7 @@ json
JSON
ld
LD
libfontconfig
microsoft
minimalistic
mosquitto
Expand Down
11 changes: 10 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

[workspace]

# Use version 2 of the feature resolver.
# This is needed by a dependency of the show-image crate.
resolver = "2"
ashbeitz marked this conversation as resolved.
Show resolved Hide resolved

members = [
# core
"core/protobuf_data_access",
Expand All @@ -22,6 +26,7 @@ members = [
"samples/mixed",
"samples/property",
"samples/seat_massager",
"samples/streaming",
]

[workspace.dependencies]
Expand All @@ -30,22 +35,26 @@ config = "0.13.3"
env_logger= "0.10.0"
futures = "0.3"
generic-json = "^0.7"
image = "0.24.3"
iref = "^2.0.3"
lazy_static = "1.4.0"
log = "^0.4"
paho-mqtt = "0.12"
parking_lot = "0.12.1"
prost = "0.11"
prost-types = "0.11"
regex = " 1.9.1"
regex = " 1.9.3"
serde = "1.0.160"
serde_derive = "1.0.163"
serde_json = "^1.0"
show-image = "0.13.1"
strum = "0.25"
strum_macros = "0.25.1"
tokio = "1.29.1"
tokio-stream = "0.1.14"
tonic = "0.9.2"
tonic-build = "0.9.2"
url = "2.3.1"
uuencode = "0.1.5"
uuid = "1.2.2"
yaml-rust = "0.4"
63 changes: 53 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
- [Install gcc](#install-gcc)
- [Install Rust](#install-rust)
- [Install Protobuf Compiler](#install-protobuf-compiler)
- [Install fontconfig-dev library](#install-fontconfig-dev-lib)
- [Install MQTT Broker](#install-mqtt-broker)
- [Cloning the Repo](#cloning-the-repo)
- [Developer Notes](#developer-notes)
- [JSON-LD Crate](#json-ld-crate)
Expand All @@ -17,6 +19,7 @@
- [Command Sample](#command-sample)
- [Mixed Sample](#mixed-sample)
- [Seat Massager Sample](#seat-massager-sample)
- [Streaming Sample](#streaming-sample)
- [Using Chariott](#using-chariott)
- [Trademarks](#trademarks)

Expand Down Expand Up @@ -60,7 +63,17 @@ The toolchain version is managed by the `rust-toolchain.toml` file. If you do no

You will need to install the Protobuf Compiler. This can be done by executing:

`sudo apt install -y protobuf-compiler`
```shell
sudo apt install -y protobuf-compiler
```

### <a name="install-fontconfig-dev-lib">Install fontconfig-dev library</a>
ashbeitz marked this conversation as resolved.
Show resolved Hide resolved
ashbeitz marked this conversation as resolved.
Show resolved Hide resolved

You will need to install the fontconfig-dev library. This can be done by executing:

```shell
sudo apt install -y libfontconfig-dev
```

### <a name="install-mqtt-broker">Install MQTT Broker</a>

Expand Down Expand Up @@ -110,7 +123,7 @@ demonstrates the mixed use of properties and commands and one that demonstrates

The demos use config files and we have provided a templated version of each config file. These templates can be found in:

- {repo-root-dir}/core/invehicle_digital_twin/template
- {repo-root-dir}/core/invehicle-digital-twin/template
- {repo-root-dir}/samples/common/template

Chariott may be used to discover the in-vehicle digital twin service. We will discuss how to enable this feature.
Expand All @@ -123,7 +136,7 @@ Steps:

1. The best way to run the demo is by using three windows: one running the In-Vehicle Digital Twin, one running the Digital Twin Provider and one running the Digital Twin Consumer.
Orientate the three windows so that they are lined up in a column. The top window can be used for the In-Vehicle Digital Twin.
The middle window can be used for the Provider. The bottom window can be used for a Consumer.<br>
The middle window can be used for the Digital Twin Provider. The bottom window can be used for the Digital Twin Consumer.<br>
1. In each window, change directory to the directory containing the build artifacts.
Make sure that you replace "{repo-root-dir}" with the repository root directory on the machine where you are running the demo.<br><br>
`cd {repo-root-dir}/target/debug`<br>
Expand All @@ -136,7 +149,7 @@ Make sure that you replace "{repo-root-dir}" with the repository root directory
`provider_authority: "0.0.0.0:1883"`<br>
`invehicle_digital_twin_uri: "http://0.0.0.0:5010"`<br><br>
1. In the top window, run:<br><br>
`./in-vehicle-digital-twin`<br>
`./invehicle-digital-twin`<br>
1. In the middle window, run:<br><br>
`./property-provider`<br>
1. In the bottom window, run:<br><br>
Expand All @@ -151,7 +164,7 @@ Steps:

1. The best way to run the demo is by using three windows: one running the In-Vehicle Digital Twin, one running the Digital Twin Provider and one running the Digital Twin Consumer.
Orientate the three windows so that they are lined up in a column. The top window can be used for the In-Vehicle Digital Twin.
The middle window can be used for the Provider. The bottom window can be used for a Consumer.<br>
The middle window can be used for the Digital Twin Provider. The bottom window can be used for the Digital Twin Consumer.<br>
1. In each window, change directory to the directory containing the build artifacts.
Make sure that you replace "{repo-root-dir}" with the repository root directory on the machine where you are running the demo.<br><br>
`cd {repo-root-dir}/target/debug`<br>
Expand All @@ -165,7 +178,7 @@ Make sure that you replace "{repo-root-dir}" with the repository root directory
`provider_authority: "0.0.0.0:4010"`<br>
`invehicle_digital_twin_uri: "http://0.0.0.0:5010"`<br><br>
1. In the top window, run:<br><br>
`./in-vehicle-digital-twin`<br>
`./invehicle-digital-twin`<br>
1. In the middle window, run:<br><br>
`./command-provider`<br>
1. In the bottom window, run:<br><br>
Expand All @@ -180,7 +193,7 @@ Steps:

1. The best way to run the demo is by using three windows: one running the In-Vehicle Digital Twin, one running the Digital Twin Provider and one running the Digital Twin Consumer.
Orientate the three windows so that they are lined up in a column. The top window can be used for the In-Vehicle Digital Twin.
The middle window can be used for the Provider. The bottom window can be used for a Consumer.<br>
The middle window can be used for the Digital Twin Provider. The bottom window can be used for the Digital Twin Consumer.<br>
1. In each window, change directory to the directory containing the build artifacts.
Make sure that you replace "{repo-root-dir}" with the repository root directory on the machine where you are running the demo.<br><br>
`cd {repo-root-dir}/target/debug`<br>
Expand All @@ -194,7 +207,7 @@ Make sure that you replace "{repo-root-dir}" with the repository root directory
`provider_authority: "0.0.0.0:4010"`<br>
`invehicle_digital_twin_uri: "http://0.0.0.0:5010"`<br><br>
1. In the top window, run:<br><br>
`./in-vehicle-digital-twin`<br>
`./invehicle-digital-twin`<br>
1. In the middle window, run:<br><br>
`./mixed-provider`<br>
1. In the bottom window, run:<br><br>
Expand All @@ -209,7 +222,7 @@ Steps:

1. The best way to run the demo is by using three windows: one running the In-Vehicle Digital Twin, one running the Digital Twin Provider and one running the Digital Twin Consumer.
Orientate the three windows so that they are lined up in a column. The top window can be used for the In-Vehicle Digital Twin.
The middle window can be used for the Provider. The bottom window can be used for a Consumer.<br>
The middle window can be used for the Digital Twin Provider. The bottom window can be used for the Digital Twin Consumer.<br>
1. In each window, change directory to the directory containing the build artifacts.
Make sure that you replace "{repo-root-dir}" with the repository root directory on the machine where you are running the demo.<br><br>
`cd {repo-root-dir}/target/debug`<br>
Expand All @@ -223,13 +236,43 @@ Make sure that you replace "{repo-root-dir}" with the repository root directory
`provider_authority: "0.0.0.0:4010"`<br>
`invehicle_digital_twin_uri: "http://0.0.0.0:5010"`<br><br>
1. In the top window, run:<br><br>
`./in-vehicle-digital-twin`<br>
`./invehicle-digital-twin`<br>
1. In the middle window, run:<br><br>
`./seat-massager-provider`<br>
1. In the bottom window, run:<br><br>
`./seat-massager-consumer`<br>
1. Use control-c in each of the windows when you wish to stop the demo.

### <a name="streaming-sample">Streaming Sample</a>

The following instructions are for the demo for streaming.

Steps:

1. The best way to run the demo is by using three windows: one running the In-Vehicle Digital Twin, one running the Digital Twin Provider and one running the Digital Twin Consumer.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since much of the setup is copied and pasted for all of these demos, can we move it out into a "common setup" section?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are suttle differences and I expect these to diverge as Ibeji becomes more mature.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaving as is for now.

Orientate the three windows so that they are lined up in a column. The top window can be used for the In-Vehicle Digital Twin.
The middle window can be used for the Digital Twin Provider. The bottom window can be used for the Digital Twin Consumer.<br>
1. In each window, change directory to the directory containing the build artifacts.
Make sure that you replace "{repo-root-dir}" with the repository root directory on the machine where you are running the demo.<br><br>
`cd {repo-root-dir}/target/debug`<br>
1. Create the three config files with the following contents, if they are not already there:<br><br>
---- streaming_consumer_settings.yaml ----<br>
`invehicle_digital_twin_uri: "http://0.0.0.0:5010"`<br><br>
`number_of_images: 20`<br><br>
---- invehicle_digital_twin_settings.yaml ----<br>
`invehicle_digital_twin_authority: "0.0.0.0:5010"`<br><br>
---- streaming_provider_settings.yaml ----<br>
`provider_authority: "0.0.0.0:4010"`<br>
`invehicle_digital_twin_uri: "http://0.0.0.0:5010"`<br><br>
`image_directory: "<<chariott-repo-root>>/examples/applications/simulated-camera/images"`
1. In the top window, run:<br><br>
`./invehicle-digital-twin`<br>
1. In the middle window, run:<br><br>
`./streaming-provider`<br>
1. In the bottom window, run:<br><br>
`./streaming-consumer`<br>
1. Use control-c in each of the windows when you wish to stop the demo.

### <a name="using-chariott">Using Chariott</a>

If you want the digital twin consumers and digital twin providers for each demo to use Chariott to discover the URI for the In-Vehicle Digital Twin Service,
Expand Down
9 changes: 5 additions & 4 deletions devops/cg/about.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
accepted = [
"MIT",
"Apache-2.0",
"BSD-2-Clause",
"BSD-3-Clause",
"CC0-1.0",
"EPL-1.0",
"EPL-2.0",
"ISC",
"MIT",
"Unicode-DFS-2016",
"BSD-2-Clause",
"BSD-3-Clause",
"Zlib",
"CC0-1.0",
]
17 changes: 17 additions & 0 deletions digital-twin-model/dtdl/v3/spec/sdv/camera.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[
{
"@context": "dtmi:dtdl:context;3",
"@type": "Interface",
"@id": "dtmi:sdv:Camera;1",
"description": "Cabin camera.",
"contents": [
{
"@type": "Property",
"@id": "dtmi:sdv:Camera:Feed;1",
"name": "Feed",
"schema": "string",
"description": "The cabin camera's feed for inside the cabin."
ashbeitz marked this conversation as resolved.
Show resolved Hide resolved
}
]
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"@type": "Property",
"@id": "dtmi:sdv:HVAC:AmbientAirTemperature;1",
"name": "AmbientAirTemperature",
"description": "The immediate surroundings air temperature (in Fahrenheit).",
"description": "The immediate surroundings' air temperature (in Fahrenheit).",
"schema": "integer"
},
{
Expand Down
9 changes: 9 additions & 0 deletions digital-twin-model/src/sdv_v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ pub mod airbag_seat_massager {
}
}

pub mod camera {
pub mod feed {
pub const ID: &str = "dtmi:sdv:Camera:Feed;1";
pub const NAME: &str = "Feed";
pub const DESCRIPTION: &str = "The cabin camera's feed for inside the cabin.";
pub type TYPE = String;
}
}

pub mod hmi {
pub mod show_notification {
pub const ID: &str = "dtmi:sdv:HMI:ShowNotification;1";
Expand Down
18 changes: 12 additions & 6 deletions docs/design/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@ DTDL can identify and specify each of the resources. Below is an example of a HV

#### Register

Below is the sequence diagram for the Register activity.
The sequence diagram for the Register activity is shown below.

![Sequence Diagram](diagrams/register_sequence.svg)

#### Find by Id

Below is the sequence diagram for the Find-By-Id activity.
The sequence diagram for the Find-By-Id activity is shown below.

![Sequence Diagram](diagrams/findbyid_sequence.svg)

Expand All @@ -86,28 +86,34 @@ Below is the sequence diagram for the Find-By-Id activity.

#### Get

The sequence diagram for a Digital Twin Consumer using the Get operation.
The sequence diagram for a Digital Twin Consumer using the Get operation is shown below.

![Sequence Diagram](diagrams/get_sequence.svg)

#### Set

The sequence diagram for a Digital Twin Consumer using the Set operation.
The sequence diagram for a Digital Twin Consumer using the Set operation is shown below.

![Sequence Diagram](diagrams/set_sequence.svg)

#### Subscribe

The sequence diagram for a Digital Twin Consumer using the Subscribe operation.
The sequence diagram for a Digital Twin Consumer using the Subscribe operation is shown below.

![Sequence Diagram](diagrams/subscribe_sequence.svg)

#### Invoke

The sequence diagram for a Digital Twin Consumer using the Invoke operation.
The sequence diagram for a Digital Twin Consumer using the Invoke operation is shown below.

![Sequence Diagram](diagrams/invoke_sequence.svg)

#### Stream

The sequence diagram for a Digital Twin Consumer using the Stream operation is shown below.

![Sequence Diagram](diagrams/stream_sequence.svg)

## <a name="appendix-digital-twin-interface">Appendix: Digital Twin Interface</a>

### FindById
Expand Down
2 changes: 1 addition & 1 deletion docs/design/diagrams/findbyid_sequence.puml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ entityAccessInfo:
{
name: "AmbientAirTemperature"
id: "dtmi:sdv:HVAC:AmbientAirTemperature;1"
description: "The immediate surroundings air temperature (in Fahrenheit)."
description: "The immediate surroundings' air temperature (in Fahrenheit)."
endpointInfoList: [
{
protocol: "grpc"
Expand Down
Loading