Spaces:
Sleeping
Sleeping
Download config.py from Ducdata1808/AGV_simulator: direct link, hf CLI and curl.
- Browser
- Download file 975 Bytes
-
https://huggingface.co/spaces/Ducdata1808/AGV_simulator/resolve/main/config.py
- Command line
-
hf download hf://spaces/Ducdata1808/AGV_simulator/config.py
-
curl -L -o config.py https://huggingface.co/spaces/Ducdata1808/AGV_simulator/resolve/main/config.py
975 Bytes
| import tomli | |
| from dataclasses import dataclass | |
| from typing import Optional | |
| class MqttBrokerConfig: | |
| host: str | |
| port: str | |
| vda_interface: str | |
| class VehicleConfig: | |
| manufacturer: str | |
| serial_number: str | |
| vda_version: str | |
| vda_full_version: str | |
| class Settings: | |
| action_time: float | |
| speed: float | |
| robot_count: int | |
| state_frequency: int | |
| visualization_frequency: int | |
| map_id: str | |
| class Config: | |
| mqtt_broker: MqttBrokerConfig | |
| vehicle: VehicleConfig | |
| settings: Settings | |
| def get_config() -> Config: | |
| """Load configuration from config.toml file""" | |
| with open("config.toml", "rb") as f: | |
| config_dict = tomli.load(f) | |
| mqtt_broker = MqttBrokerConfig(**config_dict["mqtt_broker"]) | |
| vehicle = VehicleConfig(**config_dict["vehicle"]) | |
| settings = Settings(**config_dict["settings"]) | |
| return Config(mqtt_broker=mqtt_broker, vehicle=vehicle, settings=settings) |