-
Notifications
You must be signed in to change notification settings - Fork 124
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
base: main
Are you sure you want to change the base?
Conversation
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.
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.
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.
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.