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

[RSDK-9928] - Add preloaded images to image_file camera #4830

Merged
merged 3 commits into from
Mar 5, 2025

Conversation

hexbabe
Copy link
Member

@hexbabe hexbabe commented Mar 4, 2025

RSDK-9928

This PR makes a new additive non-breaking attribute preloaded_image that is "pizza" | "dog" | "crowd". If specified, it will use the base64 representation of said images in the modified file worlddata.go -> fakedata.go which used to only contain the world asset for the fake camera rtp passthrough stream, but now also includes these preloaded images.

There is validation in Validate to make sure that only "pizza" | "dog" | "crowd" is specified when preloaded_image is given.

Images will also return the specified preloaded image along with other configured filenames.

I also added tests to make sure the camera initializes properly with the field specified and checked outputs of Image and Images

The additional images increases our fake assets from 11kb to 477kb.

Manual testing

pizza dog crowd
MixCollage-05-Mar-2025-10-59-AM-8173

@viambot viambot added the safe to test This pull request is marked safe to test from a trusted zone label Mar 4, 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 Mar 5, 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 Mar 5, 2025
@hexbabe hexbabe changed the title [RSDK-9928] - Add predefined images to image_file camera [RSDK-9928] - Add preloaded images to image_file camera Mar 5, 2025
@hexbabe hexbabe marked this pull request as ready for review March 5, 2025 15:49
@hexbabe hexbabe requested a review from randhid March 5, 2025 16:02
Copy link
Member

@randhid randhid left a comment

Choose a reason for hiding this comment

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

Extra tests:

  • fake camera with rtp passthrough true still shows the world data.
  • image_file camera can reconfigure from preloaded data to image file and back.

"errors"
"fmt"
"image"
"image/png"
Copy link
Member

Choose a reason for hiding this comment

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

Does fake camera use png or jpeg for the worlddata image?

Copy link
Member Author

Choose a reason for hiding this comment

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

fake camera uses jpg

Copy link
Member

Choose a reason for hiding this comment

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

should we use that here? It should lead to a smaller file I think.

Copy link
Member Author

Choose a reason for hiding this comment

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

fake camera with rtp passthrough true still shows the world data. ✅
image_file camera can reconfigure from preloaded data to image file and back. ✅

Copy link
Member Author

Choose a reason for hiding this comment

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

To test ae1d862, I ran my feature branch viam-server and re-tested that the pizza, crowd, and dog render properly on app

verifying the new jpeg decoding works

Copy link
Member Author

Choose a reason for hiding this comment

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

New file is 165kb down from 477kb with png

@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 Mar 5, 2025
@hexbabe hexbabe merged commit e4d85cd into viamrobotics:main Mar 5, 2025
16 checks passed
@hexbabe hexbabe deleted the RSDK-9928 branch March 5, 2025 22:04
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.

3 participants