hardware#
- class mesofield.hardware.HardwareManager[source]#
Bases:
objectHigh-level class that initializes all hardware (cameras, encoder, etc.) using the ParameterManager. Keeps references easily accessible.
When config_file is
Noneor the file does not exist the manager starts in an unconfigured default state. Callload_config()later to point it at a real YAML file and theninitialize()to bring hardware up.- load_config(config_file)[source]#
Load (or reload) a hardware YAML file.
This does not initialise devices – call
initialize()afterwards.- Parameters:
config_file (str)
- Return type:
None
- initialize(cfg)[source]#
Initialize all devices from YAML and configure engines.
Does nothing if the manager has no loaded YAML configuration. Validates that exactly one device is flagged
primary: true.- Return type:
None
- to_yaml(path=None)[source]#
Serialize the current devices into a
hardware.yamlmapping.Each device becomes a top-level
type:-tagged stanza keyed by its device id, re-importable through_init_extras(). This is the migration path from a scripted procedure to a reusable rig file.When path is given the mapping is also written to disk. Raises
RuntimeErrorif any device’s class was never registered via@DeviceRegistry.register(noregistry_key-> not migratable).
- property primary#
Return the device flagged
primary: truein YAML.
- deinitialize()[source]#
Tear down all devices and reset to unconfigured state.
After this call the manager can be re-initialised with a fresh
load_config()/initialize()cycle.
- stop_all()#
Stop all devices.
- get_device(device_id)[source]#
Get a device by its ID.
- Parameters:
device_id (str)
- Return type:
HardwareDevice | None