1
1
import asyncio
2
2
import os
3
- from typing import Any , ClassVar , Dict , Mapping , Optional , Tuple
3
+ from typing import Any , ClassVar , Dict , List , Mapping , Optional , Tuple
4
+
4
5
from typing_extensions import Self
5
6
6
7
from viam .components .arm import Arm , JointPositions , KinematicsFileFormat , Pose
7
8
from viam .operations import run_with_operation
8
9
from viam .proto .app .robot import ComponentConfig
9
- from viam .proto .common import ResourceName
10
+ from viam .proto .common import Capsule , Geometry , ResourceName , Sphere
10
11
from viam .resource .base import ResourceBase
11
12
from viam .resource .types import Model , ModelFamily
12
13
@@ -30,6 +31,10 @@ def __init__(self, name: str):
30
31
# Starting joint positions
31
32
self .joint_positions = JointPositions (values = [0 , 0 , 0 , 0 , 0 , 0 ])
32
33
self .is_stopped = True
34
+ self .geometries = [
35
+ Geometry (center = Pose (x = 1 , y = 2 , z = 3 , o_x = 2 , o_y = 3 , o_z = 4 , theta = 20 ), sphere = Sphere (radius_mm = 2 )),
36
+ Geometry (center = Pose (x = 1 , y = 2 , z = 3 , o_x = 2 , o_y = 3 , o_z = 4 , theta = 20 ), capsule = Capsule (radius_mm = 3 , length_mm = 8 )),
37
+ ]
33
38
super ().__init__ (name )
34
39
35
40
@classmethod
@@ -90,6 +95,9 @@ async def stop(self, extra: Optional[Dict[str, Any]] = None, **kwargs):
90
95
async def is_moving (self ) -> bool :
91
96
return not self .is_stopped
92
97
98
+ async def get_geometries (self ) -> List [Geometry ]:
99
+ return self .geometries
100
+
93
101
async def get_kinematics (self , extra : Optional [Dict [str , Any ]] = None , ** kwargs ) -> Tuple [KinematicsFileFormat .ValueType , bytes ]:
94
102
dirname = os .path .dirname (__file__ )
95
103
filepath = os .path .join (dirname , "./my_arm_kinematics.json" )
0 commit comments