From 0c647b93b1f4c5c079ab7a7e2846e52e9042fb42 Mon Sep 17 00:00:00 2001 From: David Date: Wed, 13 Mar 2024 00:32:12 +0100 Subject: [PATCH] Changed the camera config to include the resolution --- include/ueds_connector/data-types.h | 10 +++++++--- .../ueds_connector/serialization/serializable-shared.h | 5 ++++- src/ueds_connector/ueds_connector.cpp | 6 ++++++ 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/include/ueds_connector/data-types.h b/include/ueds_connector/data-types.h index d2eff6d..b1faf16 100644 --- a/include/ueds_connector/data-types.h +++ b/include/ueds_connector/data-types.h @@ -103,8 +103,8 @@ enum CameraCaptureModeEnum : unsigned short { struct CameraConfig { CameraConfig() = default; - CameraConfig(bool showDebugCamera, double angleFov, const Coordinates offset, const Rotation orientation) - : showDebugCamera(showDebugCamera), angleFOV(angleFov), offset(offset), orientation(orientation) {} + CameraConfig(bool showDebugCamera, double angleFov, const Coordinates offset, const Rotation orientation, int Width, int Height) + : showDebugCamera(showDebugCamera), angleFOV(angleFov), offset(offset), orientation(orientation), Width(Width), Height(Height) {} bool showDebugCamera; @@ -113,10 +113,14 @@ struct CameraConfig { Coordinates offset; Rotation orientation; + + int Width; + + int Height; std::string toString() const { return "(showDebugCamera: " + std::to_string(showDebugCamera) + ", angleFOV: " + std::to_string(angleFOV) + - ", offset: " + offset.toString() + ", directionZ: " + orientation.toString() + ")"; + ", offset: " + offset.toString() + ", directionZ: " + orientation.toString() + ", Width: " + std::to_string(Width) + ", Height: " + std::to_string(Height) + ")"; } }; } // namespace ueds_connector diff --git a/include/ueds_connector/serialization/serializable-shared.h b/include/ueds_connector/serialization/serializable-shared.h index 6b4ac01..57e1a49 100644 --- a/include/ueds_connector/serialization/serializable-shared.h +++ b/include/ueds_connector/serialization/serializable-shared.h @@ -114,10 +114,13 @@ struct CameraConfig double orientationRoll; double angleFOV; + + int Width; + int Height; template void serialize(Archive& archive) { - archive(showDebugCamera, offsetX, offsetY, offsetZ, orientationPitch, orientationYaw, orientationRoll, angleFOV); + archive(showDebugCamera, offsetX, offsetY, offsetZ, orientationPitch, orientationYaw, orientationRoll, angleFOV, Width, Height); } }; diff --git a/src/ueds_connector/ueds_connector.cpp b/src/ueds_connector/ueds_connector.cpp index 16152d3..79d7f52 100644 --- a/src/ueds_connector/ueds_connector.cpp +++ b/src/ueds_connector/ueds_connector.cpp @@ -364,6 +364,9 @@ std::pair UedsConnector::GetCameraConfig() { config.offset = Coordinates{response.config.offsetX, response.config.offsetY, response.config.offsetZ}; config.orientation = Rotation{response.config.orientationPitch, response.config.orientationYaw, response.config.orientationRoll}; + + config.Width = response.config.Width; + config.Height = response.config.Height; } return std::make_pair(success, config); @@ -390,6 +393,9 @@ bool UedsConnector::SetCameraConfig(const CameraConfig& config) { request.config.orientationYaw = config.orientation.yaw; request.config.orientationRoll = config.orientation.roll; + request.config.Width = config.Width; + request.config.Height = config.Height; + Serializable::Drone::SetCameraConfig::Response response{}; const auto status = Request(request, response);