-
Notifications
You must be signed in to change notification settings - Fork 126
RSDK-11831 — Make ReadImage call GetImages under the hood #5337
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
Conversation
dmhilly
left a comment
There was a problem hiding this 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, |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool! Thanks for explaining.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense! This SGTM.
dmhilly
left a comment
There was a problem hiding this 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 |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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()) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
There was a problem hiding this 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?
I think there exists a |
oliviamiller
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
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: