Skip to content

Conversation

@hexbabe
Copy link
Member

@hexbabe hexbabe commented Sep 30, 2025

RSDK-11831

DO NOT MERGE until the breaking change to remove GetImage has been stacked on top of this PR and is also ready to merge. We should merge both together when we are ready for the breaking change December 1st.

Manual Testing:

  • Realsense with depth configured primary
  • Realsense with color configured primary

@viambot viambot added the safe to test This pull request is marked safe to test from a trusted zone label Sep 30, 2025
@hexbabe hexbabe marked this pull request as ready for review September 30, 2025 20:49
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Sep 30, 2025
@hexbabe hexbabe changed the title [RSDK-11831] — Make ReadImage call GetImages under the hood RSDK-11831 — Make ReadImage call GetImages under the hood Sep 30, 2025
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Sep 30, 2025
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Oct 1, 2025
Copy link
Member

@dmhilly dmhilly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left two questions! Thanks Sean!

ts := data.Timestamps{
TimeRequested: timeRequested,
TimeReceived: time.Now(),
TimeReceived: resMetadata.CapturedAt,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you remind me why this change?

Copy link
Member Author

@hexbabe hexbabe Oct 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We assume CapturedAt is more accurate than time.Now() because most of the time CapturedAt is from the frame metadata itself from the underlying camera rather than when we receive the GetImages response, which is what time.Now() expresses.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool! Thanks for explaining.

Copy link
Contributor

@SebastianMunozP SebastianMunozP Oct 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we sure the CapturedAt and time.Now() belongs to the same time frame or reference?

Copy link
Member Author

@hexbabe hexbabe Dec 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CapturedAt, we can assume, does, since it comes from the same resp

return res, data.NewFailedToReadError(params.ComponentName, readImage.String(), err)
}

// Select the corresponding image based on requested mime type if provided
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Since the requested mime type was already an argument before, I'm curious if this is how it worked previously, or is this new behavior?

Copy link
Member Author

@hexbabe hexbabe Oct 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is new behavior since previously we would be calling GetImage and letting the implementer of GetImage handle the mime type however it wants. Now, we are returning the requested mime type iff we find it in the GetImages response.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realized this is better than always defaulting to images[0] as we discussed on Slack

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense! This SGTM.

@hexbabe hexbabe requested a review from dmhilly October 2, 2025 18:53
Copy link
Member

@dmhilly dmhilly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks Sean :)

return res, data.NewFailedToReadError(params.ComponentName, readImage.String(), err)
}

// Select the corresponding image based on requested mime type if provided
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense! This SGTM.

ts := data.Timestamps{
TimeRequested: timeRequested,
TimeReceived: time.Now(),
TimeReceived: resMetadata.CapturedAt,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool! Thanks for explaining.

return res, data.NewFailedToReadError(params.ComponentName, readImage.String(), err)
}

mimeType := data.MimeTypeStringToMimeType(img.MimeType())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we verify that this mimeType is valid before using it later?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MimeTypeStringToMimeType returns on an enum, which only contains "valid" values IMO. What kind of verification are you suggesting?

Copy link
Member

@seanavery seanavery left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Wondering if we should also rename the collector from ReadImage->GetImages, but this could be a follow-up.

Are there any plans to actually extend the collector to handle multiple image returns?

@hexbabe
Copy link
Member Author

hexbabe commented Dec 16, 2025

LGTM

Wondering if we should also rename the collector from ReadImage->GetImages, but this could be a follow-up.

Are there any plans to actually extend the collector to handle multiple image returns?

I think there exists a GetImages collector already. Next steps are: https://viam.atlassian.net/browse/RSDK-11721, then https://viam.atlassian.net/browse/RSDK-11734

@viambot viambot removed the safe to test This pull request is marked safe to test from a trusted zone label Dec 16, 2025
@hexbabe hexbabe requested a review from tahiyasalam December 16, 2025 17:36
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Dec 16, 2025
@viambot viambot added the safe to test This pull request is marked safe to test from a trusted zone label Dec 17, 2025
Copy link
Member

@oliviamiller oliviamiller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Dec 31, 2025
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Jan 2, 2026
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Jan 2, 2026
@hexbabe hexbabe merged commit 75b65ff into viamrobotics:main Jan 5, 2026
19 checks passed
@hexbabe hexbabe deleted the RSDK-11831 branch January 5, 2026 15:09
@hexbabe hexbabe restored the RSDK-11831 branch January 5, 2026 15:09
@hexbabe hexbabe deleted the RSDK-11831 branch January 5, 2026 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe to test This pull request is marked safe to test from a trusted zone

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants