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-9458] Remove 'Stream' from Camera interface #4691

Open
wants to merge 78 commits into
base: main
Choose a base branch
from

Conversation

randhid
Copy link
Member

@randhid randhid commented Jan 8, 2025

The merge conflicts on Sean's PR will likely be terrible when he gets back in 2.5 weeks, so I'm using this branch to keep it recent.

I also think we're at a point where we can merge. I'm adding the original testing Sean did to the end of this comment.

Requests: @bhaney, could I have a config to test one of the vision services with to ensure DecodeImageFromCamera does not break them?

Original PR + comment

Tests

✅ Test webcam Darwin
✅ Test webcam switch inputs Darwin
✅ Test RTSP with passthrough and without
✅ Test webcam Linux
✅ Test webcam switch inputs Linux
✅ Test transforms (especially test crop + new features) caught a bug
#4635
✅ Test ffmpeg with mediamtx
✅ Test fake
✅ Test image_file
✅ Test OAK-D

hexbabe and others added 30 commits October 24, 2024 14:59
…here we convert to go image; Change default mimetypes for classifier
…ng default mimetypes for vision since we are failing unit tests with 'do not know how to encode' errors
Copy link
Contributor

github-actions bot commented Jan 8, 2025

Warning your change may break code samples. If your change modifies any of the following functions please contact @viamrobotics/fleet-management. Thanks!

component function
base IsMoving
board GPIOPinByName
camera Properties
encoder Properties
motor IsMoving
sensor Readings
servo Position
arm EndPosition
audio MediaProperties
gantry Lengths
gripper IsMoving
input_controller Controls
movement_sensor LinearAcceleration
power_sensor Power
pose_tracker Poses
motion GetPose
vision GetProperties

@viambot viambot added the safe to test This pull request is marked safe to test from a trusted zone label Jan 8, 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 8, 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 8, 2025
@randhid randhid changed the title Sean pr [RSDK-9458] Remove 'Stream' from Camera interface Jan 8, 2025
@randhid randhid marked this pull request as ready for review January 8, 2025 12:56
Comment on lines +133 to +137
// StreamCamera is a camera that has `Stream` embedded to directly integrate with gostream.
// Note that generally, when writing camera components from scratch, embedding `Stream` is an anti-pattern.
type StreamCamera interface {
Camera
Stream(ctx context.Context, errHandlers ...gostream.ErrorHandler) (gostream.VideoStream, error)
Copy link
Member Author

Choose a reason for hiding this comment

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

this is meant to be removed in a follow up pr - affected drivers are transform, ffmpeg, fake, image_file and webcam

@randhid randhid requested a review from dgottlieb January 8, 2025 14:16
Close(ctx context.Context) error
// StreamCamera is a camera that has `Stream` embedded to directly integrate with gostream.
// Note that generally, when writing camera components from scratch, embedding `Stream` is an anti-pattern.
type StreamCamera interface {
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 can rename this to VideoSource - less of a break I think, even if the interface has changed.

That being said - the things that care about this struct still being a video source are set not to use Videsoruces in the (hopefully near) future.

@@ -128,7 +111,8 @@ type Camera interface {
// err = myCamera.Close(context.Background())
//
// [camera component docs]: https://docs.viam.com/components/camera/
type VideoSource interface {
type Camera interface {
Copy link
Member

Choose a reason for hiding this comment

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

There's a lot of files changed here. Am I correct that these changes to VideoSource/Camera/StreamCamera are the only real changes and everything else is the refactor to appease the compiler?

Copy link
Member Author

Choose a reason for hiding this comment

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

Kind of - in the process of deprecating Stream, different methods are being used in vision, and the stream server now takes context to refresh the streams - I can break up this pr into independent pieces and remove some of sean yu's renames to make it smaller, I do think this was the diff that made the most sense for his manual testing.

Copy link
Member Author

@randhid randhid Jan 9, 2025

Choose a reason for hiding this comment

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

The camera driver changes + the new StreamCamera interface (ffmpeg, transformpipeline, webcam) are there to appease the compiler without refactoring those drivers intensely.

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.