Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Camera Promises and Futures #135

Merged
merged 11 commits into from
Sep 28, 2023
Merged

Camera Promises and Futures #135

merged 11 commits into from
Sep 28, 2023

Conversation

ClayJay3
Copy link
Collaborator

  • All cameras will now use future for some methods where fast and parallelized copying is critical.
  • Camera Examples have been cleaned up.
  • Camera method names have been renamed to be more accurate.

To retrieve a copy of a frame or piece of data from the camera:

  • Locally create the data type you will be retrieving
  • Call the camera's request method pertaining to the data you want to get a copy of
  • Call the get() of the returned std::future. This will be true or false depending on if the copy was successful.
  • The data type you locally created now contains the data you requested and can be used normally.
  • The same data type can be reused on the next iteration. You do not have to create a new variable every iteration.

Example use:

// Get reference to camera.
BasicCam* TestCamera1 = g_pCameraHandler->GetBasicCam(CameraHandlerThread::eHeadLeftArucoEye);
// Declare mats to store images in.
cv::Mat cvNormalFrame1;

// Loop forever.
while (true)
{
    // Grab normal frame from camera.
    std::future<bool> fuCopyStatus1 = TestCamera1->RequestFrameCopy(cvNormalFrame1);

    // Wait for copy to complete and check if it was successful.
    if(fuCopyStatus1.get())
    {
        // Display frame.
        cv::imshow("BasicCamExample Frame1", cvNormalFrame1);
    }
}

Other Changes

.clang-format has been changed to break up long string literals if they exceed the 170 character mark.

Closes #134

@ClayJay3 ClayJay3 added enhancement Requests for new features or improvements to existing features. 5-Star Indicates a very difficult task, suitable for experts or those with extensive experience, requiring formatting Issues related to code formatting, style enforcement, or linting tasks. cleanup Code refactoring or cleanup tasks to remove deprecated features, improve clarity, or ensure code qua cameras Tasks or issues specifically related to camera components, feeds, or image processing. labels Sep 28, 2023
@ClayJay3 ClayJay3 added this to the URC 2024 - Sprint 1 milestone Sep 28, 2023
@ClayJay3 ClayJay3 self-assigned this Sep 28, 2023
@ClayJay3 ClayJay3 requested a review from a team as a code owner September 28, 2023 01:09
@ClayJay3 ClayJay3 merged commit b3aa0e6 into development Sep 28, 2023
@ClayJay3 ClayJay3 deleted the topic/camera-futures branch September 28, 2023 01:30
MRDT-Software pushed a commit that referenced this pull request May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5-Star Indicates a very difficult task, suitable for experts or those with extensive experience, requiring cameras Tasks or issues specifically related to camera components, feeds, or image processing. cleanup Code refactoring or cleanup tasks to remove deprecated features, improve clarity, or ensure code qua enhancement Requests for new features or improvements to existing features. formatting Issues related to code formatting, style enforcement, or linting tasks.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Change return type of some ZEDCam methods to be an std::future
2 participants