allenai / allenai/ai2thor

TimeoutError with multi-agent

Ouverte
#1,265 4 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
C#
Étoiles
1.8k
Forks
296
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

I'm trying to get top-down view with two agents in the scene using the following code.
```python
import random
import matplotlib.pyplot as plt
import prior
from ai2thor.controller import Controller
from ai2thor.platform import CloudRendering

NUM_AGENTS = 1

dataset = prior.load_dataset("procthor-10k")
scene = dataset["train"][0]

controller = Controller(platform=CloudRendering, scene=scene)

multi_agent_event = controller.step(dict(action='Initialize', agentCount=NUM_AGENTS))
event = controller.step(action="GetMapViewCameraProperties")
event = controller.step(action="AddThirdPartyCamera", **event.metadata["actionReturn"])

reachable_positions_ = controller.step(action="GetReachablePositions").metadata["actionReturn"]
reachable_positions = [(p["x"], p["y"], p["z"]) for p in reachable_positions_]

random.seed(42)
for i in range(NUM_AGENTS):
pos = random.choice(reachable_positions_)
controller.step(dict(action="Teleport", position=pos, agentId=i))

img = controller.last_event.events[0].third_party_camera_frames[-1][::-1, ...]
plt.imshow(img)
plt.show()
```

This code works as expected. However, I get the following `TimeoutError` for `NUM_AGENTS = 2`. Let me know how I can get this to work for 2 or more agents.

```
Traceback (most recent call last):
File "/opt/venv/lib/python3.10/site-packages/ai2thor/controller.py", line 979, in step
self.last_event = self.server.receive()
File "/opt/venv/lib/python3.10/site-packages/ai2thor/fifo_server.py", line 229, in receive
metadata, files = self._recv_message(
File "/opt/venv/lib/python3.10/site-packages/ai2thor/fifo_server.py", line 145, in _recv_message
header = self._read_with_timeout(
File "/opt/venv/lib/python3.10/site-packages/ai2thor/fifo_server.py", line 134, in _read_with_timeout
raise TimeoutError(f"Reading from AI2-THOR backend timed out (using {timeout}s) timeout.")
TimeoutError: Reading from AI2-THOR backend timed out (using 100.0s) timeout.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/ab/projects/ai2thor/multiagent_demo.py", line 25, in
controller.step(dict(action="Teleport", position=pos, agentId=i))
File "/opt/venv/lib/python3.10/site-packages/ai2thor/controller.py", line 997, in step
raise (TimeoutError if isinstance(e, TimeoutError) else RuntimeError)(
TimeoutError: Error encountered when running action {'action': 'Teleport', 'position': {'x': 2.75, 'y': 0.9009993672370911, 'z': 1.5}, 'agentId': 1, 'sequenceId': 9} in scene Procedural.
```

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.