1
- from typing import Any , Dict , List , Mapping , Optional , Sequence , Tuple , Union
1
+ from typing import Any , Dict , List , Mapping , Optional , Sequence , Union
2
2
3
3
import numpy as np
4
4
from grpclib .server import Stream
306
306
Readings ,
307
307
SensorsServiceBase ,
308
308
)
309
- from viam .proto .service .slam import MappingMode
309
+ from viam .proto .service .slam import MappingMode , SensorInfo , SensorType
310
310
from viam .proto .service .vision import Classification , Detection
311
311
from viam .services .generic import Generic as GenericService
312
312
from viam .services .mlmodel import File , LabelType , Metadata , MLModel , TensorInfo
@@ -603,10 +603,21 @@ class MockSLAM(SLAM):
603
603
POSITION = Pose (x = 1 , y = 2 , z = 3 , o_x = 2 , o_y = 3 , o_z = 4 , theta = 20 )
604
604
CLOUD_SLAM = False
605
605
MAPPING_MODE = MappingMode .MAPPING_MODE_UNSPECIFIED
606
+ INTERNAL_STATE_FILE_TYPE = ".pbstream"
607
+ SENSOR_INFO = [
608
+ SensorInfo (name = "my-camera" , type = SensorType .SENSOR_TYPE_CAMERA ),
609
+ SensorInfo (name = "my-movement-sensor" , type = SensorType .SENSOR_TYPE_MOVEMENT_SENSOR ),
610
+ ]
606
611
607
612
def __init__ (self , name : str ):
608
613
self .name = name
609
614
self .timeout : Optional [float ] = None
615
+ self .properties = SLAM .Properties (
616
+ cloud_slam = self .CLOUD_SLAM ,
617
+ mapping_mode = self .MAPPING_MODE ,
618
+ internal_state_file_type = self .INTERNAL_STATE_FILE_TYPE ,
619
+ sensor_info = self .SENSOR_INFO
620
+ )
610
621
super ().__init__ (name )
611
622
612
623
async def get_internal_state (self , * , timeout : Optional [float ] = None ) -> List [bytes ]:
@@ -621,9 +632,9 @@ async def get_position(self, *, timeout: Optional[float] = None) -> Pose:
621
632
self .timeout = timeout
622
633
return self .POSITION
623
634
624
- async def get_properties (self , * , timeout : Optional [float ] = None ) -> Tuple [ bool , MappingMode . ValueType ] :
635
+ async def get_properties (self , * , timeout : Optional [float ] = None ) -> SLAM . Properties :
625
636
self .timeout = timeout
626
- return ( self .CLOUD_SLAM , self . MAPPING_MODE )
637
+ return self .properties
627
638
628
639
async def do_command (self , command : Mapping [str , ValueTypes ], * , timeout : Optional [float ] = None , ** kwargs ) -> Mapping [str , ValueTypes ]:
629
640
return {"command" : command }
0 commit comments