diff --git a/robot_sf/sim_config.py b/robot_sf/sim_config.py index 22d1adf..c1b1320 100644 --- a/robot_sf/sim_config.py +++ b/robot_sf/sim_config.py @@ -10,17 +10,28 @@ @dataclass class EnvSettings: + """ + Data class to hold environment settings for a simulation. + """ sim_config: SimulationSettings = SimulationSettings() lidar_config: LidarScannerSettings = LidarScannerSettings() - robot_config: Union[DifferentialDriveSettings, BicycleDriveSettings] = DifferentialDriveSettings() + robot_config: Union[DifferentialDriveSettings, BicycleDriveSettings] = \ + DifferentialDriveSettings() map_pool: MapDefinitionPool = MapDefinitionPool() def __post_init__(self): + """ + Check if any of the properties are not initialized (None) and raise an error if so. + """ if not self.sim_config or not self.lidar_config \ or not self.robot_config or not self.map_pool: raise ValueError('Please make sure all properties are initialized!') def robot_factory(self) -> Union[DifferentialDriveRobot, BicycleDriveRobot]: + """ + Factory method to create a robot instance based on the type of robot configuration provided. + :return: robot instance. + """ if isinstance(self.robot_config, DifferentialDriveSettings): return DifferentialDriveRobot(self.robot_config) elif isinstance(self.robot_config, BicycleDriveSettings):