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 Go camera interface #4580

Open
wants to merge 74 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
a643d22
Init craziness
hexbabe Oct 24, 2024
41cb592
Use camera pkg scoped ReadImage in webcam
hexbabe Oct 25, 2024
f6e3d69
Merge branch 'main' into RSDK-9132
hexbabe Nov 4, 2024
d6439dd
Use agreed upon Image signature
hexbabe Nov 6, 2024
6417a56
Merge branch 'main' into RSDK-9132
hexbabe Nov 6, 2024
59c36ec
Fix tests
hexbabe Nov 6, 2024
16079fa
Delete ReadImager and fix mimetype formatting in data collector
hexbabe Nov 6, 2024
9084264
Fix up obstacle depth; Delete custom extra type;
hexbabe Nov 7, 2024
c44afa2
Update video source comment spec; Add helper to DRY up .Image calls w…
hexbabe Nov 7, 2024
11b1d7d
Fix obstacle depth mimetype (it needs it for re-encode since we can't…
hexbabe Nov 7, 2024
438d550
Add image metadata replacing mimetype return; Add back non empty stri…
hexbabe Nov 7, 2024
0d8081b
Forgot to include mimetype in test resp oops
hexbabe Nov 7, 2024
824c30f
Add width and height to ImageMetadata struct
hexbabe Nov 8, 2024
e744b68
Use GetGoImage in camera client Stream
hexbabe Nov 8, 2024
fd50881
Remove jpeg default in vision
hexbabe Nov 11, 2024
e570393
Revert detections, classifications, and capture all's image call to R…
hexbabe Nov 11, 2024
6646d78
Don't modify vision at all
hexbabe Nov 12, 2024
612e91c
Remove width and height from ImageMetadata; DRY up webcam and videoso…
hexbabe Nov 12, 2024
9029a05
Move ReadImageBytes to videosourcewrappers
hexbabe Nov 13, 2024
6ec0041
Rename GetGoImage -> ImageFromVideoSource
hexbabe Nov 13, 2024
ef1bd0e
Make lint
hexbabe Nov 13, 2024
d01159a
Move mimetype unmarshaling outside of capture func
hexbabe Nov 13, 2024
44611d5
Update components/camera/client.go
hexbabe Nov 13, 2024
146345f
Add error for empty bytes responses in server & client
hexbabe Nov 14, 2024
c698e16
Add empty image bytes tests
hexbabe Nov 14, 2024
9da582f
Fix random things that I am doing wrong
hexbabe Nov 14, 2024
1b51109
Revert
hexbabe Nov 14, 2024
eaf28d7
RSDK-9218: Change all of the artifacts to v4. (#4535)
dgottlieb Nov 6, 2024
4fe7e36
RSDK-8359: Update smarty to avoid unnecessary data races. (#4534)
dgottlieb Nov 6, 2024
b4e1960
RSDK-8819: Implement FTDC file rotation. (#4510)
dgottlieb Nov 6, 2024
fc6665d
APP-6785: Remove local control page - remove web workflows (#4523)
ethanlookpotts Nov 7, 2024
8afb714
APP-6850 update android build for go 1.23 (#4539)
abe-winter Nov 8, 2024
375a35f
RSDK-8611: Have test make a tls config copy to avoid concurrent acces…
dgottlieb Nov 8, 2024
5bf744c
RSDK-8837: Remove the short timeout for testing reconnects that are e…
dgottlieb Nov 8, 2024
2a1cd8b
make errors reported during discovery (#4546)
erh Nov 9, 2024
1233170
Update gripper.go (#4540)
npentrel Nov 11, 2024
95f3f42
RSDK-9090 clarify package cleanup (#4542)
maximpertsov Nov 11, 2024
b208d2c
RSDK-9240: Remove github action code coverage stuff we do not use. (#…
dgottlieb Nov 11, 2024
0b85975
[Data-3312] add basic data capture support for capturing tabular data…
nicksanford Nov 11, 2024
c44454b
RSDK-9136: issues when stopping motor with controls (#4550)
martha-johnston Nov 12, 2024
d848d20
RSDK-9037: Add AttachDirectionalAwareness to DoCommand (#4552)
martha-johnston Nov 13, 2024
09e295c
RSDK-8767 - populate local_name and remote_path to all resource names…
Kschappacher Nov 13, 2024
3edf860
APP-6696 include `os_version` tag on GOOS=darwin (#4536)
abe-winter Nov 13, 2024
b7c4635
RSDK-8926: Rover canary motor test fail because failure to set pins (…
martha-johnston Nov 14, 2024
63b7681
[DATA-3338] - collector test improvements (#4551)
nicksanford Nov 14, 2024
c91b68d
Merge branch 'main' into RSDK-9132
hexbabe Nov 14, 2024
d63980e
Fix new collector tests
hexbabe Nov 14, 2024
6ffbae2
Change image.Image getter wrapper to take in a camera resource not a …
hexbabe Nov 14, 2024
65b5bad
Merge branch 'viamrobotics:main' into RSDK-9132
hexbabe Nov 14, 2024
9a9612f
If err, then bytes and metadata should be falsy
hexbabe Nov 14, 2024
ab7e736
Use imgbuf bytes directly for a robot client test rather than encode …
hexbabe Nov 14, 2024
8244dfd
Add back ReadImage/Stream tests where it makes sense
hexbabe Nov 15, 2024
5feb0ed
Getting started with the refactor
hexbabe Nov 20, 2024
5c0191d
Remove debugging crap
hexbabe Nov 22, 2024
a1fcc2f
Fix videosourcewrappers
hexbabe Nov 25, 2024
859d027
Merge branch 'main' into RSDK-9132-beta-timeline
hexbabe Dec 3, 2024
de2cb6a
Try to remove Stream
hexbabe Dec 3, 2024
21fe63a
Merge branch 'main' into RSDK-9132-beta-timeline
hexbabe Dec 3, 2024
2fdabbf
Make lint
hexbabe Dec 3, 2024
f3e9fd5
Align comments
hexbabe Dec 4, 2024
b27c121
Merge branch 'main' into RSDK-9132-beta-timeline
hexbabe Dec 4, 2024
4a8ad4a
Delete some Stream documentations; Default to jpeg encoding in webcam…
hexbabe Dec 4, 2024
5ecc6ed
Change streamcamera comment; Add more exclamation points; Change came…
hexbabe Dec 4, 2024
7815d22
Merge branch 'main' into RSDK-9132-beta-timeline
hexbabe Dec 16, 2024
7283fef
Merge branch 'main' into RSDK-9132-beta-timeline
hexbabe Dec 16, 2024
58fce9c
Add some more docstrings; use camerautils
hexbabe Dec 16, 2024
0b08026
Fix ffmpeg stream
hexbabe Dec 17, 2024
728d547
Make change to video source wrapper instead of ffmpeg to fix image_fi…
hexbabe Dec 17, 2024
4c4b53c
DATA-3445 Implement Go SDK for ExportTabularData API (#4633)
vijayvuyyuru Dec 16, 2024
96fcdb5
RSDK-8471 Add three-dot diff to git diff (#4636)
biotinker Dec 17, 2024
cd7e4c2
RSDK-9423: non interactive module generation (#4617)
purplenicole730 Dec 17, 2024
d9b0136
RSDK-9423: Revert flag name change (#4638)
purplenicole730 Dec 17, 2024
4aef8b1
Merge branch 'main' into RSDK-9132-beta-timeline
hexbabe Dec 17, 2024
7f47f80
Rename import tot camerautils
hexbabe Dec 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 8 additions & 24 deletions components/camera/camera.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,6 @@ type ImageMetadata struct {
}

// A Camera is a resource that can capture frames.
type Camera interface {
resource.Resource
VideoSource
}

// VideoSource represents anything that can capture frames.
// For more information, see the [camera component docs].
//
// Image example:
Expand All @@ -102,17 +96,6 @@ type Camera interface {
//
// images, metadata, err := myCamera.Images(context.Background())
//
// Stream example:
//
// myCamera, err := camera.FromRobot(machine, "my_camera")
//
// // gets the stream from a camera
// stream, err := myCamera.Stream(context.Background())
//
// // gets an image from the camera stream
// img, release, err := stream.Next(context.Background())
// defer release()
//
// NextPointCloud example:
//
// myCamera, err := camera.FromRobot(machine, "my_camera")
Expand All @@ -127,7 +110,8 @@ type Camera interface {
// err = myCamera.Close(context.Background())
//
// [camera component docs]: https://docs.viam.com/components/camera/
type VideoSource interface {
type Camera interface {
resource.Resource
// Image returns a byte slice representing an image that tries to adhere to the MIME type hint.
// Image also may return metadata about the frame.
Image(ctx context.Context, mimeType string, extra map[string]interface{}) ([]byte, ImageMetadata, error)
Expand All @@ -136,20 +120,20 @@ type VideoSource interface {
// along with associated metadata (just timestamp for now). It's not for getting a time series of images from the same imager.
Images(ctx context.Context) ([]NamedImage, resource.ResponseMetadata, error)

// Stream returns a stream that makes a best effort to return consecutive images
// that may have a MIME type hint dictated in the context via gostream.WithMIMETypeHint.
Stream(ctx context.Context, errHandlers ...gostream.ErrorHandler) (gostream.VideoStream, error)

// NextPointCloud returns the next immediately available point cloud, not necessarily one
// a part of a sequence. In the future, there could be streaming of point clouds.
NextPointCloud(ctx context.Context) (pointcloud.PointCloud, error)

// Properties returns properties that are intrinsic to the particular
// implementation of a camera.
Properties(ctx context.Context) (Properties, error)
}

// Close shuts down the resource and prevents further use.
Close(ctx context.Context) error
// StreamCamera is a camera that has `Stream` embedded to directly integrate with gostream.
Copy link
Member Author

@hexbabe hexbabe Dec 18, 2024

Choose a reason for hiding this comment

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

I want to delete this asap, but it's necessary for preserving some of the builtins e.g. transform

Could make follow-up tickets to refactor all the builtins to use Image and yeet transform pipeline and modularize all the nodes.

// 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)
}

// ReadImage reads an image from the given source that is immediately available.
Expand Down
77 changes: 0 additions & 77 deletions components/camera/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ func TestClient(t *testing.T) {
test.That(t, err, test.ShouldBeNil)
camera1Client, err := camera.NewClientFromConn(context.Background(), conn, "", camera.Named(testCameraName), logger)
test.That(t, err, test.ShouldBeNil)

frame, err := camera.DecodeImageFromCamera(context.Background(), rutils.MimeTypeRawRGBA, nil, camera1Client)
test.That(t, err, test.ShouldBeNil)
compVal, _, err := rimage.CompareImages(img, frame)
Expand Down Expand Up @@ -245,10 +244,6 @@ func TestClient(t *testing.T) {
client2, err := resourceAPI.RPCClient(context.Background(), conn, "", camera.Named(failCameraName), logger)
test.That(t, err, test.ShouldBeNil)

_, _, err = camera.ReadImage(context.Background(), client2)
test.That(t, err, test.ShouldNotBeNil)
test.That(t, err.Error(), test.ShouldContainSubstring, errGetImageFailed.Error())

_, _, err = client2.Image(context.Background(), "", nil)
test.That(t, err, test.ShouldNotBeNil)
test.That(t, err.Error(), test.ShouldContainSubstring, errGetImageFailed.Error())
Expand Down Expand Up @@ -547,78 +542,6 @@ func TestClientWithInterceptor(t *testing.T) {
test.That(t, conn.Close(), test.ShouldBeNil)
}

func TestClientStreamAfterClose(t *testing.T) {
// Set up gRPC server
logger := logging.NewTestLogger(t)
listener, err := net.Listen("tcp", "localhost:0")
test.That(t, err, test.ShouldBeNil)
rpcServer, err := rpc.NewServer(logger, rpc.WithUnauthenticated())
test.That(t, err, test.ShouldBeNil)

// Set up camera that can stream images
img := image.NewNRGBA(image.Rect(0, 0, 4, 4))
injectCamera := &inject.Camera{}
injectCamera.PropertiesFunc = func(ctx context.Context) (camera.Properties, error) {
return camera.Properties{}, nil
}
injectCamera.ImageFunc = func(ctx context.Context, mimeType string, extra map[string]interface{}) ([]byte, camera.ImageMetadata, error) {
imgBytes, err := rimage.EncodeImage(ctx, img, mimeType)
test.That(t, err, test.ShouldBeNil)
return imgBytes, camera.ImageMetadata{MimeType: mimeType}, nil
}

// Register CameraService API in our gRPC server.
resources := map[resource.Name]camera.Camera{
camera.Named(testCameraName): injectCamera,
}
cameraSvc, err := resource.NewAPIResourceCollection(camera.API, resources)
test.That(t, err, test.ShouldBeNil)
resourceAPI, ok, err := resource.LookupAPIRegistration[camera.Camera](camera.API)
test.That(t, err, test.ShouldBeNil)
test.That(t, ok, test.ShouldBeTrue)
test.That(t, resourceAPI.RegisterRPCService(context.Background(), rpcServer, cameraSvc), test.ShouldBeNil)

// Start serving requests.
go rpcServer.Serve(listener)
defer rpcServer.Stop()

// Make client connection
conn, err := viamgrpc.Dial(context.Background(), listener.Addr().String(), logger)
test.That(t, err, test.ShouldBeNil)
client, err := camera.NewClientFromConn(context.Background(), conn, "", camera.Named(testCameraName), logger)
test.That(t, err, test.ShouldBeNil)

// Get a stream
stream, err := client.Stream(context.Background())
test.That(t, stream, test.ShouldNotBeNil)
test.That(t, err, test.ShouldBeNil)

// Read from stream
media, _, err := stream.Next(context.Background())
test.That(t, media, test.ShouldNotBeNil)
test.That(t, err, test.ShouldBeNil)

// Close client and read from stream
test.That(t, client.Close(context.Background()), test.ShouldBeNil)
media, _, err = stream.Next(context.Background())
test.That(t, media, test.ShouldBeNil)
test.That(t, err.Error(), test.ShouldContainSubstring, "context canceled")

// Get a new stream
stream, err = client.Stream(context.Background())
test.That(t, stream, test.ShouldNotBeNil)
test.That(t, err, test.ShouldBeNil)

// Read from the new stream
media, _, err = stream.Next(context.Background())
test.That(t, media, test.ShouldNotBeNil)
test.That(t, err, test.ShouldBeNil)

// Close client and connection
test.That(t, client.Close(context.Background()), test.ShouldBeNil)
test.That(t, conn.Close(), test.ShouldBeNil)
}

// See modmanager_test.go for the happy path (aka, when the
// client has a webrtc connection).
func TestRTPPassthroughWithoutWebRTC(t *testing.T) {
Expand Down
3 changes: 1 addition & 2 deletions components/camera/ffmpeg/ffmpeg.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ func init() {
}

type ffmpegCamera struct {
resource.Named
gostream.VideoReader
cancelFunc context.CancelFunc
activeBackgroundWorkers sync.WaitGroup
Expand All @@ -92,7 +91,7 @@ func (writer stderrWriter) Write(p []byte) (n int, err error) {
}

// NewFFMPEGCamera instantiates a new camera which leverages ffmpeg to handle a variety of potential video types.
func NewFFMPEGCamera(ctx context.Context, conf *Config, logger logging.Logger) (camera.VideoSource, error) {
func NewFFMPEGCamera(ctx context.Context, conf *Config, logger logging.Logger) (camera.StreamCamera, error) {
// make sure ffmpeg is in the path before doing anything else
if _, err := exec.LookPath("ffmpeg"); err != nil {
return nil, err
Expand Down
3 changes: 2 additions & 1 deletion components/camera/ffmpeg/ffmpeg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"go.viam.com/test"
"go.viam.com/utils/artifact"

"go.viam.com/rdk/components/camera"
"go.viam.com/rdk/logging"
"go.viam.com/rdk/utils"
)
Expand All @@ -20,7 +21,7 @@ func TestFFMPEGCamera(t *testing.T) {
test.That(t, err, test.ShouldBeNil)
test.That(t, err, test.ShouldBeNil)
for i := 0; i < 5; i++ {
_, _, err = cam.Image(ctx, utils.MimeTypeJPEG, nil)
_, err = camera.DecodeImageFromCamera(ctx, utils.MimeTypeJPEG, nil, cam)
test.That(t, err, test.ShouldBeNil)
}
test.That(t, cam.Close(context.Background()), test.ShouldBeNil)
Expand Down
5 changes: 0 additions & 5 deletions components/camera/replaypcd/replaypcd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -660,11 +660,6 @@ func TestReplayPCDUnimplementedFunctions(t *testing.T) {
replayCamera, _, serverClose, err := createNewReplayPCDCamera(ctx, t, replayCamCfg, true)
test.That(t, err, test.ShouldBeNil)

t.Run("Stream", func(t *testing.T) {
_, err := replayCamera.Stream(ctx, nil)
test.That(t, err.Error(), test.ShouldEqual, "Stream is unimplemented")
})

err = replayCamera.Close(ctx)
test.That(t, err, test.ShouldBeNil)

Expand Down
6 changes: 5 additions & 1 deletion components/camera/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ type serviceServer struct {
func NewRPCServiceServer(coll resource.APIResourceCollection[Camera]) interface{} {
logger := logging.NewLogger("camserver")
imgTypes := make(map[string]ImageType)
return &serviceServer{coll: coll, logger: logger, imgTypes: imgTypes}
return &serviceServer{
coll: coll,
logger: logger,
imgTypes: imgTypes,
}
}

// GetImage returns an image from a camera of the underlying robot. If a specific MIME type
Expand Down
6 changes: 3 additions & 3 deletions components/camera/transformpipeline/classifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ type classifierConfig struct {

// classifierSource takes an image from the camera, and overlays labels from the classifier.
type classifierSource struct {
src camera.VideoSource
src camera.StreamCamera
classifierName string
maxClassifications uint32
labelFilter classification.Postprocessor
Expand All @@ -37,8 +37,8 @@ type classifierSource struct {

func newClassificationsTransform(
ctx context.Context,
source camera.VideoSource, r robot.Robot, am utils.AttributeMap,
) (camera.VideoSource, camera.ImageType, error) {
source camera.StreamCamera, r robot.Robot, am utils.AttributeMap,
) (camera.StreamCamera, camera.ImageType, error) {
conf, err := resource.TransformAttributeMap[*classifierConfig](am)
if err != nil {
return nil, camera.UnspecifiedStream, err
Expand Down
5 changes: 3 additions & 2 deletions components/camera/transformpipeline/classifier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ func buildRobotWithClassifier(logger logging.Logger) (robot.Robot, error) {
return r, nil
}

//nolint:dupl
func TestClassifierSource(t *testing.T) {
logger := logging.NewTestLogger(t)
ctx, cancel := context.WithCancel(context.Background())
Expand All @@ -99,7 +98,9 @@ func TestClassifierSource(t *testing.T) {
test.That(t, err, test.ShouldBeNil)
defer classifier.Close(ctx)

resImg, _, err := camera.ReadImage(ctx, classifier)
streamClassifier, ok := classifier.(camera.StreamCamera)
test.That(t, ok, test.ShouldBeTrue)
resImg, _, err := camera.ReadImage(ctx, streamClassifier)
test.That(t, err, test.ShouldBeNil)
ovImg := rimage.ConvertImage(resImg)

Expand Down
25 changes: 11 additions & 14 deletions components/camera/transformpipeline/composed.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,25 @@ import (
// depthToPretty takes a depth image and turns into a colorful image, with blue being
// farther away, and red being closest. Actual depth information is lost in the transform.
type depthToPretty struct {
src camera.VideoSource
src camera.StreamCamera
cameraModel *transform.PinholeCameraModel
}

func propsFromVideoSource(ctx context.Context, source camera.VideoSource) (camera.Properties, error) {
func propsFromVideoSource(ctx context.Context, source camera.Camera) (camera.Properties, error) {
var camProps camera.Properties

if cameraSrc, ok := source.(camera.Camera); ok {
props, err := cameraSrc.Properties(ctx)
if err != nil {
return camProps, err
}
camProps = props
props, err := source.Properties(ctx)
if err != nil {
return camProps, err
}
camProps = props
return camProps, nil
}

func newDepthToPrettyTransform(
ctx context.Context,
source camera.VideoSource,
source camera.StreamCamera,
stream camera.ImageType,
) (camera.VideoSource, camera.ImageType, error) {
) (camera.StreamCamera, camera.ImageType, error) {
if stream != camera.DepthStream {
return nil, camera.UnspecifiedStream,
errors.Errorf("source has stream type %s, depth_to_pretty only supports depth stream inputs", stream)
Expand Down Expand Up @@ -109,16 +106,16 @@ type overlayConfig struct {

// overlaySource overlays the depth and color 2D images in order to debug the alignment of the two images.
type overlaySource struct {
src camera.VideoSource
src camera.StreamCamera
cameraModel *transform.PinholeCameraModel
}

func newOverlayTransform(
ctx context.Context,
src camera.VideoSource,
src camera.StreamCamera,
stream camera.ImageType,
am utils.AttributeMap,
) (camera.VideoSource, camera.ImageType, error) {
) (camera.StreamCamera, camera.ImageType, error) {
conf, err := resource.TransformAttributeMap[*overlayConfig](am)
if err != nil {
return nil, camera.UnspecifiedStream, err
Expand Down
13 changes: 7 additions & 6 deletions components/camera/transformpipeline/composed_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,22 +63,23 @@ func TestComposed(t *testing.T) {
test.That(t, err, test.ShouldBeNil)
test.That(t, pc.Size(), test.ShouldEqual, 1)

myOverlay, stream, err := newOverlayTransform(context.Background(), cloudSource, camera.ColorStream, am)
streamedCloudSource := streamCameraFromCamera(context.Background(), cloudSource)
myOverlay, stream, err := newOverlayTransform(context.Background(), streamedCloudSource, camera.ColorStream, am)
test.That(t, err, test.ShouldBeNil)
test.That(t, stream, test.ShouldEqual, camera.ColorStream)
pic, _, err := camera.ReadImage(context.Background(), myOverlay)
test.That(t, err, test.ShouldBeNil)
test.That(t, pic.Bounds(), test.ShouldResemble, image.Rect(0, 0, 1280, 720))

myPipeline, err := newTransformPipeline(context.Background(), cloudSource, conf, robot, logger)
myPipeline, err := newTransformPipeline(context.Background(), streamedCloudSource, nil, conf, robot, logger)
test.That(t, err, test.ShouldBeNil)
defer myPipeline.Close(context.Background())
pic, _, err = camera.ReadImage(context.Background(), myPipeline)
pic, err = camera.DecodeImageFromCamera(context.Background(), utils.MimeTypeJPEG, nil, myPipeline)
test.That(t, err, test.ShouldBeNil)
test.That(t, pic.Bounds(), test.ShouldResemble, image.Rect(0, 0, 1280, 720))

// wrong result with bad config
_, _, err = newOverlayTransform(context.Background(), cloudSource, camera.ColorStream, utils.AttributeMap{})
_, _, err = newOverlayTransform(context.Background(), streamedCloudSource, camera.ColorStream, utils.AttributeMap{})
test.That(t, err, test.ShouldNotBeNil)
test.That(t, err, test.ShouldWrap, transform.ErrNoIntrinsics)
// wrong config, still no intrinsics
Expand All @@ -88,7 +89,7 @@ func TestComposed(t *testing.T) {
Height: 720,
},
}
_, _, err = newOverlayTransform(context.Background(), cloudSource, camera.ColorStream, am)
_, _, err = newOverlayTransform(context.Background(), streamedCloudSource, camera.ColorStream, am)
test.That(t, err, test.ShouldNotBeNil)
test.That(t, err, test.ShouldWrap, transform.ErrNoIntrinsics)
// wrong config, no attributes
Expand All @@ -99,7 +100,7 @@ func TestComposed(t *testing.T) {
},
},
}
_, err = newTransformPipeline(context.Background(), cloudSource, conf, robot, logger)
_, err = newTransformPipeline(context.Background(), streamedCloudSource, nil, conf, robot, logger)
test.That(t, err, test.ShouldNotBeNil)
test.That(t, err, test.ShouldWrap, transform.ErrNoIntrinsics)
}
6 changes: 3 additions & 3 deletions components/camera/transformpipeline/depth_edges.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ type depthEdgesConfig struct {

// depthEdgesSource applies a Canny Edge Detector to the depth map.
type depthEdgesSource struct {
src camera.VideoSource
src camera.StreamCamera
detector *rimage.CannyEdgeDetector
blurRadius float64
}

func newDepthEdgesTransform(ctx context.Context, source camera.VideoSource, am utils.AttributeMap,
) (camera.VideoSource, camera.ImageType, error) {
func newDepthEdgesTransform(ctx context.Context, source camera.StreamCamera, am utils.AttributeMap,
) (camera.StreamCamera, camera.ImageType, error) {
conf, err := resource.TransformAttributeMap[*depthEdgesConfig](am)
if err != nil {
return nil, camera.UnspecifiedStream, err
Expand Down
Loading
Loading