Skip to content

[RSDK-8045] connect to machine from viam client #685

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
Jul 17, 2024

Conversation

njooma
Copy link
Member

@njooma njooma commented Jul 16, 2024

Adds the ability to connect to a machine with an already-connected Viam client

@njooma njooma requested a review from a team as a code owner July 16, 2024 21:04
Copy link
Member

@purplenicole730 purplenicole730 left a comment

Choose a reason for hiding this comment

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

One question about main parts, and a quick type fix. Otherwise, looks good to me! Thank you for adding a viam_client test!


if id is not None and address is None:
parts = await self.app_client.get_robot_parts(id)
main_part = [p for p in parts if p.main_part][0]
Copy link
Member

Choose a reason for hiding this comment

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

I don't know how main parts work; are there multiple main parts with the same address?

Copy link
Member Author

Choose a reason for hiding this comment

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

There should be one main part per machine, and this will find it.

@njooma njooma force-pushed the RSDK-8045/simul-auth branch from c6d9389 to b98d515 Compare July 17, 2024 17:33

if id is not None and address is None:
parts = await self.app_client.get_robot_parts(id)
main_part = [p for p in parts if p.main_part][0]
Copy link
Member

Choose a reason for hiding this comment

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

(minor) not sure if we expect to have enough parts for this to matter, but I think this could be slightly cleaner/more efficient as main_part = next(p for p in parts if p.main_part).

Copy link
Member Author

Choose a reason for hiding this comment

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

Tested it, and it's about 25% faster to do the iterator method so I updated

@njooma njooma merged commit be98e2d into viamrobotics:main Jul 17, 2024
13 checks passed
@njooma njooma deleted the RSDK-8045/simul-auth branch July 17, 2024 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants