From 99550012042e04361c39fd508d90be8fb8a7a916 Mon Sep 17 00:00:00 2001 From: Dominic Sudy Date: Thu, 17 Aug 2023 13:23:01 +0200 Subject: [PATCH 1/5] Adapt examples --- examples/seat-adjuster/AppManifest.json | 54 +++++++++++++---------- examples/set-data-points/AppManifest.json | 54 +++++++++++------------ 2 files changed, 56 insertions(+), 52 deletions(-) diff --git a/examples/seat-adjuster/AppManifest.json b/examples/seat-adjuster/AppManifest.json index d6e65228..c8bdde1e 100644 --- a/examples/seat-adjuster/AppManifest.json +++ b/examples/seat-adjuster/AppManifest.json @@ -1,26 +1,32 @@ -[ - { - "name": "seatadjuster", - "vehicleModel": { - "src": "https://github.com/COVESA/vehicle_signal_specification/releases/download/v3.0/vss_rel_3.0.json", - "datapoints": [ - { - "path": "Vehicle.Cabin.Seat.Row1.Pos1.Position", - "required": "true", - "access": "read" - }, - { - "path": "Vehicle.Speed", - "required": "true", - "access": "read" +{ + "name": "seatadjuster", + "interfaces": [ + { + "type": "vehicle-signal-interface", + "config": { + "src": "https://github.com/COVESA/vehicle_signal_specification/releases/download/v3.0/vss_rel_3.0.json", + "datapoints": { + "required": [ + { + "path": "Vehicle.Cabin.Seat.Row1.Pos1.Position", + "access": "read" + }, + { + "path": "Vehicle.Speed", + "access": "read" + } + ] } - ] + } }, - "runtime": [ - "grpc://sdv.databroker.v1.Broker/GetDatapoints", - "grpc://sdv.databroker.v1.Broker/Subscribe", - "grpc://sdv.edge.comfort.seats.v1.Seats/MoveComponent", - "mqtt" - ] - } -] + { + "type": "pubsub", + "config": { + "reads": [ "seatadjuster/setPosition/request" ], + "writes": [ + "seatadjuster/setPosition/response", "seatadjuster/currentPosition" + ] + } + } + ] +} diff --git a/examples/set-data-points/AppManifest.json b/examples/set-data-points/AppManifest.json index 45d73edc..fc5a6440 100644 --- a/examples/set-data-points/AppManifest.json +++ b/examples/set-data-points/AppManifest.json @@ -1,29 +1,27 @@ -[ - { - "name": "set-data-points", - "vehicleModel": { - "src": "https://github.com/COVESA/vehicle_signal_specification/releases/download/v3.0/vss_rel_3.0.json", - "datapoints": [ - { - "path": "Vehicle.Cabin.Seat.Row1.Pos1.Position", - "required": "true", - "access": "write" - }, - { - "path": "Vehicle.Cabin.Seat.Row1.Pos2.Position", - "required": "true", - "access": "write" - }, - { - "path": "Vehicle.Speed", - "required": "true", - "access": "write" +{ + "name": "set-data-points", + "interfaces": [ + { + "type": "vehicle-signal-interface", + "config": { + "src": "https://github.com/COVESA/vehicle_signal_specification/releases/download/v3.0/vss_rel_3.0.json", + "datapoints": { + "required": [ + { + "path": "Vehicle.Cabin.Seat.Row1.Pos1.Position", + "access": "write" + }, + { + "path": "Vehicle.Cabin.Seat.Row1.Pos2.Position", + "access": "write" + }, + { + "path": "Vehicle.Speed", + "access": "write" + } + ] } - ] - }, - "runtime": [ - "grpc://sdv.databroker.v1.Broker/GetDatapoints", - "grpc://sdv.databroker.v1.Broker/SetDatapoints" - ] - } -] + } + } + ] +} From 15e27373251aeee1cea6e2295397375652ef1686 Mon Sep 17 00:00:00 2001 From: Dominic Sudy <99014187+doosuu@users.noreply.github.com> Date: Fri, 18 Aug 2023 13:21:59 +0200 Subject: [PATCH 2/5] Apply suggestions from code review Co-authored-by: Markus Petke --- examples/seat-adjuster/AppManifest.json | 4 +++- examples/set-data-points/AppManifest.json | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/examples/seat-adjuster/AppManifest.json b/examples/seat-adjuster/AppManifest.json index c8bdde1e..59e57578 100644 --- a/examples/seat-adjuster/AppManifest.json +++ b/examples/seat-adjuster/AppManifest.json @@ -1,4 +1,5 @@ { + "manifestVersion": "v3", "name": "seatadjuster", "interfaces": [ { @@ -24,7 +25,8 @@ "config": { "reads": [ "seatadjuster/setPosition/request" ], "writes": [ - "seatadjuster/setPosition/response", "seatadjuster/currentPosition" + "seatadjuster/setPosition/response", + "seatadjuster/currentPosition" ] } } diff --git a/examples/set-data-points/AppManifest.json b/examples/set-data-points/AppManifest.json index fc5a6440..339e4a4e 100644 --- a/examples/set-data-points/AppManifest.json +++ b/examples/set-data-points/AppManifest.json @@ -1,4 +1,5 @@ { + "manifestVersion": "v3", "name": "set-data-points", "interfaces": [ { From 6b3d317756160169dd80df6beb2a8d696c041c29 Mon Sep 17 00:00:00 2001 From: Dominic Sudy Date: Sat, 19 Aug 2023 08:03:00 +0200 Subject: [PATCH 3/5] Refactor seat-adjuster example to use vehicle-signal-interface only. --- .../seat-adjuster/src/SeatAdjusterApp.cpp | 60 ++++++------------- install_dependencies.sh | 2 +- 2 files changed, 20 insertions(+), 42 deletions(-) diff --git a/examples/seat-adjuster/src/SeatAdjusterApp.cpp b/examples/seat-adjuster/src/SeatAdjusterApp.cpp index ca5696a5..21a2ba97 100644 --- a/examples/seat-adjuster/src/SeatAdjusterApp.cpp +++ b/examples/seat-adjuster/src/SeatAdjusterApp.cpp @@ -52,11 +52,6 @@ void SeatAdjusterApp::onStart() { ->onError( [this](auto&& status) { onErrorDatapoint(std::forward(status)); }); - // TODO: Do we need some kind of functionality to ensure that the Model - // in the VDB is actually the same as the one we are using? i.e. does it - // have the data points we are expecting??? - // m_vehicleModel->verify(); - subscribeToTopic(TOPIC_REQUEST) ->onItem([this](auto&& item) { onSetPositionRequestReceived(std::forward(item)); @@ -64,18 +59,6 @@ void SeatAdjusterApp::onStart() { ->onError([this](auto&& status) { onErrorTopic(std::forward(status)); }); } -void SeatAdjusterApp::onSeatMovementRequested(const velocitas::VoidResult& status, int requestId, - float requestedPosition) { - velocitas::logger().info("Seat movement request processed..."); - - nlohmann::json respData( - {{JSON_FIELD_REQUEST_ID, requestId}, - {JSON_FIELD_RESULT, - {{JSON_FIELD_MESSAGE, fmt::format("Called MoveComponent {}", requestedPosition)}, - {JSON_FIELD_STATUS, STATUS_OK}}}}); - publishToTopic(TOPIC_RESPONSE, respData.dump()); -} - void SeatAdjusterApp::onSetPositionRequestReceived(const std::string& data) { velocitas::logger().debug("position request: \"{}\"", data); const auto jsonData = nlohmann::json::parse(data); @@ -93,46 +76,41 @@ void SeatAdjusterApp::onSetPositionRequestReceived(const std::string& data) { const auto desiredSeatPosition = jsonData[JSON_FIELD_POSITION].get(); const auto requestId = jsonData[JSON_FIELD_REQUEST_ID].get(); - const auto vehicleSpeed = m_vehicleModel->Speed.get()->await().value(); + nlohmann::json respData({{JSON_FIELD_REQUEST_ID, requestId}, {JSON_FIELD_RESULT, {}}}); + const auto vehicleSpeed = m_vehicleModel->Speed.get()->await().value(); if (vehicleSpeed == 0) { velocitas::vehicle::cabin::SeatService::SeatLocation location{1, 1}; - m_vehicleModel->Cabin.SeatService - .moveComponent(location, velocitas::vehicle::cabin::SeatService::Component::Base, - desiredSeatPosition) - ->onResult([this, requestId, desiredSeatPosition](auto&& result) { - onSeatMovementRequested(std::forward(result), requestId, - desiredSeatPosition); - }) - ->onError([this](auto&& status) { onError(std::forward(status)); }); + m_vehicleModel->Cabin.Seat.Row1.Pos1.Position.set(desiredSeatPosition)->await(); + + respData[JSON_FIELD_RESULT][JSON_FIELD_STATUS] = STATUS_OK; + respData[JSON_FIELD_RESULT][JSON_FIELD_MESSAGE] = + fmt::format("Set Seat position to: {}", desiredSeatPosition); } else { const auto errorMsg = fmt::format( "Not allowed to move seat because vehicle speed is {} and not 0", vehicleSpeed); velocitas::logger().info(errorMsg); - nlohmann::json respData( - {{JSON_FIELD_REQUEST_ID, requestId}, - {JSON_FIELD_RESULT, - {{JSON_FIELD_STATUS, STATUS_FAIL}, {JSON_FIELD_MESSAGE, errorMsg}}}}); - publishToTopic(TOPIC_RESPONSE, respData.dump()); + respData[JSON_FIELD_RESULT][JSON_FIELD_STATUS] = STATUS_FAIL; + respData[JSON_FIELD_RESULT][JSON_FIELD_MESSAGE] = errorMsg; } + + publishToTopic(TOPIC_RESPONSE, respData.dump()); } void SeatAdjusterApp::onSeatPositionChanged(const velocitas::DataPointReply& dataPoints) { - const auto seatPositionValue = - dataPoints.get(m_vehicleModel->Cabin.Seat.Row1.Pos1.Position)->value(); - + nlohmann::json jsonResponse; try { - nlohmann::json jsonResponse({JSON_FIELD_POSITION, seatPositionValue}); - - publishToTopic(TOPIC_CURRENT_POSITION, jsonResponse.dump()); + const auto seatPositionValue = + dataPoints.get(m_vehicleModel->Cabin.Seat.Row1.Pos1.Position)->value(); + jsonResponse[JSON_FIELD_POSITION] = seatPositionValue; } catch (std::exception& exception) { velocitas::logger().error("Unable to get Current Seat Position, Exception: {}", exception.what()); - nlohmann::json jsonResponse( - {{JSON_FIELD_STATUS, STATUS_FAIL}, {JSON_FIELD_MESSAGE, exception.what()}}); - - publishToTopic(TOPIC_CURRENT_POSITION, jsonResponse.dump()); + jsonResponse[JSON_FIELD_STATUS] = STATUS_FAIL; + jsonResponse[JSON_FIELD_MESSAGE] = exception.what(); } + + publishToTopic(TOPIC_CURRENT_POSITION, jsonResponse.dump()); } void SeatAdjusterApp::onError(const velocitas::Status& status) { diff --git a/install_dependencies.sh b/install_dependencies.sh index 83fbbd07..24664e45 100755 --- a/install_dependencies.sh +++ b/install_dependencies.sh @@ -113,7 +113,7 @@ fi # Enable Conan revision handling to enable pinning googleapis recipe revision (see conanfile.py) export CONAN_REVISIONS_ENABLED=1 -conan install \ +conan install --update \ -pr:h ../.conan/profiles/linux_${HOST_ARCH}_${BUILD_VARIANT} \ ${XCOMPILE_PROFILE} \ --build "${WHICH_DEPS_TO_BUILD}" .. From aa85b5c74cb52e09f2e9d460a804e33129ecfc9a Mon Sep 17 00:00:00 2001 From: Dominic Sudy Date: Sat, 19 Aug 2023 08:10:26 +0200 Subject: [PATCH 4/5] Update auto-generated 3rd party notice file --- NOTICE-3RD-PARTY-CONTENT.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/NOTICE-3RD-PARTY-CONTENT.md b/NOTICE-3RD-PARTY-CONTENT.md index 8f76972c..7547ecc4 100644 --- a/NOTICE-3RD-PARTY-CONTENT.md +++ b/NOTICE-3RD-PARTY-CONTENT.md @@ -4,18 +4,18 @@ | Dependency | Version | License | |:-----------|:-------:|--------:| |bottle|0.12.25|MIT| -|certifi|2023.5.7|Mozilla Public License 2.0| -|cfgv|3.3.1|MIT| -|charset-normalizer|3.1.0|MIT| +|certifi|2023.7.22|Mozilla Public License 2.0| +|cfgv|3.4.0|MIT| +|charset-normalizer|3.2.0|MIT| |colorama|0.4.6|BSD| |conan|1.58.0|MIT| |cpplint|1.6.1|New BSD| -|distlib|0.3.6|Python Software Foundation License| +|distlib|0.3.7|Python Software Foundation License| |distro|1.7.0|Apache 2.0| |fasteners|0.18|Apache 2.0| |filelock|3.12.2|The Unlicense (Unlicense)| |gcovr|5.2|BSD| -|identify|2.5.24|MIT| +|identify|2.5.26|MIT| |idna|3.4|BSD| |Jinja2|3.1.2|New BSD| |lxml|4.9.3|New BSD| @@ -23,20 +23,20 @@ |node-semver|0.6.1|MIT| |nodeenv|1.8.0|BSD| |patch-ng|1.17.4|MIT| -|platformdirs|3.8.1|MIT| +|platformdirs|3.10.0|MIT| |pluginbase|1.0.1|BSD| |pre-commit|2.20.0|MIT| -|Pygments|2.15.1|Simplified BSD| -|PyJWT|2.7.0|MIT| +|Pygments|2.16.1|Simplified BSD| +|PyJWT|2.8.0|MIT| |python-dateutil|2.8.2|Apache 2.0
BSD| |PyYAML|6.0|MIT| |requests|2.31.0|Apache 2.0| |setuptools|58.1.0|MIT| |six|1.16.0|MIT| |toml|0.10.2|MIT| -|tqdm|4.65.0|MIT
Mozilla Public License 2.0 (MPL 2.0)| +|tqdm|4.66.1|MIT
Mozilla Public License 2.0 (MPL 2.0)| |urllib3|1.26.16|MIT| -|virtualenv|20.23.1|MIT| +|virtualenv|20.24.3|MIT| ## Workflows | Dependency | Version | License | |:-----------|:-------:|--------:| From 7247d1528e32d769dccb2cace04aea98cba34510 Mon Sep 17 00:00:00 2001 From: Dominic Sudy Date: Sat, 19 Aug 2023 08:15:06 +0200 Subject: [PATCH 5/5] Remove unused variable. --- examples/seat-adjuster/src/SeatAdjusterApp.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/seat-adjuster/src/SeatAdjusterApp.cpp b/examples/seat-adjuster/src/SeatAdjusterApp.cpp index 21a2ba97..e0b7e629 100644 --- a/examples/seat-adjuster/src/SeatAdjusterApp.cpp +++ b/examples/seat-adjuster/src/SeatAdjusterApp.cpp @@ -79,7 +79,6 @@ void SeatAdjusterApp::onSetPositionRequestReceived(const std::string& data) { nlohmann::json respData({{JSON_FIELD_REQUEST_ID, requestId}, {JSON_FIELD_RESULT, {}}}); const auto vehicleSpeed = m_vehicleModel->Speed.get()->await().value(); if (vehicleSpeed == 0) { - velocitas::vehicle::cabin::SeatService::SeatLocation location{1, 1}; m_vehicleModel->Cabin.Seat.Row1.Pos1.Position.set(desiredSeatPosition)->await(); respData[JSON_FIELD_RESULT][JSON_FIELD_STATUS] = STATUS_OK;