Packing stations refactor
This commit is contained in:
parent
3ae78c6ee5
commit
d0cde0beab
@ -102,9 +102,9 @@ class ForkliftAgent(AgentBase):
|
|||||||
packing_station: GridLocation = None
|
packing_station: GridLocation = None
|
||||||
stations = dict(self.graph.packingStations)
|
stations = dict(self.graph.packingStations)
|
||||||
if i.real_type == ItemType.SHELF:
|
if i.real_type == ItemType.SHELF:
|
||||||
packing_station = stations[PatchType.packingA]
|
packing_station = stations[PatchType.packingShelf]
|
||||||
elif i.real_type == ItemType.REFRIGERATOR:
|
elif i.real_type == ItemType.REFRIGERATOR:
|
||||||
packing_station = stations[PatchType.packingB]
|
packing_station = stations[PatchType.packingRefrigerator]
|
||||||
elif i.real_type == ItemType.DOOR:
|
elif i.real_type == ItemType.DOOR:
|
||||||
packing_station = stations[PatchType.packingC]
|
packing_station = stations[PatchType.packingC]
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ class PatchType(enum.Enum):
|
|||||||
item = 3
|
item = 3
|
||||||
wall = 4
|
wall = 4
|
||||||
diffTerrain = 5
|
diffTerrain = 5
|
||||||
packingA = 6
|
packingShelf = 6
|
||||||
packingB = 7
|
packingRefrigerator = 7
|
||||||
packingC = 8
|
packingDoor = 8
|
||||||
divider = 9
|
divider = 9
|
||||||
|
BIN
img/door_d.jpg
Normal file
BIN
img/door_d.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 30 KiB |
BIN
img/fridge_f.jpg
Normal file
BIN
img/fridge_f.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 23 KiB |
BIN
img/shelf_s.jpg
Normal file
BIN
img/shelf_s.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 35 KiB |
9
main.py
9
main.py
@ -51,6 +51,13 @@ def agent_portrayal(agent):
|
|||||||
portrayal = {"Shape": "img/okB00mer.png", "scale": 1.0, "Layer": 0}
|
portrayal = {"Shape": "img/okB00mer.png", "scale": 1.0, "Layer": 0}
|
||||||
elif agent.patch_type == PatchType.diffTerrain:
|
elif agent.patch_type == PatchType.diffTerrain:
|
||||||
portrayal = {"Shape": "img/puddle.png", "scale": 1.0, "Layer": 0}
|
portrayal = {"Shape": "img/puddle.png", "scale": 1.0, "Layer": 0}
|
||||||
|
elif agent.patch_type == PatchType.packingShelf:
|
||||||
|
portrayal = {"Shape": "img/shelf_s.jpg", "scale": 1.0, "Layer": 0}
|
||||||
|
elif agent.patch_type == PatchType.packingRefrigerator:
|
||||||
|
portrayal = {"Shape": "img/fridge_f.jpg", "scale": 1.0, "Layer": 0}
|
||||||
|
elif agent.patch_type == PatchType.packingDoor:
|
||||||
|
portrayal = {"Shape": "img/door_d.jpg", "scale": 1.0, "Layer": 0}
|
||||||
|
|
||||||
elif agent.patch_type == PatchType.divider:
|
elif agent.patch_type == PatchType.divider:
|
||||||
portrayal = \
|
portrayal = \
|
||||||
{"Shape": "rect",
|
{"Shape": "rect",
|
||||||
@ -83,7 +90,7 @@ if __name__ == '__main__':
|
|||||||
diagram = GridWithWeights(gridWidth, gridHeight)
|
diagram = GridWithWeights(gridWidth, gridHeight)
|
||||||
diagram.walls = [(6, 5), (6, 6), (6, 7), (6, 8), (2, 3), (2, 4), (3, 4), (4, 4), (6, 4)]
|
diagram.walls = [(6, 5), (6, 6), (6, 7), (6, 8), (2, 3), (2, 4), (3, 4), (4, 4), (6, 4)]
|
||||||
diagram.puddles = [(2, 2), (2, 5), (2, 6), (5, 4)]
|
diagram.puddles = [(2, 2), (2, 5), (2, 6), (5, 4)]
|
||||||
diagram.packingStations = [(PatchType.packingA, (4, 8)), (PatchType.packingB, (4, 6)), (PatchType.packingC, (4, 2))]
|
diagram.packingStations = [(PatchType.packingShelf, (4, 8)), (PatchType.packingRefrigerator, (4, 6)), (PatchType.packingDoor, (4, 2))]
|
||||||
|
|
||||||
grid = CanvasGrid(agent_portrayal, gridWidth, gridHeight, scale * gridWidth, scale * gridHeight)
|
grid = CanvasGrid(agent_portrayal, gridWidth, gridHeight, scale * gridWidth, scale * gridHeight)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user