1- from typing import Any , Dict , List , Mapping , Optional , Sequence , Tuple , Union
1+ from typing import Any , Dict , List , Mapping , Optional , Sequence , Union
22
33import numpy as np
44from grpclib .server import Stream
306306 Readings ,
307307 SensorsServiceBase ,
308308)
309- from viam .proto .service .slam import MappingMode
309+ from viam .proto .service .slam import MappingMode , SensorInfo , SensorType
310310from viam .proto .service .vision import Classification , Detection
311311from viam .services .generic import Generic as GenericService
312312from viam .services .mlmodel import File , LabelType , Metadata , MLModel , TensorInfo
@@ -603,10 +603,21 @@ class MockSLAM(SLAM):
603603 POSITION = Pose (x = 1 , y = 2 , z = 3 , o_x = 2 , o_y = 3 , o_z = 4 , theta = 20 )
604604 CLOUD_SLAM = False
605605 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+ ]
606611
607612 def __init__ (self , name : str ):
608613 self .name = name
609614 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+ )
610621 super ().__init__ (name )
611622
612623 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:
621632 self .timeout = timeout
622633 return self .POSITION
623634
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 :
625636 self .timeout = timeout
626- return ( self .CLOUD_SLAM , self . MAPPING_MODE )
637+ return self .properties
627638
628639 async def do_command (self , command : Mapping [str , ValueTypes ], * , timeout : Optional [float ] = None , ** kwargs ) -> Mapping [str , ValueTypes ]:
629640 return {"command" : command }
0 commit comments