-
Notifications
You must be signed in to change notification settings - Fork 56
[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
Conversation
There was a problem hiding this 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!
src/viam/app/viam_client.py
Outdated
|
||
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] |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
c6d9389
to
b98d515
Compare
src/viam/app/viam_client.py
Outdated
|
||
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] |
There was a problem hiding this comment.
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)
.
There was a problem hiding this comment.
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
Adds the ability to connect to a machine with an already-connected Viam client