From bfe1bc0009d93854298475030768a6a249b53dfc Mon Sep 17 00:00:00 2001 From: John Turner <7strbass@gmail.com> Date: Mon, 25 Nov 2024 16:15:10 -0500 Subject: [PATCH] --expand sensor attributes manager functions --- .../managers/SensorAttributesManager.cpp | 33 ++++++++++++++++++- .../managers/SensorAttributesManager.h | 2 +- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/src/esp/metadata/managers/SensorAttributesManager.cpp b/src/esp/metadata/managers/SensorAttributesManager.cpp index 0d7c1e152c..635bd057ef 100644 --- a/src/esp/metadata/managers/SensorAttributesManager.cpp +++ b/src/esp/metadata/managers/SensorAttributesManager.cpp @@ -163,9 +163,40 @@ void SensorAtttributesManager::setValsFromJSONDoc( const io::JsonGenericValue& jsonConfig) { // TODO support loading values from JSON docs for each type of // SensorAttributes. + // position of sensor + io::jsonIntoConstSetter( + jsonConfig, "position", [attribs](const Magnum::Vector3& position) { + attribs->setPosition(position); + }); + + // orientation + io::jsonIntoConstSetter( + jsonConfig, "orientation", [attribs](const Magnum::Vector3& orientation) { + attribs->setOrientation(orientation); + }); + + // noise model + io::jsonIntoConstSetter( + jsonConfig, "noise_model", [attribs](const std::string& noise_model) { + attribs->setNoiseModel(noise_model); + }); + + // sensor type + this->setEnumStringFromJsonDoc( + jsonConfig, "sensor_type", "SensorTypeNamesMap", false, + attributes::SensorTypeNamesMap, + [attribs](const std::string& val) { attribs->setSensorType(val); }); + + // sensor subtype + this->setEnumStringFromJsonDoc( + jsonConfig, "sensor_subtype", "SensorSubTypeNamesMap", false, + attributes::SensorSubTypeNamesMap, + [attribs](const std::string& val) { attribs->setSensorSubType(val); }); + + // TODO populate other types of sensor attributes from json // check for user defined attributes - // this->parseUserDefinedJsonVals(attribs, jsonConfig); + this->parseUserDefinedJsonVals(attribs, jsonConfig); } // SensorAtttributesManager::setValsFromJSONDoc diff --git a/src/esp/metadata/managers/SensorAttributesManager.h b/src/esp/metadata/managers/SensorAttributesManager.h index 88b49cd220..58464fb753 100644 --- a/src/esp/metadata/managers/SensorAttributesManager.h +++ b/src/esp/metadata/managers/SensorAttributesManager.h @@ -152,7 +152,7 @@ class SensorAtttributesManager core::managedContainers::ManagedObjectPreregistration preRegisterObjectFinalize(attributes::AbstractSensorAttributes::ptr object, const std::string& objectHandle, - bool forceRegistration) override; + CORRADE_UNUSED bool forceRegistration) override; /** * @brief Not required for this manager.