Skip to content

config

config

Configuration class for loading and validating the configuration for config.

Prototype to be move into its own module eventually.

SystemConfig

SystemConfig(config: dict | Path)

Bases: dict

Configuration class for Festo modules and subsystems.

Used to dynamically instantiate a subsystem running using the Festo Python framework and specify the topology and operating parameters of said system.

Load and normalise config from a dict or JSON file path.

Source code in src/applied_motion/config.py
def __init__(self, config: dict | Path) -> None:
    """Load and normalise *config* from a dict or JSON file path."""
    if isinstance(config, SystemConfig):
        self.config = config
    else:
        config = self._load_config_source(config)
        logger.debug("SystemConfig: loaded config source=%s", type(config).__name__)
        parsed_config = self._normalize_config(config)
        self.config = parsed_config

GantryConfig

GantryConfig(sys_config: dict, name: str)

Validated, structured configuration for a single named gantry component.

Validate and store gantry config fields from sys_config for component name.

Source code in src/applied_motion/config.py
def __init__(self, sys_config: dict, name: str) -> None:
    """Validate and store gantry config fields from *sys_config* for component *name*."""
    self.name = name
    gantry_cfg, backend, axes_cfg, axis_order, concurrent_raw = self._validate_config(sys_config, name)
    self.backend = backend
    self.axes_cfg = axes_cfg
    self.axis_order = axis_order
    self.concurrent_raw = concurrent_raw
    self.interface = gantry_cfg.get("interface")