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-6058 Deprecate sensors service api #424

Merged
merged 9 commits into from
Jan 16, 2024
Merged

Conversation

randhid
Copy link
Member

@randhid randhid commented Jan 3, 2024

This pull request marks the sensors service API as deprecated. This will be removed once the RC card for sensors no longer has a dependency on the GetAllReadings Function.

Copy link
Member

@penguinland penguinland left a comment

Choose a reason for hiding this comment

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

LGTM. It's exciting to get rid of this!

proto/viam/service/sensors/v1/sensors.proto Show resolved Hide resolved
}

message GetSensorsResponse {
repeated common.v1.ResourceName sensor_names = 1;
Copy link
Member

Choose a reason for hiding this comment

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

I think that in addition to giving RPCs the deprecated option, you can do that to entire messages, too. Worth doing here? I dunno; what you've got is already pretty thorough.

Copy link
Member Author

Choose a reason for hiding this comment

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

nice! I am not a proto expert, had to google what to actually do here. I don't see the harm in just adding deprecated signifiers everywhere we can.

Copy link
Member

Choose a reason for hiding this comment

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

I think it's:

message GetSensorsResponse {
    option deprecated = true;
    repeated common.v1.ResourceName sensor_names = 1 [deprecated = true]; 
    ...
}

but I've never done this myself and could be wrong.

Copy link
Member Author

Choose a reason for hiding this comment

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

Okay I'm satisfied. I will check with a local version of this API with rdk tomorrow to make sure things work as expected and won't break anything juts by adding a deprecated signifier to proto.

proto/viam/service/sensors/v1/sensors.proto Show resolved Hide resolved
@randhid
Copy link
Member Author

randhid commented Jan 12, 2024

This pull request marks the sensors service API as deprecated. This will be removed once the RC card for sensors no longer has a dependency on the GetAllReadings Function.

Finally taste with a local build of the API following instructions here, in case anyone was wondering about the method I used to test.

Tested with the python SDK using the following code:

    service = SensorsClient.from_robot(robot, "builtin")
    sensors = await service.get_sensors()
    print(f"b get_readings return value: {sensors}")

    vals = await service.get_readings(sensors)
    print(f"b get_readings return value: {vals}")

Got back:

get_sensors return value: [<viam.proto.common.ResourceName rdk:component:sensor/b at 0x103ee7b30>, <viam.proto.common.ResourceName rdk:component:sensor/c at 0x103ee76d0>, <viam.proto.common.ResourceName rdk:component:sensor/a at 0x103ee7680>]
get_readings return value: {<viam.proto.common.ResourceName rdk:component:sensor/b at 0x103ee7a40>: {'a': 1.0, 'b': 2.0, 'c': 3.0}, <viam.proto.common.ResourceName rdk:component:sensor/c at 0x103ee7c20>: {'a': 1.0, 'b': 2.0, 'c': 3.0}, <viam.proto.common.ResourceName rdk:component:sensor/a at 0x103ee71d0>: {'a': 1.0, 'b': 2.0, 'c': 3.0}}

RC Card is still functional (three fake sensors configured):

Screenshot 2024-01-12 at 17 47 43

I'm happy, will merge in.

@randhid randhid added question Further information is requested and removed question Further information is requested labels Jan 13, 2024
@randhid randhid added question Further information is requested and removed protos-compiled question Further information is requested labels Jan 16, 2024
@randhid randhid added question Further information is requested and removed question Further information is requested labels Jan 16, 2024
Copy link
Member

@penguinland penguinland left a comment

Choose a reason for hiding this comment

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

Rand thinks the PR is stuck in some weird CI edge case, and needs another LGTM to get unstuck...

@randhid randhid added question Further information is requested and removed question Further information is requested labels Jan 16, 2024
@randhid randhid merged commit a7b6c9a into viamrobotics:main Jan 16, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants