Skip to content

Commit

Permalink
--expand sensor attributes manager functions
Browse files Browse the repository at this point in the history
  • Loading branch information
jturner65 committed Nov 25, 2024
1 parent e327d81 commit bfe1bc0
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
33 changes: 32 additions & 1 deletion src/esp/metadata/managers/SensorAttributesManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<Magnum::Vector3>(
jsonConfig, "position", [attribs](const Magnum::Vector3& position) {
attribs->setPosition(position);
});

// orientation
io::jsonIntoConstSetter<Magnum::Vector3>(
jsonConfig, "orientation", [attribs](const Magnum::Vector3& orientation) {
attribs->setOrientation(orientation);
});

// noise model
io::jsonIntoConstSetter<std::string>(
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

Expand Down
2 changes: 1 addition & 1 deletion src/esp/metadata/managers/SensorAttributesManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit bfe1bc0

Please sign in to comment.