From 870fde4c96eb265b57fe1e4cd4df8cf4eb09a966 Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Wed, 13 Nov 2024 11:48:14 +1300 Subject: [PATCH] camera: don't forget to set component ID --- src/mavsdk/plugins/camera/camera_impl.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/mavsdk/plugins/camera/camera_impl.cpp b/src/mavsdk/plugins/camera/camera_impl.cpp index 1357d379b..8845a4420 100644 --- a/src/mavsdk/plugins/camera/camera_impl.cpp +++ b/src/mavsdk/plugins/camera/camera_impl.cpp @@ -1252,6 +1252,8 @@ void CameraImpl::process_camera_information(const mavlink_message_t& message) camera_information.cam_definition_uri[sizeof(camera_information.cam_definition_uri) - 1] = '\0'; Camera::Information new_information{}; + // TODO: Check the case for 1-6. + new_information.component_id = message.compid; new_information.vendor_name = reinterpret_cast(camera_information.vendor_name); new_information.model_name = reinterpret_cast(camera_information.model_name); new_information.focal_length_mm = camera_information.focal_length; @@ -1268,13 +1270,12 @@ void CameraImpl::process_camera_information(const mavlink_message_t& message) }); if (potential_camera == _potential_cameras.end()) { - auto new_potential_camera = PotentialCamera(message.compid); - _potential_cameras.emplace_back(std::move(new_potential_camera)); + _potential_cameras.emplace_back(message.compid); potential_camera = std::prev(_potential_cameras.end()); } // We need a copy of the component ID inside the information. - new_information.component_id = potential_camera->component_id; + potential_camera->component_id = new_information.component_id; potential_camera->maybe_information = new_information; potential_camera->camera_definition_url = camera_information.cam_definition_uri; potential_camera->camera_definition_version = camera_information.cam_definition_version;