Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -78,4 +77,4 @@ services:
network_mode: host

volumes:
pgdata:
pgdata:
3 changes: 3 additions & 0 deletions laborchestrator/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
jssp**.json
Schedule**
WFG**
6 changes: 6 additions & 0 deletions laborchestrator/platform_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,15 @@ sila_servers:
shaker_6_d_pos_:
capacity: 1

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
pythonlab_translation:
storage: LabwareStorageResource
movers: MoverServiceResource
shakers: ShakerServiceResource
scanners: ScannerResource
2 changes: 2 additions & 0 deletions laborchestrator/vu_lab/processes/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from .basic_process import BasicProcess
from .mini_process import MiniProcess
4 changes: 3 additions & 1 deletion laborchestrator/vu_lab/processes/basic_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__(
Expand All @@ -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(
Expand Down
45 changes: 45 additions & 0 deletions laborchestrator/vu_lab/processes/scanner_process.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
"""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="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):

resolution = 640
# Loop through all containers and scan them
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)
42 changes: 42 additions & 0 deletions laborchestrator/vu_lab/resources/scanner_resource.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
"""Duplicate this file and add/modify the missing parts to create a new resource"""

import logging
from pythonlab.resource import ServiceResource

DURATION = 10
FREQUENCY = 10
NUM_BEDS = 1
PRIORITY = 3


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: ServiceResource,
resolution: int,
**kwargs,
):
kwargs.update(
{
"fct": "scan",
"resolution": resolution,
}
)

print(f"==[ Scan invoked.")

Check warning on line 41 in laborchestrator/vu_lab/resources/scanner_resource.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Add replacement fields or use a normal string instead of an f-string.

See more on https://sonarcloud.io/project/issues?id=OSLA-project_VU-lab&issues=AZqhbMtQvNIN9y7uysNY&open=AZqhbMtQvNIN9y7uysNY&pullRequest=35
self.proc.add_process_step(self, [container], **kwargs)
38 changes: 38 additions & 0 deletions laborchestrator/vu_lab/wrappers/scanner_wrapper.py
Original file line number Diff line number Diff line change
@@ -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()
Loading