Skip to content

Commit

Permalink
camera: don't forget to set component ID
Browse files Browse the repository at this point in the history
  • Loading branch information
julianoes committed Nov 20, 2024
1 parent e973599 commit 870fde4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/mavsdk/plugins/camera/camera_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<char*>(camera_information.vendor_name);
new_information.model_name = reinterpret_cast<char*>(camera_information.model_name);
new_information.focal_length_mm = camera_information.focal_length;
Expand All @@ -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;
Expand Down

0 comments on commit 870fde4

Please sign in to comment.