-
Notifications
You must be signed in to change notification settings - Fork 69
Add move_through_joint_positions and get_3d_models to Arm (BREAKING) #1250
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
Changes from all commits
69440b0
2208c00
a389a72
9ec2f6c
d2d766d
ce9ef0f
adcc687
3552089
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,10 +7,13 @@ | |
| DoCommandRequest, | ||
| DoCommandResponse, | ||
| Geometry, | ||
| Get3DModelsRequest, | ||
| Get3DModelsResponse, | ||
| GetKinematicsRequest, | ||
| GetKinematicsResponse, | ||
| GetStatusRequest, | ||
| GetStatusResponse, | ||
| Mesh, | ||
| ) | ||
| from viam.proto.component.arm import ( | ||
| ArmServiceStub, | ||
|
|
@@ -21,6 +24,8 @@ | |
| IsMovingRequest, | ||
| IsMovingResponse, | ||
| JointPositions, | ||
| MoveOptions, | ||
| MoveThroughJointPositionsRequest, | ||
| MoveToJointPositionsRequest, | ||
| MoveToPositionRequest, | ||
| StopRequest, | ||
|
|
@@ -91,6 +96,20 @@ async def move_to_joint_positions( | |
| request = MoveToJointPositionsRequest(name=self.name, positions=positions, extra=dict_to_struct(extra)) | ||
| await self.client.MoveToJointPositions(request, timeout=timeout, metadata=md) | ||
|
|
||
| async def move_through_joint_positions( | ||
| self, | ||
| positions: List[JointPositions], | ||
| options: Optional[MoveOptions] = None, | ||
| *, | ||
| extra: Optional[Dict[str, Any]] = None, | ||
| timeout: Optional[float] = None, | ||
| **kwargs, | ||
| ): | ||
| md = kwargs.get("metadata", self.Metadata()).proto | ||
| # Passing options=None leaves the optional field genuinely unset. | ||
| request = MoveThroughJointPositionsRequest(name=self.name, positions=positions, options=options, extra=dict_to_struct(extra)) | ||
| await self.client.MoveThroughJointPositions(request, timeout=timeout, metadata=md) | ||
|
|
||
| async def stop( | ||
| self, | ||
| *, | ||
|
|
@@ -137,8 +156,20 @@ async def get_kinematics( | |
| md = kwargs.get("metadata", self.Metadata()).proto | ||
| request = GetKinematicsRequest(name=self.name, extra=dict_to_struct(extra)) | ||
| response: GetKinematicsResponse = await self.client.GetKinematics(request, timeout=timeout, metadata=md) | ||
| # TODO: handle empty meshes in the response to prevent silent mapping | ||
| return (response.format, response.kinematics_data, response.meshes_by_urdf_filepath) | ||
|
|
||
| async def get_3d_models( | ||
| self, *, extra: Optional[Dict[str, Any]] = None, timeout: Optional[float] = None, **kwargs | ||
| ) -> Mapping[str, Mesh]: | ||
| md = kwargs.get("metadata", self.Metadata()).proto | ||
| request = Get3DModelsRequest(name=self.name, extra=dict_to_struct(extra)) | ||
| response: Get3DModelsResponse = await self.client.Get3DModels(request, timeout=timeout, metadata=md) | ||
| # Copy out of the protobuf map container: `__getitem__` on an absent key would | ||
| # otherwise create and insert a default-constructed value instead of raising | ||
| # KeyError, silently violating the Mapping contract. | ||
| return dict(response.models) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think I agree with this -- I think we can just return
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ahhh ok gotcha |
||
|
|
||
| async def get_geometries(self, *, extra: Optional[Dict[str, Any]] = None, timeout: Optional[float] = None, **kwargs) -> List[Geometry]: | ||
| md = kwargs.get("metadata", self.Metadata()) | ||
| return await get_geometries(self.client, self.name, extra, timeout, md) | ||
Uh oh!
There was an error while loading. Please reload this page.