|
@@ -25,8 +25,8 @@ class DropoffGrade:
|
|
|
self.position = (x, y, z)
|
|
self.position = (x, y, z)
|
|
|
|
|
|
|
|
class RobotController:
|
|
class RobotController:
|
|
|
- def __init__(self):
|
|
|
|
|
- self.config = ConfigParser()
|
|
|
|
|
|
|
+ def __init__(self, config: ConfigParser):
|
|
|
|
|
+ self.config = config
|
|
|
self.devices = self.config.get_devices()
|
|
self.devices = self.config.get_devices()
|
|
|
self.feeder = self.config.get_feeder()
|
|
self.feeder = self.config.get_feeder()
|
|
|
self.dropoff_grades = self.config.get_dropoff_grades()
|
|
self.dropoff_grades = self.config.get_dropoff_grades()
|
|
@@ -77,7 +77,8 @@ class RobotController:
|
|
|
logger.error("Gripper not occupied")
|
|
logger.error("Gripper not occupied")
|
|
|
return
|
|
return
|
|
|
slot.occupied = True
|
|
slot.occupied = True
|
|
|
- slot.cell_id = cell
|
|
|
|
|
|
|
+ slot.cell_id = cell.id
|
|
|
|
|
+ self.gripper_occupied = False
|
|
|
logger.info(f"Cell {cell.id} inserted to slot at position {slot.position}")
|
|
logger.info(f"Cell {cell.id} inserted to slot at position {slot.position}")
|
|
|
# Move to slot and insert cell
|
|
# Move to slot and insert cell
|
|
|
pass
|
|
pass
|
|
@@ -85,12 +86,14 @@ class RobotController:
|
|
|
async def collect_cell_from_slot(self, slot: SlotConfig):
|
|
async def collect_cell_from_slot(self, slot: SlotConfig):
|
|
|
if self.gripper_occupied:
|
|
if self.gripper_occupied:
|
|
|
logger.error("Gripper already occupied")
|
|
logger.error("Gripper already occupied")
|
|
|
- return
|
|
|
|
|
|
|
+ return None
|
|
|
# Collect cell from measurement slot
|
|
# Collect cell from measurement slot
|
|
|
|
|
+ self.gripper_occupied = True
|
|
|
slot.occupied = False
|
|
slot.occupied = False
|
|
|
|
|
+ cell_id = slot.cell_id
|
|
|
slot.cell_id = None
|
|
slot.cell_id = None
|
|
|
logger.info(f"Cell {slot.cell_id} collected from slot at position {slot.position}")
|
|
logger.info(f"Cell {slot.cell_id} collected from slot at position {slot.position}")
|
|
|
- return slot.cell_id
|
|
|
|
|
|
|
+ return cell_id
|
|
|
|
|
|
|
|
async def sort_cell(self, cell: Cell):
|
|
async def sort_cell(self, cell: Cell):
|
|
|
if cell.status == CellStatus.FAILED:
|
|
if cell.status == CellStatus.FAILED:
|
|
@@ -100,6 +103,7 @@ class RobotController:
|
|
|
for name, grade in self.dropoff_grades.items():
|
|
for name, grade in self.dropoff_grades.items():
|
|
|
if cell.capacity >= grade.capacity_threshold:
|
|
if cell.capacity >= grade.capacity_threshold:
|
|
|
await self.dropoff_cell(cell, grade)
|
|
await self.dropoff_cell(cell, grade)
|
|
|
|
|
+ self.gripper_occupied = False
|
|
|
logger.info(f"Cell {cell.id} sorted to grade {name}")
|
|
logger.info(f"Cell {cell.id} sorted to grade {name}")
|
|
|
return
|
|
return
|
|
|
logger.error(f"No suitable grade found for cell {cell.id} with capacity {cell.capacity}")
|
|
logger.error(f"No suitable grade found for cell {cell.id} with capacity {cell.capacity}")
|