Skip to content

Commit

Permalink
Changed the camera config to include the resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidCapek committed Mar 12, 2024
1 parent 1379a95 commit 0c647b9
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
10 changes: 7 additions & 3 deletions include/ueds_connector/data-types.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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
5 changes: 4 additions & 1 deletion include/ueds_connector/serialization/serializable-shared.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,13 @@ struct CameraConfig
double orientationRoll;

double angleFOV;

int Width;
int Height;

template <class Archive>
void serialize(Archive& archive) {
archive(showDebugCamera, offsetX, offsetY, offsetZ, orientationPitch, orientationYaw, orientationRoll, angleFOV);
archive(showDebugCamera, offsetX, offsetY, offsetZ, orientationPitch, orientationYaw, orientationRoll, angleFOV, Width, Height);
}
};

Expand Down
6 changes: 6 additions & 0 deletions src/ueds_connector/ueds_connector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,9 @@ std::pair<bool, CameraConfig> 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);
Expand All @@ -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);
Expand Down

0 comments on commit 0c647b9

Please sign in to comment.