From 2f8c5b774a1373ee7c570f91b057bac329fb10df 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 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/mavsdk/plugins/camera/camera_impl.cpp b/src/mavsdk/plugins/camera/camera_impl.cpp index 1357d379b..ca61b205d 100644 --- a/src/mavsdk/plugins/camera/camera_impl.cpp +++ b/src/mavsdk/plugins/camera/camera_impl.cpp @@ -971,8 +971,7 @@ void CameraImpl::process_heartbeat(const mavlink_message_t& message) }); if (!found) { - auto new_potential_camera = PotentialCamera(message.compid); - _potential_cameras.emplace_back(std::move(new_potential_camera)); + _potential_cameras.emplace_back(message.compid); check_potential_cameras_with_lock(); } } @@ -1252,6 +1251,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 +1269,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;