diff --git a/components/arm/arm.go b/components/arm/arm.go index 2217712404c..1359b44feca 100644 --- a/components/arm/arm.go +++ b/components/arm/arm.go @@ -53,7 +53,7 @@ func init() { }, newEndPositionCollector) data.RegisterCollector(data.MethodMetadata{ Subtype: SubtypeName, - MethodName: getJointPositions.String(), + MethodName: jointPositions.String(), }, newJointPositionsCollector) } diff --git a/components/arm/collectors.go b/components/arm/collectors.go index 3baf3f6a77f..cf223afd88c 100644 --- a/components/arm/collectors.go +++ b/components/arm/collectors.go @@ -12,15 +12,15 @@ type method int64 const ( endPosition method = iota - getJointPositions + jointPositions ) func (m method) String() string { switch m { case endPosition: - return "GetEndPosition" - case getJointPositions: - return "GetJointPositions" + return "EndPosition" + case jointPositions: + return "JointPositions" } return "Unknown" } @@ -50,7 +50,7 @@ func newJointPositionsCollector(resource interface{}, params data.CollectorParam cFunc := data.CaptureFunc(func(ctx context.Context, _ map[string]*anypb.Any) (interface{}, error) { v, err := arm.JointPositions(ctx, nil) if err != nil { - return nil, data.FailedToReadErr(params.ComponentName, getJointPositions.String(), err) + return nil, data.FailedToReadErr(params.ComponentName, jointPositions.String(), err) } return v, nil }) diff --git a/components/camera/camera.go b/components/camera/camera.go index e53a01f7a51..c4c52cfda53 100644 --- a/components/camera/camera.go +++ b/components/camera/camera.go @@ -53,8 +53,8 @@ func init() { }, newNextPointCloudCollector) data.RegisterCollector(data.MethodMetadata{ Subtype: SubtypeName, - MethodName: next.String(), - }, newNextCollector) + MethodName: readImage.String(), + }, newReadImageCollector) } // SubtypeName is a constant that identifies the camera resource subtype string. diff --git a/components/camera/collectors.go b/components/camera/collectors.go index 28534521266..3af14fbaee3 100644 --- a/components/camera/collectors.go +++ b/components/camera/collectors.go @@ -19,15 +19,15 @@ type method int64 const ( nextPointCloud method = iota - next method = iota + readImage method = iota ) func (m method) String() string { switch m { case nextPointCloud: return "NextPointCloud" - case next: - return "Next" + case readImage: + return "ReadImage" } return "Unknown" } @@ -61,7 +61,7 @@ func newNextPointCloudCollector(resource interface{}, params data.CollectorParam return data.NewCollector(cFunc, params) } -func newNextCollector(resource interface{}, params data.CollectorParams) (data.Collector, error) { +func newReadImageCollector(resource interface{}, params data.CollectorParams) (data.Collector, error) { camera, err := assertCamera(resource) if err != nil { return nil, err @@ -78,12 +78,12 @@ func newNextCollector(resource interface{}, params data.CollectorParams) (data.C } cFunc := data.CaptureFunc(func(ctx context.Context, _ map[string]*anypb.Any) (interface{}, error) { - _, span := trace.StartSpan(ctx, "camera::data::collector::CaptureFunc::Next") + _, span := trace.StartSpan(ctx, "camera::data::collector::CaptureFunc::ReadImage") defer span.End() img, release, err := ReadImage(ctx, camera) if err != nil { - return nil, data.FailedToReadErr(params.ComponentName, next.String(), err) + return nil, data.FailedToReadErr(params.ComponentName, readImage.String(), err) } defer func() { if release != nil { diff --git a/components/gantry/collectors.go b/components/gantry/collectors.go index d224c1f218c..5e21c7f0181 100644 --- a/components/gantry/collectors.go +++ b/components/gantry/collectors.go @@ -18,9 +18,9 @@ const ( func (m method) String() string { switch m { case position: - return "GetPosition" + return "Position" case lengths: - return "GetLengths" + return "Lengths" } return "Unknown" } diff --git a/components/motor/collectors.go b/components/motor/collectors.go index 9c879f4fc45..fa00b756271 100644 --- a/components/motor/collectors.go +++ b/components/motor/collectors.go @@ -18,7 +18,7 @@ const ( func (m method) String() string { switch m { case position: - return "GetPosition" + return "Position" case isPowered: return "IsPowered" } diff --git a/data/collector.go b/data/collector.go index c6fef5d5cf3..adca6d6445d 100644 --- a/data/collector.go +++ b/data/collector.go @@ -14,7 +14,7 @@ import ( "github.com/matttproud/golang_protobuf_extensions/pbutil" "github.com/pkg/errors" "go.opencensus.io/trace" - "go.viam.com/api/app/datasync/v1" + v1 "go.viam.com/api/app/datasync/v1" "go.viam.com/utils" "google.golang.org/protobuf/types/known/anypb" "google.golang.org/protobuf/types/known/timestamppb" diff --git a/etc/configs/fake_robot_with_remote_and_data_manager.json b/etc/configs/fake_robot_with_remote_and_data_manager.json deleted file mode 100644 index e6f502c60c7..00000000000 --- a/etc/configs/fake_robot_with_remote_and_data_manager.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "network": { - "fqdn": "something-unique", - "bind_address": ":8080" - }, - "components": [ - { - "name": "localArm", - "type": "arm", - "model": "fake", - "service_config": [ - { - "type": "data_manager", - "attributes": { - "capture_methods": [ - { - "method": "GetEndPosition", - "capture_frequency_hz": 100, - "tags": [ - "a", - "b" - ] - } - ] - } - } - ] - } - ], - "services": [ - { - "type": "data_manager", - "name": "data_manager1", - "attributes": { - "capture_dir": "/tmp/capture" - } - } - ], - "remotes": [ - { - "name": "remote1", - "address": "localhost:8081", - "service_config": [ - { - "type": "data_manager", - "name": "data_manager2", - "attributes": { - "capture_methods": [ - { - "name": "rdk:component:arm/remoteArm", - "method": "GetEndPosition", - "capture_frequency_hz": 100 - } - ] - } - } - ] - } - ] -} diff --git a/services/datamanager/builtin/builtin_test.go b/services/datamanager/builtin/builtin_test.go index 3733dc74a47..836f8cdc413 100644 --- a/services/datamanager/builtin/builtin_test.go +++ b/services/datamanager/builtin/builtin_test.go @@ -52,7 +52,7 @@ var ( syncIntervalMins = 0.0041 // 250ms captureDir = "/tmp/capture" - armDir = captureDir + "/arm/arm1/GetEndPosition" + armDir = captureDir + "/arm/arm1/EndPosition" emptyFileBytesSize = 30 // size of leading metadata message ) @@ -166,7 +166,7 @@ func TestNewDataManager(t *testing.T) { test.That(t, err, test.ShouldBeNil) // Check that a collector wrote to file. - armDir := captureDir + "/arm/arm1/GetEndPosition" + armDir := captureDir + "/arm/arm1/EndPosition" filesInArmDir, err := readDir(t, armDir) test.That(t, err, test.ShouldBeNil) test.That(t, len(filesInArmDir), test.ShouldEqual, 1) @@ -216,7 +216,7 @@ func TestCaptureDisabled(t *testing.T) { time.Sleep(captureWaitTime) // Verify that the collector wrote to its file. - armDir := captureDir + "/arm/arm1/GetEndPosition" + armDir := captureDir + "/arm/arm1/EndPosition" filesInArmDir, err := readDir(t, armDir) test.That(t, err, test.ShouldBeNil) test.That(t, len(filesInArmDir), test.ShouldEqual, 1) @@ -263,7 +263,7 @@ func TestNewRemoteDataManager(t *testing.T) { test.That(t, err, test.ShouldBeNil) // Verify that the local and remote collectors wrote to their files. - localArmDir := captureDir + "/arm/localArm/GetEndPosition" + localArmDir := captureDir + "/arm/localArm/EndPosition" filesInLocalArmDir, err := readDir(t, localArmDir) test.That(t, err, test.ShouldBeNil) test.That(t, len(filesInLocalArmDir), test.ShouldEqual, 1) @@ -271,7 +271,7 @@ func TestNewRemoteDataManager(t *testing.T) { test.That(t, err, test.ShouldBeNil) test.That(t, info.Size(), test.ShouldBeGreaterThan, 0) - remoteArmDir := captureDir + "/arm/remoteArm/GetEndPosition" + remoteArmDir := captureDir + "/arm/remoteArm/EndPosition" filesInRemoteArmDir, err := readDir(t, remoteArmDir) test.That(t, err, test.ShouldBeNil) test.That(t, len(filesInRemoteArmDir), test.ShouldEqual, 1) @@ -623,7 +623,7 @@ func TestScheduledSync(t *testing.T) { // Make the captureDir where we're logging data for our arm. captureDir := "/tmp/capture" - armDir := captureDir + "/arm/arm1/GetEndPosition" + armDir := captureDir + "/arm/arm1/EndPosition" // Clear the capture dir after we're done. defer resetFolder(t, armDir) @@ -674,7 +674,7 @@ func TestManualAndScheduledSync(t *testing.T) { // Make the captureDir where we're logging data for our arm. captureDir := "/tmp/capture" - armDir := captureDir + "/arm/arm1/GetEndPosition" + armDir := captureDir + "/arm/arm1/EndPosition" defer resetFolder(t, armDir) // Initialize the data manager and update it with our config. @@ -783,7 +783,7 @@ func TestAdditionalParamsInConfig(t *testing.T) { test.That(t, err, test.ShouldBeNil) time.Sleep(captureWaitTime) - filesInCamDir, err := readDir(t, captureDir+"/camera/c1/Next") + filesInCamDir, err := readDir(t, captureDir+"/camera/c1/ReadImage") test.That(t, err, test.ShouldBeNil) test.That(t, len(filesInCamDir), test.ShouldEqual, 1) info, err := filesInCamDir[0].Info() diff --git a/services/datamanager/data/fake_robot_with_data_manager.json b/services/datamanager/data/fake_robot_with_data_manager.json index 516487b4b79..de5420ab4d1 100644 --- a/services/datamanager/data/fake_robot_with_data_manager.json +++ b/services/datamanager/data/fake_robot_with_data_manager.json @@ -14,7 +14,7 @@ "attributes": { "capture_methods": [ { - "method": "GetEndPosition", + "method": "EndPosition", "capture_frequency_hz": 100, "tags": [ "a", diff --git a/services/datamanager/data/fake_robot_with_remote_and_data_manager.json b/services/datamanager/data/fake_robot_with_remote_and_data_manager.json index b044cba1cb7..fd385932ce8 100644 --- a/services/datamanager/data/fake_robot_with_remote_and_data_manager.json +++ b/services/datamanager/data/fake_robot_with_remote_and_data_manager.json @@ -14,7 +14,7 @@ "attributes": { "capture_methods": [ { - "method": "GetEndPosition", + "method": "EndPosition", "capture_frequency_hz": 100, "tags": [ "a", @@ -49,7 +49,7 @@ "capture_methods": [ { "name": "rdk:component:arm/remoteArm", - "method": "GetEndPosition", + "method": "EndPosition", "capture_frequency_hz": 100 } ] diff --git a/services/datamanager/data/robot_with_cam_capture.json b/services/datamanager/data/robot_with_cam_capture.json index 9442f25ae6d..7b74d525f72 100644 --- a/services/datamanager/data/robot_with_cam_capture.json +++ b/services/datamanager/data/robot_with_cam_capture.json @@ -10,7 +10,7 @@ "attributes": { "capture_methods": [ { - "method": "Next", + "method": "ReadImage", "capture_frequency_hz": 100, "additional_params": { "mime_type": "image/jpeg" diff --git a/services/datamanager/datacapture/data_capture_file_test.go b/services/datamanager/datacapture/data_capture_file_test.go index d660fc8a6e2..a346c114f6e 100644 --- a/services/datamanager/datacapture/data_capture_file_test.go +++ b/services/datamanager/datacapture/data_capture_file_test.go @@ -28,7 +28,7 @@ func TestBuildCaptureMetadata(t *testing.T) { componentType: "arm", componentName: "arm1", componentModel: "eva", - method: "GetEndPosition", + method: "EndPosition", additionalParams: make(map[string]string), dataType: v1.DataType_DATA_TYPE_TABULAR_SENSOR, fileExtension: ".dat",