From d49991d6efe448faa0a0fdef376034bc8d26a683 Mon Sep 17 00:00:00 2001 From: John Turner <7strbass@gmail.com> Date: Mon, 30 Dec 2024 13:09:05 -0500 Subject: [PATCH] --add missing wrapper classes --- src/esp/CMakeLists.txt | 4 + .../sensorWrappers/ManagedCameraSensor.h | 54 ++++++++++++++ .../sensorWrappers/ManagedCubeMapSensorBase.h | 74 +++++++++++++++++++ .../ManagedEquirectangularSensor.h | 58 +++++++++++++++ .../sensorWrappers/ManagedFisheyeSensor.h | 55 ++++++++++++++ .../sensorWrappers/ManagedSensorTemplates.h | 3 + .../sensorWrappers/ManagedVisualSensorBase.h | 8 +- 7 files changed, 252 insertions(+), 4 deletions(-) create mode 100644 src/esp/sensor/sensorWrappers/ManagedCameraSensor.h create mode 100644 src/esp/sensor/sensorWrappers/ManagedCubeMapSensorBase.h create mode 100644 src/esp/sensor/sensorWrappers/ManagedEquirectangularSensor.h create mode 100644 src/esp/sensor/sensorWrappers/ManagedFisheyeSensor.h diff --git a/src/esp/CMakeLists.txt b/src/esp/CMakeLists.txt index 8b95bed57c..74a1db58cc 100644 --- a/src/esp/CMakeLists.txt +++ b/src/esp/CMakeLists.txt @@ -472,6 +472,10 @@ set( sensor/sensorManagers/SensorWrapperManager.h sensor/sensorManagers/SensorWrapperBaseManager.h sensor/sensorWrappers/ManagedAudioSensor.h + sensor/sensorWrappers/ManagedCameraSensor.h + sensor/sensorWrappers/ManagedCubeMapSensorBase.h + sensor/sensorWrappers/ManagedEquirectangularSensor.h + sensor/sensorWrappers/ManagedFisheyeSensor.h sensor/sensorWrappers/ManagedSensorBase.h sensor/sensorWrappers/ManagedSensorTemplates.h sensor/sensorWrappers/ManagedVisualSensorBase.h diff --git a/src/esp/sensor/sensorWrappers/ManagedCameraSensor.h b/src/esp/sensor/sensorWrappers/ManagedCameraSensor.h new file mode 100644 index 0000000000..58a99c4a3c --- /dev/null +++ b/src/esp/sensor/sensorWrappers/ManagedCameraSensor.h @@ -0,0 +1,54 @@ +// Copyright (c) Meta Platforms, Inc. and its affiliates. +// This source code is licensed under the MIT license found in the +// LICENSE file in the root directory of this source tree. + +#ifndef ESP_SENSOR_MANAGEDCAMERASENSOR_H_ +#define ESP_SENSOR_MANAGEDCAMERASENSOR_H_ + +#include "ManagedVisualSensorBase.h" +#include "esp/sensor/CameraSensor.h" + +namespace esp { +namespace sensor { + +/** + * @brief Class for wrapper for camera sensor objects + */ +class ManagedCameraSensor : public AbstractManagedVisualSensor { + public: + explicit ManagedCameraSensor( + const std::string& classKey = "ManagedCameraSensor") + : AbstractManagedVisualSensor::AbstractManagedVisualSensor( + classKey) {} + + // TODO Add appropriate camera sensor getters/setters here + + protected: + /** + * @brief Retrieve a comma-separated string holding the header values for + * the info returned for this managed visual sensor, type-specific. + */ + std::string getVisualSensorObjInfoHeaderInternal() const override { + return ""; + } + + /** + * @brief Specialization-specific extension of getObjectInfo, comma + * separated info ideal for saving to csv + */ + + std::string getVisualSensorObjInfoInternal( + CORRADE_UNUSED std::shared_ptr& sp) + const override { + // TODO provide info stream for sensors + return ""; + } + + public: + ESP_SMART_POINTERS(ManagedCameraSensor) +}; // class ManagedCameraSensor + +} // namespace sensor +} // namespace esp + +#endif // ESP_SENSOR_MANAGEDCAMERASENSOR_H_ diff --git a/src/esp/sensor/sensorWrappers/ManagedCubeMapSensorBase.h b/src/esp/sensor/sensorWrappers/ManagedCubeMapSensorBase.h new file mode 100644 index 0000000000..a8ba4b86ca --- /dev/null +++ b/src/esp/sensor/sensorWrappers/ManagedCubeMapSensorBase.h @@ -0,0 +1,74 @@ +// Copyright (c) Meta Platforms, Inc. and its affiliates. +// This source code is licensed under the MIT license found in the +// LICENSE file in the root directory of this source tree. + +#ifndef ESP_SENSOR_MANAGEDCUBEMAPSENSORBASE_H_ +#define ESP_SENSOR_MANAGEDCUBEMAPSENSORBASE_H_ + +#include "ManagedVisualSensorBase.h" +#include "esp/sensor/CubeMapSensorBase.h" + +namespace esp { +namespace sensor { + +/** + * @brief Class Template for wrapper for CubeMap sensor objects + */ +template +class AbstractManagedCubeMapSensorBase + : public esp::sensor::AbstractManagedVisualSensor { + public: + static_assert( + std::is_base_of::value, + "AbstractManagedCubeMapSensorBase :: Managed CubeMap sensor object " + "type must be derived from esp::sensor::CubeMapSensorBase"); + + explicit AbstractManagedCubeMapSensorBase(const std::string& classKey) + : AbstractManagedVisualSensor(classKey) {} + + // TODO Add appropriate camera sensor getters/setters here + + protected: + /** + * @brief Retrieve a comma-separated string holding the header values for + * the info returned for this managed visual sensor, type-specific. + */ + std::string getVisualSensorObjInfoHeaderInternal() const override { + return "" + getCubeMapSensorObjInfoHeaderInternal(); + } + + /** + * @brief Retrieve a comma-separated string holding the header values for + * the info returned for this managed visual sensor, type-specific. + */ + + virtual std::string getCubeMapSensorObjInfoHeaderInternal() const = 0; + /** + * @brief Specialization-specific extension of getObjectInfo, comma + * separated info ideal for saving to csv + */ + + std::string getVisualSensorObjInfoInternal( + CORRADE_UNUSED std::shared_ptr& sp) const override { + // TODO provide info stream for sensors + std::string res = + Cr::Utility::formatString("{},", getCubeMapSensorObjInfoInternal()); + + return res; + } + + /** + * @brief Specialization-specific extension of getSensorObjInfoInternal, comma + * separated info ideal for saving to csv + */ + virtual std::string getCubeMapSensorObjInfoInternal( + std::shared_ptr& sp) const = 0; + + public: + ESP_SMART_POINTERS(AbstractManagedCubeMapSensorBase) +}; // class ManagedCubeMapSensorBase + +} // namespace sensor +} // namespace esp + +#endif // ESP_SENSOR_MANAGEDCUBEMAPSENSORBASE_H_ diff --git a/src/esp/sensor/sensorWrappers/ManagedEquirectangularSensor.h b/src/esp/sensor/sensorWrappers/ManagedEquirectangularSensor.h new file mode 100644 index 0000000000..da8b67a824 --- /dev/null +++ b/src/esp/sensor/sensorWrappers/ManagedEquirectangularSensor.h @@ -0,0 +1,58 @@ +// Copyright (c) Meta Platforms, Inc. and its affiliates. +// This source code is licensed under the MIT license found in the +// LICENSE file in the root directory of this source tree. + +#ifndef ESP_SENSOR_MANAGEDEQUIRECTANGULARSENSOR_H_ +#define ESP_SENSOR_MANAGEDEQUIRECTANGULARSENSOR_H_ + +#include "ManagedCubeMapSensorBase.h" +#include "esp/sensor/EquirectangularSensor.h" + +namespace esp { +namespace sensor { + +/** + * @brief Class for wrapper for sensor objects of all kinds to + * enable Managed Container access. + */ +class ManagedEquirectangularSensor + : public AbstractManagedCubeMapSensorBase { + public: + explicit ManagedEquirectangularSensor( + const std::string& classKey = "ManagedEquirectangularSensor") + : AbstractManagedCubeMapSensorBase< + EquirectangularSensor>::AbstractManagedCubeMapSensorBase(classKey) { + } + + // TODO Add appropriate equirectangular sensor getters/setters here + + protected: + /** + * @brief Retrieve a comma-separated string holding the header values for + * the info returned for this managed Equirectangular CubeMap sensor, + * type-specific. + */ + std::string getCubeMapSensorObjInfoHeaderInternal() const override { + return ""; + } + + /** + * @brief Specialization-specific extension of getObjectInfo, comma + * separated info ideal for saving to csv + */ + + std::string getCubeMapSensorObjInfoInternal( + CORRADE_UNUSED std::shared_ptr& sp) + const override { + // TODO provide info stream for sensors + return ""; + } + + public: + ESP_SMART_POINTERS(ManagedEquirectangularSensor) +}; // namespace sensor + +} // namespace sensor +} // namespace esp + +#endif // ESP_SENSOR_MANAGEDEQUIRECTANGULARSENSOR_H_ diff --git a/src/esp/sensor/sensorWrappers/ManagedFisheyeSensor.h b/src/esp/sensor/sensorWrappers/ManagedFisheyeSensor.h new file mode 100644 index 0000000000..5878cd51c4 --- /dev/null +++ b/src/esp/sensor/sensorWrappers/ManagedFisheyeSensor.h @@ -0,0 +1,55 @@ +// Copyright (c) Meta Platforms, Inc. and its affiliates. +// This source code is licensed under the MIT license found in the +// LICENSE file in the root directory of this source tree. + +#ifndef ESP_SENSOR_MANAGEDFISHEYESENSOR_H_ +#define ESP_SENSOR_MANAGEDFISHEYESENSOR_H_ + +#include "ManagedCubeMapSensorBase.h" +#include "esp/sensor/FisheyeSensor.h" + +namespace esp { +namespace sensor { + +/** + * @brief Class for wrapper for sensor objects of all kinds to + * enable Managed Container access. + */ +class ManagedFisheyeSensor + : public AbstractManagedCubeMapSensorBase { + public: + explicit ManagedFisheyeSensor( + const std::string& classKey = "ManagedFisheyeSensor") + : AbstractManagedCubeMapSensorBase< + FisheyeSensor>::AbstractManagedCubeMapSensorBase(classKey) {} + + // TODO Add appropriate fisheye sensor getters/setters here + + protected: + /** + * @brief Retrieve a comma-separated string holding the header values for + * the info returned for this managed visual sensor, type-specific. + */ + std::string getCubeMapSensorObjInfoHeaderInternal() const override { + return ""; + } + + /** + * @brief Specialization-specific extension of getObjectInfo, comma + * separated info ideal for saving to csv + */ + + std::string getCubeMapSensorObjInfoInternal( + CORRADE_UNUSED std::shared_ptr& sp) const override { + // TODO provide info stream for sensors + return ""; + } + + public: + ESP_SMART_POINTERS(ManagedFisheyeSensor) +}; // namespace sensor + +} // namespace sensor +} // namespace esp + +#endif // ESP_SENSOR_MANAGEDFISHEYESENSOR_H_ diff --git a/src/esp/sensor/sensorWrappers/ManagedSensorTemplates.h b/src/esp/sensor/sensorWrappers/ManagedSensorTemplates.h index ff8374227e..1a1f3db928 100644 --- a/src/esp/sensor/sensorWrappers/ManagedSensorTemplates.h +++ b/src/esp/sensor/sensorWrappers/ManagedSensorTemplates.h @@ -25,6 +25,9 @@ class AbstractManagedSensor : public ManagedSensorBase { "AbstractManagedSensor :: Managed sensor object type must be " "derived from esp::sensor::Sensor"); + /** + * @brief Alias for weak pointer to the @ref esp::sensor::Sensor this construct wraps. + */ typedef std::weak_ptr WeakObjRef; explicit AbstractManagedSensor(const std::string& classKey) diff --git a/src/esp/sensor/sensorWrappers/ManagedVisualSensorBase.h b/src/esp/sensor/sensorWrappers/ManagedVisualSensorBase.h index 50e4fc3427..f4aa8c43ec 100644 --- a/src/esp/sensor/sensorWrappers/ManagedVisualSensorBase.h +++ b/src/esp/sensor/sensorWrappers/ManagedVisualSensorBase.h @@ -15,7 +15,7 @@ namespace esp { namespace sensor { /** - * @brief Base class template for wrapper for visual sensor objects of all kinds + * @brief Class template for wrapper for visual sensor objects of all kinds * that extends AbstractManagedSensorAccess */ @@ -51,10 +51,10 @@ class AbstractManagedVisualSensor * separated info ideal for saving to csv */ std::string getSensorObjInfoInternal( - CORRADE_UNUSED std::shared_ptr& sp) const override { + CORRADE_UNUSED std::shared_ptr& sp) const override { // TODO provide info stream for sensors - std::string res = Cr::Utility::formatString( - "{},{}", "VisualSensor", getVisualSensorObjInfoInternal()); + std::string res = + Cr::Utility::formatString("{},", getVisualSensorObjInfoInternal()); return res; }