Skip to content

Migrate to connect-es #4417

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

Merged
merged 5 commits into from
Oct 7, 2024
Merged

Conversation

edaniels
Copy link
Contributor

@edaniels edaniels commented Oct 3, 2024

Depends on viamrobotics/viam-typescript-sdk#368

There's nothing very interesting here and testing so far seems to have this work.

@edaniels edaniels requested a review from njooma October 3, 2024 14:53
@viambot viambot added the safe to test This pull request is marked safe to test from a trusted zone label Oct 3, 2024
Copy link
Member

@njooma njooma left a comment

Choose a reason for hiding this comment

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

Seems like the changes are all of the same type. Everything reads a lot cleaner

Copy link
Contributor

@zaporter-work zaporter-work left a comment

Choose a reason for hiding this comment

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

Did not manually test due to hardcoded file in package.json.

Code LGTM. Thanks for doing this change!

Comment on lines +12 to +13
const client = new MovementSensorClient(robotClient, name, {
requestLogger: rcLogConditionally,
Copy link
Contributor

Choose a reason for hiding this comment

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

[aside] Do you know if these clients expensive to construct? I traced the trail down through connect-es PromiseClient but didn't go much further.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

they are O(n) calls where n is the number of proto methods. If I were rewriting how this would work now, I wouldn't keep creating clients but just have each component have a cached client or robot client.

@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 Oct 7, 2024
@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 Oct 7, 2024
@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 Oct 7, 2024
Copy link
Contributor

@ethanlookpotts ethanlookpotts left a comment

Choose a reason for hiding this comment

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

Code LGTM, manual testing now

movement_sensor: 'movementSensorService',
navigation: 'navigationService',
power_sensor: 'powerSensorService',
sensors: 'sensorsService',
Copy link
Contributor

Choose a reason for hiding this comment

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

Does the sensors service no longer exist? I was under the impression it still existed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

there's no reified client for it other than the promise client. is anyone running a do command against a sensors service though?

Copy link
Contributor

Choose a reason for hiding this comment

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

They shouldn't be - we have every intention to get rid of it - but if it exists, I'm sure someone is using it. We can skip it, was just curious.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

if a problem comes up with it, it wont be hard to get it working again!


return response?.toObject().sensorNamesList ?? [];
const request = new sensorsApi.GetSensorsRequest({ name });
const resp = await robotClient.sensorsService.getSensors(request);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not create SensorsClient like the other wrappers?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

because the TS SDK never had one

Copy link
Contributor Author

Choose a reason for hiding this comment

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

note there's a SensorClient but not a SensorsClient

Copy link
Contributor

Choose a reason for hiding this comment

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

not a problem then!

Copy link
Contributor

Choose a reason for hiding this comment

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

Why are the responses for getVoltage, getCurrent, and getPower arrays now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah interesting, what is the bool that is the second entry? Could we use array destructuring?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it's something about it being AC or not

console.error('done streaming robot status');
$statusStream = null;
});
})().catch(console.error);
Copy link
Contributor

Choose a reason for hiding this comment

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

Will this catch actually catch anything since the whole thing is wrapped in a try/catch?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nope good... catch

@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 Oct 7, 2024
@ethanlookpotts
Copy link
Contributor

Manual testing LGTM - I wasn't seeing any operations but not sure that I would with the fakes. There are hopefully very few users on this so I think we're safe and can fix forward if anything comes up.

@edaniels
Copy link
Contributor Author

edaniels commented Oct 7, 2024

Manual testing LGTM - I wasn't seeing any operations but not sure that I would with the fakes. There are hopefully very few users on this so I think we're safe and can fix forward if anything comes up.

Ah yeah I managed to get one using a motor gofor, many of them are too instantaneous though

@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 Oct 7, 2024
@edaniels edaniels merged commit 036ed32 into viamrobotics:main Oct 7, 2024
19 checks passed
@edaniels edaniels deleted the ts-sdk-connect-es branch October 7, 2024 20:38
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.

5 participants