From 69e775142089aa62078da99609e9481fbe0d1e67 Mon Sep 17 00:00:00 2001 From: cantordust <43831101+cantordust@users.noreply.github.com> Date: Thu, 20 Nov 2025 14:18:46 +0100 Subject: [PATCH 01/10] - [WIP] Scanner resource --- laborchestrator/.gitignore | 1 + laborchestrator/platform_config.yaml | 5 ++ .../vu_lab/processes/basic_process.py | 4 +- .../vu_lab/processes/scanner_process.py | 46 +++++++++++++++++++ .../vu_lab/resources/scanner_resource.py | 29 ++++++++++++ .../vu_lab/wrappers/scanner_wrapper.py | 38 +++++++++++++++ 6 files changed, 122 insertions(+), 1 deletion(-) create mode 100644 laborchestrator/.gitignore create mode 100644 laborchestrator/vu_lab/processes/scanner_process.py create mode 100644 laborchestrator/vu_lab/resources/scanner_resource.py create mode 100644 laborchestrator/vu_lab/wrappers/scanner_wrapper.py diff --git a/laborchestrator/.gitignore b/laborchestrator/.gitignore new file mode 100644 index 0000000..965750f --- /dev/null +++ b/laborchestrator/.gitignore @@ -0,0 +1 @@ +jssp**.json diff --git a/laborchestrator/platform_config.yaml b/laborchestrator/platform_config.yaml index 42f9197..f47d058 100755 --- a/laborchestrator/platform_config.yaml +++ b/laborchestrator/platform_config.yaml @@ -20,9 +20,14 @@ sila_servers: shaker6: capacity: 1 + scanners: + scanner1: + capacity: 1 + # ------ Translation to used resources in the process description ------ # the key must match the categories above and the values must match the required resources in the workflow description pythonlab_translation: storage: LabwareStorageResource movers: MoverServiceResource shakers: ShakerServiceResource + scanners: LabwareResource diff --git a/laborchestrator/vu_lab/processes/basic_process.py b/laborchestrator/vu_lab/processes/basic_process.py index e2ae7c5..b6271ed 100644 --- a/laborchestrator/vu_lab/processes/basic_process.py +++ b/laborchestrator/vu_lab/processes/basic_process.py @@ -6,7 +6,7 @@ from pythonlab.resources.services.labware_storage import LabwareStorageResource from pythonlab.resources.services.moving import MoverServiceResource from pythonlab.resources.services.shaker import ShakerServiceResource - +from vu_lab.resources.scanner_resource import ScannerResource class BasicProcess(PLProcess, ABC): def __init__( @@ -33,6 +33,8 @@ def create_resources(self) -> None: self.shaker_pool = ShakerServiceResource(proc=self, name=None) + self.scanner1 = ScannerResource(proc=self, name="scanner1") + # the containers are automatically named/enumerated. You can change the naming without causing problems self.containers = [ LabwareResource( diff --git a/laborchestrator/vu_lab/processes/scanner_process.py b/laborchestrator/vu_lab/processes/scanner_process.py new file mode 100644 index 0000000..2b5e4bf --- /dev/null +++ b/laborchestrator/vu_lab/processes/scanner_process.py @@ -0,0 +1,46 @@ +"""Duplicate this file and add/modify the missing parts to create new processes""" + +from pythonlab.process import PLProcess +from vu_lab.processes.basic_process import BasicProcess +from pythonlab.resource import LabwareResource +from vu_lab.resources.scanner_resource import ScannerResource + +DURATION = 10 +FREQUENCY = 10 +NUM_BEDS = 1 +PRIORITY = 3 + + +class ScannerProcess(BasicProcess): + """A simple test process that moves plates to a scanner, scans them, and returns them to the hotel.""" + + def __init__( + self, + priority: int = PRIORITY, + num_beds: int = NUM_BEDS, + duration: float = DURATION, + frequency: float = FREQUENCY, + ): + super().__init__( + priority=priority, num_plates=num_beds, process_name="VU Test Process" + ) + self.duration = duration + self.frequency = frequency + + def init_service_resources(self): + # setting start position of containers + super().init_service_resources() + for i, cont in enumerate(self.containers): + cont.set_start_position(self.hotel1, i + 1) + + def process(self): + + resolution = 640 + # loop through all containers + for idx in range(self.num_mw_plates): + cont = self.containers[idx] + + # Move all containers to shaker + self.robot_arm.move(cont, self.scanner1) + self.scanner1.scan(cont, resolution) + self.robot_arm.move(cont, self.hotel1) diff --git a/laborchestrator/vu_lab/resources/scanner_resource.py b/laborchestrator/vu_lab/resources/scanner_resource.py new file mode 100644 index 0000000..b931eba --- /dev/null +++ b/laborchestrator/vu_lab/resources/scanner_resource.py @@ -0,0 +1,29 @@ +"""Duplicate this file and add/modify the missing parts to create new processes""" + +from pythonlab.process import PLProcess +from vu_lab.processes.basic_process import BasicProcess +from pythonlab.resource import LabwareResource + +DURATION = 10 +FREQUENCY = 10 +NUM_BEDS = 1 +PRIORITY = 3 + + +class ScannerResource(LabwareResource): + + def scan( + self, + container: LabwareResource, + resolution: int, + **kwargs, + ): + kwargs.update( + { + "fct": "scan", + "resolution": resolution, + } + ) + + self.proc.add_process_step(self, [container], **kwargs) + print(f"==[ Scan invoked.") diff --git a/laborchestrator/vu_lab/wrappers/scanner_wrapper.py b/laborchestrator/vu_lab/wrappers/scanner_wrapper.py new file mode 100644 index 0000000..f96e965 --- /dev/null +++ b/laborchestrator/vu_lab/wrappers/scanner_wrapper.py @@ -0,0 +1,38 @@ +from laborchestrator.structures import ProcessStep, ContainerInfo +from laborchestrator.engine.worker_interface import Observable + +from vu_lab.wrappers import DeviceInterface + +from sila2.client import SilaClient as ScannerClient + + +class ScannerWrapper(DeviceInterface): + @staticmethod + def get_SiLA_handler( + step: ProcessStep, + cont: ContainerInfo, + sila_client: ScannerClient, + **kwargs, + ) -> Observable: + pass + + # Start scanning + # Stop scanning + # Start scan runtime + + def start_scan( + self, + client: ScannerClient, + resolution: int, + ) -> Observable: + """ + Start scanning with the specified mode, duration, and displacement. + :param client: SiLA client for the shaker device + :param resolution: The scanner resolution. + """ + + return client.ScanController.start_scan_step(resolution) + + def abort_scan(self, client: ScannerClient) -> Observable: + + return client.ScanController.abort_shake() From 1acfb768d41065ed1dd6ac2d37a0b30b9a3d8dae Mon Sep 17 00:00:00 2001 From: cantordust <43831101+cantordust@users.noreply.github.com> Date: Wed, 26 Nov 2025 16:58:14 +0100 Subject: [PATCH 02/10] Suppressing errors during docker bootstrapping phase --- docker-compose.yml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index e58872c..bab7423 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,25 +1,24 @@ services: - teleshake: build: ./teleshake/ environment: - PORT=50050 - ports: - - "50050:50050" + # ports: + # - "50050:50050" network_mode: host sila-browser: image: registry.gitlab.com/unitelabs/sila2/sila-browser:latest network_mode: host - ports: - - "3000:3000" + # ports: + # - "3000:3000" robot-arm: build: ./robot-arm/ network_mode: host - environment: - - ROBOT_IP=192.168.1.4 # Change + # environment: + # - ROBOT_IP=192.168.1.4 # Change # command: [ "python", "-m", "genericroboticarm", "--address", "0.0.0.0" ] command: python -m genericroboticarm --port 50054 --address 0.0.0.0 -r XArm --simulation volumes: @@ -78,4 +77,4 @@ services: network_mode: host volumes: - pgdata: \ No newline at end of file + pgdata: From 29cef27f5242e0aef969ad78aae59bd213044d6d Mon Sep 17 00:00:00 2001 From: cantordust <43831101+cantordust@users.noreply.github.com> Date: Wed, 26 Nov 2025 16:59:35 +0100 Subject: [PATCH 03/10] Ignore some generated files. --- laborchestrator/.gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/laborchestrator/.gitignore b/laborchestrator/.gitignore index 965750f..38618e7 100644 --- a/laborchestrator/.gitignore +++ b/laborchestrator/.gitignore @@ -1 +1,3 @@ jssp**.json +Schedule** +WFG** From bcc7f775a7f3e508a37d17ec1dee8daf2041b0e7 Mon Sep 17 00:00:00 2001 From: cantordust <43831101+cantordust@users.noreply.github.com> Date: Wed, 26 Nov 2025 17:00:24 +0100 Subject: [PATCH 04/10] Added `scanner` as a resource in `platform_config.yaml`. --- laborchestrator/platform_config.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/laborchestrator/platform_config.yaml b/laborchestrator/platform_config.yaml index ec1c902..3ad54e6 100755 --- a/laborchestrator/platform_config.yaml +++ b/laborchestrator/platform_config.yaml @@ -20,9 +20,10 @@ sila_servers: shaker_6_d_pos_: capacity: 1 - scanners: + scanners: scanner1: capacity: 1 + resolution: 640 # ------ Translation to used resources in the process description ------ # the key must match the categories above and the values must match the required resources in the workflow description From 2f8922437fd3aa95fe870768b4eac6fd3c46f4f9 Mon Sep 17 00:00:00 2001 From: cantordust <43831101+cantordust@users.noreply.github.com> Date: Wed, 26 Nov 2025 17:01:12 +0100 Subject: [PATCH 05/10] Added a scanner resource (`laborchestrator/resources`) --- laborchestrator/vu_lab/resources/scanner_resource.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/laborchestrator/vu_lab/resources/scanner_resource.py b/laborchestrator/vu_lab/resources/scanner_resource.py index b931eba..800f8b5 100644 --- a/laborchestrator/vu_lab/resources/scanner_resource.py +++ b/laborchestrator/vu_lab/resources/scanner_resource.py @@ -1,7 +1,5 @@ """Duplicate this file and add/modify the missing parts to create new processes""" -from pythonlab.process import PLProcess -from vu_lab.processes.basic_process import BasicProcess from pythonlab.resource import LabwareResource DURATION = 10 From b93c35e9f5f08bf638b374eb86ff5988abaf3c22 Mon Sep 17 00:00:00 2001 From: cantordust <43831101+cantordust@users.noreply.github.com> Date: Wed, 26 Nov 2025 17:02:27 +0100 Subject: [PATCH 06/10] Added process classes to `processes/__init__.py` --- laborchestrator/vu_lab/processes/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/laborchestrator/vu_lab/processes/__init__.py b/laborchestrator/vu_lab/processes/__init__.py index e69de29..833f19b 100644 --- a/laborchestrator/vu_lab/processes/__init__.py +++ b/laborchestrator/vu_lab/processes/__init__.py @@ -0,0 +1,2 @@ +from .basic_process import BasicProcess +from .mini_process import MiniProcess From 01dfaba22390d45f1467bf39bc37a47e0f8ec325 Mon Sep 17 00:00:00 2001 From: cantordust <43831101+cantordust@users.noreply.github.com> Date: Wed, 26 Nov 2025 17:03:04 +0100 Subject: [PATCH 07/10] Added a simple scanner process. --- laborchestrator/vu_lab/processes/scanner_process.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/laborchestrator/vu_lab/processes/scanner_process.py b/laborchestrator/vu_lab/processes/scanner_process.py index 2b5e4bf..b230afd 100644 --- a/laborchestrator/vu_lab/processes/scanner_process.py +++ b/laborchestrator/vu_lab/processes/scanner_process.py @@ -22,21 +22,18 @@ def __init__( frequency: float = FREQUENCY, ): super().__init__( - priority=priority, num_plates=num_beds, process_name="VU Test Process" + priority=priority, num_plates=num_beds, process_name="Vu Test Process" ) self.duration = duration self.frequency = frequency def init_service_resources(self): - # setting start position of containers super().init_service_resources() - for i, cont in enumerate(self.containers): - cont.set_start_position(self.hotel1, i + 1) def process(self): resolution = 640 - # loop through all containers + # Loop through all containers and scan them for idx in range(self.num_mw_plates): cont = self.containers[idx] From 16a130c4ce9baa4e59467a0cfcc35927c134df3c Mon Sep 17 00:00:00 2001 From: cantordust <43831101+cantordust@users.noreply.github.com> Date: Thu, 27 Nov 2025 14:15:00 +0100 Subject: [PATCH 08/10] Updated `laborchestrator/platform_config.yaml` with the correct resource class for the scanner. --- laborchestrator/platform_config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/laborchestrator/platform_config.yaml b/laborchestrator/platform_config.yaml index 3ad54e6..5a5e1b4 100755 --- a/laborchestrator/platform_config.yaml +++ b/laborchestrator/platform_config.yaml @@ -31,4 +31,4 @@ pythonlab_translation: storage: LabwareStorageResource movers: MoverServiceResource shakers: ShakerServiceResource - scanners: LabwareResource + scanners: ScannerResource From 02eb55195fa9727c4704973d2d04e314cef9d4d1 Mon Sep 17 00:00:00 2001 From: cantordust <43831101+cantordust@users.noreply.github.com> Date: Thu, 27 Nov 2025 14:15:43 +0100 Subject: [PATCH 09/10] Updated the scanner resource to have `ServiceResource` as the base class. --- .../vu_lab/resources/scanner_resource.py | 25 +++++++++++++++---- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/laborchestrator/vu_lab/resources/scanner_resource.py b/laborchestrator/vu_lab/resources/scanner_resource.py index 800f8b5..c1f82de 100644 --- a/laborchestrator/vu_lab/resources/scanner_resource.py +++ b/laborchestrator/vu_lab/resources/scanner_resource.py @@ -1,6 +1,7 @@ -"""Duplicate this file and add/modify the missing parts to create new processes""" +"""Duplicate this file and add/modify the missing parts to create a new resource""" -from pythonlab.resource import LabwareResource +import logging +from pythonlab.resource import ServiceResource DURATION = 10 FREQUENCY = 10 @@ -8,11 +9,25 @@ PRIORITY = 3 -class ScannerResource(LabwareResource): +class ScannerResource(ServiceResource): + """ + Flatbed scanner resource as a service. + + :param Resource: [description] + :type Resource: [type] + """ + + def __init__(self, proc, name: str = "Scanner"): + super().__init__(proc=proc, name=name) + + self._resolution = 640 + + def init(self): + logging.debug(f"init {self.name}") def scan( self, - container: LabwareResource, + container: ServiceResource, resolution: int, **kwargs, ): @@ -23,5 +38,5 @@ def scan( } ) - self.proc.add_process_step(self, [container], **kwargs) print(f"==[ Scan invoked.") + self.proc.add_process_step(self, [container], **kwargs) From a27a41aaa32be69cd6ee77c956adf9755edf28f6 Mon Sep 17 00:00:00 2001 From: cantordust <43831101+cantordust@users.noreply.github.com> Date: Thu, 27 Nov 2025 14:16:28 +0100 Subject: [PATCH 10/10] Updated the scanner process definition. --- laborchestrator/vu_lab/processes/scanner_process.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/laborchestrator/vu_lab/processes/scanner_process.py b/laborchestrator/vu_lab/processes/scanner_process.py index b230afd..a8c9982 100644 --- a/laborchestrator/vu_lab/processes/scanner_process.py +++ b/laborchestrator/vu_lab/processes/scanner_process.py @@ -22,13 +22,15 @@ def __init__( frequency: float = FREQUENCY, ): super().__init__( - priority=priority, num_plates=num_beds, process_name="Vu Test Process" + priority=priority, num_plates=num_beds, process_name="Scanner process" ) self.duration = duration self.frequency = frequency def init_service_resources(self): super().init_service_resources() + self.container = self.containers[0] + self.container.set_start_position(self.hotel1, 1) def process(self):